Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleRec
提交
b11b8825
P
PaddleRec
项目概览
PaddlePaddle
/
PaddleRec
通知
68
Star
12
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
27
列表
看板
标记
里程碑
合并请求
10
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
27
Issue
27
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b11b8825
编写于
5月 19, 2020
作者:
T
tangwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename Layer
上级
7a3ec4e6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
21 deletion
+12
-21
core/layer.py
core/layer.py
+1
-10
core/modules/modul/layers.py
core/modules/modul/layers.py
+11
-11
未找到文件。
core/layer.py
浏览文件 @
b11b8825
...
@@ -25,17 +25,8 @@ class Layer(object):
...
@@ -25,17 +25,8 @@ class Layer(object):
"""
"""
pass
pass
def
generate
(
self
,
mode
,
param
):
"""R
"""
if
mode
==
'fluid'
:
return
self
.
generate_fluid
(
param
)
print
(
'unsupport this mode: '
+
mode
)
return
None
,
None
@
abc
.
abstractmethod
@
abc
.
abstractmethod
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
pass
pass
core/modules/modul/layers.py
浏览文件 @
b11b8825
...
@@ -17,7 +17,7 @@ import paddle.fluid as fluid
...
@@ -17,7 +17,7 @@ import paddle.fluid as fluid
from
paddlerec.core.layer
import
Layer
from
paddlerec.core.layer
import
Layer
class
Embedding
Input
Layer
(
Layer
):
class
Embedding
Fuse
Layer
(
Layer
):
"""R
"""R
"""
"""
...
@@ -32,7 +32,7 @@ class EmbeddingInputLayer(Layer):
...
@@ -32,7 +32,7 @@ class EmbeddingInputLayer(Layer):
self
.
_emb_dim
=
self
.
_mf_dim
+
3
# append show ctr lr
self
.
_emb_dim
=
self
.
_mf_dim
+
3
# append show ctr lr
self
.
_emb_layers
=
[]
self
.
_emb_layers
=
[]
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
show_clk
=
fluid
.
layers
.
concat
(
show_clk
=
fluid
.
layers
.
concat
(
...
@@ -64,7 +64,7 @@ class LabelInputLayer(Layer):
...
@@ -64,7 +64,7 @@ class LabelInputLayer(Layer):
self
.
_data_type
=
config
.
get
(
'data_type'
,
"int64"
)
self
.
_data_type
=
config
.
get
(
'data_type'
,
"int64"
)
self
.
_label_idx
=
config
[
'label_idx'
]
self
.
_label_idx
=
config
[
'label_idx'
]
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
label
=
fluid
.
layers
.
data
(
name
=
self
.
_name
,
shape
=
[
-
1
,
self
.
_dim
],
\
label
=
fluid
.
layers
.
data
(
name
=
self
.
_name
,
shape
=
[
-
1
,
self
.
_dim
],
\
...
@@ -86,7 +86,7 @@ class TagInputLayer(Layer):
...
@@ -86,7 +86,7 @@ class TagInputLayer(Layer):
self
.
_dim
=
config
.
get
(
'dim'
,
1
)
self
.
_dim
=
config
.
get
(
'dim'
,
1
)
self
.
_data_type
=
config
[
'data_type'
]
self
.
_data_type
=
config
[
'data_type'
]
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
output
=
fluid
.
layers
.
data
(
name
=
self
.
_name
,
shape
=
[
-
1
,
self
.
_dim
],
\
output
=
fluid
.
layers
.
data
(
name
=
self
.
_name
,
shape
=
[
-
1
,
self
.
_dim
],
\
...
@@ -108,7 +108,7 @@ class ParamLayer(Layer):
...
@@ -108,7 +108,7 @@ class ParamLayer(Layer):
self
.
_data_type
=
config
.
get
(
'data_type'
,
'float32'
)
self
.
_data_type
=
config
.
get
(
'data_type'
,
'float32'
)
self
.
_config
=
config
self
.
_config
=
config
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
return
self
.
_config
,
{
'inference_param'
:
{
'name'
:
'param'
,
'params'
:
[],
'table_id'
:
self
.
_table_id
}}
return
self
.
_config
,
{
'inference_param'
:
{
'name'
:
'param'
,
'params'
:
[],
'table_id'
:
self
.
_table_id
}}
...
@@ -126,7 +126,7 @@ class SummaryLayer(Layer):
...
@@ -126,7 +126,7 @@ class SummaryLayer(Layer):
self
.
_data_type
=
config
.
get
(
'data_type'
,
'float32'
)
self
.
_data_type
=
config
.
get
(
'data_type'
,
'float32'
)
self
.
_config
=
config
self
.
_config
=
config
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
return
self
.
_config
,
{
'inference_param'
:
{
'name'
:
'summary'
,
'params'
:
[],
'table_id'
:
self
.
_table_id
}}
return
self
.
_config
,
{
'inference_param'
:
{
'name'
:
'summary'
,
'params'
:
[],
'table_id'
:
self
.
_table_id
}}
...
@@ -144,7 +144,7 @@ class NormalizetionLayer(Layer):
...
@@ -144,7 +144,7 @@ class NormalizetionLayer(Layer):
self
.
_summary
=
config
[
'summary'
]
self
.
_summary
=
config
[
'summary'
]
self
.
_table_id
=
config
.
get
(
'table_id'
,
-
1
)
self
.
_table_id
=
config
.
get
(
'table_id'
,
-
1
)
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
input_layer
=
param
[
'layer'
][
self
.
_input
[
0
]]
input_layer
=
param
[
'layer'
][
self
.
_input
[
0
]]
...
@@ -159,7 +159,7 @@ class NormalizetionLayer(Layer):
...
@@ -159,7 +159,7 @@ class NormalizetionLayer(Layer):
'params'
:
inference_param
,
'table_id'
:
summary_layer
.
get
(
'table_id'
,
-
1
)}}
'params'
:
inference_param
,
'table_id'
:
summary_layer
.
get
(
'table_id'
,
-
1
)}}
class
Neural
Layer
(
Layer
):
class
FC
Layer
(
Layer
):
"""R
"""R
"""
"""
...
@@ -172,7 +172,7 @@ class NeuralLayer(Layer):
...
@@ -172,7 +172,7 @@ class NeuralLayer(Layer):
self
.
_bias
=
config
.
get
(
'bias'
,
True
)
self
.
_bias
=
config
.
get
(
'bias'
,
True
)
self
.
_act_func
=
config
.
get
(
'act_func'
,
None
)
self
.
_act_func
=
config
.
get
(
'act_func'
,
None
)
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
param_layer
=
param
[
'layer'
][
self
.
_param
]
param_layer
=
param
[
'layer'
][
self
.
_param
]
...
@@ -200,7 +200,7 @@ class NeuralLayer(Layer):
...
@@ -200,7 +200,7 @@ class NeuralLayer(Layer):
'table_id'
:
param_layer
.
get
(
'table_id'
,
-
1
)}}
'table_id'
:
param_layer
.
get
(
'table_id'
,
-
1
)}}
class
Sigmoid
LossLayer
(
Layer
):
class
Log
LossLayer
(
Layer
):
"""R
"""R
"""
"""
...
@@ -231,7 +231,7 @@ class SigmoidLossLayer(Layer):
...
@@ -231,7 +231,7 @@ class SigmoidLossLayer(Layer):
}
}
}
}
def
generate
_fluid
(
self
,
param
):
def
generate
(
self
,
param
):
"""R
"""R
"""
"""
input_layer
=
param
[
'layer'
][
self
.
_input
[
0
]]
input_layer
=
param
[
'layer'
][
self
.
_input
[
0
]]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录