Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9c687a97
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9c687a97
编写于
6月 01, 2018
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'ups/develop' into nlp
上级
7e9f0790
9503dbb1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
11 addition
and
6 deletion
+11
-6
paddle/fluid/inference/tensorrt/convert/fc_op.cc
paddle/fluid/inference/tensorrt/convert/fc_op.cc
+1
-1
paddle/fluid/inference/tensorrt/convert/op_converter.h
paddle/fluid/inference/tensorrt/convert/op_converter.h
+1
-1
paddle/fluid/platform/profiler.cc
paddle/fluid/platform/profiler.cc
+1
-0
python/paddle/batch.py
python/paddle/batch.py
+4
-2
python/paddle/v2/minibatch.py
python/paddle/v2/minibatch.py
+4
-2
未找到文件。
paddle/fluid/inference/tensorrt/convert/fc_op.cc
浏览文件 @
9c687a97
...
@@ -59,7 +59,7 @@ class FcOpConverter : public OpConverter {
...
@@ -59,7 +59,7 @@ class FcOpConverter : public OpConverter {
const
framework
::
Scope
&
scope
)
override
{
const
framework
::
Scope
&
scope
)
override
{
VLOG
(
4
)
<<
"convert a fluid fc op to tensorrt fc layer without bias"
;
VLOG
(
4
)
<<
"convert a fluid fc op to tensorrt fc layer without bias"
;
framework
::
OpDesc
op_desc
(
op
,
nullptr
,
nullptr
);
framework
::
OpDesc
op_desc
(
op
,
nullptr
);
PADDLE_ENFORCE_EQ
(
op_desc
.
Input
(
"X"
).
size
(),
1
);
PADDLE_ENFORCE_EQ
(
op_desc
.
Input
(
"X"
).
size
(),
1
);
PADDLE_ENFORCE_EQ
(
op_desc
.
Input
(
"Y"
).
size
(),
1
);
// Y is a weight
PADDLE_ENFORCE_EQ
(
op_desc
.
Input
(
"Y"
).
size
(),
1
);
// Y is a weight
PADDLE_ENFORCE_EQ
(
op_desc
.
Output
(
"Out"
).
size
(),
1
);
PADDLE_ENFORCE_EQ
(
op_desc
.
Output
(
"Out"
).
size
(),
1
);
...
...
paddle/fluid/inference/tensorrt/convert/op_converter.h
浏览文件 @
9c687a97
...
@@ -40,7 +40,7 @@ class OpConverter {
...
@@ -40,7 +40,7 @@ class OpConverter {
void
ConvertOp
(
const
framework
::
proto
::
OpDesc
&
op
,
void
ConvertOp
(
const
framework
::
proto
::
OpDesc
&
op
,
const
std
::
unordered_set
<
std
::
string
>&
parameters
,
const
std
::
unordered_set
<
std
::
string
>&
parameters
,
const
framework
::
Scope
&
scope
,
TensorRTEngine
*
engine
)
{
const
framework
::
Scope
&
scope
,
TensorRTEngine
*
engine
)
{
framework
::
OpDesc
op_desc
(
op
,
nullptr
,
nullptr
);
framework
::
OpDesc
op_desc
(
op
,
nullptr
);
OpConverter
*
it
{
nullptr
};
OpConverter
*
it
{
nullptr
};
...
...
paddle/fluid/platform/profiler.cc
浏览文件 @
9c687a97
...
@@ -127,6 +127,7 @@ double Event::CpuElapsedMs(const Event& e) const {
...
@@ -127,6 +127,7 @@ double Event::CpuElapsedMs(const Event& e) const {
double
Event
::
CudaElapsedMs
(
const
Event
&
e
)
const
{
double
Event
::
CudaElapsedMs
(
const
Event
&
e
)
const
{
#ifdef PADDLE_WITH_CUDA
#ifdef PADDLE_WITH_CUDA
if
(
!
has_cuda_
)
return
0.0
;
PADDLE_ENFORCE
(
e
.
has_cuda
()
&&
has_cuda
());
PADDLE_ENFORCE
(
e
.
has_cuda
()
&&
has_cuda
());
PADDLE_ENFORCE
(
e
.
device
()
==
device
());
PADDLE_ENFORCE
(
e
.
device
()
==
device
());
PADDLE_ENFORCE
(
cudaEventSynchronize
(
event_
));
PADDLE_ENFORCE
(
cudaEventSynchronize
(
event_
));
...
...
python/paddle/batch.py
浏览文件 @
9c687a97
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
__all__
=
[
'batch'
]
__all__
=
[
'batch'
]
def
batch
(
reader
,
batch_size
):
def
batch
(
reader
,
batch_size
,
drop_last
=
False
):
"""
"""
Create a batched reader.
Create a batched reader.
...
@@ -23,6 +23,8 @@ def batch(reader, batch_size):
...
@@ -23,6 +23,8 @@ def batch(reader, batch_size):
:type reader: callable
:type reader: callable
:param batch_size: size of each mini-batch
:param batch_size: size of each mini-batch
:type batch_size: int
:type batch_size: int
:param drop_last: drop the last batch, if the size of last batch is not equal to batch_size.
:type drop_last: bool
:return: the batched reader.
:return: the batched reader.
:rtype: callable
:rtype: callable
"""
"""
...
@@ -35,7 +37,7 @@ def batch(reader, batch_size):
...
@@ -35,7 +37,7 @@ def batch(reader, batch_size):
if
len
(
b
)
==
batch_size
:
if
len
(
b
)
==
batch_size
:
yield
b
yield
b
b
=
[]
b
=
[]
if
b
:
if
drop_last
==
False
and
len
(
b
)
!=
0
:
yield
b
yield
b
return
batch_reader
return
batch_reader
python/paddle/v2/minibatch.py
浏览文件 @
9c687a97
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
__all__
=
[
'batch'
]
__all__
=
[
'batch'
]
def
batch
(
reader
,
batch_size
):
def
batch
(
reader
,
batch_size
,
drop_last
=
False
):
"""
"""
Create a batched reader.
Create a batched reader.
...
@@ -23,6 +23,8 @@ def batch(reader, batch_size):
...
@@ -23,6 +23,8 @@ def batch(reader, batch_size):
:type reader: callable
:type reader: callable
:param batch_size: size of each mini-batch
:param batch_size: size of each mini-batch
:type batch_size: int
:type batch_size: int
:param drop_last: drop the last batch, if the size of last batch is not equal to batch_size.
:type drop_last: bool
:return: the batched reader.
:return: the batched reader.
:rtype: callable
:rtype: callable
"""
"""
...
@@ -35,7 +37,7 @@ def batch(reader, batch_size):
...
@@ -35,7 +37,7 @@ def batch(reader, batch_size):
if
len
(
b
)
==
batch_size
:
if
len
(
b
)
==
batch_size
:
yield
b
yield
b
b
=
[]
b
=
[]
if
b
:
if
drop_last
==
False
and
len
(
b
)
!=
0
:
yield
b
yield
b
return
batch_reader
return
batch_reader
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录