law reduce_to_fiber
bendtorch-core@0.1.0.0 · src/autograd/reduce_fold_LAWS.bend:75
import bendtorch-core@0.1.0.0/src/autograd/reduce_fold_LAWS.bend as ReduceFoldLAWS
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/tensor/contracts/LAWS.bend as Contracts
import bendtorch-core@0.1.0.0/src/autograd/reduce.bend as Reduce
import bendtorch-core@0.1.0.0/src/autograd/reduce_LAWS.bend as ReduceLaws
import bendtorch-core@0.1.0.0/src/autograd/reduce_fold.bend as ReduceFold
75
76
77
78
79
80
81law reduce_to_fiber:
82 for +target: Shape.Shape
83 for +shape: Shape.Shape
84 for +plan: Shape.BroadcastPlan
85 for planned: {Shape.broadcast_checked(target, shape) == Done{plan} : Result<&2, &2, Shape.Error, Shape.BroadcastPlan>}
86 for same: {Shape.dimensions(Shape.output_shape(plan)) == Shape.dimensions(shape) : List<&2, U32>}
87 for +fill: F32
88 for +ops: List<&2, StorageLaws.Op>
89 for -fits: {Lifecycle.logical_length(Replayed.storage(shape, fill, ops)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}
90 ReduceToContract<target, shape,
91 index => ReduceLaws.fiber(plan, Contracts.words(shape, fill, ops, Shape.logical_numel(Shape.dimensions(shape))),
92 index, Shape.logical_numel(Shape.dimensions(shape))),
93 other => Replayed.value(shape, fill, ops, other),
94 Reduce.reduce_to(Core.Packed{shape, Core.TTensor{Replayed.storage(shape, fill, ops), fits}}, target)>