Skip to content

Commit 45f18b0

Browse files
committed
Merge remote-tracking branch 'origin/develop' into doc/api1
2 parents 16a3d88 + e42e6ea commit 45f18b0

File tree

11 files changed

+575
-26
lines changed

11 files changed

+575
-26
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
| jczaja | Jacek Czaja |
2323
| JiayiFeng | Jia-Yi Feng |
2424
| kbinias | Krzysztof Binias |
25+
| kexinzhao | Ke-Xin Zhao |
2526
| kuke | Yi-Bing Liu |
2627
| lcy-seso | Ying Cao |
2728
| lipeng-unisound | Peng Li |

cmake/inference_lib.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function(copy TARGET)
3939
message(FATAL_ERROR "${TARGET} source numbers are not equal to destination numbers")
4040
endif()
4141
math(EXPR len "${copy_lib_SRCS_len} - 1")
42-
42+
4343
add_custom_target(${TARGET} DEPENDS ${copy_lib_DEPS})
4444
foreach(index RANGE ${len})
4545
list(GET copy_lib_SRCS ${index} src)
@@ -155,6 +155,15 @@ copy(inference_lib DEPS paddle_fluid_shared paddle_fluid
155155
DSTS ${dst_dir}/${module} ${dst_dir}/${module}
156156
)
157157

158+
if(WITH_CONTRIB)
159+
set(contrib_dst_dir "${FLUID_INSTALL_DIR}/contrib/inference")
160+
copy(contrib_inference_lib DEPS paddle_inference_api
161+
SRCS ${PADDLE_SOURCE_DIR}/paddle/contrib/inference/paddle_inference_api.h
162+
${PADDLE_BINARY_DIR}/paddle/contrib/inference/libpaddle_inference_api.*
163+
DSTS ${contrib_dst_dir} ${contrib_dst_dir}
164+
)
165+
endif()
166+
158167
set(module "platform")
159168
copy(platform_lib DEPS profiler_py_proto
160169
SRCS ${src_dir}/${module}/*.h ${src_dir}/${module}/dynload/*.h ${src_dir}/${module}/details/*.h

doc/fluid/api/layers.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ conv2d
342342
.. autofunction:: paddle.fluid.layers.conv2d
343343
:noindex:
344344

345+
conv3d
346+
------
347+
348+
.. autofunction:: paddle.fluid.layers.conv3d
349+
:noindex:
350+
345351
sequence_pool
346352
-------------
347353

@@ -366,6 +372,12 @@ pool2d
366372
.. autofunction:: paddle.fluid.layers.pool2d
367373
:noindex:
368374

375+
pool3d
376+
------
377+
378+
.. autofunction:: paddle.fluid.layers.pool3d
379+
:noindex:
380+
369381
batch_norm
370382
----------
371383

@@ -384,6 +396,13 @@ conv2d_transpose
384396
.. autofunction:: paddle.fluid.layers.conv2d_transpose
385397
:noindex:
386398

399+
conv3d_transpose
400+
----------------
401+
402+
.. autofunction:: paddle.fluid.layers.conv2d_transpose
403+
:noindex:
404+
405+
387406
sequence_expand
388407
---------------
389408

paddle/fluid/operators/concat_op.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ REGISTER_OPERATOR(concat, ops::ConcatOp, ops::ConcatOpMaker,
107107
false> /* set false to disable empty grad */);
108108
REGISTER_OPERATOR(concat_grad, ops::ConcatOpGrad);
109109
REGISTER_OP_CPU_KERNEL(
110-
concat, ops::ConcatKernel<paddle::platform::CPUDeviceContext, float>);
110+
concat, ops::ConcatKernel<paddle::platform::CPUDeviceContext, double>,
111+
ops::ConcatKernel<paddle::platform::CPUDeviceContext, float>,
112+
ops::ConcatKernel<paddle::platform::CPUDeviceContext, int64_t>,
113+
ops::ConcatKernel<paddle::platform::CPUDeviceContext, int>);
111114
REGISTER_OP_CPU_KERNEL(
112115
concat_grad,
113-
ops::ConcatGradKernel<paddle::platform::CPUDeviceContext, float>);
116+
ops::ConcatGradKernel<paddle::platform::CPUDeviceContext, double>,
117+
ops::ConcatGradKernel<paddle::platform::CPUDeviceContext, float>,
118+
ops::ConcatGradKernel<paddle::platform::CPUDeviceContext, int64_t>,
119+
ops::ConcatGradKernel<paddle::platform::CPUDeviceContext, int>);

