Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindspore
提交
76bbfdea
M
mindspore
项目概览
MindSpore
/
mindspore
通知
35
Star
15
Fork
15
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
76bbfdea
编写于
9月 03, 2020
作者:
S
simson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
API comment for operations part1
上级
cd5a1bf1
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
210 addition
and
196 deletion
+210
-196
mindspore/nn/graph_kernels/graph_kernels.py
mindspore/nn/graph_kernels/graph_kernels.py
+4
-4
mindspore/nn/optim/adam.py
mindspore/nn/optim/adam.py
+1
-1
mindspore/nn/optim/lazyadam.py
mindspore/nn/optim/lazyadam.py
+1
-1
mindspore/nn/optim/rmsprop.py
mindspore/nn/optim/rmsprop.py
+1
-1
mindspore/ops/operations/__init__.py
mindspore/ops/operations/__init__.py
+1
-1
mindspore/ops/operations/array_ops.py
mindspore/ops/operations/array_ops.py
+43
-35
mindspore/ops/operations/comm_ops.py
mindspore/ops/operations/comm_ops.py
+13
-13
mindspore/ops/operations/math_ops.py
mindspore/ops/operations/math_ops.py
+42
-42
mindspore/ops/operations/nn_ops.py
mindspore/ops/operations/nn_ops.py
+93
-87
mindspore/ops/operations/other_ops.py
mindspore/ops/operations/other_ops.py
+11
-11
未找到文件。
mindspore/nn/graph_kernels/graph_kernels.py
浏览文件 @
76bbfdea
...
...
@@ -33,7 +33,7 @@ class InplaceAssign(PrimitiveWithInfer):
Inputs:
- **variable** (Parameter) - The `Parameter`.
- **value** (Tensor) - The value to
assign
.
- **value** (Tensor) - The value to
be assigned
.
- **depend** (Tensor) - The dependent tensor to keep this op connected in graph.
Outputs:
...
...
@@ -274,7 +274,7 @@ class EqualCount(GraphKernel):
"""
Computes the number of the same elements of two tensors.
The two input tensors should have same shape and data type.
The two input tensors should have
the
same shape and data type.
Inputs:
x (Tensor): the first input tensor.
...
...
@@ -1139,9 +1139,9 @@ class LambNextMV(GraphKernel):
Outputs:
Tuple of 2 Tensor.
- **add3** (Tensor) -
The shape is the same as the shap
e after broadcasting, and the data type is
- **add3** (Tensor) -
the shape is the same as the on
e after broadcasting, and the data type is
the one with high precision or high digits among the inputs.
- **realdiv4** (Tensor) -
The shape is the same as the shap
e after broadcasting, and the data type is
- **realdiv4** (Tensor) -
the shape is the same as the on
e after broadcasting, and the data type is
the one with high precision or high digits among the inputs.
Examples:
...
...
mindspore/nn/optim/adam.py
浏览文件 @
76bbfdea
...
...
@@ -194,7 +194,7 @@ class Adam(Optimizer):
Default: 0.999.
eps (float): Term added to the denominator to improve numerical stability. Should be greater than 0. Default:
1e-8.
use_locking (bool): Whether to enable a lock to protect
updating variable tensors
.
use_locking (bool): Whether to enable a lock to protect
variable tensors from being updated
.
If true, updates of the var, m, and v tensors will be protected by a lock.
If false, the result is unpredictable. Default: False.
use_nesterov (bool): Whether to use Nesterov Accelerated Gradient (NAG) algorithm to update the gradients.
...
...
mindspore/nn/optim/lazyadam.py
浏览文件 @
76bbfdea
...
...
@@ -141,7 +141,7 @@ class LazyAdam(Optimizer):
Default: 0.999.
eps (float): Term added to the denominator to improve numerical stability. Should be greater than 0. Default:
1e-8.
use_locking (bool): Whether to enable a lock to protect
updating variable tensors
.
use_locking (bool): Whether to enable a lock to protect
variable tensors from being updated
.
If true, updates of the var, m, and v tensors will be protected by a lock.
If false, the result is unpredictable. Default: False.
use_nesterov (bool): Whether to use Nesterov Accelerated Gradient (NAG) algorithm to update the gradients.
...
...
mindspore/nn/optim/rmsprop.py
浏览文件 @
76bbfdea
...
...
@@ -80,7 +80,7 @@ class RMSProp(Optimizer):
.. math::
w = w - m_{t}
where
,
:math:`w` represents `params`, which will be updated.
where :math:`w` represents `params`, which will be updated.
:math:`g_{t}` is mean gradients, :math:`g_{t-1}` is the last moment of :math:`g_{t}`.
:math:`s_{t}` is the mean square gradients, :math:`s_{t-1}` is the last moment of :math:`s_{t}`,
:math:`m_{t}` is moment, the delta of `w`, :math:`m_{t-1}` is the last moment of :math:`m_{t}`.
...
...
mindspore/ops/operations/__init__.py
浏览文件 @
76bbfdea
...
...
@@ -16,7 +16,7 @@
"""
Primitive operator classes.
A collection of operators to build ne
rual networks or computing
functions.
A collection of operators to build ne
ural networks or to compute
functions.
"""
from
.image_ops
import
(
CropAndResize
)
...
...
mindspore/ops/operations/array_ops.py
浏览文件 @
76bbfdea
...
...
@@ -220,11 +220,11 @@ class Cast(PrimitiveWithInfer):
Inputs:
- **input_x** (Union[Tensor, Number]) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
The tensor to be cast
ed
.
The tensor to be cast.
- **type** (dtype.Number) - The valid data type of the output tensor. Only constant value is allowed.
Outputs:
Tensor, the shape of tensor is
:math:`(x_1, x_2, ..., x_R)`, same as `input_x
`.
Tensor, the shape of tensor is
the same as `input_x`, :math:`(x_1, x_2, ..., x_R)
`.
Examples:
>>> input_np = np.random.randn(2, 3, 4, 5).astype(np.float32)
...
...
@@ -964,7 +964,7 @@ class TupleToArray(PrimitiveWithInfer):
- **input_x** (tuple) - A tuple of numbers. These numbers have the same type. Only constant value is allowed.
Outputs:
Tensor, if the input tuple contain `N` numbers, then the
output tensor shape
is (N,).
Tensor, if the input tuple contain `N` numbers, then the
shape of the output tensor
is (N,).
Examples:
>>> type = P.TupleToArray()((1,2,3))
...
...
@@ -1129,11 +1129,11 @@ class Argmax(PrimitiveWithInfer):
"""
Returns the indices of the max value of a tensor across the axis.
If the shape of input tensor is :math:`(x_1, ..., x_N)`, the
output tensor shape is
If the shape of input tensor is :math:`(x_1, ..., x_N)`, the
shape of the output tensor will be
:math:`(x_1, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
Args:
axis (int): Axis
on which Argmax operation applies
. Default: -1.
axis (int): Axis
where the Argmax operation applies to
. Default: -1.
output_type (:class:`mindspore.dtype`): An optional data type of `mindspore.dtype.int32`.
Default: `mindspore.dtype.int32`.
...
...
@@ -1176,11 +1176,11 @@ class Argmin(PrimitiveWithInfer):
"""
Returns the indices of the min value of a tensor across the axis.
If the shape of input tensor is :math:`(x_1, ..., x_N)`, the
output tensor shape
is
If the shape of input tensor is :math:`(x_1, ..., x_N)`, the
shape of the output tensor
is
:math:`(x_1, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
Args:
axis (int): Axis
on which Argmin operation applies
. Default: -1.
axis (int): Axis
where the Argmin operation applies to
. Default: -1.
output_type (:class:`mindspore.dtype`): An optional data type of `mindspore.dtype.int32`.
Default: `mindspore.dtype.int32`.
...
...
@@ -1222,16 +1222,17 @@ class Argmin(PrimitiveWithInfer):
class
ArgMaxWithValue
(
PrimitiveWithInfer
):
"""
Calculates
maximum value with
corresponding index.
Calculates
the maximum value with the
corresponding index.
Calculates maximum value along with given axis for the input tensor. Returns the maximum values and indices.
Calculates the maximum value along with the given axis for the input tensor. It returns the maximum values and
indices.
Note:
In auto_parallel and semi_auto_parallel mode, the first output index can not be used.
Args:
axis (int): The dimension to reduce. Default: 0.
keep_dims (bool): Whether to reduce dimension, if true the output will keep same dimension with the input,
keep_dims (bool): Whether to reduce dimension, if true
,
the output will keep same dimension with the input,
the output will reduce dimension if false. Default: False.
Inputs:
...
...
@@ -1239,11 +1240,12 @@ class ArgMaxWithValue(PrimitiveWithInfer):
:math:`(x_1, x_2, ..., x_N)`.
Outputs:
tuple(Tensor), tuple of 2 tensors, corresponding index and maximum value of input tensor.
- index (Tensor) - The index for maximum value of input tensor. If `keep_dims` is true, the output tensors shape
is :math:`(x_1, x_2, ..., x_{axis-1}, 1, x_{axis+1}, ..., x_N)`. Else, the shape is
tuple (Tensor), tuple of 2 tensors, containing the corresponding index and the maximum value of the input
tensor.
- index (Tensor) - The index for the maximum value of the input tensor. If `keep_dims` is true, the shape of
output tensors is :math:`(x_1, x_2, ..., x_{axis-1}, 1, x_{axis+1}, ..., x_N)`. Otherwise, the shape is
:math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
- output_x (Tensor) - The maximum value of input tensor,
the shape sam
e as index.
- output_x (Tensor) - The maximum value of input tensor,
with the same shap
e as index.
Examples:
>>> input_x = Tensor(np.random.rand(5), mindspore.float32)
...
...
@@ -1272,16 +1274,17 @@ class ArgMaxWithValue(PrimitiveWithInfer):
class
ArgMinWithValue
(
PrimitiveWithInfer
):
"""
Calculates minimum value with corresponding index, return indices and values.
Calculates
the
minimum value with corresponding index, return indices and values.
Calculates minimum value along with given axis for the input tensor. Returns the minimum values and indices.
Calculates the minimum value along with the given axis for the input tensor. It returns the minimum values and
indices.
Note:
In auto_parallel and semi_auto_parallel mode, the first output index can not be used.
Args:
axis (int): The dimension to reduce. Default: 0.
keep_dims (bool): Whether to reduce dimension, if true the output will keep same dimension as the input,
keep_dims (bool): Whether to reduce dimension, if true the output will keep
the
same dimension as the input,
the output will reduce dimension if false. Default: False.
Inputs:
...
...
@@ -1289,9 +1292,12 @@ class ArgMinWithValue(PrimitiveWithInfer):
:math:`(x_1, x_2, ..., x_N)`.
Outputs:
Tensor, corresponding index and minimum value of input tensor. If `keep_dims` is true, the output tensors shape
is :math:`(x_1, x_2, ..., x_{axis-1}, 1, x_{axis+1}, ..., x_N)`. Else, the shape is
tuple (Tensor), tuple of 2 tensors, containing the corresponding index and the minimum value of the input
tensor.
- index (Tensor) - The index for the maximum value of the input tensor. If `keep_dims` is true, the shape of
output tensors is :math:`(x_1, x_2, ..., x_{axis-1}, 1, x_{axis+1}, ..., x_N)`. Otherwise, the shape is
:math:`(x_1, x_2, ..., x_{axis-1}, x_{axis+1}, ..., x_N)`.
- output_x (Tensor) - The minimum value of input tensor, with the same shape as index.
Examples:
>>> input_x = Tensor(np.random.rand(5))
...
...
@@ -1568,9 +1574,9 @@ class Concat(PrimitiveWithInfer):
Note:
The input data is a tuple of tensors. These tensors have the same rank `R`. Set the given axis as `m`, and
:math:`0 \le m < N`. Set the number of input tensors as `N`. For the :math:`i`-th tensor :math:`t_i` has
the shape :math:`(x_1, x_2, ..., x_{mi}, ..., x_R)`. :math:`x_{mi}` is the :math:`m`-th dimension of the
:math:`i`-th tensor. Then, the
output tensor shape
is
:math:`0 \le m < N`. Set the number of input tensors as `N`. For the :math:`i`-th tensor :math:`t_i`
, it
has
the shape
of
:math:`(x_1, x_2, ..., x_{mi}, ..., x_R)`. :math:`x_{mi}` is the :math:`m`-th dimension of the
:math:`i`-th tensor. Then, the
shape of the output tensor
is
.. math::
(x_1, x_2, ..., \sum_{i=1}^Nx_{mi}, ..., x_R)
...
...
@@ -1579,7 +1585,7 @@ class Concat(PrimitiveWithInfer):
axis (int): The specified axis. Default: 0.
Inputs:
- **input_x** (tuple, list) -
Tuple or
list of input tensors.
- **input_x** (tuple, list) -
A tuple or a
list of input tensors.
Outputs:
Tensor, the shape is :math:`(x_1, x_2, ..., \sum_{i=1}^Nx_{mi}, ..., x_R)`.
...
...
@@ -1691,7 +1697,7 @@ class Pack(PrimitiveWithInfer):
Packs the list of input tensors with the same rank `R`, output is a tensor of rank `(R+1)`.
Given input tensors of shape :math:`(x_1, x_2, ..., x_R)`. Set the number of input tensors as `N`.
If :math:`0 \le axis`, the
output tensor shape
is :math:`(x_1, x_2, ..., x_{axis}, N, x_{axis+1}, ..., x_R)`.
If :math:`0 \le axis`, the
shape of the output tensor
is :math:`(x_1, x_2, ..., x_{axis}, N, x_{axis+1}, ..., x_R)`.
Args:
axis (int): Dimension along which to pack. Default: 0.
...
...
@@ -2364,7 +2370,7 @@ class ScatterNd(PrimitiveWithInfer):
Inputs:
- **indices** (Tensor) - The index of scattering in the new tensor. With int32 data type.
- **update** (Tensor) - The source Tensor to be scattered.
- **shape** (tuple[int]) - Define the shape of the output tensor
. H
as the same type as indices.
- **shape** (tuple[int]) - Define the shape of the output tensor
, h
as the same type as indices.
Outputs:
Tensor, the new tensor, has the same type as `update` and the same shape as `shape`.
...
...
@@ -3055,7 +3061,7 @@ class SpaceToBatch(PrimitiveWithInfer):
of the input are zero padded according to paddings if necessary.
Args:
block_size (int): The block size of divi
ding block with value >=
2.
block_size (int): The block size of divi
sion, has the value not less than
2.
paddings (list): The padding value for H and W dimension, containing 2 sub list, each containing 2 int value.
All values must be >= 0. paddings[i] specifies the paddings for spatial dimension i, which corresponds to
input dimension i+2. It is required that input_shape[i+2]+paddings[i][0]+paddings[i][1] is divisible
...
...
@@ -3066,7 +3072,7 @@ class SpaceToBatch(PrimitiveWithInfer):
Outputs:
Tensor, the output tensor with the same type as input. Assume input shape is :math:`(n, c, h, w)` with
:math:`block\_size` and :math:`padd
dings`. The output tensor shape
will be :math:`(n', c', h', w')`, where
:math:`block\_size` and :math:`padd
ings`. The shape of the output tensor
will be :math:`(n', c', h', w')`, where
:math:`n' = n*(block\_size*block\_size)`
...
...
@@ -3124,11 +3130,12 @@ class BatchToSpace(PrimitiveWithInfer):
dimension and block_size with given amount to crop from dimension, respectively.
Args:
block_size (int): The block size of dividing block with value >= 2.
crops (Union[list(int), tuple(int)]): The crop value for H and W dimension, containing 2 sub list,
each containing 2 int value.
All values must be >= 0. crops[i] specifies the crop values for spatial dimension i, which corresponds to
input dimension i+2. It is required that input_shape[i+2]*block_size >= crops[i][0]+crops[i][1].
block_size (int): The block size of division, has the value not less than 2.
crops (Union[list(int), tuple(int)]): The crop value for H and W dimension, containing 2 sub lists.
Each list contains 2 integers.
All values must be not less than 0. crops[i] specifies the crop values for the spatial dimension i, which
corresponds to the input dimension i+2. It is required that
input_shape[i+2]*block_size >= crops[i][0]+crops[i][1].
Inputs:
- **input_x** (Tensor) - The input tensor. It must be a 4-D tensor, dimension 0 should be divisible by
...
...
@@ -3210,7 +3217,8 @@ class SpaceToBatchND(PrimitiveWithInfer):
- **input_x** (Tensor) - The input tensor. It must be a 4-D tensor.
Outputs:
Tensor, the output tensor with the same type as input. Assume input shape is :math:`(n, c, h, w)` with
:math:`block\_shape` and :math:`padddings`. The output tensor shape will be :math:`(n', c', h', w')`, where
:math:`block\_shape` and :math:`padddings`. The shape of the output tensor will be :math:`(n', c', h', w')`,
where
:math:`n' = n*(block\_shape[0]*block\_shape[1])`
...
...
@@ -3276,11 +3284,11 @@ class SpaceToBatchND(PrimitiveWithInfer):
class
BatchToSpaceND
(
PrimitiveWithInfer
):
r
"""
Divide batch dimension with blocks and interleave
s
these blocks back into spatial dimensions.
Divide batch dimension with blocks and interleave these blocks back into spatial dimensions.
This operation will divide batch dimension N into blocks with block_shape, the output tensor's N dimension
is the corresponding number of blocks after division. The output tensor's H, W dimension is product of original H, W
dimension and block_shape with given amount to crop from dimension, respectively.
dimension and block_shape with given amount to crop from dimension, respectively.
B
Args:
block_shape (Union[list(int), tuple(int)]): The block shape of dividing block with all value >= 1.
...
...
mindspore/ops/operations/comm_ops.py
浏览文件 @
76bbfdea
...
...
@@ -47,17 +47,17 @@ class AllReduce(PrimitiveWithInfer):
Note:
The operation of AllReduce does not support "prod" currently.
T
ensor must have same shape and format in all processes participating in the collective
.
T
he tensors must have the same shape and format in all processes of the collection
.
Args:
op (str): Specifies an operation used for element-wise reductions,
like sum, max, min. Default: ReduceOp.SUM.
like sum, max,
and
min. Default: ReduceOp.SUM.
group (str): The communication group to work on. Default: "hccl_world_group".
Raises:
TypeError: If any of op
and group is not a string
or fusion is not a
integer
or the input's dtype is bool.
ValueError: If
op is "prod"
TypeError: If any of op
eration and group is not a string,
or fusion is not a
n integer,
or the input's dtype is bool.
ValueError: If
the operation is "prod".
Inputs:
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
...
...
@@ -113,7 +113,7 @@ class AllGather(PrimitiveWithInfer):
Gathers tensors from the specified communication group.
Note:
T
ensor must have the same shape and format in all processes participating in the collective
.
T
he tensors must have the same shape and format in all processes of the collection
.
Args:
group (str): The communication group to work on. Default: "hccl_world_group".
...
...
@@ -177,7 +177,7 @@ class _HostAllGather(PrimitiveWithInfer):
Gathers tensors from the specified communication group on host.
Note:
T
ensor must have the same shape and format in all processes participating in the collective
.
T
he tensors must have the same shape and format in all processes of the collection
.
_HostAllGather is a host-side operator, it depends on OpenMPI and must use build option -M on
to enable it. Using mpirun command to run it:
mpirun -output-filename log -merge-stderr-to-stdout -np 3 python test_host_all_gather.py
...
...
@@ -227,8 +227,8 @@ class ReduceScatter(PrimitiveWithInfer):
Reduces and scatters tensors from the specified communication group.
Note:
The back propagation of the op is not su
r
ported yet. Stay tuned for more.
T
ensor must have the same shape and format in all processes participating in the collective
.
The back propagation of the op is not su
p
ported yet. Stay tuned for more.
T
he tensors must have the same shape and format in all processes of the collection
.
Args:
op (str): Specifies an operation used for element-wise reductions,
...
...
@@ -236,7 +236,7 @@ class ReduceScatter(PrimitiveWithInfer):
group (str): The communication group to work on. Default: "hccl_world_group".
Raises:
TypeError: If any of op
and group is not a string
TypeError: If any of op
eration and group is not a string.
ValueError: If the first dimension of input can not be divided by rank size.
Examples:
...
...
@@ -288,7 +288,7 @@ class _HostReduceScatter(PrimitiveWithInfer):
Reduces and scatters tensors from the specified communication group on host.
Note:
T
ensor must have the same shape and format in all processes participating in the collective
.
T
he tensors must have the same shape and format in all processes of the collection
.
_HostReduceScatter is a host-side operator, it depends on OpenMPI and must use build option
-M on to enable it. Using mpirun command to run it:
mpirun -output-filename log -merge-stderr-to-stdout -np 3 python test_host_reduce_scatter.py
...
...
@@ -337,7 +337,7 @@ class Broadcast(PrimitiveWithInfer):
Broadcasts the tensor to the whole group.
Note:
T
ensor must have the same shape and format in all processes participating in the collective
.
T
he tensors must have the same shape and format in all processes of the collection
.
Args:
root_rank (int): Source rank. Required in all processes except the one
...
...
@@ -402,7 +402,7 @@ class _AlltoAll(PrimitiveWithInfer):
- The gather phase: Each process concatenates the received blocks along the concat_dimension.
Note:
T
ensor must have the same shape and format in all processes participating in the collective
.
T
he tensors must have the same shape and format in all processes of the collection
.
Args:
split_count (int): On each process, divide blocks into split_count number.
...
...
mindspore/ops/operations/math_ops.py
浏览文件 @
76bbfdea
...
...
@@ -133,7 +133,7 @@ class TensorAdd(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -689,12 +689,12 @@ class BatchMatMul(MatMul):
`result[..., :, :] = tensor(a[..., :, :]) * tensor(b[..., :, :])`.
The two input tensors must have
same rank and the rank must be `3` at least
.
The two input tensors must have
the same rank and the rank must be not less than `3`
.
Args:
transpose_a (bool): If True,
`a` is transposed on the last two dimensions
before multiplication.
transpose_a (bool): If True,
the last two dimensions of `a` is transposed
before multiplication.
Default: False.
transpose_b (bool): If True,
`b` is transposed on the last two dimensions
before multiplication.
transpose_b (bool): If True,
the last two dimensions of `b` is transposed
before multiplication.
Default: False.
Inputs:
...
...
@@ -860,11 +860,11 @@ class AccumulateNV2(PrimitiveWithInfer):
"""
Computes accumulation of all input tensors element-wise.
AccumulateNV2 is
like AddN with a significant difference: AccumulateNV2 won't
wait for all of its inputs to be ready before beginning to sum. That is to say,
AccumulateNV2 will be able to save memory when inputs are ready at different
times since minimum temporary storage is proportional to the output size rather
than the inputs
size.
AccumulateNV2 is
similar to AddN, but there is a significant difference
among them: AccumulateNV2 will not wait for all of its inputs to be ready
before summing. That is to say, AccumulateNV2 is able to save
memory when inputs are ready at different time since the minimum temporary
storage is proportional to the output size rather than the input
size.
Inputs:
- **input_x** (Union(tuple[Tensor], list[Tensor])) - The input tuple or list
...
...
@@ -1086,7 +1086,7 @@ class Sub(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1125,7 +1125,7 @@ class Mul(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1165,7 +1165,7 @@ class SquaredDifference(_MathBinaryOp):
float16, float32, int32 or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1355,7 +1355,7 @@ class Pow(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1641,7 +1641,7 @@ class Minimum(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1680,7 +1680,7 @@ class Maximum(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1719,7 +1719,7 @@ class RealDiv(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1759,7 +1759,7 @@ class Div(_MathBinaryOp):
is a number or a bool, the second input should be a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Raises:
...
...
@@ -1799,7 +1799,7 @@ class DivNoNan(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Raises:
...
...
@@ -1842,7 +1842,7 @@ class FloorDiv(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1873,7 +1873,7 @@ class TruncateDiv(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1903,7 +1903,7 @@ class TruncateMod(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -1931,7 +1931,7 @@ class Mod(_MathBinaryOp):
the second input should be a tensor whose data type is number.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Raises:
...
...
@@ -1999,7 +1999,7 @@ class FloorMod(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -2058,7 +2058,7 @@ class Xdivy(_MathBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is float16, float32 or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -2093,7 +2093,7 @@ class Xlogy(_MathBinaryOp):
The value must be positive.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,
Tensor, the shape is the same as the
on
e after broadcasting,
and the data type is the one with high precision or high digits among the two inputs.
Examples:
...
...
@@ -2110,7 +2110,7 @@ class Xlogy(_MathBinaryOp):
class
Acosh
(
PrimitiveWithInfer
):
"""
Compute inverse hyperbolic cosine of
x
element-wise.
Compute inverse hyperbolic cosine of
the input
element-wise.
Inputs:
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
...
...
@@ -2167,7 +2167,7 @@ class Cosh(PrimitiveWithInfer):
class
Asinh
(
PrimitiveWithInfer
):
"""
Compute inverse hyperbolic sine of
x
element-wise.
Compute inverse hyperbolic sine of
the input
element-wise.
Inputs:
- **input_x** (Tensor) - The shape of tensor is :math:`(x_1, x_2, ..., x_R)`.
...
...
@@ -2254,7 +2254,7 @@ class Equal(_LogicBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,and the data type is bool.
Tensor, the shape is the same as the
on
e after broadcasting,and the data type is bool.
Examples:
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.float32)
...
...
@@ -2275,7 +2275,7 @@ class Equal(_LogicBinaryOp):
class
ApproximateEqual
(
_LogicBinaryOp
):
"""
Returns t
he truth value of abs(x1-x2) < tolerance element-wi
se.
Returns t
rue if abs(x1-x2) is smaller than tolerance element-wise, otherwise fal
se.
Inputs of `x1` and `x2` comply with the implicit type conversion rules to make the data types consistent.
If they have different data types, lower priority data type will be converted to
...
...
@@ -2320,7 +2320,7 @@ class EqualCount(PrimitiveWithInfer):
"""
Computes the number of the same elements of two tensors.
The two input tensors should have same data type and shape.
The two input tensors should have
the
same data type and shape.
Inputs:
- **input_x** (Tensor) - The first input tensor.
...
...
@@ -2369,7 +2369,7 @@ class NotEqual(_LogicBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,and the data type is bool.
Tensor, the shape is the same as the
on
e after broadcasting,and the data type is bool.
Examples:
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.float32)
...
...
@@ -2406,7 +2406,7 @@ class Greater(_LogicBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,and the data type is bool.
Tensor, the shape is the same as the
on
e after broadcasting,and the data type is bool.
Examples:
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.int32)
...
...
@@ -2443,7 +2443,7 @@ class GreaterEqual(_LogicBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,and the data type is bool.
Tensor, the shape is the same as the
on
e after broadcasting,and the data type is bool.
Examples:
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.int32)
...
...
@@ -2480,7 +2480,7 @@ class Less(_LogicBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,and the data type is bool.
Tensor, the shape is the same as the
on
e after broadcasting,and the data type is bool.
Examples:
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.int32)
...
...
@@ -2517,7 +2517,7 @@ class LessEqual(_LogicBinaryOp):
a bool when the first input is a tensor or a tensor whose data type is number or bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,and the data type is bool.
Tensor, the shape is the same as the
on
e after broadcasting,and the data type is bool.
Examples:
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.int32)
...
...
@@ -2583,7 +2583,7 @@ class LogicalAnd(_LogicBinaryOp):
a tensor whose data type is bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting, and the data type is bool.
Tensor, the shape is the same as the
on
e after broadcasting, and the data type is bool.
Examples:
>>> input_x = Tensor(np.array([True, False, True]), mindspore.bool_)
...
...
@@ -2614,7 +2614,7 @@ class LogicalOr(_LogicBinaryOp):
a tensor whose data type is bool.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,and the data type is bool.
Tensor, the shape is the same as the
on
e after broadcasting,and the data type is bool.
Examples:
>>> input_x = Tensor(np.array([True, False, True]), mindspore.bool_)
...
...
@@ -3163,13 +3163,13 @@ class Tan(PrimitiveWithInfer):
class
Atan
(
PrimitiveWithInfer
):
"""
Computes the trig
nometric inverse tangent of x
element-wise.
Computes the trig
onometric inverse tangent of the input
element-wise.
Inputs:
- **input_x** (Tensor): The input tensor.
Outputs:
A Tensor
. Has the same type as x
.
A Tensor
, has the same type as the input
.
Examples:
>>> input_x = Tensor(np.array([1.047, 0.785]), mindspore.float32)
...
...
@@ -3194,13 +3194,13 @@ class Atan(PrimitiveWithInfer):
class
Atanh
(
PrimitiveWithInfer
):
"""
Computes inverse hyperbolic tangent of
x
element-wise.
Computes inverse hyperbolic tangent of
the input
element-wise.
Inputs:
- **input_x** (Tensor): The input tensor.
Outputs:
A Tensor
. Has the same type as x
.
A Tensor
, has the same type as the input
.
Examples:
>>> input_x = Tensor(np.array([1.047, 0.785]), mindspore.float32)
...
...
@@ -3238,7 +3238,7 @@ class Atan2(_MathBinaryOp):
- **input_y** (Tensor) - The input tensor.
Outputs:
Tensor, the shape is the same as the
shap
e after broadcasting,and the data type is same as `input_x`.
Tensor, the shape is the same as the
on
e after broadcasting,and the data type is same as `input_x`.
Examples:
>>> input_x = Tensor(np.array([[0, 1]]), mindspore.float32)
...
...
mindspore/ops/operations/nn_ops.py
浏览文件 @
76bbfdea
此差异已折叠。
点击以展开。
mindspore/ops/operations/other_ops.py
浏览文件 @
76bbfdea
...
...
@@ -34,7 +34,7 @@ class Assign(Primitive):
Inputs:
- **variable** (Parameter) - The `Parameter`.
- **value** (Tensor) - The value to
assign
.
- **value** (Tensor) - The value to
be assigned
.
Outputs:
Tensor, has the same type as original `variable`.
...
...
@@ -77,7 +77,7 @@ class BoundingBoxEncode(PrimitiveWithInfer):
Args:
means (tuple): Means for encoding bounding boxes calculation. Default: (0.0, 0.0, 0.0, 0.0).
stds (tuple):
Stds for encoding bounding boxe
s calculation. Default: (1.0, 1.0, 1.0, 1.0).
stds (tuple):
The standard deviations of delta
s calculation. Default: (1.0, 1.0, 1.0, 1.0).
Inputs:
- **anchor_box** (Tensor) - Anchor boxes. The shape of anchor_box must be (n, 4).
...
...
@@ -133,8 +133,8 @@ class BoundingBoxDecode(PrimitiveWithInfer):
wh_ratio_clip (float): The limit of width and height ratio for decoding box calculation. Default: 0.016.
Inputs:
- **anchor_box** (Tensor) - Anchor boxes. The shape of
anchor_box
must be (n, 4).
- **deltas** (Tensor) - Delta of boxes. Which has the same shape with
anchor_box
.
- **anchor_box** (Tensor) - Anchor boxes. The shape of
`anchor_box`
must be (n, 4).
- **deltas** (Tensor) - Delta of boxes. Which has the same shape with
`anchor_box`
.
Outputs:
Tensor, decoded boxes.
...
...
@@ -183,11 +183,11 @@ class CheckValid(PrimitiveWithInfer):
"""
Check bounding box.
Check whether the bounding box cross data and data border.
Check whether the bounding box cross data and data border
are valid
.
Inputs:
- **bboxes** (Tensor) - Bounding boxes tensor with shape (N, 4). Data type should be float16 or float32.
- **img_metas** (Tensor) - Raw image size information
, format
(height, width, ratio).
- **img_metas** (Tensor) - Raw image size information
with the format of
(height, width, ratio).
Data type should be float16 or float32.
Outputs:
...
...
@@ -372,17 +372,17 @@ class Depend(Primitive):
class
CheckBprop
(
PrimitiveWithInfer
):
"""
Checks whether
data type and shape of corresponding element from tuple
x and y are the same.
Checks whether
the data type and the shape of corresponding elements from tuples
x and y are the same.
Raises:
TypeError: If not the same.
TypeError: If
tuples x and y are
not the same.
Inputs:
- **input_x** (tuple[Tensor]) - The
input_x
contains the outputs of bprop to be checked.
- **input_y** (tuple[Tensor]) - The
input_y
contains the inputs of bprop to check against.
- **input_x** (tuple[Tensor]) - The
`input_x`
contains the outputs of bprop to be checked.
- **input_y** (tuple[Tensor]) - The
`input_y`
contains the inputs of bprop to check against.
Outputs:
(tuple[Tensor]), the
input_x
,
(tuple[Tensor]), the
`input_x`
,
if data type and shape of corresponding elements from `input_x` and `input_y` are the same.
Examples:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录