def reshape_decided

bendtorch-core@0.1.0.0 · src/tensor/transforms.bend:31

import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
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

31def reshape_decided(+input: Shape.Shape, +target: Shape.Shape, tensor: Core.Tensor<input>,
32  decision: Shape.BoolCase<Nat.is_eq(Shape.elements(input), Shape.elements(target))>) ->
33  Result<&2, &1, Error, Core.Dynamic>:
34  match decision:
35    case Shape.BFalse{equal}:
36      Fail{LayoutError{Layout.ElementCountMismatch{}}}
37    case Shape.BTrue{equal}:
38      Done{reshape_equal(input, target, tensor,
39        elements_equal(input, target, equal))}

Uses (11)

Used by (9)