def planned_retains
bendtorch-core@0.1.0.0 · src/autograd/reduce_PROOF.bend:210
import bendtorch-core@0.1.0.0/src/autograd/reduce_PROOF.bend as ReducePROOF
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
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
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 Laws
210def planned_retains(+shape: Shape.Shape, tensor: Core.Tensor<shape>, +target: Shape.Shape,
211 result: Result<&2, &2, Shape.Error, Shape.BroadcastPlan>) ->
212 Laws.Retained<Core.Packed{shape, tensor}, Reduce.planned(shape, tensor, target, result)>:
213 match result:
214 case Fail{error}:
215 Laws.Retained{property => {==}}
216 case Done{+plan}:
217 fitted_retains(shape, tensor, target, plan,
218 Layout.words_same(Shape.dimensions(Shape.output_shape(plan)), Shape.dimensions(shape)))