!36206 Fix the docs of deformable_conv2d

Merge pull request !36206 from YuJianfeng/code_docs
This commit is contained in:
i-robot 2022-06-20 10:34:43 +00:00 committed by Gitee
commit 412ba826ab
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 6 additions and 4 deletions

View File

@ -4,6 +4,7 @@ mindspore.ops.deformable_conv2d
.. py:function:: mindspore.ops.deformable_conv2d(x, weight, offsets, kernel_size, strides, padding, bias=None, dilations=(1, 1, 1, 1), groups=1, deformable_groups=1, modulated=True)
给定4D的Tensor输入 `x` `weight``offsets` 计算一个2D的可变形卷积。可变形卷积运算可以表达如下
可变形卷积v1
.. math::
@ -20,11 +21,11 @@ mindspore.ops.deformable_conv2d
- **x** (Tensor) - 一个四维Tensor表示输入图像。数据格式为"NCHW"shape为 :math:`(N, C_{in}, H_{in}, W_{in})` 。Dytpe为float16或float32。
- **weight** (Tensor) - 一个四维Tensor表示可学习的滤波器。数据类型必须与 `x` 相同shape为 :math:`(C_{out}, C_{in} / groups, H_{f}, W_{f})`
- **offsets** (Tensor) - 一个四维Tensor存储x和y坐标的偏移以及可变形卷积的输入掩码mask。数据格式为"NCHW"shape为 :math:`(batch, 3 * deformable_groups * H_{f} * W_{f}, H_{out}, W_{out})` 注意其中C维度的存储顺序为(offset_x, offset_y, mask)。数据类型必须与 `x` 相同。
- **offsets** (Tensor) - 一个四维Tensor存储x和y坐标的偏移以及可变形卷积的输入掩码mask。数据格式为"NCHW"shape为 :math:`(batch, 3 * deformable\_groups * H_{f} * W_{f}, H_{out}, W_{out})` 注意其中C维度的存储顺序为(offset_x, offset_y, mask)。数据类型必须与 `x` 相同。
- **kernel_size** (tuple[int]) - 一个包含两个整数的元组,表示卷积核的大小。
- **strides** (tuple[int]) - 一个包含四个整数的元组,表示对于输入的每个维度的滑动窗口步长。其维度顺序依据 `x` 的数据格式对应N和C维度的值必须设置成1。
- **padding** (tuple[int]) - 一个包含四个整数的元组,表示沿(上,下,左,右)四个方向往输入填充的像素点个数。
- **bias** (Tensor, 可选) - 一个一维Tensor表示加到卷积输出的偏置参数。shape为 :math:`(out_channels)` 。默认值为None。
- **bias** (Tensor, 可选) - 一个一维Tensor表示加到卷积输出的偏置参数。shape为 :math:`(out\_channels)` 。默认值为None。
- **dilations** (tuple[int], 可选) - 一个包含四个整数的元组,表示对于输入的每个维度的膨胀系数。其维度顺序依据 `x` 的数据格式对应N和C维度的值必须设置成1。默认值为(1, 1, 1, 1)。
- **groups** (int, 可选) - 一个int32类型的整数表示从输入通道到输出通道的阻塞连接数。输入通道数和输出通道数必须都能被 `groups` 整除。默认值为1。
- **deformable_groups** (int, 可选) - 一个int32类型的整数表示可变形卷积组数。输入通道数必须能被 `deformable_groups` 整除。默认值为1。

View File

@ -384,6 +384,7 @@ def deformable_conv2d(x, weight, offsets, kernel_size, strides, padding, bias=No
r"""
Given 4D tensor inputs `x`, `weight` and `offsets`, compute a 2D deformable convolution. The deformable convolution
operation can be expressed as follow:
Deformable Convolution v1:
.. math::
@ -404,7 +405,7 @@ def deformable_conv2d(x, weight, offsets, kernel_size, strides, padding, bias=No
weight (Tensor): A 4D tensor of learnable filters. Must have the same type as `x`.
The shape is :math:`(C_{out}, C_{in} / groups, H_{f}, W_{f})`.
offsets (Tensor): A 4D tensor of x-y coordinates offset and mask. With the format "NCHW",
the shape is :math:`(batch, 3 * deformable_groups * H_{f} * W_{f}, H_{out}, W_{out})`. Note the C dimension
the shape is :math:`(batch, 3 * deformable\_groups * H_{f} * W_{f}, H_{out}, W_{out})`. Note the C dimension
is stored in the order of (offset_x, offset_y, mask). Must have the same type as `x`.
kernel_size (tuple[int]): A tuple of 2 integers. The size of kernel.
strides (tuple[int]): A tuple of 4 integers. The stride of the sliding window for each dimension of
@ -413,7 +414,7 @@ def deformable_conv2d(x, weight, offsets, kernel_size, strides, padding, bias=No
padding (tuple[int]): A tuple of 4 integers. The number of pixels to add to each (top, bottom, left,
right) side of the input.
bias (Tensor, Optional): An 1D tensor of additive biases to the filter outputs.
The shape is :math:`(out_channels)`. Defaults to None.
The shape is :math:`(out\_channels)`. Defaults to None.
dilations (tuple[int], Optional): A tuple of 4 integers. The dilation factor for each dimension of input. The
dimension order is interpreted according to the data format of `x`. The N and C dimensions must be set
to 1. Defaults to (1, 1, 1, 1).