2using System.Collections.Generic;
44 public override void Fill(
int nCount,
long hMem,
int nNumAxes = 1,
int nNumOutputs = 1,
int nNumChannels = 1,
int nHeight = 1,
int nWidth = 1)
46 m_log.
CHECK(nCount > 0,
"There is no data to fill!");
50 m_log.
CHECK_GE(nSparse, -1,
"The sparse value should be >= -1.");
58 m_log.
CHECK_GE(nNumAxes, 1,
"The blob must have at least one axis.");
60 double dfNonZeroProbability = (double)nSparse / (
double)nNumOutputs;
61 T fNonZeroProbability = (T)Convert.ChangeType(dfNonZeroProbability, typeof(T));
63 m_randVec.Allocate(nCount);
64 m_cuda.rng_bernoulli(nCount, fNonZeroProbability, m_randVec.gpu_data);
65 m_cuda.mul(nCount, hMem, m_randVec.gpu_data, hMem);
The Log class provides general output in text form.
void CHECK(bool b, string str)
Test a flag for true.
void CHECK_GE(double df1, double df2, string str)
Test whether one number is greater than or equal to another.
The CudaDnn object is the main interface to the Low-Level Cuda C++ DLL.
The SyncedMemory manages the low-level connection between the GPU and host memory.
Abstract Filler class used to fill blobs with values.
FillerParameter m_param
Specifies the filler parameters.
CudaDnn< T > m_cuda
Specifies the CudaDnn instance used to communicate to the low-level Cuda Dnn DLL.
Log m_log
Specifies the output log.
Fills a Blob with Gaussian-distributed values .
GaussianFiller(CudaDnn< T > cuda, Log log, FillerParameter p)
Constructor.
override void Fill(int nCount, long hMem, int nNumAxes=1, int nNumOutputs=1, int nNumChannels=1, int nHeight=1, int nWidth=1)
Fill the memory with random numbers from a guassian distribution.
Specifies the filler parameters used to create each Filler.
int sparse
Specifies the sparcity value to use with the 'guassian' filler.
double mean
Specifies the mean value to use with the 'gaussian' filler.
double std
Specifies the standard deviation value to use with the 'gaussian' filler.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.common namespace contains common MyCaffe classes.
The MyCaffe.fillers namespace contains all fillers including the Filler class.
The MyCaffe.param namespace contains parameters used to create models.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...