[−][src]Module melange::tensor::shape
shape
contains all the tools to complement typenum
crate and efficiently use it for shape "arithmetics".
As in typenum
, this module contains two kinds of unsafe traits:
- type operators that act like type-level functions on type-level entities,
- marker traits that provide functions to interact with type-level entities at runtime.
Type operators all share the Output associated type that contains the type-level result of the operation the trait represents.
Structs
Dyn | Zero-sized struct representing type-level dynamic dimension. It implements comparisons with type level unsigned integers and is considered equal to all of them. This involves Dyn is compatible with any dimension. |
Traits
At | Type operator that outputs the dimension at (0-starting) index Ax (a type-level unsigned integer) of the implementor shape. |
Broadcast | Binary trait operator that outputs B1 if the implementor shape can be broadcasted to Rhs. Broadcasting is valid if for all axes: |
Dim | Marker trait implemented on type-level unsigned integers and |
FitIn | Binary trait operator that outputs B1 if the implementor shape is fits in Rhs i.e. all the dimensions of the implementor are less or equal to the dimanesions on the respective axes of Rhs. |
If | Conditionnal trait operator: |
Insert | Type operator that inserts dimension S before the first axis.Abs
This is useful because dimensions are stored in reverse order in
the recursive |
NumElements | Marker trait implemented on static shapes that provides a type-level number of elements and its runtime counterpart. |
Reduction | Trait operator that replaces the dimension of the axis having the (0-starting) index Ax (a type-level unsigned integer) with U1. |
ReductionOptChunckSize | Trait operator that computes the intrinsic optimal chunk size i.e. the largest contiguous group of elements in storage after a reduction performed on the axis at (0-starting) index Ax (a type-level unsigned integer). |
ReprDim | Type operator that outputs the representative dimension of two compatible dimensions: |
ReprShape | Type operator that outputs the representative shape of two shapes which is defined as the collection of the representatives of all dimensions. |
ReprShapeDyn | Type operator that outputs the representative shape of two shapes which is defined as the collection of the representatives of all dimensions. |
Same | Binary trait operator that outputs B1 if the implementor shape is compatible with Rhs i.e. all the dimensions on the respective axes are compatible. |
SameNumElements | Binary trait operator that outputs B1 if the implementor shape and Rhs have the same number of elements i.e. the products of their dimensions are equal. |
Shape | Marker trait implemented on |
StaticDim | Marker trait implemented on type-level unsigned integers only that are the only valid type-level dimensions for a shape to be static. |
StaticShape | Marker trait implemented on shapes containing type-level unsigned integers only. Provides means of conversion for runtime use. |
StridedDim | Binary type operator that outputs B1 if the implementor dimension can be strided to Rhs. |
StridedShape | Binary type operator that outputs B1 if the implementor shape can be strided to Rhs i.e. all dimensions can be strided to the dimension on the respective axis of Rhs. |
StridedShapeDyn | Binary type operator that outputs B1 if the implementor shape can be strided to Rhs i.e. all dimensions can be strided to the dimension on the respective axis of Rhs. |
TRUE | This trait "aliases" B1 (type-level bit one) for use in trait bounds. It is especially useful with type-level binary operators. |
Transpose | Type operator that reverses the order of the axes in the implementor shape. |
Functions
intrinsic_strides_in_place |
Type Definitions
Shape1D | 1D shape alias. |
Shape2D | 2D shape alias. |
Shape3D | 3D shape alias. |
Shape4D | 4D shape alias. |
Shape5D | 5D shape alias. |
Shape6D | 6D shape alias. |