Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
735fc98c
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看板
提交
735fc98c
编写于
8月 12, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
!4265 support two mstypes do equal.
Merge pull request !4265 from zhangbuxue/support_two_mstypes_do_equal
上级
13c2b233
35677ac0
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
156 addition
and
66 deletion
+156
-66
mindspore/ccsrc/frontend/operator/ops_front_infer_function.cc
...spore/ccsrc/frontend/operator/ops_front_infer_function.cc
+8
-8
mindspore/ccsrc/pipeline/pynative/pynative_execute.cc
mindspore/ccsrc/pipeline/pynative/pynative_execute.cc
+5
-3
mindspore/common/tensor.py
mindspore/common/tensor.py
+4
-2
mindspore/core/ir/dtype_extends.cc
mindspore/core/ir/dtype_extends.cc
+15
-17
mindspore/core/ir/func_graph_cloner.cc
mindspore/core/ir/func_graph_cloner.cc
+2
-2
mindspore/ops/composite/multitype_ops/_constexpr_utils.py
mindspore/ops/composite/multitype_ops/_constexpr_utils.py
+7
-0
mindspore/ops/composite/multitype_ops/equal_impl.py
mindspore/ops/composite/multitype_ops/equal_impl.py
+46
-31
tests/st/pynative/test_implicit_conversion.py
tests/st/pynative/test_implicit_conversion.py
+1
-0
tests/ut/python/pipeline/parse/test_equal_two_mstype.py
tests/ut/python/pipeline/parse/test_equal_two_mstype.py
+65
-0
tests/ut/python/pynative_mode/test_implicit_conversion.py
tests/ut/python/pynative_mode/test_implicit_conversion.py
+3
-3
未找到文件。
mindspore/ccsrc/frontend/operator/ops_front_infer_function.cc
浏览文件 @
735fc98c
...
...
@@ -206,7 +206,7 @@ bool CompareShape(const std::vector<ValuePtr> &x_shape, const std::vector<ValueP
}
AbstractBasePtr
DoInferReduceShape
(
const
AbstractTuplePtr
&
x_shape
,
const
ValuePtr
&
x_shp_value
,
const
Value
Tupl
ePtr
&
axis_value_ptr
,
const
PrimitivePtr
&
primitive
)
{
const
Value
Sequeu
ePtr
&
axis_value_ptr
,
const
PrimitivePtr
&
primitive
)
{
size_t
x_rank
=
x_shape
->
size
();
std
::
set
<
int
>
axis_set
;
auto
axis_data
=
axis_value_ptr
->
value
();
...
...
@@ -348,17 +348,17 @@ AbstractBasePtr InferImplReduceShape(const AnalysisEnginePtr &, const PrimitiveP
<<
" evaluator shape's data field can't be anything: "
<<
args_spec_list
[
1
]
->
ToString
();
}
// Axis can be scalar, tuple or
None
Abstract
Tupl
ePtr
axis
=
nullptr
;
// Axis can be scalar, tuple or
list
Abstract
Sequeu
ePtr
axis
=
nullptr
;
if
(
args_spec_list
[
1
]
->
isa
<
AbstractScalar
>
())
{
MS_LOG
(
DEBUG
)
<<
op_name
<<
" evaluator second parameter is scalar"
;
AbstractBasePtrList
axis_list
=
{
dyn_cast
<
AbstractScalar
>
(
args_spec_list
[
1
])};
axis
=
std
::
make_shared
<
AbstractTuple
>
(
axis_list
);
}
else
if
(
args_spec_list
[
1
]
->
isa
<
Abstract
Tupl
e
>
())
{
MS_LOG
(
DEBUG
)
<<
op_name
<<
" evaluator second parameter is
tupl
e"
;
axis
=
args_spec_list
[
1
]
->
cast
<
Abstract
Tupl
ePtr
>
();
}
else
if
(
args_spec_list
[
1
]
->
isa
<
Abstract
Sequeu
e
>
())
{
MS_LOG
(
DEBUG
)
<<
op_name
<<
" evaluator second parameter is
sequeu
e"
;
axis
=
args_spec_list
[
1
]
->
cast
<
Abstract
Sequeu
ePtr
>
();
}
else
{
MS_LOG
(
EXCEPTION
)
<<
op_name
<<
" evaluator second parameter should be a scalar or tuple, but got "
MS_LOG
(
EXCEPTION
)
<<
op_name
<<
" evaluator second parameter should be a scalar or tuple
or list
, but got "
<<
args_spec_list
[
1
]
->
ToString
();
}
...
...
@@ -367,7 +367,7 @@ AbstractBasePtr InferImplReduceShape(const AnalysisEnginePtr &, const PrimitiveP
MS_LOG
(
EXCEPTION
)
<<
op_name
<<
" evaluator shape's data field can't be anything: "
<<
args_spec_list
[
1
]
->
ToString
();
}
auto
axis_value_ptr
=
axis_value
->
cast
<
Value
Tupl
ePtr
>
();
auto
axis_value_ptr
=
axis_value
->
cast
<
Value
Sequeu
ePtr
>
();
MS_EXCEPTION_IF_NULL
(
axis_value_ptr
);
return
DoInferReduceShape
(
shape_x
,
x_shp_value
,
axis_value_ptr
,
primitive
);
...
...
mindspore/ccsrc/pipeline/pynative/pynative_execute.cc
浏览文件 @
735fc98c
...
...
@@ -261,17 +261,19 @@ void ConvertInputs(const PrimitivePyPtr &prim, const py::list &args, const OpExe
auto
obj
=
out_args
[
i
];
if
(
py
::
isinstance
<
tensor
::
Tensor
>
(
obj
))
{
auto
arg
=
py
::
cast
<
tensor
::
TensorPtr
>
(
obj
);
if
(
arg
->
data_type
()
==
it
->
second
)
{
TypeId
arg_type_id
=
arg
->
data_type
();
if
(
prim
::
type_map
.
find
(
arg_type_id
)
==
prim
::
type_map
.
end
()
||
arg_type_id
==
it
->
second
)
{
continue
;
}
if
(
signature
[
i
].
rw
==
SignatureEnumRW
::
kRWWrite
)
{
prim
::
RaiseExceptionForConvertRefDtype
(
prim
->
name
(),
TypeIdToMsTypeStr
(
arg
->
data_type
()
),
prim
::
RaiseExceptionForConvertRefDtype
(
prim
->
name
(),
TypeIdToMsTypeStr
(
arg
_type_id
),
TypeIdToMsTypeStr
(
it
->
second
));
}
}
if
(
!
py
::
isinstance
<
tensor
::
Tensor
>
(
obj
)
&&
!
py
::
isinstance
<
py
::
int_
>
(
obj
)
&&
!
py
::
isinstance
<
py
::
float_
>
(
obj
))
{
MS_EXCEPTION
(
TypeError
)
<<
"For '"
<<
prim
->
name
()
<<
"', the "
<<
i
<<
"th input is a not support type: "
MS_EXCEPTION
(
TypeError
)
<<
"For '"
<<
prim
->
name
()
<<
"', the "
<<
i
<<
"th input is a not support implicit conversion type: "
<<
py
::
cast
<
std
::
string
>
(
obj
.
attr
(
"__class__"
).
attr
(
"__name__"
))
<<
", and the value is "
<<
py
::
cast
<
py
::
str
>
(
obj
)
<<
"."
;
}
...
...
mindspore/common/tensor.py
浏览文件 @
735fc98c
...
...
@@ -239,7 +239,8 @@ class Tensor(Tensor_):
Check all array elements along a given axis evaluate to True.
Args:
axis (Union[None, int, tuple(int)): Dimensions of reduction.
axis (Union[None, int, tuple(int)): Dimensions of reduction,
when axis is None or empty tuple, reduce all dimensions.
Default: (), reduce all dimensions.
keep_dims (bool): Whether to keep the reduced dimensions.
Default : False, don't keep these reduced dimensions.
...
...
@@ -257,7 +258,8 @@ class Tensor(Tensor_):
Check any array element along a given axis evaluate to True.
Args:
axis (Union[None, int, tuple(int)): Dimensions of reduction.
axis (Union[None, int, tuple(int)): Dimensions of reduction,
when axis is None or empty tuple, reduce all dimensions.
Default: (), reduce all dimensions.
keep_dims (bool): Whether to keep the reduced dimensions.
Default : False, don't keep these reduced dimensions.
...
...
mindspore/core/ir/dtype_extends.cc
浏览文件 @
735fc98c
...
...
@@ -338,21 +338,21 @@ TypePtr FunctionStrToType(const std::string &type_name) {
TypePtr
StringToType
(
const
std
::
string
&
type_name
)
{
TypePtr
type
=
nullptr
;
if
(
type_name
.
compare
(
"None"
)
==
0
)
{
if
(
type_name
==
"None"
)
{
type
=
std
::
make_shared
<
TypeNone
>
();
}
else
if
(
type_name
.
compare
(
"Ellipsis"
)
==
0
)
{
}
else
if
(
type_name
==
"Ellipsis"
)
{
type
=
std
::
make_shared
<
TypeEllipsis
>
();
}
else
if
(
type_name
.
compare
(
"TypeType"
)
==
0
)
{
}
else
if
(
type_name
==
"TypeType"
)
{
type
=
std
::
make_shared
<
TypeType
>
();
}
else
if
(
type_name
.
compare
(
"SymbolicKeyType"
)
==
0
)
{
}
else
if
(
type_name
==
"SymbolicKeyType"
)
{
type
=
std
::
make_shared
<
SymbolicKeyType
>
();
}
else
if
(
type_name
.
compare
(
"RefKeyType"
)
==
0
)
{
}
else
if
(
type_name
==
"RefKeyType"
)
{
type
=
std
::
make_shared
<
RefKeyType
>
();
}
else
if
(
type_name
.
compare
(
"EnvType"
)
==
0
)
{
}
else
if
(
type_name
==
"EnvType"
)
{
type
=
std
::
make_shared
<
EnvType
>
();
}
else
if
(
type_name
.
compare
(
"Number"
)
==
0
)
{
}
else
if
(
type_name
==
"Number"
)
{
type
=
std
::
make_shared
<
Number
>
();
}
else
if
(
type_name
.
compare
(
"Bool"
)
==
0
)
{
}
else
if
(
type_name
==
"Bool"
)
{
type
=
std
::
make_shared
<
Bool
>
();
}
else
if
(
type_name
.
compare
(
0
,
strlen
(
"Int"
),
"Int"
)
==
0
)
{
type
=
StringToNumberType
<
Int
>
(
type_name
,
"Int"
);
...
...
@@ -372,16 +372,18 @@ TypePtr StringToType(const std::string &type_name) {
type
=
ListStrToType
(
type_name
);
}
else
if
(
type_name
.
compare
(
0
,
strlen
(
"Tuple"
),
"Tuple"
)
==
0
)
{
type
=
TupleStrToType
(
type_name
);
}
else
if
(
type_name
.
compare
(
"Slice"
)
==
0
)
{
}
else
if
(
type_name
==
"Slice"
)
{
type
=
std
::
make_shared
<
Slice
>
();
}
else
if
(
type_name
.
compare
(
"Dictionary"
)
==
0
)
{
}
else
if
(
type_name
==
"Dictionary"
)
{
type
=
std
::
make_shared
<
Dictionary
>
();
}
else
if
(
type_name
.
compare
(
"String"
)
==
0
)
{
}
else
if
(
type_name
==
"String"
)
{
type
=
std
::
make_shared
<
String
>
();
}
else
if
(
type_name
.
compare
(
"Problem"
)
==
0
)
{
}
else
if
(
type_name
==
"Problem"
)
{
type
=
std
::
make_shared
<
Problem
>
();
}
else
if
(
type_name
.
compare
(
0
,
strlen
(
"Function"
),
"Function"
)
==
0
)
{
type
=
FunctionStrToType
(
type_name
);
}
else
if
(
type_name
==
"mstype"
)
{
type
=
std
::
make_shared
<
TypeType
>
();
}
else
{
// - unsupported to convert
// Class
...
...
@@ -389,7 +391,6 @@ TypePtr StringToType(const std::string &type_name) {
// JTagged
// Anything
// External
// Problem
MS_LOG
(
EXCEPTION
)
<<
"Unsupported type name: "
<<
type_name
<<
"!"
;
}
return
type
;
...
...
@@ -403,10 +404,7 @@ bool IsParentOrChildrenType(TypePtr const &x, TypePtr const &base_type) {
if
(
base_type
->
type_id
()
==
kTypeUnknown
||
x
->
type_id
()
==
kTypeUnknown
)
{
return
false
;
}
if
(
base_type
->
type_id
()
==
x
->
parent_type
()
||
x
->
type_id
()
==
base_type
->
parent_type
())
{
return
true
;
}
return
false
;
return
base_type
->
type_id
()
==
x
->
parent_type
()
||
x
->
type_id
()
==
base_type
->
parent_type
();
}
bool
IsIdentidityOrSubclass
(
TypePtr
const
&
x
,
TypePtr
const
&
base_type
)
{
...
...
mindspore/core/ir/func_graph_cloner.cc
浏览文件 @
735fc98c
...
...
@@ -206,8 +206,8 @@ void Cloner::InlineCloneParameters(const FuncGraphPtr &func_graph, const AnfNode
MS_EXCEPTION_IF_NULL
(
func_graph
);
auto
&
old_params
=
func_graph
->
parameters
();
if
(
old_params
.
size
()
!=
params
.
size
())
{
MS_
LOG
(
EXCEPTION
)
<<
"Origin params size["
<<
old_params
.
size
()
<<
"], inline params size["
<<
params
.
size
()
<<
"]"
;
return
;
MS_
EXCEPTION
(
TypeError
)
<<
"Origin params size["
<<
old_params
.
size
()
<<
"], inline params size["
<<
params
.
size
()
<<
"]"
;
}
for
(
size_t
i
=
0
;
i
<
old_params
.
size
();
++
i
)
{
repl_node_
[
old_params
[
i
]]
=
params
[
i
];
...
...
mindspore/ops/composite/multitype_ops/_constexpr_utils.py
浏览文件 @
735fc98c
...
...
@@ -762,3 +762,10 @@ def get_stride_info_from_tuple(data_shape, index_tuple):
end_strides
.
append
(
data_shape
[
item
])
step_strides
.
append
(
1
)
return
tuple
(
begin_strides
),
tuple
(
end_strides
),
tuple
(
step_strides
),
shrink_axis
@
constexpr
def
mstype_eq
(
x
,
y
):
if
x
==
y
:
return
True
return
False
mindspore/ops/composite/multitype_ops/equal_impl.py
浏览文件 @
735fc98c
...
...
@@ -14,7 +14,7 @@
# ============================================================================
"""equal_impl"""
from
.
import
_constexpr_utils
as
const_utils
from
...composite
import
base
from
...
import
functional
as
F
...
...
@@ -32,8 +32,8 @@ def _equal_scalar(x, y):
Determine if two numbers are equal.
Args:
x (Number):
x
y (NUmber):
y
x (Number):
first input number.
y (NUmber):
second input number.
Returns:
bool, if x == y return true, x != y return false.
...
...
@@ -41,14 +41,29 @@ def _equal_scalar(x, y):
return
F
.
scalar_eq
(
x
,
y
)
@
equal
.
register
(
"mstype"
,
"mstype"
)
def
_equal_mstype
(
x
,
y
):
"""
Determine if two mindspore types are equal.
Args:
x (mstype): first input mindspore type.
y (mstype): second input mindspore type.
Returns:
bool, if x == y return true, x != y return false.
"""
return
const_utils
.
mstype_eq
(
x
,
y
)
@
equal
.
register
(
"String"
,
"String"
)
def
_equal_string
(
x
,
y
):
"""
Determine if two strings are equal.
Args:
x
: str
y
: str
x
(str): first input string.
y
(str): second input string.
Returns:
bool, if x == y return true, x != y return false.
...
...
@@ -62,8 +77,8 @@ def _string_equal_none(x, y):
Determine if string equals none.
Args:
x
: str
.
y
:
None.
x
(str): first input string
.
y
(None) second input
None.
Returns:
bool, return false.
...
...
@@ -77,8 +92,8 @@ def _none_equal_string(x, y):
Determine if string equals none.
Args:
x
:
None.
y
: str
.
x
(None): first input
None.
y
(str): second input string
.
Returns:
bool, return false.
...
...
@@ -92,8 +107,8 @@ def _none_equal_none(x, y):
Determine if none equals none.
Args:
x
:
None.
y
:
None.
x
(None): first input
None.
y
(None): second input
None.
Returns:
bool, return true.
...
...
@@ -107,8 +122,8 @@ def _scalar_equal_none(x, y):
Determine if number equals none.
Args:
x
: N
umber.
y
:
None.
x
(Number): first input n
umber.
y
(None): second input
None.
Returns:
bool, return false.
...
...
@@ -122,8 +137,8 @@ def _none_equal_scalar(x, y):
Determine if number equals none.
Args:
x
:
None.
y
: NU
mber.
x
(None): first input
None.
y
(Number): second input Nu
mber.
Returns:
bool, return false.
...
...
@@ -137,8 +152,8 @@ def _euqal_tuple(x, y):
Determine if two tuples are equal by element.
Args:
x (tuple):
x
y (tuple):
y
x (tuple):
first input tuple.
y (tuple):
second input tuple.
Returns:
bool, if x and y are equal by element return true, else return false.
...
...
@@ -152,8 +167,8 @@ def _euqal_list(x, y):
Determine if two lists are equal by element.
Args:
x (list):
x
y (list):
y
x (list):
first input list.
y (list):
second input list.
Returns:
bool, if x and y are equal by element return true, else return false.
...
...
@@ -167,8 +182,8 @@ def _tuple_euqal_none(x, y):
Determine if tuple element equals none element.
Args:
x
: T
uple.
y
:
None.
x
(tuple): first input t
uple.
y
(None): second input
None.
Returns:
bool, return false.
...
...
@@ -182,8 +197,8 @@ def _none_equal_tuple(x, y):
Determine if tuple element equals none element.
Args:
x
:
None.
y
: T
uple.
x
(None): first input
None.
y
(tuple): second input t
uple.
Returns:
bool, return false.
...
...
@@ -199,8 +214,8 @@ def _tensor_equal_tensor(x, y):
Determine if two tensors are equal.
Args:
x
: T
ensor.
y
: T
ensor.
x
(Tensor): first input t
ensor.
y
(Tensor): second input t
ensor.
Returns:
bool, if x == y return true, x != y return false.
...
...
@@ -214,8 +229,8 @@ def _tensor_equal_none(x, y):
Determine if tensor equal none.
Args:
x
: T
ensor.
y
:
None.
x
(Tensor): first input t
ensor.
y
(None): second input
None.
Returns:
bool, return false.
...
...
@@ -229,8 +244,8 @@ def _none_equal_tensor(x, y):
Determine if tensor equal none.
Args:
x
:
None.
y
: T
ensor.
x
(None): first input
None.
y
(Tensor): second input t
ensor.
Returns:
bool, return false.
...
...
@@ -245,7 +260,7 @@ def _list_equal_none(x, y):
Args:
x (list): The first input which is a list.
y (
n
one): The second input which is none.
y (
N
one): The second input which is none.
Returns:
bool, return false.
...
...
@@ -259,7 +274,7 @@ def _none_equal_list(x, y):
Determine if none equal list.
Args:
x (
n
one): The first input which is none.
x (
N
one): The first input which is none.
y (list): The second input which is a list.
Returns:
...
...
tests/st/pynative/test_implicit_conversion.py
浏览文件 @
735fc98c
...
...
@@ -49,6 +49,7 @@ def test_bool_and_int_tensor_add():
ret_expect
=
Tensor
(
np
.
array
([[
2
,
3
,
4
],
[
5
,
6
,
7
]],
dtype
=
np
.
int32
))
assert
(
ret_actual
.
asnumpy
()
==
ret_expect
.
asnumpy
()).
all
()
def
test_float_tensor_and_int_tensor_add
():
x
=
Tensor
(
np
.
array
([[
0.1
,
0.2
,
0.3
],
[
0.4
,
0.5
,
0.6
]],
dtype
=
np
.
float32
))
y
=
Tensor
(
np
.
array
([[
1
,
2
,
3
],
[
4
,
5
,
6
]],
dtype
=
np
.
int32
))
...
...
tests/ut/python/pipeline/parse/test_equal_two_mstype.py
0 → 100644
浏览文件 @
735fc98c
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
""" test enumerate"""
import
numpy
as
np
import
mindspore.nn
as
nn
from
mindspore
import
Tensor
from
mindspore
import
context
from
mindspore.common
import
dtype
as
mstype
context
.
set_context
(
mode
=
context
.
GRAPH_MODE
)
def
test_equal_two_const_mstype
():
class
Net
(
nn
.
Cell
):
def
__init__
(
self
):
super
(
Net
,
self
).
__init__
()
self
.
type_base
=
mstype
.
float32
self
.
type_0
=
mstype
.
float32
self
.
type_1
=
mstype
.
float16
self
.
type_2
=
mstype
.
int32
self
.
type_3
=
mstype
.
tuple_
def
construct
(
self
):
ret_0
=
self
.
type_0
==
self
.
type_base
ret_1
=
self
.
type_1
==
self
.
type_base
ret_2
=
self
.
type_2
==
self
.
type_base
ret_3
=
self
.
type_3
==
self
.
type_base
return
ret_0
,
ret_1
,
ret_2
,
ret_3
net
=
Net
()
assert
net
()
==
(
True
,
False
,
False
,
False
)
def
test_equal_two_tensor_mstype
():
class
Net
(
nn
.
Cell
):
def
__init__
(
self
):
super
(
Net
,
self
).
__init__
()
def
construct
(
self
,
x
,
y
,
z
):
ret_x
=
x
.
dtype
==
mstype
.
float32
ret_y
=
y
.
dtype
==
mstype
.
int32
ret_z
=
z
.
dtype
==
mstype
.
bool_
ret_xy
=
x
.
dtype
==
y
.
dtype
ret_xz
=
x
.
dtype
==
z
.
dtype
ret_yz
=
y
.
dtype
==
z
.
dtype
return
ret_x
,
ret_y
,
ret_z
,
ret_xy
,
ret_xz
,
ret_yz
net
=
Net
()
x
=
Tensor
(
np
.
arange
(
3
*
4
*
5
).
reshape
((
3
,
4
,
5
)),
mstype
.
float32
)
y
=
Tensor
(
np
.
arange
(
3
*
4
*
5
).
reshape
((
3
,
4
,
5
)),
mstype
.
int32
)
z
=
Tensor
(
np
.
arange
(
3
*
4
*
5
).
reshape
((
3
,
4
,
5
)),
mstype
.
bool_
)
assert
net
(
x
,
y
,
z
)
==
(
True
,
True
,
True
,
False
,
False
,
False
)
tests/ut/python/pynative_mode/test_implicit_conversion.py
浏览文件 @
735fc98c
...
...
@@ -96,7 +96,7 @@ def test_float_tensor_and_str_add():
y
=
"ok"
with
pytest
.
raises
(
TypeError
)
as
er
:
ret
=
x
+
y
assert
"For 'TensorAdd', the 1th input is a not support type: str"
in
str
(
er
.
value
)
assert
"For 'TensorAdd', the 1th input is a not support
implicit conversion
type: str"
in
str
(
er
.
value
)
def
test_float_tensor_and_tuple_add
():
...
...
@@ -104,7 +104,7 @@ def test_float_tensor_and_tuple_add():
y
=
(
1
,
2
,
3
)
with
pytest
.
raises
(
TypeError
)
as
er
:
ret
=
x
+
y
assert
"For 'TensorAdd', the 1th input is a not support type: tuple"
in
str
(
er
.
value
)
assert
"For 'TensorAdd', the 1th input is a not support
implicit conversion
type: tuple"
in
str
(
er
.
value
)
def
test_float_tensor_and_list_add
():
...
...
@@ -112,7 +112,7 @@ def test_float_tensor_and_list_add():
y
=
[
1
,
2
,
3
]
with
pytest
.
raises
(
TypeError
)
as
er
:
ret
=
x
+
y
assert
"For 'TensorAdd', the 1th input is a not support type: list"
in
str
(
er
.
value
)
assert
"For 'TensorAdd', the 1th input is a not support
implicit conversion
type: list"
in
str
(
er
.
value
)
def
test_float_tensor_and_bool_tensors_add_grad
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录