Skip to content

Commit 5dbb71b

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into add-program-cache-for-executor
2 parents 0d70231 + 5b63568 commit 5dbb71b

File tree

8 files changed

+152
-25
lines changed

8 files changed

+152
-25
lines changed

doc/build_and_install/index_cn.rst

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,54 @@
33

44
.. _install_steps:
55

6-
安装流程
7-
++++++++
6+
PaddlePaddle针对不同的用户群体提供了多种安装方式。
87

9-
PaddlePaddle提供pip和Docker的安装方式:
8+
专注深度学习模型开发
9+
-----------------
10+
11+
PaddlePaddle提供了多种python wheel包,可通过pip一键安装:
12+
13+
.. toctree::
14+
:maxdepth: 1
15+
16+
pip_install_cn.rst
17+
18+
这是最便捷的安装方式,请根据机器配置和系统选择对应的安装包。
19+
20+
关注底层框架
21+
----------
22+
23+
PaddlePaddle提供了基于Docker的安装方式,请参照以下教程:
1024

1125
.. toctree::
12-
:maxdepth: 1
26+
:maxdepth: 1
1327

14-
pip_install_cn.rst
15-
docker_install_cn.rst
28+
docker_install_cn.rst
1629

17-
编译流程
18-
++++++++
30+
我们推荐在Docker中运行PaddlePaddle,该方式具有以下优势:
1931

20-
.. warning::
32+
- 无需单独安装第三方依赖
33+
- 方便分享运行时环境,易于问题的复现
2134

22-
建议直接使用上述安装流程,方便快速安装。只有在遇到需要独立定制的二进制时才需要编译。
35+
对于有定制化二进制文件需求的用户,我们同样提供了从源码编译安装PaddlePaddle的方法:
2336

24-
.. toctree::
37+
.. toctree::
2538
:maxdepth: 1
2639

2740
build_from_source_cn.rst
2841

29-
常见问题解答
30-
++++++++++
42+
.. warning::
43+
44+
需要提醒的是,这种安装方式会涉及到一些第三方库的下载、编译及安装,整个安装过程耗时较长。
45+
46+
47+
常见问题汇总
48+
-----------
49+
50+
如果在安装过程中遇到了问题,请先尝试在下面的页面寻找答案:
51+
52+
:ref:`常见问题解答 <install_faq>`
53+
54+
如果问题没有得到解决,欢迎向PaddlePaddle社区反馈问题:
3155

32-
`常见问题解答 <http://www.paddlepaddle.org/docs/develop/documentation/zh/faq/build_and_install/index_cn.html>`_
56+
`创建issue <https://github.com/PaddlePaddle/Paddle/issues/new>`_

doc/faq/build_and_install/index_cn.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _install_faq:
2+
13
###################
24
编译安装与单元测试
35
###################

doc/howto/cmd_parameter/index_cn.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,25 @@
22

33
命令行参数设置
44
===============
5+
深度学习算法的实现有着多样化的特点,运行环境、运行阶段、模型结构、训练策略等等这些都是常见的变化因素。PaddlePaddle支持用户灵活地设置各种命令行参数,以实现对模型训练或预测流程的控制。
6+
7+
在这一部分,首先以几个实际场景为例,展示了部分命令行参数的使用:
58

69
.. toctree::
710
:maxdepth: 1
811

912
use_case_cn.md
13+
14+
接着对所有参数的使用场合进行概述和分类:
15+
16+
.. toctree::
17+
:maxdepth: 1
18+
1019
arguments_cn.md
20+
21+
最后给出细节描述,详细解释这些参数的属性和意义:
22+
23+
.. toctree::
24+
:maxdepth: 1
25+
1126
detail_introduction_cn.md

paddle/fluid/framework/dim.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ HOSTDEVICE int64_t& indexer<0>(Dim<0>& dim, int idx) {
157157
throw std::invalid_argument("Invalid index");
158158
#else
159159
PADDLE_ASSERT(false);
160-
#endif
161-
#if (defined __CUDA_ARCH__) && (CUDA_VERSION < 8000)
160+
#if CUDA_VERSION < 8000
162161
// On CUDA versions previous to 8.0, only __shared__ variables
163162
// could be declared as static in the device code.
164163
int64_t head = 0;
165164
#else
166165
static int64_t head = 0;
167166
#endif
168167
return head;
168+
#endif
169169
}
170170

171171
template <int D>
@@ -189,15 +189,15 @@ HOSTDEVICE int64_t indexer<0>(const Dim<0>& dim, int idx) {
189189
throw std::invalid_argument("Invalid index");
190190
#else
191191
PADDLE_ASSERT(false);
192-
#endif
193-
#if (defined __CUDA_ARCH__) && (CUDA_VERSION < 8000)
192+
#if CUDA_VERSION < 8000
194193
// On CUDA versions previous to 8.0, only __shared__ variables
195194
// could be declared as static in the device code.
196195
int64_t head = 0;
197196
#else
198197
static int64_t head = 0;
199198
#endif
200199
return head;
200+
#endif
201201
}
202202

203203
} // namespace

