update ops docs

This commit is contained in:
lilinjie 2023-02-26 11:03:48 +08:00
parent 1c4e24f1b1
commit 6e4c429ddc
35 changed files with 235 additions and 176 deletions

View File

@ -7,7 +7,7 @@ mindspore.ops.FillDiagonal
参数:
- **fill_value** (float) - `input_x` 对角线的填充值。
- **wrap** (bool可选) - 控制对于一个高矩阵(即矩阵的行数大于列数),对角线元素是否继续延伸到剩余的行。下面的例子说明产生怎样的效果。默认值False。
- **wrap** (bool可选) - 控制对于一个高矩阵(即矩阵的行数大于列数),对角线元素是否继续延伸到剩余的行。具体效果详见下方代码样例。默认值False。
输入:
- **input_x** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)` 其数据类型必须为float32、int32或者int64。

View File

@ -4,8 +4,8 @@ mindspore.ops.NthElement
.. py:class:: mindspore.ops.NthElement(reverse=False)
寻找并返回输入Tensor最后一维第 :math:`n` 小的值。
如果输入是Vector(rank为1)寻找第n小的值并以Scalar Tensor类型输出结果
对于Matrixrank大于1计算最后一维每一行各自可以看作一个Vector第n小的值。因此,返回值 `values` 的shape满足 `values`.shape = `input`.shape[:-1]。
如果输入是1-D Tensor(即Vector)则找到Vector中第n小的值并将其输出为标量Tensor
对于矩阵或更高维度的输入分别计算每行中的第n小的值或沿着最后一个维度的Vector并输出这些值。因此,返回值 `values` 的shape满足 `values`.shape = `input`.shape[:-1]。
参数:
- **reverse** (bool可选) - 可选参数如果设为True则寻找第 :math:`n` 大的值如果设为False则寻找第n小的值。默认值False。

View File

@ -7,10 +7,11 @@ mindspore.ops.ParameterizedTruncatedNormal
当其shape为 :math:`(batch\_size, *)` 的时候, `mean``stdevs``min``max` 的shape应该为 :math:`()` 或者 :math:`(batch\_size, )`
.. note::
在广播之后,在任何位置, `min` 的值必须严格小于 `max` 的值。
- 在广播之后,在任何位置, `min` 的值必须严格小于 `max` 的值。
- 当 `seed``seed2` 被赋予一个非零值时,该值将被用作种子。否则,将使用一个随机种子。
参数:
- **seed** (int可选) - 随机数种子。如果 `seed` 或者 `seed2` 被设置为非零,则使用这个非零值。否则使用一个随机生成的种子。默认值0。
- **seed** (int可选) - 随机数种子。默认值0。
- **seed2** (int可选) - 另一个随机种子避免发生冲突。默认值0。
输入:

View File

@ -3,8 +3,8 @@ mindspore.ops.RGBToHSV
.. py:class:: mindspore.ops.RGBToHSV
将一张或多张图片由RGB格式转换为HSV格式
输出与输入有相同shape的Tensor含有每个像素的HSV值。输出值仅在[0,1]范围内才是被有效定义的
将一张或多张图像从RGB颜色空间转换为HSV颜色空间
其中每个像素的RGB值转换为其对应的HSV值。此函数仅适用于输入像素值在[0,1]范围内的情况
.. note::
输入图片的最后一维长度必须为3。

View File

@ -11,10 +11,10 @@ mindspore.ops.ResizeArea
`size` 的值必须大于0。
参数:
- **align_corners** (bool可选) - 如果为True则输入输出图像四个角像素的中心被对齐同时保留角像素处的值。默认值False。
- **align_corners** (bool可选) - 指定是否对齐输入和输出Tensor的四个角的中心点。当这个参数设置为True时输出Tensor的角点会和输入Tensor的角点对齐从而保留角点处的值。默认值False。
输入:
- **images** (Tensor) -输入图像为四维的Tensor其shape为 :math:`(batch, channels, height, width)` 支持的数据类型有int8、int16、int32、int64、float16、float32、float64、uint8和uint16。
- **images** (Tensor) -输入图像为四维的Tensor其shape为 :math:`(batch, channels, height, width)` 数据格式为“NHWC”。支持的数据类型有int8、int16、int32、int64、float16、float32、float64、uint8和uint16。
- **size** (Tensor) - 必须为含有两个元素的一维的Tensor分别为new_height, new_width表示输出图像的高和宽。支持的数据类型为int32。
输出:

View File

@ -3,6 +3,8 @@ mindspore.ops.STFT
.. py:class:: mindspore.ops.STFT(n_fft, hop_length, win_length, normalized, onesided, return_complex)
应用短时傅里叶变换STFT于输入信号。
STFT将信号分割成狭窄的时间间隔并对每个片段进行傅立叶变换来量化非平稳信号频率和相位随时间的变化。
更多参考详见 :func:`mindspore.ops.stft`
更多参考详见 :func:`mindspore.ops.stft`

View File

@ -3,14 +3,17 @@ mindspore.ops.SampleDistortedBoundingBoxV2
.. py:class:: mindspore.ops.SampleDistortedBoundingBoxV2(seed=0, seed2=0, aspect_ratio_range=(0.75, 1.33), area_range=(0.05, 1.0), max_attempts=100, use_image_if_no_bounding_boxes=False)
为图像生成单个随机扭曲的边界框。
在图像中创建一个随机扭曲的边界框。
在图像识别或物品定位中,除了提供真实标签之外,通常还提供边界框注释。用于训练这种系统的常用技术是在保持图像内容的同时随机扭曲图像,即数据增强。
此算子根据给定的 `image_size``bounding_boxes` 和一系列约束输出对象的随机扭曲定位即边界框。输出以3个Tensor的形式返回分别是
`begin``size``bboxes` 。前2个Tensor可以直接输入到mindspore.ops.Slice中以裁剪图像。第三个Tensor即为生成的扭曲边界框。
该函数常用于目标定位和图像识别任务。在这样的任务中,除了提供基准标签之外,还提供了边界框注释。通常使用数据增强技术对图像进行随机扭曲,同时保持其内容不变。
该函数需要输入 `image_size``bounding_boxes` 以及一系列限制条件,并基于这些输入输出一个随机扭曲的对象定位框(即边界框)。
输出以三个Tensor的形式返回分别是
`begin``size``bboxes` 。前两个Tensor可以直接输入到 :class:`mindspore.ops.Slice`以裁剪图像。第三个Tensor即为生成的扭曲边界框。
参数:
- **seed** (int可选) - 如果 `seed``seed2` 设置为非零则随机数生成器将使用这两个给定的的种子。否则将使用随机数作为种子。默认值0。
- **seed** (int可选) - 随机数种子。如果 `seed``seed2` 设置为非零则随机数生成器将使用这两个给定的的种子。否则将使用随机数作为种子。默认值0。
- **seed2** (int可选) - 避免种子冲突的第二个种子。默认值0。
- **aspect_ratio_range** (Union[list(float), tuple(float)],可选) - 指定图像的裁剪区域必须具有宽高比范围。区域宽高比 = area_width / area_height。这个属性应为正。默认值(0.75, 1.33)。
- **area_range** (Union[list(float), tuple(float)],可选) - 图像的裁剪区域必须包含在此范围内提供的图像。此属性的值应该在范围(0.0, 1.0]内。默认值:(0.05, 1.0)。

View File

@ -3,7 +3,6 @@ mindspore.ops.SearchSorted
.. py:class:: mindspore.ops.SearchSorted(dtype=mstype.int64, right=False)
`sequence` 的最内维度查找索引,以便最内维度元素的的顺序在插入 `values`值之后维持不变。
返回 `values` 中每个元素应该插入到 `sorted_sequence` 中的位置所对应的索引,以使 `sorted_sequence` 中元素的顺序在插值之后维持不变。
更多参考详见 :func:`mindspore.ops.searchsorted`

View File

@ -3,9 +3,11 @@ mindspore.ops.SegmentMax
.. py:class:: mindspore.ops.SegmentMax
计算Tensor的片段最大值。
计算Tensor中每个分段的最大值。
计算一个Tensor使得 :math:`output_i=max_j(input\_x_j)` 其中求和是在j上满足:math:`segment\_ids[j] == i` 。如果给定 ID :math:`i` 的分段的和为空,则有 :math:`output[i] = 0`
具体来说生成一个新的Tensor `output` ,满足 :math:`output_i=max_j(input\_x_j)` ,其
中最大值在满足 :math:`segment\_ids[j] == i` 这个条件的所有的 `j` 对应的元素中取得。
如果一个分段中没有元素则输出Tensor中相应的元素将被设置为零:math:`output[i] = 0`
输入:
- **input_x** (Tensor) - 输入Tensor。数据类型为实数且秩不小于1的输入Tensor。

View File

@ -3,9 +3,11 @@ mindspore.ops.SegmentMean
.. py:class:: mindspore.ops.SegmentMean
计算Tensor的片段均值。
计算Tensor中每个分段的均值。
计算一个Tensor使得 :math:`output_i=mean_j(input\_x_j)` 其中求和是在j上满足:math:`segment\_ids[j] == i` 。如果给定 ID :math:`i` 的分段的和为空,则有 :math:`output[i] = 0`
具体来说生成一个新的Tensor `output` ,满足 :math:`output_i=mean_j(input\_x_j)` ,其
中均值在满足 :math:`segment\_ids[j] == i` 这个条件的所有的 `j` 对应的元素中取得。
如果一个分段中没有元素则输出Tensor中相应的元素将被设置为零:math:`output[i] = 0`
.. warning::
如果 `input_x` 的数据类型是复数,则无法计算其梯度。

View File

@ -3,9 +3,11 @@ mindspore.ops.SegmentMin
.. py:class:: mindspore.ops.SegmentMin
计算Tensor的片段最小值。
计算Tensor中每个分段的最小值。
计算一个Tensor使得 :math:`output_i=min_j(input\_x_j)` 其中求和是在j上满足:math:`segment\_ids[j] == i` 。如果给定 ID :math:`i` 的分段的和为空,则有 :math:`output[i] = 0`
具体来说生成一个新的Tensor `output` ,满足 :math:`output_i=min_j(input\_x_j)` ,其
中最小值在满足 :math:`segment\_ids[j] == i` 这个条件的所有的 `j` 对应的元素中取得。
如果一个分段中没有元素则输出Tensor中相应的元素将被设置为零:math:`output[i] = 0`
输入:
- **input_x** (Tensor) - 输入Tensor。数据类型为实数且秩不小于1的输入Tensor。

View File

@ -3,9 +3,11 @@ mindspore.ops.SegmentProd
.. py:class:: mindspore.ops.SegmentProd
计算Tensor的片段乘积。
计算Tensor中每个分段所有元素的累积。
计算一个Tensor使得 :math:`output_i = \prod_j input\_x_j` 其中求和是在j上满足:math:`segment\_ids[j] == i` 。如果给定 ID :math:`i` 的分段的和为空,则有 :math:`output[i] = 0`
具体来说生成一个新的Tensor `output` ,满足 :math:`output_i = \prod_j input\_x_j` ,其
中累积是满足 :math:`segment\_ids[j] == i` 这个条件的所有的 `j` 对应的元素相乘的结果。
如果一个分段中没有元素则输出Tensor中相应的元素将被设置为1:math:`output[i] = 1`
.. warning::
如果 `input_x` 的数据类型是复数,则无法计算其梯度。

View File

@ -3,13 +3,15 @@ mindspore.ops.SegmentSum
.. py:class:: mindspore.ops.SegmentSum
计算Tensor的片段和。
计算Tensor中每个分段所有元素的累加合。
具体来说生成一个新的Tensor `output` ,满足 :math:`output_i = \sum_j input\_x_j` ,其
中累加合是满足 :math:`segment\_ids[j] == i` 这个条件的所有的 `j` 对应的元素相加的结果。
如果一个分段中没有元素则输出Tensor中相应的元素将被设置为零:math:`output[i] = 0`
.. warning::
如果 `input_x` 的数据类型是复数,则不能进行反向求导。
计算一个Tensor使得 :math:`output_i = \sum_j input\_x_j` 其中求和是在j上满足:math:`segment\_ids[j] == i` 。如果给定 ID :math:`i` 的分段的和为空,则有 :math:`output[i] = 0`
输入:
- **input_x** (Tensor) - 输入Tensor。数据类型为实数且秩不小于1的输入Tensor。
- **segment_ids** (Tensor) - 数据类型为为int32或int64的一维Tensor。Tensor的大小必须等于 `input_x` 的shape的第一维。其值必须按升序排序不需要覆盖所有有效值范围内的值但必须是正整数。只允许常量值。

View File

@ -3,7 +3,7 @@ mindspore.ops.Tril
.. py:class:: mindspore.ops.Tril(diagonal=0)
返回单个矩阵二维Tensor或批次输入矩阵的下三角形部分,其他位置的元素将被置零。
返回单个或一批二维矩阵下三角形部分,其他位置的元素将被置零。
矩阵的下三角形部分定义为对角线本身和对角线以下的元素。
参数:

View File

@ -3,7 +3,7 @@ mindspore.ops.Triu
.. py:class:: mindspore.ops.Triu(diagonal=0)
返回单个矩阵上三角形部分,其他位置的元素将被置零。
返回单个或一批二维矩阵上三角形部分,其他位置的元素将被置零。
矩阵的上三角形部分定义为对角线和对角线上方的元素。
参数:

View File

@ -7,11 +7,12 @@ mindspore.ops.TruncatedNormal
生成的值符合正态分布。
.. warning::
`shape` 所含元素的值必须大于零。输出长度必须不超过1000000。
.. note::
- `shape` 所含元素的值必须大于零。输出长度必须不超过1000000。
- 当 `seed``seed2` 被赋予一个非零值时,该值将被用作种子。否则,将使用一个随机种子。
参数:
- **seed** (int可选) - 随机数种子。如果 `seed` 或者 `seed2` 被设置为非零,则使用这个非零值。否则使用一个随机生成的种子。默认值0。
- **seed** (int可选) - 随机数种子。默认值0。
- **seed2** (int可选) - 另一个随机种子避免发生冲突。默认值0。
- **dtype** (mindspore.dtype可选) - 指定输出类型。可选值为mindspore.float16、mindspore.float32和mindspore.float64。默认值mindspore.float32。

View File

@ -3,10 +3,10 @@ mindspore.ops.UnravelIndex
.. py:class:: mindspore.ops.UnravelIndex
将索引数组转换为坐标数组的元组。
由扁平化索引组成的数组转换为包含坐标数组的元组。
输入:
- **indices** (Tensor) - 其元素将换为shape为 `dims` 的坐标数组。维度为零维或者一维其数据类型为int32或int64。
- **indices** (Tensor) - 输入Tensor其元素将换为shape为 `dims` 的坐标数组。维度为零维或者一维其数据类型为int32或int64。
- **dims** (Tensor) - `indices` 转换之后的shape输入Tensor。其维度必须为1数据类型与 `indices` 一致。
输出:
@ -17,4 +17,3 @@ mindspore.ops.UnravelIndex
- **TypeError** - 如果 `indices``dims` 的数据类型不是int32或int64。
- **ValueError** - 如果 `dims` 维度不等于1或者 `indices` 维度不是0或1。
- **ValueError** - 如果 `indices` 包含负数。

View File

@ -5,9 +5,9 @@ mindspore.ops.addr
计算 `vec1``vec2` 的外积,并将其添加到 `x` 中。
如果 `vec1` 是一个大小为 :math:`N` 的向量, `vec2` 是一个大小为 :math:`M` 的向量,那么 `x` 必须可以和大小为 :math:`(N, M)` 的矩阵广播,同时返回是一个大小为 :math:`(N, M)` 的矩阵
如果 `vec1` 是一个大小为 :math:`N` 的向量, `vec2` 是一个大小为 :math:`M` 的向量,那么 `x` 必须可以和大小为 :math:`(N, M)` 的矩阵广播。
可选值 `bata``alpha` 分别是 `vec1``vec2` 外积的扩展因子以及附加矩阵 `x` 。如果 `beta` 为0那么 `x`被忽略
可选值 `bata``alpha` 分别是 `vec1``vec2` 外积以及附加矩阵 `x` 的扩展因子。如果 `beta` 为0那么 `x`不参与计算
.. math::
output = β x + α (vec1 ⊗ vec2)

View File

@ -3,7 +3,7 @@ mindspore.ops.deg2rad
.. py:function:: mindspore.ops.deg2rad(x)
计算一个新的Tensor其中 `x` 的每个角度元素都从度转换为弧度
逐元素地将 `x` 从度数制转换为弧度制
参数:
- **x** (Tensor[Number]) - 输入的Tensor。其必须是一个正定矩阵数据类型为float16float32或float64。

View File

@ -3,9 +3,9 @@ mindspore.ops.diff
.. py:function:: mindspore.ops.diff(x, n=1, axis=-1, prepend=None, append=None)
沿着给定维度计算输入Tensor的n阶前向差分。
沿着给定维度计算输入Tensor `x` 的n阶前向差分。
第一阶差分沿着给定轴由如下公式计算::math:`out[i] = a[i+1] - a[i]` ,更高阶差分通过迭代使`diff` 计算。
第一阶差分沿着给定 `axis` 由如下公式计算::math:`out[i] = a[i+1] - a[i]` ,更高阶差分通过将上一阶计算结果作为输入迭代调`diff` 计算。
.. note::
不支持空Tensor, 如果传入了空Tensor会出现ValueError。
@ -14,8 +14,8 @@ mindspore.ops.diff
- **x** (Tensor) - 输入Tensor。x元素的数据类型不支持uint16、uint32 或 uint64。
- **n** (int可选) - 递归计算差分的阶数目前只支持1。默认值1。
- **axis** (int可选) - 计算差分的维度,默认是最后一维。默认值:-1。
- **prepend** (Tensor可选) - 在计算差分之前,沿 axis 将值添加到 input 或附加到 input。它们的维度必须与输入的维度相同并且它们的shape必须与输入的shape匹配但 axis 除外。默认值None。
- **append** (Tensor可选) - 在计算差分之前,沿 axis 将值添加到 input 或附加到 input。它们的维度必须与输入的维度相同并且它们的shape必须与输入的shape匹配但 axis 除外。默认值None。
- **prepend** (Tensor可选) - 在计算差分之前,沿 axis 添加到 `x` 之前的值。它们的维度必须与输入的维度相同并且它们的shape必须与输入的shape匹配但 axis 除外。默认值None。
- **append** (Tensor可选) - 在计算差分之前,沿 axis 添加到 `x` 之后的值。它们的维度必须与输入的维度相同并且它们的shape必须与输入的shape匹配但 axis 除外。默认值None。
返回:
Tensor输入Tensor差分后的结果。输出的shape除了第 `axis` 维上尺寸缩小 `n` 以外,与 `x` 一致。输出的类型与 `x` 一致。

View File

@ -3,13 +3,15 @@ mindspore.ops.ldexp
.. py:function:: mindspore.ops.ldexp(x, other)
将输入乘以 :math:`2^{other}`
逐元素将输入Tensor乘以 :math:`2^{other}`
该函数使用两个参数,即尾数 `x` 和指数 `other` ,并将它们的乘积作为浮点数返回:
.. math::
out_{i} = x_{i} * ( 2_{i} ^{other} )
.. note::
通常,该函数可以通过将输入中的尾数乘以 `other` 中的指数的整数2的幂来创建浮点数
该函数通常用于由尾数和幂构造浮点数,或将浮点数按二的幂进行缩放
参数:
- **x** (Tensor) - 输入的一个Tensor。

View File

@ -3,7 +3,7 @@ mindspore.ops.matrix_exp
.. py:function:: mindspore.ops.matrix_exp(x)
计算方阵的矩阵指数。支持batch维输入。
计算单个或一批方阵的矩阵指数。
.. math::

View File

@ -3,8 +3,10 @@ mindspore.ops.orgqr
.. py:function:: mindspore.ops.orgqr(x, tau)
计算 `Householder <https://en.wikipedia.org/wiki/Householder_transformation#Householder_matrix>`_ 矩阵乘积的前 :math:`N` 列。
以输入无批次的情况为例, 假设输入x的shape经过 `Householder转换 <https://en.wikipedia.org/wiki/Householder_transformation#Householder_matrix>`_ 之后为::math:`(M, N)`
计算 :class:`mindspore.ops.Geqrf` 返回的正交矩阵 :math:`Q` 的显式表示。
下面以输入无batch维的情况为例 计算 `Householder <https://en.wikipedia.org/wiki/Householder_transformation#Householder_matrix>`_ 矩阵的前 :math:`N` 列。
假设输入 `x` 的shape经过 `Householder转换 <https://en.wikipedia.org/wiki/Householder_transformation#Householder_matrix>`_ 之后为::math:`(M, N)`
`x` 的对角线被置为1 `x` 中下三角形的每一列都表示为: :math:`w_j` ,其中 :math:`j`:math:`j=1, \ldots, M` 范围内此函数返回Householder矩阵乘积的前 :math:`N` 列:
.. math::

