def transposed_source

bendtorch-core@0.1.0.0 · src/tensor/transpose_PROOF.bend:177

import bendtorch-core@0.1.0.0/src/tensor/transpose_PROOF.bend as TransposePROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/axis_spec.bend as Axis
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout

177# What `permute_source(input, [1, 0], index)` computes once the input's
178# dimensions are known.
179def transposed_source(+dims: List<&2, U32>, +index: U32) -> Maybe<&2, U32>:
180  Layout.reference_source_coordinates(dims,
181    Axis.scatter(U32, Shape.rank_dimensions(dims), Shape.naturals([1, 0]),
182      Shape.words(Shape.digits(Shape.naturals(Axis.order(U32, dims, Shape.naturals([1, 0]))), U32.to_nat(index))), 0n))

Uses (11)

Used by (2)