VJP: Why does reverse transmission not have to save the whole aberrics

The model layer may produce tens of thousands of numbers, but training ultimately requires only a marker of the gradient of the loss to the parameters.

• Step by stepCollate in 1 diagram2 self-measured2 First-hand sources
Start Body
Learning objectives and first steps2 objectives 2 first fixes

Try to do it after reading

  • Align shapes to mark vector output
  • Calculate the reverse result of the given upstream weight

Suggested first

  • Vector and Matrix Operations
  • Counts and chain rules

It's a lot of output. The target can still be small

The model layer may produce tens of thousands of numbers, but training ultimately requires only a marker of the gradient of the loss to the parameters. The RAM is large if you construct the full number of guides per output to each parameter. The reverse model uses the established upstream weights to calculate directly its local accompaniment and does not require the entire matrix to be left to users.

Definitions f : R ²→ R ², f(x₁,x₂) =( x ₁²+ x ₂,3 x ₁− x ₂)。 The output is placed in rows, the input is in column, and the Aberric J is 2x2 matrix. Remove x = (2,1) in the first line [4,1] and in the second line [3,−1]. This arrangement cannot be omitted, otherwise it's written in the book. v ᵀ J or J ᵀ v It's easy to be confused by the transposition symbol.

If the target is L =2 f ₁− f 2. Upstream weight v =(2,−1)。 The gradients for both inputs are 2 x 4−1 x 3 = 5 and 2 x 1 + 1 = 3. The result was therefore [5,3]. There is no unconditional attempt to reconcile the two outputs; v = [1,1] will be matched with another gradient [7,0] representing another target.

Inverse as J T v, as agreed by column vector, with shape as input dimension 2; Write v T J, which is consistent, as agreed by the vector. The frame provides a non-valued output of gradient or grad_outputs, which is essentially to determine the upstream weight. It does not require the user to provide the right answer, nor does it set a learning rate for each parameter.

One practical use is the multi-target sensitivity. If the output is forecast for two windows, the input lead for the group target can be calculated by giving the given window weights, instead of constructing the complete accompaniment of all windows. However, weights must correspond to the output, and the sequence of broadcasts or wrong axes changes the target. For a sample, the independence of the batch dimension is also determined by the computational chart, and the volume of shape alone cannot be assumed to be a fractional angle of the aberration.

Can be expanded independently L =2 x ₁²−3 x ₁+3 x Two, direct guidance from it. x 1 = 2 obtained [5,3], reconciled with multiplier results. This test does not require GPU. When further using the high-level lead, confirm whether the first lead is kept in microcharts; Keeping the gradient value is not the same as keeping the gradient's calculation chart. A vector of a relatively comparable volume synthesizes the upstream weights of multiple outputs into the input lead. If the upstream vector is derived from a loss, it must be consistent with the output shape and cannot be applied directly to any array of elements.

Alberline and upstream weightsTwo rows with four-one and three-six-one, multiplied by two-by-one upstream weights and one-by-one, plus five-three columns.413−1× 2× −1[5, 3]Row output for J, column for input
Synthesizing the inverse weight of the two-dimensional function; There is no need to keep the whole Yakow as a training state.

Review with standard Python

J=[[4.,1.],[3.,-1.]]
v=[2.,-1.]
assert [sum(v[i]*J[i][j] for i in range(2)) for j in range(2)]==[5.,3.]

Only fixed arithmeticals and indexes are validated above and no framework training is called.

Do you know the "sole gradient" of vector output without the upper weight being passed?

No, no, no, no, no, no. Different upstream weights represent different output combinations and usually different input gradients.

What should v = [10] return?

Select only the lead for the first output and result is [4,1]. This is the first line of the current Yakuza, and the output and input dimensions still need to be separated.

Sources and reconciliations

Definitions, methods and interfaces are available.

  1. PyTorch — The Fundamentals of Autograd
  2. CS231n — Backpropagation, Intuitions

Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.

← Back to the knowledge directory
Ask Max Ask about this site
Ask Max ↗

Opening the assistant…

Paper figure

Photo comments

LEAVE A NOTE

About this photograph

Connecting to the discussion board…

    Comments become public after moderation. You can delete your own comments from this browser.
    No email is required. Clearing cookies prevents this browser from claiming earlier comments.

    MAX WANG / INDEX

    Find something

    Enter a keyword, or explore the directory below.