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')[源代码]

可变形卷积

参数
  • inp (Tensor) – 卷积运算的特征图。

  • weight (Tensor) – 卷积核。

  • offset (Tensor) – 可变形卷积层的输入坐标偏移,该张量的通道数要和可变形卷积的设置相同。

  • mask (Tensor) – 可变形卷积层的输入掩码,该张量的通道数要和可变形卷积的设置相同。

  • bias (Optional[Tensor]) – 添加到卷积结果中的偏置量(如果给定该值)

  • stride (Union[int, Tuple[int, int]]) – 二维卷积运算的步长。默认:1

  • padding (Union[int, Tuple[int, int]]) – 输入数据空域维度两侧的填充(padding)大小。仅支持填充0值。默认:0

  • dilation (Union[int, Tuple[int, int]]) – 二维卷积运算的空洞(dilation)。默认:1

  • groups (int) – number of groups into which the input and output channels are divided, so as to perform a grouped convolution. When groups is not 1, in_channels and out_channels must be divisible by groups, and the shape of weight should be (groups, out_channel // groups, in_channels // groups, height, width). Default: 1

  • conv_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.

返回类型

Tensor

返回

输出张量。