2using System.Collections.Generic;
71 m_nCount = colBottom[0].count();
73 for (
int i = 0; i < colTop.
Count; i++)
80 m_log.
CHECK(colTop[i].gpu_data != colBottom[0].gpu_data,
"Layer does not allow in-place computation.");
81 colTop[i].
ReshapeLike(colBottom[0], colBottom[0].HalfSize);
82 m_log.
CHECK_EQ(m_nCount, colTop[i].count(),
"The count should equal the top[i].count().");
97 int nCount = colBottom[0].count();
98 long hBottom = colBottom[0].gpu_data;
100 for (
int i = 0; i < colTop.
Count; i++)
102 m_cuda.copy(nCount, hBottom, colTop[i].mutable_gpu_data);
116 if (!rgbPropagateDown[0])
119 if (colTop.
Count == 1)
121 m_cuda.copy(m_nCount, colTop[0].gpu_diff, colBottom[0].mutable_gpu_diff);
125 m_cuda.add(m_nCount, colTop[0].gpu_diff, colTop[1].gpu_diff, colBottom[0].mutable_gpu_diff);
128 for (
int i = 2; i < colTop.
Count; i++)
130 long hTopDiff = colTop[i].gpu_diff;
131 long hBottomDiff = colBottom[0].mutable_gpu_diff;
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 ReshapeLike(BlobCollection< T > src)
Reshapes all blobs in the collection to the sizes of the source.
The CudaDnn object is the main interface to the Low-Level Cuda C++ DLL.
An interface for the units of computation which can be composed into a Net.
Log m_log
Specifies the Log for output.
T m_tOne
Specifies a generic type equal to 1.0.
bool m_bConvertBottom
Specifies whether or not the layer should convert the bottom when using half sized memory.
CudaDnn< T > m_cuda
Specifies the CudaDnn connection to Cuda.
LayerParameter.LayerType m_type
Specifies the Layer type.
The SplitLayer creates a 'split' path in the network by copying the bottom blob into multiple top blo...
SplitLayer(CudaDnn< T > cuda, Log log, LayerParameter p)
The SplitLayer constructor.
override int MinTopBlobs
Returns the minimum number of required top (output) Blobs: split
override void forward(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Computes the forward calculation copying the bottom Blobs with all of the top Blobs.
override void backward(BlobCollection< T > colTop, List< bool > rgbPropagateDown, BlobCollection< T > colBottom)
Computes the error gradient w.r.t the inputs.
override void Reshape(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Reshape the bottom (input) and top (output) blobs.
override void LayerSetUp(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Setup the layer.
override int ExactNumBottomBlobs
Returns the exact number of required bottom (input) Blobs: input.
Specifies the base parameter for all layers.
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.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-...