Learn Before
Example

Example: Gradient of the Sum Function y=xiy = \sum x_i

Consider the scalar-valued sum function y=xiy = \sum x_i, which computes the sum of the elements of a vector x\mathbf{x}. The gradient of this function with respect to x\mathbf{x} is a vector of ones. When calculating this gradient in deep learning frameworks, it is often necessary to first reset or clear the gradient buffer to prevent the new gradient from accumulating with any previously stored gradients.

0

1

Updated 2026-05-02

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L