NEML2 2.1.0
Loading...
Searching...
No Matches
AxisLayout Struct Reference

#include <AxisLayout.h>

Public Types

enum class  IStructure : uint8_t { DENSE , BLOCK }
 Enum for the structure represented by intermediate dimensions (if any). More...

Public Member Functions

 AxisLayout ()=default
 AxisLayout (const std::vector< std::vector< VariableName > > &vars, std::vector< TensorShape > intmd_shapes, std::vector< TensorShape > base_shapes, std::vector< IStructure > istrs)
 Construct a new Axis Layout object.
 AxisLayout (const AxisLayout *parent, std::size_t group_idx, std::size_t start, std::size_t end, std::vector< std::size_t > offsets={})
 Construct a new Axis Layout object by viewing into a parent layout.
std::size_t ngroup () const
 Number of variable groups.
std::pair< std::size_t, std::size_t > group_offsets (std::size_t) const
 Starting and ending offsets of a variable group.
AxisLayout group (std::size_t) const
 Contiguous view of the variable group.
IStructure istr (std::size_t=0) const
 Variable group IStructure.
AxisLayout view () const
 Contiguous view of the entire layout.
bool is_view () const
 Whether this is a view into a parent layout.
std::size_t nvar () const
 Number of variables.
std::vector< Sizestorage_sizes (bool include_intmd) const
 Storage sizes of variables.
std::vector< VariableNamevars () const
 Accessor for variable names.
const VariableNamevar (std::size_t) const
 Accessor for variable name.
const TensorShapeintmd_sizes (std::size_t) const
 Accessor for variable intermediate shape.
const TensorShapebase_sizes (std::size_t) const
 Accessor for variable base shape.
void update_intmd_shapes (const std::vector< TensorShape > &)
 Update intermediate shapes.

Member Enumeration Documentation

◆ IStructure

enum class IStructure : uint8_t
strong

Enum for the structure represented by intermediate dimensions (if any).

Enumerator
DENSE 

All intermediate dimensions are grouped into base dimensions.

BLOCK 

Intermediate dimensions represent blocks of variables.

Constructor & Destructor Documentation

◆ AxisLayout() [1/3]

AxisLayout ( )
default

◆ AxisLayout() [2/3]

AxisLayout ( const std::vector< std::vector< VariableName > > & vars,
std::vector< TensorShape > intmd_shapes,
std::vector< TensorShape > base_shapes,
std::vector< IStructure > istrs )

Construct a new Axis Layout object.

Parameters
varsID-to-variable mapping, partitioned by variable groups
intmd_shapesID-to-variable intermediate shape mapping
base_shapesID-to-variable base shape mapping
istrsIStructure for each variable group

◆ AxisLayout() [3/3]

AxisLayout ( const AxisLayout * parent,
std::size_t group_idx,
std::size_t start,
std::size_t end,
std::vector< std::size_t > offsets = {} )

Construct a new Axis Layout object by viewing into a parent layout.

Parameters
parentThe axis layout this is viewing into
group_idxThe group index of the view
startThe starting offset of the view (inclusive)
endThe ending offset of the view (exclusive)
offsetsThe offsets of the variable groups in the view

Member Function Documentation

◆ base_sizes()

const TensorShape & base_sizes ( std::size_t ) const

Accessor for variable base shape.

◆ group()

AxisLayout group ( std::size_t ) const

Contiguous view of the variable group.

◆ group_offsets()

std::pair< std::size_t, std::size_t > group_offsets ( std::size_t ) const

Starting and ending offsets of a variable group.

◆ intmd_sizes()

const TensorShape & intmd_sizes ( std::size_t ) const

Accessor for variable intermediate shape.

◆ is_view()

bool is_view ( ) const
inline

Whether this is a view into a parent layout.

◆ istr()

IStructure istr ( std::size_t = 0) const

◆ ngroup()

std::size_t ngroup ( ) const

Number of variable groups.

◆ nvar()

std::size_t nvar ( ) const

Number of variables.

◆ storage_sizes()

std::vector< Size > storage_sizes ( bool include_intmd) const

Storage sizes of variables.

◆ update_intmd_shapes()

void update_intmd_shapes ( const std::vector< TensorShape > & )

Update intermediate shapes.

◆ var()

const VariableName & var ( std::size_t ) const

Accessor for variable name.

◆ vars()

std::vector< VariableName > vars ( ) const

Accessor for variable names.

◆ view()

AxisLayout view ( ) const

Contiguous view of the entire layout.