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