mxnet
Public Member Functions | List of all members
nnvm::TShape Class Reference

A Shape class that is used to represent shape of each tensor. More...

#include <tuple.h>

Inheritance diagram for nnvm::TShape:
Inheritance graph
Collaboration diagram for nnvm::TShape:
Collaboration graph

Public Member Functions

 TShape ()=default
 default constructor More...
 
 TShape (uint32_t ndim)
 
 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 >
 TShape (RandomAccessIterator begin, RandomAccessIterator end)
 construct the Tuple from content of iterator More...
 
TShapeoperator= (const Tuple< dim_t > &src)
 assignment function from tshape More...
 
TShapeoperator= (Tuple< dim_t > &&src)
 move assignment function from tshape More...
 
size_t Size () const
 
size_t ProdShape (int dimstart, int dimend) const
 
const dim_tdata () const
 
dim_tdata ()
 
- Public Member Functions inherited from nnvm::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_tbegin () const
 
dim_tbegin ()
 
const dim_tend () const
 
dim_tend ()
 
uint32_t ndim () const
 
dim_toperator[] (size_t i)
 get corresponding index More...
 
const dim_toperator[] (size_t 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 nnvm::Tuple< dim_t >
void SetDim (uint32_t ndim)
 
- Protected Attributes inherited from nnvm::Tuple< dim_t >
uint32_t ndim_
 number of dimension of the tuple More...
 
uint32_t 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_tdata_heap_
 space to store shape when dimension is big More...
 
- Static Protected Attributes inherited from nnvm::Tuple< dim_t >
static const uint32_t kStackCache
 

Detailed Description

A Shape class that is used to represent shape of each tensor.

Constructor & Destructor Documentation

nnvm::TShape::TShape ( )
default

default constructor

nnvm::TShape::TShape ( uint32_t  ndim)
inline

constructor to construct a shape with all 1.

Parameters
ndimthe number of dimension
nnvm::TShape::TShape ( const Tuple< dim_t > &  s)
inline

copy constructor of TShape

Parameters
ssource shape.
nnvm::TShape::TShape ( std::initializer_list< dim_t init)
inline

constructor from initializer list

Parameters
initthe initializer_list
nnvm::TShape::TShape ( Tuple< dim_t > &&  s)
inline

move constructor.

Parameters
ssource shape.
template<typename RandomAccessIterator >
nnvm::TShape::TShape ( RandomAccessIterator  begin,
RandomAccessIterator  end 
)
inline

construct the Tuple from content of iterator

Parameters
beginthe beginning of iterator
endend the end of the iterator
Template Parameters
RandomAccessIteratoriterator type

Member Function Documentation

const dim_t* nnvm::TShape::data ( ) const
inline
Returns
the begin data pointer to content of the tuple
dim_t* nnvm::TShape::data ( )
inline
Returns
the begin data pointer to content of the tuple
TShape& nnvm::TShape::operator= ( const Tuple< dim_t > &  src)
inline

assignment function from tshape

Parameters
srcsource shape.
Returns
self.
TShape& nnvm::TShape::operator= ( Tuple< dim_t > &&  src)
inline

move assignment function from tshape

Parameters
srcsource shape.
Returns
self.
size_t nnvm::TShape::ProdShape ( int  dimstart,
int  dimend 
) const
inline
Returns
product shape in [dimstart,dimend)
Parameters
dimstartstart dimension
dimendend dimension
size_t nnvm::TShape::Size ( void  ) const
inline
Returns
total number of elements in the shape

The documentation for this class was generated from the following file: