Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
FluidDoc
提交
8f8eebbc
F
FluidDoc
项目概览
PaddlePaddle
/
FluidDoc
通知
5
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
23
列表
看板
标记
里程碑
合并请求
111
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FluidDoc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
23
Issue
23
列表
看板
标记
里程碑
合并请求
111
合并请求
111
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8f8eebbc
编写于
3月 23, 2020
作者:
L
Li Fuchen
提交者:
GitHub
3月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change fluid.layers.embedding to fluid.embedding to fix a bug of dim (#1934)
上级
a95aeae6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
11 addition
and
11 deletion
+11
-11
doc/fluid/user_guides/nlp_case/understand_sentiment/README.cn.md
...id/user_guides/nlp_case/understand_sentiment/README.cn.md
+2
-2
doc/fluid/user_guides/nlp_case/understand_sentiment/README.md
...fluid/user_guides/nlp_case/understand_sentiment/README.md
+2
-2
doc/fluid/user_guides/nlp_case/understand_sentiment/index.cn.html
...d/user_guides/nlp_case/understand_sentiment/index.cn.html
+2
-2
doc/fluid/user_guides/nlp_case/understand_sentiment/index.html
...luid/user_guides/nlp_case/understand_sentiment/index.html
+2
-2
doc/fluid/user_guides/nlp_case/understand_sentiment/train_conv.py
...d/user_guides/nlp_case/understand_sentiment/train_conv.py
+1
-1
doc/fluid/user_guides/nlp_case/understand_sentiment/train_dyn_rnn.py
...ser_guides/nlp_case/understand_sentiment/train_dyn_rnn.py
+1
-1
doc/fluid/user_guides/nlp_case/understand_sentiment/train_stacked_lstm.py
...uides/nlp_case/understand_sentiment/train_stacked_lstm.py
+1
-1
未找到文件。
doc/fluid/user_guides/nlp_case/understand_sentiment/README.cn.md
浏览文件 @
8f8eebbc
...
@@ -151,7 +151,7 @@ BATCH_SIZE = 128 #batch的大小
...
@@ -151,7 +151,7 @@ BATCH_SIZE = 128 #batch的大小
```
python
```
python
#文本卷积神经网络
#文本卷积神经网络
def
convolution_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
):
def
convolution_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
):
emb
=
fluid
.
layers
.
embedding
(
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
conv_3
=
fluid
.
nets
.
sequence_conv_pool
(
conv_3
=
fluid
.
nets
.
sequence_conv_pool
(
input
=
emb
,
input
=
emb
,
...
@@ -183,7 +183,7 @@ def convolution_net(data, input_dim, class_dim, emb_dim, hid_dim):
...
@@ -183,7 +183,7 @@ def convolution_net(data, input_dim, class_dim, emb_dim, hid_dim):
def
stacked_lstm_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
,
stacked_num
):
def
stacked_lstm_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
,
stacked_num
):
#计算词向量
#计算词向量
emb
=
fluid
.
layers
.
embedding
(
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
#第一层栈
#第一层栈
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/README.md
浏览文件 @
8f8eebbc
...
@@ -140,7 +140,7 @@ Note that `fluid.nets.sequence_conv_pool` contains both convolution and pooling
...
@@ -140,7 +140,7 @@ Note that `fluid.nets.sequence_conv_pool` contains both convolution and pooling
```
python
```
python
#Textconvolution neural network
#Textconvolution neural network
def
convolution_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
):
def
convolution_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
):
emb
=
fluid
.
layers
.
embedding
(
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
conv_3
=
fluid
.
nets
.
sequence_conv_pool
(
conv_3
=
fluid
.
nets
.
sequence_conv_pool
(
input
=
emb
,
input
=
emb
,
...
@@ -172,7 +172,7 @@ The code of the stack bidirectional LSTM `stacked_lstm_net` is as follows:
...
@@ -172,7 +172,7 @@ The code of the stack bidirectional LSTM `stacked_lstm_net` is as follows:
def
stacked_lstm_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
,
stacked_num
):
def
stacked_lstm_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
,
stacked_num
):
# Calculate word vectorvector
# Calculate word vectorvector
emb
=
fluid
.
layers
.
embedding
(
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
#First stack
#First stack
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/index.cn.html
浏览文件 @
8f8eebbc
...
@@ -193,7 +193,7 @@ BATCH_SIZE = 128 #batch的大小
...
@@ -193,7 +193,7 @@ BATCH_SIZE = 128 #batch的大小
```python
```python
#文本卷积神经网络
#文本卷积神经网络
def convolution_net(data, input_dim, class_dim, emb_dim, hid_dim):
def convolution_net(data, input_dim, class_dim, emb_dim, hid_dim):
emb = fluid.
layers.
embedding(
emb = fluid.embedding(
input=data, size=[input_dim, emb_dim], is_sparse=True)
input=data, size=[input_dim, emb_dim], is_sparse=True)
conv_3 = fluid.nets.sequence_conv_pool(
conv_3 = fluid.nets.sequence_conv_pool(
input=emb,
input=emb,
...
@@ -225,7 +225,7 @@ def convolution_net(data, input_dim, class_dim, emb_dim, hid_dim):
...
@@ -225,7 +225,7 @@ def convolution_net(data, input_dim, class_dim, emb_dim, hid_dim):
def stacked_lstm_net(data, input_dim, class_dim, emb_dim, hid_dim, stacked_num):
def stacked_lstm_net(data, input_dim, class_dim, emb_dim, hid_dim, stacked_num):
#计算词向量
#计算词向量
emb = fluid.
layers.
embedding(
emb = fluid.embedding(
input=data, size=[input_dim, emb_dim], is_sparse=True)
input=data, size=[input_dim, emb_dim], is_sparse=True)
#第一层栈
#第一层栈
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/index.html
浏览文件 @
8f8eebbc
...
@@ -182,7 +182,7 @@ Note that `fluid.nets.sequence_conv_pool` contains both convolution and pooling
...
@@ -182,7 +182,7 @@ Note that `fluid.nets.sequence_conv_pool` contains both convolution and pooling
```python
```python
#Textconvolution neural network
#Textconvolution neural network
def convolution_net(data, input_dim, class_dim, emb_dim, hid_dim):
def convolution_net(data, input_dim, class_dim, emb_dim, hid_dim):
emb = fluid.
layers.
embedding(
emb = fluid.embedding(
input=data, size=[input_dim, emb_dim], is_sparse=True)
input=data, size=[input_dim, emb_dim], is_sparse=True)
conv_3 = fluid.nets.sequence_conv_pool(
conv_3 = fluid.nets.sequence_conv_pool(
input=emb,
input=emb,
...
@@ -214,7 +214,7 @@ The code of the stack bidirectional LSTM `stacked_lstm_net` is as follows:
...
@@ -214,7 +214,7 @@ The code of the stack bidirectional LSTM `stacked_lstm_net` is as follows:
def stacked_lstm_net(data, input_dim, class_dim, emb_dim, hid_dim, stacked_num):
def stacked_lstm_net(data, input_dim, class_dim, emb_dim, hid_dim, stacked_num):
# Calculate word vectorvector
# Calculate word vectorvector
emb = fluid.
layers.
embedding(
emb = fluid.embedding(
input=data, size=[input_dim, emb_dim], is_sparse=True)
input=data, size=[input_dim, emb_dim], is_sparse=True)
#First stack
#First stack
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/train_conv.py
浏览文件 @
8f8eebbc
...
@@ -42,7 +42,7 @@ def parse_args():
...
@@ -42,7 +42,7 @@ def parse_args():
def
convolution_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
):
def
convolution_net
(
data
,
input_dim
,
class_dim
,
emb_dim
,
hid_dim
):
emb
=
fluid
.
layers
.
embedding
(
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
conv_3
=
fluid
.
nets
.
sequence_conv_pool
(
conv_3
=
fluid
.
nets
.
sequence_conv_pool
(
input
=
emb
,
input
=
emb
,
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/train_dyn_rnn.py
浏览文件 @
8f8eebbc
...
@@ -42,7 +42,7 @@ def parse_args():
...
@@ -42,7 +42,7 @@ def parse_args():
def
dynamic_rnn_lstm
(
data
,
input_dim
,
class_dim
,
emb_dim
,
lstm_size
):
def
dynamic_rnn_lstm
(
data
,
input_dim
,
class_dim
,
emb_dim
,
lstm_size
):
emb
=
fluid
.
layers
.
embedding
(
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
sentence
=
fluid
.
layers
.
fc
(
input
=
emb
,
size
=
lstm_size
*
4
,
act
=
'tanh'
)
sentence
=
fluid
.
layers
.
fc
(
input
=
emb
,
size
=
lstm_size
*
4
,
act
=
'tanh'
)
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/train_stacked_lstm.py
浏览文件 @
8f8eebbc
...
@@ -47,7 +47,7 @@ def stacked_lstm_net(data, input_dim, class_dim, emb_dim, hid_dim,
...
@@ -47,7 +47,7 @@ def stacked_lstm_net(data, input_dim, class_dim, emb_dim, hid_dim,
stacked_num
):
stacked_num
):
assert
stacked_num
%
2
==
1
assert
stacked_num
%
2
==
1
emb
=
fluid
.
layers
.
embedding
(
emb
=
fluid
.
embedding
(
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
input
=
data
,
size
=
[
input_dim
,
emb_dim
],
is_sparse
=
True
)
fc1
=
fluid
.
layers
.
fc
(
input
=
emb
,
size
=
hid_dim
)
fc1
=
fluid
.
layers
.
fc
(
input
=
emb
,
size
=
hid_dim
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录