megengine.functional.nn.deformable_conv2d¶
- deformable_conv2d(inp, weight, offset, mask, bias=None, stride=1, padding=0, dilation=1, groups=1, conv_mode='cross_correlation', compute_mode='default')[source]¶
Deformable Convolution.
- Parameters
inp (
Tensor
) – input feature map.weight (
Tensor
) – convolution kernel. weight usually has shape(out_channels, in_channels, height, width)
.offset (
Tensor
) – input offset to kernel, channel of this tensor should match the deformable settings.mask (
Tensor
) – input mask to kernel, channel of this tensor should match the deformable settings.bias (
Optional
[Tensor
]) – bias added to the result of convolution (if given).stride (
Union
[int
,Tuple
[int
,int
]]) – stride of the 2D convolution operation. Default: 1padding (
Union
[int
,Tuple
[int
,int
]]) – size of the paddings added to the input on both sides of its spatial dimensions. Only zero-padding is supported. Default: 0dilation (
Union
[int
,Tuple
[int
,int
]]) – dilation of the 2D convolution operation. Default: 1groups (
int
) – number of groups into which the input and output channels are divided, so as to perform agrouped convolution
. Whengroups
is not 1,in_channels
andout_channels
must be divisible by groups, and the shape of weight should be(groups, out_channel // groups, in_channels // groups, height, width)
. Default: 1conv_mode – supports “cross_correlation”. Default: “cross_correlation”
compute_mode – when set to “default”, no special requirements will be placed on the precision of intermediate results. When set to “float32”, “float32” would be used for accumulator and intermediate result, but only effective when input and output are of float16 dtype.
- Return type
- Returns
output tensor.