Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
FluidDoc
提交
e242e6f1
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看板
未验证
提交
e242e6f1
编写于
5月 20, 2020
作者:
L
Li Fuchen
提交者:
GitHub
5月 20, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix an infer bug of understand_sentiment (#2164)
* fix a infer bug of understand_sentiment.
上级
c245fed2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
17 addition
and
10 deletion
+17
-10
doc/fluid/user_guides/nlp_case/understand_sentiment/README.cn.md
...id/user_guides/nlp_case/understand_sentiment/README.cn.md
+2
-1
doc/fluid/user_guides/nlp_case/understand_sentiment/README.md
...fluid/user_guides/nlp_case/understand_sentiment/README.md
+2
-1
doc/fluid/user_guides/nlp_case/understand_sentiment/index.cn.html
...d/user_guides/nlp_case/understand_sentiment/index.cn.html
+2
-1
doc/fluid/user_guides/nlp_case/understand_sentiment/index.html
...luid/user_guides/nlp_case/understand_sentiment/index.html
+2
-1
doc/fluid/user_guides/nlp_case/understand_sentiment/train_conv.py
...d/user_guides/nlp_case/understand_sentiment/train_conv.py
+3
-2
doc/fluid/user_guides/nlp_case/understand_sentiment/train_dyn_rnn.py
...ser_guides/nlp_case/understand_sentiment/train_dyn_rnn.py
+3
-2
doc/fluid/user_guides/nlp_case/understand_sentiment/train_stacked_lstm.py
...uides/nlp_case/understand_sentiment/train_stacked_lstm.py
+3
-2
未找到文件。
doc/fluid/user_guides/nlp_case/understand_sentiment/README.cn.md
浏览文件 @
e242e6f1
...
...
@@ -394,7 +394,7 @@ inference_scope = fluid.core.Scope()
```
python
reviews_str
=
[
'read the book forget the movie'
,
'this is a great movie'
,
'this is very bad'
b
'read the book forget the movie'
,
b
'this is a great movie'
,
b
'this is very bad'
]
reviews
=
[
c
.
split
()
for
c
in
reviews_str
]
...
...
@@ -404,6 +404,7 @@ for c in reviews:
lod
.
append
([
word_dict
.
get
(
words
,
UNK
)
for
words
in
c
])
base_shape
=
[[
len
(
c
)
for
c
in
lod
]]
lod
=
np
.
array
(
sum
(
lod
,
[]),
dtype
=
np
.
int64
)
tensor_words
=
fluid
.
create_lod_tensor
(
lod
,
base_shape
,
place
)
```
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/README.md
浏览文件 @
e242e6f1
...
...
@@ -383,7 +383,7 @@ Then we use `create_lod_tensor` to create the tensor of the detail level. For a
```
python
reviews_str
=
[
'read the book forget the movie'
,
'this is a great movie'
,
'this is very bad'
b
'read the book forget the movie'
,
b
'this is a great movie'
,
b
'this is very bad'
]
reviews
=
[
c
.
split
()
for
c
in
reviews_str
]
...
...
@@ -393,6 +393,7 @@ for c in reviews:
lod
.
append
([
word_dict
.
get
(
words
,
UNK
)
for
words
in
c
])
base_shape
=
[[
len
(
c
)
for
c
in
lod
]]
lod
=
np
.
array
(
sum
(
lod
,
[]),
dtype
=
np
.
int64
)
tensor_words
=
fluid
.
create_lod_tensor
(
lod
,
base_shape
,
place
)
```
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/index.cn.html
浏览文件 @
e242e6f1
...
...
@@ -436,7 +436,7 @@ inference_scope = fluid.core.Scope()
```python
reviews_str = [
'read the book forget the movie', 'this is a great movie',
'this is very bad'
b'read the book forget the movie', b'this is a great movie', b
'this is very bad'
]
reviews = [c.split() for c in reviews_str]
...
...
@@ -446,6 +446,7 @@ for c in reviews:
lod.append([word_dict.get(words, UNK) for words in c])
base_shape = [[len(c) for c in lod]]
lod = np.array(sum(lod, []), dtype=np.int64)
tensor_words = fluid.create_lod_tensor(lod, base_shape, place)
```
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/index.html
浏览文件 @
e242e6f1
...
...
@@ -425,7 +425,7 @@ Then we use `create_lod_tensor` to create the tensor of the detail level. For a
```python
reviews_str = [
'read the book forget the movie', 'this is a great movie',
'this is very bad'
b'read the book forget the movie', b'this is a great movie', b
'this is very bad'
]
reviews = [c.split() for c in reviews_str]
...
...
@@ -435,6 +435,7 @@ for c in reviews:
lod.append([word_dict.get(words, UNK) for words in c])
base_shape = [[len(c) for c in lod]]
lod = np.array(sum(lod, []), dtype=np.int64)
tensor_words = fluid.create_lod_tensor(lod, base_shape, place)
```
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/train_conv.py
浏览文件 @
e242e6f1
...
...
@@ -205,8 +205,8 @@ def infer(use_cuda, params_dirname=None):
# length 3, 4 and 2, respectively.
# Note that lod info should be a list of lists.
reviews_str
=
[
'read the book forget the movie'
,
'this is a great movie'
,
'this is very bad'
b
'read the book forget the movie'
,
b
'this is a great movie'
,
b
'this is very bad'
]
reviews
=
[
c
.
split
()
for
c
in
reviews_str
]
...
...
@@ -216,6 +216,7 @@ def infer(use_cuda, params_dirname=None):
lod
.
append
([
np
.
int64
(
word_dict
.
get
(
words
,
UNK
))
for
words
in
c
])
base_shape
=
[[
len
(
c
)
for
c
in
lod
]]
lod
=
np
.
array
(
sum
(
lod
,
[]),
dtype
=
np
.
int64
)
tensor_words
=
fluid
.
create_lod_tensor
(
lod
,
base_shape
,
place
)
assert
feed_target_names
[
0
]
==
"words"
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/train_dyn_rnn.py
浏览文件 @
e242e6f1
...
...
@@ -194,8 +194,8 @@ def infer(use_cuda, params_dirname=None):
# length 3, 4 and 2, respectively.
# Note that lod info should be a list of lists.
reviews_str
=
[
'read the book forget the movie'
,
'this is a great movie'
,
'this is very bad'
b
'read the book forget the movie'
,
b
'this is a great movie'
,
b
'this is very bad'
]
reviews
=
[
c
.
split
()
for
c
in
reviews_str
]
...
...
@@ -205,6 +205,7 @@ def infer(use_cuda, params_dirname=None):
lod
.
append
([
np
.
int64
(
word_dict
.
get
(
words
,
UNK
))
for
words
in
c
])
base_shape
=
[[
len
(
c
)
for
c
in
lod
]]
lod
=
np
.
array
(
sum
(
lod
,
[]),
dtype
=
np
.
int64
)
tensor_words
=
fluid
.
create_lod_tensor
(
lod
,
base_shape
,
place
)
assert
feed_target_names
[
0
]
==
"words"
...
...
doc/fluid/user_guides/nlp_case/understand_sentiment/train_stacked_lstm.py
浏览文件 @
e242e6f1
...
...
@@ -216,8 +216,8 @@ def infer(use_cuda, params_dirname=None):
# length 3, 4 and 2, respectively.
# Note that lod info should be a list of lists.
reviews_str
=
[
'read the book forget the movie'
,
'this is a great movie'
,
'this is very bad'
b
'read the book forget the movie'
,
b
'this is a great movie'
,
b
'this is very bad'
]
reviews
=
[
c
.
split
()
for
c
in
reviews_str
]
...
...
@@ -227,6 +227,7 @@ def infer(use_cuda, params_dirname=None):
lod
.
append
([
np
.
int64
(
word_dict
.
get
(
words
,
UNK
))
for
words
in
c
])
base_shape
=
[[
len
(
c
)
for
c
in
lod
]]
lod
=
np
.
array
(
sum
(
lod
,
[]),
dtype
=
np
.
int64
)
tensor_words
=
fluid
.
create_lod_tensor
(
lod
,
base_shape
,
place
)
assert
feed_target_names
[
0
]
==
"words"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录