mxnet
Public Member Functions | Friends | List of all members
mxnet::cpp::Shape Struct Reference

dynamic shape class that can hold shape of arbirary dimension More...

#include <shape.h>

Collaboration diagram for mxnet::cpp::Shape:
Collaboration graph

Public Member Functions

 Shape ()
 constructor More...
 
 Shape (const std::vector< index_t > &v)
 constructor from a vector of index_t More...
 
 Shape (index_t s1)
 constructor one dimmension shape More...
 
 Shape (index_t s1, index_t s2)
 constructor two dimmension shape More...
 
 Shape (index_t s1, index_t s2, index_t s3)
 constructor three dimmension shape More...
 
 Shape (index_t s1, index_t s2, index_t s3, index_t s4)
 constructor four dimmension shape More...
 
 Shape (index_t s1, index_t s2, index_t s3, index_t s4, index_t s5)
 constructor five dimmension shape More...
 
 Shape (const Shape &s)
 constructor from Shape More...
 
 ~Shape ()
 destructor More...
 
template<typename RandomAccessIterator >
void CopyFrom (RandomAccessIterator begin, RandomAccessIterator end)
 copy shape from content betwen two iterators More...
 
Shapeoperator= (const Shape &shape)
 assignment from shape More...
 
Shapeoperator= (const std::vector< index_t > &shape)
 assignment from vector More...
 
const index_tdata () const
 
index_tdata ()
 
index_t ndim (void) const
 return number of dimension of the tensor inside More...
 
index_toperator[] (index_t i)
 get corresponding index More...
 
const index_toperator[] (index_t i) const
 get corresponding index More...
 
size_t Size (void) const
 total number of elements in the tensor More...
 
bool operator== (const Shape &s) const
 
bool operator!= (const Shape &s) const
 

Friends

std::ostream & operator<< (std::ostream &os, const Shape &shape)
 allow string printing of the shape More...
 
std::istream & operator>> (std::istream &is, Shape &shape)
 read shape from the istream More...
 

Detailed Description

dynamic shape class that can hold shape of arbirary dimension

Constructor & Destructor Documentation

mxnet::cpp::Shape::Shape ( )
inline

constructor

mxnet::cpp::Shape::Shape ( const std::vector< index_t > &  v)
inlineexplicit

constructor from a vector of index_t

Parameters
vthe vector
mxnet::cpp::Shape::Shape ( index_t  s1)
inlineexplicit

constructor one dimmension shape

Parameters
s1size of the first dimmension
mxnet::cpp::Shape::Shape ( index_t  s1,
index_t  s2 
)
inline

constructor two dimmension shape

Parameters
s1size of the first dimmension
s2size of the second dimmension
mxnet::cpp::Shape::Shape ( index_t  s1,
index_t  s2,
index_t  s3 
)
inline

constructor three dimmension shape

Parameters
s1size of the first dimmension
s2size of the second dimmension
s3size of the third dimmension
mxnet::cpp::Shape::Shape ( index_t  s1,
index_t  s2,
index_t  s3,
index_t  s4 
)
inline

constructor four dimmension shape

Parameters
s1size of the first dimmension
s2size of the second dimmension
s3size of the third dimmension
s4size of the fourth dimmension
mxnet::cpp::Shape::Shape ( index_t  s1,
index_t  s2,
index_t  s3,
index_t  s4,
index_t  s5 
)
inline

constructor five dimmension shape

Parameters
s1size of the first dimmension
s2size of the second dimmension
s3size of the third dimmension
s4size of the fourth dimmension
s5size of the fifth dimmension
mxnet::cpp::Shape::Shape ( const Shape s)
inline

constructor from Shape

Parameters
sthe source shape
mxnet::cpp::Shape::~Shape ( )
inline

destructor

Member Function Documentation

template<typename RandomAccessIterator >
void mxnet::cpp::Shape::CopyFrom ( RandomAccessIterator  begin,
RandomAccessIterator  end 
)
inline

copy shape from content betwen two iterators

Parameters
beginthe beginning of iterator
endthe end of the iterator
Template Parameters
RandomAccessIteratoriterator type
const index_t* mxnet::cpp::Shape::data ( ) const
inline
Returns
the data content of the shape
index_t* mxnet::cpp::Shape::data ( )
inline
Returns
the data content of the shape
index_t mxnet::cpp::Shape::ndim ( void  ) const
inline

return number of dimension of the tensor inside

bool mxnet::cpp::Shape::operator!= ( const Shape s) const
inline
Returns
whether two shape not equals
Parameters
sthe shape to compare against
Shape& mxnet::cpp::Shape::operator= ( const Shape shape)
inline

assignment from shape

Parameters
shapesource shape
Returns
reference of self
Shape& mxnet::cpp::Shape::operator= ( const std::vector< index_t > &  shape)
inline

assignment from vector

Parameters
shapesource shape
Returns
reference of self
bool mxnet::cpp::Shape::operator== ( const Shape s) const
inline
Returns
whether two shape equals
Parameters
sthe shape to compare against
index_t& mxnet::cpp::Shape::operator[] ( index_t  i)
inline

get corresponding index

Parameters
idimension index
Returns
the corresponding dimension size
const index_t& mxnet::cpp::Shape::operator[] ( index_t  i) const
inline

get corresponding index

Parameters
idimension index
Returns
the corresponding dimension size
size_t mxnet::cpp::Shape::Size ( void  ) const
inline

total number of elements in the tensor

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Shape shape 
)
friend

allow string printing of the shape

Parameters
osthe output stream
shapethe shape
Returns
the ostream
std::istream& operator>> ( std::istream &  is,
Shape shape 
)
friend

read shape from the istream

Parameters
isthe input stream
shapethe shape
Returns
the istream

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