Skip to content

Commit cb7ca1c

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into Add_conv3d_Python_API
2 parents 9b13b4c + d07d953 commit cb7ca1c

File tree

68 files changed

+2542
-588
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2542
-588
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ option(EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF)
6161
option(WITH_ARM_FP16 "Use half precision support on armv8.2-a cpu" OFF)
6262
option(WITH_FAST_BUNDLE_TEST "Bundle tests that can be run in a single process together to reduce launch overhead" OFF)
6363
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
64+
option(WITH_ANAKIN "Compile with Anakin library" OFF)
6465
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
6566

6667
# CMAKE_BUILD_TYPE
@@ -193,7 +194,10 @@ set(EXTERNAL_LIBS
193194
if(WITH_GPU)
194195
include(cuda)
195196
include(tensorrt)
196-
endif(WITH_GPU)
197+
include(external/anakin)
198+
else()
199+
set(WITH_ANAKIN OFF CACHE STRING "Anakin is valid only when GPU is set." FORCE)
200+
endif()
197201

198202
if(WITH_AMD_GPU)
199203
find_package(HIP)

benchmark/fluid/fluid_benchmark.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def train(avg_loss, infer_prog, optimizer, train_reader, test_reader, batch_acc,
180180
print_train_time(start_time, time.time(), num_samples)
181181
print("Pass: %d, Loss: %f" % (pass_id, np.mean(train_losses))),
182182
# evaluation
183-
if not args.no_test and batch_acc:
183+
if not args.no_test and batch_acc and not args.use_reader_op:
184184
pass_test_acc = test(exe, infer_prog, test_reader, feeder,
185185
batch_acc)
186186
print(", Test Accuracy: %f" % pass_test_acc)
@@ -277,11 +277,12 @@ def train_parallel(avg_loss, infer_prog, optimizer, train_reader, test_reader,
277277
batch_id += 1
278278

279279
print_train_time(start_time, time.time(), num_samples)
280-
if not args.no_test and batch_acc:
280+
if not args.no_test and batch_acc and not args.use_reader_op:
281+
# we have not implement record io for test
282+
# skip test when use args.use_reader_op
281283
test_acc = test(startup_exe, infer_prog, test_reader, feeder,
282284
batch_acc)
283285
print("Pass: %d, Test Accuracy: %f\n" % (pass_id, test_acc))
284-
exit(0)
285286

286287

287288
def print_arguments(args):

benchmark/fluid/models/resnet.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ def get_model(args):
199199
batched_train_reader = paddle.batch(
200200
paddle.reader.shuffle(
201201
train_reader, buf_size=5120),
202-
batch_size=args.batch_size * args.gpus)
203-
batched_test_reader = paddle.batch(train_reader, batch_size=args.batch_size)
202+
batch_size=args.batch_size * args.gpus,
203+
drop_last=True)
204+
batched_test_reader = paddle.batch(
205+
train_reader, batch_size=args.batch_size, drop_last=True)
204206

205-
return avg_cost, inference_program, optimizer, batched_train_reader, batched_test_reader, batch_acc
207+
return avg_cost, inference_program, optimizer, batched_train_reader,\
208+
batched_test_reader, batch_acc

cmake/external/anakin.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
if (NOT WITH_ANAKIN)
2+
return()
3+
endif()
4+
5+
set(ANAKIN_INSTALL_DIR "${THIRD_PARTY_PATH}/install/anakin" CACHE PATH
6+
"Anakin install path." FORCE)
7+
set(ANAKIN_INCLUDE "${ANAKIN_INSTALL_DIR}" CACHE STRING "root of Anakin header files")
8+
set(ANAKIN_LIBRARY "${ANAKIN_INSTALL_DIR}" CACHE STRING "path of Anakin library")
9+
10+
set(ANAKIN_COMPILE_EXTRA_FLAGS -Wno-error=unused-variable -Wno-error=format-extra-args -Wno-error=comment -Wno-error=format -Wno-error=switch -Wno-error=return-type -Wno-error=non-virtual-dtor -Wno-reorder -Wno-error=cpp)
11+
12+
set(ANAKIN_LIBRARY_URL "https://github.com/pangge/Anakin/releases/download/3.0/anakin_release_simple.tar.gz")
13+
14+
# A helper function used in Anakin, currently, to use it, one need to recursively include
15+
# nearly all the header files.
16+
function(fetch_include_recursively root_dir)
17+
if (IS_DIRECTORY ${root_dir})
18+
include_directories(${root_dir})
19+
endif()
20+
21+
file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*)
22+
foreach(sub ${ALL_SUB})
23+
if (IS_DIRECTORY ${root_dir}/${sub})
24+
fetch_include_recursively(${root_dir}/${sub})
25+
endif()
26+
endforeach()
27+
endfunction()
28+
29+
# download library
30+
message(STATUS "Download Anakin library from ${ANAKIN_LIBRARY_URL}")
31+
execute_process(COMMAND bash -c "mkdir -p ${ANAKIN_INSTALL_DIR}")
32+
execute_process(COMMAND bash -c "rm -rf ${ANAKIN_INSTALL_DIR}/*")
33+
execute_process(COMMAND bash -c "cd ${ANAKIN_INSTALL_DIR}; wget -q ${ANAKIN_LIBRARY_URL}")
34+
execute_process(COMMAND bash -c "mkdir -p ${ANAKIN_INSTALL_DIR}")
35+
execute_process(COMMAND bash -c "cd ${ANAKIN_INSTALL_DIR}; tar xzf anakin_release_simple.tar.gz")
36+
37+
if (WITH_ANAKIN)
38+
message(STATUS "Anakin for inference is enabled")
39+
message(STATUS "Anakin is set INCLUDE:${ANAKIN_INCLUDE} LIBRARY:${ANAKIN_LIBRARY}")
40+
fetch_include_recursively(${ANAKIN_INCLUDE})
41+
link_directories(${ANAKIN_LIBRARY})
42+
endif()

doc/fluid/api/detection.rst

Whitespace-only changes.

doc/fluid/api/gen_doc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
python gen_doc.py layers --submodules control_flow device io nn ops tensor > layers.rst
2+
python gen_doc.py layers --submodules control_flow device io nn ops tensor detection learning_rate_scheduler > layers.rst
33

44
for module in data_feeder clip metrics executor initializer io nets optimizer param_attr profiler regularizer
55
do

doc/fluid/api/io.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,3 @@ get_inference_program
5959
.. autofunction:: paddle.fluid.io.get_inference_program
6060
:noindex:
6161

62-
save_checkpoint
63-
---------------
64-
65-
.. autofunction:: paddle.fluid.io.save_checkpoint
66-
:noindex:
67-
68-
load_checkpoint
69-
---------------
70-
71-
.. autofunction:: paddle.fluid.io.load_checkpoint
72-
:noindex:
73-
74-
clean_checkpoint
75-
----------------
76-
77-
.. autofunction:: paddle.fluid.io.clean_checkpoint
78-
:noindex:
79-

doc/fluid/api/layers.rst

Lines changed: 90 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ Print
181181
.. autofunction:: paddle.fluid.layers.Print
182182
:noindex:
183183

184-
is_empty
185-
--------
186-
187-
.. autofunction:: paddle.fluid.layers.is_empty
188-
:noindex:
189-
190184
device
191185
======
192186

@@ -261,19 +255,6 @@ double_buffer
261255
.. autofunction:: paddle.fluid.layers.double_buffer
262256
:noindex:
263257

264-
random_data_generator
265-
---------------------
266-
267-
.. autofunction:: paddle.fluid.layers.random_data_generator
268-
:noindex:
269-
270-
Preprocessor
271-
------------
272-
273-
.. autoclass:: paddle.fluid.layers.Preprocessor
274-
:members:
275-
:noindex:
276-
277258
nn
278259
==
279260

@@ -632,30 +613,6 @@ roi_pool
632613
.. autofunction:: paddle.fluid.layers.roi_pool
633614
:noindex:
634615

635-
dice_loss
636-
---------
637-
638-
.. autofunction:: paddle.fluid.layers.dice_loss
639-
:noindex:
640-
641-
resize_bilinear
642-
---------------
643-
644-
.. autofunction:: paddle.fluid.layers.resize_bilinear
645-
:noindex:
646-
647-
gather
648-
------
649-
650-
.. autofunction:: paddle.fluid.layers.gather
651-
:noindex:
652-
653-
random_crop
654-
-----------
655-
656-
.. autofunction:: paddle.fluid.layers.random_crop
657-
:noindex:
658-
659616
ops
660617
===
661618

@@ -803,12 +760,6 @@ sum
803760
.. autofunction:: paddle.fluid.layers.sum
804761
:noindex:
805762

806-
shape
807-
-----
808-
809-
.. autofunction:: paddle.fluid.layers.shape
810-
:noindex:
811-
812763
sigmoid
813764
-------
814765

@@ -1058,3 +1009,93 @@ zeros
10581009
.. autofunction:: paddle.fluid.layers.zeros
10591010
:noindex:
10601011

1012+
detection
1013+
=========
1014+
1015+
multi_box_head
1016+
--------------
1017+
1018+
.. autofunction:: paddle.fluid.layers.multi_box_head
1019+
:noindex:
1020+
1021+
bipartite_match
1022+
---------------
1023+
1024+
.. autofunction:: paddle.fluid.layers.bipartite_match
1025+
:noindex:
1026+
1027+
target_assign
1028+
-------------
1029+
1030+
.. autofunction:: paddle.fluid.layers.target_assign
1031+
:noindex:
1032+
1033+
detection_output
1034+
----------------
1035+
1036+
.. autofunction:: paddle.fluid.layers.detection_output
1037+
:noindex:
1038+
1039+
ssd_loss
1040+
--------
1041+
1042+
.. autofunction:: paddle.fluid.layers.ssd_loss
1043+
:noindex:
1044+
1045+
detection_map
1046+
-------------
1047+
1048+
.. autofunction:: paddle.fluid.layers.detection_map
1049+
:noindex:
1050+
1051+
iou_similarity
1052+
--------------
1053+
1054+
.. autofunction:: paddle.fluid.layers.iou_similarity
1055+
:noindex:
1056+
1057+
box_coder
1058+
---------
1059+
1060+
.. autofunction:: paddle.fluid.layers.box_coder
1061+
:noindex:
1062+
1063+
learning_rate_scheduler
1064+
=======================
1065+
1066+
exponential_decay
1067+
-----------------
1068+
1069+
.. autofunction:: paddle.fluid.layers.exponential_decay
1070+
:noindex:
1071+
1072+
natural_exp_decay
1073+
-----------------
1074+
1075+
.. autofunction:: paddle.fluid.layers.natural_exp_decay
1076+
:noindex:
1077+
1078+
inverse_time_decay
1079+
------------------
1080+
1081+
.. autofunction:: paddle.fluid.layers.inverse_time_decay
1082+
:noindex:
1083+
1084+
polynomial_decay
1085+
----------------
1086+
1087+
.. autofunction:: paddle.fluid.layers.polynomial_decay
1088+
:noindex:
1089+
1090+
piecewise_decay
1091+
---------------
1092+
1093+
.. autofunction:: paddle.fluid.layers.piecewise_decay
1094+
:noindex:
1095+
1096+
noam_decay
1097+
----------
1098+
1099+
.. autofunction:: paddle.fluid.layers.noam_decay
1100+
:noindex:
1101+

doc/fluid/api/optimizer.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ DecayedAdagradOptimizer
8989
:members:
9090
:noindex:
9191

92-
RMSPropOptimizer
93-
----------------
94-
95-
.. autoclass:: paddle.fluid.optimizer.RMSPropOptimizer
96-
:members:
97-
:noindex:
98-
9992
Adadelta
10093
--------
10194

doc/fluid/api/profiler.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,3 @@ profiler
2323
.. autofunction:: paddle.fluid.profiler.profiler
2424
:noindex:
2525

26-
start_profiler
27-
--------------
28-
29-
.. autofunction:: paddle.fluid.profiler.start_profiler
30-
:noindex:
31-
32-
stop_profiler
33-
-------------
34-
35-
.. autofunction:: paddle.fluid.profiler.stop_profiler
36-
:noindex:
37-

0 commit comments

Comments
 (0)