View File

@ -13,7 +13,7 @@ mindspore.ops.pdist
参数:
- **x** (Tensor) - 输入Tensor `x` 其shape为 :math:`(*B, N, M)`,其中 :math:`*B` 表示批处理大小可以是多维度。类型float16float32或float64。
- **p** (float) - p-范数距离的p值:math:`p∈[0∞]`。默认值2.0。
- **p** (float) - 范数距离的阶, :math:`p∈[0∞)`。默认值2.0。
返回:
Tensor类型与 `x` 一致。
@ -24,4 +24,3 @@ mindspore.ops.pdist
- **TypeError** - `p` 不是float。
- **ValueError** - `p` 是负数。
- **ValueError** - `x` 的维度小于2。

View File

@ -3,7 +3,7 @@ mindspore.ops.rad2deg
.. py:function:: mindspore.ops.rad2deg(x)
计算一个新的Tensor其中 `x` 的每个角度元素都从弧度转换为度
逐元素地将 `x` 从弧度制转换为度数制
参数:
- **x** (Tensor) - 输入的Tensor。

View File

@ -3,7 +3,7 @@ mindspore.ops.unfold
.. py:function:: mindspore.ops.unfold(input, kernel_size, dilation=1, padding=0, stride=1)
从一个输入Tensor中提取出滑动的局部区域块。输入Tensor格式为(N, C, H, W)
通过从数据格式为NCHW的Tensor中提取局部滑块并沿新的维度连接它们来重新排列输入Tensor
.. warning::
目前仅支持输入为一个四维的Tensor类似图片格式

