NEML2 1.4.0
|
The accessor containing all the information needed to access an item in a LabeledAxis
.
More...
The accessor containing all the information needed to access an item in a LabeledAxis
.
The accessor consists of an arbitrary number of item names. The last item name can be either a variable name or a sub-axis name. All the other item names are considered to be sub-axis names.
The LabeledAxisAccessor stores the item labels and does not resolve the actual layout of the item. This way an accessor can be used access the same variable from different tensor layouts.
The item names cannot contain whitespace, ".", ",", ";", or "/".
#include <LabeledAxisAccessor.h>
Public Types | |
using | iterator = c10::SmallVector<std::string>::iterator |
using | const_iterator = c10::SmallVector<std::string>::const_iterator |
Public Member Functions | |
LabeledAxisAccessor ()=default | |
~LabeledAxisAccessor () | |
template<typename... S> | |
LabeledAxisAccessor (const char *name, S &&... names) | |
template<typename... S> | |
LabeledAxisAccessor (const std::string &name, S &&... names) | |
template<typename Container , typename = std::enable_if_t<!std::is_convertible_v<Container, std::string>>> | |
LabeledAxisAccessor (const Container &c) | |
operator std::vector< std::string > () const | |
const c10::SmallVector< std::string > & | vec () const |
bool | empty () const |
size_t | size () const |
LabeledAxisAccessor | with_suffix (const std::string &suffix) const |
Append a suffix to the final item name. | |
LabeledAxisAccessor | append (const LabeledAxisAccessor &axis) const |
Append another accessor. | |
LabeledAxisAccessor | prepend (const LabeledAxisAccessor &axis) const |
Prepend another accessor. | |
LabeledAxisAccessor | slice (size_t n) const |
Remove the leading n items from the labels. | |
LabeledAxisAccessor | slice (size_t n1, size_t n2) const |
Extract out the labels from n1 to n2 . | |
LabeledAxisAccessor | remount (const LabeledAxisAccessor &axis, size_t n=1) const |
A combination of slice and prepend. | |
bool | start_with (const LabeledAxisAccessor &axis) const |
Check if this accessor begins with another accessor. | |
LabeledAxisAccessor | old () const |
Returns the "old" counterpart. | |
Iterators | |
Begin and end iterators for the underlying data. | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
using const_iterator = c10::SmallVector<std::string>::const_iterator |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
LabeledAxisAccessor append | ( | const LabeledAxisAccessor & | axis | ) | const |
Append another accessor.
|
inline |
|
inline |
bool empty | ( | ) | const |
|
inline |
|
inline |
LabeledAxisAccessor old | ( | ) | const |
Returns the "old" counterpart.
|
explicit |
LabeledAxisAccessor prepend | ( | const LabeledAxisAccessor & | axis | ) | const |
Prepend another accessor.
LabeledAxisAccessor remount | ( | const LabeledAxisAccessor & | axis, |
size_t | n = 1 ) const |
A combination of slice and prepend.
size_t size | ( | ) | const |
LabeledAxisAccessor slice | ( | size_t | n | ) | const |
Remove the leading n
items from the labels.
LabeledAxisAccessor slice | ( | size_t | n1, |
size_t | n2 ) const |
Extract out the labels from n1
to n2
.
bool start_with | ( | const LabeledAxisAccessor & | axis | ) | const |
Check if this accessor begins with another accessor.
|
inline |
LabeledAxisAccessor with_suffix | ( | const std::string & | suffix | ) | const |
Append a suffix to the final item name.