Caffe2 - C++ API
A deep learning, cross platform ML framework
deform_conv_op.cc
1 #include "caffe2/operators/deform_conv_op.h"
2 #include "caffe2/operators/conv_pool_op_base.h"
3 #include "caffe2/operators/deform_conv_op_impl.h"
4 
5 namespace caffe2 {
6 
7 OPERATOR_SCHEMA(DeformConv)
8  .NumInputs(3, 4)
9  .NumOutputs(1)
10  .TensorInferenceFunction(ConvPoolOpBase<CPUContext>::TensorInferenceForConv)
11  .SetDoc(R"DOC(
12 Deformable convolution operator consumes an input vector, the kernel offsets
13 blob, the filter blob and the bias blob and computes the output. Other
14 parameters, such as the stride and kernel size, or the pads' sizes in each
15 direction are not necessary for input because they are provided by the
16 ConvPoolOpBase operator. Various dimension checks are done implicitly, and the
17 sizes are specified in the Input docs for this operator. As is expected, the
18 filter is convolved with a subset of the image using the deformed kernel as
19 specified by offsets blob and the bias is added; this is done throughout the
20 image data and the output is computed.
21  )DOC")
22  .Input(
23  0,
24  "X",
25  "Input data blob from previous layer; has size "
26  "(N x C x H x W), where N is the batch size, C is the number of channels, and"
27  " H and W are the height and width. Note that this is for the NCHW usage. On "
28  "the other hand, the NHWC Op has a different set of dimension constraints.")
29  .Input(
30  1,
31  "offset",
32  "Offsets blob that specifies the deformed shape of the "
33  "kernel; consists of 2d offsets for each kernel element, one full set per "
34  "each output element; therefore has size (N x 2*kH*kW x H' x W') where N is "
35  "the batch size, kH and kW are the height and width of the kernel, H' and W' "
36  "are the output blob dimensions.")
37  .Input(
38  2,
39  "filter",
40  "The filter blob that will be used in the convolutions; "
41  "has size (M x C x kH x kW), where C is the number of channels, and kH and "
42  "kW are the height and width of the kernel.")
43  .Input(
44  3,
45  "bias",
46  "The 1D bias blob that is added through the convolution; "
47  "has size (M).")
48  .Output(
49  0,
50  "Y",
51  "Output data blob that contains the result of the "
52  "convolution. The output dimensions are functions of the kernel size, "
53  "stride size, and pad lengths."
54  "");
55 
56 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13