2using System.Collections.Generic;
76 m_log.
CHECK_EQ(nNumSpecs, 1,
"Output dimension specified by zoom factor OR shrink factor OR explicitly.");
80 m_log.
CHECK_LE(m_nPadBeg, 0,
"Only supports non-positive padding (cropping) for now.");
81 m_log.
CHECK_LE(m_nPadEnd, 0,
"Only supports non-positive padding (cropping) for now.");
91 m_nNum = colBottom[0].num;
92 m_nChannels = colBottom[0].channels;
93 m_nHeightIn = colBottom[0].height;
94 m_nWidthIn = colBottom[0].width;
96 m_nHeightInEff = m_nHeightIn + m_nPadBeg + m_nPadEnd;
97 m_nWidthInEff = m_nWidthIn + m_nPadBeg + m_nPadEnd;
102 m_log.
CHECK_GE(nZoomFactor, 1,
"The zoom factor must be positive.");
103 m_nHeightOut = m_nHeightInEff + (m_nHeightInEff ) * (nZoomFactor - 1);
104 m_nWidthOut = m_nWidthInEff + (m_nWidthInEff ) * (nZoomFactor - 1);
109 m_log.
CHECK_GE(nShrinkFactor, 1,
"The shrink factor must be positive.");
110 m_nHeightOut = (m_nHeightInEff - 1) / nShrinkFactor + 1;
111 m_nWidthOut = (m_nWidthInEff - 1) / nShrinkFactor + 1;
120 m_log.
FAIL(
"You must specify the zoom factor OR shrink factor OR explicit size.");
123 m_log.
CHECK_GT(m_nHeightInEff, 0,
"The height should be positive.");
124 m_log.
CHECK_GT(m_nWidthInEff, 0,
"The width should be positive.");
125 m_log.
CHECK_GT(m_nHeightOut, 0,
"The height should be positive.");
126 m_log.
CHECK_GT(m_nWidthOut, 0,
"The width should be positive.");
128 colTop[0].
Reshape(m_nNum, m_nChannels, m_nHeightOut, m_nWidthOut);
142 m_cuda.interp2(m_nNum * m_nChannels, colBottom[0].gpu_data, -m_nPadBeg, -m_nPadBeg, m_nHeightInEff, m_nWidthInEff, m_nHeightIn, m_nWidthIn, colTop[0].mutable_gpu_data, 0, 0, m_nHeightOut, m_nWidthOut, m_nHeightOut, m_nWidthOut,
false);
155 if (!rgbPropagateDown[0])
159 m_cuda.interp2(m_nNum * m_nChannels, colBottom[0].mutable_gpu_diff, -m_nPadBeg, -m_nPadBeg, m_nHeightInEff, m_nWidthInEff, m_nHeightIn, m_nWidthIn, colTop[0].gpu_diff, 0, 0, m_nHeightOut, m_nWidthOut, m_nHeightOut, m_nWidthOut,
true);
The Log class provides general output in text form.
void FAIL(string str)
Causes a failure which throws an exception with the desciptive text.
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.
void CHECK_LE(double df1, double df2, string str)
Test whether one number is less than or equal to another.
void CHECK_GE(double df1, double df2, string str)
Test whether one number is greater than or equal to another.
The BlobCollection contains a list of Blobs.
void SetDiff(double df)
Set all blob diff to the value specified.
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.
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.
CudaDnn< T > m_cuda
Specifies the CudaDnn connection to Cuda.
LayerParameter.LayerType m_type
Specifies the Layer type.
The InterpLayer changes the spatial resolution by bi-linear interpolation.
InterpLayer(CudaDnn< T > cuda, Log log, LayerParameter p)
The InterpLayer constructor.
override void LayerSetUp(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Setup the layer.
override void forward(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Forward computation.
override int ExactNumBottomBlobs
Returns the exact number of required bottom (input) Blobs: input.
override void Reshape(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Reshape the bottom (input) and top (output) blobs.
override int ExactNumTopBlobs
Returns the exact number of required top (output) Blobs: flatten
override void backward(BlobCollection< T > colTop, List< bool > rgbPropagateDown, BlobCollection< T > colBottom)
Computes the error gradient w.r.t. the concatenate inputs.
int? zoom_factor
Specifies the height of the output.
int? height
Specifies the height of the output.
int? width
Specifies the width of the output.
int pad_beg
Specifies the padding at the begin of the output.
int? shrink_factor
Specifies the shrink factor of the output.
int pad_end
Specifies the padding at the end of the output.
Specifies the base parameter for all layers.
InterpParameter interp_param
Returns the parameter set when initializing the LayerType.INTERP
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.beta namespace contains all beta stage layers.
The MyCaffe.param.beta parameters are used by the MyCaffe.layer.beta layers.
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-...