def broadcast_to

bendtorch-core@0.1.0.0 · src/autograd/broadcast.bend:51

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

51# The input owner comes back unchanged next to the result. An incompatible
52# shape pair fails with the planner's broadcast error; a compatible pair whose
53# broadcast is larger than the target (for example [3] to [1]) fails with
54# NotBroadcastable.
55def broadcast_to(input: Core.Dynamic, +target: Shape.Shape) -> Core.Dynamic & Result<&2, &1, Error, Core.Dynamic>:
56  Core.Packed{+shape, tensor} = input
57  planned(Core.Packed{shape, tensor}, target, Shape.broadcast_checked(shape, target))

Uses (7)

Used by (12)