mxnet
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
mshadow::Shape< dimension > Struct Template Reference

shape of a tensor More...

#include <tensor.h>

Collaboration diagram for mshadow::Shape< dimension >:
Collaboration graph

Public Member Functions

MSHADOW_XINLINE Shape (void)
 default constructor, do nothing More...
 
MSHADOW_XINLINE Shape (const Shape< kDimension > &s)
 constuctor More...
 
MSHADOW_XINLINE index_toperator[] (int idx)
 get corresponding index More...
 
MSHADOW_XINLINE const index_toperator[] (int idx) const
 get corresponding index More...
 
MSHADOW_XINLINE bool operator== (const Shape< kDimension > &s) const
 
MSHADOW_XINLINE bool operator!= (const Shape< kDimension > &s) const
 
MSHADOW_XINLINE Shape< 1 > FlatTo1D (void) const
 
MSHADOW_XINLINE Shape< 2 > FlatTo2D (void) const
 
MSHADOW_XINLINE index_t Size (void) const
 
MSHADOW_XINLINE index_t ProdShape (int dimstart, int dimend) const
 
MSHADOW_XINLINE Shape< kSubdimSubShape (void) const
 get subshape that takes off largest dimension v * More...
 
template<int dimstart, int dimend>
MSHADOW_XINLINE Shape< dimend-dimstart > Slice (void) const
 slice the shape from start to end More...
 

Public Attributes

index_t shape_ [kDimension]
 storing the dimension information More...
 

Static Public Attributes

static const int kDimension = dimension
 dimension of current shape More...
 
static const int kSubdim = dimension - 1
 dimension of current shape minus one More...
 

Detailed Description

template<int dimension>
struct mshadow::Shape< dimension >

shape of a tensor

Template Parameters
dimensiondimension of tensor

Constructor & Destructor Documentation

template<int dimension>
MSHADOW_XINLINE mshadow::Shape< dimension >::Shape ( void  )
inline

default constructor, do nothing

template<int dimension>
MSHADOW_XINLINE mshadow::Shape< dimension >::Shape ( const Shape< kDimension > &  s)
inline

constuctor

Member Function Documentation

template<int dimension>
MSHADOW_XINLINE Shape<1> mshadow::Shape< dimension >::FlatTo1D ( void  ) const
inline

flatten the tensor, return a 1D shape

Returns
the flat 1d shape
template<int dimension>
MSHADOW_XINLINE Shape<2> mshadow::Shape< dimension >::FlatTo2D ( void  ) const
inline

flatten the higher dimension to second dimension, return a 2D shape

Returns
the flat 2d shape
template<int dimension>
MSHADOW_XINLINE bool mshadow::Shape< dimension >::operator!= ( const Shape< kDimension > &  s) const
inline
Returns
whether two shape not equal
Parameters
sthe shape to compare against
template<int dimension>
MSHADOW_XINLINE bool mshadow::Shape< dimension >::operator== ( const Shape< kDimension > &  s) const
inline
Returns
whether two shape equals
Parameters
sthe shape to compare against
template<int dimension>
MSHADOW_XINLINE index_t& mshadow::Shape< dimension >::operator[] ( int  idx)
inline

get corresponding index

Parameters
idxdimension index
Returns
the corresponding dimension size
template<int dimension>
MSHADOW_XINLINE const index_t& mshadow::Shape< dimension >::operator[] ( int  idx) const
inline

get corresponding index

Parameters
idxdimension index
Returns
the corresponding dimension size
template<int dimension>
MSHADOW_XINLINE index_t mshadow::Shape< dimension >::ProdShape ( int  dimstart,
int  dimend 
) const
inline
Returns
product shape in [dimstart,dimend)
Parameters
dimstartstart dimension
dimendend dimension
template<int dimension>
MSHADOW_XINLINE index_t mshadow::Shape< dimension >::Size ( void  ) const
inline
Returns
number of valid elements
template<int dimension>
template<int dimstart, int dimend>
MSHADOW_XINLINE Shape<dimend - dimstart> mshadow::Shape< dimension >::Slice ( void  ) const
inline

slice the shape from start to end

Template Parameters
dimstartstart dimension
dimendend dimension
Returns
the sliced shape
template<int dimension>
MSHADOW_XINLINE Shape<kSubdim> mshadow::Shape< dimension >::SubShape ( void  ) const
inline

get subshape that takes off largest dimension v *

Returns
subshape

Member Data Documentation

template<int dimension>
const int mshadow::Shape< dimension >::kDimension = dimension
static

dimension of current shape

template<int dimension>
const int mshadow::Shape< dimension >::kSubdim = dimension - 1
static

dimension of current shape minus one

template<int dimension>
index_t mshadow::Shape< dimension >::shape_[kDimension]

storing the dimension information


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