mindspore.nn.optim_ex.Optimizer
- class mindspore.nn.optim_ex.Optimizer(params, defaults)[source]
Base class for all optimizers.
Warning
This is an experimental optimizer API that is subject to change. This module must be used with lr scheduler module in LRScheduler Class .
- Parameters
params (Union[list(Parameter), list(dict)]) – an iterable of
mindspore.Parameter
or dict. Specifies what Tensors should be optimized.defaults – (dict): a dict containing default values of optimization options (used when a parameter group doesn’t specify them).
- Raises
TypeError – If learning_rate is not one of int, float, Tensor.
TypeError – If element of parameters is neither Parameter nor dict.
TypeError – If weight_decay is neither float nor int.
ValueError – If weight_decay is less than 0.
ValueError – If learning_rate is a Tensor, but the dimension of tensor is greater than 1.
- Supported Platforms:
Ascend
GPU
CPU