Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
98a47232
M
models
项目概览
PaddlePaddle
/
models
1 年多 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
98a47232
编写于
4月 25, 2018
作者:
W
walloollaw
提交者:
qingqing01
4月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more help info in argmax when axis is not set (#879)
上级
81b673eb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
5 deletion
+28
-5
fluid/image_classification/caffe2fluid/kaffe/net_template.py
fluid/image_classification/caffe2fluid/kaffe/net_template.py
+1
-0
fluid/image_classification/caffe2fluid/kaffe/paddle/transformer.py
...ge_classification/caffe2fluid/kaffe/paddle/transformer.py
+22
-4
fluid/image_classification/caffe2fluid/kaffe/shapes.py
fluid/image_classification/caffe2fluid/kaffe/shapes.py
+5
-1
未找到文件。
fluid/image_classification/caffe2fluid/kaffe/net_template.py
浏览文件 @
98a47232
...
...
@@ -121,6 +121,7 @@ def generate_net_code(net_name, inputs_info):
net_codes
=
str
(
inspect
.
getsource
(
MyNet
))
net_codes
=
net_codes
.
replace
(
'MyNet(object)'
,
'%s(Network)'
%
net_name
)
net_codes
=
net_codes
.
replace
(
'MyNet'
,
net_name
)
net_codes
=
net_codes
.
replace
(
'"INPUTS_INFO"'
,
inputs_info
)
custom_layer_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
...
...
fluid/image_classification/caffe2fluid/kaffe/paddle/transformer.py
浏览文件 @
98a47232
...
...
@@ -64,6 +64,11 @@ class MaybeActivated(object):
if
node
.
metadata
.
get
(
'relu'
,
False
)
!=
default
:
self
.
inject_kwargs
[
'relu'
]
=
not
default
default_slope
=
0.0
slope
=
node
.
metadata
.
get
(
'relu_negative_slope'
,
default_slope
)
if
slope
!=
default_slope
:
self
.
inject_kwargs
[
'relu_negative_slope'
]
=
slope
def
__call__
(
self
,
*
args
,
**
kwargs
):
kwargs
.
update
(
self
.
inject_kwargs
)
return
TensorFlowNode
(
*
args
,
**
kwargs
)
...
...
@@ -108,11 +113,19 @@ class TensorFlowMapper(NodeMapper):
else
:
# Stochastic pooling, for instance.
raise
KaffeError
(
'Unsupported pooling type.'
)
(
kernel_params
,
padding
)
=
self
.
get_kernel_params
(
node
)
ceil_mode
=
getattr
(
node
.
layer
.
parameters
,
'ceil_mode'
,
True
)
return
TensorFlowNode
(
pool_op
,
kernel_params
.
kernel_h
,
kernel_params
.
kernel_w
,
kernel_params
.
stride_h
,
kernel_params
.
stride_w
,
ceil_mode
,
**
padding
)
global_pool
=
getattr
(
node
.
layer
.
parameters
,
'global_pooling'
,
False
)
if
global_pool
:
input_shape
=
node
.
get_only_parent
().
output_shape
return
TensorFlowNode
(
pool_op
,
input_shape
.
height
,
input_shape
.
width
,
1
,
1
,
ceil_mode
)
else
:
(
kernel_params
,
padding
)
=
self
.
get_kernel_params
(
node
)
return
TensorFlowNode
(
pool_op
,
kernel_params
.
kernel_h
,
kernel_params
.
kernel_w
,
kernel_params
.
stride_h
,
kernel_params
.
stride_w
,
ceil_mode
,
**
padding
)
def
map_sigmoid
(
self
,
node
):
return
TensorFlowNode
(
'sigmoid'
)
...
...
@@ -169,6 +182,11 @@ class TensorFlowMapper(NodeMapper):
raise
KaffeError
(
'Unknown elementwise operation: {}'
.
format
(
op_code
))
def
map_scale
(
self
,
node
):
params
=
node
.
parameters
return
TensorFlowNode
(
'scale'
,
axis
=
params
.
axis
,
num_axes
=
params
.
num_axes
)
def
commit
(
self
,
chains
):
return
chains
...
...
fluid/image_classification/caffe2fluid/kaffe/shapes.py
浏览文件 @
98a47232
...
...
@@ -95,12 +95,16 @@ def shape_convolution(node):
def
shape_pool
(
node
):
global_pool
=
getattr
(
node
.
layer
.
parameters
,
'global_pooling'
,
False
)
if
global_pool
:
input_shape
=
node
.
get_only_parent
().
output_shape
return
make_tensor
(
input_shape
.
batch_size
,
input_shape
.
channels
,
1
,
1
)
ceil_mode
=
getattr
(
node
.
layer
.
parameters
,
'ceil_mode'
,
True
)
if
ceil_mode
is
True
:
method
=
math
.
ceil
else
:
method
=
math
.
floor
return
get_strided_kernel_output_shape
(
node
,
method
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录