mxnet
|
A Shape class that is used to represent shape of each tensor. More...
#include <tuple.h>
Public Member Functions | |
TShape () | |
default constructor More... | |
TShape (const int ndim, const dim_t value) | |
TShape (const Tuple< dim_t > &s) | |
copy constructor of TShape More... | |
TShape (std::initializer_list< dim_t > init) | |
constructor from initializer list More... | |
TShape (Tuple< dim_t > &&s) | |
move constructor. More... | |
template<typename RandomAccessIterator , typename std::enable_if< std::is_same< typename std::iterator_traits< RandomAccessIterator >::iterator_category, std::random_access_iterator_tag >::value, int >::type = 0> | |
TShape (RandomAccessIterator begin, RandomAccessIterator end) | |
construct the Tuple from content of iterator. This function is enforced with template arguments of random access iterator types. This is necessary to distinguish from another constructor: TShape(const int, const dim_t). More... | |
TShape & | operator= (const Tuple< dim_t > &src) |
assignment function from tshape More... | |
TShape & | operator= (Tuple< dim_t > &&src) |
move assignment function from tshape More... | |
size_t | Size () const |
size_t | ProdShape (int dimstart, int dimend) const |
const dim_t * | data () const |
dim_t * | data () |
Public Member Functions inherited from mxnet::Tuple< dim_t > | |
Tuple ()=default | |
default constructor More... | |
Tuple (const Tuple< dim_t > &s) | |
copy constructor from another tuple More... | |
Tuple (std::initializer_list< dim_t > init) | |
constructor from initializer list More... | |
Tuple (std::vector< dim_t > init) | |
constructor from vector More... | |
Tuple (Tuple< dim_t > &&src) | |
move constructor from Tuple More... | |
Tuple (RandomAccessIterator begin, RandomAccessIterator end) | |
construct the Tuple from content of iterator More... | |
~Tuple () | |
destructor More... | |
void | assign (RandomAccessIterator begin, RandomAccessIterator end) |
Assign content to tuple from iterator. More... | |
void | swap (Tuple< dim_t > &other) |
Swap current object with other. More... | |
Tuple< dim_t > & | operator= (const Tuple< dim_t > &src) |
assignment from another tuple. More... | |
Tuple< dim_t > & | operator= (Tuple< dim_t > &&src) |
assignment from rvalue of another tuple. More... | |
Tuple< dim_t > & | operator= (std::initializer_list< dim_t > init) |
assignment from initializer list More... | |
bool | operator== (const Tuple< dim_t > &s) const |
bool | operator!= (const Tuple< dim_t > &s) const |
const dim_t * | begin () const |
dim_t * | begin () |
const dim_t * | end () const |
dim_t * | end () |
int | ndim () const |
dim_t & | operator[] (int i) |
get corresponding index More... | |
const dim_t & | operator[] (int i) const |
get corresponding index More... | |
void | Save (dmlc::JSONWriter *writer) const |
Save Tuple to JSON. More... | |
void | Save (TStream *strm) const |
save the content into binary stream More... | |
void | Load (dmlc::JSONReader *reader) |
Load Tuple from JSON. More... | |
bool | Load (TStream *strm) |
load the content from binary stream More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mxnet::Tuple< dim_t > | |
void | SetDim (int ndim) |
Protected Attributes inherited from mxnet::Tuple< dim_t > | |
int | ndim_ |
number of dimension of the tuple More... | |
int | num_heap_allocated_ |
number of cells allocated in data_heap_ More... | |
dim_t | data_stack_ [kStackCache] |
in stack space used to store shape when it is small More... | |
dim_t * | data_heap_ |
space to store shape when dimension is big More... | |
Static Protected Attributes inherited from mxnet::Tuple< dim_t > | |
static const int | kStackCache |
A Shape class that is used to represent shape of each tensor.
The ndim of a valid shape is an integer in range [-1, inf). ndim = -1 means the shape information is unknown and need to be inferred. ndim = 0 means the tensor with the shape is a scalar.
The dimension size of a valid shape is an integer in range [-1, inf). dim_size = -1 means the size of that dimension is unknown and need to be inferred. dim_size = 0 means that dimension is empty.
The definition of ndim = 0 and dim_size = 0 is consistent with NumPy.
|
inline |
default constructor
|
inline |
constructor to construct a shape with all value
.
ndim | the number of dimension |
value | the dimension size for all dims |
copy constructor of TShape
s | source shape. |
|
inline |
constructor from initializer list
init | the initializer_list |
|
inline |
construct the Tuple from content of iterator. This function is enforced with template arguments of random access iterator types. This is necessary to distinguish from another constructor: TShape(const int, const dim_t).
begin | the beginning of iterator |
end | end the end of the iterator |
RandomAccessIterator | iterator type |
|
inline |
|
inline |
assignment function from tshape
src | source shape. |
move assignment function from tshape
src | source shape. |
|
inline |
dimstart | start dimension |
dimend | end dimension |
|
inline |