How does backpropagation calculate gradients?
Reveal the answer and explore the explanation.
02EasyCoreHow does backpropagation calculate gradients?
Answer
EasyCore
How does backpropagation calculate gradients?
Answer
Applies chain rule to compute gradients of the loss with respect to parameters.
Practical example
Propagate output error through differentiable layers.
PythonRelated concept example
import torch
x = torch.tensor(3., requires_grad=True)
loss = x**2
loss.backward()
print(x.grad) # tensor(6.)Automatic differentiation applies the chain rule.
Reference: Further reading ↗