def scatter

bendtorch-core@0.1.0.0 · src/tensor/gather.bend:448

import bendtorch-core@0.1.0.0/src/tensor/gather.bend as Gather
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core

448# The backward of a planned index_select or gather: the gradient g of its
449# output, added into +0.0 words of the input's shape at the entries, PyTorch's
450# index_add and scatter_add. g comes back unchanged next to the result.
451def scatter(g: Core.Dynamic, +input: Shape.Shape, +plan: Plan, +entries: List<&2, U32>) -> Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
452  Core.Packed{+shape, tensor} = g
453  built(Backward{}, shape, input, plan, entries, tensor, Core.new(input, 0.0))

Uses (11)

Used by (1)