paddle/fluid/operators/concat_op.cu.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ limitations under the License. */
1515
#include "paddle/fluid/operators/concat_op.h"
1616
namespace ops = paddle::operators;
1717
REGISTER_OP_CUDA_KERNEL(
18-
concat, ops::ConcatKernel<paddle::platform::CUDADeviceContext, float>);
18+
concat, ops::ConcatKernel<paddle::platform::CUDADeviceContext, double>,
19+
ops::ConcatKernel<paddle::platform::CUDADeviceContext, float>,
20+
ops::ConcatKernel<paddle::platform::CUDADeviceContext, int64_t>,
21+
ops::ConcatKernel<paddle::platform::CUDADeviceContext, int>);
1922
REGISTER_OP_CUDA_KERNEL(
2023
concat_grad,
21-
ops::ConcatGradKernel<paddle::platform::CUDADeviceContext, float>);
24+
ops::ConcatGradKernel<paddle::platform::CUDADeviceContext, double>,
25+
ops::ConcatGradKernel<paddle::platform::CUDADeviceContext, float>,
26+
ops::ConcatGradKernel<paddle::platform::CUDADeviceContext, int64_t>,
27+
ops::ConcatGradKernel<paddle::platform::CUDADeviceContext, int>);

paddle/fluid/operators/get_places_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class GetPlacesOpProtoMaker : public framework::OpProtoAndCheckerMaker {
8585
.InEnum({"CUDA", "CPU", "AUTO"})
8686
.SetDefault("AUTO");
8787
AddComment(R"DOC(
88-
Returns a list of places based on flags. The list will be used for parallel
88+
Returns a list of places based on arguments. The list will be used for parallel
8989
execution.
9090
)DOC");
9191
}

paddle/fluid/operators/split_op.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,7 @@ USE_CPU_ONLY_OP(concat);
115115

116116
REGISTER_OPERATOR(split, ops::SplitOp, ops::SplitOpMaker, ops::SplitGradMaker);
117117
REGISTER_OP_CPU_KERNEL(split,
118-
ops::SplitOpKernel<paddle::platform::CPUPlace, float>);
118+
ops::SplitOpKernel<paddle::platform::CPUPlace, double>,
119+
ops::SplitOpKernel<paddle::platform::CPUPlace, float>,
120+
ops::SplitOpKernel<paddle::platform::CPUPlace, int64_t>,
121+
ops::SplitOpKernel<paddle::platform::CPUPlace, int>);

paddle/fluid/operators/split_op.cu.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ limitations under the License. */
1515
#include "paddle/fluid/operators/split_op.h"
1616
namespace ops = paddle::operators;
1717
REGISTER_OP_CUDA_KERNEL(
18-
split, ops::SplitOpKernel<paddle::platform::CUDADeviceContext, float>);
18+
split, ops::SplitOpKernel<paddle::platform::CUDADeviceContext, double>,
19+
ops::SplitOpKernel<paddle::platform::CUDADeviceContext, float>,
20+
ops::SplitOpKernel<paddle::platform::CUDADeviceContext, int64_t>,
21+
ops::SplitOpKernel<paddle::platform::CUDADeviceContext, int>);

python/paddle/fluid/layers/control_flow.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,34 @@ def __exit__(self, exc_type, exc_val, exc_tb):
12101210

12111211

12121212
class IfElse(object):
1213+
"""
1214+
if-else control flow.
1215+
1216+
Args:
1217+
cond (Variable): condition used to compare.
1218+
name (str, default None): The name of this layer.
1219+
1220+
Examples:
1221+
.. code-block:: python
1222+
1223+
limit = fluid.layers.fill_constant_batch_size_like(
1224+
input=label, dtype='int64', shape=[1], value=5.0)
1225+
cond = fluid.layers.less_than(x=label, y=limit)
1226+
ie = fluid.layers.IfElse(cond)
1227+
with ie.true_block():
1228+
true_image = ie.input(image)
1229+
hidden = fluid.layers.fc(input=true_image, size=100, act='tanh')
1230+
prob = fluid.layers.fc(input=hidden, size=10, act='softmax')
1231+
ie.output(prob)
1232+
1233+
with ie.false_block():
1234+
false_image = ie.input(image)
1235+
hidden = fluid.layers.fc(
1236+
input=false_image, size=200, act='tanh')
1237+
prob = fluid.layers.fc(input=hidden, size=10, act='softmax')
1238+
ie.output(prob)
1239+
prob = ie()
1240+
"""
12131241
OUT_IF_ELSE_BLOCKS = 0
12141242
IN_IF_ELSE_TRUE_BLOCKS = 1
12151243
IN_IF_ELSE_FALSE_BLOCKS = 2

python/paddle/fluid/layers/io.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,26 @@ def read_file(file_obj):
587587

588588

589589
class Preprocessor(object):
590+
"""
591+
A block for data pre-processing in reader.
592+
593+
Args:
594+
reader (Variable): A reader variable.
595+
name (str, default None): The name of the reader.
596+
597+
Examples:
598+
.. code-block:: python
599+
600+
preprocessor = fluid.layers.io.Preprocessor(reader=reader)
601+
with preprocessor.block():
602+
img, lbl = preprocessor.inputs()
603+
img_out = img / 2
604+
lbl_out = lbl + 1
605+
preprocessor.outputs(img_out, lbl_out)
606+
607+
data_file = fluid.layers.io.double_buffer(preprocessor())
608+
609+
"""
590610
BEFORE_SUB_BLOCK = 0
591611
IN_SUB_BLOCK = 1
592612
AFTER_SUB_BLOCK = 2

0 commit comments

Comments
 (0)