make_optimizer
- opennmt.optimizers.make_optimizer(name, learning_rate, **kwargs)[source]
Creates the optimizer.
- Parameters
name – The name of the optimizer class in
tf.keras.optimizers.legacy
ortfa.optimizers
as a string.learning_rate – The learning rate or learning rate schedule to use.
**kwargs – Additional optimizer arguments. If
weight_decay
is set, the optimizer will be extended with decoupled weight decay.
- Returns
A
tf.keras.optimizers.legacy.Optimizer
instance.- Raises
ValueError – if
name
can not be resolved to an optimizer class.