mlx.optimizers.cosine_decay#
- cosine_decay(init: float, decay_steps: int, end: float = 0.0) Callable #
Make a cosine decay scheduler.
- Parameters:
Example
>>> lr_schedule = optim.cosine_decay(1e-1, 1000) >>> optimizer = optim.SGD(learning_rate=lr_schedule) >>> optimizer.learning_rate array(0.1, dtype=float32) >>> >>> for _ in range(5): optimizer.update({}, {}) ... >>> optimizer.learning_rate array(0.0999961, dtype=float32)