oa::MatrixShape

— dimensions of an oa::Matrix (OA's N-D array), rank up to OA_MAX_TENSOR_DIMS. Construct with brace-init for any rank: MatrixShape{m, n} // rank-2 MatrixShape{n, c, h, w} // rank-4 (e.g. conv NCHW) The variadic constructor keeps brace initialization without importing the hosted initializer-list or exception runtime.

Public Methods

oa::Result<MatrixShape> oa::MatrixShape::broadcast(const MatrixShape & inOther)
Array<oa::I64, OA_MAX_TENSOR_DIMS> oa::MatrixShape::broadcastStrides(const MatrixShape & inOut)
oa::I64 oa::MatrixShape::numElements()
bool oa::MatrixShape::operator!=(const MatrixShape & inOther)
bool oa::MatrixShape::operator==(const MatrixShape & inOther)
oa::I64 & oa::MatrixShape::operator[](oa::I32 inDim)
oa::I64 oa::MatrixShape::operator[](oa::I32 inDim)
oa::I64 oa::MatrixShape::stride(oa::I32 inDim)

Public Data Members

dimsArrayfield
rankoa::I32field

Constructor & Destructor Documentation

oa::MatrixShape::MatrixShape()
No public source comment is attached to this declaration.
oa::MatrixShape::MatrixShape( First inFirst, Rest... inRest )
No public source comment is attached to this declaration.

Parameters

inFirst
First

inRest
Rest...

Public Method Documentation

oa::Result<MatrixShape> oa::MatrixShape::broadcast( const MatrixShape & inOther )
NumPy-style broadcast: align right, max dims, error if incompatible.

Parameters

inOther
const MatrixShape &

Returns

oa::Result<MatrixShape>

The declared return value.

Array<oa::I64, OA_MAX_TENSOR_DIMS> oa::MatrixShape::broadcastStrides( const MatrixShape & inOut )
Compute broadcast strides for this shape against a broadcasted output shape. Returns row-major strides with 0 where this shape has a broadcasted dim (1 or absent).

Parameters

inOut
const MatrixShape &

Returns

Array<oa::I64, OA_MAX_TENSOR_DIMS>

The declared return value.

oa::I64 oa::MatrixShape::numElements()
No public source comment is attached to this declaration.

Returns

oa::I64

The declared return value.

bool oa::MatrixShape::operator!=( const MatrixShape & inOther )
No public source comment is attached to this declaration.

Parameters

inOther
const MatrixShape &

Returns

bool

The declared return value.

bool oa::MatrixShape::operator==( const MatrixShape & inOther )
No public source comment is attached to this declaration.

Parameters

inOther
const MatrixShape &

Returns

bool

The declared return value.

oa::I64 & oa::MatrixShape::operator[]( oa::I32 inDim )
No public source comment is attached to this declaration.

Parameters

inDim
oa::I32

Returns

oa::I64 &

The declared return value.

oa::I64 oa::MatrixShape::operator[]( oa::I32 inDim )
No public source comment is attached to this declaration.

Parameters

inDim
oa::I32

Returns

oa::I64

The declared return value.

oa::I64 oa::MatrixShape::stride( oa::I32 inDim )
Row-major: stride in elements for dimension inDim (product of later dims).

Parameters

inDim
oa::I32

Returns

oa::I64

The declared return value.