Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
book
提交
f3bc752a
B
book
项目概览
PaddlePaddle
/
book
通知
16
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
40
列表
看板
标记
里程碑
合并请求
37
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
B
book
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
40
Issue
40
列表
看板
标记
里程碑
合并请求
37
合并请求
37
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f3bc752a
编写于
7月 10, 2019
作者:
Y
Youwei Song
提交者:
lujun
7月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use numpy.asarray as data initializer (#769)
use numpy.asarray as data initializer
上级
25cab9f5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
25 deletion
+25
-25
04.word2vec/README.cn.md
04.word2vec/README.cn.md
+5
-5
04.word2vec/README.md
04.word2vec/README.md
+5
-5
04.word2vec/index.cn.html
04.word2vec/index.cn.html
+5
-5
04.word2vec/index.html
04.word2vec/index.html
+5
-5
04.word2vec/train.py
04.word2vec/train.py
+5
-5
未找到文件。
04.word2vec/README.cn.md
浏览文件 @
f3bc752a
...
...
@@ -444,11 +444,11 @@ def infer(use_cuda, params_dirname=None):
# 用来查询embedding表获取对应的词向量,因此其形状大小是[1]。
# recursive_sequence_lengths设置的是基于长度的LoD,因此都应该设为[[1]]
# 注意recursive_sequence_lengths是列表的列表
data1
=
[[
211
]]
# 'among'
data2
=
[[
6
]]
# 'a'
data3
=
[[
96
]]
# 'group'
data4
=
[[
4
]]
# 'of'
lod
=
[[
1
]]
data1
=
numpy
.
asarray
([[
211
]],
dtype
=
numpy
.
int64
)
# 'among'
data2
=
numpy
.
asarray
([[
6
]],
dtype
=
numpy
.
int64
)
# 'a'
data3
=
numpy
.
asarray
([[
96
]],
dtype
=
numpy
.
int64
)
# 'group'
data4
=
numpy
.
asarray
([[
4
]],
dtype
=
numpy
.
int64
)
# 'of'
lod
=
numpy
.
asarray
([[
1
]],
dtype
=
numpy
.
int64
)
first_word
=
fluid
.
create_lod_tensor
(
data1
,
lod
,
place
)
second_word
=
fluid
.
create_lod_tensor
(
data2
,
lod
,
place
)
...
...
04.word2vec/README.md
浏览文件 @
f3bc752a
...
...
@@ -409,11 +409,11 @@ def infer(use_cuda, params_dirname=None):
# Used to query the embedding table to get the corresponding word vector, so its shape size is [1].
# recursive_sequence_lengths sets the length based on LoD, so it should all be set to [[1]]
# Note that recursive_sequence_lengths is a list of lists
data1
=
[[
211
]]
# 'among'
data2
=
[[
6
]]
# 'a'
data3
=
[[
96
]]
# 'group'
data4
=
[[
4
]]
# 'of'
lod
=
[[
1
]]
data1
=
numpy
.
asarray
([[
211
]],
dtype
=
numpy
.
int64
)
# 'among'
data2
=
numpy
.
asarray
([[
6
]],
dtype
=
numpy
.
int64
)
# 'a'
data3
=
numpy
.
asarray
([[
96
]],
dtype
=
numpy
.
int64
)
# 'group'
data4
=
numpy
.
asarray
([[
4
]],
dtype
=
numpy
.
int64
)
# 'of'
lod
=
numpy
.
asarray
([[
1
]],
dtype
=
numpy
.
int64
)
first_word
=
fluid
.
create_lod_tensor
(
data1
,
lod
,
place
)
second_word
=
fluid
.
create_lod_tensor
(
data2
,
lod
,
place
)
...
...
04.word2vec/index.cn.html
浏览文件 @
f3bc752a
...
...
@@ -486,11 +486,11 @@ def infer(use_cuda, params_dirname=None):
# 用来查询embedding表获取对应的词向量,因此其形状大小是[1]。
# recursive_sequence_lengths设置的是基于长度的LoD,因此都应该设为[[1]]
# 注意recursive_sequence_lengths是列表的列表
data1 =
[[211]]
# 'among'
data2 =
[[6]]
# 'a'
data3 =
[[96]]
# 'group'
data4 =
[[4]]
# 'of'
lod =
[[1]]
data1 =
numpy.asarray([[211]], dtype=numpy.int64)
# 'among'
data2 =
numpy.asarray([[6]], dtype=numpy.int64)
# 'a'
data3 =
numpy.asarray([[96]], dtype=numpy.int64)
# 'group'
data4 =
numpy.asarray([[4]], dtype=numpy.int64)
# 'of'
lod =
numpy.asarray([[1]], dtype=numpy.int64)
first_word = fluid.create_lod_tensor(data1, lod, place)
second_word = fluid.create_lod_tensor(data2, lod, place)
...
...
04.word2vec/index.html
浏览文件 @
f3bc752a
...
...
@@ -451,11 +451,11 @@ def infer(use_cuda, params_dirname=None):
# Used to query the embedding table to get the corresponding word vector, so its shape size is [1].
# recursive_sequence_lengths sets the length based on LoD, so it should all be set to [[1]]
# Note that recursive_sequence_lengths is a list of lists
data1 =
[[211]]
# 'among'
data2 =
[[6]]
# 'a'
data3 =
[[96]]
# 'group'
data4 =
[[4]]
# 'of'
lod =
[[1]]
data1 =
numpy.asarray([[211]], dtype=numpy.int64)
# 'among'
data2 =
numpy.asarray([[6]], dtype=numpy.int64)
# 'a'
data3 =
numpy.asarray([[96]], dtype=numpy.int64)
# 'group'
data4 =
numpy.asarray([[4]], dtype=numpy.int64)
# 'of'
lod =
numpy.asarray([[1]], dtype=numpy.int64)
first_word = fluid.create_lod_tensor(data1, lod, place)
second_word = fluid.create_lod_tensor(data2, lod, place)
...
...
04.word2vec/train.py
浏览文件 @
f3bc752a
...
...
@@ -206,11 +206,11 @@ def infer(use_cuda, params_dirname=None):
# meaning there is only one level of detail and there is only one sequence of
# one word on this level.
# Note that recursive_sequence_lengths should be a list of lists.
data1
=
[[
numpy
.
int64
(
211
)]]
# 'among'
data2
=
[[
numpy
.
int64
(
6
)]]
# 'a'
data3
=
[[
numpy
.
int64
(
96
)]]
# 'group'
data4
=
[[
numpy
.
int64
(
4
)]]
# 'of'
lod
=
[[
numpy
.
int64
(
1
)]]
data1
=
numpy
.
asarray
([[
211
]],
dtype
=
numpy
.
int64
)
# 'among'
data2
=
numpy
.
asarray
([[
6
]],
dtype
=
numpy
.
int64
)
# 'a'
data3
=
numpy
.
asarray
([[
96
]],
dtype
=
numpy
.
int64
)
# 'group'
data4
=
numpy
.
asarray
([[
4
]],
dtype
=
numpy
.
int64
)
# 'of'
lod
=
numpy
.
asarray
([[
1
]],
dtype
=
numpy
.
int64
)
first_word
=
fluid
.
create_lod_tensor
(
data1
,
lod
,
place
)
second_word
=
fluid
.
create_lod_tensor
(
data2
,
lod
,
place
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录