Apache SINGA
A distributed deep learning platform .
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
Public Member Functions | List of all members
mshadow::Random< cpu > Class Template Reference

CPU random number generator. More...

#include <tensor_random.h>

Public Member Functions

 Random (int seed)
 constructor of random engine More...
 
void Seed (int seed)
 seed random number generator using this seed More...
 
template<int dim>
void SampleUniform (Tensor< cpu, dim > &dst, real_t a=0.0f, real_t b=1.0f)
 generate data from uniform [a,b) More...
 
template<int dim>
void SampleGaussian (Tensor< cpu, dim > &dst, real_t mu=0.0f, real_t sigma=1.0f)
 generate data from standard gaussian More...
 
template<int dim>
expr::ReshapeExp< Tensor< cpu, 1 >
, dim, 1 > 
gaussian (Shape< dim > shape)
 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< cpu, 1 >
, 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<>
class mshadow::Random< cpu >

CPU random number generator.

Constructor & Destructor Documentation

mshadow::Random< cpu >::Random ( int  seed)
inline

constructor of random engine

Parameters
seedrandom number seed

Member Function Documentation

template<int dim>
expr::ReshapeExp<Tensor<cpu,1>,dim,1> mshadow::Random< cpu >::gaussian ( Shape< dim >  shape)
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
Template Parameters
dimdimension of tensor
template<int dim>
void mshadow::Random< cpu >::SampleGaussian ( Tensor< cpu, dim > &  dst,
real_t  mu = 0.0f,
real_t  sigma = 1.0f 
)
inline

generate data from standard gaussian

Parameters
dstdestination
mumean variable
sigmastandard deviation
Template Parameters
dimdimension of tensor
template<int dim>
void mshadow::Random< cpu >::SampleUniform ( Tensor< cpu, dim > &  dst,
real_t  a = 0.0f,
real_t  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
void mshadow::Random< cpu >::Seed ( int  seed)
inline

seed random number generator using this seed

Parameters
seedseed of prng
template<int dim>
expr::ReshapeExp<Tensor<cpu,1>,dim,1> mshadow::Random< cpu >::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
Template Parameters
dimdimension of tensor

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