Skip to content

Commit 3a25cee

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into update-api-reference-1
2 parents 2f9ed97 + 745ea4d commit 3a25cee

Some content is hidden

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

62 files changed

+2713
-348
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 |

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)

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()

cmake/external/openblas.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ IF(NOT ${CBLAS_FOUND})
2929
"${CBLAS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}openblas${CMAKE_STATIC_LIBRARY_SUFFIX}"
3030
CACHE FILEPATH "openblas library." FORCE)
3131

32+
ADD_DEFINITIONS(-DPADDLE_USE_OPENBLAS)
33+
3234
SET(OPENBLAS_CC "${CMAKE_C_COMPILER} -Wno-unused-but-set-variable -Wno-unused-variable")
3335
SET(OPENBLAS_COMMIT "v0.2.20")
3436

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/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 detection > 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/layers.rst

Lines changed: 58 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

@@ -1041,3 +1060,42 @@ box_coder
10411060
.. autofunction:: paddle.fluid.layers.box_coder
10421061
:noindex:
10431062

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/survey/dynamic_graph.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Pytorch chooses immediate evaluation. It avoids ever materializing a "forward gr
171171

172172
## What can fluid learn from them?
173173

174-
TBD
174+
Please refer to `paddle/contrib/dynamic/`.
175175

176176
# Appendix
177177

doc/v2/dev/contribute_to_paddle_cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ no changes added to commit (use "git add" and/or "git commit -a")
104104
➜ docker run -it -v $(pwd):/paddle paddle:latest-dev bash -c "cd /paddle/build && ctest"
105105
```
106106

107-
关于构建和测试的更多信息,请参见[这篇文档](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/getstarted/build_and_install/docker_install_cn.rst)
107+
关于构建和测试的更多信息,请参见[使用Docker安装运行](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/v2/build_and_install/docker_install_cn.rst)
108108

109109
## 提交(commit)
110110

paddle/contrib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
#
1515

1616
add_subdirectory(inference)
17+
add_subdirectory(tape)

0 commit comments

Comments
 (0)