Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
X2Paddle
提交
97a4a77a
X
X2Paddle
项目概览
PaddlePaddle
/
X2Paddle
大约 1 年 前同步成功
通知
328
Star
698
Fork
167
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
26
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
X2Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
26
Issue
26
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
97a4a77a
编写于
11月 04, 2019
作者:
J
Jason
提交者:
GitHub
11月 04, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #199 from SunAhong1993/develop
fix the normalize
上级
d59c2b04
b3838fbd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
4 deletion
+7
-4
x2paddle/decoder/caffe_decoder.py
x2paddle/decoder/caffe_decoder.py
+5
-0
x2paddle/op_mapper/caffe_custom_layer/normalize.py
x2paddle/op_mapper/caffe_custom_layer/normalize.py
+2
-4
未找到文件。
x2paddle/decoder/caffe_decoder.py
浏览文件 @
97a4a77a
...
@@ -246,9 +246,14 @@ class CaffeDecoder(object):
...
@@ -246,9 +246,14 @@ class CaffeDecoder(object):
if
layer
.
type
==
'PReLU'
:
if
layer
.
type
==
'PReLU'
:
c_o
,
c_i
,
h
,
w
=
map
(
int
,
[
1
]
+
\
c_o
,
c_i
,
h
,
w
=
map
(
int
,
[
1
]
+
\
list
(
dims
)
+
[
1
]
*
(
3
-
len
(
dims
)))
list
(
dims
)
+
[
1
]
*
(
3
-
len
(
dims
)))
elif
layer
.
type
==
'Normalize'
:
data
=
np
.
asarray
(
list
(
blob
.
data
),
dtype
=
np
.
float32
)
transformed
.
append
(
data
)
continue
else
:
else
:
c_o
,
c_i
,
h
,
w
=
map
(
int
,
[
1
]
*
(
4
-
len
(
dims
))
\
c_o
,
c_i
,
h
,
w
=
map
(
int
,
[
1
]
*
(
4
-
len
(
dims
))
\
+
list
(
dims
))
+
list
(
dims
))
else
:
else
:
c_o
=
blob
.
num
c_o
=
blob
.
num
c_i
=
blob
.
channels
c_i
=
blob
.
channels
...
...
x2paddle/op_mapper/caffe_custom_layer/normalize.py
浏览文件 @
97a4a77a
...
@@ -12,16 +12,14 @@ def normalize_layer(inputs,
...
@@ -12,16 +12,14 @@ def normalize_layer(inputs,
input_shape
=
None
,
input_shape
=
None
,
name
=
None
):
name
=
None
):
assert
across_spatial
==
False
,
"Only support across_spatial == False for Normalize"
assert
across_spatial
==
False
,
"Only support across_spatial == False for Normalize"
input
=
inputs
[
0
]
input
=
inputs
[
0
]
l2_norm
=
fluid
.
layers
.
l2_normalize
(
input
,
axis
=
1
,
name
=
name
+
'_l2'
)
l2_norm
=
fluid
.
layers
.
l2_normalize
(
input
,
axis
=
1
,
name
=
name
+
'_l2'
)
scale_param
=
fluid
.
layers
.
create_parameter
(
scale_param
=
fluid
.
layers
.
create_parameter
(
shape
=
[
1
]
shape
=
[
1
]
if
channel_shared
else
[
input_shape
[
0
][
1
]],
if
channel_shared
else
[
input_shape
[
0
][
0
],
1
,
1
,
input_shape
[
0
][
1
]],
dtype
=
input
.
dtype
,
dtype
=
input
.
dtype
,
attr
=
name
+
'_scale'
)
attr
=
name
+
'_scale'
)
scale_param
=
fluid
.
layers
.
reshape
(
x
=
scale_param
,
\
scale_param
=
fluid
.
layers
.
reshape
(
x
=
scale_param
,
\
shape
=
[
1
]
if
channel_shared
else
[
input_shape
[
0
][
0
],
1
,
1
,
input_shape
[
0
][
1
]])
shape
=
[
1
]
if
channel_shared
else
[
input_shape
[
0
][
1
]])
out
=
fluid
.
layers
.
elementwise_mul
(
x
=
l2_norm
,
out
=
fluid
.
layers
.
elementwise_mul
(
x
=
l2_norm
,
y
=
scale_param
,
y
=
scale_param
,
axis
=-
1
if
channel_shared
else
1
)
axis
=-
1
if
channel_shared
else
1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录