Skip to content
masterclass Buddy

PyTorch · Class

optim.SGD

torch.optim.SGD updates parameters with stochastic gradient descent. It supports momentum, weight decay, Nesterov updates, objective maximization, and alternative implementations.

Last updated

Syntax

torch.optim.SGD(params, lr=0.001, momentum=0, dampening=0, weight_decay=0, nesterov=False, *, maximize=False, foreach=None, differentiable=False, fused=None)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • torch.optim.Optimizer
  • add_param_group
  • load_state_dict
  • torch.optim.sgd.sgd

Source: SGD — PyTorch 2.15 documentation. Checked 2026-11-03.