mxnet
Public Member Functions | List of all members
mshadow::Random< gpu, DType > Class Template Reference

GPU random number generator. More...

#include <random.h>

Collaboration diagram for mshadow::Random< gpu, DType >:
Collaboration graph

Public Member Functions

 Random (int seed)
 constructor of random engine More...
 
 ~Random (void) MSHADOW_THROW_EXCEPTION
 
void set_stream (Stream< gpu > *stream)
 set the stream of computation More...
 
void Seed (int seed)
 seed random number generator using this seed More...
 
void GetRandInt (const Tensor< gpu, 1, unsigned > &dst)
 get a set of random integers More...
 
template<int dim>
void SampleUniform (Tensor< gpu, dim, DType > *dst, DType a=0.0f, DType b=1.0f)
 generate data from uniform [a,b) More...
 
template<int dim>
void SampleGaussian (Tensor< gpu, dim, DType > *dst, DType mu=0.0f, DType sigma=1.0f)
 generate data from standard gaussian More...
 
template<int dim>
expr::ReshapeExp< Tensor< gpu, 1, DType >, DType, dim, 1 > gaussian (Shape< dim > shape, DType mu=0.0f, DType sigma=1.0f)
 return a temporal expression storing standard gaussian random variables the temporal tensor is only valid before next call of gaussian or uniform can be used as part of expression Caution: this means expression such as A = gaussian(s1) * gaussian(s2) will give invalid result, since second call of gaussian(s2) makes gaussian(s1) invalid A = gaussian(s1)*B+C; is correct; use one gaussian/uniform in each expression More...
 
template<int dim>
expr::ReshapeExp< Tensor< gpu, 1, DType >, DType, dim, 1 > uniform (Shape< dim > shape)
 return a temporal expression storing standard uniform [0,1) the temporal tensor is only valid before next call of gaussian or uniform can be used as part of expression Caution: this means expression such as A = gaussian(s1) * gaussian(s2) will give invalid result, since second call of gaussian(s2) makes gaussian(s1) invalid A = gaussian(s1)*B+C; is correct; use one gaussian/uniform in each expression More...
 

Detailed Description

template<typename DType>
class mshadow::Random< gpu, DType >

GPU random number generator.

Constructor & Destructor Documentation

template<typename DType >
mshadow::Random< gpu, DType >::Random ( int  seed)
inlineexplicit

constructor of random engine

Parameters
seedrandom number seed
template<typename DType >
mshadow::Random< gpu, DType >::~Random ( void  )
inline

Member Function Documentation

template<typename DType >
template<int dim>
expr::ReshapeExp<Tensor<gpu, 1, DType>, DType, dim, 1> mshadow::Random< gpu, DType >::gaussian ( Shape< dim >  shape,
DType  mu = 0.0f,
DType  sigma = 1.0f 
)
inline

return a temporal expression storing standard gaussian random variables the temporal tensor is only valid before next call of gaussian or uniform can be used as part of expression Caution: this means expression such as A = gaussian(s1) * gaussian(s2) will give invalid result, since second call of gaussian(s2) makes gaussian(s1) invalid A = gaussian(s1)*B+C; is correct; use one gaussian/uniform in each expression

Parameters
shapeshape of the tensor
mumean
sigmavariance
Returns
a temporal expression storing standard gaussian random variables
Template Parameters
dimdimension of tensor
template<typename DType >
void mshadow::Random< gpu, DType >::GetRandInt ( const Tensor< gpu, 1, unsigned > &  dst)
inline

get a set of random integers

template<typename DType >
template<int dim>
void mshadow::Random< gpu, DType >::SampleGaussian ( Tensor< gpu, dim, DType > *  dst,
DType  mu = 0.0f,
DType  sigma = 1.0f 
)
inline

generate data from standard gaussian

Parameters
dstdestination
mumean variable
sigmastandard deviation
Template Parameters
dimdimension of tensor
template<typename DType >
template<int dim>
void mshadow::Random< gpu, DType >::SampleUniform ( Tensor< gpu, dim, DType > *  dst,
DType  a = 0.0f,
DType  b = 1.0f 
)
inline

generate data from uniform [a,b)

Parameters
dstdestination
alower bound of uniform
bupper bound of uniform
Template Parameters
dimdimension of tensor
template<typename DType >
void mshadow::Random< gpu, DType >::Seed ( int  seed)
inline

seed random number generator using this seed

Parameters
seedseed of prng
template<typename DType >
void mshadow::Random< gpu, DType >::set_stream ( Stream< gpu > *  stream)
inline

set the stream of computation

Parameters
streamcomputation stream
template<typename DType >
template<int dim>
expr::ReshapeExp<Tensor<gpu, 1, DType>, DType, dim, 1> mshadow::Random< gpu, DType >::uniform ( Shape< dim >  shape)
inline

return a temporal expression storing standard uniform [0,1) the temporal tensor is only valid before next call of gaussian or uniform can be used as part of expression Caution: this means expression such as A = gaussian(s1) * gaussian(s2) will give invalid result, since second call of gaussian(s2) makes gaussian(s1) invalid A = gaussian(s1)*B+C; is correct; use one gaussian/uniform in each expression

Parameters
shapeshape of the tensor
Returns
a temporal expression storing standard uniform [0,1)
Template Parameters
dimdimension of tensor

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