def planned_success

bendtorch-core@0.1.0.0 · src/autograd/reduce_PROOF.bend:452

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/shape/LAWS.bend as ShapeLaws
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith
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/tensor/elementwise_PROOF.bend as ElementwiseProof
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

452def planned_success(+shape: Shape.Shape, tensor: Core.Tensor<shape>, +target: Shape.Shape,
453  result: Result<&2, &2, Shape.Error, Shape.BroadcastPlan>,
454  -sources: {ShapeLaws.planned_dimensions(target, shape, result) == (Shape.dimensions(target), Shape.dimensions(shape)) : List<&2, U32> & List<&2, U32>},
455  -built: {ShapeLaws.broadcast_built(result) == True{} : Bool},
456  -alignment: Shape.Broadcast<Shape.extents(target), Shape.extents(shape), Shape.extents(shape)>) ->
457  Laws.Success<Reduce.planned(shape, tensor, target, result)>:
458  match result:
459    case Fail{error}:
460      Laws.Success{Empty.absurd({False{} == True{} : Bool}, Arith.clash(built))}
461    case Done{+plan}:
462      fitted_success(shape, tensor, target, plan,
463        Layout.words_same(Shape.dimensions(Shape.output_shape(plan)), Shape.dimensions(shape)), {==},
464        ElementwiseProof.planned_output_dimensions(target, shape, plan, Shape.dimensions(shape), alignment, sources))

Uses (23)

Used by (1)