2using System.Collections.Generic;
40 public override void Fill(
int nCount,
long hMem,
int nNumAxes = 1,
int nNumOutputs = 1,
int nNumChannels = 1,
int nHeight = 1,
int nWidth = 1)
42 m_log.
CHECK(nCount > 0,
"There is no data to fill!");
43 m_cuda.rng_uniform(nCount, 0, 1, hMem);
48 T[] rgData =
m_cuda.GetMemory(hMem);
49 int nDim = nCount / nNumOutputs;
51 m_log.
CHECK_GT(nDim, 0,
"The dimension must be greater than 0.");
53 for (
int i = 0; i < nNumOutputs; i++)
57 for (
int j = 0; j < nDim; j++)
59 int nIdx = i * nDim + j;
60 dfSum += (double)Convert.ChangeType(rgData[nIdx], typeof(
double));
63 for (
int j = 0; j < nDim; j++)
65 int nIdx = i * nDim + j;
66 double dfVal = (double)Convert.ChangeType(rgData[nIdx], typeof(
double)) / dfSum;
67 rgData[nIdx] = (T)Convert.ChangeType(dfVal, typeof(T));
71 m_cuda.SetMemory(hMem, rgData);
The Log class provides general output in text form.
void CHECK(bool b, string str)
Test a flag for true.
void CHECK_EQ(double df1, double df2, string str)
Test whether one number is equal to another.
void CHECK_GT(double df1, double df2, string str)
Test whether one number is greater than another.
The CudaDnn object is the main interface to the Low-Level Cuda C++ DLL.
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 values such that .
PositiveUnitballFiller(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 postive unitball distribution.
Specifies the filler parameters used to create each Filler.
int sparse
Specifies the sparcity value to use with the 'guassian' 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-...