Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Browse files Browse the repository at this point in the history
… argmin_argmax
  • Loading branch information
sneaxiy committed Jun 14, 2018
2 parents e0f883e + 9169b3b commit fa002cd
Show file tree
Hide file tree
Showing 94 changed files with 3,134 additions and 934 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ option(EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF)
option(WITH_ARM_FP16 "Use half precision support on armv8.2-a cpu" OFF)
option(WITH_FAST_BUNDLE_TEST "Bundle tests that can be run in a single process together to reduce launch overhead" OFF)
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
option(WITH_ANAKIN "Compile with Anakin library" OFF)
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})

# CMAKE_BUILD_TYPE
Expand Down Expand Up @@ -193,7 +194,10 @@ set(EXTERNAL_LIBS
if(WITH_GPU)
include(cuda)
include(tensorrt)
endif(WITH_GPU)
include(external/anakin)
else()
set(WITH_ANAKIN OFF CACHE STRING "Anakin is valid only when GPU is set." FORCE)
endif()

if(WITH_AMD_GPU)
find_package(HIP)
Expand Down
7 changes: 4 additions & 3 deletions benchmark/fluid/fluid_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def train(avg_loss, infer_prog, optimizer, train_reader, test_reader, batch_acc,
print_train_time(start_time, time.time(), num_samples)
print("Pass: %d, Loss: %f" % (pass_id, np.mean(train_losses))),
# evaluation
if not args.no_test and batch_acc:
if not args.no_test and batch_acc and not args.use_reader_op:
pass_test_acc = test(exe, infer_prog, test_reader, feeder,
batch_acc)
print(", Test Accuracy: %f" % pass_test_acc)
Expand Down Expand Up @@ -285,11 +285,12 @@ def train_parallel(avg_loss, infer_prog, optimizer, train_reader, test_reader,
batch_id += 1

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


def print_arguments(args):
Expand Down
9 changes: 6 additions & 3 deletions benchmark/fluid/models/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ def get_model(args):
batched_train_reader = paddle.batch(
paddle.reader.shuffle(
train_reader, buf_size=5120),
batch_size=args.batch_size * args.gpus)
batched_test_reader = paddle.batch(train_reader, batch_size=args.batch_size)
batch_size=args.batch_size * args.gpus,
drop_last=True)
batched_test_reader = paddle.batch(
train_reader, batch_size=args.batch_size, drop_last=True)

return avg_cost, inference_program, optimizer, batched_train_reader, batched_test_reader, batch_acc
return avg_cost, inference_program, optimizer, batched_train_reader,\
batched_test_reader, batch_acc
4 changes: 4 additions & 0 deletions cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SIMD_FLAG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_FLAG}")

if(WITH_DISTRIBUTE)
add_definitions(-DPADDLE_WITH_DISTRIBUTE)
endif()

if(WITH_GOLANG)
# we need to symlink Paddle directory into GOPATH. If we
# don't do it and we have code that depends on Paddle, go
Expand Down
42 changes: 42 additions & 0 deletions cmake/external/anakin.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
if (NOT WITH_ANAKIN)
return()
endif()

set(ANAKIN_INSTALL_DIR "${THIRD_PARTY_PATH}/install/anakin" CACHE PATH
"Anakin install path." FORCE)
set(ANAKIN_INCLUDE "${ANAKIN_INSTALL_DIR}" CACHE STRING "root of Anakin header files")
set(ANAKIN_LIBRARY "${ANAKIN_INSTALL_DIR}" CACHE STRING "path of Anakin library")

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)

set(ANAKIN_LIBRARY_URL "https://github.com/pangge/Anakin/releases/download/3.0/anakin_release_simple.tar.gz")

# A helper function used in Anakin, currently, to use it, one need to recursively include
# nearly all the header files.
function(fetch_include_recursively root_dir)
if (IS_DIRECTORY ${root_dir})
include_directories(${root_dir})
endif()

file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*)
foreach(sub ${ALL_SUB})
if (IS_DIRECTORY ${root_dir}/${sub})
fetch_include_recursively(${root_dir}/${sub})
endif()
endforeach()
endfunction()

# download library
message(STATUS "Download Anakin library from ${ANAKIN_LIBRARY_URL}")
execute_process(COMMAND bash -c "mkdir -p ${ANAKIN_INSTALL_DIR}")
execute_process(COMMAND bash -c "rm -rf ${ANAKIN_INSTALL_DIR}/*")
execute_process(COMMAND bash -c "cd ${ANAKIN_INSTALL_DIR}; wget -q ${ANAKIN_LIBRARY_URL}")
execute_process(COMMAND bash -c "mkdir -p ${ANAKIN_INSTALL_DIR}")
execute_process(COMMAND bash -c "cd ${ANAKIN_INSTALL_DIR}; tar xzf anakin_release_simple.tar.gz")

if (WITH_ANAKIN)
message(STATUS "Anakin for inference is enabled")
message(STATUS "Anakin is set INCLUDE:${ANAKIN_INCLUDE} LIBRARY:${ANAKIN_LIBRARY}")
fetch_include_recursively(${ANAKIN_INCLUDE})
link_directories(${ANAKIN_LIBRARY})
endif()
2 changes: 2 additions & 0 deletions cmake/external/openblas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ IF(NOT ${CBLAS_FOUND})
"${CBLAS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}openblas${CMAKE_STATIC_LIBRARY_SUFFIX}"
CACHE FILEPATH "openblas library." FORCE)

ADD_DEFINITIONS(-DPADDLE_USE_OPENBLAS)