View File

@ -5925,8 +5925,8 @@ def _check_unfold_params(param, param_name, param_size):
def unfold(input, kernel_size, dilation=1, padding=0, stride=1):
"""
Extracts sliding local blocks from a batched input tensor. Format
of the input Tensor is (N, C, H, W).
Reshapes a tensor of format (N, C, H, W) by extracting sliding local blocks from the input Tensor
and concatenating them along a new dimension.
.. warning::
- Currently, only 4-D input tensors (batched image-like tensors) are supported.

View File

@ -3260,7 +3260,7 @@ def det(x):
def matrix_exp(x):
r"""
Computes the matrix exponential of a square matrix. Supports batched inputs.
Computes the exponential of a single or a batch of square matrices.
.. math::
@ -3490,28 +3490,26 @@ def trunc(input):
def ldexp(x, other):
"""
Multiplies input by :math:`2^{other}` .
Multiplies input Tensor by :math:`2^{other}` element-wise.
It takes two arguments, a mantissa `x` and an exponent `other`,
and returns their product as a floating-point number:
.. math::
out_{i} = x_{i} * ( 2_{i} ^{other} )
out_{i} = x_{i} * ( 2 ^{other_{i}} )
Note:
Typically this function can create floating point numbers
by multiplying mantissas in input with powers of integer 2
from the exponents in `other`.
This function is commonly used to construct
floating-point numbers from their component parts, or to scale a
floating-point number by a power of two.
Args:
x (Tensor): The input tensor.
other (Tensor): A tensor of exponents, typically integers.
x (Tensor): The input Tensor.
other (Tensor): A Tensor of integers that represent exponents.
Returns:
Tensor, the output tensor.
Raises:
TypeError: If `x` is not a Tensor.
TypeError: If `other` is not a Tensor.
ValueError: If shape of `x` and `other` can not broadcast.
Tensor, the output Tensor.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
@ -4382,10 +4380,13 @@ def median(x, axis=-1, keepdims=False):
def orgqr(x, tau):
r"""
Computes the first :math:`N` columns of a product of
Calculates the explicit representation of the orthogonal matrix :math:`Q`
returned by :class:`mindspore.ops.Geqrf`.
Take the case of input without batch dimension as an example,
computes the first :math:`N` columns of a product of
`Householder <https://en.wikipedia.org/wiki/Householder_transformation#Householder_matrix>`_
matrices. Take the case of input without batch
as an example. Suppose input `x` is a matrix of size :math:`(M, N)` after householder transformation.
matrices. Suppose input `x` is a matrix of size :math:`(M, N)` after householder transformation.
When the diagonal of `x` is set to 1, every colunm of lower triangular in `x` is
denoted as :math:`w_j` for :math:`j` for
:math:`j=1, \ldots, M`, this function returns the first :math:`N` columns of the matrix
@ -5344,13 +5345,13 @@ def adjoint(x):
def addr(x, vec1, vec2, beta=1, alpha=1):
"""
Executes the outer-product of `vec1` and `vec2` and adds it to the matrix `x`.
Computes the outer product of two vector `vec1` and `vec2`, and adds the resulting matrix to `x`.
If `vec1` is a vector of size :math:`N` and `vec2` is a vector of size :math:`M`, then `x` must be broadcastable
with a matrix of size :math:`(N, M)` and `out` will be a matrix of size :math:`(N, M)`.
Given `vec1` and `vec2` of sizes :math:`N` and :math:`M`,
`x` must be able to broadcast to a matrix of shape :math:`(N, M)`.
The optional values `beta` and `alpha` are the scale factors on the outer product between `vec1` and `vec2`
and the added matrix `x` respectively. If `beta` is 0, then `x` will be ignored.
`beta` and `alpha` are optional scaling factors for the outer product of :math:`vec1` and :math:`vec2`,
and the matrix `x` respectively. Setting `beta` to 0 will exclude `x` from the computation.
.. math::
output = β x + α (vec1 vec2)
@ -5746,10 +5747,10 @@ def _check_input_2d(input_shape, param_name, func_name):
def deg2rad(x):
"""
Calculates a new tensor with each of the elements of `x` converted from angles in degrees to radians.
Converts angles in degrees to angles in radians element-wise.
Args:
x (Tensor[Number]): The input tensor. It must be a positive-definite matrix.
x (Tensor[Number]): The input tensor.
With float16, float32 or float64 data type.
Returns:
@ -5784,7 +5785,7 @@ def deg2rad(x):
def rad2deg(x):
"""
Returns a new tensor with each of the elements of `x` converted from angles in radians to degrees.
Converts angles in radians to angles in degrees element-wise.
Args:
x (Tensor): The input tensor.
@ -6239,10 +6240,11 @@ def _check_is_int(arg_value, arg_name, cls_name):
def diff(x, n=1, axis=-1, prepend=None, append=None):
r"""
Calculates the n-th discrete difference along the given axis.
Computes the n-th discrete difference along a specified axis of a given input `x`.
The first difference is given by :math:`out[i] = a[i+1] - a[i]` along the given axis,
higher differences are calculated by using `diff` iteratively.
The first difference is calculated as :math:`out[i] = a[i+1] - a[i]` along the specified `axis`.
To compute higher differences, the function is called recursively
using the output from the previous iteration as input.
Note:
Zero-shaped Tensor is not supported, a value error is raised if
@ -6252,18 +6254,18 @@ def diff(x, n=1, axis=-1, prepend=None, append=None):
x (Tensor): Input tensor.
Full support for signed integers, partial support for floats and complex numbers
n (int, optional): The number of times values are differenced. If zero,
the input is returned as-is. Default: 1. Currently only 1 is supported.
the input is returned as-is. Currently only 1 is supported. Default: 1.
axis (int, optional): The axis along which the difference is taken, default
is the last axis. Default: -1.
prepend (Tensor, optional): Values to prepend or append to a along
prepend (Tensor, optional): Values to prepend to `x` along
`axis` prior to performing the difference. Scalar values are expanded to
arrays with length 1 in the direction of `axis` and the shape of the input
array in along all other axis. Otherwise the dimension and shape must
array along all other axis. Otherwise the dimension and shape must
match `x` except along `axis`. Default: None.
append (Tensor, optional): Values to prepend or append to a along
append (Tensor, optional): Values to append to `x` along
`axis` prior to performing the difference. Scalar values are expanded to
arrays with length 1 in the direction of `axis` and the shape of the input
array in along all other axis. Otherwise the dimension and shape must
array along all other axis. Otherwise the dimension and shape must
match `x` except along `axis`. Default: None.
Returns:
@ -6343,8 +6345,8 @@ def tril_indices(row, col, offset=0, dtype=mstype.int64):
Examples:
>>> output = ops.tril_indices(4, 3, -1, mindspore.int64)
>>> print(output)
[[2 3 3]
[0 0 1]]
[[1 2 2 3 3 3]
[0 0 1 0 1 2]]
>>> print(output.dtype)
Int64
"""
@ -8399,7 +8401,7 @@ def baddbmm(x, batch1, batch2, beta=1, alpha=1):
def log2(x):
r"""
Returns a new tensor with the logarithm to the base 2 of the elements of input.
Returns a new Tensor by taking the base 2 logarithm of the elements in the input Tensor.
.. math::
y_i = log_2(x_i)
@ -8615,7 +8617,7 @@ def xdivy(x, y):
def log10(x):
r"""
Returns a new tensor with the logarithm to the base 10 of the elements of input.
Returns a new Tensor by taking the base 10 logarithm of the elements in the input Tensor.
.. math::
y_i = log_{10}(x_i)

View File

@ -2632,9 +2632,11 @@ def deformable_conv2d(x, weight, offsets, kernel_size, strides, padding, bias=No
def pdist(x, p=2.0):
r"""
Computes the p-norm distance between each pair of row vectors in the input. If `x` is a 2D Tensor of
shape :math:`(N, M)`, then `output` must be a 1D Tensor of shape :math:`(N * (N - 1) / 2,)`. If `x` is a
Tensor of shape :math:`(*B, N, M)`, then `output` must be a Tensor of shape :math:`(*B, N * (N - 1) / 2)`.
Calculates the distance between every pair of row vectors in
the input using the p-norm. If the input `x` is a 2D Tensor with shape :math:`(N, M)`,
the `output` must be a 1D Tensor with shape :math:`(N * (N - 1) / 2,)`. If `x` has batch
dimension with shape :math:`(*B, N, M)`, then the `output` must be a Tensor with
shape :math:`(*B, N * (N - 1) / 2)`.
.. math::
y[n] = \sqrt[p]{{\mid x_{i} - x_{j} \mid}^p}
@ -2644,7 +2646,7 @@ def pdist(x, p=2.0):
Args:
x (Tensor): Input tensor of shape :math:`(*B, N, M)`. :math:`*B` is batch size, one-dim or multi-dim.
dtype: float16, float32 or float64.
p (float): p value for the p-norm distance to calculate between each vector pair. :math:`p[0,]`. Default: 2.0.
p (float): The order of norm distance, :math:`p[0,)`. Default: 2.0.
Returns:
Tensor, has the same dtype as `x`.

