Optimizer.apply_gradients(gradients: dict, parameters: dict)#

Apply the gradients to the parameters and return the updated parameters.

Can be used to update a model via model.update(opt.apply_gradients(grads, model)) which is precisely how Optimizer.update() is implemented.

  • gradients (dict) – A Python tree of gradients.

  • parameters (dict) – A Python tree of parameters. It can be a superset of the gradients. In that case the returned python tree will be of the same structure as the gradients.