Skip to content

Commit 8f13ba4

Browse files
committed
add some examples for backbone components
1 parent fa41d55 commit 8f13ba4

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

docs/source/component/backbone.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,23 @@ message InputLayer {
12941294
- `wide_output_dim` wide模型每个特征的参数权重维度,一般设定为1
12951295
- `concat_seq_feature` 是否需要把序列特征的embedding拼接在一起
12961296

1297+
比如同一个group的所有特征 pooling 为一个特征的示例如下:
1298+
1299+
- 前提条件:这个group内的所有特征的在embedding_dim都相同
1300+
1301+
```protobuf
1302+
blocks {
1303+
name: 'feat_pooling'
1304+
inputs {
1305+
feature_group_name: 'feat_group'
1306+
}
1307+
input_layer {
1308+
only_output_3d_tensor: true
1309+
}
1310+
extra_input_fn: 'lambda x: tf.reduce_sum(x, axis=1)'
1311+
}
1312+
```
1313+
12971314
## 3. Lambda组件块
12981315

12991316
`Lambda组件块`可以配置一个lambda函数,执行一些较简单的操作。示例如下:

docs/source/component/sequence.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,43 @@ blocks {
7373
}
7474
```
7575

76+
## 对输入序列pooling的例子
77+
78+
```protobuf
79+
model_config: {
80+
model_name: 'SumPooling'
81+
model_class: 'RankModel
82+
...
83+
feature_groups: {
84+
group_name: 'sequence'
85+
feature_names: "tag_category_list"
86+
feature_names: "tag_brand_list"
87+
wide_deep: DEEP
88+
}
89+
backbone {
90+
91+
blocks {
92+
name: 'seq_input'
93+
inputs {
94+
feature_group_name: 'sequence'
95+
}
96+
input_layer {
97+
output_seq_and_normal_feature: true
98+
}
99+
}
100+
blocks {
101+
name: 'sum_pooling'
102+
inputs {
103+
block_name: 'seq_input'
104+
input_slice: '[0]'
105+
}
106+
extra_input_fn: 'lambda x: tf.reduce_sum(x, axis=1)'
107+
}
108+
...
109+
}
110+
}
111+
```
112+
76113
## 完整的例子
77114

78115
- [DIN](../models/din.md)

0 commit comments

Comments
 (0)