View File

@ -76,11 +76,11 @@ class _ScatterOp(PrimitiveWithInfer):
class UnravelIndex(Primitive):
"""
Converts an array of flat indices into a tuple of coordinate arrays.
Transforms an array consisting of flattened indices into a tuple that contains coordinate arrays.
Inputs:
- **indices** (Tensor) - Input Tensor whose elements are indices converting into
the flattened version of an array of dimensions dims.
- **indices** (Tensor) - The input Tensor, containing indices that will be transformed
into the flattened form of an array with dimensions specified by `dims`.
The dimension of `indices` must be 0-D or 1-D.
Must be one of the following types: int32, int64.
- **dims** (Tensor) - The shape of the array to use for unraveling indices.
@ -3854,7 +3854,7 @@ class ResizeNearestNeighborV2(Primitive):
ValueError: If attr `half_pixel_centers` and `align_corners` are True at the same time.
Supported Platforms:
``Ascend`` ``CPU``
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> input_tensor = Tensor(np.ones((1, 4, 4, 1)), mstype.float32)
@ -4394,9 +4394,10 @@ class ScatterSub(Primitive):
class Triu(Primitive):
"""
Returns the higher triangular part of a single Tensor,
the other elements of the result tensor out are set to 0.
The higher triangular part of the matrix is defined as the elements on and above the diagonal.
Returns the upper triangular portion of the 2-D matrix or the set of matrices
in a batch. The remaining elements of the resulting Tensor are assigned a value of 0.
The upper triangular section of the matrix comprises of the
elements present on and above the main diagonal.
Args:
diagonal (int, optional): The index of diagonal. Default: 0, indicating the main diagonal.
@ -6189,9 +6190,8 @@ class MaskedSelect(PrimitiveWithCheck):
class SearchSorted(Primitive):
"""
Find the indices from the innermost dimension of `sorted_sequence` such that the order of the innermost dimension
within `sorted_sequence` would be preserved when the corresponding values in `values` were inserted before the
indices.
Returns the indices correspond to the positions where the given numbers in `values` should be inserted
into `sorted_sequence` so that the order of the sequence is maintained.
Refer to :func:`mindspore.ops.searchsorted` for more details.
@ -6649,11 +6649,12 @@ class SplitV(Primitive):
(x_1, x_2, ..., x_{m_N}, ..., x_R))
Args:
size_splits (Union[tuple, list]): The list containing the sizes of each output tensor
along the split dimension. Must sum to the dimension of value along `split_dim`.
Can contain one -1 indicating that dimension is to be inferred.
split_dim (int): The dimension along which to split. Must be in the range [-len(input_x.shape),
len(input_x.shape)).
size_splits (Union[tuple, list]): A tuple or list of sizes of each output tensor along the split
dimension, and the sum of these sizes should equal to the dimension of the
input tensor along `split_dim`. The list may also contain a single instance of
the value -1, which indicates that the size of that dimension should be inferred.
split_dim (int): An int indicates the dimension along which to split.
Must be in the range [-len(input_x.shape), len(input_x.shape)).
num_split (int): The number of output tensors. Must be positive int.
Inputs:
@ -7249,9 +7250,10 @@ class NonZero(Primitive):
class Tril(Primitive):
"""
Returns the lower triangular part of the matrix (2-D tensor) or batch of matrices input,
the other elements of the result tensor out are set to 0.
The lower triangular part of the matrix is defined as the elements on and below the diagonal.
Returns the lower triangular portion of the 2-D matrix or the set of matrices
in a batch. The remaining elements of the resulting Tensor are assigned a value of 0.
The lower triangular section of the matrix comprises of the
elements present on and below the main diagonal.
Args:
diagonal (int, optional): An optional attribute indicates the diagonal to consider, default: 0,
@ -7399,10 +7401,13 @@ class IndexPut(Primitive):
class SegmentMax(Primitive):
r"""
Computes the maximum along segments of a tensor.
Computes the maximum along segments of a Tensor.
Computes a tensor such that :math:`output_i=max_j(input\_x_j)` where max is over :math:`j` such that
:math:`segment\_ids[j] == i`. If the max is empty for a given segment ID :math:`i`, :math:`output[i] = 0`.
Specifically, it generates a new Tensor `output` such that :math:`output_i=max_j(input\_x_j)`
in which the maximum value is obtained from all elements corresponding
to :math:j that meets :math:`segment\_ids[j] == i`.
If a segment contains no elements for a given segment :math:`i`,
then the corresponding element in the output Tensor is set to zero: :math:`output[i] = 0`.
Inputs:
- **input_x** (Tensor) - The input tensor whose dtype is real number and whose rank is not less than 1.
@ -7449,10 +7454,13 @@ class SegmentMax(Primitive):
class SegmentMin(Primitive):
r"""
Computes the minimum along segments of a tensor.
Computes the minimum along segments of a Tensor.
Computes a tensor such that :math:`output_i=min_j(input\_x_j)` where :math:`min` is over :math:`j` such that
:math:`segment\_ids[j] == i`. If the min is empty for a given segment ID :math:`i`, :math:`output[i] = 0`.
Specifically, it generates a new Tensor `output` such that :math:`output_i=min_j(input\_x_j)`
in which the minimum value is obtained from all elements corresponding
to :math:j that meets :math:`segment\_ids[j] == i`.
If a segment contains no elements for a given segment :math:`i`,
then the corresponding element in the output Tensor is set to zero: :math:`output[i] = 0`.
Inputs:
- **input_x** (Tensor) - The input tensor whose dtype is real number and whose rank is not less than 1.
@ -7499,10 +7507,13 @@ class SegmentMin(Primitive):
class SegmentSum(Primitive):
r"""
Computes the sum along segments of a tensor.
Computes the cumulative sum along segments of a Tensor.
Computes a tensor such that :math:`output_i = \sum_j input\_x_j` where sum is over :math:`j` such that
:math:`segment\_ids[j] == i`. If the sum is empty for a given segment ID :math:`i`, :math:`output[i] = 0`.
Specifically, it generates a new Tensor `output` such that :math:`output_i = \sum_j input\_x_j`
in which the cumulative sum is obtained from all elements corresponding
to :math:j that meets :math:`segment\_ids[j] == i`.
If a segment contains no elements for a given segment :math:`i`,
then the corresponding element in the output Tensor is set to 0: :math:`output[i] = 0`.
.. warning::
If the dtype of `input_x` is complex number, the gradient can not be calculated.
@ -7778,10 +7789,13 @@ class AffineGrid(Primitive):
class SegmentMean(Primitive):
r"""
Computes the mean along segments of a tensor.
Computes the mean along segments of a Tensor.
Computes a tensor such that :math:`output_i = mean_j(input\_x_j)` where mean is over :math:`j` such that
:math:`segment\_ids[j] == i`. If the mean is empty for a given segment ID :math:`i`, :math:`output[i] = 0`.
Specifically, it generates a new Tensor `output` such that :math:`output_i=mean_j(input\_x_j)`
in which the mean value is obtained from all elements corresponding
to :math:j that meets :math:`segment\_ids[j] == i`.
If a segment contains no elements for a given segment :math:`i`,
then the corresponding element in the output Tensor is set to zero: :math:`output[i] = 0`.
.. warning::
If the dtype of `input_x` is complex number, the gradient can not be calculated.
@ -7832,10 +7846,13 @@ class SegmentMean(Primitive):
class SegmentProd(Primitive):
r"""
Computes the prod along segments of a tensor.
Computes the cumulative product along segments of a Tensor.
Computes a tensor such that :math:`output_i = \prod_j input\_x_j` where prod is over :math:`j` such that
:math:`segment\_ids[j] == i`. If the prod is empty for a given segment ID :math:`i`, :math:`output[i] = 0`.
Specifically, it generates a new Tensor `output` such that :math:`output_i = \prod_j input\_x_j`
in which the cumulative product is obtained from all elements corresponding
to :math:j that meets :math:`segment\_ids[j] == i`.
If a segment contains no elements for a given segment :math:`i`,
then the corresponding element in the output Tensor is set to 1: :math:`output[i] = 1`.
.. warning::
If the dtype of `input_x` is complex number, the gradient can not be calculated.

View File

@ -606,9 +606,9 @@ class CropAndResizeGradBoxes(Primitive):
class RGBToHSV(Primitive):
"""
Convert one or more images from RGB to HSV.
Outputs a tensor of the same shape as the images tensor, containing the HSV value of the pixels.
The output is only well defined if the value in images are in [0,1].
Transform one single or a batch of images from RGB to HSV color space.
Each pixel's RGB value is converted to its corresponding HSV value.
Note that the function is only well-defined for input pixel values in the range [0, 1].
Note:
Last dimension of input images must be size 3.
@ -862,12 +862,15 @@ class ResizeArea(Primitive):
The values of `size` must be greater than zero.
Args:
align_corners (bool, optional): If true, the centers of the 4 corner pixels of the input and output
tensors are aligned, preserving the values at the corner pixels. Defaults: False.
align_corners (bool, optional): A boolean flag that specifies whether
to align the centers of the four corner pixels of the input and output tensors.
When this flag is set to True, the corner pixels of the output tensor are aligned
with the corner pixels of the input tensor, which preserves the values at the corner pixels.
Defaults: False.
Inputs:
- **images** (Tensor) - Input images must be a 4-D tensor with shape
which is :math:`(batch, channels, height, width)`. The format must be NHWC.
which is :math:`(batch, channels, height, width)`. The format must be "NHWC".
Types allowed: int8, int16, int32, int64, float16, float32, float64, uint8, uint16.
- **size** (Tensor) - Input size must be a 1-D tensor of 2 elements: new_height, new_width.
The new size of output image.