SET(OPENBLAS_CC "${CMAKE_C_COMPILER} -Wno-unused-but-set-variable -Wno-unused-variable")
SET(OPENBLAS_COMMIT "v0.2.20")

Expand Down
Empty file added doc/fluid/api/detection.rst
Empty file.
2 changes: 1 addition & 1 deletion doc/fluid/api/gen_doc.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
python gen_doc.py layers --submodules control_flow device io nn ops tensor > layers.rst
python gen_doc.py layers --submodules control_flow device io nn ops tensor detection learning_rate_scheduler > layers.rst

for module in data_feeder clip metrics executor initializer io nets optimizer param_attr profiler regularizer
do
Expand Down
18 changes: 0 additions & 18 deletions doc/fluid/api/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,3 @@ get_inference_program
.. autofunction:: paddle.fluid.io.get_inference_program
:noindex:

save_checkpoint
---------------

.. autofunction:: paddle.fluid.io.save_checkpoint
:noindex:

load_checkpoint
---------------

.. autofunction:: paddle.fluid.io.load_checkpoint
:noindex:

clean_checkpoint
----------------

.. autofunction:: paddle.fluid.io.clean_checkpoint
:noindex:

139 changes: 90 additions & 49 deletions doc/fluid/api/layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ Print
.. autofunction:: paddle.fluid.layers.Print
:noindex:

is_empty
--------

.. autofunction:: paddle.fluid.layers.is_empty
:noindex:

device
======

Expand Down Expand Up @@ -261,19 +255,6 @@ double_buffer
.. autofunction:: paddle.fluid.layers.double_buffer
:noindex:

random_data_generator
---------------------

.. autofunction:: paddle.fluid.layers.random_data_generator
:noindex:

Preprocessor
------------

.. autoclass:: paddle.fluid.layers.Preprocessor
:members:
:noindex:

nn
==

Expand Down Expand Up @@ -613,30 +594,6 @@ roi_pool
.. autofunction:: paddle.fluid.layers.roi_pool
:noindex:

dice_loss
---------

.. autofunction:: paddle.fluid.layers.dice_loss
:noindex:

resize_bilinear
---------------

.. autofunction:: paddle.fluid.layers.resize_bilinear
:noindex:

gather
------

.. autofunction:: paddle.fluid.layers.gather
:noindex:

random_crop
-----------

.. autofunction:: paddle.fluid.layers.random_crop
:noindex:

ops
===

Expand Down Expand Up @@ -784,12 +741,6 @@ sum
.. autofunction:: paddle.fluid.layers.sum
:noindex:

shape
-----

.. autofunction:: paddle.fluid.layers.shape
:noindex:

sigmoid
-------

Expand Down Expand Up @@ -1039,3 +990,93 @@ zeros
.. autofunction:: paddle.fluid.layers.zeros
:noindex:

detection
=========

multi_box_head
--------------

.. autofunction:: paddle.fluid.layers.multi_box_head
:noindex:

bipartite_match
---------------

.. autofunction:: paddle.fluid.layers.bipartite_match
:noindex:

target_assign
-------------

.. autofunction:: paddle.fluid.layers.target_assign
:noindex:

detection_output
----------------

.. autofunction:: paddle.fluid.layers.detection_output
:noindex:

ssd_loss
--------

.. autofunction:: paddle.fluid.layers.ssd_loss
:noindex:

detection_map
-------------

.. autofunction:: paddle.fluid.layers.detection_map
:noindex:

iou_similarity
--------------

.. autofunction:: paddle.fluid.layers.iou_similarity
:noindex:

box_coder
---------

.. autofunction:: paddle.fluid.layers.box_coder
:noindex:

learning_rate_scheduler
=======================

exponential_decay
-----------------

.. autofunction:: paddle.fluid.layers.exponential_decay
:noindex:

natural_exp_decay
-----------------

.. autofunction:: paddle.fluid.layers.natural_exp_decay
:noindex:

inverse_time_decay
------------------

.. autofunction:: paddle.fluid.layers.inverse_time_decay
:noindex:

polynomial_decay
----------------

.. autofunction:: paddle.fluid.layers.polynomial_decay
:noindex:

piecewise_decay
---------------

.. autofunction:: paddle.fluid.layers.piecewise_decay
:noindex:

noam_decay
----------

.. autofunction:: paddle.fluid.layers.noam_decay
:noindex:

7 changes: 0 additions & 7 deletions doc/fluid/api/optimizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ DecayedAdagradOptimizer
:members:
:noindex:

RMSPropOptimizer
----------------

.. autoclass:: paddle.fluid.optimizer.RMSPropOptimizer
:members:
:noindex:

Adadelta
--------

Expand Down
12 changes: 0 additions & 12 deletions doc/fluid/api/profiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,3 @@ profiler
.. autofunction:: paddle.fluid.profiler.profiler
:noindex:

start_profiler
--------------

.. autofunction:: paddle.fluid.profiler.start_profiler
:noindex:

stop_profiler
-------------

.. autofunction:: paddle.fluid.profiler.stop_profiler
:noindex:

2 changes: 1 addition & 1 deletion doc/survey/dynamic_graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Pytorch chooses immediate evaluation. It avoids ever materializing a "forward gr

## What can fluid learn from them?

TBD
Please refer to `paddle/contrib/dynamic/`.

# Appendix

Expand Down
2 changes: 1 addition & 1 deletion doc/v2/api/config/evaluators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ value_printer
:noindex:

Detection
=====
==========

detection_map
-------------
Expand Down
Loading

0 comments on commit fa002cd

Please sign in to comment.