torch.optim.functional.sparse_adam#
- torch.optim.functional.sparse_adam(params, grads, exp_avgs, exp_avg_sqs, state_steps, *, eps, beta1, beta2, lr, maximize)[source]#
Functional API that performs SparseAdam algorithm computation.
This function updates the provided parameters and optimizer state in place. The caller must initialize and retain optimizer state. Unless intentionally constructing a differentiable update with a supported
differentiable=Trueargument, call this function undertorch.no_grad. See Functional optimizer API for the common functional optimizer contract and examples, andSparseAdamfor algorithm details.Note
state_stepsmust contain the current step value for each parameter. This function reads these values but does not increment them; the caller must increment each step before the corresponding update.