def permutation_product

bendtorch-core@0.1.0.0 · src/tensor/axis_algebra.bend:3067

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

3067def permutation_product(+shape: Shape.Shape, +axes: List<&2, U32>, accepted: {True{} == Layout.bijective(shape, axes) : Bool}) ->
3068  {Shape.logical_numel(Axis.order(U32, Shape.dimensions(shape), Shape.naturals(axes))) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}:
3069  Equal.trans(Nat, Shape.logical_numel(Axis.order(U32, Shape.dimensions(shape), Shape.naturals(axes))),
3070    Shape.numel(Axis.order(Nat, Shape.naturals(Shape.dimensions(shape)), Shape.naturals(axes))), Shape.logical_numel(Shape.dimensions(shape)),
3071    Equal.cong(List<&2, Nat>, Nat, dims => Shape.numel(dims), Shape.naturals(Axis.order(U32, Shape.dimensions(shape), Shape.naturals(axes))),
3072      Axis.order(Nat, Shape.naturals(Shape.dimensions(shape)), Shape.naturals(axes)), order_naturals(Shape.naturals(axes), Shape.dimensions(shape))),
3073    facts_product(Shape.rank_dimensions(Shape.dimensions(shape)), Shape.naturals(axes), Shape.naturals(Shape.dimensions(shape)), Equal.sym(Nat, Shape.rank_dimensions(Shape.dimensions(shape)), List.length(&2, Nat, Shape.naturals(Shape.dimensions(shape))), Shape.rank_naturals(Shape.dimensions(shape))), shape_facts(shape, axes, accepted)))

Uses (20)

Used by (3)