View File

@ -7000,6 +7000,8 @@ class Cholesky(Primitive):
class STFT(Primitive):
"""
Applies Short-time Fourier transform (STFT) on input signal.
STFT segments the signal into narrow time intervals and takes the Fourier transform
of each segment to quantify the change of a nonstationary signals frequency
and phase content over time.
@ -7487,7 +7489,8 @@ class NanToNum(Primitive):
class Orgqr(Primitive):
r"""
Computes the first :math:`N` columns of a product of Householder matrices.
Calculates the explicit representation of the orthogonal matrix :math:`Q`
returned by :class:`mindspore.ops.Geqrf`.
Refer to :func:`mindspore.ops.orgqr` for more details.

View File

@ -9239,19 +9239,21 @@ class FractionalAvgPool(Primitive):
class NthElement(Primitive):
r"""
Finds values of the n-th order statistic for the last dimension.
If the input is a vector (rank-1), finds the entries which is the nth-smallest value in
the vector and outputs their values as scalar tensor.
For matrices (resp. higher rank input), computes the entries which is the nth-smallest value in
each row (resp. vector along the last dimension). Thus, values.shape = input.shape[:-1].
Computes the n-th smallest values for the last dimension of the input Tensor.
- When `input` is a 1-D Tensor (i.e. Vector), it finds the nth-smallest value in the vector
and outputs its value as a scalar Tensor.
- When `input` is matrices or has higher rank, it finds the nth-smallest value
in each row (or vector along the last dimension) and outputs
these values in a Tensor with shape of `values.shape = input.shape[:-1]`.
Args:
reverse (bool, optional): An optional bool. When set to True, find the nth-largest value
in the vector and vice versa. Default: False.
reverse (bool, optional): An optional bool. If set to True, it find the nth-largest value
in the vector instead of the nth-smallest. Default: False.
Inputs:
- **input** (Tensor) - A Tensor. 1-D or higher with last dimension at least :math:`n+1`.
- **n** (Union[int, Tensor]) - If the n is a tensor, it should be a 0-D tensor, dtype is int32.
- **n** (Union[int, Tensor]) - If the `n` is a Tensor, it should be a 0-D Tensor, dtype is int32.
Valid range of n is :math:`[0, input.shape[-1])`.
Outputs:

View File

@ -213,43 +213,53 @@ class BoundingBoxDecode(Primitive):
class SampleDistortedBoundingBoxV2(Primitive):
r"""
Generate a single randomly distorted bounding box for an image.
Creates a single bounding box that is randomly distorted for an image.
Bounding box annotations are often supplied in addition to ground-truth labels in image recognition or object
localization tasks. A common technique for training such a system is to randomly distort an image while preserving
its content, i.e. data augmentation. This Op outputs a randomly distorted localization of an object, i.e. bounding
box, given an `image_size`, `bounding_boxes` and a series of constraints. The output is returned as 3 tensors:
`begin`, `size` and `bboxes`. The first 2 tensors can be fed directly into mindspore.ops.Slice to crop the image.
It is often used for object localization and image recognition tasks.
In such tasks, bounding box annotations are supplied in addition to ground-truth
labels, and data augmentation techniques are often used to randomly distort an image
while preserving its content.
This function takes the `image_size`, `bounding_boxes`, and
a series of constraints as input, and outputs a randomly distorted localization of an
object (i.e., bounding box) based on these inputs.
The output is returned as 3 tensors:
The output is returned as 3 tensors:
`begin`, `size` and `bboxes`. The first 2 tensors can be fed directly
into :class:`mindspore.ops.Slice` to crop the image.
The latter is the generated distorted bounding box.
Args:
seed (int, optional): If either `seed` or `seed2` is set to non-zero, the random number generator is
seeded by the given seed. Otherwise, it is seeded by a random seed. Default: 0.
seed2 (int, optional): A second seed to avoid seed collision. Default: 0.
seed (int, optional): Random number seed. If either `seed` or `seed2` is set to a non-zero value,
the seed is to the given value. Otherwise, a random seed is uesed. Default: 0.
seed2 (int, optional): The second seed to avoid seed collision. Default: 0.
aspect_ratio_range (Union[list(float), tuple(float)], optional): Specifying the valild range of aspect
ratio of cropped area. Aspect ratio of area = area_width / area_height. The value of this
attribute should be positive. Default: (0.75, 1.33).
area_range (Union[list(float), tuple(float)], optional): The cropped area of the image must contain a
fraction of the supplied image within this range. The value of this attribute should
be in range (0.0, 1.0]. Default: (0.05, 1.0).
max_attempts (int, optional): Number of attempts at generating a cropped region of the image
of the specified constraints. After max_attempts failures, return the entire image. The value of
this attribute should be positive. Default: 100.
max_attempts (int, optional): A poditive integer specifies the number of attempts that will be made to
generate a cropped region of the image based on the given constraints. If the maximum number of
attempts is exceeded without success, the function will return the entire original image.
Default: 100.
use_image_if_no_bounding_boxes (bool, optional): Controls behavior if no bounding boxes supplied.
If no bounding boxes supplied (`bounding_boxes` in shape [0, N, 4] or [batch, 0, 4]), and this
attribute is set True, then assume an implicit bounding box covering the
whole input, else if this attribute is set False, then raise an error. Default: False.
Inputs:
- **image_size** (Tensor) - 1-D, containing [height, width, channels]. The value of this input
- **image_size** (Tensor) - 1-D Tensor, containing [height, width, channels]. The value of this input
tensor should be positive.
- **bounding_boxes** (Tensor) - 3-D with shape [batch, N, 4] describing the N bounding boxes associated with
the image. The value of this input tensor should be in range [0.0, 1.0]. The
data type is float32.
- **min_object_covered** (Tensor) - The cropped area of the image must contain at least this fraction of any
bounding box supplied. The value of this parameter should be in range
[0.0, 1.0]. In the case of 0, the cropped area does not need to overlap any
of the bounding boxes supplied. The data type is float32.
- **bounding_boxes** (Tensor) - 3-D Tensor with shape :math:`(batch, N, 4)` describing the N
bounding boxes associated with the image. The value of this input tensor should be in range [0.0, 1.0].
The data type is float32.
- **min_object_covered** (Tensor) - The least fraction of bounding box the croped area need to cover.
This parameter's value should be between 0.0 and 1.0, inclusive. If the value is 0,
the cropped area does not need to overlap with any of the supplied bounding boxes.
The data type is float32.
Outputs:
- **begin** (Tensor) - A 1-D Tensor, containing [offset_height, offset_width, 0]. The data type is same as
@ -257,8 +267,8 @@ class SampleDistortedBoundingBoxV2(Primitive):
- **size** (Tensor) - A 1-D Tensor, containing [target_height, target_width, -1]. The data type is same as
`image_size`. When the data type of `image_size` is uint8, the last value of `size`,
which is originally -1, will be forced to 255.
- **bboxes** (Tensor) - A 3-D Tensor with shape [1, 1, 4], containing the distorted bounding box. The data type
is float32.
- **bboxes** (Tensor) - A 3-D Tensor with shape :math:`(1, 1, 4)`, containing
the distorted bounding box. The data type is float32.
Raises:
TypeError: If `image_size` is not a Tensor.

