!45347 [MS][DOC]export some primitive doc

Merge pull request !45347 from mengyuanli/code_docs_export_primitive
This commit is contained in:
i-robot 2022-11-10 09:04:27 +00:00 committed by Gitee
commit 7c0fb73222
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 53 additions and 52 deletions

View File

@ -132,6 +132,9 @@ MindSpore中 `mindspore.ops` 接口与上一版本相比,新增、删除和支
mindspore.ops.Adam
mindspore.ops.AdamWeightDecay
mindspore.ops.AdaptiveAvgPool2D
mindspore.ops.AdaptiveAvgPool3D
mindspore.ops.AdaptiveMaxPool2D
mindspore.ops.AdaptiveMaxPool3D
mindspore.ops.ApplyAdadelta
mindspore.ops.ApplyAdagrad
mindspore.ops.ApplyAdagradDA
@ -185,6 +188,7 @@ MindSpore中 `mindspore.ops` 接口与上一版本相比,新增、删除和支
:nosignatures:
:template: classtemplate.rst
mindspore.ops.AdjustHue
mindspore.ops.BoundingBoxDecode
mindspore.ops.BoundingBoxEncode
mindspore.ops.CheckValid

View File

@ -0,0 +1,8 @@
mindspore.ops.AdaptiveAvgPool3D
================================
.. py:class:: mindspore.ops.AdaptiveAvgPool3D(output_size)
三维自适应平均池化。
更多参考详见 :func:`mindspore.ops.adaptive_avg_pool3d`

View File

@ -0,0 +1,8 @@
mindspore.ops.AdaptiveMaxPool2D
===============================
.. py:class:: mindspore.ops.AdaptiveMaxPool2D(output_size)
二维自适应最大值池化。
更多参考详见 :func:`mindspore.ops.adaptive_max_pool2d`

View File

@ -0,0 +1,23 @@
mindspore.ops.AdjustHue
=======================
.. py:class:: mindspore.ops.AdjustHue()
调整 RGB 图像的色调。
.. note::
该运算是种将 RGB 图像转换为浮点表示的便捷方法。通过将图像转换为HSV色彩空间并移动色调通道中的强度来调整图像然后转换回原始数据模式。
当多个调整依次进行时尽量减少冗余转换的数量。
输入:
- **image** (Tensor) - 输入的Tensor。shape的最后一个维度的必须为3。dtype需要是float16或float32。Tensor的维度至少是3维。
- **delta** (Tensor) - 色调通道的添加值。dtype需要是float32。Tensor必须是0维的。
输出:
Tensor具有与 `image` 相同的shape和dtype。
异常:
- **TypeError** - 如果 `image``delta` 不是Tensor。
- **TypeError** - 如果 `image` 的dtype不是float32或float16。
- **TypeError** - 如果 `delta` 的dtype不是float32。
- **ValueError** - 如果 `image` 的维度低于3维。

View File

@ -132,6 +132,9 @@ Optimizer
mindspore.ops.Adam
mindspore.ops.AdamWeightDecay
mindspore.ops.AdaptiveAvgPool2D
mindspore.ops.AdaptiveAvgPool3D
mindspore.ops.AdaptiveMaxPool2D
mindspore.ops.AdaptiveMaxPool3D
mindspore.ops.ApplyAdadelta
mindspore.ops.ApplyAdagrad
mindspore.ops.ApplyAdagradDA
@ -185,6 +188,7 @@ Image Processing
:nosignatures:
:template: classtemplate.rst
mindspore.ops.AdjustHue
mindspore.ops.BoundingBoxDecode
mindspore.ops.BoundingBoxEncode
mindspore.ops.CheckValid

View File

@ -131,7 +131,7 @@ class AdjustHue(Primitive):
Inputs:
- **image** (Tensor): RGB image or images. The size of the last dimension must be 3.
the dtype is float16 or float32. At least 3-D.
the dtype is float16 or float32. At least 3-D.
- **delta** (Tensor): How much to add to the hue channel, the dtype is float32. Must be 0-D.
Output:
@ -139,9 +139,9 @@ class AdjustHue(Primitive):
Raises:
TypeError: If neither `image` nor `delta` is a tensor.
TypeError: If the dtype of image not float16 or float32.
TypeError: If the dtype of delta not float32.
ValueError: If image have at less than 3 dimensions.
TypeError: If the dtype of `image` is neither float16 nor float32.
TypeError: If the dtype of `delta` not float32.
ValueError: If the dimension of `image` is less than 3.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``

View File

@ -375,55 +375,9 @@ class AdaptiveAvgPool2D(AdaptiveAvgPool2DV1):
class AdaptiveMaxPool2D(Primitive):
r"""
AdaptiveMaxPool2D operation.
Applies a 2D adaptive max pooling over an input signal composed of several input planes.
This operator applies a 2D adaptive max pooling to an input signal composed of multiple input planes.
That is, for any input size, the size of the specified output is H x W.
The number of output features is equal to the number of input planes.
The input and output data format can be "NCHW" and "CHW". N is the batch size, C is the number of channels,
H is the feature height, and W is the feature width.
For max adaptive pool2d:
.. math::
\begin{align}
h_{start} &= floor(i * H_{in} / H_{out})\\
h_{end} &= ceil((i + 1) * H_{in} / H_{out})\\
w_{start} &= floor(j * W_{in} / W_{out})\\
w_{end} &= ceil((j + 1) * W_{in} / W_{out})\\
Output(i,j) &= {\max Input[h_{start}:h_{end}, w_{start}:w_{end}]}
\end{align}
Note:
In Ascend, the second output `argmax` is invalid, please ignore it.
Args:
output_size (Union[int, tuple]): The target output size is H x W.
ouput_size can be a tuple, or a single H for H x H, and H and W can be int or None
which means the output size is the same as the input.
return_indices (bool): If `return_indices` is True, the indices of max value would be output.
Default: False.
Inputs:
- **input_x** (Tensor) - The input of AdaptiveMaxPool2D, which is a 3D or 4D tensor,
with float16, float32 or float64 data type.
Outputs:
Tensor, with the same type as the `input_x`.
Shape of the output is `input_x_shape[:len(input_x_shape) - len(out_shape)] + out_shape`.
Raises:
TypeError: If `output_size` is not int or tuple.
TypeError: If `input_x` is not a tensor.
TypeError: If `return_indices` is not a bool.
TypeError: If dtype of `input_x` is not float16, float32 or float64.
ValueError: If `output_size` is a tuple and the length of `output_size` is not 2.
ValueError: If the dimension of `input_x` is not NCHW or CHW.
ValueError: If `output_size` is less than -1.
Refer to :func:`mindspore.ops.adaptive_max_pool2d` for more details.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``