|
mxnet
|
#include <layout.h>

Public Types | |
| using | LayoutDim = char |
| using | iterator = std::vector< LayoutDim >::const_iterator |
| using | reverse_iterator = std::vector< LayoutDim >::const_reverse_iterator |
Public Member Functions | |
| Layout () | |
| default constructor More... | |
| Layout (const std::string &layout) | |
| construct from a string. More... | |
| Layout (const Layout &s) | |
| copy constructor from another layout More... | |
| Layout (Layout &&src) | |
| move constructor from Layout More... | |
| Layout & | operator= (const Layout &src) |
| assignment from another layout. More... | |
| Layout & | operator= (Layout &&src) |
| assignment from rvalue of another layout. More... | |
| Layout & | operator= (const std::string &src) |
| assignment from string. More... | |
| bool | operator== (const Layout &s) const |
| bool | operator!= (const Layout &s) const |
| Layout | operator+ (const Layout &other) const |
| Append the current layout by another. More... | |
| void | swap (Layout &other) |
| Swap current object with other. More... | |
| bool | convertible (const Layout &dst) const |
| Two layouts are convertible only if they have same set of super-dimensions. e.g., NCHW, NCHW16c, NHWC are convertible between each other, but NCHW, CHW, OIHW are not. More... | |
| Layout | sublayout (size_t pos, size_t len) const |
Returns a sublayout which is the portion of the object that starts at dimension pos and spans len dimensions (or until the end of the layout, whichever comes first). More... | |
| Layout | reverse () const |
| Layout | split (LayoutDim dim, size_t target_pos, uint32_t size) const |
Split dim by size and put the sub-dimension to position target_pos. More... | |
| iterator | begin () const |
| iterator | end () const |
| reverse_iterator | rbegin () const |
| reverse_iterator | rend () const |
| size_t | ndim () const |
| std::string | at (size_t i) const |
The description of the i-th dimension. If it is a sub-dimension, the size will be returned as well, e.g., 16c. Otherwise a single character is returned, e.g., C. More... | |
| int32_t | indexof (LayoutDim dim) const |
| return the index of the input dimension. If it is not found in the layout or the layout is undefined, return -1. More... | |
| int64_t | subsizeof (LayoutDim dim) const |
| bool | contains (LayoutDim dim) const |
| Whether the layout contains a dimension. More... | |
| LayoutDim | operator[] (size_t i) const |
| bool | defined () const |
| const std::string & | name () const |
| void | Save (dmlc::JSONWriter *writer) const |
| Write layout in JSON format. More... | |
| void | Load (dmlc::JSONReader *reader) |
| Load layout from JSON. More... | |
Static Public Member Functions | |
| static bool | is_superdim (LayoutDim dim) |
| Check whether a given dimension is a super-dimension. More... | |
| static bool | is_subdim (LayoutDim dim) |
| Check whether a given dimension is a sub-dimension. More... | |
| static LayoutDim | to_superdim (LayoutDim dim) |
| Convert a given dimension to super-dimension. More... | |
| static LayoutDim | to_subdim (LayoutDim dim) |
| Convert a given dimension to sub-dimension. More... | |
| static const Layout & | Undef () |
| Return an undefined layout. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Layout &l) |
| allow output string of layout to ostream More... | |
| using nnvm::Layout::iterator = std::vector<LayoutDim>::const_iterator |
| using nnvm::Layout::LayoutDim = char |
| using nnvm::Layout::reverse_iterator = std::vector<LayoutDim>::const_reverse_iterator |
|
inline |
default constructor
|
inline |
construct from a string.
| layout | input in layout convention: upper case indicates a dimension and the corresponding lower case with factor size indicates the split dimension. return undefined layout if "__undef__" is passed. |
|
inline |
copy constructor from another layout
| s | the source layout |
|
inline |
move constructor from Layout
| src | the source layout |
|
inline |
The description of the i-th dimension. If it is a sub-dimension, the size will be returned as well, e.g., 16c. Otherwise a single character is returned, e.g., C.
| i | The position |
|
inline |
|
inline |
Whether the layout contains a dimension.
| dim | dimension to be checked. |
|
inline |
Two layouts are convertible only if they have same set of super-dimensions. e.g., NCHW, NCHW16c, NHWC are convertible between each other, but NCHW, CHW, OIHW are not.
| dst | the target layout |
|
inline |
|
inline |
|
inline |
return the index of the input dimension. If it is not found in the layout or the layout is undefined, return -1.
| dim | the input dimension. |
|
inlinestatic |
Check whether a given dimension is a sub-dimension.
| dim | input dimension |
|
inlinestatic |
Check whether a given dimension is a super-dimension.
| dim | input dimension |
|
inline |
Load layout from JSON.
| reader | JSONReader |
|
inline |
|
inline |
|
inline |
| s | the layout to compare against |
Append the current layout by another.
| other | the layout to be appended |
assignment from another layout.
| src | source layout |
assignment from rvalue of another layout.
| src | source layout |
|
inline |
assignment from string.
| src | source layout |
|
inline |
| s | the layout to compare against |
|
inline |
|
inline |
|
inline |
|
inline |
Write layout in JSON format.
| writer | JSONWriter |
Split dim by size and put the sub-dimension to position target_pos.
| dim | The source dimension to be split. It must be a super-dimension. |
| target_pos | The target position of the newly split sub-dimension. |
| size | size of the sub-dimension. |
|
inline |
Returns a sublayout which is the portion of the object that starts at dimension pos and spans len dimensions (or until the end of the layout, whichever comes first).
| pos | The start position. |
| len | The length of the sub-layout. |
|
inline |
| dim | the input super-dimension or sub-dimension. |
dim (if dim is a super-dimension), or the size of dim itself (if dim is a sub-dimension). Return -1 if dim is not in the layout or the layout is undefined.
|
inline |
Swap current object with other.
| other | another object to be swapped. |
Convert a given dimension to sub-dimension.
| dim | input dimension |
Convert a given dimension to super-dimension.
| dim | input dimension |
|
inlinestatic |
Return an undefined layout.
|
friend |
allow output string of layout to ostream
| os | the output stream |
| l | the layout |
1.8.13