Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
c3d9f180
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看板
提交
c3d9f180
编写于
5月 16, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 16, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1176 fix validator for transpose
Merge pull request !1176 from jiangjinsheng/issue_transpose
上级
22ba991f
e45532b7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
7 deletion
+9
-7
mindspore/ops/operations/array_ops.py
mindspore/ops/operations/array_ops.py
+8
-6
tests/ut/python/nn/test_cell_wrapper.py
tests/ut/python/nn/test_cell_wrapper.py
+1
-1
未找到文件。
mindspore/ops/operations/array_ops.py
浏览文件 @
c3d9f180
...
...
@@ -461,12 +461,12 @@ class Transpose(PrimitiveWithInfer):
x_shape
=
x
[
'shape'
]
p_value
=
perm
[
'value'
]
x_type
=
x
[
'dtype'
]
if
len
(
x_shape
)
!=
len
(
p_value
):
raise
ValueError
(
'The dimension of x and perm must be equal.'
)
validator
.
check_value_type
(
"p_value"
,
p_value
,
[
tuple
],
self
.
name
)
validator
.
check_subclass
(
"x_type"
,
x_type
,
mstype
.
tensor
,
self
.
name
)
if
len
(
x_shape
)
!=
len
(
p_value
):
raise
ValueError
(
'The dimension of x and perm must be equal.'
)
tmp
=
list
(
p_value
)
for
i
,
dim
in
enumerate
(
p_value
):
validator
.
check_integer
(
"perm[%d]"
%
i
,
dim
,
0
,
Rel
.
GE
,
self
.
name
)
...
...
@@ -2165,7 +2165,7 @@ class SpaceToBatch(PrimitiveWithInfer):
of the input are zero padded according to paddings if necessary.
Args:
block_size (int): The block size of dividing block with value >=
1
.
block_size (int): The block size of dividing block with value >=
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
...
...
@@ -2199,10 +2199,11 @@ class SpaceToBatch(PrimitiveWithInfer):
def
__init__
(
self
,
block_size
,
paddings
):
"""Init SpaceToBatch"""
validator
.
check_value_type
(
'block_size'
,
block_size
,
[
int
],
self
.
name
)
validator
.
check
(
'block_size'
,
block_size
,
''
,
1
,
Rel
.
GT
,
self
.
name
)
validator
.
check
(
'block_size'
,
block_size
,
''
,
2
,
Rel
.
GE
,
self
.
name
)
self
.
block_size
=
block_size
validator
.
check
(
'paddings shape'
,
np
.
array
(
paddings
).
shape
,
''
,
(
2
,
2
),
Rel
.
EQ
,
self
.
name
)
for
elem
in
itertools
.
chain
(
*
paddings
):
validator
.
check_integer
(
'paddings element'
,
elem
,
0
,
Rel
.
GE
,
self
.
name
)
validator
.
check_value_type
(
'paddings element'
,
elem
,
[
int
],
self
.
name
)
self
.
paddings
=
paddings
...
...
@@ -2266,10 +2267,11 @@ class BatchToSpace(PrimitiveWithInfer):
def
__init__
(
self
,
block_size
,
crops
):
"""Init BatchToSpace"""
validator
.
check_value_type
(
'block_size'
,
block_size
,
[
int
],
self
.
name
)
validator
.
check
(
'block_size'
,
block_size
,
''
,
1
,
Rel
.
G
T
,
self
.
name
)
validator
.
check
(
'block_size'
,
block_size
,
''
,
1
,
Rel
.
G
E
,
self
.
name
)
self
.
block_size
=
block_size
validator
.
check
(
'crops shape'
,
np
.
array
(
crops
).
shape
,
''
,
(
2
,
2
))
for
elem
in
itertools
.
chain
(
*
crops
):
validator
.
check_integer
(
'crops element'
,
elem
,
0
,
Rel
.
GE
,
self
.
name
)
validator
.
check_value_type
(
'crops element'
,
elem
,
[
int
],
self
.
name
)
self
.
crops
=
crops
...
...
tests/ut/python/nn/test_cell_wrapper.py
浏览文件 @
c3d9f180
...
...
@@ -64,7 +64,7 @@ def test_parameter_update_int32_and_tensor():
param_step
=
train_network
.
parameters_dict
()[
'global_step'
]
update_global_step
=
ParameterUpdate
(
param_step
)
input_step
=
Tensor
(
np
.
array
([
0.2
,
0.02
,
0.002
]),
mstype
.
float32
)
input_step
=
Tensor
(
np
.
array
([
1000
]),
mstype
.
float32
)
_executor
.
compile
(
update_global_step
,
input_step
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录