def perm_axes

bendtorch@1.3.0.0 · tensor.bend:496

import bendtorch@1.3.0.0/tensor.bend as Tensor
import Base

496# reading s at every position of the permuted shape: axis d has s's size and s's stride of axis p[d]; the last first
497def perm_axes(p: List<&2, Nat>, +s: List<&2, Nat>, acc: List<&2, Ax>) -> List<&2, Ax>:
498  match p:
499    case Nil{}:
500      acc
501    case Con{+k, r}:
502      perm_axes(r, s, Ax{U32.from_nat(at1(s, k)), U32.from_nat(inner(s, k))} <> acc)

Uses (6)

Used by (1)