PyTorch · Function
backward
Function.backward defines the reverse-mode gradient rule for a custom PyTorch operation. It receives output gradients and returns matching input gradients.
Last updated
Syntax
static Function.backward(ctx, *grad_outputs)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
torch.autograd.Functiontorch.autograd.function.BackwardCFunctionctx.needs_input_gradctx.saved_tensors