Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e87181db
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e87181db
编写于
3月 02, 2017
作者:
H
Helin Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use value_range instead of ele_range
上级
fa3b1c46
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
12 deletion
+12
-12
python/paddle/trainer/PyDataProvider2.py
python/paddle/trainer/PyDataProvider2.py
+6
-6
python/paddle/v2/tests/test_data_feeder.py
python/paddle/v2/tests/test_data_feeder.py
+6
-6
未找到文件。
python/paddle/trainer/PyDataProvider2.py
浏览文件 @
e87181db
...
@@ -65,11 +65,11 @@ def sparse_value_slot(dim, seq_type=SequenceType.NO_SEQUENCE):
...
@@ -65,11 +65,11 @@ def sparse_value_slot(dim, seq_type=SequenceType.NO_SEQUENCE):
return
InputType
(
dim
,
seq_type
,
DataType
.
SparseValue
)
return
InputType
(
dim
,
seq_type
,
DataType
.
SparseValue
)
def
index_slot
(
el
e_range
,
seq_type
=
SequenceType
.
NO_SEQUENCE
):
def
index_slot
(
valu
e_range
,
seq_type
=
SequenceType
.
NO_SEQUENCE
):
"""Data type of integer.
"""Data type of integer.
:param
el
e_range: range of this integer.
:param
valu
e_range: range of this integer.
"""
"""
return
InputType
(
el
e_range
,
seq_type
,
DataType
.
Index
)
return
InputType
(
valu
e_range
,
seq_type
,
DataType
.
Index
)
dense_vector
=
dense_slot
dense_vector
=
dense_slot
...
@@ -103,11 +103,11 @@ def sparse_vector_sub_sequence(dim):
...
@@ -103,11 +103,11 @@ def sparse_vector_sub_sequence(dim):
return
sparse_vector
(
dim
,
seq_type
=
SequenceType
.
SUB_SEQUENCE
)
return
sparse_vector
(
dim
,
seq_type
=
SequenceType
.
SUB_SEQUENCE
)
def
integer_value_sequence
(
el
e_range
):
def
integer_value_sequence
(
valu
e_range
):
"""Data type of a sequence of integer.
"""Data type of a sequence of integer.
:param
el
e_range: range of each element.
:param
valu
e_range: range of each element.
"""
"""
return
integer_value
(
el
e_range
,
seq_type
=
SequenceType
.
SEQUENCE
)
return
integer_value
(
valu
e_range
,
seq_type
=
SequenceType
.
SEQUENCE
)
def
integer_value_sub_sequence
(
dim
):
def
integer_value_sub_sequence
(
dim
):
...
...
python/paddle/v2/tests/test_data_feeder.py
浏览文件 @
e87181db
...
@@ -110,14 +110,14 @@ class DataFeederTest(unittest.TestCase):
...
@@ -110,14 +110,14 @@ class DataFeederTest(unittest.TestCase):
self
.
assertAlmostEqual
(
value
.
all
(),
w
[
i
].
all
())
self
.
assertAlmostEqual
(
value
.
all
(),
w
[
i
].
all
())
def
test_integer
(
self
):
def
test_integer
(
self
):
el
e_range
=
100
valu
e_range
=
100
batch_size
=
32
batch_size
=
32
index
=
[]
index
=
[]
for
i
in
xrange
(
batch_size
):
for
i
in
xrange
(
batch_size
):
each_sample
=
[]
each_sample
=
[]
each_sample
.
append
(
np
.
random
.
randint
(
el
e_range
))
each_sample
.
append
(
np
.
random
.
randint
(
valu
e_range
))
index
.
append
(
each_sample
)
index
.
append
(
each_sample
)
feeder
=
DataFeeder
([(
'input'
,
data_type
.
integer_value
(
el
e_range
))],
feeder
=
DataFeeder
([(
'input'
,
data_type
.
integer_value
(
valu
e_range
))],
{
'input'
:
0
})
{
'input'
:
0
})
arg
=
feeder
(
index
)
arg
=
feeder
(
index
)
output
=
arg
.
getSlotIds
(
0
).
copyToNumpyArray
()
output
=
arg
.
getSlotIds
(
0
).
copyToNumpyArray
()
...
@@ -125,7 +125,7 @@ class DataFeederTest(unittest.TestCase):
...
@@ -125,7 +125,7 @@ class DataFeederTest(unittest.TestCase):
self
.
assertEqual
(
output
.
all
(),
index
.
flatten
().
all
())
self
.
assertEqual
(
output
.
all
(),
index
.
flatten
().
all
())
def
test_integer_sequence
(
self
):
def
test_integer_sequence
(
self
):
el
e_range
=
10000
valu
e_range
=
10000
batch_size
=
32
batch_size
=
32
start
=
[
0
]
start
=
[
0
]
data
=
[]
data
=
[]
...
@@ -133,11 +133,11 @@ class DataFeederTest(unittest.TestCase):
...
@@ -133,11 +133,11 @@ class DataFeederTest(unittest.TestCase):
each_sample
=
[]
each_sample
=
[]
each_sample
.
append
(
each_sample
.
append
(
self
.
sparse_binary_reader
(
self
.
sparse_binary_reader
(
el
e_range
,
30
,
non_empty
=
True
))
valu
e_range
,
30
,
non_empty
=
True
))
data
.
append
(
each_sample
)
data
.
append
(
each_sample
)
start
.
append
(
len
(
each_sample
[
0
])
+
start
[
-
1
])
start
.
append
(
len
(
each_sample
[
0
])
+
start
[
-
1
])
feeder
=
DataFeeder
(
feeder
=
DataFeeder
(
[(
'input'
,
data_type
.
integer_value_sequence
(
el
e_range
))],
[(
'input'
,
data_type
.
integer_value_sequence
(
valu
e_range
))],
{
'input'
:
0
})
{
'input'
:
0
})
arg
=
feeder
(
data
)
arg
=
feeder
(
data
)
output_data
=
arg
.
getSlotIds
(
0
).
copyToNumpyArray
()
output_data
=
arg
.
getSlotIds
(
0
).
copyToNumpyArray
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录