2using System.Collections.Generic;
19 List<Filler<T>> m_rgFillers =
new List<Filler<T>>();
20 List<bool> m_rgbRefill =
new List<bool>();
62 int num_top = colTop.
Count;
66 m_log.
CHECK(num_data_filler == 0 || num_data_filler == 1 || num_data_filler == num_top,
"Number of data fillers must be 0, 1 or equal to the number of tops: " + num_top.ToString() +
"; you specified " + num_data_filler.ToString() +
" data fillers.");
68 bool legacy_dims = (param.
num.Count > 0 || param.
channels.Count > 0 || param.
height.Count > 0 || param.
width.Count > 0) ?
true :
false;
74 m_log.
CHECK(param.
num.Count == 1 || param.
num.Count == num_top,
"Must specify 'num' once, or once per top blob (" + num_top.ToString() +
"); specified " + param.
num.Count.ToString() +
".");
75 m_log.
CHECK(param.
channels.Count == 1 || param.
channels.Count == num_top,
"Must specify 'channels' once, or once per top blob (" + num_top.ToString() +
"); specified " + param.
channels.Count.ToString() +
".");
76 m_log.
CHECK(param.
height.Count == 1 || param.
height.Count == num_top,
"Must specify 'height' once, or once per top blob (" + num_top.ToString() +
"); specified " + param.
height.Count.ToString() +
".");
77 m_log.
CHECK(param.
width.Count == 1 || param.
width.Count == num_top,
"Must specify 'width' once, or once per top blob (" + num_top.ToString() +
"); specified " + param.
width.Count.ToString() +
".");
87 m_rgbRefill =
new List<bool>();
88 m_rgFillers =
new List<Filler<T>>();
90 if (num_data_filler <= 1)
94 if (num_data_filler == 0)
97 filler_param.
value = 0;
106 m_rgbRefill.Add((filler_param.
type ==
"constant") ?
true :
false);
111 for (
int i=0; i<num_top; i++)
116 m_rgbRefill.Add((param.
data_filler[i].type ==
"constant") ?
true :
false);
120 for (
int i=0; i<num_top; i++)
124 int num = (int)((param.
num.Count == 1) ? param.
num[0] : param.
num[i]);
127 int width = (int)((param.
width.Count == 1) ? param.
width[0] : param.
width[i]);
128 colTop[i].
Reshape(num, channels, height, width);
132 int shape_index = (param.
shape.Count == 1) ? 0 : i;
142 for (
int i = 0; i < m_rgbRefill.Count; i++)
145 m_rgbRefill[i] =
true;
147 m_rgbRefill[i] = !m_rgbRefill[i];
171 for (
int i = 0; i < colTop.
Count; i++)
173 int filler_id = (m_rgFillers.Count > 1) ? i : 0;
175 if (m_rgbRefill[filler_id])
176 m_rgFillers[filler_id].Fill(colTop[i]);
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.
The BlobCollection contains a list of Blobs.
int Count
Returns the number of items in the collection.
void Reshape(int[] rgShape)
Reshapes all blobs in the collection to the given shape.
The CudaDnn object is the main interface to the Low-Level Cuda C++ DLL.
Abstract Filler class used to fill blobs with values.
The DummyDataLayer provides data to the Net generated by a Filler. This layer is initialized with the...
DummyDataLayer(CudaDnn< T > cuda, Log log, LayerParameter p)
The DummyDataLayer constructor.
override int ExactNumBottomBlobs
Returns 0 for data layers have no bottom (input) Blobs.
override void backward(BlobCollection< T > colTop, List< bool > rgbPropagateDown, BlobCollection< T > colBottom)
Not implemented - data Layers do not perform backward..
override void LayerSetUp(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Setup the layer.
override void Reshape(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Data layers have no bottoms, so reshaping is trivial.
override int MinTopBlobs
Returns the minimum number of required top (output) Blobs: data
override void forward(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Run the Forward computation, which fills the data into the top (output) Blobs.
An interface for the units of computation which can be composed into a Net.
Log m_log
Specifies the Log for output.
LayerParameter m_param
Specifies the LayerParameter describing the Layer.
double Forward(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Given the bottom (input) Blobs, this function computes the top (output) Blobs and the loss.
CudaDnn< T > m_cuda
Specifies the CudaDnn connection to Cuda.
static Layer< T > Create(CudaDnn< T > cuda, Log log, LayerParameter p, CancelEvent evtCancel, IXDatabaseBase db=null, TransferInput trxinput=null)
Create a new Layer based on the LayerParameter.
LayerParameter.LayerType m_type
Specifies the Layer type.
This layer produces N >= 1 top blobs. DummyDataParameter must specify 1 or shape fields,...
List< uint > width
DEPRECIATED - 4D dimensions, use 'shape' instead.
List< FillerParameter > data_filler
If 0 data fillers are specified, ConstantFiller
List< BlobShape > shape
Specifies the shape of the dummy data where: shape(0) = num shape(1) = channels shape(2) = height sha...
List< uint > num
DEPRECIATED - 4D dimensions, use 'shape' instead.
bool force_refill
(optional, default = true) Specifies whether to force refill the data (even constant data) as opposed...
List< uint > channels
DEPRECIATED - 4D dimensions, use 'shape' instead.
List< uint > height
>DEPRECIATED - 4D dimensions, use 'shape' instead.
Specifies the filler parameters used to create each Filler.
double value
Specifies the value used by 'constant' filler.
string type
Specifies the type of filler to use.
Specifies the base parameter for all layers.
DummyDataParameter dummy_data_param
Returns the parameter set when initialized with LayerType.DUMMYDATA
LayerType
Specifies the layer type.
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.layers namespace contains all layers that have a solidified code base,...
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-...