paddle/fluid/operators/mine_hard_examples_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class MineHardExamplesOp : public framework::OperatorWithKernel {
247247
const framework::ExecutionContext& ctx) const override {
248248
return framework::OpKernelType(
249249
framework::ToDataType(ctx.Input<framework::Tensor>("ClsLoss")->type()),
250-
ctx.device_context());
250+
platform::CPUPlace());
251251
}
252252
};
253253

python/paddle/fluid/layers/detection.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,17 @@ def detection_output(loc,
5454
score_threshold=0.01,
5555
nms_eta=1.0):
5656
"""
57-
**Detection Output Layer**
57+
**Detection Output Layer for Single Shot Multibox Detector (SSD).**
5858
59-
This layer applies the NMS to the output of network and computes the
60-
predict bounding box location. The output's shape of this layer could
61-
be zero if there is no valid bounding box.
59+
This operation is to get the detection results by performing following
60+
two steps:
61+
62+
1. Decode input bounding box predictions according to the prior boxes.
63+
2. Get the final detection results by applying multi-class non maximum
64+
suppression (NMS).
65+
66+
Please note, this operation doesn't clip the final output bounding boxes
67+
to the image window.
6268
6369
Args:
6470
loc(Variable): A 3-D Tensor with shape [N, M, 4] represents the
@@ -91,7 +97,15 @@ class number, M is number of bounding boxes. For each category
9197
nms_eta(float): The parameter for adaptive NMS.
9298
9399
Returns:
94-
The detected bounding boxes which are a Tensor.
100+
Variable: The detection outputs is a LoDTensor with shape [No, 6].
101+
Each row has six values: [label, confidence, xmin, ymin, xmax, ymax].
102+
`No` is the total number of detections in this mini-batch. For each
103+
instance, the offsets in first dimension are called LoD, the offset
104+
number is N + 1, N is the batch size. The i-th image has
105+
`LoD[i + 1] - LoD[i]` detected results, if it is 0, the i-th image
106+
has no detected results. If all images have not detected results,
107+
all the elements in LoD are 0, and output tensor only contains one
108+
value, which is -1.
95109
96110
Examples:
97111
.. code-block:: python

python/paddle/fluid/layers/nn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3206,7 +3206,7 @@ def one_hot(input, depth):
32063206
operator.
32073207
32083208
Args:
3209-
input(Tensor/LodTensor): A Tensor/LodTensor of indices, last dimension must be 1.
3209+
input(variable): A Tensor/LodTensor of indices, last dimension must be 1.
32103210
depth(scalar): an interger defining the depth of the one hot dimension.
32113211
32123212
Returns:

python/paddle/fluid/layers/tensor.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,75 @@ def zeros(shape, dtype, force_cpu=False):
362362
data = fluid.layers.zeros(shape=[1], dtype='int64')
363363
"""
364364
return fill_constant(value=0.0, **locals())
365+
366+
367+
def save(x, file_path, overwrite=True):
368+
"""
369+
Saves a variable as a file.
370+
371+
Args:
372+
x(variable): The Tensor/LoDTensor to be saved.
373+
file_path(str): The file path where the variable will be saved.
374+
overwrite(bool): Whether or not cover the given file when it has already
375+
existed. If it's set 'False' and the file is existed, a runtime
376+
error will be thrown.
377+
"""
378+
helper = LayerHelper("save", **locals())
379+
helper.append_op(
380+
type="save",
381+
inputs={"input": x},
382+
outputs={},
383+
args={"file_path": file_path,
384+
"overwrite": overwrite})
385+
386+
387+
def save_combine(x, file_path, overwrite=True):
388+
"""
389+
Saves a list of variables into a single file.
390+
391+
Args:
392+
x(list): A list of Tensor/LoDTensor to be saved together in a single file.
393+
file_path(str): The file path where variables will be saved.
394+
overwrite(bool): Whether or not cover the given file when it has already
395+
existed. If it's set 'False' and the file is existed, a runtime
396+
error will be thrown.
397+
"""
398+
helper = LayerHelper("save_combine", **locals())
399+
helper.append_op(
400+
type="save_combine",
401+
inputs={"input": x},
402+
outputs={},
403+
args={"file_path": file_path,
404+
"overwrite": overwrite})
405+
406+
407+
def load(out, file_path):
408+
"""
409+
Loads a variable from a given file.
410+
411+
Args:
412+
out(variable): The variable to be read from the disk file.
413+
file_path(str): The path of the disk file.
414+
"""
415+
helper = LayerHelper("load", **locals())
416+
helper.append_op(
417+
type="load",
418+
inputs={},
419+
output={"Out": out},
420+
args={"file_path": file_path})
421+
422+
423+
def load_combine(out, file_path):
424+
"""
425+
Loads a list of vairables from a single file.
426+
427+
Args:
428+
out(list): The list of variables to be read from the disk file.
429+
file_path(str): The path of the disk file.
430+
"""
431+
helper = LayerHelper("load_combine", **locals())
432+
helper.append_op(
433+
type="load_combine",
434+
inputs={},
435+
output={"Out": out},
436+
args={"file_path": file_path})

0 commit comments

Comments
 (0)