def transpose_decided

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

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

256def transpose_decided(+input: Shape.Shape, source: Core.Tensor<input>, +a: U32, +b: U32,
257  decision: Shape.BoolCase<Transpose.valid(input, a, b)>) ->
258  Core.Tensor<input> & Result<&2, &1, Error, Core.Dynamic>:
259  match decision:
260    case Shape.BFalse{equal}:
261      (source, Fail{LayoutError{Layout.AxisOutOfBounds{}}})
262    case Shape.BTrue{equal}:
263      permute_copy(input, source, Layout.transpose_axes(Shape.dimensions(input), a, b, 0))

Uses (14)

Used by (7)