forked from mindspore-Ecosystem/mindspore
!47223 modify math format
Merge pull request !47223 from 俞涵/code_docs_2.0.0al
This commit is contained in:
commit
3d40eceef6
|
@ -92,7 +92,7 @@ mindspore.common.initializer
|
|||
|
||||
.. py:class:: mindspore.common.initializer.XavierNormal(gain=1)
|
||||
|
||||
生成一个服从Xarvier正态分布的随机数组:math:`{N}(0, \text{sigma}^2)` 用于初始化Tensor,其中:
|
||||
生成一个服从Xarvier正态分布的随机数组 :math:`{N}(0, \text{sigma}^2)` 用于初始化Tensor,其中:
|
||||
|
||||
.. math::
|
||||
sigma = gain * \sqrt{\frac{2}{n_{in} + n_{out}}}
|
||||
|
|
|
@ -31,7 +31,7 @@ mindspore.ops.AlltoAll
|
|||
|
||||
:math:`y_{concat\_dim} = x_{concat\_dim} * split\_count`
|
||||
|
||||
:math:`y_other = x_other`.
|
||||
:math:`y\_other = x\_other`.
|
||||
|
||||
异常:
|
||||
- **TypeError** - 如果 `group` 不是字符串。
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
|
||||
输入:
|
||||
- **x_indices** (Tensor) - 二维Tensor,表示稀疏Tensor中非零元素的索引,所有元素的取值都是非负的。数据类型为int64。
|
||||
其shape可表示为:math: `(y, x)` 。
|
||||
其shape可表示为: :math:`(y, x)` 。
|
||||
- **x_values** (Tensor) - 一维Tensor,表示与 `y_indices` 中的索引对应的值。支持的数据类型为float16、float32。
|
||||
其shape可表示为:math: `(x,)` 。
|
||||
其shape可表示为: :math:`(x,)` 。
|
||||
- **x_shape** (Tensor) - 一维Tensor,代表稀疏Tensor的shape。数据类型为int64。
|
||||
其shape可表示为:math: `(y,)` 。
|
||||
其shape可表示为: :math:`(y,)` 。
|
||||
|
||||
输出:
|
||||
- **y_indices** (Tensor) - 二维Tensor,表示稀疏Tensor中非零元素的索引,所有元素的取值都是非负的。数据类型为int64。
|
||||
其shape可表示为:math: `(y, z)` , `z` 代表 `x_indices` 中不同索引的数量。
|
||||
其shape可表示为: :math:`(y, z)` , `z` 代表 `x_indices` 中不同索引的数量。
|
||||
- **y_values** (Tensor) - 一维Tensor,表示与 `y_indices` 中的索引对应的值。数据类型与 `x_values` 保持一致。
|
||||
其shape可表示为:math: `(z,)` 。
|
||||
其shape可表示为: :math:`(z,)` 。
|
||||
- **y_shape** (Tensor) - 一维Tensor,代表稀疏Tensor的shape。数据类型为int64。
|
||||
其shape可表示为:math: `(y,)` 。
|
||||
其shape可表示为: :math:`(y,)` 。
|
||||
|
||||
异常:
|
||||
- **TypeError** - 输入 `x_values` 的数据类型不是float32或float16之一。
|
||||
|
|
|
@ -6,12 +6,12 @@ mindspore.ops.HSVToRGB
|
|||
将一个或多个图像从HSV转换为RGB。图像的格式应为:NHWC。
|
||||
|
||||
输入:
|
||||
- **x** (Tensor) - 输入的图像必须是shape为 :math:`[batch, image_height, image_width, channel]` 的4维Tensor。
|
||||
- **x** (Tensor) - 输入的图像必须是shape为 :math:`[batch, image\_height, image\_width, channel]` 的4维Tensor。
|
||||
channel 值必须为3。
|
||||
支持的类型:float16、float32、float64。
|
||||
|
||||
输出:
|
||||
一个4-D Tensor,shape为 :math:`[batch, image_height, image_width, channel]` ,且数据类型同输入一致。
|
||||
一个4-D Tensor,shape为 :math:`[batch, image\_height, image\_width, channel]` ,且数据类型同输入一致。
|
||||
|
||||
异常:
|
||||
- **TypeError** - 如果 `x` 不是一个Tensor。
|
||||
|
|
|
@ -5,7 +5,7 @@ mindspore.ops.IdentityN
|
|||
|
||||
返回与输入具有相同shape和值的tuple(Tensor)。
|
||||
|
||||
此操作可用于覆盖复杂函数的梯度。例如,假设 :math: `y = f(x)` ,
|
||||
此操作可用于覆盖复杂函数的梯度。例如,假设 :math:`y = f(x)` ,
|
||||
我们希望为反向传播应用自定义函数g,则 :math:`dx=g(dy)` 。
|
||||
|
||||
输入:
|
||||
|
|
|
@ -36,9 +36,9 @@ mindspore.ops.Im2Col
|
|||
|
||||
- **pads** (Union[int, tuple[int], list[int]],可选) - 窗口的填充,必须是1个、2个或4个整数来指定高宽和宽度方向的填充。默认值:0。
|
||||
|
||||
- 如果是1个整数,则 :math:`pad_height = pad_width` 。
|
||||
- 如果是2个整数,则 :math:`pad_height = pads[0]`, :math:`pad_width = pads[1]` 。
|
||||
- 如果是4个整数,则 :math:`pads = [pad_height_top, pad_height_bottom, pad_width_left, pad_width_right]` 。
|
||||
- 如果是1个整数,则 :math:`pad\_height = pad\_width` 。
|
||||
- 如果是2个整数,则 :math:`pad\_height = pads[0]`, :math:`pad\_width = pads[1]` 。
|
||||
- 如果是4个整数,则 :math:`pads = [pad\_height\_top, pad\_height\_bottom, pad\_width\_left, pad\_width\_right]` 。
|
||||
|
||||
输入:
|
||||
- **x** (Tensor) - 输入Tensor,只支持4-D Tensor(1个batch的图像Tensor)。支持所有的实数类型。
|
||||
|
|
|
@ -27,5 +27,5 @@ mindspore.ops.LuUnpack
|
|||
- **ValueError** - 若 `LU_pivots` 的维度小于1。
|
||||
- **ValueError** - 若 `LU_pivots` 最后一维的大小不等于 `LU_data` 的最后两维的较小者。
|
||||
- **ValueError** - 若 `lu_data` 与 `LU_pivots` 的batch维度不匹配。
|
||||
- **ValueError** - 在CPU平台上,若 `LU_pivots` 的值不在 :math:`[1, LU_data.shape[-2]]` 范围内。
|
||||
- **RuntimeError** - 在Ascend平台上,若 `LU_pivots` 的值不在 :math:`[1, LU_data.shape[-2]]` 范围内。
|
||||
- **ValueError** - 在CPU平台上,若 `LU_pivots` 的值不在 :math:`[1, LU\_data.shape[-2]]` 范围内。
|
||||
- **RuntimeError** - 在Ascend平台上,若 `LU_pivots` 的值不在 :math:`[1, LU\_data.shape[-2]]` 范围内。
|
||||
|
|
|
@ -4,7 +4,7 @@ mindspore.ops.MatrixPower
|
|||
.. py:class:: mindspore.ops.MatrixPower
|
||||
|
||||
计算一个batch的方阵的n次幂。
|
||||
如果 :math: `n=0` ,则返回一个batch的单位矩阵。
|
||||
如果 :math:`n=0` ,则返回一个batch的单位矩阵。
|
||||
如果n为负数,则为返回每个矩阵(如果可逆)逆矩阵的 :math:`abs(n)` 次幂。
|
||||
|
||||
参数:
|
||||
|
|
|
@ -6,9 +6,9 @@ mindspore.ops.MatrixSetDiagV3
|
|||
返回具有新的对角线值的批处理矩阵Tensor。
|
||||
给定输入 `x` 和对角线 `diagonal` ,此操作返回与 `x` 具有相同shape和值的Tensor,但返回的Tensor除开最内层矩阵的对角线,
|
||||
这些值将被对角线中的值覆盖。如果某些对角线比 `max_diag_len` 短,则需要被填充,其中 `max_diag_len` 指对角线的最长长度。
|
||||
`diagonal` 的维度 :math:`shape[-2]` 必须等于对角线个数 `num_diags` , :math:`num_diags = k[1] - k[0] + 1`,
|
||||
`diagonal` 的维度 :math:`shape[-2]` 必须等于对角线个数 `num_diags` , :math:`num\_diags = k[1] - k[0] + 1`,
|
||||
`diagonal` 的维度 :math:`shape[-1]` 必须等于最长对角线值 `max_diag_len` ,
|
||||
:math:`max_diag_len = min(x.shape[-2] + min(k[1], 0), x.shape[-1] + min(-k[0], 0))` 。
|
||||
:math:`max\_diag\_len = min(x.shape[-2] + min(k[1], 0), x.shape[-1] + min(-k[0], 0))` 。
|
||||
设 `x` 具有 `r + 1` 维 :math:`[I, J, ..., L, M, N]` 。
|
||||
当 `k` 是整数或 :math:`k[0] == k[1]` 时,对角线 `diagonal` 的shape为 :math:`[I, J, ..., L, max\_diag\_len]` 。
|
||||
否则,其shape为 :math:`[I, J, ... L, num\_diags, max\_diag\_len]` 。
|
||||
|
@ -48,7 +48,7 @@ mindspore.ops.MatrixSetDiagV3
|
|||
- **ValueError** - 对角线 `diagonal` 的维度与输入 `x` 的维度不匹配。
|
||||
- **ValueError** - 对角线 `diagonal` 的shape与输入 `x` 不匹配。
|
||||
- **ValueError** - 对角线 `diagonal` 的维度 :math:`shape[-2]` 不等于与对角线个数 `num_diags` ,
|
||||
:math:`num_diags = k[1]-k[0]+1` 。
|
||||
:math:`num\_diags = k[1]-k[0]+1` 。
|
||||
- **ValueError** - `k` 的取值不在 :math:`(-x.shape[-2], x.shape[-1])` 范围内。
|
||||
- **ValueError** - 对角线 `diagonal` 的维度 :math:`shape[-1]` 不等于最长对角线长度 `max_diag_len`,
|
||||
:math:`max_diag_len = min(x.shape[-2] + min(k[1], 0), x.shape[-1] + min(-k[0], 0))` 。
|
||||
:math:`max\_diag\_len = min(x.shape[-2] + min(k[1], 0), x.shape[-1] + min(-k[0], 0))` 。
|
||||
|
|
|
@ -34,7 +34,7 @@ mindspore.ops.MaxUnpool2D
|
|||
- **output_shape** (tuple[int],可选) - 一个可选的输入,指定目标输出的尺寸。默认值:()。
|
||||
|
||||
- 如果 `output_shape == ()` ,则输出的shape由 `kszie` 、 `strides` 和 `pads` 计算得到。
|
||||
- 如果 :math:`output_shape != ()` ,则 `output_shape` 必须为 :math:`(N, C, H, W)` 或 :math:`(N, H, W, C)` ,
|
||||
- 如果 :math:`output\_shape != ()` ,则 `output_shape` 必须为 :math:`(N, C, H, W)` 或 :math:`(N, H, W, C)` ,
|
||||
同时 `output_shape` 必须属于 :math:`[(N, C, H_{out} - strides[0], W_{out} - strides[1]), (N, C, H_{out} + strides[0], W_{out} + strides[1])]` 。
|
||||
|
||||
- **data_format** (str,可选) - 可选的数据格式。当前支持 `NCHW` 和 `NHWC` 。默认值: `NCHW` 。
|
||||
|
|
|
@ -13,8 +13,8 @@ mindspore.ops.NonMaxSuppressionV3
|
|||
- 对于坐标系的正交变换和平移,该算法不受影响,因此坐标系的平移变换后算法会选择相同的框。
|
||||
|
||||
输入:
|
||||
- **boxes** (Tensor) - 二维Tensor,shape为 :math:`(num_boxes, 4)` 。
|
||||
- **scores** (Tensor) - 一维Tensor,其shape为 :math:`(num_boxes)` 。表示对应每一行每个方框的score值, `scores` 和 `boxes` 的num_boxes必须相等。支持的数据类型为float32。
|
||||
- **boxes** (Tensor) - 二维Tensor,shape为 :math:`(num\_boxes, 4)` 。
|
||||
- **scores** (Tensor) - 一维Tensor,其shape为 :math:`(num\_boxes)` 。表示对应每一行每个方框的score值, `scores` 和 `boxes` 的num_boxes必须相等。支持的数据类型为float32。
|
||||
- **max_output_size** (Union[Tensor, Number.Int]) - 选取最大的边框数,必须大于等于0,数据类型为int32。
|
||||
- **iou_threshold** (Union[Tensor, Number.Float]) - 边框重叠值阈值,重叠值大于此值说明重叠过大,其值必须大于等于0,小于等于1。支持的数据类型为float32。
|
||||
- **score_threshold** (Union[Tensor, Number.Float]) - 移除边框阈值,边框score值大于此值则移除相应边框。支持的数据类型为float32。
|
||||
|
|
|
@ -10,8 +10,8 @@ mindspore.ops.NonMaxSuppressionWithOverlaps
|
|||
- 对于坐标系的正交变换和平移,该算法不受影响;因此坐标系的平移变换后算法会选择相同的框。
|
||||
|
||||
输入:
|
||||
- **overlaps** (Tensor) - 二维Tensor,其shape为 :math:`(num_boxes, num_boxes)` ,表示n乘n的边框重叠值。支持的数据类型为float32。
|
||||
- **scores** (Tensor) - 一维Tensor,其shape为 :math:`(num_boxes)` 。表示对应每一行每个方框的score值, `scores` 和 `overlaps` 的num_boxes必须相等。支持的数据类型为float32。
|
||||
- **overlaps** (Tensor) - 二维Tensor,其shape为 :math:`(num\_boxes, num_boxes)` ,表示n乘n的边框重叠值。支持的数据类型为float32。
|
||||
- **scores** (Tensor) - 一维Tensor,其shape为 :math:`(num\_boxes)` 。表示对应每一行每个方框的score值, `scores` 和 `overlaps` 的num_boxes必须相等。支持的数据类型为float32。
|
||||
- **max_output_size** (Union[Tensor, Number.Int]) - 选取最大的边框数,必须大于等于0,数据类型为int32。
|
||||
- **overlap_threshold** (Union[Tensor, Number.Float]) - 边框重叠值阈值,重叠值大于此值说明重叠过大。支持的数据类型为float32。
|
||||
- **score_threshold** (Union[Tensor, Number.Float]) - 移除边框阈值,边框score值大于此值则移除相应边框。支持的数据类型为float32。
|
||||
|
|
|
@ -12,7 +12,7 @@ mindspore.ops.NuclearNorm
|
|||
根据 `dim` 列表,输入Tensor根据 `dim` 重新排列。 `dim` 指定的两个维度将被放在末尾,其他维度的顺序相对不变。对每个调整后的Tensor的切片执行SVD以获得奇异值,将所有奇异值求和即为获得核规范。
|
||||
|
||||
参数:
|
||||
- **dim** (Union[list(int), tuple(int)],可选) - 指定计算 `x` 矩阵核范数的哪两个维度,如果 `dim` 为None,则核规范将在输入所有维度上计算。 `dim` 的长度应该是2,其值应在此范围内::math:`[-x_rank,x_rank)` 。x_rank是 `x` 的维度。dim[0]和dim[1]的值不能指向相同的维度。默认值:None。
|
||||
- **dim** (Union[list(int), tuple(int)],可选) - 指定计算 `x` 矩阵核范数的哪两个维度,如果 `dim` 为None,则核规范将在输入所有维度上计算。 `dim` 的长度应该是2,其值应在此范围内::math:`[-x\_rank,x\_rank)` 。x_rank是 `x` 的维度。dim[0]和dim[1]的值不能指向相同的维度。默认值:None。
|
||||
- **keepdim** (bool,可选) - 输出Tensor是否保留维度。默认值:False。
|
||||
|
||||
输入:
|
||||
|
@ -31,6 +31,6 @@ mindspore.ops.NuclearNorm
|
|||
- **ValueError** - 指定的 `dim` 的长度不等于2。
|
||||
- **ValueError** - 没有指定 `dim` 的时候, `x` 的维度不等于2。
|
||||
- **ValueError** - `dim[0]` 和 `dim[1]` 指向相同的维度。
|
||||
- **ValueError** - `dim[0]` 或者 `dim[1]` 超出范围::math:`[-x_rank, x_rank)` ,其中x_rank 为 `x` 的维度。
|
||||
- **ValueError** - `dim[0]` 或者 `dim[1]` 超出范围::math:`[-x\_rank, x\_rank)` ,其中x_rank 为 `x` 的维度。
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ mindspore.ops.PSROIPooling
|
|||
- **output_dim** (int) -执行池化后输出的维度。
|
||||
|
||||
输入:
|
||||
- **features** (Tensor) - 输入特征Tensor,其shape必须为 :math:`(N, C, H, W)` 。 各维度的值应满足: :math:`(C == output_dim * group_size * group_size)` 。数据类型为float16或者float32。
|
||||
- **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。
|
||||
|
||||
输出:
|
||||
|
@ -22,5 +22,5 @@ mindspore.ops.PSROIPooling
|
|||
- **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** - `features` 的shape不满足 :math:`(C == output\_dim * group\_size * group\_size)` 。
|
||||
- **ValueError** - `spatial_scale` 为负数。
|
||||
|
|
|
@ -4,7 +4,7 @@ mindspore.ops.ParameterizedTruncatedNormal
|
|||
.. py:class:: mindspore.ops.ParameterizedTruncatedNormal(seed=0, seed2=0)
|
||||
|
||||
返回一个具有指定shape的Tensor,其数值取自截断正态分布。
|
||||
当其shape为 :math:`(batch_size, *)` 的时候, `mean` 、 `stdevs` 、 `min` 和 `max` 的shape应该为 :math:`()` 或者 :math:`(batch_size, )` 。
|
||||
当其shape为 :math:`(batch\_size, *)` 的时候, `mean` 、 `stdevs` 、 `min` 和 `max` 的shape应该为 :math:`()` 或者 :math:`(batch\_size, )` 。
|
||||
|
||||
.. note::
|
||||
在广播之后,在任何位置, `min` 的值必须严格小于 `max` 的值。
|
||||
|
@ -27,7 +27,7 @@ mindspore.ops.ParameterizedTruncatedNormal
|
|||
- **TypeError** - `shape` 、 `mean` 、 `stdevs` 、 `min` 和 `max` 数据类型不支持。
|
||||
- **TypeError** - `mean` 、 `stdevs` 、 `min` 和 `max` 的shape不一致。
|
||||
- **TypeError** - `shape` 、 `mean` 、 `stdevs` 、 `min` 和 `max` 不全是Tensor。
|
||||
- **ValueError** - 当其 `shape` 为 :math:`(batch_size, *)` 时, `mean` 、 `stdevs` 、 `min` 或者 `max` 的shape不是 :math:`()` 或者 :math:`(batch_size, )` 。
|
||||
- **ValueError** - 当其 `shape` 为 :math:`(batch\_size, *)` 时, `mean` 、 `stdevs` 、 `min` 或者 `max` 的shape不是 :math:`()` 或者 :math:`(batch\_size, )` 。
|
||||
- **ValueError** - `shape` 的元素不全大于零。
|
||||
- **ValueError** - `stdevs` 的值不全大于零。
|
||||
- **ValueError** - `shape` 的的元素个数小于2。
|
||||
|
|
|
@ -14,7 +14,7 @@ mindspore.ops.ScaleAndTranslate
|
|||
- **antialias** (bool,可选) - 决定是否使用抗锯齿。默认值:True。
|
||||
|
||||
输入:
|
||||
- **images** (Tensor) - 4维Tensor,shape为 :math:`(batch, image_height, image_width, channel)` 。
|
||||
- **images** (Tensor) - 4维Tensor,shape为 :math:`(batch, image\_height, image\_width, channel)` 。
|
||||
- **size** (Tensor) - 缩放和平移操作后输出图像的大小。包含两个正数的的一维Tensor,形状必须为 :math:`(2,)` ,数据类型为int32。
|
||||
- **scale** (Tensor) - 指示缩放因子。包含两个正数的的一维Tensor,形状必须为 :math:`(2,)` ,数据类型为int32。
|
||||
- **translation** (Tensor) - 平移像素值。包含两个数的的一维Tensor,形状必须为 :math:`(2,)` ,数据类型为float32。
|
||||
|
|
|
@ -3,7 +3,7 @@ mindspore.ops.TrilIndices
|
|||
|
||||
.. py:class:: mindspore.ops.TrilIndices(row, col, offset=0, dtype=mstype.int32)
|
||||
|
||||
返回一个包含 `row` * `col` 的矩阵的下三角形部分的索引的Tensor。Tensor的shape为 :math:`(2, tril_size)` ,其中, `tril_size` 为下三角矩阵的元素总数。第一行包含所有索引的行坐标,第二行包含列坐标。索引按行排序,然后按列排序。
|
||||
返回一个包含 `row` * `col` 的矩阵的下三角形部分的索引的Tensor。Tensor的shape为 :math:`(2, tril\_size)` ,其中, `tril_size` 为下三角矩阵的元素总数。第一行包含所有索引的行坐标,第二行包含列坐标。索引按行排序,然后按列排序。
|
||||
|
||||
矩阵的下三角形部分定义为对角线本身和对角线以下的元素。
|
||||
|
||||
|
@ -17,7 +17,7 @@ mindspore.ops.TrilIndices
|
|||
- **dtype** (:class:`mindspore.dtype`, 可选) - 指定输出Tensor数据类型,支持的数据类型为 `mstype.int32` 和 `mstype.int64` ,默认值: `mstype.int32` 。
|
||||
|
||||
输出:
|
||||
- **y** (Tensor) - 矩阵的下三角形部分的索引。数据类型由 `dtype` 指定,shape为 :math:`(2, tril_size)` ,其中, `tril_size` 为下三角矩阵的元素总数。
|
||||
- **y** (Tensor) - 矩阵的下三角形部分的索引。数据类型由 `dtype` 指定,shape为 :math:`(2, tril\_size)` ,其中, `tril_size` 为下三角矩阵的元素总数。
|
||||
|
||||
异常:
|
||||
- **TypeError** - 如果 `row` 、 `col` 或 `offset` 不是int。
|
||||
|
|
|
@ -5,7 +5,7 @@ mindspore.ops.TripletMarginLoss
|
|||
|
||||
三元组损失函数。
|
||||
|
||||
创建一个标准,用于计算输入Tensor :math:`x` 、 :math:`x2` 和 :math:`x3` 与大于:math:`0` 的 `margin` 之间的三元组损失值。
|
||||
创建一个标准,用于计算输入Tensor :math:`x` 、 :math:`x2` 和 :math:`x3` 与大于 :math:`0` 的 `margin` 之间的三元组损失值。
|
||||
可以用来测量样本之间的相似度。一个三元组包含 `a` 、 `p` 和 `n` (即分别代表示 `anchor` 、 `positive examples` 和 `negative examples` )。
|
||||
所有输入Tensor的shape都应该为 :math:`(N, D)` 。
|
||||
距离交换在V. Balntas、E. Riba等人在论文 `Learning local feature descriptors with triplets and shallow convolutional neural networks <http://158.109.8.37/files/BRP2016.pdf>`_ 中有详细的阐述。
|
||||
|
|
|
@ -3,7 +3,7 @@ mindspore.ops.TriuIndices
|
|||
|
||||
.. py:class:: mindspore.ops.TriuIndices(row, col, offset=0, dtype=mstype.int32)
|
||||
|
||||
返回一个包含 `row` * `col` 的矩阵的上三角形部分的索引的Tensor。Tensor的shape为 :math:`(2, tril_size)` ,其中, `tril_size` 为上三角矩阵的元素总数。第一行包含所有索引的行坐标,第二行包含列坐标。索引按行排序,然后按列排序。
|
||||
返回一个包含 `row` * `col` 的矩阵的上三角形部分的索引的Tensor。Tensor的shape为 :math:`(2, tril\_size)` ,其中, `tril_size` 为上三角矩阵的元素总数。第一行包含所有索引的行坐标,第二行包含列坐标。索引按行排序,然后按列排序。
|
||||
|
||||
矩阵的下三角形部分定义为对角线本身和对角线以上的元素。
|
||||
|
||||
|
@ -17,7 +17,7 @@ mindspore.ops.TriuIndices
|
|||
- **dtype** (:class:`mindspore.dtype`,可选) - 指定输出Tensor数据类型,支持的数据类型为 `mstype.int32` 和 `mstype.int64` ,默认值: `mstype.int32` 。
|
||||
|
||||
输出:
|
||||
- **y** (Tensor) - 矩阵的下三角形部分的索引。数据类型由 `dtype` 指定,shape为 :math:`(2, tril_size)` ,其中, `tril_size` 为上三角矩阵的元素总数。
|
||||
- **y** (Tensor) - 矩阵的下三角形部分的索引。数据类型由 `dtype` 指定,shape为 :math:`(2, tril\_size)` ,其中, `tril_size` 为上三角矩阵的元素总数。
|
||||
|
||||
异常:
|
||||
- **TypeError** - 如果 `row` 、 `col` 或 `offset` 不是int。
|
||||
|
|
|
@ -6,8 +6,8 @@ mindspore.ops.cdist
|
|||
计算两个Tensor每对列向量之间的p-norm距离。
|
||||
|
||||
参数:
|
||||
- **x** (Tensor) - 输入Tensor,shape为 :math: `(B, P, M)` ,B维度为0时该维度被忽略,shape为 :math:`(P, M)` 。在GPU上支持数据类型为[float32, float64],在CPU上支持[float32]。
|
||||
- **y** (Tensor) - 输入Tensor,shape为 :math: `(B, R, M)` ,与 `x` 的数据类型一致。
|
||||
- **x** (Tensor) - 输入Tensor,shape为 :math:`(B, P, M)` ,B维度为0时该维度被忽略,shape为 :math:`(P, M)` 。在GPU上支持数据类型为[float32, float64],在CPU上支持[float32]。
|
||||
- **y** (Tensor) - 输入Tensor,shape为 :math:`(B, R, M)` ,与 `x` 的数据类型一致。
|
||||
- **p** (float,可选) - 计算向量对p-norm距离的P值,P∈[0,∞]。默认值:2.0。
|
||||
|
||||
返回:
|
||||
|
|
|
@ -11,7 +11,7 @@ mindspore.ops.crop_and_resize
|
|||
|
||||
参数:
|
||||
- **image** (Tensor) - shape为 :math:`(batch, image\_height, image\_width, depth)` 的图像Tensor。数据类型:int8, int16, int32, int64, float16, float32, float64, uint8, uint16。
|
||||
- **boxes** (Tensor) - shape为 :math:`(num_boxes, 4)` 的2维Tensor。其中,第 :math:`i` 行指定对第 :math:`\text{box_indices[i]}` 张图像裁剪时的归一化坐标 :math:`[y1, x1, y2, x2]`,那么通过归一化的 :math:`y` 坐标值可映射到的图像坐标为 :math:`y * (image\_height - 1)`,因此,归一化的图像高度 :math:`[0, 1]` 间隔映射到的图像高度间隔为 :math:`[0, image\_height - 1]`。我们也允许 :math:`y1 > y2`,这种情况下,就是对图像进行的上下翻转,宽度方向与此类似。同时,我们也允许归一化的坐标值超出 :math:`[0, 1]` 的区间,这种情况下,采用 :math:`\text{extrapolation_value}` 进行填充。数据类型:float32。
|
||||
- **boxes** (Tensor) - shape为 :math:`(num\_boxes, 4)` 的2维Tensor。其中,第 :math:`i` 行指定对第 :math:`\text{box_indices[i]}` 张图像裁剪时的归一化坐标 :math:`[y1, x1, y2, x2]`,那么通过归一化的 :math:`y` 坐标值可映射到的图像坐标为 :math:`y * (image\_height - 1)`,因此,归一化的图像高度 :math:`[0, 1]` 间隔映射到的图像高度间隔为 :math:`[0, image\_height - 1]`。我们也允许 :math:`y1 > y2`,这种情况下,就是对图像进行的上下翻转,宽度方向与此类似。同时,我们也允许归一化的坐标值超出 :math:`[0, 1]` 的区间,这种情况下,采用 :math:`\text{extrapolation_value}` 进行填充。数据类型:float32。
|
||||
- **box_indices** (Tensor) - shape为 :math:`(num\_boxes)` 的1维Tensor,其中,每一个元素必须是 :math:`[0, batch)` 区间内的值。:math:`\text{box_indices[i]}` 指定 :math:`\text{boxes[i, :]}` 所指向的图像索引。数据类型:int32。
|
||||
- **crop_size** (Tuple[int]) - 2元组(crop_height, crop_width),该输入必须为常量并且均为正值。指定对裁剪出的图像进行调整时的输出大小,纵横比可与原图不一致。数据类型:int32。
|
||||
- **method** (str,可选) - 指定调整大小时的采样方法,取值为"bilinear"、 "nearest"或"bilinear_v2",其中,"bilinear"是标准的线性插值算法,而在某些情况下,"bilinear_v2"可能会得到更优的效果。默认值:"bilinear"。
|
||||
|
|
|
@ -55,4 +55,4 @@ mindspore.ops.deformable_conv2d
|
|||
- :math:`C_{in}` 能被8整除。
|
||||
- `deformable_groups` 必须等于1。
|
||||
- `offsets` 的数据是浮点数类型(即需要包含小数部分)。
|
||||
- `kernel_size` 需要满足:math:`3 * kernel\_size[0] * kernel\_size[1] > 8`。
|
||||
- `kernel_size` 需要满足 :math:`3 * kernel\_size[0] * kernel\_size[1] > 8`。
|
||||
|
|
|
@ -24,9 +24,9 @@ mindspore.ops.hinge_embedding_loss
|
|||
其中 :math:`L = \{l_1,\dots,l_N\}^\top`。
|
||||
|
||||
参数:
|
||||
- **inputs** (Tensor) - 预测值,公式中表示为 :math:`x`,shape为:math:`(*)`。`*` 代表着任意数量的维度。
|
||||
- **inputs** (Tensor) - 预测值,公式中表示为 :math:`x`,shape为 :math:`(*)`。`*` 代表着任意数量的维度。
|
||||
- **targets** (Tensor) - 标签值,公式中表示为 :math:`y`,和 `logits` 具有相同shape,包含1或-1。
|
||||
- **margin** (float) - Hinge Embedding Loss公式定义的阈值 :math:`margin`。公式中表示为:math:`\Delta`。默认值:1.0。
|
||||
- **margin** (float) - Hinge Embedding Loss公式定义的阈值 :math:`margin`。公式中表示为 :math:`\Delta`。默认值:1.0。
|
||||
- **reduction** (str) - 指定应用于输出结果的计算方式,'none'、'mean'、'sum',默认值:'mean'。
|
||||
|
||||
返回:
|
||||
|
|
|
@ -30,7 +30,7 @@ mindspore.ops.multi_margin_loss
|
|||
- 'sum':输出的总和。
|
||||
|
||||
返回:
|
||||
- **outputs** - (Tensor),当 `reduction` 为"none"时,shape为:math:`(N,)`。否则,为标量。类型与 `inputs` 相同。
|
||||
- **outputs** - (Tensor),当 `reduction` 为"none"时,shape为 :math:`(N,)`。否则,为标量。类型与 `inputs` 相同。
|
||||
|
||||
异常:
|
||||
- **TypeError** - `p` 或者 `target` 数据类型不是int。
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
- 如果 `segment_ids` 中不存在segment_id `i` ,则对输出 `output[i]` 填充0。
|
||||
- 在Ascend平台上,如果segment_id的值小于0或大于输入Tensor的shape的长度,将触发执行错误。
|
||||
|
||||
如果给定的segment_ids :math: `i` 的和为空,则:math: `\text{output}[i] = 0` 。如果 `segment_ids` 元素为负数,将忽略该值。 `num_segments` 必须等于不同segment_id的数量。
|
||||
如果给定的segment_ids :math: `i` 的和为空,则 :math:`\text{output}[i] = 0` 。如果 `segment_ids` 元素为负数,将忽略该值。 `num_segments` 必须等于不同segment_id的数量。
|
||||
|
||||
参数:
|
||||
- **input_x** (Tensor) - shape: :math:`(x_1, x_2, ..., x_R)` 。
|
||||
- **input_x** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)` 。
|
||||
- **segment_ids** (Tensor) - 将shape设置为 :math:`(x_1, x_2, ..., x_N)` ,其中0<N<=R。
|
||||
- **num_segments** (Union[int, Tensor], 可选) - 分段数量 :math:`z` ,数据类型为int或0维的Tensor。
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ class _LayerNorm(Cell):
|
|||
- **x** (Tensor) - Tensor of shape :math:`(batch, seq\_length, hidden\_size)`.
|
||||
|
||||
Outputs:
|
||||
Tensor of shape :math:`(batch, seq_length, hidden_size)`.
|
||||
Tensor of shape :math:`(batch, seq\_length, hidden\_size)`.
|
||||
"""
|
||||
|
||||
def __init__(self, normalized_shape, eps=1e-5, param_init_type=mstype.float32, is_self_defined=False):
|
||||
|
|
|
@ -3406,13 +3406,13 @@ def matrix_diag(x, k=0, num_rows=-1, num_cols=-1, padding_value=0, align="RIGHT_
|
|||
num_rows (Union[int, Tensor], optional): A Tensor of type int32 with only one value. The number of rows of the
|
||||
output Tensor. If `num_rows` is -1, indicating that the innermost matrix of the output Tensor is a square
|
||||
matrix, and the real number of rows will be derivated by other inputs. That is
|
||||
:math:`num_rows = x.shape[-1] - min(k[1], 0)`. Otherwise, the value must be equal or greater than
|
||||
:math:`num\_rows = x.shape[-1] - min(k[1], 0)`. Otherwise, the value must be equal or greater than
|
||||
:math:`x.shape[-1] - min(k[1], 0)`. Default: -1.
|
||||
num_cols (Union[int, Tensor], optional): A Tensor of type int32 with only one value.
|
||||
The number of columns of
|
||||
the output Tensor. If `num_cols` is -1, indicating that the innermost matrix of the output
|
||||
Tensor is a square matrix, and the real number of columns will be derivated by other inputs.
|
||||
That is :math:`num_cols = x.shape[-1] + max(k[0], 0)`. Otherwise, the value must be equal or
|
||||
That is :math:`num\_cols = x.shape[-1] + max(k[0], 0)`. Otherwise, the value must be equal or
|
||||
greater than :math:`x.shape[-1] - min(k[1], 0)`. Default: -1.
|
||||
padding_value (Union[int, float, Tensor], optional): A Tensor with only one value. Have the same dtype as x.
|
||||
The number to fill the area outside the specified diagonal band. Default: 0.
|
||||
|
@ -3830,7 +3830,7 @@ def unsorted_segment_min(x, segment_ids, num_segments):
|
|||
|
||||
\text { output }_i=\text{min}_{j \ldots} \text { data }[j \ldots]
|
||||
|
||||
where :math:`min` over tuples :math:`j...` such that :math:`segment_ids[j...] == i`.
|
||||
where :math:`min` over tuples :math:`j...` such that :math:`segment\_ids[j...] == i`.
|
||||
|
||||
Note:
|
||||
- If the segment_id i is absent in the segment_ids, then output[i] will be filled with
|
||||
|
|
|
@ -4808,7 +4808,7 @@ def triu_indices(row, col, offset=0, dtype=mstype.int64):
|
|||
|
||||
Outputs:
|
||||
- **y** (Tensor) - indices of the elements in upper triangular part of matrix. The type is specified by `dtype`.
|
||||
The shape of output is :math:`(2, triu_size)`, where :math:`triu_size` is the number of elements in the
|
||||
The shape of output is :math:`(2, triu\_size)`, where :math:`triu\_size` is the number of elements in the
|
||||
upper triangular matrix.
|
||||
|
||||
Raises:
|
||||
|
|
|
@ -1677,32 +1677,32 @@ class DynamicGRUV2Grad(Primitive):
|
|||
reset_after (bool): An bool identifying whether to apply reset gate after matrix multiplication. Default: True.
|
||||
|
||||
Inputs:
|
||||
- **x** (Tensor) - Current words. Tensor of shape :math:`(num_step, batch_size, input_size)`.
|
||||
- **x** (Tensor) - Current words. Tensor of shape :math:`(num\_step, batch\_size, input\_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **weight_input** (Tensor) - Weight. Tensor of shape :math:`(input_size, 3 x hidden_size)`.
|
||||
- **weight_input** (Tensor) - Weight. Tensor of shape :math:`(input\_size, 3 x hidden\_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **weight_hidden** (Tensor) - Bias. Tensor of shape :math:`(hidden_size, 3 x hidden_size)`.
|
||||
- **weight_hidden** (Tensor) - Bias. Tensor of shape :math:`(hidden\_size, 3 x hidden\_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **y** (Tensor) - A Tensor of shape :math:
|
||||
if num_proj > 0 `(num_step, batch_size, min(hidden_size, num_proj)`,
|
||||
if num_proj == 0 `(num_step, batch_size, hidden_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **init_h** (Tensor) - Hidden state of initial time.
|
||||
Tensor of shape :math:`(batch_size, hidden_size)`.
|
||||
Tensor of shape :math:`(batch\_size, hidden\_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **h** (Tensor) - A Tensor of shape :math:`(num_step, batch_size, hidden_size)`.
|
||||
- **h** (Tensor) - A Tensor of shape :math:`(num\_step, batch\_size, hidden_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **dy** (Tensor) - Gradient of `y`, has the same shape and data type as `y`.
|
||||
- **dh** (Tensor) - Gradient of `h`, has the same shape and data type as `init_h`.
|
||||
- **update** (Tensor) - A Tensor of shape :math:`(num_step, batch_size, hidden_size)`.
|
||||
- **update** (Tensor) - A Tensor of shape :math:`(num\_step, batch\_size, hidden\_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **reset** (Tensor) - A Tensor of shape :math:`(num_step, batch_size, hidden_size)`.
|
||||
- **reset** (Tensor) - A Tensor of shape :math:`(num\_step, batch\_size, hidden\_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **new** (Tensor) - A Tensor of shape :math:`(num_step, batch_size, hidden_size)`.
|
||||
- **new** (Tensor) - A Tensor of shape :math:`(num\_step, batch\_size, hidden\_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **hidden_new** (Tensor) - A Tensor of shape :math:`(num_step, batch_size, hidden_size)`.
|
||||
- **hidden_new** (Tensor) - A Tensor of shape :math:`(num\_step, batch\_size, hidden\_size)`.
|
||||
The data type must be float16 or float32.
|
||||
- **seq_length** (Tensor) - The length of each batch. Tensor of shape :math:`(batch_size)`.
|
||||
- **seq_length** (Tensor) - The length of each batch. Tensor of shape :math:`(batch\_size)`.
|
||||
Only `None` is currently supported.
|
||||
- **mask** (Tensor) - A 4-D Tensor. The data type must be float16 or float32.
|
||||
|
||||
|
@ -1711,13 +1711,13 @@ class DynamicGRUV2Grad(Primitive):
|
|||
Has the same type with input `x`.
|
||||
- **dw_hidden** (Tensor) - A Tensor has the same shape as `weight_hidden`.
|
||||
Has the same type with input `x`.
|
||||
- **db_input** (Tensor) - A Tensor of shape :math:`(3 x hidden_size)`.
|
||||
- **db_input** (Tensor) - A Tensor of shape :math:`(3 x hidden\_size)`.
|
||||
Has the same type with input `x`.
|
||||
- **db_hidden** (Tensor) - A Tensor of shape :math:`(3 x hidden_size)`.
|
||||
- **db_hidden** (Tensor) - A Tensor of shape :math:`(3 x hidden\_size)`.
|
||||
Has the same type with input `x`.
|
||||
- **dx** (Tensor) - A Tensor of shape :math:`(num_step, batch_size, hidden_size)`.
|
||||
- **dx** (Tensor) - A Tensor of shape :math:`(num\_step, batch\_size, hidden\_size)`.
|
||||
Has the same type with input `x`.
|
||||
- **dh_prev** (Tensor) - A Tensor of shape :math:`(batch_size, hidden_size)`.
|
||||
- **dh_prev** (Tensor) - A Tensor of shape :math:`(batch\_size, hidden\_size)`.
|
||||
Has the same type with input `x`.
|
||||
"""
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class CusBatchMatMul(PrimitiveWithInfer):
|
|||
|
||||
|
||||
class CusCholeskyTrsm(PrimitiveWithInfer):
|
||||
"""
|
||||
r"""
|
||||
L * LT = A.
|
||||
LT * (LT)^-1 = I.
|
||||
return (LT)^-1.
|
||||
|
@ -81,7 +81,7 @@ class CusCholeskyTrsm(PrimitiveWithInfer):
|
|||
- **input_x** (Tensor) - The first tensor to be multiplied. The shape of the tensor is :math:`(N, N)`.
|
||||
|
||||
Outputs:
|
||||
Tensor, the shape of the output tensor is :math:`(N // Split_dim, Split_dim, Split_dim)`.
|
||||
Tensor, the shape of the output tensor is :math:`(N // Split\_dim, Split\_dim, Split\_dim)`.
|
||||
|
||||
Examples:
|
||||
>>> input_x = Tensor(np.ones(shape=[256, 256]), mindspore.float32)
|
||||
|
|
|
@ -449,9 +449,9 @@ class Im2Col(Primitive):
|
|||
pads (Union[int, tuple[int], list[int]], optional): The pad of the window, that must be a tuple of
|
||||
one or two or four `int` for height and width. Default: 0.
|
||||
|
||||
- If one int, :math:`pad_height = pad_width`.
|
||||
- If two int, :math:`pad_height = pads[0]`, :math:`pad_width = pads[1]`.
|
||||
- If four int, :math:`pads = [pad_height_top, pad_height_bottom, pad_width_left, pad_width_right]`.
|
||||
- If one int, :math:`pad\_height = pad\_width`.
|
||||
- If two int, :math:`pad\_height = pads[0]`, :math:`pad\_width = pads[1]`.
|
||||
- If four int, :math:`pads = [pad\_height\_top, pad\_height\_bottom, pad\_width\_left, pad\_width\_right]`.
|
||||
|
||||
Inputs:
|
||||
- **x** (Tensor) - input tensor, only 4-D input tensors (batched image-like tensors) are supported.
|
||||
|
@ -1348,9 +1348,9 @@ class MatrixSetDiagV3(Primitive):
|
|||
equal to the longest diagonal value `max_diag_len` calculated
|
||||
by :math:`min(x.shape[-2] + min(k[1], 0), x.shape[-1] + min(-k[0], 0))` .
|
||||
Let x have r + 1 dimensions [I, J, ..., L, M, N].
|
||||
The diagonal tensor has rank r with shape :math:`[I, J, ..., L, max_diag_len]`
|
||||
The diagonal tensor has rank r with shape :math:`[I, J, ..., L, max\_diag\_len]`
|
||||
when k is an integer or :math:`k[0] == k[1]` . Otherwise, it has rank r + 1
|
||||
with shape :math:`[I, J, ..., L, num_diags, max_diag_len]` .
|
||||
with shape :math:`[I, J, ..., L, num\_diags, max\_diag\_len]` .
|
||||
|
||||
Args:
|
||||
align (str, optional): An optional string from: "RIGHT_LEFT", "LEFT_RIGHT", "LEFT_LEFT", "RIGHT_RIGHT".
|
||||
|
|
|
@ -364,8 +364,8 @@ class NonMaxSuppressionV3(Primitive):
|
|||
selected by the algorithm.
|
||||
|
||||
Inputs:
|
||||
- **boxes** (Tensor) - A 2-D Tensor of shape :math:`(num_boxes, 4)`.
|
||||
- **scores** (Tensor) - A 1-D Tensor of shape :math:`(num_boxes)` representing a single score
|
||||
- **boxes** (Tensor) - A 2-D Tensor of shape :math:`(num\_boxes, 4)`.
|
||||
- **scores** (Tensor) - A 1-D Tensor of shape :math:`(num\_boxes)` representing a single score
|
||||
corresponding to each box (each row of boxes), the num_boxes of `scores` must be equal to
|
||||
the num_boxes of `boxes`.
|
||||
- **max_output_size** (Union[Tensor, Number.Int]) - A scalar integer Tensor representing the maximum
|
||||
|
@ -415,7 +415,7 @@ class NonMaxSuppressionV3(Primitive):
|
|||
|
||||
|
||||
class NonMaxSuppressionWithOverlaps(Primitive):
|
||||
"""
|
||||
r"""
|
||||
Greedily selects a subset of bounding boxes in descending order of score.
|
||||
|
||||
Note:
|
||||
|
@ -425,9 +425,9 @@ class NonMaxSuppressionWithOverlaps(Primitive):
|
|||
selected by the algorithm.
|
||||
|
||||
Inputs:
|
||||
- **overlaps** (Tensor) - A 2-D Tensor of shape :math:`(num_boxes, num_boxes)`,
|
||||
- **overlaps** (Tensor) - A 2-D Tensor of shape :math:`(num\_boxes, num\_boxes)`,
|
||||
representing the n-by-n box overlap values. Types allowed:float32.
|
||||
- **scores** (Tensor) - A 1-D Tensor of shape :math:`(num_boxes)` representing a single score
|
||||
- **scores** (Tensor) - A 1-D Tensor of shape :math:`(num\_boxes)` representing a single score
|
||||
corresponding to each box (each row of boxes), the num_boxes of `scores` must be equal to
|
||||
the num_boxes of `overlaps`.
|
||||
Types allowed:float32.
|
||||
|
@ -486,7 +486,7 @@ class NonMaxSuppressionWithOverlaps(Primitive):
|
|||
|
||||
|
||||
class HSVToRGB(Primitive):
|
||||
"""
|
||||
r"""
|
||||
Convert one or more images from HSV to RGB.
|
||||
Outputs a tensor of the same shape as the images tensor,
|
||||
containing the HSV value of the pixels. The output is only
|
||||
|
@ -494,11 +494,11 @@ class HSVToRGB(Primitive):
|
|||
|
||||
Inputs:
|
||||
- **x** (Tensor) - The input image must be a 4-D tensor of shape
|
||||
:math:`[batch, image_height, image_width, channel]`.
|
||||
:math:`[batch, image\_height, image\_width, channel]`.
|
||||
Number of channel must be 3. Types allowed: float16, float32, float64.
|
||||
|
||||
Outputs:
|
||||
A 4-D tensor of shape :math:`[batch, image_height, image_width, channel]`
|
||||
A 4-D tensor of shape :math:`[batch, image\_height, image\_width, channel]`
|
||||
with same type of input.
|
||||
|
||||
Raises:
|
||||
|
@ -850,7 +850,7 @@ class ResizeBicubic(Primitive):
|
|||
|
||||
|
||||
class ResizeArea(Primitive):
|
||||
"""
|
||||
r"""
|
||||
Resize images to a certain size using area interpolation.
|
||||
|
||||
The resizing process only changes the two dimensions of images, which represent the width and height of images.
|
||||
|
@ -871,7 +871,7 @@ class ResizeArea(Primitive):
|
|||
Types allowed: int32.
|
||||
|
||||
Outputs:
|
||||
A 4-D tensor of shape :math:`(batch, new_height, new_width, channels)` with type float32.
|
||||
A 4-D tensor of shape :math:`(batch, new\_height, new\_width, channels)` with type float32.
|
||||
|
||||
Raises:
|
||||
TypeError: If dtype of `images` is not supported.
|
||||
|
@ -1004,7 +1004,7 @@ class CropAndResizeGradImage(Primitive):
|
|||
|
||||
|
||||
class ScaleAndTranslate(Primitive):
|
||||
"""
|
||||
r"""
|
||||
Scale And Translate the input image tensor.
|
||||
|
||||
Note:
|
||||
|
@ -1018,7 +1018,7 @@ class ScaleAndTranslate(Primitive):
|
|||
antialias (bool, optional): Deciding whether to use the antialias. Default: True.
|
||||
|
||||
Inputs:
|
||||
- **images** (Tensor) - A 4-D tensor of shape :math:`(batch, image_height, image_width, channel)`.
|
||||
- **images** (Tensor) - A 4-D tensor of shape :math:`(batch, image\_height, image\_width, channel)`.
|
||||
- **size** (Tensor) - The size of the output image after scale and translate operations. A 1-D tensor with two
|
||||
positive elements whose dtype is int32 and shape must be (2,).
|
||||
- **scale** (Tensor) - Indicates the zoom factor. A 1-D tensor with two positive elements whose dtype is float32
|
||||
|
|
|
@ -7268,7 +7268,7 @@ class NextAfter(Primitive):
|
|||
class TrilIndices(Primitive):
|
||||
r"""
|
||||
Returns the indices of the lower triangular part of a `row` -by- `col` matrix in a Tensor.
|
||||
The Tensor has a shape :math:`(2, tril_size)` where :math:`tril_size` is the number of
|
||||
The Tensor has a shape :math:`(2, tril\_size)` where :math:`tril\_size` is the number of
|
||||
elements in the lower triangular matrix. The first row contains row coordinates of
|
||||
all indices and the second row contains column coordinates.
|
||||
Indices are ordered based on rows and then columns.
|
||||
|
@ -7287,7 +7287,7 @@ class TrilIndices(Primitive):
|
|||
|
||||
Outputs:
|
||||
- **y** (Tensor) - indices of the elements in lower triangular part of matrix. The type specified by `dtype`.
|
||||
The shape of output is :math:`(2, tril_size)`, where :math:`tril_size` is the number of elements in the
|
||||
The shape of output is :math:`(2, tril\_size)`, where :math:`tril\_size` is the number of elements in the
|
||||
lower triangular matrix.
|
||||
|
||||
Raises:
|
||||
|
@ -7492,7 +7492,7 @@ class Orgqr(Primitive):
|
|||
class TriuIndices(Primitive):
|
||||
r"""
|
||||
Returns the indices of the upper triangular part of a `row` -by- `col` matrix in a Tensor.
|
||||
The Tensor has a shape :math:`(2, tril_size)` where :math:`tril_size` is the number of
|
||||
The Tensor has a shape :math:`(2, tril\_size)` where :math:`tril\_size` is the number of
|
||||
elements in the upper triangular matrix. The first row contains row coordinates of
|
||||
all indices and the second row contains column coordinates.
|
||||
Indices are ordered based on rows and then columns.
|
||||
|
@ -7511,7 +7511,7 @@ class TriuIndices(Primitive):
|
|||
|
||||
Outputs:
|
||||
- **y** (Tensor) - indices of the elements in lower triangular part of matrix. The type specified by `dtype`.
|
||||
The shape of output is :math:`(2, tril_size)`, where :math:`tril_size` is the number of elements in the
|
||||
The shape of output is :math:`(2, tril\_size)`, where :math:`tril\_size` is the number of elements in the
|
||||
lower triangular matrix.
|
||||
|
||||
Raises:
|
||||
|
|
|
@ -2082,8 +2082,8 @@ class MaxUnpool2D(Primitive):
|
|||
|
||||
output_shape (tuple[int], optional): The target output size is an optional input. Default: ().
|
||||
|
||||
- If :math:`output_shape == ()` , then the shape of output computed by `kszie`, `strides` and `pads` .
|
||||
- If :math:`output_shape != ()` , then `output_shape` must be :math:`(N, C, H, W)` or :math:`(N, H, W, C)`
|
||||
- If :math:`output\_shape == ()` , then the shape of output computed by `kszie`, `strides` and `pads` .
|
||||
- If :math:`output\_shape != ()` , then `output_shape` must be :math:`(N, C, H, W)` or :math:`(N, H, W, C)`
|
||||
and `output_shape` must belong to :math:`[(N, C, H_{out} - strides[0], W_{out} - strides[1]),
|
||||
(N, C, H_{out} + strides[0], W_{out} + strides[1])]`.
|
||||
|
||||
|
@ -7770,7 +7770,7 @@ class Conv3DBackpropInput(Primitive):
|
|||
data_format (str): The optional value for data format. Currently only support 'NCDHW'.
|
||||
|
||||
Inputs:
|
||||
- **weight** (Tensor) - Set size of kernel is :math:`(D_in, K_h, K_w)`, then the shape is
|
||||
- **weight** (Tensor) - Set size of kernel is :math:`(D_{in}, K_h, K_w)`, then the shape is
|
||||
:math:`(C_{out}, C_{in}, D_{in}, K_h, K_w)`. Currently weight data type only support float16 and float32.
|
||||
- **dout** (Tensor) - the gradients with respect to the output of the convolution.
|
||||
The shape conforms to the default.
|
||||
|
@ -9385,7 +9385,7 @@ class PSROIPooling(Primitive):
|
|||
|
||||
Inputs:
|
||||
- **features** (Tensor) - The input features, whose shape must be :math:`(N, C, H, W)`. With data type is
|
||||
float16 or float32. This formula should hold: :math:`(C == output_dim * group_size * group_size)`.
|
||||
float16 or float32. This formula should hold: :math:`(C == output\_dim * group\_size * group\_size)`.
|
||||
- **rois** (Tensor) - The shape is `(batch, 5, rois_n)`. With data type of float16 or float32.
|
||||
The size of first dimension `batch` is batch_size. The size of the second dimension must be `5`.
|
||||
The size of third dimension `rois_n` is the number of rois. The value of `rois` like:
|
||||
|
@ -9402,7 +9402,7 @@ class PSROIPooling(Primitive):
|
|||
TypeError: If `group_size` or `output_dim` is not an int.
|
||||
TypeError: If `features` or `rois` is not a Tensor.
|
||||
TypeError: If dtype of `rois` is not float16 or float32.
|
||||
ValueError: If shape of `features` does not satisfy :math:`(C == output_dim * group_size * group_size)`.
|
||||
ValueError: If shape of `features` does not satisfy :math:`(C == output\_dim * group\_size * group\_size)`.
|
||||
ValueError: If `spatial_scale` is negative.
|
||||
|
||||
Supported Platforms:
|
||||
|
|
|
@ -436,10 +436,10 @@ class Gamma(PrimitiveWithInfer):
|
|||
|
||||
|
||||
class ParameterizedTruncatedNormal(Primitive):
|
||||
"""
|
||||
r"""
|
||||
Returns a tensor of the specified shape filled with truncated normal values.
|
||||
When `shape` is :math:`(batch_size, *)`, the shape of `mean`, `stdevs`,
|
||||
`min` and `max` should be :math:`()` or :math:`(batch_size, )`.
|
||||
When `shape` is :math:`(batch\_size, *)`, the shape of `mean`, `stdevs`,
|
||||
`min` and `max` should be :math:`()` or :math:`(batch\_size, )`.
|
||||
|
||||
Note:
|
||||
The value in tensor `min` must be strictly less than `max` at any position after broadcasting.
|
||||
|
@ -468,8 +468,8 @@ class ParameterizedTruncatedNormal(Primitive):
|
|||
TypeError: If data type of `shape`, `mean`, `stdevs`, `min` and `max` are not allowed.
|
||||
TypeError: If `mean`, `stdevs`, `min`, `max` don't have the same type.
|
||||
TypeError: If any of `shape`, `mean`, `stdevs`, `min` and `max` is not Tensor.
|
||||
ValueError: When `shape` is :math:`(batch_size, *)`, if the shape of `mean`, `stdevs`, `min` or `max`
|
||||
is not :math:`()` or :math:`(batch_size, )`.
|
||||
ValueError: When `shape` is :math:`(batch\_size, *)`, if the shape of `mean`, `stdevs`, `min` or `max`
|
||||
is not :math:`()` or :math:`(batch\_size, )`.
|
||||
ValueError: If `shape` elements are not positive.
|
||||
ValueError: If `stdevs` elements are not positive.
|
||||
ValueError: If `shape` has less than 2 elements.
|
||||
|
|
|
@ -1395,7 +1395,7 @@ class SparseMatrixNNZ(Primitive):
|
|||
|
||||
|
||||
class SparseFillEmptyRows(Primitive):
|
||||
"""
|
||||
r"""
|
||||
Fill the blank lines in the input 2D SparseTensor with default values.
|
||||
|
||||
Inputs:
|
||||
|
@ -1415,7 +1415,7 @@ class SparseFillEmptyRows(Primitive):
|
|||
- **output_values** (Tensor) - A 1-D Tensor. It represents the value corresponding to the position
|
||||
in the `output_indices`, the shape of which should be :math:`(m,)`, because of being filled, m>=n.
|
||||
- **empty_row_indicator** (Tensor) - A 1-D Tensor. It indicates whether each row is empty.
|
||||
Support bool. The shape is :math:`(dense_shape[0],)`.
|
||||
Support bool. The shape is :math:`(dense\_shape[0],)`.
|
||||
- **reverse_index_map** (Tensor) - A 1-D Tensor. It is the index that means the value here is original
|
||||
rather than filled. Support bool. The shape is :math:`(n, 2)`.
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class OptimizeResults(NamedTuple):
|
|||
|
||||
def minimize(func, x0, args=(), method=None, jac=None, hess=None, hessp=None, bounds=None, constraints=(),
|
||||
tol=None, callback=None, options=None):
|
||||
"""Minimization of scalar function of one or more variables.
|
||||
r"""Minimization of scalar function of one or more variables.
|
||||
|
||||
This API for this function matches SciPy with some minor deviations:
|
||||
|
||||
|
@ -79,7 +79,7 @@ def minimize(func, x0, args=(), method=None, jac=None, hess=None, hessp=None, bo
|
|||
jac (Callable, optional): method for computing the gradient vector. Only for `"BFGS"` and `"LBFGS"`.
|
||||
if it is None, the gradient will be estimated with gradient of ``func``.
|
||||
if it is a callable, it should be a function that returns the gradient vector:
|
||||
:math:`jac(x, *args) -> array_like, shape (n,)`
|
||||
:math:`jac(x, *args) -> array\_like, shape (n,)`
|
||||
where x is an array with shape (n,) and args is a tuple with the fixed parameters.
|
||||
tol (float, optional): tolerance for termination. For detailed control, use solver-specific
|
||||
options. Default: None.
|
||||
|
|
|
@ -68,8 +68,8 @@ class Dice(Metric):
|
|||
|
||||
@rearrange_inputs
|
||||
def update(self, *inputs):
|
||||
"""
|
||||
Updates the internal evaluation result :math:`y_pred` and :math:`y`.
|
||||
r"""
|
||||
Updates the internal evaluation result :math:`y\_pred` and :math:`y`.
|
||||
|
||||
Args:
|
||||
inputs (tuple): Input `y_pred` and `y`. `y_pred` and `y` are Tensor, list or numpy.ndarray. `y_pred` is the
|
||||
|
|
|
@ -52,7 +52,7 @@ class MeanSurfaceDistance(Metric):
|
|||
distance_metric (string): Three measurement methods are supported: "euclidean", "chessboard" or "taxicab".
|
||||
Default: "euclidean".
|
||||
symmetric (bool): Whether to calculate the Mean Surface Distance between y_pred and y.
|
||||
If False, it only calculates :math:`AvgSurDis({y_pred} \rightarrow y)`,
|
||||
If False, it only calculates :math:`AvgSurDis({y\_pred} \rightarrow y)`,
|
||||
otherwise, the mean of distance from `y_pred` to `y` and from `y` to `y_pred`, i.e.
|
||||
:math:`MeanSurDis(y_{pred} \leftrightarrow y)`, will be returned. Default: False.
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class RootMeanSquareDistance(Metric):
|
|||
symmetric (bool): Whether to calculate the symmetric average root mean square distance between
|
||||
y_pred and y. If False, only calculates :math:`RmsSurDis(y_{pred}, y)` surface distance,
|
||||
otherwise, the mean of distance from `y_pred` to `y` and from `y` to `y_pred`, i.e.
|
||||
:math:`RmsSurDis({y_pred} \leftrightarrow y)` will be returned. Default: False.
|
||||
:math:`RmsSurDis({y\_pred} \leftrightarrow y)` will be returned. Default: False.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
|
Loading…
Reference in New Issue