!47813 modify format

Merge pull request !47813 from 俞涵/code_docs_1110
This commit is contained in:
i-robot 2023-01-12 09:23:07 +00:00 committed by Gitee
commit 106411e71e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 43 additions and 21 deletions

View File

@ -18,5 +18,5 @@ mindspore.get_grad
identifier所指定的求导输入位置的索引所对应的梯度值或者网络变量所对应的梯度值。
异常:
- **ValueError** - 无法找到identifier所对应的梯度值。
- **RuntimeError** - 无法找到identifier所对应的梯度值。
- **TypeError** - 入参类型不符合要求。

View File

@ -7,7 +7,7 @@ mindspore.nn.probability.distribution.StudentT
连续随机分布,取值范围为 :math:`(-\inf, \inf)` ,概率密度函数为
.. math::
f(x, \nu, \mu, \sigma) = (1 + y^2 / \nu)^(-0.5*(\nu + 1)) / Z
f(x, \nu, \mu, \sigma) = (1 + y^2 / \nu)^{(-0.5*(\nu + 1))} / Z
其中 :math:`y = (x - \mu) / \sigma`, :math:`Z = abs(\sigma) * \sqrt(\nu * \pi) * \Gamma(0.5 * \nu) / \Gamma(0.5 * (\nu + 1))`, :math:`\nu, \mu, \sigma` 为分别为StudentT分布的自由度期望与标准差。

View File

@ -0,0 +1,26 @@
mindspore.ops.PSROIPooling
==========================
.. py:class:: mindspore.ops.PSROIPooling(spatial_scale, group_size, output_dim)
对输入Tensor应用Position Sensitive ROI-Pooling。
参数:
- **spatial_scale** (float) - 将框坐标映射到输入坐标的比例因子。例如如果你的框定义在224x224的图像上并且你的输入是112x112的特征图由原始图像的0.5倍缩放产生此时需要将其设置为0.5。
- **group_size** (int) - 执行池化后输出的大小(以像素为单位),以(高度,宽度)的格式输出。
- **output_dim** (int) - 执行池化后输出的维度。
输入:
- **features** (Tensor) - 输入特征Tensor其shape必须为 :math:`(N, C, H, W)` 。 各维度的值应满足: :math:`(C == output\_dim * group\_size * group\_size)` 。数据类型为float16或者float32。
- **rois** (Tensor) - 其shape为 :math:`(batch, 5, rois_n)` 数据类型为float16或者float32。第一个维度的batch为批处理大小。第二个维度的大小必须为5。第三维度rois_n是rois的数量。rois_n的值格式为(index, x1, y1, x2, y2)。其中第一个元素是rois的索引。方框坐标格式为(x1、y1、x2、y2)之后将把这些方框的选中的区域提取出来。区域坐标必须满足0 <= x1 < x2和0 <= y1 < y2。
输出:
- **out** (Tensor) - 池化后的输出。其shape为 :math:`(rois.shape[0] * rois.shape[2], output\_dim, group\_size, group\_size)`
异常:
- **TypeError** - `spatial_scale` 不是float类型。
- **TypeError** - `group_size` 或者 `output_dim` 不是 int类型。
- **TypeError** - `features` 或者 `rois` 不是Tensor。
- **TypeError** - `rois` 数据类型不是float16或者float32。
- **ValueError** - `features` 的shape不满足 :math:`(C == output\_dim * group\_size * group\_size)`
- **ValueError** - `spatial_scale` 为负数。

View File

@ -6,7 +6,7 @@ mindspore.ops.rand_like
返回一个Tensorshape和dtype由输入决定其元素为服从均匀分布的 :math:`[0, 1)` 区间的数字。
参数:
- **x** (Tensor)输入的Tensor用来决定输出Tensor的shape和默认的dtype。
- **x** (Tensor) - 输入的Tensor用来决定输出Tensor的shape和默认的dtype。
- **seed** (int可选) - 随机种子必须大于或等于0。默认值None值将取0。
关键字参数:

View File

@ -31,7 +31,7 @@ class StudentT(Distribution):
and the probability density function:
.. math::
f(x, \nu, \mu, \sigma) = (1 + y^2 / \nu)^(-0.5*(\nu + 1)) / Z
f(x, \nu, \mu, \sigma) = (1 + y^2 / \nu)^{(-0.5*(\nu + 1))} / Z
where :math:`y = (x-\mu)/\sigma`, :math:`Z = abs(\sigma)*\sqrt(\nu * \pi)*\Gamma(0.5 * \nu)/\Gamma(0.5*(\nu + 1))`,
:math:`\nu, \mu, \sigma` are the degrees of freedom , mean and scale of the laplace distribution respectively.

View File

