Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
7c233a57
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看板
提交
7c233a57
编写于
4月 20, 2020
作者:
B
buxue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support python func print and != for list with none
上级
679dbd27
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
10 deletion
+43
-10
mindspore/_extends/parse/resources.py
mindspore/_extends/parse/resources.py
+1
-0
mindspore/_extends/parse/trope.py
mindspore/_extends/parse/trope.py
+2
-2
mindspore/ops/composite/multitype_ops/not_equal_impl.py
mindspore/ops/composite/multitype_ops/not_equal_impl.py
+34
-3
mindspore/ops/functional.py
mindspore/ops/functional.py
+1
-1
mindspore/ops/operations/_grad_ops.py
mindspore/ops/operations/_grad_ops.py
+1
-0
tests/ut/python/pipeline/parse/test_operator.py
tests/ut/python/pipeline/parse/test_operator.py
+4
-2
tests/vm_impl/nn_ops_vm_impl.py
tests/vm_impl/nn_ops_vm_impl.py
+0
-2
未找到文件。
mindspore/_extends/parse/resources.py
浏览文件 @
7c233a57
...
...
@@ -114,6 +114,7 @@ convert_object_map = {
T
.
map
:
C
.
HyperMap
(),
T
.
partial
:
F
.
partial
,
T
.
zip
:
C
.
zip_operation
,
T
.
print
:
F
.
print_
,
# custom define operation
T
.
iter
:
M
.
ms_iter
,
...
...
mindspore/_extends/parse/trope.py
浏览文件 @
7c233a57
...
...
@@ -27,7 +27,7 @@ from operator import ( # noqa
# support system function call
from
builtins
import
(
# noqa
bool
,
getattr
,
setattr
,
len
,
iter
,
next
,
pow
,
range
,
map
,
zip
bool
,
getattr
,
setattr
,
len
,
iter
,
next
,
pow
,
range
,
map
,
zip
,
print
)
# support functools
...
...
@@ -44,7 +44,7 @@ __all__ = ['add', 'sub', 'mul', 'truediv', 'floordiv', 'mod', 'eq', 'ne', 'lt',
'not_'
,
'and_'
,
'or_'
,
'xor'
,
'lshift'
,
'rshift'
,
'invert'
,
'is_'
,
'is_not'
,
'contains'
,
'matmul'
,
'getitem'
,
'setitem'
,
'bool'
,
'getattr'
,
'setattr'
,
'len'
,
'iter'
,
'next'
,
'pow'
,
'range'
,
'map'
,
'zip'
,
'partial'
,
'partial'
,
'print'
,
'exp'
,
'log'
,
'sin'
,
'cos'
,
'tan'
]
...
...
mindspore/ops/composite/multitype_ops/not_equal_impl.py
浏览文件 @
7c233a57
...
...
@@ -132,7 +132,7 @@ def _none_not_equal_scalar(x, y):
@
not_equal
.
register
(
"Tuple"
,
"Tuple"
)
def
_euqal_tuple
(
x
,
y
):
def
_
not_
euqal_tuple
(
x
,
y
):
"""
Determine if two tuples are not equal by element.
...
...
@@ -147,7 +147,7 @@ def _euqal_tuple(x, y):
@
not_equal
.
register
(
"List"
,
"List"
)
def
_euqal_list
(
x
,
y
):
def
_
not_
euqal_list
(
x
,
y
):
"""
Determine if two lists are not equal by element.
...
...
@@ -162,7 +162,7 @@ def _euqal_list(x, y):
@
not_equal
.
register
(
"Tuple"
,
"None"
)
def
_tuple_euqal_none
(
x
,
y
):
def
_tuple_
not_
euqal_none
(
x
,
y
):
"""
Determine if tuple element not equals none element.
...
...
@@ -190,6 +190,7 @@ def _none_not_equal_tuple(x, y):
"""
return
True
@
not_equal
.
register
(
"Tensor"
,
"Number"
)
@
not_equal
.
register
(
"Number"
,
"Tensor"
)
@
not_equal
.
register
(
"Tensor"
,
"Tensor"
)
...
...
@@ -235,3 +236,33 @@ def _none_not_equal_tensor(x, y):
bool, return True.
"""
return
True
@
not_equal
.
register
(
"List"
,
"None"
)
def
_list_not_equal_none
(
x
,
y
):
"""
Determine if list not equal none.
Args:
x (list): The first input which is a list.
y (none): The second input which is none.
Returns:
bool, return true.
"""
return
True
@
not_equal
.
register
(
"None"
,
"List"
)
def
_none_not_equal_list
(
x
,
y
):
"""
Determine if none not equal list.
Args:
x (none): The first input which is none.
y (list): The second input which is a list.
Returns:
bool, return true.
"""
return
True
mindspore/ops/functional.py
浏览文件 @
7c233a57
...
...
@@ -66,7 +66,7 @@ scalar_to_array = P.ScalarToArray()
scalar_to_tensor
=
P
.
ScalarToTensor
()
tuple_to_array
=
P
.
TupleToArray
()
scalar_cast
=
P
.
ScalarCast
()
print_
=
P
.
Print
()
tuple_setitem
=
Primitive
(
'tuple_setitem'
)
tuple_getitem
=
Primitive
(
'tuple_getitem'
)
...
...
mindspore/ops/operations/_grad_ops.py
浏览文件 @
7c233a57
...
...
@@ -108,6 +108,7 @@ class BinaryCrossEntropyGrad(PrimitiveWithInfer):
validator
.
check_two_types_same
(
'x_type'
,
x_type
,
'weight_type'
,
weight_type
)
return
x_type
class
ConcatOffset
(
PrimitiveWithInfer
):
"""primitive for computing Concat's gradient."""
...
...
tests/ut/python/pipeline/parse/test_operator.py
浏览文件 @
7c233a57
...
...
@@ -160,8 +160,10 @@ def test_ops():
ret_floor
=
p
//
q
+
q
//
p
ret
=
ret_pow
+
ret_mod
+
ret_floor
if
self
.
int
>
self
.
float
:
if
self
.
str_a
+
self
.
str_b
==
"helloworld"
:
return
ret
if
[
1
,
2
,
3
]
!=
None
:
if
self
.
str_a
+
self
.
str_b
==
"helloworld"
:
print
(
"hello world"
)
return
ret
return
x
net
=
OpsNet
(
9
,
2
)
...
...
tests/vm_impl/nn_ops_vm_impl.py
浏览文件 @
7c233a57
...
...
@@ -151,8 +151,6 @@ def vm_impl_max_pool_grad_with_argmax(self):
"""Generate vm_impl function for MaxPoolGradWithArgmax"""
def
vm_impl
(
x
,
dout
,
argmax
):
print
(
"buxue"
)
print
(
argmax
)
x
=
x
.
asnumpy
()
dout
=
dout
.
asnumpy
()
arg_max
=
argmax
.
asnumpy
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录