update ops docs
This commit is contained in:
parent
9a81a0e969
commit
8763479103
|
@ -3,15 +3,24 @@
|
|||
|
||||
.. py:class:: mindspore.ops.CombinedNonMaxSuppression(clip_boxes=True, pad_per_class=False)
|
||||
|
||||
根据分数降序,使用非极大抑制法通过遍历所有可能的边界框(Bounding Box)来选择一个最优的结果。
|
||||
使用非极大值抑制法遍历候选边界框列表,从中选择一组子集,其中边界框按其置信度得分降序排列。
|
||||
|
||||
参数:
|
||||
- **clip_boxes** (bool, 可选) - 如果为True,则假设边界框坐标在[0,1]之间,如果超出[0,1]则剪辑输出框。如果为False,则不进行剪切并按原样输出框坐标。默认值:True。
|
||||
- **pad_per_class** (bool, 可选) - 如果为True,输出 `nmsed_boxes` 、`nmsed_scores` 和 `nmsed_classes` 将被填充为 `max_output_size_per_class` * num_classes的长度,如果该长度超过 `max_total_size` ,在这种情况下它将被裁剪为 `max_total_size` 。如果为False,则输出 `nmsed_boxes` 、 `nmsed_scores` 和 `nmsed_classes` 将被填充/裁剪到 `max_total_size` 。默认值:False。
|
||||
- **clip_boxes** (bool, 可选) - 确定是否应用边界框归一化,以确保坐标在[0,1]范围内。
|
||||
默认值:True。
|
||||
|
||||
- 如果为True,则剪裁超出此范围的框。
|
||||
- 如果为False,则返回框坐标,而不进行任何修改。
|
||||
|
||||
- **pad_per_class** (bool, 可选) - 确定是否需要对非极大值抑制(NMS)算法的输出进行填充或剪裁,以满足最大尺寸的限制。
|
||||
默认值:False。
|
||||
|
||||
- 如果为False,则将输出剪裁到最大尺寸 `max_total_size` 。
|
||||
- 如果为True,则将输出填充到 `max_size_per_class` * `num_classes` 的最大长度,如果超 `过max_total_size` 则剪裁。
|
||||
|
||||
输入:
|
||||
- **boxes** (Tensor) - Shape可表示为:(batch_size, num_boxes, q, 4)。如果q为1,则对所有类都使用相同的边界框;如果q等于类的数量,则对于每一类都使用特定的边界框。数据类型:float32。
|
||||
- **scores** (Tensor) - 表示对应于每个Bounding Boxes( `boxes` 的每一行)的单个分数,数据类型必须为float32,其shape可表示为:(batch_size, num_boxes, num_classes)。
|
||||
- **boxes** (Tensor) - 边界框坐标,是一个float32类型的Tensor,shape为 :math:`(batch_size, num_boxes, q, 4)` 。如果q为1,则所有类别都使用相同的边界框。否则,如果q等于类的数量,则对于每一类都使用特定的边界框。
|
||||
- **scores** (Tensor) - 表示对应于每个Bounding Boxes( `boxes` 的每一行)的单个分数,数据类型必须为float32,其shape可表示为: :math:`(batch_size, num_boxes, num_classes)` 。
|
||||
- **max_output_size_per_class** (Tensor) - 0D Tensor,表示每个类中由非极大抑制法(non-max suppression)选择的Bounding Boxes数目的上限。数据类型:int32。
|
||||
- **max_total_size** (Tensor) - 0D Tensor,表示在所有类中可保留的Bounding Boxes数目的上限。数据类型:int32。
|
||||
- **iou_threshold** (Tensor) - 0D Tensor,判断Bounding Boxes是否与IOU重叠过多的阈值,取值必须在[0,1]区间内。数据类型:float32。
|
||||
|
@ -33,4 +42,4 @@
|
|||
- **ValueError** - `scores` 不是3D Tensor。
|
||||
- **ValueError** - `max_total_size` 小于0。
|
||||
- **ValueError** - `max_output_size_per_class` 小于0。
|
||||
- **ValueError** - `iou_threshold` 取值不在区间[0,1]中。
|
||||
- **ValueError** - `iou_threshold` 取值不在区间[0,1]中。
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
.. py:class:: mindspore.ops.DataFormatVecPermute(src_format='NHWC', dst_format='NCHW')
|
||||
|
||||
将输入按从 `src_format` 到 `dst_format` 的变化重新排列。
|
||||
将输入Tensor的数据格式从 `src_format` 转换为 `dst_format` ,通过重新排列其维度来实现。
|
||||
|
||||
参数:
|
||||
- **src_format** (str, 可选) - 原先的数据排列格式,可以为'NHWC'和'NCHW'之一。默认值:'NHWC'。
|
||||
- **src_format** (str, 可选) - 初始数据排列格式,可以为'NHWC'和'NCHW'之一。默认值:'NHWC'。
|
||||
- **dst_format** (str, 可选) - 目标数据排列格式,可以为'NHWC'和'NCHW'之一。默认值:'NCHW'。
|
||||
|
||||
输入:
|
||||
- **input_x** (Tensor) - shape为(4, )或(4, 2)的输入Tensor。数据类型为int32或int64。
|
||||
- **input_x** (Tensor) - shape为 :math:`(4, )` 或 :math:`(4, 2)` 的输入Tensor。数据类型为int32或int64。
|
||||
|
||||
输出:
|
||||
与 `input_x` 的shape和数据类型一致的Tensor。
|
||||
|
@ -18,5 +18,5 @@
|
|||
异常:
|
||||
- **TypeError** - 输入 `input_x` 不是Tensor。
|
||||
- **TypeError** - `input_x` 的数据类型不是int32或int64。
|
||||
- **ValueError** - `input_x` 的shape不为(4, )或(4, 2)。
|
||||
- **ValueError** - `src_format` 或 `dst_format` 不是'NHWC'或'NCHW'之一。
|
||||
- **ValueError** - `input_x` 的shape不为 :math:`(4, )` or :math:`(4, 2)` 。
|
||||
- **ValueError** - `src_format` 或 `dst_format` 不是'NHWC'或'NCHW'之一。
|
||||
|
|
|
@ -3,7 +3,7 @@ mindspore.ops.DiagPart
|
|||
|
||||
.. py:class:: mindspore.ops.DiagPart
|
||||
|
||||
返回输入的对角线部分。
|
||||
提取输入Tensor的对角线元素。
|
||||
|
||||
假如 `input_x` 有维度 :math:`[D_1,..., D_k, D_1,..., D_k]`,那么输出是一个秩为k的Tensor,维度为 :math:`[D_1,..., D_k]`,其中:
|
||||
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
.. py:class:: mindspore.ops.EuclideanNorm(keep_dims=False)
|
||||
|
||||
计算Tensor维度上元素的欧几里得范数,根据给定的轴对输入进行规约操作。
|
||||
计算Tensor沿指定轴的欧几里得范数(又称L2范数)。默认情况下会移除axis中指定的维度。
|
||||
|
||||
参数:
|
||||
- **keep_dims** (bool,可选) - 如果为True,被规约的轴保留为1,如果为False,不保留给定的这些轴,默认值:False。
|
||||
|
||||
输入:
|
||||
- **x** (Tensor) - 输入Tensor,将被规约,数据类型为:float16、float32、float64、int8、int16、
|
||||
- **x** (Tensor) - 输入Tensor,数据类型为:float16、float32、float64、int8、int16、
|
||||
int32、int64、complex64、complex128、uint8、uint16、uint32、uint64。
|
||||
- **axes** (Tensor) - 将进行规约的轴。数据类型为:int32、int64。取值范围为: `[-rank(x), rank(x))`。
|
||||
- **axes** (Tensor) - 指定进行规约计算的维度。数据类型为:int32、int64。取值范围为: `[-rank(x), rank(x))` 。
|
||||
|
||||
输出:
|
||||
Tensor,与输入 `x` 具有相同的数据类型。
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
.. py:class:: mindspore.ops.Expand
|
||||
|
||||
返回一个当前张量的新视图,其中单维度扩展到更大的尺寸。
|
||||
沿着Tensor单维度进行扩展,以匹配给定的目标shape。
|
||||
|
||||
更多细节请参考 :func:`mindspore.ops.expand`。
|
||||
|
|
|
@ -3,17 +3,17 @@ mindspore.ops.FillDiagonal
|
|||
|
||||
.. py:class:: mindspore.ops.FillDiagonal(fill_value, wrap=False)
|
||||
|
||||
填充至少具有二维的Tensor的主对角线。当 `dims>2` 时,输入的所有维度必须等长。此函数就地修改输入Tensor,并返回输入Tensor。
|
||||
填充至少具有二维的Tensor的主对角线。当输入的维度大于2时,所有维度必须等长。此函数原地修改输入Tensor,并返回输入Tensor。
|
||||
|
||||
参数:
|
||||
- **fill_value** (float) - 填充值。
|
||||
- **wrap** (bool,可选) - 如果设置为True, 表示高矩阵N列之后的对角线 `wrapped` ,否则不处理,默认值:False。
|
||||
- **fill_value** (float) - `input_x` 对角线的填充值。
|
||||
- **wrap** (bool,可选) - 控制对于一个高矩阵(即矩阵的行数大于列数),对角线元素是否继续延伸到剩余的行。下面的例子说明产生怎样的效果。默认值:False。
|
||||
|
||||
输入:
|
||||
- **input_x** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)` ,其数据类型必须为:float32、int32或者int64。
|
||||
|
||||
输出:
|
||||
- **y** (Tensor) - Tensor,和输入 `x` 具有相同的shape和dtype。
|
||||
- **y** (Tensor) - Tensor,和输入 `input_x` 具有相同的shape和dtype。
|
||||
|
||||
异常:
|
||||
- **TypeError** - 如果 `input_x` 的dtype不是:float32、int32或者int64。
|
||||
|
|
|
@ -176,7 +176,7 @@ def _check_infer_attr_reduce(axis, keep_dims, prim_name):
|
|||
|
||||
class Expand(Primitive):
|
||||
"""
|
||||
Returns a new view of the self tensor with singleton dimensions expanded to a larger size.
|
||||
Expands the Tensor along singleton dimensions to match given desired shape.
|
||||
|
||||
Refer to :func:`mindspore.ops.expand` for more details.
|
||||
|
||||
|
@ -3572,10 +3572,10 @@ class Diag(PrimitiveWithCheck):
|
|||
class DiagPart(PrimitiveWithCheck):
|
||||
r"""
|
||||
|
||||
Extracts the diagonal part from given tensor.
|
||||
Extracts the diagonal elements from the given Tensor.
|
||||
|
||||
Assume input has dimensions :math:`[D_1,..., D_k, D_1,..., D_k]`, the output is a tensor
|
||||
of rank k with dimensions :math:`[D_1,..., D_k]` where:
|
||||
If the input is a Tensor of shape :math:`[D_1,..., D_k, D_1,..., D_k]`, then the
|
||||
output will be a Tensor of rank k of shape :math:`[D_1,..., D_k]` where:
|
||||
:math:`output[i_1,..., i_k] = input[i_1,..., i_k, i_1,..., i_k]`.
|
||||
|
||||
Inputs:
|
||||
|
@ -7587,20 +7587,23 @@ class LeftShift(Primitive):
|
|||
|
||||
class FillDiagonal(Primitive):
|
||||
"""
|
||||
Fill the main diagonal of a tensor that has at least 2-dimensions.
|
||||
When dims>2, all dimensions of input must be of equal length.
|
||||
This function modifies the input tensor in-place, and returns the input tensor.
|
||||
Fills the main diagonal of a Tensor in-place with a specified value and returns the result.
|
||||
The input has at least 2 dimensions, and all dimensions of input must be equal in length
|
||||
when the dimension of input is greater than 2.
|
||||
|
||||
Args:
|
||||
fill_value (float): The fill value.
|
||||
wrap (bool, optional): the diagonal `wrapped` after N columns for tall matrices. Default: False.
|
||||
fill_value (float): The value to fill the diagonal of `input_x`.
|
||||
wrap (bool, optional): Controls whether the diagonal elements continue onto the
|
||||
remaining rows in case of a tall matrix(A matrix has more rows than columns).
|
||||
Examples blow demonstrates how it works on a tall matrix if `wrap` is set True.
|
||||
Default: False.
|
||||
|
||||
Inputs:
|
||||
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
|
||||
The data type must be float32, int32 or int64.
|
||||
|
||||
Outputs:
|
||||
- **y** (Tensor) - Tensor, has the same shape and data type as the input `x`.
|
||||
- **y** (Tensor) - Tensor, has the same shape and data type as the input `input_x`.
|
||||
|
||||
Raises:
|
||||
TypeError: If data type of `input_x` is not one of the following: float32, int32, int64.
|
||||
|
|
|
@ -1064,33 +1064,40 @@ class ScaleAndTranslate(Primitive):
|
|||
|
||||
class CombinedNonMaxSuppression(Primitive):
|
||||
r"""
|
||||
Greedily selects a subset of bounding boxes in descending order of score.
|
||||
Applies a greedy approach to select a subset of bounding boxes from a list of
|
||||
candidates using NonMaxSuppression, where the boxes are sorted in descending order of their confidence score.
|
||||
|
||||
Args:
|
||||
clip_boxes (bool, optional): If true, assume the box coordinates are between [0, 1] and clip the output boxes
|
||||
if they fall beyond [0, 1]. If false, do not do clipping and output the box coordinates as it is.
|
||||
Defaults to true.
|
||||
pad_per_class (bool, optional): If false, the output nmsed boxes,
|
||||
scores and classes are padded/clipped to max_total_size.
|
||||
If true, the output nmsed boxes, scores and classes are padded to be of length
|
||||
max_size_per_class * num_classes, unless it exceeds max_total_size in which case it is clipped to
|
||||
max_total_size. Defaults to false.
|
||||
clip_boxes (bool, optional): Determines whether to apply bounding box normalization to ensure the
|
||||
coordinates are within [0, 1] range. Default: True.
|
||||
|
||||
- If True, clip the boxes that fall outside this range.
|
||||
- If False, return the box coordinates as they are without any modifications.
|
||||
|
||||
pad_per_class (bool, optional): Determines whether the output of the non-maximum suppression (NMS)
|
||||
algorithm should be padded or clipped to meet the maximum size constraints. Default: False.
|
||||
|
||||
- If False, the output is clipped to the maximum size of `max_total_size`.
|
||||
- If True, the output is padded up to `max_size_per_class` * `num_classes` and clipped if
|
||||
it exceeds `max_total_size`.
|
||||
|
||||
Inputs:
|
||||
- **boxes** (Tensor) - A Tensor of type float32 and shape (batch_size, num_boxes, q, 4).
|
||||
If q is 1 then same boxes are used for all classes otherwise,
|
||||
if q is equal to number of classes, class-specific boxes are used.
|
||||
- **scores** (Tensor) - A Tensor of type float32 and shape (batch_size, num_boxes, num_classes)
|
||||
representing a single score corresponding to each box (each row of boxes).
|
||||
- **max_output_size_per_class** (Tensor) - A 0D Tensor of type int32, representing the max number of boxes to be
|
||||
selected by non max suppression per class.
|
||||
- **max_total_size** (Tensor) - A 0D Tensor of type int32, representing the maximum number of boxes retained
|
||||
over all classes.
|
||||
- **iou_threshold** (Tensor) - A 0D float32 tensor representing the threshold for deciding whether
|
||||
boxes overlap too much with respect to IOU, and iou_threshold must be equal or greater
|
||||
- **boxes** (Tensor) - A float32 Tensor with shape :math:`(batch_size, num_boxes, q, 4)`
|
||||
representing the bounding box coordinates.
|
||||
`q` can be 1, indicating that all classes use the same bounding box, or the number of classes,
|
||||
indicating that class-specific boxes are applied.
|
||||
- **scores** (Tensor) - A 3-D Tensor of float32 type with the shape
|
||||
:math:`(batch_size, num_boxes, num_classes)`. It contains a score value for each box,
|
||||
with each row of `boxes` represented by a single score.
|
||||
- **max_output_size_per_class** (Tensor) - The maximum number of boxes that can be selected for each class
|
||||
by the non-maximum suppression algorithm, represented by a scalar Tensor of type int32.
|
||||
- **max_total_size** (Tensor) - A scalar Tensor of type int32 that represents the
|
||||
maximum number of boxes that are kept for all classes.
|
||||
- **iou_threshold** (Tensor) - A scalar Tensor of float32 type that represents the threshold for
|
||||
determining if the IOU overlap between boxes is too high. `iou_threshold` must be equal or greater
|
||||
than 0 and be equal or smaller than 1.
|
||||
- **score_threshold** (Tensor) - A 0D float32 tensor representing the threshold for deciding when to remove
|
||||
boxes based on score.
|
||||
- **score_threshold** (Tensor) - A scalar Tensor of type float32 that represents the threshold
|
||||
for determining when to remove boxes based on their scores.
|
||||
|
||||
Outputs:
|
||||
- **nmsed_boxes** - A Tensor of float32 with shape of (batch_size, num_detection, 4), which contains
|
||||
|
|
|
@ -538,18 +538,17 @@ class _Reduce(PrimitiveWithCheck):
|
|||
|
||||
class EuclideanNorm(Primitive):
|
||||
"""
|
||||
Computes the euclidean norm of elements across dimensions of a tensor.
|
||||
Reduces input along the dimensions given in axis.
|
||||
Calculates the Euclidean norm(aka L2 norm) of a Tensor along the specified axes.
|
||||
The specified `axes` are removed by default.
|
||||
|
||||
Args:
|
||||
keep_dims (bool, optional): If true, the reduceed dimensions are retained with length 1.
|
||||
If false, don't keep these dimensions. Default: False.
|
||||
keep_dims (bool, optional): whether to retain the reduced dimensions. If true, retains them with length 1.
|
||||
If false, these dimensions are removed. Default: False.
|
||||
|
||||
Inputs:
|
||||
- **x** (Tensor) - The input tensor. Must be one of the following types :float16, float32, float64, int8, int16,
|
||||
int32, int64, complex64, complex128, uint8, uint16, uint32, uint64. The tensor to reduce.
|
||||
- **axes** (Tensor) - The dimensions to reduce. Must be one of the following types: int32, int64.
|
||||
Must be in the range [-rank(x), rank(x)).
|
||||
- **x** (Tensor) - The input Tensor to reduce. Must be one of the following types:
|
||||
float16, float32, float64, int8, int16, int32, int64, complex64, complex128, uint8, uint16, uint32, uint64.
|
||||
- **axes** (Tensor) - The axes to perform reduction on. Must be one of the following types: int32, int64.
|
||||
|
||||
Outputs:
|
||||
Tensor, has the same type as the 'x'.
|
||||
|
|
|
@ -1395,16 +1395,15 @@ class Conv2D(Primitive):
|
|||
|
||||
class DataFormatVecPermute(Primitive):
|
||||
r"""
|
||||
Permute input tensor from src_format to dst_format.
|
||||
Converts the input tensor from the `src_format` to the `dst_format` by permuting its dimensions.
|
||||
|
||||
Args:
|
||||
src_format (str, optional): An optional value for source data format. The format can be 'NHWC' and 'NCHW'.
|
||||
Default: 'NHWC'.
|
||||
dst_format (str, optional): An optional value for destination data format. The format can be 'NHWC' and 'NCHW'.
|
||||
Default: 'NCHW'.
|
||||
src_format (str, optional): the source data format, which can be 'NHWC' and 'NCHW'. Default: 'NHWC'.
|
||||
dst_format (str, optional): the target data format, which can be 'NHWC' and 'NCHW'. Default: 'NCHW'.
|
||||
|
||||
Inputs:
|
||||
- **input_x** (Tensor) - A Tensor of shape (4, ) or (4, 2) in source data format. Only supports int32 and int64.
|
||||
- **input_x** (Tensor) - A Tensor of shape :math:`(4, )` or :math:`(4, 2)` in source data format.
|
||||
Supports int32 and int64 datatype.
|
||||
|
||||
Outputs:
|
||||
Tensor, has the same data type and shape as the `input_x`.
|
||||
|
@ -1413,7 +1412,7 @@ class DataFormatVecPermute(Primitive):
|
|||
TypeError: If `input_x` is not a Tensor.
|
||||
TypeError: If dtype of `input_x` is neither int32 nor int64.
|
||||
ValueError: If `src_format` or `dst_format` is not a str in ['NHWC', 'NCHW'].
|
||||
ValueError: If input_x shape is not (4, ) or (4, 2).
|
||||
ValueError: If `input_x` shape is not :math:`(4, )` or :math:`(4, 2).
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
|
Loading…
Reference in New Issue