Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
8599a84a
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8599a84a
编写于
8月 31, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 31, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5574 Add implicit conversion description for some ops in API
Merge pull request !5574 from lihongkang/lhk_master
上级
d27178bf
ac53cf8e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
92 addition
and
15 deletion
+92
-15
mindspore/ops/operations/math_ops.py
mindspore/ops/operations/math_ops.py
+87
-15
mindspore/ops/operations/other_ops.py
mindspore/ops/operations/other_ops.py
+5
-0
未找到文件。
mindspore/ops/operations/math_ops.py
浏览文件 @
8599a84a
...
@@ -119,9 +119,10 @@ class TensorAdd(_MathBinaryOp):
...
@@ -119,9 +119,10 @@ class TensorAdd(_MathBinaryOp):
"""
"""
Adds two input tensors element-wise.
Adds two input tensors element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -157,6 +158,13 @@ class AssignAdd(PrimitiveWithInfer):
...
@@ -157,6 +158,13 @@ class AssignAdd(PrimitiveWithInfer):
"""
"""
Updates a `Parameter` by adding a value to it.
Updates a `Parameter` by adding a value to it.
Inputs of `variable` and `value` 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
relatively highest priority data type.
If `value` is a number, the number is automatically converted to Tensor,
and the data type is consistent with the Tensor data type involved in the operation.
RuntimeError exception will be thrown when the data type conversion of Parameter is required.
Inputs:
Inputs:
- **variable** (Parameter) - The `Parameter`.
- **variable** (Parameter) - The `Parameter`.
- **value** (Union[numbers.Number, Tensor]) - The value to be added to the `variable`.
- **value** (Union[numbers.Number, Tensor]) - The value to be added to the `variable`.
...
@@ -200,6 +208,13 @@ class AssignSub(PrimitiveWithInfer):
...
@@ -200,6 +208,13 @@ class AssignSub(PrimitiveWithInfer):
"""
"""
Updates a `Parameter` by subtracting a value from it.
Updates a `Parameter` by subtracting a value from it.
Inputs of `variable` and `value` 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
relatively highest priority data type.
If `value` is a number, the number is automatically converted to Tensor,
and the data type is consistent with the Tensor data type involved in the operation.
RuntimeError exception will be thrown when the data type conversion of Parameter is required.
Inputs:
Inputs:
- **variable** (Parameter) - The `Parameter`.
- **variable** (Parameter) - The `Parameter`.
- **value** (Union[numbers.Number, Tensor]) - The value to be subtracted from the `variable`.
- **value** (Union[numbers.Number, Tensor]) - The value to be subtracted from the `variable`.
...
@@ -574,6 +589,7 @@ class CumProd(PrimitiveWithInfer):
...
@@ -574,6 +589,7 @@ class CumProd(PrimitiveWithInfer):
>>> op3 = P.CumProd(exclusive=True, reverse=True)
>>> op3 = P.CumProd(exclusive=True, reverse=True)
>>> output = op3(input_x, 0) # output=[b * c, c, 1]
>>> output = op3(input_x, 0) # output=[b * c, c, 1]
"""
"""
@
prim_attr_register
@
prim_attr_register
def
__init__
(
self
,
exclusive
=
False
,
reverse
=
False
):
def
__init__
(
self
,
exclusive
=
False
,
reverse
=
False
):
cls_name
=
self
.
name
cls_name
=
self
.
name
...
@@ -1056,9 +1072,10 @@ class Sub(_MathBinaryOp):
...
@@ -1056,9 +1072,10 @@ class Sub(_MathBinaryOp):
"""
"""
Subtracts the second input tensor from the first input tensor element-wise.
Subtracts the second input tensor from the first input tensor element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1094,9 +1111,10 @@ class Mul(_MathBinaryOp):
...
@@ -1094,9 +1111,10 @@ class Mul(_MathBinaryOp):
"""
"""
Multiplies two tensors element-wise.
Multiplies two tensors element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1132,6 +1150,7 @@ class SquaredDifference(_MathBinaryOp):
...
@@ -1132,6 +1150,7 @@ class SquaredDifference(_MathBinaryOp):
"""
"""
Subtracts the second input tensor from the first input tensor element-wise and returns square of it.
Subtracts the second input tensor from the first input tensor element-wise and returns square of it.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
...
@@ -1322,9 +1341,10 @@ class Pow(_MathBinaryOp):
...
@@ -1322,9 +1341,10 @@ class Pow(_MathBinaryOp):
"""
"""
Computes a tensor to the power of the second input.
Computes a tensor to the power of the second input.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1607,9 +1627,10 @@ class Minimum(_MathBinaryOp):
...
@@ -1607,9 +1627,10 @@ class Minimum(_MathBinaryOp):
"""
"""
Computes the element-wise minimum of input tensors.
Computes the element-wise minimum of input tensors.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1645,9 +1666,10 @@ class Maximum(_MathBinaryOp):
...
@@ -1645,9 +1666,10 @@ class Maximum(_MathBinaryOp):
"""
"""
Computes the element-wise maximum of input tensors.
Computes the element-wise maximum of input tensors.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1683,9 +1705,10 @@ class RealDiv(_MathBinaryOp):
...
@@ -1683,9 +1705,10 @@ class RealDiv(_MathBinaryOp):
"""
"""
Divide the first input tensor by the second input tensor in floating-point type element-wise.
Divide the first input tensor by the second input tensor in floating-point type element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1721,9 +1744,10 @@ class Div(_MathBinaryOp):
...
@@ -1721,9 +1744,10 @@ class Div(_MathBinaryOp):
"""
"""
Computes the quotient of dividing the first input tensor by the second input tensor element-wise.
Computes the quotient of dividing the first input tensor by the second input tensor element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1761,9 +1785,10 @@ class DivNoNan(_MathBinaryOp):
...
@@ -1761,9 +1785,10 @@ class DivNoNan(_MathBinaryOp):
"""
"""
Computes a safe divide which returns 0 if the y is zero.
Computes a safe divide which returns 0 if the y is zero.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1803,9 +1828,10 @@ class FloorDiv(_MathBinaryOp):
...
@@ -1803,9 +1828,10 @@ class FloorDiv(_MathBinaryOp):
"""
"""
Divide the first input tensor by the second input tensor element-wise and rounds down to the closest integer.
Divide the first input tensor by the second input tensor element-wise and rounds down to the closest integer.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -1833,6 +1859,7 @@ class TruncateDiv(_MathBinaryOp):
...
@@ -1833,6 +1859,7 @@ class TruncateDiv(_MathBinaryOp):
Divide the first input tensor by the second input tensor element-wise for integer types, negative numbers will
Divide the first input tensor by the second input tensor element-wise for integer types, negative numbers will
round fractional quantities towards zero.
round fractional quantities towards zero.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
...
@@ -1862,6 +1889,7 @@ class TruncateMod(_MathBinaryOp):
...
@@ -1862,6 +1889,7 @@ class TruncateMod(_MathBinaryOp):
"""
"""
Returns element-wise remainder of division.
Returns element-wise remainder of division.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
...
@@ -1891,6 +1919,7 @@ class Mod(_MathBinaryOp):
...
@@ -1891,6 +1919,7 @@ class Mod(_MathBinaryOp):
"""
"""
Computes the remainder of dividing the first input tensor by the second input tensor element-wise.
Computes the remainder of dividing the first input tensor by the second input tensor element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar. When the inputs are two tensors,
The inputs must be two tensors or one tensor and one scalar. When the inputs are two tensors,
both dtypes cannot be bool, and the shapes of them could be broadcast. When the inputs are one tensor
both dtypes cannot be bool, and the shapes of them could be broadcast. When the inputs are one tensor
and one scalar, the scalar only could be a constant.
and one scalar, the scalar only could be a constant.
...
@@ -1956,9 +1985,10 @@ class FloorMod(_MathBinaryOp):
...
@@ -1956,9 +1985,10 @@ class FloorMod(_MathBinaryOp):
"""
"""
Compute element-wise remainder of division.
Compute element-wise remainder of division.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be bool
, and the shapes of them could be broadcast.
dtypes of them cannot be both bool
, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -2014,6 +2044,7 @@ class Xdivy(_MathBinaryOp):
...
@@ -2014,6 +2044,7 @@ class Xdivy(_MathBinaryOp):
"""
"""
Divide the first input tensor by the second input tensor element-wise. Returns zero when `x` is zero.
Divide the first input tensor by the second input tensor element-wise. Returns zero when `x` is zero.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
...
@@ -2047,6 +2078,7 @@ class Xlogy(_MathBinaryOp):
...
@@ -2047,6 +2078,7 @@ class Xlogy(_MathBinaryOp):
Computes first input tensor multiplied by the logarithm of second input tensor element-wise.
Computes first input tensor multiplied by the logarithm of second input tensor element-wise.
Returns zero when `x` is zero.
Returns zero when `x` is zero.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
dtypes of them cannot be both bool, and the shapes of them could be broadcast.
...
@@ -2210,6 +2242,7 @@ class Equal(_LogicBinaryOp):
...
@@ -2210,6 +2242,7 @@ class Equal(_LogicBinaryOp):
"""
"""
Computes the equivalence between two tensors element-wise.
Computes the equivalence between two tensors element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors, the shapes of them could be broadcast.
When the inputs are two tensors, the shapes of them could be broadcast.
When the inputs are one tensor and one scalar, the scalar only could be a constant.
When the inputs are one tensor and one scalar, the scalar only could be a constant.
...
@@ -2244,6 +2277,11 @@ class ApproximateEqual(_LogicBinaryOp):
...
@@ -2244,6 +2277,11 @@ class ApproximateEqual(_LogicBinaryOp):
"""
"""
Returns the truth value of abs(x1-x2) < tolerance element-wise.
Returns the truth value of abs(x1-x2) < tolerance element-wise.
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
relatively highest priority data type.
RuntimeError exception will be thrown when the data type conversion of Parameter is required.
Args:
Args:
tolerance (float): The maximum deviation that two elements can be considered equal. Default: 1e-05.
tolerance (float): The maximum deviation that two elements can be considered equal. Default: 1e-05.
...
@@ -2319,6 +2357,7 @@ class NotEqual(_LogicBinaryOp):
...
@@ -2319,6 +2357,7 @@ class NotEqual(_LogicBinaryOp):
"""
"""
Computes the non-equivalence of two tensors element-wise.
Computes the non-equivalence of two tensors element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors, the shapes of them could be broadcast.
When the inputs are two tensors, the shapes of them could be broadcast.
When the inputs are one tensor and one scalar, the scalar only could be a constant.
When the inputs are one tensor and one scalar, the scalar only could be a constant.
...
@@ -2353,9 +2392,10 @@ class Greater(_LogicBinaryOp):
...
@@ -2353,9 +2392,10 @@ class Greater(_LogicBinaryOp):
"""
"""
Computes the boolean value of :math:`x > y` element-wise.
Computes the boolean value of :math:`x > y` element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -2375,6 +2415,7 @@ class Greater(_LogicBinaryOp):
...
@@ -2375,6 +2415,7 @@ class Greater(_LogicBinaryOp):
>>> greater(input_x, input_y)
>>> greater(input_x, input_y)
[False, True, False]
[False, True, False]
"""
"""
def
infer_value
(
self
,
x
,
y
):
def
infer_value
(
self
,
x
,
y
):
if
x
is
not
None
and
y
is
not
None
:
if
x
is
not
None
and
y
is
not
None
:
x
=
x
.
asnumpy
()
x
=
x
.
asnumpy
()
...
@@ -2388,9 +2429,10 @@ class GreaterEqual(_LogicBinaryOp):
...
@@ -2388,9 +2429,10 @@ class GreaterEqual(_LogicBinaryOp):
"""
"""
Computes the boolean value of :math:`x >= y` element-wise.
Computes the boolean value of :math:`x >= y` element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -2410,6 +2452,7 @@ class GreaterEqual(_LogicBinaryOp):
...
@@ -2410,6 +2452,7 @@ class GreaterEqual(_LogicBinaryOp):
>>> greater_equal(input_x, input_y)
>>> greater_equal(input_x, input_y)
[True, True, False]
[True, True, False]
"""
"""
def
infer_value
(
self
,
x
,
y
):
def
infer_value
(
self
,
x
,
y
):
if
x
is
not
None
and
y
is
not
None
:
if
x
is
not
None
and
y
is
not
None
:
x
=
x
.
asnumpy
()
x
=
x
.
asnumpy
()
...
@@ -2423,9 +2466,10 @@ class Less(_LogicBinaryOp):
...
@@ -2423,9 +2466,10 @@ class Less(_LogicBinaryOp):
"""
"""
Computes the boolean value of :math:`x < y` element-wise.
Computes the boolean value of :math:`x < y` element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be
bool, and the shapes of them could be broadcast.
dtypes of them cannot be both
bool, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -2445,6 +2489,7 @@ class Less(_LogicBinaryOp):
...
@@ -2445,6 +2489,7 @@ class Less(_LogicBinaryOp):
>>> less(input_x, input_y)
>>> less(input_x, input_y)
[False, False, True]
[False, False, True]
"""
"""
def
infer_value
(
self
,
x
,
y
):
def
infer_value
(
self
,
x
,
y
):
if
x
is
not
None
and
y
is
not
None
:
if
x
is
not
None
and
y
is
not
None
:
x
=
x
.
asnumpy
()
x
=
x
.
asnumpy
()
...
@@ -2458,9 +2503,10 @@ class LessEqual(_LogicBinaryOp):
...
@@ -2458,9 +2503,10 @@ class LessEqual(_LogicBinaryOp):
"""
"""
Computes the boolean value of :math:`x <= y` element-wise.
Computes the boolean value of :math:`x <= y` element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one scalar.
The inputs must be two tensors or one tensor and one scalar.
When the inputs are two tensors,
When the inputs are two tensors,
both dtypes cannot be bool
, and the shapes of them could be broadcast.
dtypes of them cannot be both bool
, and the shapes of them could be broadcast.
When the inputs are one tensor and one scalar,
When the inputs are one tensor and one scalar,
the scalar only could be a constant.
the scalar only could be a constant.
...
@@ -2480,6 +2526,7 @@ class LessEqual(_LogicBinaryOp):
...
@@ -2480,6 +2526,7 @@ class LessEqual(_LogicBinaryOp):
>>> less_equal(input_x, input_y)
>>> less_equal(input_x, input_y)
[True, False, True]
[True, False, True]
"""
"""
def
infer_value
(
self
,
x
,
y
):
def
infer_value
(
self
,
x
,
y
):
if
x
is
not
None
and
y
is
not
None
:
if
x
is
not
None
and
y
is
not
None
:
x
=
x
.
asnumpy
()
x
=
x
.
asnumpy
()
...
@@ -2523,6 +2570,7 @@ class LogicalAnd(_LogicBinaryOp):
...
@@ -2523,6 +2570,7 @@ class LogicalAnd(_LogicBinaryOp):
"""
"""
Computes the "logical AND" of two tensors element-wise.
Computes the "logical AND" of two tensors element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one bool.
The inputs must be two tensors or one tensor and one bool.
When the inputs are two tensors, the shapes of them could be broadcast,
When the inputs are two tensors, the shapes of them could be broadcast,
and the data types of them should be bool.
and the data types of them should be bool.
...
@@ -2553,6 +2601,7 @@ class LogicalOr(_LogicBinaryOp):
...
@@ -2553,6 +2601,7 @@ class LogicalOr(_LogicBinaryOp):
"""
"""
Computes the "logical OR" of two tensors element-wise.
Computes the "logical OR" of two tensors element-wise.
Inputs of `input_x` and `input_y` comply with the implicit type conversion rules to make the data types consistent.
The inputs must be two tensors or one tensor and one bool.
The inputs must be two tensors or one tensor and one bool.
When the inputs are two tensors, the shapes of them could be broadcast,
When the inputs are two tensors, the shapes of them could be broadcast,
and the data types of them should be bool.
and the data types of them should be bool.
...
@@ -3179,6 +3228,11 @@ class Atan2(_MathBinaryOp):
...
@@ -3179,6 +3228,11 @@ class Atan2(_MathBinaryOp):
It returns :math:`\theta\ \in\ [-\pi, \pi]`
It returns :math:`\theta\ \in\ [-\pi, \pi]`
such that :math:`x = r*\sin(\theta), y = r*\cos(\theta)`, where :math:`r = \sqrt{x^2 + y^2}`.
such that :math:`x = r*\sin(\theta), y = r*\cos(\theta)`, where :math:`r = \sqrt{x^2 + y^2}`.
Inputs of `input_x` and `input_y` 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
relatively highest priority data type.
RuntimeError exception will be thrown when the data type conversion of Parameter is required.
Inputs:
Inputs:
- **input_x** (Tensor) - The input tensor.
- **input_x** (Tensor) - The input tensor.
- **input_y** (Tensor) - The input tensor.
- **input_y** (Tensor) - The input tensor.
...
@@ -3235,6 +3289,12 @@ class BitwiseAnd(_BitwiseBinaryOp):
...
@@ -3235,6 +3289,12 @@ class BitwiseAnd(_BitwiseBinaryOp):
"""
"""
Returns bitwise `and` of two tensors element-wise.
Returns bitwise `and` of two tensors element-wise.
Inputs of `input_x1` and `input_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
relatively highest priority data type.
RuntimeError exception will be thrown when the data type conversion of Parameter is required.
Inputs:
Inputs:
- **input_x1** (Tensor) - The input tensor with int16, int32 or uint16 data type.
- **input_x1** (Tensor) - The input tensor with int16, int32 or uint16 data type.
- **input_x2** (Tensor) - The input tensor with same type as the `input_x1`.
- **input_x2** (Tensor) - The input tensor with same type as the `input_x1`.
...
@@ -3255,6 +3315,12 @@ class BitwiseOr(_BitwiseBinaryOp):
...
@@ -3255,6 +3315,12 @@ class BitwiseOr(_BitwiseBinaryOp):
"""
"""
Returns bitwise `or` of two tensors element-wise.
Returns bitwise `or` of two tensors element-wise.
Inputs of `input_x1` and `input_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
relatively highest priority data type.
RuntimeError exception will be thrown when the data type conversion of Parameter is required.
Inputs:
Inputs:
- **input_x1** (Tensor) - The input tensor with int16, int32 or uint16 data type.
- **input_x1** (Tensor) - The input tensor with int16, int32 or uint16 data type.
- **input_x2** (Tensor) - The input tensor with same type as the `input_x1`.
- **input_x2** (Tensor) - The input tensor with same type as the `input_x1`.
...
@@ -3275,6 +3341,12 @@ class BitwiseXor(_BitwiseBinaryOp):
...
@@ -3275,6 +3341,12 @@ class BitwiseXor(_BitwiseBinaryOp):
"""
"""
Returns bitwise `xor` of two tensors element-wise.
Returns bitwise `xor` of two tensors element-wise.
Inputs of `input_x1` and `input_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
relatively highest priority data type.
RuntimeError exception will be thrown when the data type conversion of Parameter is required.
Inputs:
Inputs:
- **input_x1** (Tensor) - The input tensor with int16, int32 or uint16 data type.
- **input_x1** (Tensor) - The input tensor with int16, int32 or uint16 data type.
- **input_x2** (Tensor) - The input tensor with same type as the `input_x1`.
- **input_x2** (Tensor) - The input tensor with same type as the `input_x1`.
...
...
mindspore/ops/operations/other_ops.py
浏览文件 @
8599a84a
...
@@ -27,6 +27,11 @@ class Assign(Primitive):
...
@@ -27,6 +27,11 @@ class Assign(Primitive):
"""
"""
Assign `Parameter` with a value.
Assign `Parameter` with a value.
Inputs of `variable` and `value` 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
relatively highest priority data type.
RuntimeError exception will be thrown when the data type conversion of Parameter is required.
Inputs:
Inputs:
- **variable** (Parameter) - The `Parameter`.
- **variable** (Parameter) - The `Parameter`.
- **value** (Tensor) - The value to assign.
- **value** (Tensor) - The value to assign.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录