law broadcast_to_replayed

bendtorch-core@0.1.0.0 · src/autograd/broadcast_pointwise_LAWS.bend:94

import bendtorch-core@0.1.0.0/src/autograd/broadcast_pointwise_LAWS.bend as BroadcastPointwiseLAWS
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
import bendtorch-core@0.1.0.0/src/autograd/broadcast.bend as Broadcast

94# The broadcast_to result is replayed: for every P, if P holds for every
95# result that hands back the input with its words and gives an output of the
96# plan's shape whose words are `cells`, then P holds for broadcast_to. The
97# output word at k is the input word at left_map(plan, k), whatever split of
98# the output into parallel halves the build takes, and the output is a
99# replayed tensor, so a later law about a replayed contribution, such as
100# reduce_to_fiber, applies to it.
101law broadcast_to_replayed:
102  for +shape: Shape.Shape
103  for +target: Shape.Shape
104  for +plan: Shape.BroadcastPlan
105  for planned: {Shape.broadcast_checked(shape, target) == Done{plan} : Result<&2, &2, Shape.Error, Shape.BroadcastPlan>}
106  for same: {Shape.dimensions(Shape.output_shape(plan)) == Shape.dimensions(target) : List<&2, U32>}
107  for +fill: F32
108  for +ops: List<&2, StorageLaws.Op>
109  for -fits: {Lifecycle.logical_length(Replayed.storage(shape, fill, ops)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}
110  for -P: Core.Dynamic & Result<&2, &1, Broadcast.Error, Core.Dynamic> -> Type
111  for h: BroadcastWith(plan, shape, fill, ops, P)
112  P(Broadcast.broadcast_to(Core.Packed{shape, Core.TTensor{Replayed.storage(shape, fill, ops), fits}}, target))

Uses (22)

Used by (0)

No other definition uses this definition.