scatter_add: Repeated target location must be highlighted

Multiple sources may point to the same target, for example, multiple sides of the map send messages to a node, or samples are assigned to the same statistical barrel.

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

Try to do it after reading

  • Hand is a thin-placed aggregation
  • Rebuttal source element gradient from output target

Suggested first

  • Python Basic Syntax:
  • Thick shape with Index

The graph tells us the same type of aggregation as the barrel count

Multiple sources may point to the same target, for example, multiple sides of the map send messages to a node, or samples are assigned to the same statistical barrel. scatter_add adds the source value to the target. This repeats the index here as a normal input for algorithms and not as a data error that should be deleted.

Source value [2,3,5], target index [0,1,1] and target vector initial value [0,0]. The first value is added to position 0, the second to position 1 and the third to position 0 and the final value [7,3]. If the coverage is changed to a given value, position 0 may leave only one of them in writing, and is no longer a message for peace.

Sets the subsequent mark loss L = out 02+ out 12. The output gradient is [14,6] and each source element reads the upstream gradient for the target to which it corresponds, so the source gradient is [14,6,14]. The same source value does not affect the mapping relationship; If the edge is still in place, the corresponding multipliers are counted in reverse.

High-dimensional scenes should identify scatter axes, index shape and source volume shape. The different APIs have their own compacts for broadcasting, downsizing and reverse support, and cannot be guided by a single-dimensional example of random mixing shape. Empty targets, cross-border indexes and non-initialised outputs must also be processed; The output used for the search for peace should normally start from zero.

The order of attribution of parallel floating point additions may affect the end of the position, and the realization of certain equipment also involves certainty limitations. Integer small examples are strictly equal to [7] and do not represent the true GPU float point aggregations which must be reciprocated. Validation should distinguish between the reasonable tolerance of the result of the algorithm and the obvious error caused by the different writing rules.

scatter_add sends the source elements to the specified target and adds them, and the initial target values are also involved in the final result. If the default target is fully zero, the error in clearing the existing status may be missed, and non-zero initial targets should be added. General loops could be used as a reference for small input, and then for comparison towards quantitative achievement; In particular, the testing of repeat targets is retained, avoiding the mixing of overlay errors with a completely different index.

Batch maps that combine nodes of the charts also require local target indexes to be offset by drawings. Forgetting that deviation would mix messages from different samples with the same node, although the index did not cross the border, semantics were already wrong.

Review with standard Python

out=[0,0]
for value,index in zip([2,3,5],[0,1,0]):out[index]+=value
assert out==[7,3]

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

Remove the third source value 5 or the same map?

No, position zero is missing a valid message and the result is two; To re-evaluate the index will throw away the source that needs to be accumulated.

Why are the two points of the source gradient of position zero 14?

The output local lead for each added number is 1 and they all inherit the same out 0 upstream gradient 14.

Sources and reconciliations

Definitions, methods and interfaces are available.

  1. PyTorch — Introduction to PyTorch Tensors
  2. torch.Tensor.scatter_add_

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.