Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
157ee1ca
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看板
提交
157ee1ca
编写于
6月 22, 2020
作者:
J
jiangjinsheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix nn.PReLU example
上级
304dbfaa
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
4 deletion
+11
-4
mindspore/nn/layer/activation.py
mindspore/nn/layer/activation.py
+1
-1
mindspore/ops/operations/_grad_ops.py
mindspore/ops/operations/_grad_ops.py
+2
-0
mindspore/ops/operations/array_ops.py
mindspore/ops/operations/array_ops.py
+5
-1
mindspore/ops/operations/nn_ops.py
mindspore/ops/operations/nn_ops.py
+3
-2
未找到文件。
mindspore/nn/layer/activation.py
浏览文件 @
157ee1ca
...
...
@@ -378,7 +378,7 @@ class PReLU(Cell):
Tensor, with the same type and shape as the `input_data`.
Examples:
>>> input_x = Tensor(np.
array([-1, -2, 0, 2, 1]
), mindspore.float32)
>>> input_x = Tensor(np.
random.rand(1, 10, 4, 4
), mindspore.float32)
>>> prelu = nn.PReLU()
>>> prelu(input_x)
...
...
mindspore/ops/operations/_grad_ops.py
浏览文件 @
157ee1ca
...
...
@@ -1066,6 +1066,8 @@ class StridedSliceGrad(PrimitiveWithInfer):
self
.
init_prim_io_names
(
inputs
=
[
'dy'
,
'shapex'
,
'begin'
,
'end'
,
'strides'
],
outputs
=
[
'output'
])
def
__infer__
(
self
,
dy
,
shapex
,
begin
,
end
,
strides
):
args
=
{
"shapex"
:
shapex
[
'dtype'
],
"begin"
:
begin
[
'dtype'
],
"end"
:
end
[
'dtype'
],
"strides"
:
strides
[
'dtype'
]}
validator
.
check_tensor_type_same
(
args
,
mstype
.
number_type
,
self
.
name
)
return
{
'shape'
:
shapex
[
'value'
],
'dtype'
:
dy
[
'dtype'
],
'value'
:
None
}
...
...
mindspore/ops/operations/array_ops.py
浏览文件 @
157ee1ca
...
...
@@ -2602,6 +2602,8 @@ class SpaceToBatchND(PrimitiveWithInfer):
for
elem
in
block_shape
:
validator
.
check
(
'block_shape element'
,
elem
,
''
,
1
,
Rel
.
GE
,
self
.
name
)
validator
.
check_value_type
(
'block_shape element'
,
elem
,
[
int
],
self
.
name
)
self
.
block_shape
=
block_shape
validator
.
check
(
'paddings shape'
,
np
.
array
(
paddings
).
shape
,
''
,
(
block_rank
,
2
),
Rel
.
EQ
,
self
.
name
)
...
...
@@ -2644,7 +2646,7 @@ class BatchToSpaceND(PrimitiveWithInfer):
The length of block_shape is M correspoding to the number of spatial dimensions.
crops (list): 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_s
iz
e[i] > crops[i][0]+crops[i][1].
input dimension i+2. It is required that input_shape[i+2]*block_s
hap
e[i] > crops[i][0]+crops[i][1].
Inputs:
- **input_x** (Tensor) - The input tensor.
...
...
@@ -2680,6 +2682,8 @@ class BatchToSpaceND(PrimitiveWithInfer):
for
elem
in
block_shape
:
validator
.
check
(
'block_shape element'
,
elem
,
''
,
1
,
Rel
.
GE
,
self
.
name
)
validator
.
check_value_type
(
'block_shape element'
,
elem
,
[
int
],
self
.
name
)
self
.
block_shape
=
block_shape
validator
.
check
(
'crops shape'
,
np
.
array
(
crops
).
shape
,
''
,
(
block_rank
,
2
),
Rel
.
EQ
,
self
.
name
)
...
...
mindspore/ops/operations/nn_ops.py
浏览文件 @
157ee1ca
...
...
@@ -2157,10 +2157,10 @@ class ResizeBilinear(PrimitiveWithInfer):
Tensor, resized image. Tensor of shape `(N_i, ..., N_n, new_height, new_width)` in `float32`.
Examples:
>>> tensor = Tensor([[[[1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]]], mindspore.
in
t32)
>>> tensor = Tensor([[[[1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]]], mindspore.
floa
t32)
>>> resize_bilinear = P.ResizeBilinear((5, 5))
>>> result = resize_bilinear(tensor)
>>> assert result.shape == (5, 5)
>>> assert result.shape == (
1, 1,
5, 5)
"""
@
prim_attr_register
...
...
@@ -2176,6 +2176,7 @@ class ResizeBilinear(PrimitiveWithInfer):
return
out_shape
def
infer_dtype
(
self
,
input_dtype
):
validator
.
check_tensor_type_same
({
'input_dtype'
:
input_dtype
},
[
mstype
.
float16
,
mstype
.
float32
],
self
.
name
)
return
mstype
.
tensor_type
(
mstype
.
float32
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录