# mlx.optimizers.OptimizerState — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# mlx.optimizers.OptimizerState

class mlx.optimizers.OptimizerState

  The optimizer state implements a recursively defined `collections.defaultdict`, namely a missing key in an optimizer state is an `OptimizerState`.

  Note

  `OptimizerState.get()` in contrast to a normal dictionary also sets the key to the `default` value if the `key` was not present in the dictionary.

  Methods

  `get`(key, default) | If `key` doesn't exist set its value to `default` and then return it.