View File

@ -76,17 +76,18 @@ class NonDeterministicInts(Primitive):
class TruncatedNormal(Primitive):
"""
Returns a tensor of the specified shape filled with truncated normal values.
Returns a Tensor of the specified shape filled with truncated normal values.
The generated values follow a normal distribution.
The generated values conform to a Gaussian distribution.
.. warning::
The value of `shape` must be greater than zero. The output length can not exceed 1000000.
Note:
- The value of `shape` must be greater than zero. The output length can not exceed 1000000.
- When `seed` or `seed2` is assigned a non-zero value, that value will be used as the seed.
Otherwise, a random seed will be used instead.
Args:
seed (int, optional): An optional int. Defaults to 0. If either `seed` or `seed2` are set to be non-zero,
the seed is set by the given seed. Otherwise, it is seeded by a random seed.
seed2 (int, optional): An optional int. Defaults to 0. A second seed to avoid seed collision.
seed (int, optional): Random number seed. Default: 0.
seed2 (int, optional): The second seed to avoid seed collision. Default: 0.
dtype (mindspore.dtype, optional): Specified output data type. Must be one of the following types:
mindspore.float16, mindspore.float32 and mindspore.float64. Default: mindspore.float32.
@ -406,12 +407,13 @@ class ParameterizedTruncatedNormal(Primitive):
`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.
- The value in tensor `min` must be strictly less than `max` at any position after broadcasting.
- When `seed` or `seed2` is assigned a non-zero value, that value will be used as the seed.
Otherwise, a random seed will be used instead.
Args:
seed (int, optional): Random number seed. If either `seed` or `seed2` are set to be non-zero,
the seed is set by the given seed. Otherwise, it is seeded by a random seed. Default: 0.
seed2 (int, optional): A second seed to avoid seed collision. Default: 0.
seed (int, optional): Random number seed. Default: 0.
seed2 (int, optional): The second seed to avoid seed collision. Default: 0.
Inputs:
- **shape** (Tensor) - The shape of random tensor to be generated. Its type must be one of the following types: