Apache SINGA
A distributed deep learning platform .
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
mshadow::Tensor< Device, dimension > Struct Template Reference

general tensor More...

#include <tensor.h>

Inheritance diagram for mshadow::Tensor< Device, dimension >:
mshadow::expr::ContainerExp< Tensor< Device, dimension > > mshadow::expr::Exp< Tensor< Device, dimension >, type::kContainer > mshadow::TensorContainer< Device, dimension >

Public Member Functions

MSHADOW_XINLINE Tensor (void)
 default constructor
 
MSHADOW_XINLINE Tensor (const Shape< dimension > &shape)
 constructor from shape
 
MSHADOW_XINLINE Tensor (real_t *dptr, const Shape< dimension > &shape)
 constructor from data pointer and shape
 
MSHADOW_XINLINE Tensor< Device, 2 > FlatTo2D (void) const
 flatten the tensor to 2 dimension, collapse the higher dimensions together More...
 
MSHADOW_XINLINE Tensor< Device,
kSubdim
operator[] (index_t idx) const
 get a element of dimension - 1 More...
 
MSHADOW_XINLINE Tensor< Device,
dimension > 
Slice (index_t begin, index_t end) const
 slice the tensor in highest dimension [begin,end) More...
 
Tensor< Device, dimension > & operator= (real_t s)
 functions to fit expression template
 
template<typename E >
Tensor< Device, dimension > & operator= (const expr::Exp< E, expr::type::kMapper > &exp)
 functions to fit expression template
 
template<typename E >
Tensor< Device, dimension > & operator= (const expr::Exp< E, expr::type::kComplex > &exp)
 functions to fit expression template
 
- Public Member Functions inherited from mshadow::expr::ContainerExp< Tensor< Device, dimension > >
const TransposeExp< Tensor
< Device, dimension > > 
T (void) const
 transpose of a matrix More...
 
Tensor< Device, dimension > & operator+= (real_t s)
 operator overload
 
Tensor< Device, dimension > & operator+= (const Exp< E, etype > &exp)
 implementation of operator+=
 
Tensor< Device, dimension > & operator-= (real_t s)
 operator overload
 
Tensor< Device, dimension > & operator-= (const Exp< E, etype > &exp)
 implementation of operator-=
 
Tensor< Device, dimension > & operator*= (real_t s)
 operator overload
 
Tensor< Device, dimension > & operator*= (const Exp< E, etype > &exp)
 implementation of operator*=
 
Tensor< Device, dimension > & operator/= (real_t s)
 operator overload
 
Tensor< Device, dimension > & operator/= (const Exp< E, etype > &exp)
 implementation of operator/=
 
Tensor< Device, dimension > & __assign (real_t s)
 operator overload
 
Tensor< Device, dimension > & __assign (const Exp< E, type::kMapper > &exp)
 implementation of operator=, note that we can not define container = container
 
Tensor< Device, dimension > & __assign (const Exp< E, type::kComplex > &exp)
 implementation of operator=, note that we can not define container = container
 
- Public Member Functions inherited from mshadow::expr::Exp< Tensor< Device, dimension >, type::kContainer >
const Tensor< Device, dimension > & self (void) const
 
Tensor< Device, dimension > & refself (void)
 

Public Attributes

real_tdptr
 pointer to the data
 
Shape< dimension > shape
 shape of the tensor
 

Static Public Attributes

static const bool kDevCPU = Device::kDevCPU
 whether current type lies in cpu
 
static const int kSubdim = dimension - 1
 dimension of subtype
 

Detailed Description

template<typename Device, int dimension>
struct mshadow::Tensor< Device, dimension >

general tensor

Template Parameters
Devicewhich device the tensor is on
dimensiondimension of the tensor

Member Function Documentation

template<typename Device, int dimension>
MSHADOW_XINLINE Tensor<Device, 2> mshadow::Tensor< Device, dimension >::FlatTo2D ( void  ) const
inline

flatten the tensor to 2 dimension, collapse the higher dimensions together

Returns
tensor after flatten
template<typename Device, int dimension>
MSHADOW_XINLINE Tensor<Device, kSubdim> mshadow::Tensor< Device, dimension >::operator[] ( index_t  idx) const
inline

get a element of dimension - 1

Parameters
idxindex
Returns
the result tensor
template<typename Device, int dimension>
MSHADOW_XINLINE Tensor<Device, dimension> mshadow::Tensor< Device, dimension >::Slice ( index_t  begin,
index_t  end 
) const
inline

slice the tensor in highest dimension [begin,end)

Parameters
beginbegin position of slice
endend position of slice
Returns
tensor after slice

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