def reduce_to

bendtorch-core@0.1.0.0 · src/autograd/reduce.bend:305

import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce
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

305# The contribution owner comes back unchanged next to the result. A target
306# that does not broadcast with the contribution fails with the planner's
307# broadcast error; a target whose broadcast with the contribution is larger
308# than the contribution (for example [2, 3] for a [3] contribution) fails with
309# NotReducible.
310def reduce_to(input: Core.Dynamic, +target: Shape.Shape) -> Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
311  Core.Packed{+shape, tensor} = input
312  planned(shape, tensor, target, Shape.broadcast_checked(target, shape))

Uses (7)

Used by (16)