@ -847,7 +847,7 @@ def rand(*size, dtype=None, seed=None):
interval :math:`[0, 1)`.
Args:
*size (Union[int, tuple(int), list(int)]): Shape of the new tensor, e.g. :math:`(2, 3)` or :math:`2`.
size (Union[int, tuple(int), list(int)]): Shape of the new tensor, e.g. :math:`(2, 3)` or :math:`2`.
Keyword Args:
dtype (:class:`mindspore.dtype`, optional): Designated tensor dtype, it must be float type. If None,
@ -856,7 +856,7 @@ def rand(*size, dtype=None, seed=None):
Returns:
Tensor, with the designated shape and dtype, filled with random numbers from the uniform distribution on
the interval :math:`[0, 1)`.
the interval :math:`[0, 1)`.
Raises:
TypeError: `seed` is not a non-negative integer.
@ -936,16 +936,16 @@ def randn(*size, dtype=None, seed=None):
from the standard normal distribution.
Args:
*size (Union[int, tuple(int), list(int)]): Shape of the new tensor, e.g., :math:`(2, 3)` or :math:`2`.
size (Union[int, tuple(int), list(int)]): Shape of the new tensor, e.g., :math:`(2, 3)` or :math:`2`.
Keyword Args:
dtype (:class:`mindspore.dtype`, optional): Designated tensor dtype, it must be float type. If None,
:class:`mindspore.float32` will be used. Default: None.
`mindspore.float32` will be used. Default: None.
seed (int, optional): Random seed, must be greater or equal to 0. Default: None, and 0 will be used.
Returns:
Tensor, with the designated shape and dtype, filled with a sample (or samples) from the
"standard normal" distribution.
"standard normal" distribution.
Raises:
TypeError: `seed` is not a non-negative integer.
@ -985,11 +985,11 @@ def randn_like(x, seed=None, *, dtype=None):
Keyword Args:
dtype (:class:`mindspore.dtype`, optional): Designated tensor dtype, it must be float type. If None,
:class:`mindspore.float32` will be used. Default: None.
`mindspore.float32` will be used. Default: None.
Returns:
Tensor, with the designated shape and dtype, filled with a sample (or samples) from the
"standard normal" distribution.
"standard normal" distribution.
Raises:
TypeError: `seed` is not a non-negative integer.
@ -1035,7 +1035,7 @@ def randint(low, high, size, seed=None, *, dtype=None):
Returns:
Tensor, with the designated shape and dtype, filled with random integers from low (inclusive)
to high (exclusive).
to high (exclusive).
Raises:
TypeError: `seed` is not a non-negative integer.
@ -1084,11 +1084,11 @@ def randint_like(x, low, high, seed=None, *, dtype=None):
Keyword Args:
dtype (:class:`mindspore.dtype`, optional): Designated tensor dtype, it must be int type. If None,
:class:`mindspore.int64` will be used. Default is :class:`mindspore.int64`.
`mindspore.int64` will be used. Default is `mindspore.int64`.
Returns:
Tensor, with the designated shape and dtype, filled with random integers from low (inclusive)
to high (exclusive).
to high (exclusive).
Raises:
TypeError: `seed` is not a non-negative integer.

View File

@ -9069,11 +9069,9 @@ class FractionalMaxPool3DWithFixedKsize(Primitive):
ksize (Union[float, tuple]): The target ksize is D x H x W.
ksize can be a tuple, or a single K for K x K x K.
specifying the window size (D, H, W) of the input tensor.
output_shape (Union[int, tuple]): The target output_shape is D x H x W.
output_shape can be a tuple, or a single H for H x H x H.
specifying the size (D, H, W) of the output tensor.
data_format (str, optional) : The optional value for data format.
Currently support 'NCDHW' and 'NHDWC'. Default: 'NCDHW'.
@ -9081,7 +9079,6 @@ class FractionalMaxPool3DWithFixedKsize(Primitive):
- **x** (Tensor) - The input of FractionalMaxPool3DWithFixedKsize, which is a 4D or 5D tensor.
Tensor of data type : float16, float32, double, int32, int64.
Supported shape :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(N, D_{in}, H_{in}, W_{in}, C)`.
- **random_samples** (Tensor) - The random step of FractionalMaxPool3DWithFixedKsize, which is a 3D tensor.
Tensor of data type : float16, float32, double, and value is between (0, 1).
Supported shape :math:`(N, C, 3)`
@ -9090,7 +9087,6 @@ class FractionalMaxPool3DWithFixedKsize(Primitive):
- **y** (Tensor) - A tensor, the output of FractionalMaxPool3DWithFixedKsize.
Has the same data type with `x`.
Tensor of shape :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(N, D_{out}, H_{out}, W_{out}, C)`.
- **argmax** (Tensor) - A tensor, the indices along with the outputs.
Has the same shape as the `y` and int32 or int64 data type.
@ -9284,7 +9280,7 @@ class PSROIPooling(Primitive):
spatial_scale (float): a scaling factor that maps the box coordinates to the input coordinates.
For example, if your boxes are defined on the scale of a 224x224 image and
your input is a 112x112 feature map (resulting from a 0.5x scaling of the original
image), youll want to set this to 0.5.
image), you'll want to set this to 0.5.
group_size (int): the size of the output (in pixels) after the pooling is performed, as (height, width).
output_dim (int): the dim of the output after the pooling is performed.
@ -9344,9 +9340,9 @@ class PSROIPooling(Primitive):
... group_size=7)
>>> out = psROIPooling(features, rois)
>>> print(out.shape)
(4, 3, 7, 7)
(4, 3, 7, 7)
>>> print(out.dtype)
Float32
Float32
"""
@prim_attr_register