mxnet
Public Member Functions | Public Attributes | List of all members
mxnet::Resource Struct Reference

Resources used by mxnet operations. A resource is something special other than NDArray, but will still participate. More...

#include <resource.h>

Collaboration diagram for mxnet::Resource:
Collaboration graph

Public Member Functions

 Resource ()
 default constructor More...
 
template<typename xpu , typename DType >
mshadow::Random< xpu, DType > * get_random (mshadow::Stream< xpu > *stream) const
 Get random number generator. More...
 
template<typename xpu , typename DType >
common::random::RandGenerator< xpu, DType > * get_parallel_random () const
 Get parallel random number generator. More...
 
template<typename xpu , int ndim>
mshadow::Tensor< xpu, ndim, real_tget_space (mshadow::Shape< ndim > shape, mshadow::Stream< xpu > *stream) const
 Get space requested as mshadow Tensor. The caller can request arbitrary size. More...
 
template<int ndim>
mshadow::Tensor< cpu, ndim, real_tget_host_space (mshadow::Shape< ndim > shape) const
 Get cpu space requested as mshadow Tensor. The caller can request arbitrary size. More...
 
template<typename xpu , int ndim, typename DType >
mshadow::Tensor< xpu, ndim, DType > get_space_typed (mshadow::Shape< ndim > shape, mshadow::Stream< xpu > *stream) const
 Get space requested as mshadow Tensor in specified type. The caller can request arbitrary size. More...
 
template<int ndim, typename DType >
mshadow::Tensor< cpu, ndim, DType > get_host_space_typed (mshadow::Shape< ndim > shape) const
 Get CPU space as mshadow Tensor in specified type. The caller can request arbitrary size. More...
 
void * get_space_internal (size_t size) const
 internal function to get space from resources. More...
 
void * get_host_space_internal (size_t size) const
 internal function to get cpu space from resources. More...
 

Public Attributes

ResourceRequest req
 The original request. More...
 
engine::VarHandle var
 engine variable More...
 
int32_t id
 identifier of id information, used for debug purpose More...
 
void * ptr_
 pointer to the resource, do not use directly, access using member functions More...
 

Detailed Description

Resources used by mxnet operations. A resource is something special other than NDArray, but will still participate.

Constructor & Destructor Documentation

mxnet::Resource::Resource ( )
inline

default constructor

Member Function Documentation

template<int ndim>
mshadow::Tensor<cpu, ndim, real_t> mxnet::Resource::get_host_space ( mshadow::Shape< ndim >  shape) const
inline

Get cpu space requested as mshadow Tensor. The caller can request arbitrary size.

Parameters
shapethe Shape of returning tensor.
Returns
the mshadow tensor requested.
Template Parameters
ndimthe number of dimension of the tensor requested.
void* mxnet::Resource::get_host_space_internal ( size_t  size) const

internal function to get cpu space from resources.

Parameters
sizeThe size of space.
Returns
The allocated space
template<int ndim, typename DType >
mshadow::Tensor<cpu, ndim, DType> mxnet::Resource::get_host_space_typed ( mshadow::Shape< ndim >  shape) const
inline

Get CPU space as mshadow Tensor in specified type. The caller can request arbitrary size.

Parameters
shapethe Shape of returning tensor
Returns
the mshadow tensor requested
Template Parameters
ndimthe number of dimnesion of tensor requested
DTyperequest data type
template<typename xpu , typename DType >
common::random::RandGenerator<xpu, DType>* mxnet::Resource::get_parallel_random ( ) const
inline

Get parallel random number generator.

Template Parameters
xputhe device type of random number generator.
DTypethe return type.
Returns
the parallel random number generator. for gpu, it is allocated on global memory.
template<typename xpu , typename DType >
mshadow::Random<xpu, DType>* mxnet::Resource::get_random ( mshadow::Stream< xpu > *  stream) const
inline

Get random number generator.

Parameters
streamThe stream to use in the random number generator.
Returns
the mshadow random number generator requested.
Template Parameters
xputhe device type of random number generator.
template<typename xpu , int ndim>
mshadow::Tensor<xpu, ndim, real_t> mxnet::Resource::get_space ( mshadow::Shape< ndim >  shape,
mshadow::Stream< xpu > *  stream 
) const
inline

Get space requested as mshadow Tensor. The caller can request arbitrary size.

This space can be shared with other calls to this->get_space. So the caller need to serialize the calls when using the conflicted space. The old space can get freed, however, this will incur a synchronization, when running on device, so the launched kernels that depend on the temp space can finish correctly.

Parameters
shapethe Shape of returning tensor.
streamthe stream of retruning tensor.
Returns
the mshadow tensor requested.
Template Parameters
xputhe device type of random number generator.
ndimthe number of dimension of the tensor requested.
void* mxnet::Resource::get_space_internal ( size_t  size) const

internal function to get space from resources.

Parameters
sizeThe size of the space.
Returns
The allocated space.
template<typename xpu , int ndim, typename DType >
mshadow::Tensor<xpu, ndim, DType> mxnet::Resource::get_space_typed ( mshadow::Shape< ndim >  shape,
mshadow::Stream< xpu > *  stream 
) const
inline

Get space requested as mshadow Tensor in specified type. The caller can request arbitrary size.

Parameters
shapethe Shape of returning tensor.
streamthe stream of retruning tensor.
Returns
the mshadow tensor requested.
Template Parameters
xputhe device type of random number generator.
ndimthe number of dimension of the tensor requested.

Member Data Documentation

int32_t mxnet::Resource::id

identifier of id information, used for debug purpose

void* mxnet::Resource::ptr_

pointer to the resource, do not use directly, access using member functions

ResourceRequest mxnet::Resource::req

The original request.

engine::VarHandle mxnet::Resource::var

engine variable


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