diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a21574b855bc6bc37fefe61de98d657e712cde7..5db5c228be2d6491463ec1ddb17de7bec730bd44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,6 +60,7 @@ option(USE_NNPACK "Compile PaddlePaddle with NNPACK library" OFF) option(WITH_DISTRIBUTE "Compile with grpc distributed support" OFF) option(USE_EIGEN_FOR_BLAS "Use matrix multiplication in 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" ON) # CMAKE_BUILD_TYPE if(NOT CMAKE_BUILD_TYPE) @@ -141,7 +142,6 @@ include(external/boost) # download boost include(external/any) # download libn::any include(external/eigen) # download eigen3 include(external/pybind11) # download pybind11 -include(external/nccl) include(external/cares) include(external/grpc) diff --git a/Dockerfile b/Dockerfile index 6ac9901ac6cea12e97047efdfb6272c957f166ae..60e76c7f2ede6beaca11659020d5991a75d5b741 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,8 @@ COPY ./paddle/scripts/docker/root/ /root/ RUN apt-get update && \ apt-get install -y \ - git python-pip python-dev openssh-server bison libnccl-dev \ + git python-pip python-dev openssh-server bison \ + libnccl2=2.1.2-1+cuda8.0 libnccl-dev=2.1.2-1+cuda8.0 \ wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ curl sed grep graphviz libjpeg-dev zlib1g-dev \ python-matplotlib gcc-4.8 g++-4.8 \ diff --git a/LICENSE b/LICENSE index e77bd090ee4f1ae549089f7de660a58364f42170..5fe86943b37a77970679f826e78c71045569f819 100644 --- a/LICENSE +++ b/LICENSE @@ -188,7 +188,7 @@ Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/benchmark/cluster/vgg16/README.md b/benchmark/cluster/vgg16/README.md index 11d00b8f85382aa720c169338c51333b730d44d5..cd681a1a282d9a26eac1c267bfa26967f8c3c9fd 100644 --- a/benchmark/cluster/vgg16/README.md +++ b/benchmark/cluster/vgg16/README.md @@ -8,23 +8,24 @@ - cpu MHz : 2101.000 - cache size : 20480 KB +### Blas settings + +Setting environment variable: `MKL_NUM_THREADS=1`. + ### Single Node Single Thread -- PServer Count: 10 -- Trainer Count: 20 - Metrics: samples / sec | Batch Size | 32 | 64 | 128 | 256 | | -- | -- | -- | -- | -- | | PaddlePaddle Fluid | 15.44 | 16.32 | 16.74 | 16.79 | | PaddlePaddle v2 | 15.97 | 17.04 | 17.60 | 17.83 | -| TensorFlow | - | - | - | - | +| TensorFlow | 9.09 | 9.10 | 9.24 | 8.66 | ### Different Batch Size - PServer Count: 10 - Trainer Count: 20 -- Per trainer CPU Core: 1 - Metrics: samples / sec | Batch Size | 32 | 64 | 128 | 256 | diff --git a/benchmark/cluster/vgg16/vgg16_fluid.py b/benchmark/cluster/vgg16/vgg16_fluid.py index 499e06ec42fc8f840137173628fa465e0541ba30..99395699f2ff5a04f340a1ca73d6e9a853981f5c 100644 --- a/benchmark/cluster/vgg16/vgg16_fluid.py +++ b/benchmark/cluster/vgg16/vgg16_fluid.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/cluster/vgg16/vgg16_v2.py b/benchmark/cluster/vgg16/vgg16_v2.py index 6ac6b3c33252e0a1f596f539fc090c5ada118e15..1a66af32d7131997c63bd3c3042875f33a467084 100644 --- a/benchmark/cluster/vgg16/vgg16_v2.py +++ b/benchmark/cluster/vgg16/vgg16_v2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/benchmark/paddle/image/alexnet.py b/benchmark/paddle/image/alexnet.py index 70296081877588885a7a6d4d8491409b41a8d378..9efc3f0494e4a817a7357f29e684f621bce1921e 100644 --- a/benchmark/paddle/image/alexnet.py +++ b/benchmark/paddle/image/alexnet.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/paddle/image/provider.py b/benchmark/paddle/image/provider.py index 21e0d381aab24d21d91cdcc4aa630f6107405f9e..6ad817ccefab3e44a8f962e907ba2110a6ed4a45 100644 --- a/benchmark/paddle/image/provider.py +++ b/benchmark/paddle/image/provider.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/paddle/rnn/imdb.py b/benchmark/paddle/rnn/imdb.py index c3b5faa19aaa325aaaf9cd9cc8f757d3f3b3bdcb..2a67f9b0cf52484d9d44fe9db0b1e57cdd20fd43 100755 --- a/benchmark/paddle/rnn/imdb.py +++ b/benchmark/paddle/rnn/imdb.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/paddle/rnn/provider.py b/benchmark/paddle/rnn/provider.py index f35cd5b079ff09ac35b171ff3032ecc5adabc947..23cc0c44a98d0ae7f586d1a376a603198f2c6144 100644 --- a/benchmark/paddle/rnn/provider.py +++ b/benchmark/paddle/rnn/provider.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/tensorflow/image/alexnet.py b/benchmark/tensorflow/image/alexnet.py index a37d7e7c62282891d67cee74cac1408eac1244f7..95728b7a85afbc231cb4ade0b3ad835de109c980 100644 --- a/benchmark/tensorflow/image/alexnet.py +++ b/benchmark/tensorflow/image/alexnet.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/tensorflow/image/alexnet_multi_gpu.py b/benchmark/tensorflow/image/alexnet_multi_gpu.py index 2ebab8fb60d471cd6de6d332d81608f2a992b9be..51dfe3f1cb26e394cd7df0f99e2e9f7e431c1bfb 100644 --- a/benchmark/tensorflow/image/alexnet_multi_gpu.py +++ b/benchmark/tensorflow/image/alexnet_multi_gpu.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/tensorflow/image/googlenet.py b/benchmark/tensorflow/image/googlenet.py index 1202cbb171efd74dec1fc6690a82e1f5126685f0..37b2ba6911514b96bc0be8994d8d095512a1cd4a 100644 --- a/benchmark/tensorflow/image/googlenet.py +++ b/benchmark/tensorflow/image/googlenet.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/tensorflow/image/googlenet_multi_gpu.py b/benchmark/tensorflow/image/googlenet_multi_gpu.py index f06437eb6c82bf0dfbb9a76799e83182ec5ee888..7179c5301cd0dc87744c2233ff5eb402dfbd7496 100644 --- a/benchmark/tensorflow/image/googlenet_multi_gpu.py +++ b/benchmark/tensorflow/image/googlenet_multi_gpu.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/tensorflow/image/smallnet_mnist_cifar.py b/benchmark/tensorflow/image/smallnet_mnist_cifar.py index 558c68575f4ae3ceba7119ed081549ad63e208d8..2ca1623b6b47a5bbea2ff67928f0a8a6374da0d7 100644 --- a/benchmark/tensorflow/image/smallnet_mnist_cifar.py +++ b/benchmark/tensorflow/image/smallnet_mnist_cifar.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/benchmark/tensorflow/rnn/reader.py b/benchmark/tensorflow/rnn/reader.py index 9660d3c22b3a16954b0a1d09d38cf033824f0a5f..ac08c10a4232a39b4f7ce93a3b14c778ee0c9e2e 100755 --- a/benchmark/tensorflow/rnn/reader.py +++ b/benchmark/tensorflow/rnn/reader.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/configure.cmake b/cmake/configure.cmake index 5c6bcfde76a1201f792d04766d698db8cd395a49..ae3295fe4115f457570203e61a56a637895e4770 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/cross_compiling/android.cmake b/cmake/cross_compiling/android.cmake index 84219cfa5587f5b765b2e8f35180797d7053169f..4cf2be3bdf07ed018c57cd6bc305a3eda9c9a23d 100644 --- a/cmake/cross_compiling/android.cmake +++ b/cmake/cross_compiling/android.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/cross_compiling/host.cmake b/cmake/cross_compiling/host.cmake index 14c35266ec60b439aaef30e5e4e0540c534160ae..f9c6b12136f488a9a6ab77b1ba673b6be75391b5 100644 --- a/cmake/cross_compiling/host.cmake +++ b/cmake/cross_compiling/host.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/cross_compiling/ios.cmake b/cmake/cross_compiling/ios.cmake index d3f5bf6852b3b295f3b5806b0577a880b0ce6ba6..10d389ec8ed57ac2b15dd925ef99c8aff4807b05 100644 --- a/cmake/cross_compiling/ios.cmake +++ b/cmake/cross_compiling/ios.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/cross_compiling/raspberry_pi.cmake b/cmake/cross_compiling/raspberry_pi.cmake index 817b39f6833e37c340d4ee465048480cfc3db151..0425b2ae158b265fd6f8423b05190a8002f03f20 100644 --- a/cmake/cross_compiling/raspberry_pi.cmake +++ b/cmake/cross_compiling/raspberry_pi.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/boost.cmake b/cmake/external/boost.cmake index dbc676bdac30e0d730206c17a1912d49d4f896eb..d9cd264b49d546c35a2c57a82ead83ea654b60ae 100644 --- a/cmake/external/boost.cmake +++ b/cmake/external/boost.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,9 +15,16 @@ include(ExternalProject) set(BOOST_PROJECT "extern_boost") +# To release PaddlePaddle as a pip package, we have to follow the +# manylinux1 standard, which features as old Linux kernels and +# compilers as possible and recommends CentOS 5. Indeed, the earliest +# CentOS version that works with NVIDIA CUDA is CentOS 6. And a new +# version of boost, say, 1.66.0, doesn't build on CentOS 6. We +# checked that the devtools package of CentOS 6 installs boost 1.41.0. +# So we use 1.41.0 here. set(BOOST_VER "1.41.0") set(BOOST_TAR "boost_1_41_0") -set(BOOST_URL "http://sourceforge.net/projects/boost/files/boost/${BOOST_VER}/${BOOST_TAR}.tar.gz") +set(BOOST_URL "http://paddlepaddledeps.s3-website-us-west-1.amazonaws.com/${BOOST_TAR}.tar.gz") set(BOOST_SOURCES_DIR ${THIRD_PARTY_PATH}/boost) set(BOOST_DOWNLOAD_DIR "${BOOST_SOURCES_DIR}/src/${BOOST_PROJECT}") set(BOOST_INCLUDE_DIR "${BOOST_DOWNLOAD_DIR}/${BOOST_TAR}" CACHE PATH "boost include directory." FORCE) diff --git a/cmake/external/cares.cmake b/cmake/external/cares.cmake index aec51410b33669f8a549f2eca193cc6aa2d07a13..a743b572a6c3f6f152d85909500e9dbb35c72a01 100644 --- a/cmake/external/cares.cmake +++ b/cmake/external/cares.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/gflags.cmake b/cmake/external/gflags.cmake index d4f252bb9f64c8db82b841fedf0817f5d8596501..a1d2d0f44685c342db9d868da716809b49575c01 100644 --- a/cmake/external/gflags.cmake +++ b/cmake/external/gflags.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/glog.cmake b/cmake/external/glog.cmake index 0c6b3aafcb4e990b9d4549820137474e5968a7aa..ac0181e69cbf5efeee44c5ca801b2710eefb3e6d 100644 --- a/cmake/external/glog.cmake +++ b/cmake/external/glog.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/grpc.cmake b/cmake/external/grpc.cmake index 79b2449fe6689993bbee8a24ae7c46b452afe0a0..0853b981813c5d60a12603471df7e0b216b0822f 100644 --- a/cmake/external/grpc.cmake +++ b/cmake/external/grpc.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/gtest.cmake b/cmake/external/gtest.cmake index 5a4aa7a5b71a4fdfd556a46037e6d1846d668fc4..d335298742c73bf1fe44e6a778ab3c142711063d 100644 --- a/cmake/external/gtest.cmake +++ b/cmake/external/gtest.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake index 89fc34796a03ff3f3e5b022ae10b2646832b1ac7..a25cff5fc567f22d4573625487f31bd4192bb172 100644 --- a/cmake/external/mkldnn.cmake +++ b/cmake/external/mkldnn.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -56,6 +56,7 @@ ExternalProject_Add( PREFIX ${MKLDNN_SOURCES_DIR} UPDATE_COMMAND "" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${MKLDNN_INSTALL_DIR} + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} CMAKE_ARGS -DMKLROOT=${MKLML_ROOT} CMAKE_ARGS -DCMAKE_C_FLAGS=${MKLDNN_CFLAG} CMAKE_ARGS -DCMAKE_CXX_FLAGS=${MKLDNN_CXXFLAG} diff --git a/cmake/external/mklml.cmake b/cmake/external/mklml.cmake index 15a07ea3daf5aa606235f20288a8306966334a1a..739a910c7c670b7b9f89e543582a32a80546fb11 100644 --- a/cmake/external/mklml.cmake +++ b/cmake/external/mklml.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/nccl.cmake b/cmake/external/nccl.cmake index fc43766efafc3d3e16f2906ce7f9a3d692c8e4ff..af5c689c3524741a88518eeb3f85996872257677 100644 --- a/cmake/external/nccl.cmake +++ b/cmake/external/nccl.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/openblas.cmake b/cmake/external/openblas.cmake index 4012a164be1d20bba050fb09749b11afc7b99588..e2b7ef8d54748de46370e808e28f9b9fcc988a84 100644 --- a/cmake/external/openblas.cmake +++ b/cmake/external/openblas.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/protobuf.cmake b/cmake/external/protobuf.cmake index ff5855052dabaa0b63099cd219f3f04e22f1aa85..0fde4373a4be58e71ff1a305bd4991cc554d7a34 100644 --- a/cmake/external/protobuf.cmake +++ b/cmake/external/protobuf.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/pybind11.cmake b/cmake/external/pybind11.cmake index 4e87dc49d8956d1fa6dec777efc5a63c6b0f79a5..c885877a2bcd622dc8d1f3ca2821a0bed84561bf 100644 --- a/cmake/external/pybind11.cmake +++ b/cmake/external/pybind11.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/python.cmake b/cmake/external/python.cmake index 46c68cce324f565ec9985ef1a280d6d933f88f1f..d7e5571bdbd8ba58d8a08c9426971f1c7b186413 100644 --- a/cmake/external/python.cmake +++ b/cmake/external/python.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/swig.cmake b/cmake/external/swig.cmake index 9db457c7b2d61228e5d5af6827c4cda11a20a463..de07703695eb14e76eedd3758d55cb98edd1e02b 100644 --- a/cmake/external/swig.cmake +++ b/cmake/external/swig.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/warpctc.cmake b/cmake/external/warpctc.cmake index 5fa60df7b3f6698ceeee1e4f6d868a3d4bfc7a41..9a9a20f897e09b823dfb19ff841c3f2aeb3f9fe6 100644 --- a/cmake/external/warpctc.cmake +++ b/cmake/external/warpctc.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/external/zlib.cmake b/cmake/external/zlib.cmake index 1638cd8fdfc34575132462859e056a1907f0b2f1..e568880632c885ca77e8e609918ff643e7ed6e47 100644 --- a/cmake/external/zlib.cmake +++ b/cmake/external/zlib.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/generic.cmake b/cmake/generic.cmake index 1cb54ba2164fafbfce9f28a3e894ae5e78a9cd68..12e07bd5f883d2cf100ece391bdf7d2bbcafc8f7 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/make_resource.py b/cmake/make_resource.py index 4f9f5546b9d4176d1035311cb9e1acf0c0eeccfd..09a2ca877dd54243428ee2c730944f75ceeeaa30 100644 --- a/cmake/make_resource.py +++ b/cmake/make_resource.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cmake/system.cmake b/cmake/system.cmake index 396bd1a0797edea0522bb1f02349373563b7726a..c91ef91127511da9ac8b9e11349f4a23aaedd613 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/api/v2/fluid/data_feeder.rst b/doc/api/fluid/data_feeder.rst similarity index 76% rename from doc/api/v2/fluid/data_feeder.rst rename to doc/api/fluid/data_feeder.rst index a591c7334fd31c98a94b50a4344f251560a0f2f9..3df5c0307ffed9d101da58b385840b115920e906 100644 --- a/doc/api/v2/fluid/data_feeder.rst +++ b/doc/api/fluid/data_feeder.rst @@ -8,7 +8,7 @@ data_feeder DataFeeder ---------- -.. autoclass:: paddle.v2.fluid.data_feeder.DataFeeder +.. autoclass:: paddle.fluid.data_feeder.DataFeeder :members: :noindex: diff --git a/doc/api/v2/fluid/evaluator.rst b/doc/api/fluid/evaluator.rst similarity index 67% rename from doc/api/v2/fluid/evaluator.rst rename to doc/api/fluid/evaluator.rst index 00dcecfd628a35d83d1c596bf0aea819a1705862..ae9daeb7918d773d7330f419de96c6972a836710 100644 --- a/doc/api/v2/fluid/evaluator.rst +++ b/doc/api/fluid/evaluator.rst @@ -8,14 +8,14 @@ evaluator Accuracy -------- -.. autoclass:: paddle.v2.fluid.evaluator.Accuracy +.. autoclass:: paddle.fluid.evaluator.Accuracy :members: :noindex: ChunkEvaluator -------------- -.. autoclass:: paddle.v2.fluid.evaluator.ChunkEvaluator +.. autoclass:: paddle.fluid.evaluator.ChunkEvaluator :members: :noindex: diff --git a/doc/api/v2/fluid/executor.rst b/doc/api/fluid/executor.rst similarity index 56% rename from doc/api/v2/fluid/executor.rst rename to doc/api/fluid/executor.rst index a028f6283f2ca333bdf6c9857a98661c0222b41e..a9cdf264e49691afc4b9425b7bfe54f8157ae6c2 100644 --- a/doc/api/v2/fluid/executor.rst +++ b/doc/api/fluid/executor.rst @@ -8,25 +8,25 @@ executor Executor -------- -.. autoclass:: paddle.v2.fluid.executor.Executor +.. autoclass:: paddle.fluid.executor.Executor :members: :noindex: global_scope ------------ -.. autofunction:: paddle.v2.fluid.executor.global_scope +.. autofunction:: paddle.fluid.executor.global_scope :noindex: scope_guard ----------- -.. autofunction:: paddle.v2.fluid.executor.scope_guard +.. autofunction:: paddle.fluid.executor.scope_guard :noindex: switch_scope ------------ -.. autofunction:: paddle.v2.fluid.executor.switch_scope +.. autofunction:: paddle.fluid.executor.switch_scope :noindex: diff --git a/doc/api/v2/fluid/gen_doc.py b/doc/api/fluid/gen_doc.py similarity index 95% rename from doc/api/v2/fluid/gen_doc.py rename to doc/api/fluid/gen_doc.py index a2147fd3f7ea635d8f14210fbcd1a568ee2230ee..89ab880301b6ac687fd61f556f87f03792c37da3 100644 --- a/doc/api/v2/fluid/gen_doc.py +++ b/doc/api/fluid/gen_doc.py @@ -17,7 +17,7 @@ import argparse import sys import types -import paddle.v2.fluid as fluid +import paddle.fluid as fluid def parse_arg(): @@ -70,7 +70,7 @@ class DocGenerator(object): def print_class(self, name): self._print_header_(name, dot='-', is_title=False) - self.stream.write('''.. autoclass:: paddle.v2.fluid.{0}.{1} + self.stream.write('''.. autoclass:: paddle.fluid.{0}.{1} :members: :noindex: @@ -78,7 +78,7 @@ class DocGenerator(object): def print_method(self, name): self._print_header_(name, dot='-', is_title=False) - self.stream.write('''.. autofunction:: paddle.v2.fluid.{0}.{1} + self.stream.write('''.. autofunction:: paddle.fluid.{0}.{1} :noindex: '''.format(self.module_name, name)) diff --git a/doc/api/v2/fluid/gen_doc.sh b/doc/api/fluid/gen_doc.sh similarity index 100% rename from doc/api/v2/fluid/gen_doc.sh rename to doc/api/fluid/gen_doc.sh diff --git a/doc/api/fluid/index.rst b/doc/api/fluid/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..b0710d8b19956eb235890fdb2a2d764084416aa5 --- /dev/null +++ b/doc/api/fluid/index.rst @@ -0,0 +1,18 @@ +====================== +Fluid +====================== + +.. toctree:: + :maxdepth: 1 + + layers.rst + data_feeder.rst + executor.rst + initializer.rst + evaluator.rst + nets.rst + optimizer.rst + param_attr.rst + profiler.rst + regularizer.rst + io.rst diff --git a/doc/api/v2/fluid/initializer.rst b/doc/api/fluid/initializer.rst similarity index 59% rename from doc/api/v2/fluid/initializer.rst rename to doc/api/fluid/initializer.rst index c38be033fff2997930525f51c93995db09daa2b6..ee69925fda6b3fc850cfb632e8edd359e7fcff9c 100644 --- a/doc/api/v2/fluid/initializer.rst +++ b/doc/api/fluid/initializer.rst @@ -8,28 +8,28 @@ initializer Constant -------- -.. autoclass:: paddle.v2.fluid.initializer.Constant +.. autoclass:: paddle.fluid.initializer.Constant :members: :noindex: Uniform ------- -.. autoclass:: paddle.v2.fluid.initializer.Uniform +.. autoclass:: paddle.fluid.initializer.Uniform :members: :noindex: Normal ------ -.. autoclass:: paddle.v2.fluid.initializer.Normal +.. autoclass:: paddle.fluid.initializer.Normal :members: :noindex: Xavier ------ -.. autoclass:: paddle.v2.fluid.initializer.Xavier +.. autoclass:: paddle.fluid.initializer.Xavier :members: :noindex: diff --git a/doc/api/v2/fluid/io.rst b/doc/api/fluid/io.rst similarity index 52% rename from doc/api/v2/fluid/io.rst rename to doc/api/fluid/io.rst index 37c9c273e369532e8ff596e9649cb695a98a2505..dd9d88b669957c22cd0a07fa4b7e219e2d6e5d61 100644 --- a/doc/api/v2/fluid/io.rst +++ b/doc/api/fluid/io.rst @@ -8,54 +8,54 @@ io save_vars --------- -.. autofunction:: paddle.v2.fluid.io.save_vars +.. autofunction:: paddle.fluid.io.save_vars :noindex: save_params ----------- -.. autofunction:: paddle.v2.fluid.io.save_params +.. autofunction:: paddle.fluid.io.save_params :noindex: save_persistables ----------------- -.. autofunction:: paddle.v2.fluid.io.save_persistables +.. autofunction:: paddle.fluid.io.save_persistables :noindex: load_vars --------- -.. autofunction:: paddle.v2.fluid.io.load_vars +.. autofunction:: paddle.fluid.io.load_vars :noindex: load_params ----------- -.. autofunction:: paddle.v2.fluid.io.load_params +.. autofunction:: paddle.fluid.io.load_params :noindex: load_persistables ----------------- -.. autofunction:: paddle.v2.fluid.io.load_persistables +.. autofunction:: paddle.fluid.io.load_persistables :noindex: save_inference_model -------------------- -.. autofunction:: paddle.v2.fluid.io.save_inference_model +.. autofunction:: paddle.fluid.io.save_inference_model :noindex: load_inference_model -------------------- -.. autofunction:: paddle.v2.fluid.io.load_inference_model +.. autofunction:: paddle.fluid.io.load_inference_model :noindex: get_inference_program --------------------- -.. autofunction:: paddle.v2.fluid.io.get_inference_program +.. autofunction:: paddle.fluid.io.get_inference_program :noindex: diff --git a/doc/api/fluid/layers.rst b/doc/api/fluid/layers.rst new file mode 100644 index 0000000000000000000000000000000000000000..ae35d8c53476b34cb18331364267dd7c8b94dd64 --- /dev/null +++ b/doc/api/fluid/layers.rst @@ -0,0 +1,805 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +====== +layers +====== + +control_flow +============ + +split_lod_tensor +---------------- + +.. autofunction:: paddle.fluid.layers.split_lod_tensor + :noindex: + +merge_lod_tensor +---------------- + +.. autofunction:: paddle.fluid.layers.merge_lod_tensor + :noindex: + +BlockGuard +---------- + +.. autoclass:: paddle.fluid.layers.BlockGuard + :members: + :noindex: + +BlockGuardWithCompletion +------------------------ + +.. autoclass:: paddle.fluid.layers.BlockGuardWithCompletion + :members: + :noindex: + +StaticRNNMemoryLink +------------------- + +.. autoclass:: paddle.fluid.layers.StaticRNNMemoryLink + :members: + :noindex: + +WhileGuard +---------- + +.. autoclass:: paddle.fluid.layers.WhileGuard + :members: + :noindex: + +While +----- + +.. autoclass:: paddle.fluid.layers.While + :members: + :noindex: + +lod_rank_table +-------------- + +.. autofunction:: paddle.fluid.layers.lod_rank_table + :noindex: + +max_sequence_len +---------------- + +.. autofunction:: paddle.fluid.layers.max_sequence_len + :noindex: + +topk +---- + +.. autofunction:: paddle.fluid.layers.topk + :noindex: + +lod_tensor_to_array +------------------- + +.. autofunction:: paddle.fluid.layers.lod_tensor_to_array + :noindex: + +array_to_lod_tensor +------------------- + +.. autofunction:: paddle.fluid.layers.array_to_lod_tensor + :noindex: + +increment +--------- + +.. autofunction:: paddle.fluid.layers.increment + :noindex: + +array_write +----------- + +.. autofunction:: paddle.fluid.layers.array_write + :noindex: + +create_array +------------ + +.. autofunction:: paddle.fluid.layers.create_array + :noindex: + +less_than +--------- + +.. autofunction:: paddle.fluid.layers.less_than + :noindex: + +array_read +---------- + +.. autofunction:: paddle.fluid.layers.array_read + :noindex: + +shrink_memory +------------- + +.. autofunction:: paddle.fluid.layers.shrink_memory + :noindex: + +array_length +------------ + +.. autofunction:: paddle.fluid.layers.array_length + :noindex: + +IfElse +------ + +.. autoclass:: paddle.fluid.layers.IfElse + :members: + :noindex: + +DynamicRNN +---------- + +.. autoclass:: paddle.fluid.layers.DynamicRNN + :members: + :noindex: + +ConditionalBlock +---------------- + +.. autoclass:: paddle.fluid.layers.ConditionalBlock + :members: + :noindex: + +StaticRNN +--------- + +.. autoclass:: paddle.fluid.layers.StaticRNN + :members: + :noindex: + +reorder_lod_tensor_by_rank +-------------------------- + +.. autofunction:: paddle.fluid.layers.reorder_lod_tensor_by_rank + :noindex: + +ParallelDo +---------- + +.. autoclass:: paddle.fluid.layers.ParallelDo + :members: + :noindex: + +Print +----- + +.. autofunction:: paddle.fluid.layers.Print + :noindex: + +device +====== + +get_places +---------- + +.. autofunction:: paddle.fluid.layers.get_places + :noindex: + +io +== + +data +---- + +.. autofunction:: paddle.fluid.layers.data + :noindex: + +BlockGuardServ +-------------- + +.. autoclass:: paddle.fluid.layers.BlockGuardServ + :members: + :noindex: + +ListenAndServ +------------- + +.. autoclass:: paddle.fluid.layers.ListenAndServ + :members: + :noindex: + +Send +---- + +.. autofunction:: paddle.fluid.layers.Send + :noindex: + +nn +== + +fc +-- + +.. autofunction:: paddle.fluid.layers.fc + :noindex: + +embedding +--------- + +.. autofunction:: paddle.fluid.layers.embedding + :noindex: + +dynamic_lstm +------------ + +.. autofunction:: paddle.fluid.layers.dynamic_lstm + :noindex: + +dynamic_lstmp +------------- + +.. autofunction:: paddle.fluid.layers.dynamic_lstmp + :noindex: + +dynamic_gru +----------- + +.. autofunction:: paddle.fluid.layers.dynamic_gru + :noindex: + +gru_unit +-------- + +.. autofunction:: paddle.fluid.layers.gru_unit + :noindex: + +linear_chain_crf +---------------- + +.. autofunction:: paddle.fluid.layers.linear_chain_crf + :noindex: + +crf_decoding +------------ + +.. autofunction:: paddle.fluid.layers.crf_decoding + :noindex: + +cos_sim +------- + +.. autofunction:: paddle.fluid.layers.cos_sim + :noindex: + +cross_entropy +------------- + +.. autofunction:: paddle.fluid.layers.cross_entropy + :noindex: + +square_error_cost +----------------- + +.. autofunction:: paddle.fluid.layers.square_error_cost + :noindex: + +accuracy +-------- + +.. autofunction:: paddle.fluid.layers.accuracy + :noindex: + +chunk_eval +---------- + +.. autofunction:: paddle.fluid.layers.chunk_eval + :noindex: + +sequence_conv +------------- + +.. autofunction:: paddle.fluid.layers.sequence_conv + :noindex: + +conv2d +------ + +.. autofunction:: paddle.fluid.layers.conv2d + :noindex: + +sequence_pool +------------- + +.. autofunction:: paddle.fluid.layers.sequence_pool + :noindex: + +pool2d +------ + +.. autofunction:: paddle.fluid.layers.pool2d + :noindex: + +batch_norm +---------- + +.. autofunction:: paddle.fluid.layers.batch_norm + :noindex: + +layer_norm +---------- + +.. autofunction:: paddle.fluid.layers.layer_norm + :noindex: + +beam_search_decode +------------------ + +.. autofunction:: paddle.fluid.layers.beam_search_decode + :noindex: + +conv2d_transpose +---------------- + +.. autofunction:: paddle.fluid.layers.conv2d_transpose + :noindex: + +sequence_expand +--------------- + +.. autofunction:: paddle.fluid.layers.sequence_expand + :noindex: + +lstm_unit +--------- + +.. autofunction:: paddle.fluid.layers.lstm_unit + :noindex: + +reduce_sum +---------- + +.. autofunction:: paddle.fluid.layers.reduce_sum + :noindex: + +reduce_mean +----------- + +.. autofunction:: paddle.fluid.layers.reduce_mean + :noindex: + +reduce_max +---------- + +.. autofunction:: paddle.fluid.layers.reduce_max + :noindex: + +reduce_min +---------- + +.. autofunction:: paddle.fluid.layers.reduce_min + :noindex: + +sequence_first_step +------------------- + +.. autofunction:: paddle.fluid.layers.sequence_first_step + :noindex: + +sequence_last_step +------------------ + +.. autofunction:: paddle.fluid.layers.sequence_last_step + :noindex: + +dropout +------- + +.. autofunction:: paddle.fluid.layers.dropout + :noindex: + +split +----- + +.. autofunction:: paddle.fluid.layers.split + :noindex: + +ctc_greedy_decoder +------------------ + +.. autofunction:: paddle.fluid.layers.ctc_greedy_decoder + :noindex: + +edit_distance +------------- + +.. autofunction:: paddle.fluid.layers.edit_distance + :noindex: + +l2_normalize +------------ + +.. autofunction:: paddle.fluid.layers.l2_normalize + :noindex: + +matmul +------ + +.. autofunction:: paddle.fluid.layers.matmul + :noindex: + +warpctc +------- + +.. autofunction:: paddle.fluid.layers.warpctc + :noindex: + +sequence_reshape +---------------- + +.. autofunction:: paddle.fluid.layers.sequence_reshape + :noindex: + +transpose +--------- + +.. autofunction:: paddle.fluid.layers.transpose + :noindex: + +im2sequence +----------- + +.. autofunction:: paddle.fluid.layers.im2sequence + :noindex: + +nce +--- + +.. autofunction:: paddle.fluid.layers.nce + :noindex: + +beam_search +----------- + +.. autofunction:: paddle.fluid.layers.beam_search + :noindex: + +row_conv +-------- + +.. autofunction:: paddle.fluid.layers.row_conv + :noindex: + +multiplex +--------- + +.. autofunction:: paddle.fluid.layers.multiplex + :noindex: + +ops +=== + +mean +---- + +.. autofunction:: paddle.fluid.layers.mean + :noindex: + +mul +--- + +.. autofunction:: paddle.fluid.layers.mul + :noindex: + +reshape +------- + +.. autofunction:: paddle.fluid.layers.reshape + :noindex: + +scale +----- + +.. autofunction:: paddle.fluid.layers.scale + :noindex: + +sigmoid_cross_entropy_with_logits +--------------------------------- + +.. autofunction:: paddle.fluid.layers.sigmoid_cross_entropy_with_logits + :noindex: + +elementwise_add +--------------- + +.. autofunction:: paddle.fluid.layers.elementwise_add + :noindex: + +elementwise_div +--------------- + +.. autofunction:: paddle.fluid.layers.elementwise_div + :noindex: + +elementwise_sub +--------------- + +.. autofunction:: paddle.fluid.layers.elementwise_sub + :noindex: + +elementwise_mul +--------------- + +.. autofunction:: paddle.fluid.layers.elementwise_mul + :noindex: + +elementwise_max +--------------- + +.. autofunction:: paddle.fluid.layers.elementwise_max + :noindex: + +elementwise_min +--------------- + +.. autofunction:: paddle.fluid.layers.elementwise_min + :noindex: + +elementwise_pow +--------------- + +.. autofunction:: paddle.fluid.layers.elementwise_pow + :noindex: + +clip +---- + +.. autofunction:: paddle.fluid.layers.clip + :noindex: + +clip_by_norm +------------ + +.. autofunction:: paddle.fluid.layers.clip_by_norm + :noindex: + +sequence_softmax +---------------- + +.. autofunction:: paddle.fluid.layers.sequence_softmax + :noindex: + +sigmoid +------- + +.. autofunction:: paddle.fluid.layers.sigmoid + :noindex: + +logsigmoid +---------- + +.. autofunction:: paddle.fluid.layers.logsigmoid + :noindex: + +exp +--- + +.. autofunction:: paddle.fluid.layers.exp + :noindex: + +relu +---- + +.. autofunction:: paddle.fluid.layers.relu + :noindex: + +tanh +---- + +.. autofunction:: paddle.fluid.layers.tanh + :noindex: + +tanh_shrink +----------- + +.. autofunction:: paddle.fluid.layers.tanh_shrink + :noindex: + +softshrink +---------- + +.. autofunction:: paddle.fluid.layers.softshrink + :noindex: + +sqrt +---- + +.. autofunction:: paddle.fluid.layers.sqrt + :noindex: + +abs +--- + +.. autofunction:: paddle.fluid.layers.abs + :noindex: + +ceil +---- + +.. autofunction:: paddle.fluid.layers.ceil + :noindex: + +floor +----- + +.. autofunction:: paddle.fluid.layers.floor + :noindex: + +round +----- + +.. autofunction:: paddle.fluid.layers.round + :noindex: + +reciprocal +---------- + +.. autofunction:: paddle.fluid.layers.reciprocal + :noindex: + +log +--- + +.. autofunction:: paddle.fluid.layers.log + :noindex: + +square +------ + +.. autofunction:: paddle.fluid.layers.square + :noindex: + +softplus +-------- + +.. autofunction:: paddle.fluid.layers.softplus + :noindex: + +softsign +-------- + +.. autofunction:: paddle.fluid.layers.softsign + :noindex: + +brelu +----- + +.. autofunction:: paddle.fluid.layers.brelu + :noindex: + +leaky_relu +---------- + +.. autofunction:: paddle.fluid.layers.leaky_relu + :noindex: + +soft_relu +--------- + +.. autofunction:: paddle.fluid.layers.soft_relu + :noindex: + +elu +--- + +.. autofunction:: paddle.fluid.layers.elu + :noindex: + +relu6 +----- + +.. autofunction:: paddle.fluid.layers.relu6 + :noindex: + +pow +--- + +.. autofunction:: paddle.fluid.layers.pow + :noindex: + +stanh +----- + +.. autofunction:: paddle.fluid.layers.stanh + :noindex: + +hard_shrink +----------- + +.. autofunction:: paddle.fluid.layers.hard_shrink + :noindex: + +thresholded_relu +---------------- + +.. autofunction:: paddle.fluid.layers.thresholded_relu + :noindex: + +hard_sigmoid +------------ + +.. autofunction:: paddle.fluid.layers.hard_sigmoid + :noindex: + +swish +----- + +.. autofunction:: paddle.fluid.layers.swish + :noindex: + +tensor +====== + +create_tensor +------------- + +.. autofunction:: paddle.fluid.layers.create_tensor + :noindex: + +create_parameter +---------------- + +.. autofunction:: paddle.fluid.layers.create_parameter + :noindex: + +create_global_var +----------------- + +.. autofunction:: paddle.fluid.layers.create_global_var + :noindex: + +cast +---- + +.. autofunction:: paddle.fluid.layers.cast + :noindex: + +concat +------ + +.. autofunction:: paddle.fluid.layers.concat + :noindex: + +sums +---- + +.. autofunction:: paddle.fluid.layers.sums + :noindex: + +assign +------ + +.. autofunction:: paddle.fluid.layers.assign + :noindex: + +fill_constant_batch_size_like +----------------------------- + +.. autofunction:: paddle.fluid.layers.fill_constant_batch_size_like + :noindex: + +fill_constant +------------- + +.. autofunction:: paddle.fluid.layers.fill_constant + :noindex: + +ones +---- + +.. autofunction:: paddle.fluid.layers.ones + :noindex: + +zeros +----- + +.. autofunction:: paddle.fluid.layers.zeros + :noindex: + diff --git a/doc/api/v2/fluid/nets.rst b/doc/api/fluid/nets.rst similarity index 57% rename from doc/api/v2/fluid/nets.rst rename to doc/api/fluid/nets.rst index 015581b7660848bdb0845fafe2d3fc05405e6ae6..7ae3187304f386a08c5cb8a4ba093423a58a7f36 100644 --- a/doc/api/v2/fluid/nets.rst +++ b/doc/api/fluid/nets.rst @@ -8,24 +8,24 @@ nets simple_img_conv_pool -------------------- -.. autofunction:: paddle.v2.fluid.nets.simple_img_conv_pool +.. autofunction:: paddle.fluid.nets.simple_img_conv_pool :noindex: sequence_conv_pool ------------------ -.. autofunction:: paddle.v2.fluid.nets.sequence_conv_pool +.. autofunction:: paddle.fluid.nets.sequence_conv_pool :noindex: glu --- -.. autofunction:: paddle.v2.fluid.nets.glu +.. autofunction:: paddle.fluid.nets.glu :noindex: scaled_dot_product_attention ---------------------------- -.. autofunction:: paddle.v2.fluid.nets.scaled_dot_product_attention +.. autofunction:: paddle.fluid.nets.scaled_dot_product_attention :noindex: diff --git a/doc/api/v2/fluid/optimizer.rst b/doc/api/fluid/optimizer.rst similarity index 56% rename from doc/api/v2/fluid/optimizer.rst rename to doc/api/fluid/optimizer.rst index 1691ebb9a7cb16da96e04147d0adea322374f529..9b165f870459b4f9ef2efe24f5604a3fcb96f7f3 100644 --- a/doc/api/v2/fluid/optimizer.rst +++ b/doc/api/fluid/optimizer.rst @@ -8,42 +8,42 @@ optimizer SGD --- -.. autoclass:: paddle.v2.fluid.optimizer.SGD +.. autoclass:: paddle.fluid.optimizer.SGD :members: :noindex: Momentum -------- -.. autoclass:: paddle.v2.fluid.optimizer.Momentum +.. autoclass:: paddle.fluid.optimizer.Momentum :members: :noindex: Adagrad ------- -.. autoclass:: paddle.v2.fluid.optimizer.Adagrad +.. autoclass:: paddle.fluid.optimizer.Adagrad :members: :noindex: Adam ---- -.. autoclass:: paddle.v2.fluid.optimizer.Adam +.. autoclass:: paddle.fluid.optimizer.Adam :members: :noindex: Adamax ------ -.. autoclass:: paddle.v2.fluid.optimizer.Adamax +.. autoclass:: paddle.fluid.optimizer.Adamax :members: :noindex: DecayedAdagrad -------------- -.. autoclass:: paddle.v2.fluid.optimizer.DecayedAdagrad +.. autoclass:: paddle.fluid.optimizer.DecayedAdagrad :members: :noindex: diff --git a/doc/api/v2/fluid/param_attr.rst b/doc/api/fluid/param_attr.rst similarity index 67% rename from doc/api/v2/fluid/param_attr.rst rename to doc/api/fluid/param_attr.rst index 8083d0d858dafcd275eaddb9b475875ee42ef724..8e4ddb2b0492d0fcfcade199fdd6dfe43faa7075 100644 --- a/doc/api/v2/fluid/param_attr.rst +++ b/doc/api/fluid/param_attr.rst @@ -8,14 +8,14 @@ param_attr ParamAttr --------- -.. autoclass:: paddle.v2.fluid.param_attr.ParamAttr +.. autoclass:: paddle.fluid.param_attr.ParamAttr :members: :noindex: WeightNormParamAttr ------------------- -.. autoclass:: paddle.v2.fluid.param_attr.WeightNormParamAttr +.. autoclass:: paddle.fluid.param_attr.WeightNormParamAttr :members: :noindex: diff --git a/doc/api/v2/fluid/profiler.rst b/doc/api/fluid/profiler.rst similarity index 58% rename from doc/api/v2/fluid/profiler.rst rename to doc/api/fluid/profiler.rst index 4a1ff7cb6976e0054f77428b699ea679aa91394f..74d102dcb0db35766c34e3d14939a8aa5861686b 100644 --- a/doc/api/v2/fluid/profiler.rst +++ b/doc/api/fluid/profiler.rst @@ -8,18 +8,18 @@ profiler cuda_profiler ------------- -.. autofunction:: paddle.v2.fluid.profiler.cuda_profiler +.. autofunction:: paddle.fluid.profiler.cuda_profiler :noindex: reset_profiler -------------- -.. autofunction:: paddle.v2.fluid.profiler.reset_profiler +.. autofunction:: paddle.fluid.profiler.reset_profiler :noindex: profiler -------- -.. autofunction:: paddle.v2.fluid.profiler.profiler +.. autofunction:: paddle.fluid.profiler.profiler :noindex: diff --git a/doc/api/v2/fluid/regularizer.rst b/doc/api/fluid/regularizer.rst similarity index 61% rename from doc/api/v2/fluid/regularizer.rst rename to doc/api/fluid/regularizer.rst index 2c17d15599baa1d02eb87c7b6c40034769ebb3a4..dc9740c46392567d314121ac401540b0e7382703 100644 --- a/doc/api/v2/fluid/regularizer.rst +++ b/doc/api/fluid/regularizer.rst @@ -8,20 +8,20 @@ regularizer append_regularization_ops ------------------------- -.. autofunction:: paddle.v2.fluid.regularizer.append_regularization_ops +.. autofunction:: paddle.fluid.regularizer.append_regularization_ops :noindex: L1Decay ------- -.. autoclass:: paddle.v2.fluid.regularizer.L1Decay +.. autoclass:: paddle.fluid.regularizer.L1Decay :members: :noindex: L2Decay ------- -.. autoclass:: paddle.v2.fluid.regularizer.L2Decay +.. autoclass:: paddle.fluid.regularizer.L2Decay :members: :noindex: diff --git a/doc/api/index_cn.rst b/doc/api/index_cn.rst deleted file mode 100644 index 84f9097a6cdc2da269bd6a0685796e14e26da37e..0000000000000000000000000000000000000000 --- a/doc/api/index_cn.rst +++ /dev/null @@ -1,10 +0,0 @@ -API -=== - -.. toctree:: - :maxdepth: 1 - - 模型配置 - 数据访问 - 训练与应用 - v2/fluid.rst diff --git a/doc/api/index_en.rst b/doc/api/index_en.rst index e6f632e1a5b9c4b50b7c6aa96a120030bd6ce338..fc8dbd07eba248942c03c2b609cfc8d8712ed0c7 100644 --- a/doc/api/index_en.rst +++ b/doc/api/index_en.rst @@ -4,7 +4,8 @@ API .. toctree:: :maxdepth: 1 + overview.rst v2/model_configs.rst v2/data.rst v2/run_logic.rst - v2/fluid.rst + fluid/index.rst diff --git a/doc/api/overview.rst b/doc/api/overview.rst new file mode 100644 index 0000000000000000000000000000000000000000..16b6cf42660c51feee09c689c671d5ef06663efb --- /dev/null +++ b/doc/api/overview.rst @@ -0,0 +1,16 @@ +V2 API Overview +================ + +The PaddlePaddle V2 API is designed to provide a modern user interface for PaddlePaddle V1(the original layer-based platform of PaddlePaddle), +it proposes some high-level concepts such as `Layers `_ , `Optimizer `_ , `Evaluator `_ and `Data Reader `_ to make the model configuration more familiar to users. + +A model is composed of the computation described by a group of `Layers`, with `Evaluator` to define the error, `Optimizer` to update the parameters and `Data Reader` to feed in the data. + +We also provide the `interface for Training and Inference `_ to help control the training and inference phrase, +it has several easy to use methods + +- `paddle.train` +- `paddle.test` +- `paddle.infer` + +to better expose the internal running details, different `events `_ are available to users by writing some callbacks. diff --git a/doc/api/v2/fluid.rst b/doc/api/v2/fluid.rst deleted file mode 100644 index 5f15cad2b530dfb3702357b3c26885ac2a7b7beb..0000000000000000000000000000000000000000 --- a/doc/api/v2/fluid.rst +++ /dev/null @@ -1,18 +0,0 @@ -====================== -Fluid -====================== - -.. toctree:: - :maxdepth: 1 - - fluid/layers.rst - fluid/data_feeder.rst - fluid/executor.rst - fluid/initializer.rst - fluid/evaluator.rst - fluid/nets.rst - fluid/optimizer.rst - fluid/param_attr.rst - fluid/profiler.rst - fluid/regularizer.rst - fluid/io.rst diff --git a/doc/api/v2/fluid/layers.rst b/doc/api/v2/fluid/layers.rst deleted file mode 100644 index 58c493fd7412cf9dbe507c9622d67dae33a5fb25..0000000000000000000000000000000000000000 --- a/doc/api/v2/fluid/layers.rst +++ /dev/null @@ -1,805 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -====== -layers -====== - -control_flow -============ - -split_lod_tensor ----------------- - -.. autofunction:: paddle.v2.fluid.layers.split_lod_tensor - :noindex: - -merge_lod_tensor ----------------- - -.. autofunction:: paddle.v2.fluid.layers.merge_lod_tensor - :noindex: - -BlockGuard ----------- - -.. autoclass:: paddle.v2.fluid.layers.BlockGuard - :members: - :noindex: - -BlockGuardWithCompletion ------------------------- - -.. autoclass:: paddle.v2.fluid.layers.BlockGuardWithCompletion - :members: - :noindex: - -StaticRNNMemoryLink -------------------- - -.. autoclass:: paddle.v2.fluid.layers.StaticRNNMemoryLink - :members: - :noindex: - -WhileGuard ----------- - -.. autoclass:: paddle.v2.fluid.layers.WhileGuard - :members: - :noindex: - -While ------ - -.. autoclass:: paddle.v2.fluid.layers.While - :members: - :noindex: - -lod_rank_table --------------- - -.. autofunction:: paddle.v2.fluid.layers.lod_rank_table - :noindex: - -max_sequence_len ----------------- - -.. autofunction:: paddle.v2.fluid.layers.max_sequence_len - :noindex: - -topk ----- - -.. autofunction:: paddle.v2.fluid.layers.topk - :noindex: - -lod_tensor_to_array -------------------- - -.. autofunction:: paddle.v2.fluid.layers.lod_tensor_to_array - :noindex: - -array_to_lod_tensor -------------------- - -.. autofunction:: paddle.v2.fluid.layers.array_to_lod_tensor - :noindex: - -increment ---------- - -.. autofunction:: paddle.v2.fluid.layers.increment - :noindex: - -array_write ------------ - -.. autofunction:: paddle.v2.fluid.layers.array_write - :noindex: - -create_array ------------- - -.. autofunction:: paddle.v2.fluid.layers.create_array - :noindex: - -less_than ---------- - -.. autofunction:: paddle.v2.fluid.layers.less_than - :noindex: - -array_read ----------- - -.. autofunction:: paddle.v2.fluid.layers.array_read - :noindex: - -shrink_memory -------------- - -.. autofunction:: paddle.v2.fluid.layers.shrink_memory - :noindex: - -array_length ------------- - -.. autofunction:: paddle.v2.fluid.layers.array_length - :noindex: - -IfElse ------- - -.. autoclass:: paddle.v2.fluid.layers.IfElse - :members: - :noindex: - -DynamicRNN ----------- - -.. autoclass:: paddle.v2.fluid.layers.DynamicRNN - :members: - :noindex: - -ConditionalBlock ----------------- - -.. autoclass:: paddle.v2.fluid.layers.ConditionalBlock - :members: - :noindex: - -StaticRNN ---------- - -.. autoclass:: paddle.v2.fluid.layers.StaticRNN - :members: - :noindex: - -reorder_lod_tensor_by_rank --------------------------- - -.. autofunction:: paddle.v2.fluid.layers.reorder_lod_tensor_by_rank - :noindex: - -ParallelDo ----------- - -.. autoclass:: paddle.v2.fluid.layers.ParallelDo - :members: - :noindex: - -Print ------ - -.. autofunction:: paddle.v2.fluid.layers.Print - :noindex: - -device -====== - -get_places ----------- - -.. autofunction:: paddle.v2.fluid.layers.get_places - :noindex: - -io -== - -data ----- - -.. autofunction:: paddle.v2.fluid.layers.data - :noindex: - -BlockGuardServ --------------- - -.. autoclass:: paddle.v2.fluid.layers.BlockGuardServ - :members: - :noindex: - -ListenAndServ -------------- - -.. autoclass:: paddle.v2.fluid.layers.ListenAndServ - :members: - :noindex: - -Send ----- - -.. autofunction:: paddle.v2.fluid.layers.Send - :noindex: - -nn -== - -fc --- - -.. autofunction:: paddle.v2.fluid.layers.fc - :noindex: - -embedding ---------- - -.. autofunction:: paddle.v2.fluid.layers.embedding - :noindex: - -dynamic_lstm ------------- - -.. autofunction:: paddle.v2.fluid.layers.dynamic_lstm - :noindex: - -dynamic_lstmp -------------- - -.. autofunction:: paddle.v2.fluid.layers.dynamic_lstmp - :noindex: - -dynamic_gru ------------ - -.. autofunction:: paddle.v2.fluid.layers.dynamic_gru - :noindex: - -gru_unit --------- - -.. autofunction:: paddle.v2.fluid.layers.gru_unit - :noindex: - -linear_chain_crf ----------------- - -.. autofunction:: paddle.v2.fluid.layers.linear_chain_crf - :noindex: - -crf_decoding ------------- - -.. autofunction:: paddle.v2.fluid.layers.crf_decoding - :noindex: - -cos_sim -------- - -.. autofunction:: paddle.v2.fluid.layers.cos_sim - :noindex: - -cross_entropy -------------- - -.. autofunction:: paddle.v2.fluid.layers.cross_entropy - :noindex: - -square_error_cost ------------------ - -.. autofunction:: paddle.v2.fluid.layers.square_error_cost - :noindex: - -accuracy --------- - -.. autofunction:: paddle.v2.fluid.layers.accuracy - :noindex: - -chunk_eval ----------- - -.. autofunction:: paddle.v2.fluid.layers.chunk_eval - :noindex: - -sequence_conv -------------- - -.. autofunction:: paddle.v2.fluid.layers.sequence_conv - :noindex: - -conv2d ------- - -.. autofunction:: paddle.v2.fluid.layers.conv2d - :noindex: - -sequence_pool -------------- - -.. autofunction:: paddle.v2.fluid.layers.sequence_pool - :noindex: - -pool2d ------- - -.. autofunction:: paddle.v2.fluid.layers.pool2d - :noindex: - -batch_norm ----------- - -.. autofunction:: paddle.v2.fluid.layers.batch_norm - :noindex: - -layer_norm ----------- - -.. autofunction:: paddle.v2.fluid.layers.layer_norm - :noindex: - -beam_search_decode ------------------- - -.. autofunction:: paddle.v2.fluid.layers.beam_search_decode - :noindex: - -conv2d_transpose ----------------- - -.. autofunction:: paddle.v2.fluid.layers.conv2d_transpose - :noindex: - -sequence_expand ---------------- - -.. autofunction:: paddle.v2.fluid.layers.sequence_expand - :noindex: - -lstm_unit ---------- - -.. autofunction:: paddle.v2.fluid.layers.lstm_unit - :noindex: - -reduce_sum ----------- - -.. autofunction:: paddle.v2.fluid.layers.reduce_sum - :noindex: - -reduce_mean ------------ - -.. autofunction:: paddle.v2.fluid.layers.reduce_mean - :noindex: - -reduce_max ----------- - -.. autofunction:: paddle.v2.fluid.layers.reduce_max - :noindex: - -reduce_min ----------- - -.. autofunction:: paddle.v2.fluid.layers.reduce_min - :noindex: - -sequence_first_step -------------------- - -.. autofunction:: paddle.v2.fluid.layers.sequence_first_step - :noindex: - -sequence_last_step ------------------- - -.. autofunction:: paddle.v2.fluid.layers.sequence_last_step - :noindex: - -dropout -------- - -.. autofunction:: paddle.v2.fluid.layers.dropout - :noindex: - -split ------ - -.. autofunction:: paddle.v2.fluid.layers.split - :noindex: - -ctc_greedy_decoder ------------------- - -.. autofunction:: paddle.v2.fluid.layers.ctc_greedy_decoder - :noindex: - -edit_distance -------------- - -.. autofunction:: paddle.v2.fluid.layers.edit_distance - :noindex: - -l2_normalize ------------- - -.. autofunction:: paddle.v2.fluid.layers.l2_normalize - :noindex: - -matmul ------- - -.. autofunction:: paddle.v2.fluid.layers.matmul - :noindex: - -warpctc -------- - -.. autofunction:: paddle.v2.fluid.layers.warpctc - :noindex: - -sequence_reshape ----------------- - -.. autofunction:: paddle.v2.fluid.layers.sequence_reshape - :noindex: - -transpose ---------- - -.. autofunction:: paddle.v2.fluid.layers.transpose - :noindex: - -im2sequence ------------ - -.. autofunction:: paddle.v2.fluid.layers.im2sequence - :noindex: - -nce ---- - -.. autofunction:: paddle.v2.fluid.layers.nce - :noindex: - -beam_search ------------ - -.. autofunction:: paddle.v2.fluid.layers.beam_search - :noindex: - -row_conv --------- - -.. autofunction:: paddle.v2.fluid.layers.row_conv - :noindex: - -multiplex ---------- - -.. autofunction:: paddle.v2.fluid.layers.multiplex - :noindex: - -ops -=== - -mean ----- - -.. autofunction:: paddle.v2.fluid.layers.mean - :noindex: - -mul ---- - -.. autofunction:: paddle.v2.fluid.layers.mul - :noindex: - -reshape -------- - -.. autofunction:: paddle.v2.fluid.layers.reshape - :noindex: - -scale ------ - -.. autofunction:: paddle.v2.fluid.layers.scale - :noindex: - -sigmoid_cross_entropy_with_logits ---------------------------------- - -.. autofunction:: paddle.v2.fluid.layers.sigmoid_cross_entropy_with_logits - :noindex: - -elementwise_add ---------------- - -.. autofunction:: paddle.v2.fluid.layers.elementwise_add - :noindex: - -elementwise_div ---------------- - -.. autofunction:: paddle.v2.fluid.layers.elementwise_div - :noindex: - -elementwise_sub ---------------- - -.. autofunction:: paddle.v2.fluid.layers.elementwise_sub - :noindex: - -elementwise_mul ---------------- - -.. autofunction:: paddle.v2.fluid.layers.elementwise_mul - :noindex: - -elementwise_max ---------------- - -.. autofunction:: paddle.v2.fluid.layers.elementwise_max - :noindex: - -elementwise_min ---------------- - -.. autofunction:: paddle.v2.fluid.layers.elementwise_min - :noindex: - -elementwise_pow ---------------- - -.. autofunction:: paddle.v2.fluid.layers.elementwise_pow - :noindex: - -clip ----- - -.. autofunction:: paddle.v2.fluid.layers.clip - :noindex: - -clip_by_norm ------------- - -.. autofunction:: paddle.v2.fluid.layers.clip_by_norm - :noindex: - -sequence_softmax ----------------- - -.. autofunction:: paddle.v2.fluid.layers.sequence_softmax - :noindex: - -sigmoid -------- - -.. autofunction:: paddle.v2.fluid.layers.sigmoid - :noindex: - -logsigmoid ----------- - -.. autofunction:: paddle.v2.fluid.layers.logsigmoid - :noindex: - -exp ---- - -.. autofunction:: paddle.v2.fluid.layers.exp - :noindex: - -relu ----- - -.. autofunction:: paddle.v2.fluid.layers.relu - :noindex: - -tanh ----- - -.. autofunction:: paddle.v2.fluid.layers.tanh - :noindex: - -tanh_shrink ------------ - -.. autofunction:: paddle.v2.fluid.layers.tanh_shrink - :noindex: - -softshrink ----------- - -.. autofunction:: paddle.v2.fluid.layers.softshrink - :noindex: - -sqrt ----- - -.. autofunction:: paddle.v2.fluid.layers.sqrt - :noindex: - -abs ---- - -.. autofunction:: paddle.v2.fluid.layers.abs - :noindex: - -ceil ----- - -.. autofunction:: paddle.v2.fluid.layers.ceil - :noindex: - -floor ------ - -.. autofunction:: paddle.v2.fluid.layers.floor - :noindex: - -round ------ - -.. autofunction:: paddle.v2.fluid.layers.round - :noindex: - -reciprocal ----------- - -.. autofunction:: paddle.v2.fluid.layers.reciprocal - :noindex: - -log ---- - -.. autofunction:: paddle.v2.fluid.layers.log - :noindex: - -square ------- - -.. autofunction:: paddle.v2.fluid.layers.square - :noindex: - -softplus --------- - -.. autofunction:: paddle.v2.fluid.layers.softplus - :noindex: - -softsign --------- - -.. autofunction:: paddle.v2.fluid.layers.softsign - :noindex: - -brelu ------ - -.. autofunction:: paddle.v2.fluid.layers.brelu - :noindex: - -leaky_relu ----------- - -.. autofunction:: paddle.v2.fluid.layers.leaky_relu - :noindex: - -soft_relu ---------- - -.. autofunction:: paddle.v2.fluid.layers.soft_relu - :noindex: - -elu ---- - -.. autofunction:: paddle.v2.fluid.layers.elu - :noindex: - -relu6 ------ - -.. autofunction:: paddle.v2.fluid.layers.relu6 - :noindex: - -pow ---- - -.. autofunction:: paddle.v2.fluid.layers.pow - :noindex: - -stanh ------ - -.. autofunction:: paddle.v2.fluid.layers.stanh - :noindex: - -hard_shrink ------------ - -.. autofunction:: paddle.v2.fluid.layers.hard_shrink - :noindex: - -thresholded_relu ----------------- - -.. autofunction:: paddle.v2.fluid.layers.thresholded_relu - :noindex: - -hard_sigmoid ------------- - -.. autofunction:: paddle.v2.fluid.layers.hard_sigmoid - :noindex: - -swish ------ - -.. autofunction:: paddle.v2.fluid.layers.swish - :noindex: - -tensor -====== - -create_tensor -------------- - -.. autofunction:: paddle.v2.fluid.layers.create_tensor - :noindex: - -create_parameter ----------------- - -.. autofunction:: paddle.v2.fluid.layers.create_parameter - :noindex: - -create_global_var ------------------ - -.. autofunction:: paddle.v2.fluid.layers.create_global_var - :noindex: - -cast ----- - -.. autofunction:: paddle.v2.fluid.layers.cast - :noindex: - -concat ------- - -.. autofunction:: paddle.v2.fluid.layers.concat - :noindex: - -sums ----- - -.. autofunction:: paddle.v2.fluid.layers.sums - :noindex: - -assign ------- - -.. autofunction:: paddle.v2.fluid.layers.assign - :noindex: - -fill_constant_batch_size_like ------------------------------ - -.. autofunction:: paddle.v2.fluid.layers.fill_constant_batch_size_like - :noindex: - -fill_constant -------------- - -.. autofunction:: paddle.v2.fluid.layers.fill_constant - :noindex: - -ones ----- - -.. autofunction:: paddle.v2.fluid.layers.ones - :noindex: - -zeros ------ - -.. autofunction:: paddle.v2.fluid.layers.zeros - :noindex: - diff --git a/doc/design/concurrent_programming.md b/doc/design/concurrent_programming.md index afc65e831d58ff427663806e56294292ccbef85b..f022e67fd3a048cd7e53c91d9a1fd0506487b665 100644 --- a/doc/design/concurrent_programming.md +++ b/doc/design/concurrent_programming.md @@ -12,7 +12,7 @@ The following table compares concepts in Fluid and Go | Go | Fluid | |----|-------| -|user-defined functions | [layers](https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle/v2/fluid) | +|user-defined functions | [layers](https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle/fluid) | | control-flow and built-in functions | [intrinsics/operators](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/operators) | | goroutines, channels | [class ThreadPool](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/framework/thread_pool.h) | | runtime | [class Executor](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/executor.h) | diff --git a/doc/design/fluid.md b/doc/design/fluid.md index 2acc168007d25a083f588b48f84e12e29baf4f47..f78fa8c1914124f33b9730f918c8887ced4f8d9d 100644 --- a/doc/design/fluid.md +++ b/doc/design/fluid.md @@ -89,7 +89,7 @@ with train_loop.block(): h[t] = the_step(input[t]) ``` -An actual Fluid example is described [here](https://github.com/PaddlePaddle/Paddle/blob/a91efdde6910ce92a78e3aa7157412c4c88d9ee8/python/paddle/v2/fluid/tests/test_while_op.py#L36-L44). +An actual Fluid example is described [here](https://github.com/PaddlePaddle/Paddle/blob/bde090a97564b9c61a6aaa38b72ccc4889d102d9/python/paddle/fluid/tests/unittests/test_while_op.py#L50-L58). From the example, the Fluid programs look very similar to their PyTorch equivalent programs, except that Fluid's loop structure, wrapped with Python's `with` statement, could run much faster than just a Python loop. diff --git a/doc/design/memory_optimization.md b/doc/design/memory_optimization.md index 1f68cef4cc28cd005acbeaa5c03cc0d84a83939c..285464ada728d8f7a086a26beca6cfa4418e98e4 100644 --- a/doc/design/memory_optimization.md +++ b/doc/design/memory_optimization.md @@ -101,7 +101,7 @@ In-place is a built-in attribute of an operator. Since we treat in-place and oth #### contruct control flow graph -Following is the ProgramDesc protobuf of [machine translation](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/fluid/tests/book/test_machine_translation.py) example. +Following is the ProgramDesc protobuf of [machine translation](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/tests/book/test_machine_translation.py) example. - Block0: diff --git a/doc/design/parallel_do.md b/doc/design/parallel_do.md new file mode 100644 index 0000000000000000000000000000000000000000..45f7731996519b87fc591ee8ce831341d7ab2965 --- /dev/null +++ b/doc/design/parallel_do.md @@ -0,0 +1,162 @@ +# Design Doc: Parallel_Do in PaddlePaddle + +In PaddlePaddle, we use parallel_do primitive to represent multithread data parallel processing. + +## Design overview + +The definition of a parallel_do op looks like the following + +```c++ +AddInput(kInputs, "Inputs needed to be split onto different devices").AsDuplicable(); +AddInput(kParameters, "Parameters are duplicated over different devices") + .AsDuplicable(); +AddInput(kPlaces, "Devices used for parallel processing"); +AddOutput(kOutputs, "Outputs needed to be merged from different devices").AsDuplicable(); +AddOutput(kParallelScopes, + "Scopes for all local variables in forward pass. One scope for each device"); +AddAttr(kParallelBlock, + "List of operaters to be executed in parallel"); +``` + +A vanilla implementation of parallel_do can be shown as the following (`|` means single thread and +`||||` means multiple threads) + +``` +In the forward pass + | Split input onto different devices + | Copy parameter onto different devices + |||| Compute forward pass in parallel + | Merge output from different devices + +In the backward pass + | Split output@grad onto different devices + |||| Compute backward pass in parallel + | accumulate param@grad from different devices to the first device + | Merge input@grad from different devices +  | Copy param@grad to the place of parallel_do_op +``` + +This implementation allows to write mixed device program like this + +```python +# get embedding feature on CPU +feature = some_cpu_only_op(data) + +gpu_places = get_place(use_gpu=True) +# parallel processing on multiple GPUs +pd = ParallelDo(gpu_places) +with pd.do(): + read_input(feature) + prediction = my_net(feature) + write_output(prediction) +prediction = pd() +loss = cross_entropy(prediction, label) +``` + +And the programDesc are like the following + +``` +# start_program will be run by executor(CPUPlace), all w1, w2 will be allocated on CPU +start_program +{ + vars: w1, w2 + ops: init(w1), init(w2) +} + +main_program +{ +block0 { + vars: data, places, w1, w2 + ops: data, get_place, parallel_do(block1), + parallel_do_grad(block2), + sgd(w2, w2_grad), + sgd(w1, w1_grad) +} +block1 { + parent_block: 0 + vars: data, h1, h2, loss + ops: fc, fc, softmax +} +block2 { + parent_block: 1 + vars: data_grad, h1_grad, h2_grad, loss_gard, w1_grad, w2_grad + ops: softmax_grad, + fc_grad + fc_grad +} +} +``` + +## Performance Imporvement + +There are serial places we can make this parallel_do faster. + +### forward: split input onto different devices + +If the input of the parallel_do is independent from any prior opeartors, we can avoid this step by +prefetching the input onto different devices in a seperate background thread. And the python code +looks like this. +```python +pd = ParallelDo(gpu_places) +with pd.do(): +    feature = get_data_from_prefetch_queue(gpu_places) + prediction = my_net(feature) + write_output(activation) +``` + +### forward: Copy parameter to onto different devices + +We can avoid this step by making each device have a copy of the parameter. This requires: + +1. `fluid.default_start_up_program()` to be run on all devices +1. In the backward, allreduce param@grad at different devices, this requires + 1. `backward.py` add `allreduce` operators at parallel_do_grad + 1. `allreduce` operators need to be called in async mode to achieve maximum throughput +1. apply gradients related op(i.e. cliping, normalization, decay, sgd) on different devices in parallel + +By doing so, we also avoided "backward: accumulate param@grad from different devices to the first device". +And the ProgramDesc looks like the following + +``` +# w1, w2 will be allocated on all GPUs +start_program +{ +block0 { + parallel_do(block1) +} +block1 { + parent_block: 0 + vars: w1, w2 + ops: init(w1), init(w2) +} +} + +main_program +{ +block0 { + vars: data, places, w1, w2 + ops: data, get_place, parallel_do(block1), + parallel_do_grad(block2), # append_backward + parallel_do(block3) # append_optimization + +} +block1 { + parent_block: 0 + vars: data, h1, h2, loss + ops: fc, fc, softmax +} +block2 { + parent_block: 1 + vars: data_grad, h1_grad, h2_grad, loss_gard, w1_grad, w2_grad + ops: softmax_grad, + fc_grad, allreduce(places, scopes, w1_grad), + fc_grad, allreduce(places, scopes, w2_grad) +} +block3 { + parent_block: 0 + vars: lr + ops: sgd(w2, w2_grad), + sgd(w1, w1_grad) +} +} +``` diff --git a/doc/design/var_desc.md b/doc/design/var_desc.md index 89fa95326c5c4909137544c6b5fd574e1281abe2..6a45af1995463402ba9c65ddb51c6c8bb107f99e 100644 --- a/doc/design/var_desc.md +++ b/doc/design/var_desc.md @@ -1,10 +1,10 @@ ## Background PaddlePaddle divides the description of neural network computation into two stages: compile time and runtime. At compile time, the neural network computation is described as a `ProgramDesc` whereas at runtime an `Executor` interprets the `ProgramDesc` to compute the operations. -PaddlePaddle use proto message to describe compile time program because +PaddlePaddle uses proto message to describe compile time program because : 1. The computation program description must be serializable and saved in a file. -1. During distributed training, the sreialized program will be sent to multiple workers. It should also be possible to break the program into different components, each of which can be executed on different workers. +1. During distributed training, the serialized program will be sent to multiple workers. It should also be possible to break the program into different components, each of which can be executed on a different worker. The computation `Program` consists of nested `Blocks`. Each `Block` will consist of data(i.e. `Variable`) and `Operations`. The concept to represent them is in the table below. @@ -14,28 +14,33 @@ The computation `Program` consists of nested `Blocks`. Each `Block` will consist |Operation|OpDesc(proto)|Operator(cpp)| -## Definition of VarDesc +## Definition of VarType -A VarDesc should have a name, and value. The are two kinds of variable type in compile time, they are `LoDTensor` and `SelectedRows`. +A VarDesc should have a name, type and whether or not it is persistable. The are different kinds of variable types supported in PaddlePaddle, apart from the POD_Types like: `LOD_TENSOR`, `SELECTED_ROWS`, `FEED_MINIBATCH`, `FETCH_LIST`, `STEP_SCOPES`, `LOD_RANK_TABLE`, `LOD_TENSOR_ARRAY`, `PLACE_LIST`, `READER` and `CHANNEL`. These are declared inside `VarType`. A `VarDesc` then looks as the following: ```proto message VarDesc { required string name = 1; - enum VarType { - LOD_TENSOR = 0; - SELECTED_ROWS = 1; - } required VarType type = 2; - optional LoDTensorDesc lod_desc = 3; - optional TensorDesc selected_rows_desc = 4; - optional bool persistable = 5 [ default = false ]; + optional bool persistable = 3 [ default = false ]; } ``` ## Definition of TensorDesc ```proto -enum DataType { +message TensorDesc { + // Should only be PODType. Is enforced in C++ + required Type data_type = 1; + repeated int64 dims = 2; // [UNK, 640, 480] is saved as [-1, 640, 480] +} +``` + +The `Type` here comes from the enum defined inside of `VarType` : + +```proto +enum Type { + // Pod Types BOOL = 0; INT16 = 1; INT32 = 2; @@ -43,11 +48,18 @@ enum DataType { FP16 = 4; FP32 = 5; FP64 = 6; -} -message TensorDesc { - required DataType data_type = 1; - repeated int64 dims = 2; // [UNK, 640, 480] is saved as [-1, 640, 480] + // Other types that may need additional descriptions + LOD_TENSOR = 7; + SELECTED_ROWS = 8; + FEED_MINIBATCH = 9; + FETCH_LIST = 10; + STEP_SCOPES = 11; + LOD_RANK_TABLE = 12; + LOD_TENSOR_ARRAY = 13; + PLACE_LIST = 14; + READER = 15; + CHANNEL = 16; } ``` @@ -58,7 +70,7 @@ A TensorDesc describes `SelectedRows` and `LoDTensor`. For details of `SelectedR ```proto message LoDTensorDesc { required TensorDesc tensor = 1; - optional int lod_level = 2; + optional int32 lod_level = 2 [ default = 0 ]; } ``` diff --git a/doc/faq/local/src/reduce_min_pool_size.py b/doc/faq/local/src/reduce_min_pool_size.py index 9efdb5707ac4a0cb701ec4fef6dfff399d6150cb..cba96652f764d26c724ea22697e04572709bf6a4 100644 --- a/doc/faq/local/src/reduce_min_pool_size.py +++ b/doc/faq/local/src/reduce_min_pool_size.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/faq/local/src/word2vec_config.py b/doc/faq/local/src/word2vec_config.py index b4fcf0960eda37f98f9f7f2949148f8d51cd2008..a5b84e8ed4de5123097026a5c7992b06fd321750 100644 --- a/doc/faq/local/src/word2vec_config.py +++ b/doc/faq/local/src/word2vec_config.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/faq/local/src/word2vec_dataprovider.py b/doc/faq/local/src/word2vec_dataprovider.py index 3b6273b0574fb54a7c374a1f19fdd993fff5c730..9fe67b6d6cbbbdc8a98d497f352cf114a882636f 100644 --- a/doc/faq/local/src/word2vec_dataprovider.py +++ b/doc/faq/local/src/word2vec_dataprovider.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/getstarted/concepts/src/infer.py b/doc/getstarted/concepts/src/infer.py index a1b60388c45ae83cbed3b5597e8b8aef5d69f814..afe256f234a1c7d29c33f3b65b8302646df0c45c 100644 --- a/doc/getstarted/concepts/src/infer.py +++ b/doc/getstarted/concepts/src/infer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/getstarted/concepts/src/train.py b/doc/getstarted/concepts/src/train.py index 0e5bdb57bc95c513eb67d426741c860a34d37dd0..a85d5d8a3acee61d11488e5b842831a79072680a 100644 --- a/doc/getstarted/concepts/src/train.py +++ b/doc/getstarted/concepts/src/train.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/howto/cluster/fluid_cluster_train_en.md b/doc/howto/cluster/fluid_cluster_train_en.md index ae825d9a517c7e9005d4e32f8f34b3f6a79be0c9..b4465e8269c2e1603c02404ea33f8c4572e76442 100644 --- a/doc/howto/cluster/fluid_cluster_train_en.md +++ b/doc/howto/cluster/fluid_cluster_train_en.md @@ -32,7 +32,7 @@ The non-cluster version of this demo with fluid API is as follows: ``` python import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid x = fluid.layers.data(name='x', shape=[13], dtype='float32') y_predict = fluid.layers.fc(input=x, size=1, act=None) @@ -125,11 +125,11 @@ for pass_id in range(100): ### E2E demo -Please find the complete demo from [here](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/fluid/tests/book_distribute/notest_dist_fit_a_line.py). +Please find the complete demo from [here](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/tests/book_distribute/notest_dist_fit_a_line.py). First `cd` into the folder that contains the `python` files. In this case: ```bash -cd /paddle/python/paddle/v2/fluid/tests/book_distribute +cd /paddle/python/paddle/fluid/tests/book_distribute ``` In parameter server node run the following in the command line: diff --git a/doc/howto/cluster/src/word2vec/api_train_v2.py b/doc/howto/cluster/src/word2vec/api_train_v2.py index 9a65f14628d8a0808dce25187b482354c72a838d..9107e24c175f1fbf29d86e222e4b66031a5b505e 100644 --- a/doc/howto/cluster/src/word2vec/api_train_v2.py +++ b/doc/howto/cluster/src/word2vec/api_train_v2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/howto/cluster/src/word2vec/api_train_v2_cluster.py b/doc/howto/cluster/src/word2vec/api_train_v2_cluster.py index 2afce9a66e521f9e3a8d566dd23762969f0594f5..791504094f3ecae925226ff1d90f20f91d4c018d 100644 --- a/doc/howto/cluster/src/word2vec/api_train_v2_cluster.py +++ b/doc/howto/cluster/src/word2vec/api_train_v2_cluster.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/howto/cluster/src/word2vec/prepare.py b/doc/howto/cluster/src/word2vec/prepare.py index ade01c378efced05787e1f62e6fa6c38f8ac5ad3..a42548fbf03a0298e1e397c868e4d531801ec89a 100644 --- a/doc/howto/cluster/src/word2vec/prepare.py +++ b/doc/howto/cluster/src/word2vec/prepare.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/doc/howto/optimization/cpu_profiling_cn.md b/doc/howto/optimization/cpu_profiling_cn.md index 14eba0e2f34b115f5cd24920b5b1af07ec953d00..d59be670c2b33b64d9b6f96b53f50e5bf9f0613b 100644 --- a/doc/howto/optimization/cpu_profiling_cn.md +++ b/doc/howto/optimization/cpu_profiling_cn.md @@ -35,7 +35,7 @@ cprofilev -a 0.0.0.0 -p 3214 -f profile.out main.py ``` ncalls tottime percall cumtime percall filename:lineno(function) 1 0.284 0.284 29.514 29.514 main.py:1() - 4696 0.128 0.000 15.748 0.003 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/executor.py:20(run) + 4696 0.128 0.000 15.748 0.003 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/executor.py:20(run) 4696 12.040 0.003 12.040 0.003 {built-in method run} 1 0.144 0.144 6.534 6.534 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/__init__.py:14() ``` @@ -61,9 +61,9 @@ cprofilev -a 0.0.0.0 -p 3214 -f profile.out main.py ```text 4696 12.040 0.003 12.040 0.003 {built-in method run} 300005 0.874 0.000 1.681 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/dataset/mnist.py:38(reader) - 107991 0.676 0.000 1.519 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:219(__init__) - 4697 0.626 0.000 2.291 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:428(sync_with_cpp) - 1 0.618 0.618 0.618 0.618 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/__init__.py:1() + 107991 0.676 0.000 1.519 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:219(__init__) + 4697 0.626 0.000 2.291 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:428(sync_with_cpp) + 1 0.618 0.618 0.618 0.618 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/__init__.py:1() ``` 可以看到最耗时的函数是C++端的`run`函数。这需要联合我们第二节`Python`与`C++`混合代码的性能分析来进行调优。而`sync_with_cpp`函数的总共耗时很长,每次调用的耗时也很长。于是我们可以点击`sync_with_cpp`的详细信息,了解其调用关系。 @@ -76,9 +76,9 @@ Called By: Function was called by... ncalls tottime cumtime -/home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:428(sync_with_cpp) <- 4697 0.626 2.291 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:562(sync_with_cpp) -/home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:562(sync_with_cpp) <- 4696 0.019 2.316 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:487(clone) - 1 0.000 0.001 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:534(append_backward) +/home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:428(sync_with_cpp) <- 4697 0.626 2.291 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:562(sync_with_cpp) +/home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:562(sync_with_cpp) <- 4696 0.019 2.316 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:487(clone) + 1 0.000 0.001 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:534(append_backward) Called: diff --git a/doc/howto/optimization/cpu_profiling_en.md b/doc/howto/optimization/cpu_profiling_en.md index 368af40cc7308cf6f4c609361078fe3ba02213ed..01e5fddf61547f9fc86ef18a6f2e2ac508d22dbb 100644 --- a/doc/howto/optimization/cpu_profiling_en.md +++ b/doc/howto/optimization/cpu_profiling_en.md @@ -49,7 +49,7 @@ port, we will see the output like the following: ``` ncalls tottime percall cumtime percall filename:lineno(function) 1 0.284 0.284 29.514 29.514 main.py:1() - 4696 0.128 0.000 15.748 0.003 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/executor.py:20(run) + 4696 0.128 0.000 15.748 0.003 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/executor.py:20(run) 4696 12.040 0.003 12.040 0.003 {built-in method run} 1 0.144 0.144 6.534 6.534 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/__init__.py:14() ``` @@ -74,9 +74,9 @@ focus on. We can sort above profiling file by tottime: ```text 4696 12.040 0.003 12.040 0.003 {built-in method run} 300005 0.874 0.000 1.681 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/dataset/mnist.py:38(reader) - 107991 0.676 0.000 1.519 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:219(__init__) - 4697 0.626 0.000 2.291 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:428(sync_with_cpp) - 1 0.618 0.618 0.618 0.618 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/__init__.py:1() + 107991 0.676 0.000 1.519 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:219(__init__) + 4697 0.626 0.000 2.291 0.000 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:428(sync_with_cpp) + 1 0.618 0.618 0.618 0.618 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/__init__.py:1() ``` We can see that the most time-consuming function is the `built-in @@ -93,9 +93,9 @@ Called By: Function was called by... ncalls tottime cumtime -/home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:428(sync_with_cpp) <- 4697 0.626 2.291 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:562(sync_with_cpp) -/home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:562(sync_with_cpp) <- 4696 0.019 2.316 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:487(clone) - 1 0.000 0.001 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/v2/fluid/framework.py:534(append_backward) +/home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:428(sync_with_cpp) <- 4697 0.626 2.291 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:562(sync_with_cpp) +/home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:562(sync_with_cpp) <- 4696 0.019 2.316 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:487(clone) + 1 0.000 0.001 /home/yuyang/perf_test/.env/lib/python2.7/site-packages/paddle/fluid/framework.py:534(append_backward) Called: diff --git a/doc/howto/read_source.md b/doc/howto/read_source.md index 31987920f32f217ac2db42548874cfe7da57dd72..edf46aff8c6cc9fc01d26c6453b3a8123238ef91 100644 --- a/doc/howto/read_source.md +++ b/doc/howto/read_source.md @@ -1,6 +1,6 @@ # PaddlePaddle Fluid Source Code Overview -Examples: https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle/v2/fluid/tests/book +Examples: https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle/fluid/tests/book Core: https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/framework @@ -26,16 +26,16 @@ sgd_optimizer = fluid.optimizer.SGD(learning_rate=0.001) sgd_optimizer.minimize(avg_cost) ``` -- Variables: `x`, `y`, `y_predict`, `cost` and `avg_cost`. [Python](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/fluid/framework.py#) -- Layers: `fluid.layers.data`, `fluid.layers.fc` and `fluid.layers.mean` are layers. [Python](https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle/v2/fluid/layers) +- Variables: `x`, `y`, `y_predict`, `cost` and `avg_cost`. [Python](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/framework.py#) +- Layers: `fluid.layers.data`, `fluid.layers.fc` and `fluid.layers.mean` are layers. [Python](https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle/fluid/layers) - Every Layer has one or more operators and variables/parameters - All the operators are defined at [`paddle/operators/`](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/operators). Other worth-looking files: - Base class: [`paddle/framework/operator.h`](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/operator.h) - Operator Registration: [`paddle/framework/op_registry.h`](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/op_registry.h) - Operator Lookup: [`paddle/framework/op_info.h`](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/op_info.h) - Optimizer: `fluid.optimizer.SGD`. It does the following - - Add backward operators. [[Python](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/fluid/backward.py)] - - Add optimizer operators. [[Python](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/fluid/optimizer.py)] + - Add backward operators. [[Python](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/backward.py)] + - Add optimizer operators. [[Python](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/optimizer.py)] # Run Time @@ -57,7 +57,7 @@ exe.run(fluid.default_main_program(), - Place: `place`. one of CPU, GPU or FPGA. [C++](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/platform/place.h) - The device handle are at [paddle/platform/device_context.h](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/platform/device_context.h) -- Executor: `fluid.Executor(place)`. [[Python](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/fluid/executor.py), [C++](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/executor.cc)] +- Executor: `fluid.Executor(place)`. [[Python](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/executor.py), [C++](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/executor.cc)] - Feeds the data: `feed=feeder.feed(data)` - Evaluates all the operators - Fetches the result: `fetch_list=[avg_cost]` diff --git a/doc/templates/conf.py.cn.in b/doc/templates/conf.py.cn.in index d134aad794b0a630dfc8395c484d111bc5462d9b..c8da4a790be041d673a749cf200dadb839fb3a62 100644 --- a/doc/templates/conf.py.cn.in +++ b/doc/templates/conf.py.cn.in @@ -18,6 +18,7 @@ import shlex from recommonmark import parser, transform import paddle import paddle.v2 +import paddle.fluid MarkdownParser = parser.CommonMarkParser AutoStructify = transform.AutoStructify diff --git a/doc/templates/conf.py.en.in b/doc/templates/conf.py.en.in index 1f057d2e839896722fedba6634607bcdf2fd893a..a4cb2b7170fc8cdfb05e97738f7b6feb8165fce0 100644 --- a/doc/templates/conf.py.en.in +++ b/doc/templates/conf.py.en.in @@ -18,6 +18,7 @@ import shlex from recommonmark import parser, transform import paddle import paddle.v2 +import paddle.fluid MarkdownParser = parser.CommonMarkParser diff --git a/go/CMakeLists.txt b/go/CMakeLists.txt index 29ce909c6442014fa0b64c6ca018a61b92c840e9..f3a9296c2c66cd96419cae37c3ac2c93c2b033f5 100644 --- a/go/CMakeLists.txt +++ b/go/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/cmd/master/CMakeLists.txt b/go/cmd/master/CMakeLists.txt index 9e149967e71c9439bb00b973aa8723a809604aaf..fc99d8d3bd1ec1941b7a068cf8417f0663dea8c0 100644 --- a/go/cmd/master/CMakeLists.txt +++ b/go/cmd/master/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/cmd/master/master.go b/go/cmd/master/master.go index f57db1c0a0107c4fd74b81aedaf4a58ff2a132ec..537df59c860a3cb77ecd8287cd352397d7f7a4e4 100644 --- a/go/cmd/master/master.go +++ b/go/cmd/master/master.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/cmd/pserver/CMakeLists.txt b/go/cmd/pserver/CMakeLists.txt index 51db6dff043db362460dcbb7328c99d3cdd51a9b..20d033c938648d1b1e5c5ed1b8a738a543c325cf 100644 --- a/go/cmd/pserver/CMakeLists.txt +++ b/go/cmd/pserver/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/cmd/pserver/pserver.go b/go/cmd/pserver/pserver.go index 1358801c1cf7f2e89f8e463560d25145d881d01d..271274cafc5c94a2c89ac211dba7a3a2bd232026 100644 --- a/go/cmd/pserver/pserver.go +++ b/go/cmd/pserver/pserver.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/connection/conn.go b/go/connection/conn.go index ffa8db689da307277f0943a0a71c7ace5ab21887..b8353e8e18ed7b40bab057d6226637df1e6e569a 100644 --- a/go/connection/conn.go +++ b/go/connection/conn.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/master/CMakeLists.txt b/go/master/CMakeLists.txt index 93efa4eaf7da8d502a17ec617823d08195c5e9ee..b5101c3479d708418dd662b84e09ad74af86adbe 100644 --- a/go/master/CMakeLists.txt +++ b/go/master/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/master/c/CMakeLists.txt b/go/master/c/CMakeLists.txt index 082d9f3f597db14d0731e0292d3b66d92a49d6c1..58b44e6445b63e12eb7d9bfdee93239cf1fab899 100644 --- a/go/master/c/CMakeLists.txt +++ b/go/master/c/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/master/c/client.go b/go/master/c/client.go index 9a3960d59cd950ba68213ac53a51bfc4e68c0546..42c176d00bd56f989b05e1d128b5ce030d220c77 100644 --- a/go/master/c/client.go +++ b/go/master/c/client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/master/client.go b/go/master/client.go index 7bcf86955348fad14cbe86e2180539372fcb82cf..e43903dd14e74047119d9dcea2adc431357305ee 100644 --- a/go/master/client.go +++ b/go/master/client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/master/client_internal_test.go b/go/master/client_internal_test.go index 2f13fd0dcda85ee10669133ed011f47ce418b61c..37028a9e1f884f6660bf1c5630980dccae2beb01 100644 --- a/go/master/client_internal_test.go +++ b/go/master/client_internal_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/master/client_test.go b/go/master/client_test.go index 1963dbfd732605d3b2612f10a047c3a03faa53be..01ecad2deada7978e6fe030a6f2d25e533749568 100644 --- a/go/master/client_test.go +++ b/go/master/client_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/master/etcd_client.go b/go/master/etcd_client.go index 2a41d36949cb19d9076c0ed00c8db6e235f1296c..36fe61127443dc8f6386295acb1a711d6a93b11c 100644 --- a/go/master/etcd_client.go +++ b/go/master/etcd_client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/master/inmem_store.go b/go/master/inmem_store.go index a5bd2d4fe150cd34c699ccfae1f3d3e0fb2ef3d6..33b4714317ff3f1ebbf312ac3a231cd9383bf224 100644 --- a/go/master/inmem_store.go +++ b/go/master/inmem_store.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/master/service.go b/go/master/service.go index f3501028800c850a521d4b08db323cb70fe926d2..39f746e528e0c91ecf0f3ccacb01520bab81e0a4 100644 --- a/go/master/service.go +++ b/go/master/service.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/master/service_internal_test.go b/go/master/service_internal_test.go index bd1a939a55553b558181d91a757c487d0f97b40b..dd22f3d548b99ac11250735c74bca3dfca46cf86 100644 --- a/go/master/service_internal_test.go +++ b/go/master/service_internal_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/CMakeLists.txt b/go/pserver/CMakeLists.txt index 9ac05199e7ab76c21275838092c0afbdf2612b77..32f3b2baba37238f0ca75e9177f9afa3dcfd4156 100644 --- a/go/pserver/CMakeLists.txt +++ b/go/pserver/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/pserver/client/CMakeLists.txt b/go/pserver/client/CMakeLists.txt index e295611060043a77bb1f19fc7053beddc9fbc327..1d6f45a6642fa8819050f8a21c212369b52d1112 100644 --- a/go/pserver/client/CMakeLists.txt +++ b/go/pserver/client/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/pserver/client/c/CMakeLists.txt b/go/pserver/client/c/CMakeLists.txt index a932791c7cb003dc812de4eed923e7c10b25c363..78776219dee06da09e8b6956cd7bc132fb28552b 100644 --- a/go/pserver/client/c/CMakeLists.txt +++ b/go/pserver/client/c/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/pserver/client/c/cclient.go b/go/pserver/client/c/cclient.go index 2eeec1b6b3c28556e02780e40ae5d6b693dce484..cddc28e46f48799f8643732283c94216e1f5cfb1 100644 --- a/go/pserver/client/c/cclient.go +++ b/go/pserver/client/c/cclient.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/client/c/test/CMakeLists.txt b/go/pserver/client/c/test/CMakeLists.txt index 3724ccb60b72bf446058c26c7ad3ee4d23f1ccce..411dc50332672143d7a1f7bd0556ae86dc37f6f3 100644 --- a/go/pserver/client/c/test/CMakeLists.txt +++ b/go/pserver/client/c/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/pserver/client/c/test/test_cclient.c b/go/pserver/client/c/test/test_cclient.c index 05ec421fff6e1c57b0bace080668d3793f85480f..0116e42a0a67f757a786aa6dc9f8097af656d8b2 100644 --- a/go/pserver/client/c/test/test_cclient.c +++ b/go/pserver/client/c/test/test_cclient.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/go/pserver/client/c/test/test_mnist.py b/go/pserver/client/c/test/test_mnist.py index 821d9adfcb3164b0982873354badc382b13645ea..97f63aeb6d4cdfc639b0d778d4df817525c51430 100644 --- a/go/pserver/client/c/test/test_mnist.py +++ b/go/pserver/client/c/test/test_mnist.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/pserver/client/c/test/test_train.py b/go/pserver/client/c/test/test_train.py index 445a8d3aa4840b6e206dec813ed6dc04c2a9a21d..2db5a0bf6a520b8fa29d13ea854b638ebcbbb7d9 100644 --- a/go/pserver/client/c/test/test_train.py +++ b/go/pserver/client/c/test/test_train.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/pserver/client/client.go b/go/pserver/client/client.go index 18fce34b376a8f60900700c588e30f92ef3514ed..2a8f66a07c79906288c4179db5cab703cc2b8b61 100644 --- a/go/pserver/client/client.go +++ b/go/pserver/client/client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/client/client_test.go b/go/pserver/client/client_test.go index ec832305ee8e24967b06b6b621c44cde30c09e55..3a067ff5188fad8f6a13de88a2802e3e5866e59c 100644 --- a/go/pserver/client/client_test.go +++ b/go/pserver/client/client_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/client/etcd_client.go b/go/pserver/client/etcd_client.go index 16d0c3b943050f05c54a3e010054fd7c2f33b6d6..3fb835a6e165b7493df1a1fbb7440ee27109bbad 100644 --- a/go/pserver/client/etcd_client.go +++ b/go/pserver/client/etcd_client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/etcd_client.go b/go/pserver/etcd_client.go index 08ddb247f26379da80d485b1a6059f793864b786..719013b1bb4e80ff1f3040394803706d97514516 100644 --- a/go/pserver/etcd_client.go +++ b/go/pserver/etcd_client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/optimizer.go b/go/pserver/optimizer.go index 6d28cad25a79d713dc06b72f96087a6b723453cd..f17577997bc94b08f3e296c4d6e35682ca3c0e57 100644 --- a/go/pserver/optimizer.go +++ b/go/pserver/optimizer.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/optimizer_test.go b/go/pserver/optimizer_test.go index 565f56dc286d214e7e9a3ddce389d92d21569cd5..3b923879d5ec77675d707ccd40bf44a5148105fb 100644 --- a/go/pserver/optimizer_test.go +++ b/go/pserver/optimizer_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/service.go b/go/pserver/service.go index 7484ec90b1a3a9e67fa798741a9dfeb580c51f1a..d6ead774af522ad78e9fe717f0d27bdf24d86246 100644 --- a/go/pserver/service.go +++ b/go/pserver/service.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/pserver/service_test.go b/go/pserver/service_test.go index 58a743e1fadff9d629f682d660e661013c33ac8a..6949348e933e74d53a99f3b6c8fb928b9b5140f5 100644 --- a/go/pserver/service_test.go +++ b/go/pserver/service_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/utils/networkhelper/CMakeLists.txt b/go/utils/networkhelper/CMakeLists.txt index 9233264ff3c5eadaae2c432066281fb721e38773..3100f2b5a527720b5e8edfb4219b42a8a874f67a 100644 --- a/go/utils/networkhelper/CMakeLists.txt +++ b/go/utils/networkhelper/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/go/utils/networkhelper/helper.go b/go/utils/networkhelper/helper.go index c3fc747bdaf54c34d6d9841343d4b21f784e9a7b..d205b6c50202148c6634bb378a03adcca7b074a0 100644 --- a/go/utils/networkhelper/helper.go +++ b/go/utils/networkhelper/helper.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/go/utils/networkhelper/helper_test.go b/go/utils/networkhelper/helper_test.go index 0bc02ad42a9aad283957fd819b14f882359c25a7..60b520fae15484e024cccddf169c2c8072c2e990 100644 --- a/go/utils/networkhelper/helper_test.go +++ b/go/utils/networkhelper/helper_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/api/Arguments.cpp b/paddle/api/Arguments.cpp index c6f9106912c475dda76b4c11e0793cc5a9f78d3f..62d6a574d55d2748635879a21cbbaa474f070cff 100644 --- a/paddle/api/Arguments.cpp +++ b/paddle/api/Arguments.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/ConfigParser.cpp b/paddle/api/ConfigParser.cpp index b6ff6ec7890c0b79d52a2f0784743289c7bc213f..d362a1e7cf3c8cd05b8c85cfaf8dbbee8b827d4b 100644 --- a/paddle/api/ConfigParser.cpp +++ b/paddle/api/ConfigParser.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/Evaluator.cpp b/paddle/api/Evaluator.cpp index fcda6eaf031c02f2314298f88b3af2c08ba6fa11..c4aac47cbec5876117b09b5598f87a1a7e8bc6c3 100644 --- a/paddle/api/Evaluator.cpp +++ b/paddle/api/Evaluator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/GradientMachine.cpp b/paddle/api/GradientMachine.cpp index dcb5fe086fdccf8ec62ee52cbaaac4b7dbbe2f9d..a3d6f0f080abcf1f45d9bc5fbdb39bb6b6ca1553 100644 --- a/paddle/api/GradientMachine.cpp +++ b/paddle/api/GradientMachine.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/Internal.h b/paddle/api/Internal.h index d48dd3a04c14f559e3c8ceb67226ddb36272e444..2195cc6739d2066303ce3462f35b839dbd44474a 100644 --- a/paddle/api/Internal.h +++ b/paddle/api/Internal.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/Matrix.cpp b/paddle/api/Matrix.cpp index 7c375e5cfb91fc5824f823346af6f80c90b36821..8282b4629dc08a7fcd9b52cbc3492ac10d8ed55c 100644 --- a/paddle/api/Matrix.cpp +++ b/paddle/api/Matrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/PaddleAPI.h b/paddle/api/PaddleAPI.h index 0b9b83d42974151d49250bdf0e7c397f59bf6a62..67368d1a99d980b248789d24a2ea4f466255687a 100644 --- a/paddle/api/PaddleAPI.h +++ b/paddle/api/PaddleAPI.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/PaddleAPIPrivate.h b/paddle/api/PaddleAPIPrivate.h index f41352bfec7c3333bde9509957aba8c5f373b9f2..e141fcd761d7db2d3836a6343700ac4a7ca80c16 100644 --- a/paddle/api/PaddleAPIPrivate.h +++ b/paddle/api/PaddleAPIPrivate.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/Parameter.cpp b/paddle/api/Parameter.cpp index 19f7a898d6b8d3d02c5654559dcb86728266731e..589d22e74e742de2595a9efd17412ddc55159230 100644 --- a/paddle/api/Parameter.cpp +++ b/paddle/api/Parameter.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/ParameterOptimizer.cpp b/paddle/api/ParameterOptimizer.cpp index 120eea3f70125a57fb5ad685f2a11479bce12d0c..d4620be3e6f26cdd4caffffac712e4ef936b222a 100644 --- a/paddle/api/ParameterOptimizer.cpp +++ b/paddle/api/ParameterOptimizer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/ParameterUpdater.cpp b/paddle/api/ParameterUpdater.cpp index 8cd73b348c507386cd88e907f7b431ef25e793aa..63c000c959f67dc682190b73bac24640ca8d0682 100644 --- a/paddle/api/ParameterUpdater.cpp +++ b/paddle/api/ParameterUpdater.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/SequenceGenerator.cpp b/paddle/api/SequenceGenerator.cpp index 8428edc60df6219fd1d3aebf74b0911a79d370cb..1b30aec8f6b6b73764886a7c7274be67851e4815 100644 --- a/paddle/api/SequenceGenerator.cpp +++ b/paddle/api/SequenceGenerator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/Trainer.cpp b/paddle/api/Trainer.cpp index 84e4ca054abb0100a02c8a40e31c49c17684ef40..795460b65051b4ec0d9772d2503f123c4a6ea3d0 100644 --- a/paddle/api/Trainer.cpp +++ b/paddle/api/Trainer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/Util.cpp b/paddle/api/Util.cpp index 11bd05c09d1ecbbcec6b6596c16416c26635a072..618e87e96459674302d8b468c3ac410e8d3af6a8 100644 --- a/paddle/api/Util.cpp +++ b/paddle/api/Util.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/Vector.cpp b/paddle/api/Vector.cpp index 500bc448c92630f4fc2f4df603c955e572d868ec..e2a7b974ca78ae3e6e0e66c206a40c8811126b53 100644 --- a/paddle/api/Vector.cpp +++ b/paddle/api/Vector.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/api/test/testTrainConfig.py b/paddle/api/test/testTrainConfig.py index 1a1283e1168650066ad6eca356ae0c1e5bd967ee..c02d61ebad53faad6abd61d77e2c4d48f76e67af 100644 --- a/paddle/api/test/testTrainConfig.py +++ b/paddle/api/test/testTrainConfig.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/paddle/capi/Arguments.cpp b/paddle/capi/Arguments.cpp index 1ec403077e7ea0bc8299e6266167b50ed81c3b08..87fac3d6c6abe37b128213d4ffd66f8c1573a910 100644 --- a/paddle/capi/Arguments.cpp +++ b/paddle/capi/Arguments.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/Main.cpp b/paddle/capi/Main.cpp index c038789340033fcf6dcc07a41b033a50e980c965..0a289dede65406facf1f1cba584f4330f2569214 100644 --- a/paddle/capi/Main.cpp +++ b/paddle/capi/Main.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/Matrix.cpp b/paddle/capi/Matrix.cpp index cbacd1fb71c14f490ff548db714e728772292b4b..24b0020636c0141b87dc80f5079f7342ec28157c 100644 --- a/paddle/capi/Matrix.cpp +++ b/paddle/capi/Matrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/Vector.cpp b/paddle/capi/Vector.cpp index 564708e963b4068da074c1fcc9aac0fade0f65b9..afb5a9afefedad7b99d440f2149ddb0c75264d80 100644 --- a/paddle/capi/Vector.cpp +++ b/paddle/capi/Vector.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/arguments.h b/paddle/capi/arguments.h index 7c32524a00b11573a037968cf10d6488ea6c5644..69a66bb012c318bc8317c246d690a7f4baffd248 100644 --- a/paddle/capi/arguments.h +++ b/paddle/capi/arguments.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/capi.h b/paddle/capi/capi.h index 4097a1a35a64347f0d79b004371df26551e51bbe..749fcc4b7994bad31395565d5ae16cd51c73b049 100644 --- a/paddle/capi/capi.h +++ b/paddle/capi/capi.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/capi_private.h b/paddle/capi/capi_private.h index c7cdbd5f6f347150c02764a86f8ffb0c068e872e..3332f42a4a6e57fed6ddb20cf7d759d67e7240b5 100644 --- a/paddle/capi/capi_private.h +++ b/paddle/capi/capi_private.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/error.cpp b/paddle/capi/error.cpp index 96ce31b45fc3f83237146443cbe4289af7bfa239..0c25de5ba98f938a3717060bf8d26dd310eb9b5e 100644 --- a/paddle/capi/error.cpp +++ b/paddle/capi/error.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/error.h b/paddle/capi/error.h index 2da9e0a3ef604fbcd53bac271c72ef33b3105152..b0940725b507845668694786de00933a5b51be9a 100644 --- a/paddle/capi/error.h +++ b/paddle/capi/error.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/common/common.h b/paddle/capi/examples/model_inference/common/common.h index 9efcbc387e6080f8c9ed284412d1abced658a0cd..23248b0caf92e2408f451c1cc04a5c179d41aff3 100644 --- a/paddle/capi/examples/model_inference/common/common.h +++ b/paddle/capi/examples/model_inference/common/common.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/dense/main.c b/paddle/capi/examples/model_inference/dense/main.c index f795bfe11d73dd6a4431b89d33bf143bec89ef76..90444889a74e3aff9c5d933d0249619f33b2b0d4 100644 --- a/paddle/capi/examples/model_inference/dense/main.c +++ b/paddle/capi/examples/model_inference/dense/main.c @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/dense/merge_v2_model.py b/paddle/capi/examples/model_inference/dense/merge_v2_model.py index 7aeb482903aa9fca1a23f9b68988ee3bd9886cca..673aba2036c7ec16d68ebc64e91ba3c9182f63a4 100644 --- a/paddle/capi/examples/model_inference/dense/merge_v2_model.py +++ b/paddle/capi/examples/model_inference/dense/merge_v2_model.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/dense/mnist_v2.py b/paddle/capi/examples/model_inference/dense/mnist_v2.py index 183eecfdf2cf146d9d919f94dd0fd5416c5ff97e..3fd15d658adff412d91fdf374f0e6e38a23edbbe 100644 --- a/paddle/capi/examples/model_inference/dense/mnist_v2.py +++ b/paddle/capi/examples/model_inference/dense/mnist_v2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/dense/trainer_config.py b/paddle/capi/examples/model_inference/dense/trainer_config.py index b94a21a7e406b833797f8f521c62a2351c2bc30a..eca2dce114b069bf9b455d77ce670d73b5047fd2 100644 --- a/paddle/capi/examples/model_inference/dense/trainer_config.py +++ b/paddle/capi/examples/model_inference/dense/trainer_config.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/multi_thread/main.c b/paddle/capi/examples/model_inference/multi_thread/main.c index eecb9138e76e6e0c0e1065b57fa26e4fa4c7f1d6..0a99e6b9c8d8447aaf8b8862676eb8a93f9013ed 100644 --- a/paddle/capi/examples/model_inference/multi_thread/main.c +++ b/paddle/capi/examples/model_inference/multi_thread/main.c @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/multi_thread/main_gpu.c b/paddle/capi/examples/model_inference/multi_thread/main_gpu.c index 85bb45658438c7410d29943a401338bd314f383f..60f0c59e7710de595fe297f2167bda3ce7936f6a 100644 --- a/paddle/capi/examples/model_inference/multi_thread/main_gpu.c +++ b/paddle/capi/examples/model_inference/multi_thread/main_gpu.c @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/multi_thread/trainer_config.py b/paddle/capi/examples/model_inference/multi_thread/trainer_config.py deleted file mode 120000 index 70cfb1f7f4cfe9afa6ccbd6f2f419aa286970bbe..0000000000000000000000000000000000000000 --- a/paddle/capi/examples/model_inference/multi_thread/trainer_config.py +++ /dev/null @@ -1 +0,0 @@ -../dense/trainer_config.py \ No newline at end of file diff --git a/paddle/capi/examples/model_inference/multi_thread/trainer_config.py b/paddle/capi/examples/model_inference/multi_thread/trainer_config.py new file mode 100755 index 0000000000000000000000000000000000000000..fa6a12319a99504b5aeee83fc8af6132c62f9aa5 --- /dev/null +++ b/paddle/capi/examples/model_inference/multi_thread/trainer_config.py @@ -0,0 +1,13 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reservedd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/paddle/capi/examples/model_inference/sequence/main.c b/paddle/capi/examples/model_inference/sequence/main.c index 80937c830d67432ff8cfb125172901bdd4257ffb..25a38d32f0b6970f78ed8d31182ffdff7fa1eddc 100644 --- a/paddle/capi/examples/model_inference/sequence/main.c +++ b/paddle/capi/examples/model_inference/sequence/main.c @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/sequence/trainer_config.py b/paddle/capi/examples/model_inference/sequence/trainer_config.py index 889f8acdfd254548ead975c5b8c19b7372ccf3d7..62ae97e2627058c66c7262a8dbf6622eef74f5af 100644 --- a/paddle/capi/examples/model_inference/sequence/trainer_config.py +++ b/paddle/capi/examples/model_inference/sequence/trainer_config.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/sparse_binary/main.c b/paddle/capi/examples/model_inference/sparse_binary/main.c index efec010a91ab933c8e1ab1715293cdeaaf376327..8df1b6008856278b411a73ed88985fcef53e9a69 100644 --- a/paddle/capi/examples/model_inference/sparse_binary/main.c +++ b/paddle/capi/examples/model_inference/sparse_binary/main.c @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/capi/examples/model_inference/sparse_binary/trainer_config.py b/paddle/capi/examples/model_inference/sparse_binary/trainer_config.py deleted file mode 120000 index 70cfb1f7f4cfe9afa6ccbd6f2f419aa286970bbe..0000000000000000000000000000000000000000 --- a/paddle/capi/examples/model_inference/sparse_binary/trainer_config.py +++ /dev/null @@ -1 +0,0 @@ -../dense/trainer_config.py \ No newline at end of file diff --git a/paddle/capi/examples/model_inference/sparse_binary/trainer_config.py b/paddle/capi/examples/model_inference/sparse_binary/trainer_config.py new file mode 100755 index 0000000000000000000000000000000000000000..fa6a12319a99504b5aeee83fc8af6132c62f9aa5 --- /dev/null +++ b/paddle/capi/examples/model_inference/sparse_binary/trainer_config.py @@ -0,0 +1,13 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reservedd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/paddle/capi/gradient_machine.cpp b/paddle/capi/gradient_machine.cpp index 1f0e033c5b7ab713f1747d58f4fcdaad001f0715..ea9aab00e3d05f1e2ef0c91eab93b67e0a3d5f37 100644 --- a/paddle/capi/gradient_machine.cpp +++ b/paddle/capi/gradient_machine.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/gradient_machine.h b/paddle/capi/gradient_machine.h index 7e37dea00b27b6cb955486b4210c1373decbcfa5..f46498b3753fe85350e9ffa60bab5415623fe465 100644 --- a/paddle/capi/gradient_machine.h +++ b/paddle/capi/gradient_machine.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/main.h b/paddle/capi/main.h index 99c4e8428dbaa14d36dc2d36b2a4f16c9ec3e0d1..a0cb7bc296762cd86c931a07c908b352fb8ce582 100644 --- a/paddle/capi/main.h +++ b/paddle/capi/main.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/matrix.h b/paddle/capi/matrix.h index 8cc3e0034e058daefc63c69efe0b1f575c586897..f6747f7b1a196764dd60a3d991a91ef19dc850c1 100644 --- a/paddle/capi/matrix.h +++ b/paddle/capi/matrix.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/tests/test_Arguments.cpp b/paddle/capi/tests/test_Arguments.cpp index 4792ceb49a7816f47ebf9b653d7f34e08f4a85bf..bb08adf716bfd6e3c88747616e538e9da89a0e25 100644 --- a/paddle/capi/tests/test_Arguments.cpp +++ b/paddle/capi/tests/test_Arguments.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/tests/test_GradientMachine.cpp b/paddle/capi/tests/test_GradientMachine.cpp index 89aa64608dd79ea8a8f5add724d9ea79e5abff16..73b9e477b2a2749250e878cf2174dcf4cc599be1 100644 --- a/paddle/capi/tests/test_GradientMachine.cpp +++ b/paddle/capi/tests/test_GradientMachine.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/tests/test_Matrix.cpp b/paddle/capi/tests/test_Matrix.cpp index 6940c28448a897cecd78b718fe720441086a5a99..5ba051ae179569bde82c4219e55060503c8fc4f5 100644 --- a/paddle/capi/tests/test_Matrix.cpp +++ b/paddle/capi/tests/test_Matrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/tests/test_Vector.cpp b/paddle/capi/tests/test_Vector.cpp index 365160dc9a08e6b6fc07fb685d5149d1e078da9b..fa7407e484c4e9b87e9f77f8a5f3d1580e020f3e 100644 --- a/paddle/capi/tests/test_Vector.cpp +++ b/paddle/capi/tests/test_Vector.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/capi/tests/test_predict_network.py b/paddle/capi/tests/test_predict_network.py index 6560417b2a111c3c1b6849468697abeea6e159b6..b8efb25704d93ebe6348bc2c6edbc272b8823b28 100644 --- a/paddle/capi/tests/test_predict_network.py +++ b/paddle/capi/tests/test_predict_network.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/paddle/capi/vector.h b/paddle/capi/vector.h index a92aeff16425779bf63a7ffd7217709b6bf3cd05..a79f7fdf789d00ee7d4b612728a5946d407876f3 100644 --- a/paddle/capi/vector.h +++ b/paddle/capi/vector.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_activation_functions.h b/paddle/cuda/include/hl_activation_functions.h index 93957fd9644652c103d15873b732d0b9fa89330f..29ec248420058db08bd1932f702d26074d49f38c 100644 --- a/paddle/cuda/include/hl_activation_functions.h +++ b/paddle/cuda/include/hl_activation_functions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_aggregate.h b/paddle/cuda/include/hl_aggregate.h index d2189de689f75d737be96d958e5da071cfeca5cf..1ca26aa3bbb72b13440defb46cf8d05760512e19 100644 --- a/paddle/cuda/include/hl_aggregate.h +++ b/paddle/cuda/include/hl_aggregate.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_avx_functions.h b/paddle/cuda/include/hl_avx_functions.h index 35f4eabb4c07c6cc9d2edded02e5b6290b1232f8..9fb99a36ea6bca2bc9bd762ca724a934b98831a7 100644 --- a/paddle/cuda/include/hl_avx_functions.h +++ b/paddle/cuda/include/hl_avx_functions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_base.h b/paddle/cuda/include/hl_base.h index 5b9884b786530aee91312c7547496c94cd7a89cb..6c4f09dacb47c431db2e2610a3e61390a82dcba0 100644 --- a/paddle/cuda/include/hl_base.h +++ b/paddle/cuda/include/hl_base.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_batch_norm.h b/paddle/cuda/include/hl_batch_norm.h index afc5e0b2deacc4aadf98b3f7ce115e534bbc5124..7814204d1b085694c74695c95a8f9cf517810450 100644 --- a/paddle/cuda/include/hl_batch_norm.h +++ b/paddle/cuda/include/hl_batch_norm.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_batch_transpose.h b/paddle/cuda/include/hl_batch_transpose.h index e2e958cd67aa72b0f654e758e1da4753412aab3f..a16d3764fc724d2dd282a9416485d604a273378e 100644 --- a/paddle/cuda/include/hl_batch_transpose.h +++ b/paddle/cuda/include/hl_batch_transpose.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cnn.h b/paddle/cuda/include/hl_cnn.h index 88418062927cd0f7714e992cc2495109da45d32f..63ec51564793ca2255032d0efbe2c47326f8b698 100644 --- a/paddle/cuda/include/hl_cnn.h +++ b/paddle/cuda/include/hl_cnn.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cpu_gru.cuh b/paddle/cuda/include/hl_cpu_gru.cuh index e4f6bf42c61694e9826a127c9628730cfd43ada7..ce1643932dee6c6f7fdfb4e71e371eb70857411a 100644 --- a/paddle/cuda/include/hl_cpu_gru.cuh +++ b/paddle/cuda/include/hl_cpu_gru.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cpu_lstm.cuh b/paddle/cuda/include/hl_cpu_lstm.cuh index 0e412fcdf57fe99f596f8dd597d67e10624f459c..58a97d1230d74545cc205fc46c61c24321db3cd7 100644 --- a/paddle/cuda/include/hl_cpu_lstm.cuh +++ b/paddle/cuda/include/hl_cpu_lstm.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cpu_matrix_kernel.cuh b/paddle/cuda/include/hl_cpu_matrix_kernel.cuh index aaa24325514812eda33309660ba85c3ceece770e..4db9bb74e0ae2cd59b425a65ad16f47d0d9bca78 100644 --- a/paddle/cuda/include/hl_cpu_matrix_kernel.cuh +++ b/paddle/cuda/include/hl_cpu_matrix_kernel.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cpu_matrix_kernel_detail.cuh b/paddle/cuda/include/hl_cpu_matrix_kernel_detail.cuh index 85ca836fdc46682195ac29a1ebf2237c28fc3311..54a749b99073692b61750f25d36d96bcb9f48b7c 100644 --- a/paddle/cuda/include/hl_cpu_matrix_kernel_detail.cuh +++ b/paddle/cuda/include/hl_cpu_matrix_kernel_detail.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cpu_scalar.cuh b/paddle/cuda/include/hl_cpu_scalar.cuh index 93043cd4bc030ef525d5bcf8d83196f2ce92eec6..939302e97158018299ad281d73483c54ae92d242 100644 --- a/paddle/cuda/include/hl_cpu_scalar.cuh +++ b/paddle/cuda/include/hl_cpu_scalar.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cpu_simd_neon.cuh b/paddle/cuda/include/hl_cpu_simd_neon.cuh index 0b1cf4abdc4d5ef2a640c75587308f7f082b854b..e54e0f4646bbe5bfa0de7d4f1d7e2b0bab406d4e 100644 --- a/paddle/cuda/include/hl_cpu_simd_neon.cuh +++ b/paddle/cuda/include/hl_cpu_simd_neon.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cpu_simd_sse.cuh b/paddle/cuda/include/hl_cpu_simd_sse.cuh index a104b626220f473324fc3c99e7cd305c3e86f3db..20c37d4dd31cd415490dbebc783d830236a0b784 100644 --- a/paddle/cuda/include/hl_cpu_simd_sse.cuh +++ b/paddle/cuda/include/hl_cpu_simd_sse.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cuda.h b/paddle/cuda/include/hl_cuda.h index 5383c1130bba30a0c553afe8d6fc34a6400f236b..70efcccb81847c11738108f222a6b0c1cff644e0 100644 --- a/paddle/cuda/include/hl_cuda.h +++ b/paddle/cuda/include/hl_cuda.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cuda.ph b/paddle/cuda/include/hl_cuda.ph index 701916b27922f980d0aa70eec8358eb10f006df5..7c4465e51ff7944e77f8048e584ad1dcfa274d56 100644 --- a/paddle/cuda/include/hl_cuda.ph +++ b/paddle/cuda/include/hl_cuda.ph @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cuda_cublas.h b/paddle/cuda/include/hl_cuda_cublas.h index e206e42b2aba9c83296de60ca7ef4784fb869c61..3959f81677b0f73768fd45498e6da0236daca5bd 100644 --- a/paddle/cuda/include/hl_cuda_cublas.h +++ b/paddle/cuda/include/hl_cuda_cublas.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cuda_cudnn.h b/paddle/cuda/include/hl_cuda_cudnn.h index b44b071bd1b3b6e9e5539d5dc0c2b155c524fd57..4664e4144a8535e57520668425725fa352e44edc 100644 --- a/paddle/cuda/include/hl_cuda_cudnn.h +++ b/paddle/cuda/include/hl_cuda_cudnn.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_cuda_cudnn.ph b/paddle/cuda/include/hl_cuda_cudnn.ph index 61378937cee78f9f2fb5c7f176555d3ead87da6c..bb3b89f6faa9a9011470400fd6fcf4756cccf02a 100644 --- a/paddle/cuda/include/hl_cuda_cudnn.ph +++ b/paddle/cuda/include/hl_cuda_cudnn.ph @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_device_functions.cuh b/paddle/cuda/include/hl_device_functions.cuh index e0b5632f23edc5cb4769a6e60c8e461d6011a3e0..ef068e10622c914e41423b5d0f117d5716744646 100755 --- a/paddle/cuda/include/hl_device_functions.cuh +++ b/paddle/cuda/include/hl_device_functions.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_functions.h b/paddle/cuda/include/hl_functions.h index 0d7e80a855d83f1b03046c04eea1a47a7a59e550..9912b4c17997b0d765ab9c67161bacb849ce3259 100644 --- a/paddle/cuda/include/hl_functions.h +++ b/paddle/cuda/include/hl_functions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_gpu.h b/paddle/cuda/include/hl_gpu.h index 4ab8de80d1c7be0f8e3eb848955373dd5e21bc18..50a2e9cdd29bc3e37c2d67f772db52dd4d95cb9e 100644 --- a/paddle/cuda/include/hl_gpu.h +++ b/paddle/cuda/include/hl_gpu.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_gpu_functions.cuh b/paddle/cuda/include/hl_gpu_functions.cuh index 8e64cbe360eb9f2ddfb0b30f2d73408b182b4b3c..705aa71f4bae94339012f17851bc8eb1a8f26c2f 100644 --- a/paddle/cuda/include/hl_gpu_functions.cuh +++ b/paddle/cuda/include/hl_gpu_functions.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_gpu_gru.cuh b/paddle/cuda/include/hl_gpu_gru.cuh index 6668e135d2b8c793b510bf06797dbc5ffb747dc9..9fcad2c3bc2fa255e3d7cd3e7940a32fd286751b 100644 --- a/paddle/cuda/include/hl_gpu_gru.cuh +++ b/paddle/cuda/include/hl_gpu_gru.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_gpu_lstm.cuh b/paddle/cuda/include/hl_gpu_lstm.cuh index 5dceba2f5b82a2b33273cb027049894998a5dfcf..92517a44d2353a42d905708fc9aa98727a13a9e9 100644 --- a/paddle/cuda/include/hl_gpu_lstm.cuh +++ b/paddle/cuda/include/hl_gpu_lstm.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_gpu_matrix_kernel.cuh b/paddle/cuda/include/hl_gpu_matrix_kernel.cuh index 9bbdf5fa72678ef7ded0c4343bbd97306b78fe9a..0db023ce3745f95ced8b3a33a1d6bcb20066b2ef 100644 --- a/paddle/cuda/include/hl_gpu_matrix_kernel.cuh +++ b/paddle/cuda/include/hl_gpu_matrix_kernel.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_gru_ops.cuh b/paddle/cuda/include/hl_gru_ops.cuh index 45f66ad533ebd00171dfa86eaa66dc6612c72403..6c647c514db6a4f22b5c472835f4c0ab0ec9b869 100644 --- a/paddle/cuda/include/hl_gru_ops.cuh +++ b/paddle/cuda/include/hl_gru_ops.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_lstm.h b/paddle/cuda/include/hl_lstm.h index 857756e5cd4c77ce618b03eddc9ca94948bd123a..5db4783bf4dd871a2349d527aad315e7426815c5 100644 --- a/paddle/cuda/include/hl_lstm.h +++ b/paddle/cuda/include/hl_lstm.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_lstm_ops.cuh b/paddle/cuda/include/hl_lstm_ops.cuh index 2601060cc2e50b876d2731c2b05ce54ff47d9315..394fdf5ac07d533579307bf478c5e491669f4c59 100644 --- a/paddle/cuda/include/hl_lstm_ops.cuh +++ b/paddle/cuda/include/hl_lstm_ops.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_matrix.h b/paddle/cuda/include/hl_matrix.h index 7daca18761b80eac0f876b21377a6ccc6a853485..88d538343f9164d7bc780cfd458586c8a553590b 100644 --- a/paddle/cuda/include/hl_matrix.h +++ b/paddle/cuda/include/hl_matrix.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_matrix_apply.cuh b/paddle/cuda/include/hl_matrix_apply.cuh index b10d177b970e259e98972bbe465a1b8cdb563c0e..a067c8233b9b1b7f76ab766ebd467c480c0a88b7 100644 --- a/paddle/cuda/include/hl_matrix_apply.cuh +++ b/paddle/cuda/include/hl_matrix_apply.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_matrix_base.cuh b/paddle/cuda/include/hl_matrix_base.cuh index 53fdb47ec9c05f5cf85d0956176ad9abf6d656f9..a309bb0011c00655ff1d9b9c6276898b3de369db 100644 --- a/paddle/cuda/include/hl_matrix_base.cuh +++ b/paddle/cuda/include/hl_matrix_base.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_matrix_base_detail.cuh b/paddle/cuda/include/hl_matrix_base_detail.cuh index de1fd17d524a486cc15af721731d2e815f17263e..74211bcb929839f1ba6a7bf117dd3f31b7bc1bed 100644 --- a/paddle/cuda/include/hl_matrix_base_detail.cuh +++ b/paddle/cuda/include/hl_matrix_base_detail.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_matrix_ops.cuh b/paddle/cuda/include/hl_matrix_ops.cuh index fc29201357ce564dcf20b12d998223f7a4cc22b4..4e8bd91234958e6e94bdde633fb79ef10715c9a6 100644 --- a/paddle/cuda/include/hl_matrix_ops.cuh +++ b/paddle/cuda/include/hl_matrix_ops.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_matrix_type.cuh b/paddle/cuda/include/hl_matrix_type.cuh index e18235219bd9f78dd87a92d448cb290d9a4904a1..e61c0d0a47900c7c1820f6b32690b6cdf7d2f13e 100644 --- a/paddle/cuda/include/hl_matrix_type.cuh +++ b/paddle/cuda/include/hl_matrix_type.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_perturbation_util.cuh b/paddle/cuda/include/hl_perturbation_util.cuh index 93b81bf0358694219c55bf076c454790286c2418..e0a27778caea61fb56737e330d8faad7e58b4926 100644 --- a/paddle/cuda/include/hl_perturbation_util.cuh +++ b/paddle/cuda/include/hl_perturbation_util.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_recurrent_apply.cuh b/paddle/cuda/include/hl_recurrent_apply.cuh index 113446cf75658f603200a57f3d8cd8a9e47fe728..b2cc231f58d2cc6b39247c31c02208f164cad16e 100644 --- a/paddle/cuda/include/hl_recurrent_apply.cuh +++ b/paddle/cuda/include/hl_recurrent_apply.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_sequence.h b/paddle/cuda/include/hl_sequence.h index 973ddcceed99ba4177b3db277e664611d42ac51b..3923bdd921bae8baa604aa22611e19d7bd3b1e47 100644 --- a/paddle/cuda/include/hl_sequence.h +++ b/paddle/cuda/include/hl_sequence.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_sparse.h b/paddle/cuda/include/hl_sparse.h index 67fe701c109db43eec844944efa76cd3cb79edee..9aab52e045cc13cb7dde7116a8b2b400277c0eab 100644 --- a/paddle/cuda/include/hl_sparse.h +++ b/paddle/cuda/include/hl_sparse.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_sparse.ph b/paddle/cuda/include/hl_sparse.ph index 13bba17811630ff12e9fcd85c520e83f44a086df..c0fdccb942cd3968f405c657cc7cd9c51c6f2409 100644 --- a/paddle/cuda/include/hl_sparse.ph +++ b/paddle/cuda/include/hl_sparse.ph @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_table_apply.h b/paddle/cuda/include/hl_table_apply.h index 2170b97f4d286608fb4b69ecbd9150e19b74834f..dff60aa0a2271189c00c067aae749692c21705d8 100644 --- a/paddle/cuda/include/hl_table_apply.h +++ b/paddle/cuda/include/hl_table_apply.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_tensor_ops.h b/paddle/cuda/include/hl_tensor_ops.h index b2bf334dab9799153fe1d4fe2c74cce9d57168b9..85a022ff5e26daab97be52b7ea9814c6b8078561 100644 --- a/paddle/cuda/include/hl_tensor_ops.h +++ b/paddle/cuda/include/hl_tensor_ops.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_thread.ph b/paddle/cuda/include/hl_thread.ph index a3830ff8d8af5dfd3b932677c7f1e6ffcee97d47..4abede1517a2264d45fd390c69ffdeb95569334c 100644 --- a/paddle/cuda/include/hl_thread.ph +++ b/paddle/cuda/include/hl_thread.ph @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_time.h b/paddle/cuda/include/hl_time.h index f63f02582060156562061f73c429fc7bbd878d2c..61d80c065c805af7b12575fa7002ae6a57f9a57a 100644 --- a/paddle/cuda/include/hl_time.h +++ b/paddle/cuda/include/hl_time.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_top_k.h b/paddle/cuda/include/hl_top_k.h index 79ae0d0e741de06e622454ccd220e2c749d795b3..a3c7872f525c0c07eb20a9e4e88d1b02cc2fcadc 100644 --- a/paddle/cuda/include/hl_top_k.h +++ b/paddle/cuda/include/hl_top_k.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/hl_warpctc_wrap.h b/paddle/cuda/include/hl_warpctc_wrap.h index 7885ae570148c0b9870089baf22b6bacb786f995..0857bd1aa1b3c66a5692b25005b7c342669afea6 100644 --- a/paddle/cuda/include/hl_warpctc_wrap.h +++ b/paddle/cuda/include/hl_warpctc_wrap.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_aggregate_stub.h b/paddle/cuda/include/stub/hl_aggregate_stub.h index bbfa9b8fad5b49290c05eeeeeeea4fe4b85a683f..2ac841facc618a070781414bc02fa67a38db0382 100644 --- a/paddle/cuda/include/stub/hl_aggregate_stub.h +++ b/paddle/cuda/include/stub/hl_aggregate_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_cnn_stub.h b/paddle/cuda/include/stub/hl_cnn_stub.h index 706cc59a8e394b109d2b290425f4b5f51d987f28..c39bd3228d3f2ea7495cd21f5ff60bdfbbd2b51d 100644 --- a/paddle/cuda/include/stub/hl_cnn_stub.h +++ b/paddle/cuda/include/stub/hl_cnn_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_cuda_cublas_stub.h b/paddle/cuda/include/stub/hl_cuda_cublas_stub.h index e86fd853f407de8bbcec5a2629d6ae600f696eb3..0b2300cda95f2ae32a5e669dd8c834d39f27adcd 100644 --- a/paddle/cuda/include/stub/hl_cuda_cublas_stub.h +++ b/paddle/cuda/include/stub/hl_cuda_cublas_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_cuda_cudnn_stub.h b/paddle/cuda/include/stub/hl_cuda_cudnn_stub.h index 3afcc6fa85a4a6a03697663719b6ab685897b68b..4b8bdf7507b26f628c8103a79b364312bc9ebbdf 100644 --- a/paddle/cuda/include/stub/hl_cuda_cudnn_stub.h +++ b/paddle/cuda/include/stub/hl_cuda_cudnn_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_cuda_stub.h b/paddle/cuda/include/stub/hl_cuda_stub.h index 5246a8d5a48fa7a6ac075f12a312d9c5383cdf8c..ac8b22ef31a39c84a849f42926738a84ad2295e9 100644 --- a/paddle/cuda/include/stub/hl_cuda_stub.h +++ b/paddle/cuda/include/stub/hl_cuda_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_lstm_stub.h b/paddle/cuda/include/stub/hl_lstm_stub.h index 246ba79f6324dd48a423d3f748bf8f551ec3d376..be2b71787e528c4f0c8cf81e397c9c2a31c8dde1 100644 --- a/paddle/cuda/include/stub/hl_lstm_stub.h +++ b/paddle/cuda/include/stub/hl_lstm_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_matrix_stub.h b/paddle/cuda/include/stub/hl_matrix_stub.h index 46e77e140768dd80fd327dd4eb3b0f62a3370950..914a2edaf2122ade3d9c7eed9fef1e980c52f87a 100644 --- a/paddle/cuda/include/stub/hl_matrix_stub.h +++ b/paddle/cuda/include/stub/hl_matrix_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_sequence_stub.h b/paddle/cuda/include/stub/hl_sequence_stub.h index 920b417b1c717efaff75f70f1b9d2b574469e425..44bc3dbaff3c89520f97f9c01d7e9d01c625d52e 100644 --- a/paddle/cuda/include/stub/hl_sequence_stub.h +++ b/paddle/cuda/include/stub/hl_sequence_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/include/stub/hl_sparse_stub.h b/paddle/cuda/include/stub/hl_sparse_stub.h index bd17461d88f716a0ed96e90ae36bb0f65099e110..4001d4fb7416fa2457e3c057a0a121611854e6d0 100644 --- a/paddle/cuda/include/stub/hl_sparse_stub.h +++ b/paddle/cuda/include/stub/hl_sparse_stub.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/avx_mathfun.h b/paddle/cuda/src/avx_mathfun.h index a0ba71faba9131f6f3f031c8276c3851090fac45..8e698e746a17b845f62e1da25fc8a2a4b6d4737d 100644 --- a/paddle/cuda/src/avx_mathfun.h +++ b/paddle/cuda/src/avx_mathfun.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_avx_functions.cc b/paddle/cuda/src/hl_avx_functions.cc index 906647587642f3815915efbeca7aab6458d25a70..6fb7c9dd06a08a1918f2f7aaeeed64d6d059b71b 100644 --- a/paddle/cuda/src/hl_avx_functions.cc +++ b/paddle/cuda/src/hl_avx_functions.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_batch_norm.cu b/paddle/cuda/src/hl_batch_norm.cu index 5828ecb8e049c2f0573ab8547164794bef6db1ca..f9ffde0d53e6cde3ddb661702923254cf6310223 100644 --- a/paddle/cuda/src/hl_batch_norm.cu +++ b/paddle/cuda/src/hl_batch_norm.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_batch_transpose.cu b/paddle/cuda/src/hl_batch_transpose.cu index f4c253df7b4be937f041f18587efd4c9d693fbe4..221839905d753eb4c7a0823d0d0a4a0a77414852 100644 --- a/paddle/cuda/src/hl_batch_transpose.cu +++ b/paddle/cuda/src/hl_batch_transpose.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cpu_functions.cc b/paddle/cuda/src/hl_cpu_functions.cc index c2117a7315fed506d0f746ddfceaf304942cf5a2..1306576bcb9e47ac04b44914a69955cd7561d3cc 100644 --- a/paddle/cuda/src/hl_cpu_functions.cc +++ b/paddle/cuda/src/hl_cpu_functions.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_aggregate.cu b/paddle/cuda/src/hl_cuda_aggregate.cu index 16a54ad343fa140aa1f3bec311c4b712d0086082..d30c264127f47da9a48acb71c59cb9e134ced127 100644 --- a/paddle/cuda/src/hl_cuda_aggregate.cu +++ b/paddle/cuda/src/hl_cuda_aggregate.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_cnn.cu b/paddle/cuda/src/hl_cuda_cnn.cu index 2d1bc4f6d55fac4b74f4e58d40fe56aa61d19cf9..a4459243e8a7c8be58be2255faf89e29817fbdf5 100644 --- a/paddle/cuda/src/hl_cuda_cnn.cu +++ b/paddle/cuda/src/hl_cuda_cnn.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_cublas.cc b/paddle/cuda/src/hl_cuda_cublas.cc index 6163209e9bc681209712243ba68dec549b7e360a..975df4287894090799c44bc0a4e9e08e4144e68f 100644 --- a/paddle/cuda/src/hl_cuda_cublas.cc +++ b/paddle/cuda/src/hl_cuda_cublas.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_cudnn.cc b/paddle/cuda/src/hl_cuda_cudnn.cc index b8caf48f9c06094e85765f7aa5a3f4195d0ca931..dfa935dcff9f7ae9f710d0f01a0217298d8cec04 100644 --- a/paddle/cuda/src/hl_cuda_cudnn.cc +++ b/paddle/cuda/src/hl_cuda_cudnn.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_device.cc b/paddle/cuda/src/hl_cuda_device.cc index 4042d9742a92f6718406c8923d9129b81afe89e7..3025aa48523d67fe3d7ed03f44252d1211d2a46a 100644 --- a/paddle/cuda/src/hl_cuda_device.cc +++ b/paddle/cuda/src/hl_cuda_device.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_lstm.cu b/paddle/cuda/src/hl_cuda_lstm.cu index a5ce81a904ebbd655a16ef68660b81d442478575..21c0c26b6ef0420b1a719736a66eeb8114ed9680 100644 --- a/paddle/cuda/src/hl_cuda_lstm.cu +++ b/paddle/cuda/src/hl_cuda_lstm.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_matrix.cu b/paddle/cuda/src/hl_cuda_matrix.cu index 607efb4f6b0aa0d22a2789397b8743f7a5271d5b..3e17c8090c5036037e936af1d6feaa2239251679 100644 --- a/paddle/cuda/src/hl_cuda_matrix.cu +++ b/paddle/cuda/src/hl_cuda_matrix.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_sequence.cu b/paddle/cuda/src/hl_cuda_sequence.cu index c52780dfcaff6e5b94d3568fac4ca011b76a1442..a3a5f038de7c0a68ee2e387d83b2272907164e90 100644 --- a/paddle/cuda/src/hl_cuda_sequence.cu +++ b/paddle/cuda/src/hl_cuda_sequence.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_sparse.cu b/paddle/cuda/src/hl_cuda_sparse.cu index 6351e7e01ee55b6303a6e48bc9ebf9834a83130e..432041fed5ab1ffc02dabcd4644fa70a6473fba1 100644 --- a/paddle/cuda/src/hl_cuda_sparse.cu +++ b/paddle/cuda/src/hl_cuda_sparse.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_cuda_sparse.cuh b/paddle/cuda/src/hl_cuda_sparse.cuh index 72572756a671b0d43f9b5e68bab2a5e5aef5f762..adb898c9ac6c108c2e98d0baa9003eca4ad6a133 100644 --- a/paddle/cuda/src/hl_cuda_sparse.cuh +++ b/paddle/cuda/src/hl_cuda_sparse.cuh @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_math.cc b/paddle/cuda/src/hl_math.cc index 3048693fb870d7032fb690570d7e31e17001507a..585b356d0a7b6c1fd95267d24f350b1c2eb99787 100644 --- a/paddle/cuda/src/hl_math.cc +++ b/paddle/cuda/src/hl_math.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_perturbation_util.cu b/paddle/cuda/src/hl_perturbation_util.cu index d01a91561efa2ebe8e0cabc2b4e8885f2c02ab48..e15cbb143936b1f816eb9410b964db699131c3cc 100644 --- a/paddle/cuda/src/hl_perturbation_util.cu +++ b/paddle/cuda/src/hl_perturbation_util.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_table_apply.cu b/paddle/cuda/src/hl_table_apply.cu index d3b71c75e6e69d48c8d98041e3d6075aa8d53610..efa4bef02ba5f5fe9ae449b44bbdc844e5745307 100644 --- a/paddle/cuda/src/hl_table_apply.cu +++ b/paddle/cuda/src/hl_table_apply.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_time.cc b/paddle/cuda/src/hl_time.cc index 7e5d7e8aaecbcdc61c1e5b5006a2958d4dc84460..26af9ec806a75bab429e65fbf1fcb7b47cd348cf 100644 --- a/paddle/cuda/src/hl_time.cc +++ b/paddle/cuda/src/hl_time.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_top_k.cu b/paddle/cuda/src/hl_top_k.cu index 1896a56634c3a75e5a2a1e08661088b263f8ee10..fea8712a773b1524022f4bba626cf5044edebef6 100644 --- a/paddle/cuda/src/hl_top_k.cu +++ b/paddle/cuda/src/hl_top_k.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/cuda/src/hl_warpctc_wrap.cc b/paddle/cuda/src/hl_warpctc_wrap.cc index 9f812dd0dead8b4b4e0a4ac58b12a81d1da00aee..5111bceaff224f2467fe1b6c92daed03414dd12e 100644 --- a/paddle/cuda/src/hl_warpctc_wrap.cc +++ b/paddle/cuda/src/hl_warpctc_wrap.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/CMakeLists.txt b/paddle/fluid/framework/CMakeLists.txt index ef1bc07c2dbe71268c706a119056d3a9fcfc7f8c..0b8cfab573f2771d6845df2d2768c8f6e6634043 100644 --- a/paddle/fluid/framework/CMakeLists.txt +++ b/paddle/fluid/framework/CMakeLists.txt @@ -68,9 +68,9 @@ py_proto_compile(framework_py_proto SRCS framework.proto) add_custom_target(framework_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py) add_dependencies(framework_py_proto framework_py_proto_init) add_custom_command(TARGET framework_py_proto POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SOURCE_DIR}/python/paddle/v2/fluid/proto - COMMAND cp *.py ${PADDLE_SOURCE_DIR}/python/paddle/v2/fluid/proto/ - COMMENT "Copy generated python proto into directory paddle/v2/fluid/proto." + COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SOURCE_DIR}/python/paddle/fluid/proto + COMMAND cp *.py ${PADDLE_SOURCE_DIR}/python/paddle/fluid/proto/ + COMMENT "Copy generated python proto into directory paddle/fluid/proto." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) cc_library(backward SRCS backward.cc DEPS net_op) diff --git a/paddle/fluid/framework/attribute.cc b/paddle/fluid/framework/attribute.cc index 1d7e7366b0723c630b24d62c1f5d0a72cf42d770..0dcecb62dba971b48c4f11c0ef47494be40eeea0 100644 --- a/paddle/fluid/framework/attribute.cc +++ b/paddle/fluid/framework/attribute.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/attribute.h b/paddle/fluid/framework/attribute.h index 16be42ae71497bcc755d10eee2d73d331ede7da6..8428bf8e3392f68c9d1e2553f4d017cb620bb9f3 100644 --- a/paddle/fluid/framework/attribute.h +++ b/paddle/fluid/framework/attribute.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/backward.cc b/paddle/fluid/framework/backward.cc index c4795f4fc5c73034b23305162ea3b710480d8ebc..1314af2b3dab281bd201e6a77bfbe87e0bd58ffb 100644 --- a/paddle/fluid/framework/backward.cc +++ b/paddle/fluid/framework/backward.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -341,7 +341,7 @@ static void CreateGradVarInBlock( auto* param = block_desc->FindVarRecursive(pname); auto* grad = block_desc->FindVar(arg); if (param == nullptr) { - grad->SetDataType(proto::DataType::FP32); + grad->SetDataType(proto::VarType::FP32); } else { grad->SetDataType(param->GetDataType()); } diff --git a/paddle/fluid/framework/backward.h b/paddle/fluid/framework/backward.h index 2ea6922426e1dad0ca9b6e1287701bca0adef5c8..3a971090c25c85efbf976532c364371baba9a870 100644 --- a/paddle/fluid/framework/backward.h +++ b/paddle/fluid/framework/backward.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/backward_test.cc b/paddle/fluid/framework/backward_test.cc index f9604c68913f98abc4d52c84bc8fa2c02e1a6a31..cc1f871360ed3f7071364dbb0f932bfd997cadb0 100644 --- a/paddle/fluid/framework/backward_test.cc +++ b/paddle/fluid/framework/backward_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/block_desc.cc b/paddle/fluid/framework/block_desc.cc index 9550159155c28247797a6caa5fc01c64a0c5f99f..d72b64700f7cf680501fd3e355d20e694f1f097d 100644 --- a/paddle/fluid/framework/block_desc.cc +++ b/paddle/fluid/framework/block_desc.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ limitations under the License. */ #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/program_desc.h" +#include + namespace paddle { namespace framework { @@ -42,15 +44,58 @@ bool BlockDesc::HasVar(const std::string &name) const { return vars_.find(name) != vars_.end(); } +VarDesc *BlockDesc::RenameVar(const std::string &old_name, + const std::string &new_name) { + if (!this->HasVar(old_name)) { + return nullptr; + } + need_update_ = true; + auto *var = this->Var(old_name); + VarDesc *new_var = new VarDesc(*(var->Proto())); + new_var->SetName(new_name); + vars_[new_name].reset(new_var); + // rename inputs and outputs + for (const auto &op : ops_) { + auto *it = op.get(); + it->Rename(old_name, new_name); + } + vars_.erase(old_name); + return new_var; +} + VarDesc *BlockDesc::FindVarRecursive(const std::string &name) const { if (name == kEmptyVarName) return nullptr; - auto it = vars_.find(name); - if (it == vars_.end()) { - return Parent() == kNoneBlockIndex ? nullptr - : ParentBlock()->FindVarRecursive(name); + std::queue frontier; + std::unordered_set visited; + + frontier.push(this); + + while (!frontier.empty()) { // BFS + auto cur = frontier.front(); + frontier.pop(); + if (visited.count(cur) != 0) { + continue; + } + auto var = cur->FindVar(name); + if (var != nullptr) { + return var; + } + + auto fwd = cur->ForwardBlock(); + auto parent = cur->ParentBlock(); + + if (fwd != nullptr) { + frontier.push(fwd); + } + if (parent != nullptr) { + frontier.push(parent); + } + + visited.insert(cur); } - return it->second.get(); + + return nullptr; } VarDesc &BlockDesc::FindRecursiveOrCreateVar(const std::string &name_bytes) { @@ -136,10 +181,7 @@ void BlockDesc::Flush() { } BlockDesc *BlockDesc::ParentBlock() const { - if (this->desc_->parent_idx() == kNoneBlockIndex) { - return nullptr; - } - return prog_->MutableBlock(static_cast(this->desc_->parent_idx())); + return prog_->MutableBlock(static_cast(desc_->parent_idx())); } proto::BlockDesc *BlockDesc::Proto() { @@ -186,5 +228,16 @@ void BlockDesc::ClearPBVars() { } } +void BlockDesc::SetForwardBlockID(int32_t forward_block_id) { + PADDLE_ENFORCE(!desc_->has_forward_block_idx(), + "Parent block ID has been set to %d. Cannot set to %d", + desc_->forward_block_idx(), forward_block_id); + desc_->set_forward_block_idx(forward_block_id); +} + +BlockDesc *BlockDesc::ForwardBlock() const { + return prog_->MutableBlock(static_cast(desc_->forward_block_idx())); +} + } // namespace framework } // namespace paddle diff --git a/paddle/fluid/framework/block_desc.h b/paddle/fluid/framework/block_desc.h index 5f7eca3878ff6174090c7b0dd4904f5604ac8dc6..3bd90f38907c0a45ae0c9bb00706e5c127f08417 100644 --- a/paddle/fluid/framework/block_desc.h +++ b/paddle/fluid/framework/block_desc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -49,12 +49,16 @@ class BlockDesc { int32_t Parent() const { return desc_->parent_idx(); } + int32_t ForwardBlockID() const { return desc_->forward_block_idx(); } + VarDesc *Var(const std::string &name_bytes); VarDesc *FindVar(const std::string &name_bytes) const; bool HasVar(const std::string &var_name) const; + VarDesc *RenameVar(const std::string &old_name, const std::string &new_name); + VarDesc *FindVarRecursive(const std::string &name_bytes) const; VarDesc &FindRecursiveOrCreateVar(const std::string &name_bytes); @@ -73,6 +77,10 @@ class BlockDesc { BlockDesc *ParentBlock() const; + BlockDesc *ForwardBlock() const; + + void SetForwardBlockID(int32_t forward_block_id); + OpDesc *AppendOp(); void AppendAllocatedOp(std::unique_ptr &&op_desc); @@ -91,7 +99,7 @@ class BlockDesc { proto::BlockDesc *Proto(); - ProgramDesc *Program() { return this->prog_; } + ProgramDesc *Program() const { return this->prog_; } private: void ClearPBOps(); diff --git a/paddle/fluid/framework/channel.h b/paddle/fluid/framework/channel.h index 5acf4fb39bbeb6bd45d215c962f10f0333578c02..be578059388e627778d485365e5a735158603fe5 100644 --- a/paddle/fluid/framework/channel.h +++ b/paddle/fluid/framework/channel.h @@ -15,6 +15,8 @@ limitations under the License. */ #pragma once #include // for size_t +#include +#include "paddle/fluid/platform/enforce.h" namespace paddle { namespace framework { @@ -51,6 +53,76 @@ void CloseChannel(Channel* ch) { ch->Close(); } +/* + * The ChannelHolder class serves two main purposes: + * 1. It acts as a unified wrapper for the different kinds of + * channels, i.e. Buffered and Unbuffered channels. This is + * similar to the ReaderHolder class. + * 2. It also helps us in TypeHiding. This is similar to the + * PlaceHolder implementations in variable.h and tensor.h. + */ +class ChannelHolder { + public: + template + void Reset(size_t buffer_size) { + holder_.reset(new PlaceholderImpl(buffer_size)); + } + + template + bool Send(T* data) { + if (!IsInitialized()) return false; + PADDLE_ENFORCE_EQ(holder_->Type(), std::type_index(typeid(T))); + // Static cast should be safe because we have ensured that types are same + Channel* channel = static_cast*>(holder_->Ptr()); + return channel != nullptr ? channel->Send(data) : false; + } + + template + bool Receive(T* data) { + if (!IsInitialized()) return false; + PADDLE_ENFORCE_EQ(holder_->Type(), std::type_index(typeid(T))); + Channel* channel = static_cast*>(holder_->Ptr()); + return channel != nullptr ? channel->Receive(data) : false; + } + + void close() { + if (IsInitialized()) holder_->Close(); + } + + inline bool IsInitialized() const { return holder_ != nullptr; } + + private: + /** + * @note Placeholder hides type T, so it doesn't appear as a template + * parameter of ChannelHolder. + */ + struct Placeholder { + virtual ~Placeholder() {} + virtual const std::type_index Type() const = 0; + virtual void* Ptr() const = 0; + virtual void Close() = 0; + }; + + template + struct PlaceholderImpl : public Placeholder { + PlaceholderImpl(size_t buffer_size) : type_(std::type_index(typeid(T))) { + channel_.reset(MakeChannel(buffer_size)); + } + + virtual const std::type_index Type() const { return type_; } + virtual void* Ptr() const { return static_cast(channel_.get()); } + virtual void Close() { + if (channel_) channel_->Close(); + } + + std::unique_ptr> channel_; + const std::type_index type_; + }; + + // Pointer to a PlaceholderImpl object + std::unique_ptr holder_; +}; + } // namespace framework } // namespace paddle diff --git a/paddle/fluid/framework/channel_test.cc b/paddle/fluid/framework/channel_test.cc index 953fa40fec8c0480726b44760a3a4c7f59c80a85..2c4e622bd789c691c38a8810fe5e09e464a8cf1f 100644 --- a/paddle/fluid/framework/channel_test.cc +++ b/paddle/fluid/framework/channel_test.cc @@ -20,6 +20,7 @@ limitations under the License. */ #include "gtest/gtest.h" using paddle::framework::Channel; +using paddle::framework::ChannelHolder; using paddle::framework::MakeChannel; using paddle::framework::CloseChannel; using paddle::framework::details::Buffered; @@ -508,3 +509,36 @@ TEST(Channel, UnbufferedChannelDestroyUnblocksSendersTest) { auto ch = MakeChannel(0); ChannelDestroyUnblockSenders(ch); } + +void ChannelHolderSendReceive(ChannelHolder *ch) { + unsigned sum_send = 0; + std::thread t([&]() { + for (int i = 0; i < 5; i++) { + EXPECT_EQ(ch->Send(&i), true); + sum_send += i; + } + }); + for (int i = 0; i < 5; i++) { + int recv; + EXPECT_EQ(ch->Receive(&recv), true); + EXPECT_EQ(recv, i); + } + + ch->close(); + t.join(); + EXPECT_EQ(sum_send, 10U); +} + +TEST(ChannelHolder, ChannelHolderBufferedSendReceiveTest) { + ChannelHolder *ch = new ChannelHolder(); + ch->Reset(10); + ChannelHolderSendReceive(ch); + delete ch; +} + +TEST(ChannelHolder, ChannelHolderUnBufferedSendReceiveTest) { + ChannelHolder *ch = new ChannelHolder(); + ch->Reset(0); + ChannelHolderSendReceive(ch); + delete ch; +} diff --git a/paddle/fluid/framework/data_device_transform.cc b/paddle/fluid/framework/data_device_transform.cc index 3c6dd28455b02aa71d8ed09d8c2c81397a6f9955..85dbb39e6fba735471446b5e5e71a612282c498a 100644 --- a/paddle/fluid/framework/data_device_transform.cc +++ b/paddle/fluid/framework/data_device_transform.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -37,7 +37,7 @@ void TransDataDevice(const Tensor& in, const platform::Place& dst_place, << " dst_place: " << dst_place; auto* dev_ctx = GetDeviceContext(in.place(), dst_place); dev_ctx->Wait(); - Copy(in, dst_place, *dev_ctx, out); + TensorCopy(in, dst_place, *dev_ctx, out); dev_ctx->Wait(); } diff --git a/paddle/fluid/framework/data_device_transform.h b/paddle/fluid/framework/data_device_transform.h index 0c4559f586aaf3cc055f9b53b050b3f3a97573bd..8ff97646cfce7979b1c9c570e6de4f1bd26916c3 100644 --- a/paddle/fluid/framework/data_device_transform.h +++ b/paddle/fluid/framework/data_device_transform.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/framework/data_device_transform_test.cu b/paddle/fluid/framework/data_device_transform_test.cu index f740f9b3268be31973774674bdea9eb404f718ed..e896a06162527ed0289767901f4b4a33fcd2875f 100644 --- a/paddle/fluid/framework/data_device_transform_test.cu +++ b/paddle/fluid/framework/data_device_transform_test.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -51,10 +51,10 @@ class TestOpWithKernel : public OperatorWithKernel { const ExecutionContext& ctx) const override { if (Attr("use_gpu")) { VLOG(3) << "force use gpu kernel"; - return OpKernelType(proto::DataType::FP32, platform::CUDAPlace(0)); + return OpKernelType(proto::VarType::FP32, platform::CUDAPlace(0)); } else { VLOG(3) << "use default kernel"; - return OpKernelType(proto::DataType::FP32, + return OpKernelType(proto::VarType::FP32, ctx.Input("input")->place()); } } @@ -157,8 +157,8 @@ TEST(Operator, CPUtoGPU) { auto dev_ctx = pool.Get(cuda_place); paddle::framework::Tensor output_tensor; - Copy(output2->Get(), paddle::platform::CPUPlace(), *dev_ctx, - &output_tensor); + TensorCopy(output2->Get(), paddle::platform::CPUPlace(), *dev_ctx, + &output_tensor); dev_ctx->Wait(); float* output2_ptr = output_tensor.data(); diff --git a/paddle/fluid/framework/data_layout.h b/paddle/fluid/framework/data_layout.h index b72f13f2e8f28556c195e65e3096b6ef1ba9e13a..39222fc4ed6656dac4773c0c8829608bb954b4c6 100644 --- a/paddle/fluid/framework/data_layout.h +++ b/paddle/fluid/framework/data_layout.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/data_layout_transform.cc b/paddle/fluid/framework/data_layout_transform.cc index c546a508fe1bc1c6e1608cb16a2e1f708a083895..4ca447d50a7262f44e5feb3739dce653604a6ed8 100644 --- a/paddle/fluid/framework/data_layout_transform.cc +++ b/paddle/fluid/framework/data_layout_transform.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/data_layout_transform.h b/paddle/fluid/framework/data_layout_transform.h index 862405fbf466cd5e5fc819f42cc7392b1c4ca624..ba15be9fc77b8405cb4bbca3f62a8be44a3f604e 100644 --- a/paddle/fluid/framework/data_layout_transform.h +++ b/paddle/fluid/framework/data_layout_transform.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/data_layout_transform_test.cc b/paddle/fluid/framework/data_layout_transform_test.cc index 99eb46bde34b089c3da65885748a1e77fe40c700..dd17cac0e10db0d058d399cc725e18dcb14be507 100644 --- a/paddle/fluid/framework/data_layout_transform_test.cc +++ b/paddle/fluid/framework/data_layout_transform_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,9 +27,9 @@ TEST(DataTransform, DataLayoutFunction) { in.mutable_data(make_ddim({2, 3, 1, 2}), place); in.set_layout(DataLayout::kNHWC); - auto kernel_nhwc = OpKernelType(proto::DataType::FP32, place, + auto kernel_nhwc = OpKernelType(proto::VarType::FP32, place, DataLayout::kNHWC, LibraryType::kPlain); - auto kernel_ncwh = OpKernelType(proto::DataType::FP32, place, + auto kernel_ncwh = OpKernelType(proto::VarType::FP32, place, DataLayout::kNCHW, LibraryType::kPlain); TransDataLayout(kernel_nhwc, kernel_ncwh, in, &out); @@ -41,4 +41,4 @@ TEST(DataTransform, DataLayoutFunction) { EXPECT_TRUE(in.layout() == DataLayout::kNHWC); EXPECT_TRUE(in.dims() == make_ddim({2, 3, 1, 2})); -} \ No newline at end of file +} diff --git a/paddle/fluid/framework/data_transform.cc b/paddle/fluid/framework/data_transform.cc index 9575d01af8875cc21061979e54ce0612d8a7f3a5..0475fc1d9aaeda39b3fe845b70461c434bcaafc4 100644 --- a/paddle/fluid/framework/data_transform.cc +++ b/paddle/fluid/framework/data_transform.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/data_transform.h b/paddle/fluid/framework/data_transform.h index 70d3a174accc8beda06c550bc5ac9ee97897eb2e..9ec67e6f3d6358cd658e198602f5e802a0ba4cc9 100644 --- a/paddle/fluid/framework/data_transform.h +++ b/paddle/fluid/framework/data_transform.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/data_type.h b/paddle/fluid/framework/data_type.h index 7a527f0d0c12806045d21b1cf279ccfd2cf73c8d..1dec766a345d8d6c6fdafc1b50450a9dde91fe5d 100644 --- a/paddle/fluid/framework/data_type.h +++ b/paddle/fluid/framework/data_type.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,35 +20,35 @@ limitations under the License. */ namespace paddle { namespace framework { -inline proto::DataType ToDataType(std::type_index type) { +inline proto::VarType::Type ToDataType(std::type_index type) { using namespace paddle::framework::proto; if (typeid(float).hash_code() == type.hash_code()) { - return DataType::FP32; + return proto::VarType::FP32; } else if (typeid(double).hash_code() == type.hash_code()) { - return DataType::FP64; + return proto::VarType::FP64; } else if (typeid(int).hash_code() == type.hash_code()) { - return DataType::INT32; + return proto::VarType::INT32; } else if (typeid(int64_t).hash_code() == type.hash_code()) { - return DataType::INT64; + return proto::VarType::INT64; } else if (typeid(bool).hash_code() == type.hash_code()) { - return DataType::BOOL; + return proto::VarType::BOOL; } else { PADDLE_THROW("Not supported"); } } -inline std::type_index ToTypeIndex(proto::DataType type) { +inline std::type_index ToTypeIndex(proto::VarType::Type type) { using namespace paddle::framework::proto; switch (type) { - case DataType::FP32: + case proto::VarType::FP32: return typeid(float); - case DataType::FP64: + case proto::VarType::FP64: return typeid(double); - case DataType::INT32: + case proto::VarType::INT32: return typeid(int); - case DataType::INT64: + case proto::VarType::INT64: return typeid(int64_t); - case DataType::BOOL: + case proto::VarType::BOOL: return typeid(bool); default: PADDLE_THROW("Not support type %d", type); @@ -56,22 +56,22 @@ inline std::type_index ToTypeIndex(proto::DataType type) { } template -inline void VisitDataType(proto::DataType type, Visitor visitor) { +inline void VisitDataType(proto::VarType::Type type, Visitor visitor) { using namespace paddle::framework::proto; switch (type) { - case DataType::FP32: + case proto::VarType::FP32: visitor.template operator()(); break; - case DataType::FP64: + case proto::VarType::FP64: visitor.template operator()(); break; - case DataType::INT32: + case proto::VarType::INT32: visitor.template operator()(); break; - case DataType::INT64: + case proto::VarType::INT64: visitor.template operator()(); break; - case DataType::BOOL: + case proto::VarType::BOOL: visitor.template operator()(); break; default: @@ -79,22 +79,22 @@ inline void VisitDataType(proto::DataType type, Visitor visitor) { } } -inline std::string DataTypeToString(const proto::DataType type) { +inline std::string DataTypeToString(const proto::VarType::Type type) { using namespace paddle::framework::proto; switch (type) { - case DataType::FP16: + case proto::VarType::FP16: return "float16"; - case DataType::FP32: + case proto::VarType::FP32: return "float32"; - case DataType::FP64: + case proto::VarType::FP64: return "float64"; - case DataType::INT16: + case proto::VarType::INT16: return "int16"; - case DataType::INT32: + case proto::VarType::INT32: return "int32"; - case DataType::INT64: + case proto::VarType::INT64: return "int64"; - case DataType::BOOL: + case proto::VarType::BOOL: return "bool"; default: PADDLE_THROW("Not support type %d", type); @@ -102,7 +102,7 @@ inline std::string DataTypeToString(const proto::DataType type) { } inline std::ostream& operator<<(std::ostream& out, - const proto::DataType& type) { + const proto::VarType::Type& type) { out << DataTypeToString(type); return out; } diff --git a/paddle/fluid/framework/data_type_transform.cc b/paddle/fluid/framework/data_type_transform.cc index 6921927305aa3a7dee801ead888737a1ab93fc8e..54cc1575d880242c01cd4752f522380a673b7c75 100644 --- a/paddle/fluid/framework/data_type_transform.cc +++ b/paddle/fluid/framework/data_type_transform.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -65,19 +65,19 @@ void TransDataType(const OpKernelType& kernel_type_for_var, auto ctx = pool.Get(in.place()); switch (src_type) { - case proto::DataType::FP32: + case proto::VarType::FP32: framework::VisitDataType(dst_type, CastDataType(in, out, ctx)); break; - case proto::DataType::FP64: + case proto::VarType::FP64: framework::VisitDataType(dst_type, CastDataType(in, out, ctx)); break; - case proto::DataType::INT32: + case proto::VarType::INT32: framework::VisitDataType(dst_type, CastDataType(in, out, ctx)); break; - case proto::DataType::INT64: + case proto::VarType::INT64: framework::VisitDataType(dst_type, CastDataType(in, out, ctx)); break; - case proto::DataType::BOOL: + case proto::VarType::BOOL: framework::VisitDataType(dst_type, CastDataType(in, out, ctx)); break; default: diff --git a/paddle/fluid/framework/data_type_transform.h b/paddle/fluid/framework/data_type_transform.h index 830cced093913839ddef2841b3de1017dc2bc426..e75da2588d07a754783f052173c3e0dce118f1b8 100644 --- a/paddle/fluid/framework/data_type_transform.h +++ b/paddle/fluid/framework/data_type_transform.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/data_type_transform_test.cc b/paddle/fluid/framework/data_type_transform_test.cc index 88dbc51b21718e2261f1c9485177621a827485e2..724c8c301f25cca21704de398fc416dff46c330c 100644 --- a/paddle/fluid/framework/data_type_transform_test.cc +++ b/paddle/fluid/framework/data_type_transform_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ TEST(DataTypeTransform, CPUTransform) { ptr[i] = i / 3; } - auto kernel_fp32 = OpKernelType(proto::DataType::FP32, place, + auto kernel_fp32 = OpKernelType(proto::VarType::FP32, place, DataLayout::kAnyLayout, LibraryType::kPlain); - auto kernel_fp64 = OpKernelType(proto::DataType::FP64, place, + auto kernel_fp64 = OpKernelType(proto::VarType::FP64, place, DataLayout::kAnyLayout, LibraryType::kPlain); - auto kernel_int32 = OpKernelType(proto::DataType::INT32, place, + auto kernel_int32 = OpKernelType(proto::VarType::INT32, place, DataLayout::kAnyLayout, LibraryType::kPlain); TransDataType(kernel_fp32, kernel_fp64, in, &out); diff --git a/paddle/fluid/framework/ddim.cc b/paddle/fluid/framework/ddim.cc index 98f1fa9d209eb23627949a4ccb235566652076a5..97afd366387e9ba6476be59a4d73d53a38834d0e 100644 --- a/paddle/fluid/framework/ddim.cc +++ b/paddle/fluid/framework/ddim.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/ddim.h b/paddle/fluid/framework/ddim.h index 405d9af7028d74e52ed015a269770c9b4ae23a5f..5aff10d3b95902fdb9fe432d9f31830304dd3d07 100644 --- a/paddle/fluid/framework/ddim.h +++ b/paddle/fluid/framework/ddim.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/ddim_test.cc b/paddle/fluid/framework/ddim_test.cc index 18d305a4036840066a7d9c999a7e73db863274d7..c1eb3210fdc5ae1b0ddb9736184e152fdd10a242 100644 --- a/paddle/fluid/framework/ddim_test.cc +++ b/paddle/fluid/framework/ddim_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/dim.h b/paddle/fluid/framework/dim.h index 3938fd3df5b54443fcbaebf600840ccf2337a173..08b708006aadc4769bde7b37347ac1adfeca2bf7 100644 --- a/paddle/fluid/framework/dim.h +++ b/paddle/fluid/framework/dim.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/dim_test.cu b/paddle/fluid/framework/dim_test.cu index 0f1969d79775ba70661806d589ae3de2696b77e8..0f384d12e6f04a96add03ccdbe7b11156c6cc67c 100644 --- a/paddle/fluid/framework/dim_test.cu +++ b/paddle/fluid/framework/dim_test.cu @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/eigen.h b/paddle/fluid/framework/eigen.h index d1b8c701a7941813c0fbf441b8a6c7f4d3811a6d..4ea1df655df005ba7585fb67fb0a3c3411a76418 100644 --- a/paddle/fluid/framework/eigen.h +++ b/paddle/fluid/framework/eigen.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/eigen_test.cc b/paddle/fluid/framework/eigen_test.cc index f9e3abeccb34fd1778cac6918d24e30021b433e9..bdc526d86f8fb3bc19e9252c38d63465e1805078 100644 --- a/paddle/fluid/framework/eigen_test.cc +++ b/paddle/fluid/framework/eigen_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/executor.cc b/paddle/fluid/framework/executor.cc index 816ad8d6590a1af3a043cfef5da1edee5119575d..0d2691e8115ad6de46dcd4fcd5b7fd79ed60ecb9 100644 --- a/paddle/fluid/framework/executor.cc +++ b/paddle/fluid/framework/executor.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ limitations under the License. */ #include #include "gflags/gflags.h" +#include "paddle/fluid/framework/channel.h" #include "paddle/fluid/framework/feed_fetch_method.h" #include "paddle/fluid/framework/feed_fetch_type.h" #include "paddle/fluid/framework/lod_rank_table.h" @@ -36,30 +37,34 @@ namespace framework { Executor::Executor(const platform::Place& place) : place_(place) {} -static void CreateTensor(Variable* var, proto::VarDesc::VarType var_type) { - if (var_type == proto::VarDesc::LOD_TENSOR) { +static void CreateTensor(Variable* var, proto::VarType::Type var_type) { + if (var_type == proto::VarType::LOD_TENSOR) { var->GetMutable(); - } else if (var_type == proto::VarDesc::SELECTED_ROWS) { + } else if (var_type == proto::VarType::SELECTED_ROWS) { var->GetMutable(); - } else if (var_type == proto::VarDesc::FEED_MINIBATCH) { + } else if (var_type == proto::VarType::FEED_MINIBATCH) { var->GetMutable(); - } else if (var_type == proto::VarDesc::FETCH_LIST) { + } else if (var_type == proto::VarType::FETCH_LIST) { var->GetMutable(); - } else if (var_type == proto::VarDesc::STEP_SCOPES) { + } else if (var_type == proto::VarType::STEP_SCOPES) { var->GetMutable>(); - } else if (var_type == proto::VarDesc::LOD_RANK_TABLE) { + } else if (var_type == proto::VarType::LOD_RANK_TABLE) { var->GetMutable(); - } else if (var_type == proto::VarDesc::LOD_TENSOR_ARRAY) { + } else if (var_type == proto::VarType::LOD_TENSOR_ARRAY) { var->GetMutable(); - } else if (var_type == proto::VarDesc::PLACE_LIST) { + } else if (var_type == proto::VarType::PLACE_LIST) { var->GetMutable(); - } else if (var_type == proto::VarDesc::READER) { + } else if (var_type == proto::VarType::READER) { var->GetMutable(); + } else if (var_type == proto::VarType::CHANNEL) { + var->GetMutable(); + } else if (var_type == proto::VarType::NCCL_COM) { + // GetMutable will be called in ncclInit } else { PADDLE_THROW( "Variable type %d is not in " "[LOD_TENSOR, SELECTED_ROWS, FEED_MINIBATCH, FETCH_LIST, " - "LOD_RANK_TABLE, PLACE_LIST, READER]", + "LOD_RANK_TABLE, PLACE_LIST, READER, CHANNEL, NCCL_COM]", var_type); } } @@ -73,8 +78,10 @@ static void CheckTensorNANOrInf(const std::string& name, tensor.type().hash_code() != typeid(double).hash_code()) { return; } - PADDLE_ENFORCE(!framework::HasInf(tensor), "Tensor %s has Inf", name); - PADDLE_ENFORCE(!framework::HasNAN(tensor), "Tensor %s has NAN", name); + PADDLE_ENFORCE(!framework::TensorContainsInf(tensor), + "Tensor %s contains Inf", name); + PADDLE_ENFORCE(!framework::TensorContainsNAN(tensor), + "Tensor %s contains NAN", name); } void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id, @@ -118,13 +125,13 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id, for (auto& op_desc : block.AllOps()) { auto op = paddle::framework::OpRegistry::CreateOp(*op_desc); - VLOG(4) << op->DebugStringEx(local_scope); platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance(); platform::RecordEvent record_event(op->Type(), pool.Get(place_)); + VLOG(3) << place_ << " " << op->DebugStringEx(local_scope); op->Run(*local_scope, place_); - VLOG(3) << op->DebugStringEx(local_scope); + if (FLAGS_benchmark) { VLOG(2) << "Memory used after operator " + op->Type() + " running: " << memory::memory_usage(place_); @@ -182,7 +189,7 @@ static bool has_feed_operators( auto var = block->FindVar(feed_holder_name); PADDLE_ENFORCE_NOT_NULL(var, "Block should already have a '%s' variable", feed_holder_name); - PADDLE_ENFORCE_EQ(var->GetType(), proto::VarDesc::FEED_MINIBATCH, + PADDLE_ENFORCE_EQ(var->GetType(), proto::VarType::FEED_MINIBATCH, "'%s' variable should be 'FEED_MINIBATCH' type", feed_holder_name); } @@ -222,7 +229,7 @@ static bool has_fetch_operators( auto var = block->FindVar(fetch_holder_name); PADDLE_ENFORCE_NOT_NULL(var, "Block should already have a '%s' variable", fetch_holder_name); - PADDLE_ENFORCE_EQ(var->GetType(), proto::VarDesc::FETCH_LIST, + PADDLE_ENFORCE_EQ(var->GetType(), proto::VarType::FETCH_LIST, "'%s' variable should be 'FETCH_LIST' type", fetch_holder_name); } @@ -241,7 +248,7 @@ void Executor::Run(const ProgramDesc& program, Scope* scope, if (!has_feed_operators(global_block, feed_targets, feed_holder_name)) { // create feed_holder variable auto* feed_holder = global_block->Var(feed_holder_name); - feed_holder->SetType(proto::VarDesc::FEED_MINIBATCH); + feed_holder->SetType(proto::VarType::FEED_MINIBATCH); feed_holder->SetPersistable(true); int i = 0; @@ -274,7 +281,7 @@ void Executor::Run(const ProgramDesc& program, Scope* scope, if (!has_fetch_operators(global_block, fetch_targets, fetch_holder_name)) { // create fetch_holder variable auto* fetch_holder = global_block->Var(fetch_holder_name); - fetch_holder->SetType(proto::VarDesc::FETCH_LIST); + fetch_holder->SetType(proto::VarType::FETCH_LIST); fetch_holder->SetPersistable(true); int i = 0; diff --git a/paddle/fluid/framework/executor.h b/paddle/fluid/framework/executor.h index 893c949939e8db2f5227b940bf721ca7f114db9c..c1f4d4e02a951e8b127b66cae125309e4798cc76 100644 --- a/paddle/fluid/framework/executor.h +++ b/paddle/fluid/framework/executor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/feed_fetch_method.cc b/paddle/fluid/framework/feed_fetch_method.cc index a9bb17355d9bc1fb7f355a4038a4c5831d3530b1..a8c3e227db3f8f3781d0acd5e233d7bea1123df1 100644 --- a/paddle/fluid/framework/feed_fetch_method.cc +++ b/paddle/fluid/framework/feed_fetch_method.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/feed_fetch_method.h b/paddle/fluid/framework/feed_fetch_method.h index 5355c29047e668d1a2ec141b303dd562158b2bb3..d6130f421e122047c2f4ed315e6f2fb7484cda1a 100644 --- a/paddle/fluid/framework/feed_fetch_method.h +++ b/paddle/fluid/framework/feed_fetch_method.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/feed_fetch_type.h b/paddle/fluid/framework/feed_fetch_type.h index 4281e36b138f66268e2f1e835d4475676d97839d..b0d1e9f0a7074da33af1cd279ab913ab604150b1 100644 --- a/paddle/fluid/framework/feed_fetch_type.h +++ b/paddle/fluid/framework/feed_fetch_type.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/framework.proto b/paddle/fluid/framework/framework.proto index d7be1a7352da56e411396614e33919bb55bc3b0f..5b43f5a8a4a1c128b04ac206d387e30c55f533fe 100644 --- a/paddle/fluid/framework/framework.proto +++ b/paddle/fluid/framework/framework.proto @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -91,52 +91,66 @@ message OpProto { required string comment = 5; } -enum DataType { - BOOL = 0; - INT16 = 1; - INT32 = 2; - INT64 = 3; - FP16 = 4; - FP32 = 5; - FP64 = 6; -} +message VarType { + enum Type { + // Pod Types + BOOL = 0; + INT16 = 1; + INT32 = 2; + INT64 = 3; + FP16 = 4; + FP32 = 5; + FP64 = 6; + + // Other types that may need additional descriptions + LOD_TENSOR = 7; + SELECTED_ROWS = 8; + FEED_MINIBATCH = 9; + FETCH_LIST = 10; + STEP_SCOPES = 11; + LOD_RANK_TABLE = 12; + LOD_TENSOR_ARRAY = 13; + PLACE_LIST = 14; + READER = 15; + CHANNEL = 16; + NCCL_COM = 17; + } -message TensorDesc { - required DataType data_type = 1; - repeated int64 dims = 2; // [UNK, 640, 480] is saved as [-1, 640, 480] -} + required Type type = 1; -message LoDTensorDesc { - required TensorDesc tensor = 1; - optional int32 lod_level = 2 [ default = 0 ]; -} + message TensorDesc { + // Should only be PODType. Is enforced in C++ + required Type data_type = 1; + repeated int64 dims = 2; // [UNK, 640, 480] is saved as [-1, 640, 480] + } + optional TensorDesc selected_rows = 2; -message LoDTensorArrayDesc { - required TensorDesc tensor = 1; - optional int32 lod_level = 2 [ default = 0 ]; -} + message LoDTensorDesc { + required TensorDesc tensor = 1; + optional int32 lod_level = 2 [ default = 0 ]; + } + optional LoDTensorDesc lod_tensor = 3; -message ReaderDesc { repeated LoDTensorDesc lod_tensor = 1; } + message LoDTensorArrayDesc { + required TensorDesc tensor = 1; + optional int32 lod_level = 2 [ default = 0 ]; + } + optional LoDTensorArrayDesc tensor_array = 4; -message VarDesc { - enum VarType { - LOD_TENSOR = 1; - SELECTED_ROWS = 2; - FEED_MINIBATCH = 3; - FETCH_LIST = 4; - STEP_SCOPES = 5; - LOD_RANK_TABLE = 6; - LOD_TENSOR_ARRAY = 7; - PLACE_LIST = 8; - READER = 9; + message ReaderDesc { repeated LoDTensorDesc lod_tensor = 1; } + optional ReaderDesc reader = 5; + + message ChannelDesc { + required Type data_type = 1; + required int64 capacity = 2; } + optional ChannelDesc channel = 6; +} + +message VarDesc { required string name = 1; required VarType type = 2; optional bool persistable = 3 [ default = false ]; - optional LoDTensorDesc lod_tensor = 4; - optional TensorDesc selected_rows = 5; - optional LoDTensorArrayDesc tensor_array = 6; - optional ReaderDesc reader = 7; } message BlockDesc { @@ -144,6 +158,7 @@ message BlockDesc { required int32 parent_idx = 2; repeated VarDesc vars = 3; repeated OpDesc ops = 4; + optional int32 forward_block_idx = 5 [ default = -1 ]; } // Please refer to diff --git a/paddle/fluid/framework/grad_op_desc_maker.h b/paddle/fluid/framework/grad_op_desc_maker.h index 21dd4e885485f88eeeb034ca45c643f9fadf3163..cf697187d6225f3a1d2506120eebe14d4a41dff9 100644 --- a/paddle/fluid/framework/grad_op_desc_maker.h +++ b/paddle/fluid/framework/grad_op_desc_maker.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/init.cc b/paddle/fluid/framework/init.cc index ad806a8cd791bc164d974d21aec92beff1f8106f..2e0a224ff5df749fd8c809dc88a85a1643542abf 100644 --- a/paddle/fluid/framework/init.cc +++ b/paddle/fluid/framework/init.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/init.h b/paddle/fluid/framework/init.h index c8fd964d006baf729888414ded2aec85ba5a024e..7d86d1581190780f513776c69b18ad41eb2ce14d 100644 --- a/paddle/fluid/framework/init.h +++ b/paddle/fluid/framework/init.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/init_test.cc b/paddle/fluid/framework/init_test.cc index f3018541e27a403e1b6e63a8da9eeb1f67915e9e..2a03f0afe657e4b3ac173e8718dd6f6f81ee5e6a 100644 --- a/paddle/fluid/framework/init_test.cc +++ b/paddle/fluid/framework/init_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/library_type.h b/paddle/fluid/framework/library_type.h index 1e3084835439b0d55de72a669b93acbaef7ed6b9..ea538731b469901a3357d624c5bb0fddc4058488 100644 --- a/paddle/fluid/framework/library_type.h +++ b/paddle/fluid/framework/library_type.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/lod_rank_table.cc b/paddle/fluid/framework/lod_rank_table.cc index 31c87492349bff4cd81b101a0e8d44b0516bac46..6bc795b642bf79b7556869c5ebe9b0323d3cc5fc 100644 --- a/paddle/fluid/framework/lod_rank_table.cc +++ b/paddle/fluid/framework/lod_rank_table.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/lod_rank_table.h b/paddle/fluid/framework/lod_rank_table.h index 0eaaf49e4c4d90250b247edf2a8699b8c7c5920d..ef83e71160e0e52071b033ea8b86e6da91bbfad2 100644 --- a/paddle/fluid/framework/lod_rank_table.h +++ b/paddle/fluid/framework/lod_rank_table.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/lod_tensor.cc b/paddle/fluid/framework/lod_tensor.cc index 70a2a652664da504a1b27b97ed5e1a1abfa188ea..e2f4e9cad1996578b7c51257785e1273d126f80f 100644 --- a/paddle/fluid/framework/lod_tensor.cc +++ b/paddle/fluid/framework/lod_tensor.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ std::ostream &operator<<(std::ostream &os, const LoDTensor &t) { if (!platform::is_cpu_place(t.place())) { LoDTensor tt; - framework::Copy(t, platform::CPUPlace(), &tt); + framework::TensorCopy(t, platform::CPUPlace(), &tt); platform::DeviceContextPool &pool = platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(t.place()); dev_ctx.Wait(); @@ -261,7 +261,7 @@ void SerializeToStream(std::ostream &os, const LoDTensor &tensor, } } // the 3st field, Tensor - SerializeToStream(os, static_cast(tensor), dev_ctx); + TensorToStream(os, static_cast(tensor), dev_ctx); } void DeserializeFromStream(std::istream &is, LoDTensor *tensor, @@ -288,7 +288,7 @@ void DeserializeFromStream(std::istream &is, LoDTensor *tensor, } } // the 3st filed, Tensor - DeserializeFromStream(is, static_cast(tensor), dev_ctx); + TensorFromStream(is, static_cast(tensor), dev_ctx); } std::vector LoDTensor::SplitLoDTensor( @@ -314,14 +314,14 @@ std::vector LoDTensor::SplitLoDTensor( if (lod().empty()) { auto src = Slice(begin, end); auto &dst_place = places[i]; - framework::Copy(src, dst_place, &dst); + framework::TensorCopy(src, dst_place, &dst); } else { auto lod_and_offset = GetSubLoDAndAbsoluteOffset(lod(), begin, end, 0); auto &offset = lod_and_offset.second; auto src = Slice(offset.first, offset.second); auto &dst_place = places[i]; - framework::Copy(src, dst_place, &dst); + framework::TensorCopy(src, dst_place, &dst); LoD my_lod; for (auto &l : lod_and_offset.first) { @@ -375,7 +375,7 @@ void LoDTensor::MergeLoDTensor( for (auto *src : lod_tensors) { int end = begin + src->dims()[0]; auto dst = Slice(begin, end); - framework::Copy(*src, dst_place, &dst); + framework::TensorCopy(*src, dst_place, &dst); begin = end; } } diff --git a/paddle/fluid/framework/lod_tensor.h b/paddle/fluid/framework/lod_tensor.h index 1509a9fb1347659f7526c6892f632feb8c84579c..94d5a6e9fd9b68d3d8230a8c258316efadda5a05 100644 --- a/paddle/fluid/framework/lod_tensor.h +++ b/paddle/fluid/framework/lod_tensor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -175,8 +175,8 @@ LoDTensor LodExpand(const LoDTensor& source, const LoD& lod, size_t level, for (size_t ins = 0; ins < num_instances; ins++) { for (size_t elem = lod_level[ins]; elem < lod_level[ins + 1]; elem++) { auto slice = tensor.Slice(elem, elem + 1); - Copy(source.Slice(ins, ins + 1), platform::CPUPlace(), - platform::CPUDeviceContext(), &slice); + TensorCopy(source.Slice(ins, ins + 1), platform::CPUPlace(), + platform::CPUDeviceContext(), &slice); } } return tensor; diff --git a/paddle/fluid/framework/lod_tensor_array.h b/paddle/fluid/framework/lod_tensor_array.h index 652513bd22597000e8249eb19776182d850793aa..6d7b6a4ada8729e3698dab5d2b1861aac632be79 100644 --- a/paddle/fluid/framework/lod_tensor_array.h +++ b/paddle/fluid/framework/lod_tensor_array.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/lod_tensor_test.cc b/paddle/fluid/framework/lod_tensor_test.cc index 7e0ed2495d68a8cc0d377aaf5b5103aea1064688..5e135192ce774ab5c351b89164be9d7600ae3640 100644 --- a/paddle/fluid/framework/lod_tensor_test.cc +++ b/paddle/fluid/framework/lod_tensor_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/lod_tensor_test.cu b/paddle/fluid/framework/lod_tensor_test.cu index 4dd7810c1b25cbfeb7d6d79034a97db3f1d67ebb..be65da5ba230e4bb15b09a07431d3107ffe19522 100644 --- a/paddle/fluid/framework/lod_tensor_test.cu +++ b/paddle/fluid/framework/lod_tensor_test.cu @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/mixed_vector.h b/paddle/fluid/framework/mixed_vector.h index 6e5ceefadd7c35d743df454909beaef37d9343d5..6a6fa538718837a958b7d82c37f583f62f4bf96e 100644 --- a/paddle/fluid/framework/mixed_vector.h +++ b/paddle/fluid/framework/mixed_vector.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -291,7 +291,7 @@ class Vector { void CopyToCPU() const { // COPY GPU Data To CPU - Copy(cuda_vec_, platform::CPUPlace(), &cpu_vec_); + TensorCopy(cuda_vec_, platform::CPUPlace(), &cpu_vec_); WaitPlace(cuda_vec_.place()); } @@ -305,13 +305,14 @@ class Vector { void ImmutableCUDA(platform::Place place) const { if (IsDirty()) { if (IsInCPU()) { - Copy(cpu_vec_, boost::get(place), &cuda_vec_); + TensorCopy(cpu_vec_, boost::get(place), + &cuda_vec_); WaitPlace(place); UnsetFlag(kDirty); SetFlag(kDataInCUDA); } else if (IsInCUDA() && !(place == cuda_vec_.place())) { framework::Tensor tmp; - Copy(cuda_vec_, boost::get(place), &tmp); + TensorCopy(cuda_vec_, boost::get(place), &tmp); WaitPlace(cuda_vec_.place()); cuda_vec_.ShareDataWith(tmp); // Still dirty @@ -322,13 +323,14 @@ class Vector { } else { if (!IsInCUDA()) { // Even data is not dirty. However, data is not in CUDA. Copy data. - Copy(cpu_vec_, boost::get(place), &cuda_vec_); + TensorCopy(cpu_vec_, boost::get(place), + &cuda_vec_); WaitPlace(place); SetFlag(kDataInCUDA); } else if (!(place == cuda_vec_.place())) { framework::Tensor tmp; WaitPlace(cuda_vec_.place()); - Copy(cuda_vec_, boost::get(place), &tmp); + TensorCopy(cuda_vec_, boost::get(place), &tmp); WaitPlace(cuda_vec_.place()); WaitPlace(place); cuda_vec_.ShareDataWith(tmp); diff --git a/paddle/fluid/framework/mixed_vector_test.cu b/paddle/fluid/framework/mixed_vector_test.cu index 8ea574b31cc5825cc2f788377d66c4c45e723898..4bf78499f2fda2d2631e05ddcbbd0bc49498af1a 100644 --- a/paddle/fluid/framework/mixed_vector_test.cu +++ b/paddle/fluid/framework/mixed_vector_test.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/op_desc.cc b/paddle/fluid/framework/op_desc.cc index cbc15e60b83397ed8420bc7a4cd716ef15979554..eabfdc11a8b314c4af9626ded3edd1bcba212de1 100644 --- a/paddle/fluid/framework/op_desc.cc +++ b/paddle/fluid/framework/op_desc.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -53,11 +53,11 @@ class CompileTimeInferShapeContext : public InferShapeContext { PADDLE_ENFORCE_LT(j, Outputs(out).size()); auto *in_var = block_.FindVarRecursive(Inputs(in)[i]); auto *out_var = block_.FindVarRecursive(Outputs(out)[j]); - if (in_var->GetType() != proto::VarDesc::LOD_TENSOR) { + if (in_var->GetType() != proto::VarType::LOD_TENSOR) { VLOG(3) << "input " << in << " is not LodTensor"; return; } - PADDLE_ENFORCE_EQ(in_var->GetType(), proto::VarDesc::LOD_TENSOR, + PADDLE_ENFORCE_EQ(in_var->GetType(), proto::VarType::LOD_TENSOR, "The %d-th output of Output(%s) must be LoDTensor.", j, out); out_var->SetLoDLevel(in_var->GetLoDLevel()); @@ -66,7 +66,7 @@ class CompileTimeInferShapeContext : public InferShapeContext { bool IsRuntime() const override; protected: - proto::VarDesc::VarType GetVarType(const std::string &name) const override; + proto::VarType::Type GetVarType(const std::string &name) const override; DDim GetDim(const std::string &name) const override; @@ -388,7 +388,7 @@ void OpDesc::InferVarType(BlockDesc *block) const { for (auto &out_pair : this->outputs_) { for (auto &out_var_name : out_pair.second) { block->FindRecursiveOrCreateVar(out_var_name) - .SetType(proto::VarDesc::LOD_TENSOR); + .SetType(proto::VarType::LOD_TENSOR); } } } @@ -507,7 +507,7 @@ void CompileTimeInferShapeContext::SetRepeatedDims( bool CompileTimeInferShapeContext::IsRuntime() const { return false; } -proto::VarDesc::VarType CompileTimeInferShapeContext::GetVarType( +proto::VarType::Type CompileTimeInferShapeContext::GetVarType( const std::string &name) const { return block_.FindVarRecursive(name)->GetType(); } diff --git a/paddle/fluid/framework/op_desc.h b/paddle/fluid/framework/op_desc.h index 698df829e56e1182e742db926a712497ee2b6966..b72aad6fb538ac483e9ce6fc9cb866c75190f006 100644 --- a/paddle/fluid/framework/op_desc.h +++ b/paddle/fluid/framework/op_desc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/op_info.cc b/paddle/fluid/framework/op_info.cc index 703c9c3234b62e80c3f768ddb892584c1c0070c0..b99e82f8c4358b60a014c6fc7c61c9bbb8683834 100644 --- a/paddle/fluid/framework/op_info.cc +++ b/paddle/fluid/framework/op_info.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/op_info.h b/paddle/fluid/framework/op_info.h index e6b3ff9e653196b9234e02131f37d5964c4f6e84..19e5c2c73eac74dee030a4f7820531800f737e4e 100644 --- a/paddle/fluid/framework/op_info.h +++ b/paddle/fluid/framework/op_info.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/op_kernel_type.h b/paddle/fluid/framework/op_kernel_type.h index b5dbff26d7edc212a270d4d187dbb868068790c9..3a1036742c206961fe52660106ae947153e9b244 100644 --- a/paddle/fluid/framework/op_kernel_type.h +++ b/paddle/fluid/framework/op_kernel_type.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -40,12 +40,12 @@ struct OpKernelType { // place, data_type, library_type kinds less than 2^8 constexpr static int LEFT_SHIFT = 8; - proto::DataType data_type_; + proto::VarType::Type data_type_; DataLayout data_layout_; platform::Place place_; LibraryType library_type_; - OpKernelType(proto::DataType data_type, platform::Place place, + OpKernelType(proto::VarType::Type data_type, platform::Place place, DataLayout data_layout = DataLayout::kAnyLayout, LibraryType library_type = LibraryType::kPlain) : data_type_(data_type), @@ -53,7 +53,7 @@ struct OpKernelType { place_(place), library_type_(library_type) {} - OpKernelType(proto::DataType data_type, + OpKernelType(proto::VarType::Type data_type, const platform::DeviceContext& dev_ctx, DataLayout data_layout = DataLayout::kAnyLayout, LibraryType library_type = LibraryType::kPlain) diff --git a/paddle/fluid/framework/op_kernel_type_test.cc b/paddle/fluid/framework/op_kernel_type_test.cc index 64096907df5a52904525ef0bf25bb9527c3a8c4b..d37ce149ce3df63692b41289bb03448d54e392f5 100644 --- a/paddle/fluid/framework/op_kernel_type_test.cc +++ b/paddle/fluid/framework/op_kernel_type_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ limitations under the License. */ TEST(OpKernelType, ToString) { using OpKernelType = paddle::framework::OpKernelType; - using DataType = paddle::framework::proto::DataType; + using DataType = paddle::framework::proto::VarType; using CPUPlace = paddle::platform::CPUPlace; using DataLayout = paddle::framework::DataLayout; using LibraryType = paddle::framework::LibraryType; @@ -33,7 +33,7 @@ TEST(OpKernelType, ToString) { TEST(OpKernelType, Hash) { using OpKernelType = paddle::framework::OpKernelType; - using DataType = paddle::framework::proto::DataType; + using DataType = paddle::framework::proto::VarType; using CPUPlace = paddle::platform::CPUPlace; using CUDAPlace = paddle::platform::CUDAPlace; using DataLayout = paddle::framework::DataLayout; diff --git a/paddle/fluid/framework/op_proto_maker.cc b/paddle/fluid/framework/op_proto_maker.cc index 0a779b10b49ab35dd0dbe25ac3f2bccd34fb654e..3116b03d0433ddf98613796b272238e5fe72ce6a 100644 --- a/paddle/fluid/framework/op_proto_maker.cc +++ b/paddle/fluid/framework/op_proto_maker.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/framework/op_proto_maker.h b/paddle/fluid/framework/op_proto_maker.h index 1dbfc7d37be6ae79fde39434b12355a54ee648f6..cf56b0fa1894374956b3011c88bc70acdba1e464 100644 --- a/paddle/fluid/framework/op_proto_maker.h +++ b/paddle/fluid/framework/op_proto_maker.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/framework/op_proto_maker_test.cc b/paddle/fluid/framework/op_proto_maker_test.cc index cfefee8dbdead9dd0074d954fe7318baae57e8c4..a8d8c6386af940d4a14016b30de344e1c7877b22 100644 --- a/paddle/fluid/framework/op_proto_maker_test.cc +++ b/paddle/fluid/framework/op_proto_maker_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/op_registry.cc b/paddle/fluid/framework/op_registry.cc index 739ec72ebc17e31ab207b0e2260d7f563ceaca6e..bfc411ca2c4a483e344b368da089392d8e4a87c1 100644 --- a/paddle/fluid/framework/op_registry.cc +++ b/paddle/fluid/framework/op_registry.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/op_registry.h b/paddle/fluid/framework/op_registry.h index 73faa99668ad58ddb66de515eb4750883f58bcf5..f1424f13b445155fe4f28732408a2445ab1aa9b7 100644 --- a/paddle/fluid/framework/op_registry.h +++ b/paddle/fluid/framework/op_registry.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/op_registry_test.cc b/paddle/fluid/framework/op_registry_test.cc index 2746168f1dda493368b81820bde2f093d06d7b4e..0d791c8583537d410b838c1662755938353052a9 100644 --- a/paddle/fluid/framework/op_registry_test.cc +++ b/paddle/fluid/framework/op_registry_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -226,7 +226,7 @@ class OpWithKernelTest : public OperatorWithKernel { framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext& ctx) const override { - return framework::OpKernelType(proto::DataType::FP32, ctx.device_context()); + return framework::OpKernelType(proto::VarType::FP32, ctx.device_context()); } }; @@ -290,9 +290,9 @@ class OpWithMultiKernelTest : public OperatorWithKernel { framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext& ctx) const override { - return framework::OpKernelType( - proto::DataType::FP32, platform::CUDAPlace(0), DataLayout::kAnyLayout, - framework::LibraryType::kCUDNN); + return framework::OpKernelType(proto::VarType::FP32, platform::CUDAPlace(0), + DataLayout::kAnyLayout, + framework::LibraryType::kCUDNN); } }; diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index 8effbf1bc6298bdcc381e2176411a79da134653f..7debdd8525741ea4ae93fe7bff7b5817373fd7ce 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -477,7 +477,7 @@ class RuntimeInferShapeContext : public InferShapeContext { } } - proto::VarDesc::VarType GetVarType(const std::string& name) const override { + proto::VarType::Type GetVarType(const std::string& name) const override { auto* var = scope_.FindVar(name); return ToVarType(var->Type()); } @@ -569,7 +569,7 @@ void OperatorWithKernel::RunImpl(const Scope& scope, } } -proto::DataType OperatorWithKernel::IndicateDataType( +proto::VarType::Type OperatorWithKernel::IndicateDataType( const ExecutionContext& ctx) const { auto& scope = ctx.scope(); int data_type = -1; @@ -595,7 +595,7 @@ proto::DataType OperatorWithKernel::IndicateDataType( } } PADDLE_ENFORCE(data_type != -1, "DataType should be indicated by input"); - return static_cast(data_type); + return static_cast(data_type); } OpKernelType OperatorWithKernel::GetExpectedKernelType( diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index 708f87dc8632ac500e1050122c5fd5412071fd22..41214b41cb68cbd7049552f39195ae5257e0d06f 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -394,9 +394,9 @@ class OperatorWithKernel : public OperatorBase { const OpKernelType& expected_kernel_type) const; private: - // indicate kernel DataType by input data. Defaultly all input data must be + // indicate kernel DataType by input data. By default all input data must be // same. - proto::DataType IndicateDataType(const ExecutionContext& ctx) const; + proto::VarType::Type IndicateDataType(const ExecutionContext& ctx) const; void RunImpl(const Scope& scope, const platform::Place& place) const final; }; diff --git a/paddle/fluid/framework/operator_test.cc b/paddle/fluid/framework/operator_test.cc index 0732ec5afe8738313e1d73c52c5303a2e8b1e96a..44ca4d7ca564515ae267c5949d29feaf22790251 100644 --- a/paddle/fluid/framework/operator_test.cc +++ b/paddle/fluid/framework/operator_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -119,7 +119,7 @@ class OpWithKernelTest : public OperatorWithKernel { void InferShape(framework::InferShapeContext* ctx) const override {} OpKernelType GetExpectedKernelType( const ExecutionContext& ctx) const override { - return OpKernelType(proto::DataType::FP32, ctx.GetPlace()); + return OpKernelType(proto::VarType::FP32, ctx.GetPlace()); } }; diff --git a/paddle/fluid/framework/program_desc.cc b/paddle/fluid/framework/program_desc.cc index b3f2e97cd954bd55ab1a8c9def6938c877a79449..049731c7216e542dedcf8754eef79f0a672291d6 100644 --- a/paddle/fluid/framework/program_desc.cc +++ b/paddle/fluid/framework/program_desc.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/program_desc.h b/paddle/fluid/framework/program_desc.h index 937de6ba9270a275e5d4e020fe5f2e7f5ef63557..538a0372116e6f90fd2fae5f00097b8efc5dcb5c 100644 --- a/paddle/fluid/framework/program_desc.h +++ b/paddle/fluid/framework/program_desc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,7 +38,13 @@ class ProgramDesc { BlockDesc *AppendBlock(const BlockDesc &parent); - BlockDesc *MutableBlock(size_t idx) { return blocks_[idx].get(); } + BlockDesc *MutableBlock(size_t idx) { + if (idx == static_cast(kNoneBlockIndex)) { + return nullptr; + } else { + return blocks_[idx].get(); + } + } const BlockDesc &Block(size_t idx) const { return *blocks_[idx]; } diff --git a/paddle/fluid/framework/program_desc_test.cc b/paddle/fluid/framework/program_desc_test.cc index afd5c9dabfbb0dab2832300dedc378ef617d8e81..66618a291b59996836e822587af618927a4263c7 100644 --- a/paddle/fluid/framework/program_desc_test.cc +++ b/paddle/fluid/framework/program_desc_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,15 +22,15 @@ TEST(ProgramDesc, copy_ctor) { ProgramDesc program; auto* global_block = program.MutableBlock(0); auto* x = global_block->Var("X"); - x->SetType(proto::VarDesc_VarType_LOD_TENSOR); + x->SetType(proto::VarType::LOD_TENSOR); x->SetLoDLevel(0); - x->SetDataType(proto::FP32); + x->SetDataType(proto::VarType::FP32); x->SetShape({1000, 784}); auto* y = global_block->Var("Y"); - y->SetType(proto::VarDesc_VarType_LOD_TENSOR); + y->SetType(proto::VarType::LOD_TENSOR); y->SetLoDLevel(0); - y->SetDataType(proto::FP32); + y->SetDataType(proto::VarType::FP32); y->SetShape({784, 100}); auto* op = global_block->AppendOp(); @@ -39,7 +39,7 @@ TEST(ProgramDesc, copy_ctor) { op->SetInput("Y", {y->Name()}); auto* out = global_block->Var("Out"); - out->SetType(proto::VarDesc_VarType_LOD_TENSOR); + out->SetType(proto::VarType::LOD_TENSOR); op->SetOutput("Y", {out->Name()}); ProgramDesc program_copy(program); @@ -84,15 +84,15 @@ TEST(ProgramDescBind, serialize_and_deserialize) { ProgramDesc program_origin; auto* global_block = program_origin.MutableBlock(0); auto* x = global_block->Var("X"); - x->SetType(proto::VarDesc_VarType_LOD_TENSOR); + x->SetType(proto::VarType::LOD_TENSOR); x->SetLoDLevel(0); - x->SetDataType(proto::FP32); + x->SetDataType(proto::VarType::FP32); x->SetShape({1000, 784}); auto* y = global_block->Var("Y"); - y->SetType(proto::VarDesc_VarType_LOD_TENSOR); + y->SetType(proto::VarType::LOD_TENSOR); y->SetLoDLevel(0); - y->SetDataType(proto::FP32); + y->SetDataType(proto::VarType::FP32); y->SetShape({784, 100}); auto* op = global_block->AppendOp(); @@ -101,7 +101,7 @@ TEST(ProgramDescBind, serialize_and_deserialize) { op->SetInput("Y", {y->Name()}); auto* out = global_block->Var("Out"); - out->SetType(proto::VarDesc_VarType_LOD_TENSOR); + out->SetType(proto::VarType::LOD_TENSOR); op->SetOutput("Y", {out->Name()}); std::string binary_str; diff --git a/paddle/fluid/framework/proto_desc.h b/paddle/fluid/framework/proto_desc.h index fa01224fefce50eb3688ff407f0a7c948c5b7cfc..40521c07829336313c32ccbf9152ca8198b99688 100644 --- a/paddle/fluid/framework/proto_desc.h +++ b/paddle/fluid/framework/proto_desc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/prune.cc b/paddle/fluid/framework/prune.cc index 79dbd3bcab4124d3aa765c8ede174c9fb3de689b..71d6e08112a8b9a92103197c221b77f015bdfd09 100644 --- a/paddle/fluid/framework/prune.cc +++ b/paddle/fluid/framework/prune.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/prune.h b/paddle/fluid/framework/prune.h index 601e66b67a77b615e43fe74e72935b1622e59965..4c5a1dedd9950553e93dc681a40af179bdb8a30d 100644 --- a/paddle/fluid/framework/prune.h +++ b/paddle/fluid/framework/prune.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/prune_test.cc b/paddle/fluid/framework/prune_test.cc index 36b76f0763ec2bab861adf86b60093c5e3c4b9e2..0e44b34383027ef58a033eb082f4bb2118b5d8a3 100644 --- a/paddle/fluid/framework/prune_test.cc +++ b/paddle/fluid/framework/prune_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ void AddOp(const std::string &type, const f::VariableNameMap &inputs, for (auto kv : outputs) { for (auto v : kv.second) { auto var = block->Var(v); - var->SetDataType(paddle::framework::proto::DataType::FP32); + var->SetDataType(paddle::framework::proto::VarType::FP32); } } diff --git a/paddle/fluid/framework/reader.cc b/paddle/fluid/framework/reader.cc index 1ef0c4821110a259fd20469e736b93f44a80f90a..dc1caa72a4c09c7045c87575abab0faac7b5bbc8 100644 --- a/paddle/fluid/framework/reader.cc +++ b/paddle/fluid/framework/reader.cc @@ -105,7 +105,7 @@ void BatchReader::ReadNext(std::vector* out) { } } Tensor dst = out_tensor.Slice(dst_offset, dst_offset + ins_shape[0]); - Copy(buffer_[i][j], platform::CPUPlace(), &dst); + TensorCopy(buffer_[i][j], platform::CPUPlace(), &dst); dst_offset += ins_shape[0]; } out_tensor.set_lod(batch_lod); diff --git a/paddle/fluid/framework/scope.cc b/paddle/fluid/framework/scope.cc index 91a8617d6615d31e1c7cfe1bc5457dd69dbf31f7..ea6c8cebd3ff16451c974bf3a0ded9d822a9caf8 100644 --- a/paddle/fluid/framework/scope.cc +++ b/paddle/fluid/framework/scope.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/scope.h b/paddle/fluid/framework/scope.h index 2da9e0716e7c02dc8c5397e37746344dff8e429d..d8fad162e59c8ea6465b2dc78c90709a758ace24 100644 --- a/paddle/fluid/framework/scope.h +++ b/paddle/fluid/framework/scope.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/scope_test.cc b/paddle/fluid/framework/scope_test.cc index d64acb130cb29eda34cb01ef0533c42f1f03dcf8..ebf8178a8319cd33f2cc5eacb95b163043c986b5 100644 --- a/paddle/fluid/framework/scope_test.cc +++ b/paddle/fluid/framework/scope_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/selected_rows.cc b/paddle/fluid/framework/selected_rows.cc index f5d9e9a4951877e031ea6fdf529676fcb21e202f..504344e937dfdc362cdc22298a5f963d87011e9d 100644 --- a/paddle/fluid/framework/selected_rows.cc +++ b/paddle/fluid/framework/selected_rows.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -34,7 +34,7 @@ void SerializeToStream(std::ostream& os, const SelectedRows& selected_rows, os.write(reinterpret_cast(&height), sizeof(height)); } // the 4st field, Tensor data - SerializeToStream(os, selected_rows.value(), dev_ctx); + TensorToStream(os, selected_rows.value(), dev_ctx); } void DeserializeFromStream(std::istream& is, SelectedRows* selected_rows, @@ -62,7 +62,7 @@ void DeserializeFromStream(std::istream& is, SelectedRows* selected_rows, selected_rows->set_height(height); } // the 4st field, tensor which contains the data - DeserializeFromStream(is, selected_rows->mutable_value(), dev_ctx); + TensorFromStream(is, selected_rows->mutable_value(), dev_ctx); } } // namespace framework diff --git a/paddle/fluid/framework/selected_rows.h b/paddle/fluid/framework/selected_rows.h index f1a263962b2efc1ca828dd2eeb45495334ac1047..c9c2c1bb721f2c527fa52f45cc54883f639f4ef8 100644 --- a/paddle/fluid/framework/selected_rows.h +++ b/paddle/fluid/framework/selected_rows.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/framework/selected_rows_test.cc b/paddle/fluid/framework/selected_rows_test.cc index d414f2a5934282b4d586e6a9f7f81e44afbc9305..960d8d64f04a819217413ff881977ce5fb5a30f2 100644 --- a/paddle/fluid/framework/selected_rows_test.cc +++ b/paddle/fluid/framework/selected_rows_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/framework/shape_inference.cc b/paddle/fluid/framework/shape_inference.cc index cfd2334f1af19023c607d364172a4176be10f622..dc9a79020f103dadfd9837cffb18ad5946f95f31 100644 --- a/paddle/fluid/framework/shape_inference.cc +++ b/paddle/fluid/framework/shape_inference.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -116,19 +116,19 @@ void InferShapeContext::SetDims(const std::vector &names, } } -std::vector InferShapeContext::GetInputsVarType( +std::vector InferShapeContext::GetInputsVarType( const std::string &name) const { return GetVarTypes(Inputs(name)); } -std::vector InferShapeContext::GetOutputsVarType( +std::vector InferShapeContext::GetOutputsVarType( const std::string &name) const { return GetVarTypes(Outputs(name)); } -std::vector InferShapeContext::GetVarTypes( +std::vector InferShapeContext::GetVarTypes( const std::vector &names) const { - std::vector retv; + std::vector retv; retv.resize(names.size()); std::transform(names.begin(), names.end(), retv.begin(), std::bind(std::mem_fn(&InferShapeContext::GetVarType), this, diff --git a/paddle/fluid/framework/shape_inference.h b/paddle/fluid/framework/shape_inference.h index c907523325c8472f902517deebec9bc02168713c..bc02d700da5186cea5f370b9676e408f62a66a68 100644 --- a/paddle/fluid/framework/shape_inference.h +++ b/paddle/fluid/framework/shape_inference.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -31,9 +31,9 @@ class InferShapeContext { virtual bool HasInput(const std::string &name) const = 0; virtual bool HasOutput(const std::string &name) const = 0; - std::vector GetInputsVarType( + std::vector GetInputsVarType( const std::string &name) const; - std::vector GetOutputsVarType( + std::vector GetOutputsVarType( const std::string &name) const; virtual bool HasInputs(const std::string &name) const = 0; @@ -75,10 +75,10 @@ class InferShapeContext { std::vector GetDims(const std::vector &names) const; - std::vector GetVarTypes( + std::vector GetVarTypes( const std::vector &names) const; - virtual proto::VarDesc::VarType GetVarType(const std::string &name) const = 0; + virtual proto::VarType::Type GetVarType(const std::string &name) const = 0; virtual InferShapeVarPtr GetVarPtr(const std::string &name) = 0; }; diff --git a/paddle/fluid/framework/tensor.cc b/paddle/fluid/framework/tensor.cc index a56091d3c629c4cedc13c465c84a646dc02cd094..e97ada06f06d0538f17160220e3aa3f4ffc55520 100644 --- a/paddle/fluid/framework/tensor.cc +++ b/paddle/fluid/framework/tensor.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/tensor.h b/paddle/fluid/framework/tensor.h index 44d2c7dae943a06eeab8ab1a1565f62b11de0af1..6f878541e6de1deec1829145b1b325ecd176a034 100644 --- a/paddle/fluid/framework/tensor.h +++ b/paddle/fluid/framework/tensor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -130,8 +130,6 @@ class Tensor { inline void set_layout(const DataLayout layout) { layout_ = layout; } private: - friend class LoDTensor; - /** * @note Placeholder hides type T, so it doesn't appear as a template * parameter of Variable. diff --git a/paddle/fluid/framework/tensor_impl.h b/paddle/fluid/framework/tensor_impl.h index e69836292cd0f4ed99e87ee8e297021dac43b64f..638bd0db9d7025199c31a9327b96062512aa5adb 100644 --- a/paddle/fluid/framework/tensor_impl.h +++ b/paddle/fluid/framework/tensor_impl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/fluid/memory/memcpy.h" #include "paddle/fluid/platform/enforce.h" +#include "paddle/fluid/platform/float16.h" namespace paddle { namespace framework { @@ -52,7 +53,9 @@ struct SizeOfTypeFunctor { }; static inline size_t SizeOfType(std::type_index type) { - SizeOfTypeFunctor functor; + SizeOfTypeFunctor + functor; size_t size = functor(type); PADDLE_ENFORCE(size != 0UL, "Cannot get size of type %s", type.name()); return size; diff --git a/paddle/fluid/framework/tensor_test.cc b/paddle/fluid/framework/tensor_test.cc index 6ed416e46f99f4d2ed50538a3e2c090ed8dd6fc3..e1012de2ec36eb4a858202d56a678b6a204c2f0a 100644 --- a/paddle/fluid/framework/tensor_test.cc +++ b/paddle/fluid/framework/tensor_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/tensor_util.cc b/paddle/fluid/framework/tensor_util.cc index 537fb4614cac8bc898b277899f803a3b1846a00e..9b465b85b0a02ffe990ab669a22f78e923e24f99 100644 --- a/paddle/fluid/framework/tensor_util.cc +++ b/paddle/fluid/framework/tensor_util.cc @@ -16,6 +16,76 @@ namespace paddle { namespace framework { + +void TensorCopy(const Tensor& src, const platform::Place& dst_place, + const platform::DeviceContext& ctx, Tensor* dst) { + VLOG(3) << "TensorCopy " << src.dims() << " from " << src.place() << " to " + << dst_place; + src.check_memory_size(); + + dst->Resize(src.dims()); + dst->set_layout(src.layout()); + auto src_place = src.place(); + auto src_ptr = src.data(); + + auto dst_ptr = dst->mutable_data(dst_place, src.type()); + + auto size = src.numel() * SizeOfType(src.type()); + + if (platform::is_cpu_place(src_place) && platform::is_cpu_place(dst_place)) { + memory::Copy(boost::get(dst_place), dst_ptr, + boost::get(src_place), src_ptr, size); + } +#ifdef PADDLE_WITH_CUDA + else if (platform::is_gpu_place(src_place) && // NOLINT + platform::is_cpu_place(dst_place)) { + auto src_gpu_place = boost::get(src_place); + auto dst_cpu_place = boost::get(dst_place); + auto ctx_place = ctx.GetPlace(); + PADDLE_ENFORCE(platform::is_gpu_place(ctx_place)); + auto ctx_gpu_place = boost::get(ctx_place); + PADDLE_ENFORCE_EQ(src_gpu_place, ctx_gpu_place); + memory::Copy( + dst_cpu_place, dst_ptr, src_gpu_place, src_ptr, size, + reinterpret_cast(ctx).stream()); + } else if (platform::is_cpu_place(src_place) && + platform::is_gpu_place(dst_place)) { + auto src_cpu_place = boost::get(src_place); + auto dst_gpu_place = boost::get(dst_place); + auto ctx_place = ctx.GetPlace(); + PADDLE_ENFORCE(platform::is_gpu_place(ctx_place)); + auto ctx_gpu_place = boost::get(ctx_place); + PADDLE_ENFORCE_EQ(dst_gpu_place, ctx_gpu_place); + memory::Copy( + dst_gpu_place, dst_ptr, src_cpu_place, src_ptr, size, + reinterpret_cast(ctx).stream()); + } else if (platform::is_gpu_place(src_place) && + platform::is_gpu_place(dst_place)) { + auto src_gpu_place = boost::get(src_place); + auto dst_gpu_place = boost::get(dst_place); + auto ctx_place = ctx.GetPlace(); + PADDLE_ENFORCE(platform::is_gpu_place(ctx_place)); + auto ctx_gpu_place = boost::get(ctx_place); + PADDLE_ENFORCE_EQ(src_gpu_place, ctx_gpu_place); + memory::Copy( + dst_gpu_place, dst_ptr, src_gpu_place, src_ptr, size, + reinterpret_cast(ctx).stream()); + } +#endif +} + +void TensorCopy(const Tensor& src, const platform::Place& dst_place, + Tensor* dst) { + platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance(); + const platform::DeviceContext* dev_ctx; + if (platform::is_gpu_place(src.place())) { + dev_ctx = pool.Get(src.place()); + } else { + dev_ctx = pool.Get(dst_place); + } + TensorCopy(src, dst_place, *dev_ctx, dst); +} + template struct AnyDTypeVisitor { Predicate predicate_; @@ -69,7 +139,7 @@ struct AnyVisitor : public boost::static_visitor { tmp.mutable_data(cpu); auto gpuctx = platform::DeviceContextPool::Instance().Get(gpu); gpuctx->Wait(); - Copy(out, cpu, *gpuctx, &tmp); + TensorCopy(out, cpu, *gpuctx, &tmp); gpuctx->Wait(); return GetResult(tmp, cpu); } @@ -87,7 +157,7 @@ inline bool Any(const framework::Tensor& tensor, Predicate predicate) { return platform::VisitPlace(place, visitor); } -struct HasNANPredicate { +struct ContainsNANPredicate { template auto operator()(const T& eigen_vec) const -> decltype(std::declval().isnan()) { @@ -96,12 +166,12 @@ struct HasNANPredicate { } }; -bool HasNAN(const framework::Tensor& tensor) { - HasNANPredicate predicate; +bool TensorContainsNAN(const framework::Tensor& tensor) { + ContainsNANPredicate predicate; return Any(tensor, predicate); } -struct HasInfPredicate { +struct ContainsInfPredicate { template auto operator()(const T& eigen_vec) const -> decltype(std::declval().isinf()) { @@ -110,10 +180,124 @@ struct HasInfPredicate { } }; -bool HasInf(const framework::Tensor& tensor) { - HasInfPredicate predicate; +bool TensorContainsInf(const framework::Tensor& tensor) { + ContainsInfPredicate predicate; return Any(tensor, predicate); } +void TensorToStream(std::ostream& os, const Tensor& tensor, + const platform::DeviceContext& dev_ctx) { + // TODO(typhoonzero): serialize to ostream + { // the 1st field, uint32_t version + constexpr uint32_t version = 0; + os.write(reinterpret_cast(&version), sizeof(version)); + } + { // the 2nd field, tensor description + // int32_t size + // void* protobuf message + proto::VarType::TensorDesc desc; + desc.set_data_type(framework::ToDataType(tensor.type())); + auto dims = framework::vectorize(tensor.dims()); + auto* pb_dims = desc.mutable_dims(); + pb_dims->Resize(static_cast(dims.size()), 0); + std::copy(dims.begin(), dims.end(), pb_dims->begin()); + int32_t size = desc.ByteSize(); + os.write(reinterpret_cast(&size), sizeof(size)); + auto out = desc.SerializeAsString(); + os.write(out.data(), size); + } + { // the 3rd field, tensor data + uint64_t size = tensor.memory_size(); + auto* data_ptr = tensor.data(); + PADDLE_ENFORCE(size < std::numeric_limits::max(), + "Index overflow when writing tensor"); + if (platform::is_gpu_place(tensor.place())) { +#ifdef PADDLE_WITH_CUDA + constexpr size_t kBufSize = 1024 * 1024 * 64; // 64MB + std::unique_ptr buf(new char[kBufSize]); + auto& gpu_dev_ctx = + static_cast(dev_ctx); + platform::CPUPlace cpu; + uintptr_t data = reinterpret_cast(data_ptr); + while (size != 0) { + size_t size_to_write = std::min(kBufSize, static_cast(size)); + memory::Copy(cpu, buf.get(), + boost::get(tensor.place()), + reinterpret_cast(data), size_to_write, + gpu_dev_ctx.stream()); + gpu_dev_ctx.Wait(); + os.write(buf.get(), size_to_write); + data += size_to_write; + size -= size_to_write; + } +#else + PADDLE_THROW("Unexpected branch"); +#endif + } else { + os.write(static_cast(data_ptr), + static_cast(size)); + } + } +} + +struct DeserializedDataFunctor { + DeserializedDataFunctor(void** buf, Tensor* tensor, + const platform::Place& place) + : buf_(buf), tensor_(tensor), place_(place) {} + + template + void operator()() { + *buf_ = tensor_->mutable_data(place_); + } + + void** buf_; + Tensor* tensor_; + platform::Place place_; +}; + +void TensorFromStream(std::istream& is, Tensor* tensor, + const platform::DeviceContext& dev_ctx) { + uint32_t version; + is.read(reinterpret_cast(&version), sizeof(version)); + PADDLE_ENFORCE_EQ(version, 0U, "Only version 0 is supported"); + proto::VarType::TensorDesc desc; + { // int32_t size + // proto buffer + int32_t size; + is.read(reinterpret_cast(&size), sizeof(size)); + std::unique_ptr buf(new char[size]); + is.read(reinterpret_cast(buf.get()), size); + PADDLE_ENFORCE(desc.ParseFromArray(buf.get(), size), + "Cannot parse tensor desc"); + } + { // read tensor + std::vector dims; + dims.reserve(static_cast(desc.dims().size())); + std::copy(desc.dims().begin(), desc.dims().end(), std::back_inserter(dims)); + tensor->Resize(framework::make_ddim(dims)); + void* buf; + auto ctx = platform::CPUDeviceContext(); + if (platform::is_gpu_place(dev_ctx.GetPlace())) { +#ifdef PADDLE_WITH_CUDA + Tensor cpu_tensor; + cpu_tensor.Resize(framework::make_ddim(dims)); + framework::VisitDataType( + desc.data_type(), + DeserializedDataFunctor(&buf, &cpu_tensor, ctx.GetPlace())); + is.read(static_cast(buf), cpu_tensor.memory_size()); + auto dst_place = dev_ctx.GetPlace(); + framework::TensorCopy(cpu_tensor, dst_place, dev_ctx, tensor); +#else + PADDLE_THROW("Unexpected branch"); +#endif + } else { + framework::VisitDataType( + desc.data_type(), + DeserializedDataFunctor(&buf, tensor, ctx.GetPlace())); + is.read(static_cast(buf), tensor->memory_size()); + } + } +} + } // namespace framework } // namespace paddle diff --git a/paddle/fluid/framework/tensor_util.cu b/paddle/fluid/framework/tensor_util.cu deleted file mode 100644 index 537fb4614cac8bc898b277899f803a3b1846a00e..0000000000000000000000000000000000000000 --- a/paddle/fluid/framework/tensor_util.cu +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. */ - -#include "paddle/fluid/framework/tensor_util.h" - -namespace paddle { -namespace framework { -template -struct AnyDTypeVisitor { - Predicate predicate_; - const Tensor& tensor_; - const DevCtx& ctx_; - Tensor* out_; - - AnyDTypeVisitor(Predicate predicate, const Tensor& tensor, const DevCtx& ctx, - Tensor* out) - : predicate_(predicate), tensor_(tensor), ctx_(ctx), out_(out) {} - - template - void operator()() const { - auto t = EigenVector::Flatten(tensor_); - auto o = EigenScalar::From(*out_); - // return any of predicate_(t) is true. - o.device(*ctx_.eigen_device()) = predicate_(t).any(); - } -}; - -template -inline void AnyImpl(Predicate predicate, const framework::Tensor& tensor, - const DevCtx& ctx, framework::Tensor* out) { - VisitDataType(ToDataType(tensor.type()), AnyDTypeVisitor( - predicate, tensor, ctx, out)); -} - -template -struct AnyVisitor : public boost::static_visitor { - const framework::Tensor& tensor_; - Predicate predicate_; - - AnyVisitor(const framework::Tensor& tensor, Predicate predicate) - : tensor_(tensor), predicate_(std::move(predicate)) {} - - template - bool operator()(const Place& place) const { - framework::Tensor out; - out.Resize({1}); - out.mutable_data(place); - auto* ctx = platform::DeviceContextPool::Instance().GetByPlace(place); - AnyImpl(predicate_, tensor_, *ctx, &out); - return this->GetResult(out, place); - } - - bool GetResult(const framework::Tensor& out, - const platform::CUDAPlace& gpu) const { - platform::CPUPlace cpu; - framework::Tensor tmp; - tmp.Resize({1}); - tmp.mutable_data(cpu); - auto gpuctx = platform::DeviceContextPool::Instance().Get(gpu); - gpuctx->Wait(); - Copy(out, cpu, *gpuctx, &tmp); - gpuctx->Wait(); - return GetResult(tmp, cpu); - } - - bool GetResult(const framework::Tensor& out, - const platform::CPUPlace& cpu) const { - return *out.data(); - } -}; - -template -inline bool Any(const framework::Tensor& tensor, Predicate predicate) { - AnyVisitor visitor(tensor, predicate); - auto place = tensor.place(); - return platform::VisitPlace(place, visitor); -} - -struct HasNANPredicate { - template - auto operator()(const T& eigen_vec) const - -> decltype(std::declval().isnan()) { - // Cast eigen_vector to vector of bool. true if is inf. - return eigen_vec.isnan(); - } -}; - -bool HasNAN(const framework::Tensor& tensor) { - HasNANPredicate predicate; - return Any(tensor, predicate); -} - -struct HasInfPredicate { - template - auto operator()(const T& eigen_vec) const - -> decltype(std::declval().isinf()) { - // Cast eigen_vector to vector of bool. true if is inf. - return eigen_vec.isinf(); - } -}; - -bool HasInf(const framework::Tensor& tensor) { - HasInfPredicate predicate; - return Any(tensor, predicate); -} - -} // namespace framework -} // namespace paddle diff --git a/paddle/fluid/framework/tensor_util.cu b/paddle/fluid/framework/tensor_util.cu new file mode 120000 index 0000000000000000000000000000000000000000..edd88c4e547016c7ec0e0c95547b3ede4b6f3c60 --- /dev/null +++ b/paddle/fluid/framework/tensor_util.cu @@ -0,0 +1 @@ +tensor_util.cc \ No newline at end of file diff --git a/paddle/fluid/framework/tensor_util.h b/paddle/fluid/framework/tensor_util.h index b7e772b6daad93dc915665d58d4a5722c74c0d2b..38b6d1c5c46dcce718f91d574ceea5de2099b787 100644 --- a/paddle/fluid/framework/tensor_util.h +++ b/paddle/fluid/framework/tensor_util.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,106 +22,38 @@ limitations under the License. */ namespace paddle { namespace framework { -/** - * @brief Copy the content of external tensor to a new place. - * - * @param[in] src The external tensor. - * @param[in] dst_place The dst place. - * @param[in] ctx The device context contains device resources. - * - * @note Copy supports CPU <-> GPU, GPU <-> GPU. - */ -inline void Copy(const Tensor& src, const platform::Place& dst_place, - const platform::DeviceContext& ctx, Tensor* dst) { - VLOG(3) << "Copy " << src.dims() << " from " << src.place() << " to " - << dst_place; - src.check_memory_size(); +void TensorCopy(const Tensor& src, const platform::Place& dst_place, + const platform::DeviceContext& ctx, Tensor* dst); +void TensorCopy(const Tensor& src, const platform::Place& dst_place, + Tensor* dst); - dst->Resize(src.dims()); - dst->set_layout(src.layout()); - auto src_place = src.place(); - auto src_ptr = src.data(); +template +void TensorFromVector(const std::vector& src, + const platform::DeviceContext& ctx, Tensor* dst); +template +void TensorFromVector(const std::vector& src, Tensor* dst); - auto dst_ptr = dst->mutable_data(dst_place, src.type()); +template +void TensorToVector(const Tensor& src, const platform::DeviceContext& ctx, + std::vector* dst); +template +void TesnorToVector(const Tensor& src, std::vector* dst); - auto size = src.numel() * SizeOfType(src.type()); +bool TensorContainsNAN(const framework::Tensor& tensor); +bool TensorContainsInf(const framework::Tensor& tensor); - if (platform::is_cpu_place(src_place) && platform::is_cpu_place(dst_place)) { - memory::Copy(boost::get(dst_place), dst_ptr, - boost::get(src_place), src_ptr, size); - } -#ifdef PADDLE_WITH_CUDA - else if (platform::is_gpu_place(src_place) && // NOLINT - platform::is_cpu_place(dst_place)) { - auto src_gpu_place = boost::get(src_place); - auto dst_cpu_place = boost::get(dst_place); - auto ctx_place = ctx.GetPlace(); - PADDLE_ENFORCE(platform::is_gpu_place(ctx_place)); - auto ctx_gpu_place = boost::get(ctx_place); - PADDLE_ENFORCE_EQ(src_gpu_place, ctx_gpu_place); - memory::Copy( - dst_cpu_place, dst_ptr, src_gpu_place, src_ptr, size, - reinterpret_cast(ctx).stream()); - } else if (platform::is_cpu_place(src_place) && - platform::is_gpu_place(dst_place)) { - auto src_cpu_place = boost::get(src_place); - auto dst_gpu_place = boost::get(dst_place); - auto ctx_place = ctx.GetPlace(); - PADDLE_ENFORCE(platform::is_gpu_place(ctx_place)); - auto ctx_gpu_place = boost::get(ctx_place); - PADDLE_ENFORCE_EQ(dst_gpu_place, ctx_gpu_place); - memory::Copy( - dst_gpu_place, dst_ptr, src_cpu_place, src_ptr, size, - reinterpret_cast(ctx).stream()); - } else if (platform::is_gpu_place(src_place) && - platform::is_gpu_place(dst_place)) { - auto src_gpu_place = boost::get(src_place); - auto dst_gpu_place = boost::get(dst_place); - auto ctx_place = ctx.GetPlace(); - PADDLE_ENFORCE(platform::is_gpu_place(ctx_place)); - auto ctx_gpu_place = boost::get(ctx_place); - PADDLE_ENFORCE_EQ(src_gpu_place, ctx_gpu_place); - memory::Copy( - dst_gpu_place, dst_ptr, src_gpu_place, src_ptr, size, - reinterpret_cast(ctx).stream()); - } -#endif -} +void TensorToStream(std::ostream& os, const Tensor& tensor, + const platform::DeviceContext& dev_ctx); +void TensorFromStream(std::istream& is, Tensor* tensor, + const platform::DeviceContext& dev_ctx); -/** - * @brief Wrapper on - * Copy(const Tensor& src, const platform::Place& dst_place, - * const platform::DeviceContext& ctx, Tensor* dst); - * - * @param[in] src The external tensor. - * @param[in] dst_place The dst place. - * - * @note Copy supports CPU <-> GPU, GPU <-> GPU. - */ -inline void Copy(const Tensor& src, const platform::Place& dst_place, - Tensor* dst) { - platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance(); - const platform::DeviceContext* dev_ctx; - if (platform::is_gpu_place(src.place())) { - dev_ctx = pool.Get(src.place()); - } else { - dev_ctx = pool.Get(dst_place); - } - Copy(src, dst_place, *dev_ctx, dst); -} +// +// The implementation of template functions. +// -/** - * @brief Copy the content of an external vector to a tensor. - * - * @param[in] src The external tensor. - * @param[in] ctx The device context contains device resources. - * - * * @note CopyFromVector will resize dst to an 1D tensor with the same - * size as src. - */ template -inline void CopyFromVector(const std::vector& src, - const platform::DeviceContext& ctx, Tensor* dst) { +void TensorFromVector(const std::vector& src, + const platform::DeviceContext& ctx, Tensor* dst) { auto dst_place = ctx.GetPlace(); auto src_ptr = static_cast(src.data()); platform::CPUPlace src_place; @@ -143,11 +75,8 @@ inline void CopyFromVector(const std::vector& src, #endif } -/** - * @brief CopyFromVector CPU vector -> CPU Tensor - */ template -inline void CopyFromVector(const std::vector& src, Tensor* dst) { +void TensorFromVector(const std::vector& src, Tensor* dst) { platform::CPUPlace dst_place = platform::CPUPlace(); auto src_ptr = static_cast(src.data()); platform::CPUPlace src_place; @@ -158,18 +87,9 @@ inline void CopyFromVector(const std::vector& src, Tensor* dst) { memory::Copy(dst_place, dst_ptr, src_place, src_ptr, size); } -/** - * @brief Copy the content of a tensor to a vector - * - * @param[in] src The external tensor. - * @param[in] ctx The device context contains device resources. - * - * * @note CopyFromVector assumes that the tensor has been resized - * before invoking. - */ template -inline void CopyToVector(const Tensor& src, const platform::DeviceContext& ctx, - std::vector* dst) { +void TensorToVector(const Tensor& src, const platform::DeviceContext& ctx, + std::vector* dst) { auto src_ptr = static_cast(src.data()); auto size = src.numel() * sizeof(T); @@ -191,11 +111,8 @@ inline void CopyToVector(const Tensor& src, const platform::DeviceContext& ctx, #endif } -/** - * @brief CopyToVector CPUTensor <-> CPU Vector - */ template -inline void CopyToVector(const Tensor& src, std::vector* dst) { +void TensorToVector(const Tensor& src, std::vector* dst) { auto src_ptr = static_cast(src.data()); auto size = src.numel() * sizeof(T); @@ -209,125 +126,5 @@ inline void CopyToVector(const Tensor& src, std::vector* dst) { src_ptr, size); } -// Returns true if a tensor contains NAN, i.e., Not A Number. -bool HasNAN(const framework::Tensor& tensor); - -// Returns true if a tensor contains Inf, i.e., Infinity. -bool HasInf(const framework::Tensor& tensor); - -inline void SerializeToStream(std::ostream& os, const Tensor& tensor, - const platform::DeviceContext& dev_ctx) { - // TODO(typhoonzero): serialize to ostream - { // the 1st field, uint32_t version - constexpr uint32_t version = 0; - os.write(reinterpret_cast(&version), sizeof(version)); - } - { // the 2nd field, tensor description - // int32_t size - // void* protobuf message - proto::TensorDesc desc; - desc.set_data_type(framework::ToDataType(tensor.type())); - auto dims = framework::vectorize(tensor.dims()); - auto* pb_dims = desc.mutable_dims(); - pb_dims->Resize(static_cast(dims.size()), 0); - std::copy(dims.begin(), dims.end(), pb_dims->begin()); - int32_t size = desc.ByteSize(); - os.write(reinterpret_cast(&size), sizeof(size)); - auto out = desc.SerializeAsString(); - os.write(out.data(), size); - } - { // the 3rd field, tensor data - uint64_t size = tensor.memory_size(); - auto* data_ptr = tensor.data(); - PADDLE_ENFORCE(size < std::numeric_limits::max(), - "Index overflow when writing tensor"); - if (platform::is_gpu_place(tensor.place())) { -#ifdef PADDLE_WITH_CUDA - constexpr size_t kBufSize = 1024 * 1024 * 64; // 64MB - std::unique_ptr buf(new char[kBufSize]); - auto& gpu_dev_ctx = - static_cast(dev_ctx); - platform::CPUPlace cpu; - uintptr_t data = reinterpret_cast(data_ptr); - while (size != 0) { - size_t size_to_write = std::min(kBufSize, static_cast(size)); - memory::Copy(cpu, buf.get(), - boost::get(tensor.place()), - reinterpret_cast(data), size_to_write, - gpu_dev_ctx.stream()); - gpu_dev_ctx.Wait(); - os.write(buf.get(), size_to_write); - data += size_to_write; - size -= size_to_write; - } -#else - PADDLE_THROW("Unexpected branch"); -#endif - } else { - os.write(static_cast(data_ptr), - static_cast(size)); - } - } -} - -struct DeserializedDataFunctor { - DeserializedDataFunctor(void** buf, Tensor* tensor, - const platform::Place& place) - : buf_(buf), tensor_(tensor), place_(place) {} - - template - void operator()() { - *buf_ = tensor_->mutable_data(place_); - } - - void** buf_; - Tensor* tensor_; - platform::Place place_; -}; - -inline void DeserializeFromStream(std::istream& is, Tensor* tensor, - const platform::DeviceContext& dev_ctx) { - uint32_t version; - is.read(reinterpret_cast(&version), sizeof(version)); - PADDLE_ENFORCE_EQ(version, 0U, "Only version 0 is supported"); - proto::TensorDesc desc; - { // int32_t size - // proto buffer - int32_t size; - is.read(reinterpret_cast(&size), sizeof(size)); - std::unique_ptr buf(new char[size]); - is.read(reinterpret_cast(buf.get()), size); - PADDLE_ENFORCE(desc.ParseFromArray(buf.get(), size), - "Cannot parse tensor desc"); - } - { // read tensor - std::vector dims; - dims.reserve(static_cast(desc.dims().size())); - std::copy(desc.dims().begin(), desc.dims().end(), std::back_inserter(dims)); - tensor->Resize(framework::make_ddim(dims)); - void* buf; - auto ctx = platform::CPUDeviceContext(); - if (platform::is_gpu_place(dev_ctx.GetPlace())) { -#ifdef PADDLE_WITH_CUDA - Tensor cpu_tensor; - cpu_tensor.Resize(framework::make_ddim(dims)); - framework::VisitDataType( - desc.data_type(), - DeserializedDataFunctor(&buf, &cpu_tensor, ctx.GetPlace())); - is.read(static_cast(buf), cpu_tensor.memory_size()); - auto dst_place = dev_ctx.GetPlace(); - framework::Copy(cpu_tensor, dst_place, dev_ctx, tensor); -#else - PADDLE_THROW("Unexpected branch"); -#endif - } else { - framework::VisitDataType( - desc.data_type(), - DeserializedDataFunctor(&buf, tensor, ctx.GetPlace())); - is.read(static_cast(buf), tensor->memory_size()); - } - } -} - } // namespace framework } // namespace paddle diff --git a/paddle/fluid/framework/tensor_util_test.cc b/paddle/fluid/framework/tensor_util_test.cc index 8764c692e875328fc98a7b67a018014af487f394..8aebfcb3b624f49b747e0874e807782b8d4a9951 100644 --- a/paddle/fluid/framework/tensor_util_test.cc +++ b/paddle/fluid/framework/tensor_util_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ namespace paddle { namespace framework { -TEST(Copy, Tensor) { +TEST(TensorCopy, Tensor) { Tensor src_tensor; Tensor dst_tensor; platform::CPUDeviceContext cpu_ctx((platform::CPUPlace())); @@ -33,7 +33,7 @@ TEST(Copy, Tensor) { src_tensor.set_layout(DataLayout::kAnyLayout); auto cpu_place = new platform::CPUPlace(); - Copy(src_tensor, *cpu_place, &dst_tensor); + TensorCopy(src_tensor, *cpu_place, &dst_tensor); const int* dst_ptr = dst_tensor.data(); ASSERT_NE(src_ptr, dst_ptr); @@ -44,7 +44,7 @@ TEST(Copy, Tensor) { EXPECT_TRUE(dst_tensor.layout() == src_tensor.layout()); Tensor slice_tensor = src_tensor.Slice(1, 2); - Copy(slice_tensor, *cpu_place, &dst_tensor); + TensorCopy(slice_tensor, *cpu_place, &dst_tensor); const int* slice_ptr = slice_tensor.data(); dst_ptr = dst_tensor.data(); ASSERT_NE(dst_ptr, slice_ptr); @@ -68,11 +68,11 @@ TEST(Copy, Tensor) { // CPU Tensor to GPU Tensor auto gpu_place = new platform::CUDAPlace(0); platform::CUDADeviceContext gpu_ctx(*gpu_place); - Copy(src_tensor, *gpu_place, gpu_ctx, &gpu_tensor); + TensorCopy(src_tensor, *gpu_place, gpu_ctx, &gpu_tensor); // GPU Tensor to CPU Tensor auto cpu_place = new platform::CPUPlace(); - Copy(gpu_tensor, *cpu_place, gpu_ctx, &dst_tensor); + TensorCopy(gpu_tensor, *cpu_place, gpu_ctx, &dst_tensor); // Sync before Compare Tensors gpu_ctx.Wait(); @@ -85,10 +85,10 @@ TEST(Copy, Tensor) { Tensor slice_tensor = src_tensor.Slice(1, 2); // CPU Slice Tensor to GPU Tensor - Copy(slice_tensor, *gpu_place, gpu_ctx, &gpu_tensor); + TensorCopy(slice_tensor, *gpu_place, gpu_ctx, &gpu_tensor); // GPU Tensor to CPU Tensor - Copy(gpu_tensor, *cpu_place, gpu_ctx, &dst_tensor); + TensorCopy(gpu_tensor, *cpu_place, gpu_ctx, &dst_tensor); // Sync before Compare Slice Tensors gpu_ctx.Wait(); @@ -104,7 +104,7 @@ TEST(Copy, Tensor) { #endif } -TEST(CopyFromVector, Tensor) { +TEST(TensorFromVector, Tensor) { using namespace paddle::framework; using namespace paddle::platform; { @@ -114,7 +114,7 @@ TEST(CopyFromVector, Tensor) { // Copy to CPU Tensor cpu_tensor.Resize(make_ddim({3, 3})); auto cpu_place = new paddle::platform::CPUPlace(); - CopyFromVector(src_vec, &cpu_tensor); + TensorFromVector(src_vec, &cpu_tensor); // Compare Tensors const int* cpu_ptr = cpu_tensor.data(); @@ -126,7 +126,7 @@ TEST(CopyFromVector, Tensor) { src_vec.erase(src_vec.begin(), src_vec.begin() + 5); cpu_tensor.Resize(make_ddim({2, 2})); - CopyFromVector(src_vec, &cpu_tensor); + TensorFromVector(src_vec, &cpu_tensor); cpu_ptr = cpu_tensor.data(); src_ptr = src_vec.data(); ASSERT_NE(src_ptr, cpu_ptr); @@ -148,15 +148,15 @@ TEST(CopyFromVector, Tensor) { cpu_tensor.Resize(make_ddim({3, 3})); auto cpu_place = new paddle::platform::CPUPlace(); CPUDeviceContext cpu_ctx(*cpu_place); - CopyFromVector(src_vec, cpu_ctx, &cpu_tensor); + TensorFromVector(src_vec, cpu_ctx, &cpu_tensor); // Copy to GPUTensor gpu_tensor.Resize(make_ddim({3, 3})); auto gpu_place = new paddle::platform::CUDAPlace(); CUDADeviceContext gpu_ctx(*gpu_place); - CopyFromVector(src_vec, gpu_ctx, &gpu_tensor); + TensorFromVector(src_vec, gpu_ctx, &gpu_tensor); // Copy from GPU to CPU tensor for comparison - Copy(gpu_tensor, *cpu_place, gpu_ctx, &dst_tensor); + TensorCopy(gpu_tensor, *cpu_place, gpu_ctx, &dst_tensor); // Sync before Compare Tensors gpu_ctx.Wait(); @@ -173,10 +173,10 @@ TEST(CopyFromVector, Tensor) { src_vec.erase(src_vec.begin(), src_vec.begin() + 5); cpu_tensor.Resize(make_ddim({2, 2})); - CopyFromVector(src_vec, cpu_ctx, &cpu_tensor); + TensorFromVector(src_vec, cpu_ctx, &cpu_tensor); gpu_tensor.Resize(make_ddim({2, 2})); - CopyFromVector(src_vec, gpu_ctx, &gpu_tensor); - Copy(gpu_tensor, *cpu_place, gpu_ctx, &dst_tensor); + TensorFromVector(src_vec, gpu_ctx, &gpu_tensor); + TensorCopy(gpu_tensor, *cpu_place, gpu_ctx, &dst_tensor); // Sync before Compare Tensors gpu_ctx.Wait(); @@ -196,7 +196,7 @@ TEST(CopyFromVector, Tensor) { #endif } -TEST(CopyToVector, Tensor) { +TEST(TensorToVector, Tensor) { using namespace paddle::framework; using namespace paddle::platform; { @@ -208,7 +208,7 @@ TEST(CopyToVector, Tensor) { CPUPlace place; std::vector dst; - CopyToVector(src, &dst); + TensorToVector(src, &dst); for (int i = 0; i < 3 * 3; ++i) { EXPECT_EQ(src_ptr[i], dst[i]); @@ -220,10 +220,10 @@ TEST(CopyToVector, Tensor) { Tensor gpu_tensor; CUDAPlace place; CUDADeviceContext gpu_ctx(place); - CopyFromVector(src_vec, gpu_ctx, &gpu_tensor); + TensorFromVector(src_vec, gpu_ctx, &gpu_tensor); std::vector dst; - CopyToVector(gpu_tensor, gpu_ctx, &dst); + TensorToVector(gpu_tensor, gpu_ctx, &dst); for (int i = 0; i < 3 * 3; ++i) { EXPECT_EQ(src_vec[i], dst[i]); @@ -232,7 +232,7 @@ TEST(CopyToVector, Tensor) { #endif } -TEST(HasNAN, CPU) { +TEST(TensorContainsNAN, CPU) { using namespace paddle::framework; using namespace paddle::platform; Tensor src; @@ -240,11 +240,12 @@ TEST(HasNAN, CPU) { buf[0] = 0.0; buf[1] = NAN; buf[2] = 0.0; - - ASSERT_TRUE(HasNAN(src)); + ASSERT_TRUE(TensorContainsNAN(src)); + buf[1] = 0.0; + ASSERT_FALSE(TensorContainsNAN(src)); } -TEST(HasInf, CPU) { +TEST(TensorContainsInf, CPU) { using namespace paddle::framework; using namespace paddle::platform; Tensor src; @@ -252,10 +253,12 @@ TEST(HasInf, CPU) { buf[0] = 1.0; buf[1] = INFINITY; buf[2] = 0.0; - ASSERT_TRUE(HasInf(src)); + ASSERT_TRUE(TensorContainsInf(src)); + buf[1] = 1.0; + ASSERT_FALSE(TensorContainsInf(src)); } -TEST(Tensor, SerializeAndDeserialize) { +TEST(Tensor, FromAndToStream) { framework::Tensor src_tensor; int array[6] = {1, 2, 3, 4, 5, 6}; src_tensor.Resize({2, 3}); @@ -268,10 +271,10 @@ TEST(Tensor, SerializeAndDeserialize) { auto place = new platform::CPUPlace(); platform::CPUDeviceContext cpu_ctx(*place); std::ostringstream oss; - SerializeToStream(oss, src_tensor, cpu_ctx); + TensorToStream(oss, src_tensor, cpu_ctx); std::istringstream iss(oss.str()); - DeserializeFromStream(iss, &dst_tensor, cpu_ctx); + TensorFromStream(iss, &dst_tensor, cpu_ctx); int* dst_ptr = dst_tensor.mutable_data(platform::CPUPlace()); for (int i = 0; i < 5; ++i) { ASSERT_EQ(dst_ptr[i], array[i]); @@ -288,13 +291,13 @@ TEST(Tensor, SerializeAndDeserialize) { auto gpu_place = new platform::CUDAPlace(); platform::CUDADeviceContext gpu_ctx(*gpu_place); - Copy(src_tensor, *gpu_place, gpu_ctx, &gpu_tensor); + TensorCopy(src_tensor, *gpu_place, gpu_ctx, &gpu_tensor); std::ostringstream oss; - SerializeToStream(oss, gpu_tensor, gpu_ctx); + TensorToStream(oss, gpu_tensor, gpu_ctx); std::istringstream iss(oss.str()); - DeserializeFromStream(iss, &dst_tensor, gpu_ctx); + TensorFromStream(iss, &dst_tensor, gpu_ctx); int* dst_ptr = dst_tensor.mutable_data(platform::CPUPlace()); for (int i = 0; i < 6; ++i) { diff --git a/paddle/fluid/framework/tensor_util_test.cu b/paddle/fluid/framework/tensor_util_test.cu index 1982b642bcd1f2e21a684b701d7bd603f0c2c894..d630ec44a2aa6f2567eedbb58b9ae181700f5fc9 100644 --- a/paddle/fluid/framework/tensor_util_test.cu +++ b/paddle/fluid/framework/tensor_util_test.cu @@ -31,7 +31,7 @@ static __global__ void FillInf(float* buf) { buf[2] = 0.5; } -TEST(HasNAN, GPU) { +TEST(TensorContainsNAN, GPU) { Tensor tensor; platform::CUDAPlace gpu(0); auto& pool = platform::DeviceContextPool::Instance(); @@ -39,10 +39,10 @@ TEST(HasNAN, GPU) { float* buf = tensor.mutable_data({3}, gpu); FillNAN<<<1, 1, 0, cuda_ctx->stream()>>>(buf); cuda_ctx->Wait(); - ASSERT_TRUE(HasNAN(tensor)); + ASSERT_TRUE(TensorContainsNAN(tensor)); } -TEST(HasInf, GPU) { +TEST(TensorContainsInf, GPU) { Tensor tensor; platform::CUDAPlace gpu(0); auto& pool = platform::DeviceContextPool::Instance(); @@ -50,7 +50,7 @@ TEST(HasInf, GPU) { float* buf = tensor.mutable_data({3}, gpu); FillInf<<<1, 1, 0, cuda_ctx->stream()>>>(buf); cuda_ctx->Wait(); - ASSERT_TRUE(HasInf(tensor)); + ASSERT_TRUE(TensorContainsInf(tensor)); } } // namespace framework diff --git a/paddle/fluid/framework/threadpool.cc b/paddle/fluid/framework/threadpool.cc index 2c4de41b0c41fa3eeaf6c77def9c728dd9976895..9854d618d2b29ed123833f55198179638c95d6db 100644 --- a/paddle/fluid/framework/threadpool.cc +++ b/paddle/fluid/framework/threadpool.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/threadpool.h b/paddle/fluid/framework/threadpool.h index e88e6c01f02deb77278a02ba81ee62ddfcf42eb8..3adc260caf5eaaa1408a26ed91457666e6c4adce 100644 --- a/paddle/fluid/framework/threadpool.h +++ b/paddle/fluid/framework/threadpool.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -64,7 +64,6 @@ class ThreadPool { Task task([fn]() -> std::unique_ptr { try { fn(); - return nullptr; } catch (platform::EnforceNotMet ex) { return std::unique_ptr( new platform::EnforceNotMet(ex)); @@ -73,6 +72,7 @@ class ThreadPool { << "Unexpected exception is catched in thread pool. All " "throwable exception in Fluid should be an EnforceNotMet."; } + return nullptr; }); std::future> f = task.get_future(); tasks_.push(std::move(task)); diff --git a/paddle/fluid/framework/threadpool_test.cc b/paddle/fluid/framework/threadpool_test.cc index 3fbfe7efc867144dbd0dd2613c824c6a3c41b7d8..4da83d630a5632233ddff6f08174dcabc1c696f8 100644 --- a/paddle/fluid/framework/threadpool_test.cc +++ b/paddle/fluid/framework/threadpool_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/type_defs.h b/paddle/fluid/framework/type_defs.h index 786d78a6440de60abea44f7b8fccb90d455b488c..4879209ece9fdfea91e484a4118c00a2a2a2b4f7 100644 --- a/paddle/fluid/framework/type_defs.h +++ b/paddle/fluid/framework/type_defs.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/var_desc.cc b/paddle/fluid/framework/var_desc.cc index 7ec9b2ced94c4176b64996827dcb79f1d756be6b..1aa0ae0f7c1946d91736ab61236a65a45c203fe3 100644 --- a/paddle/fluid/framework/var_desc.cc +++ b/paddle/fluid/framework/var_desc.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,18 +18,21 @@ limitations under the License. */ namespace paddle { namespace framework { -proto::VarDesc::VarType VarDesc::GetType() const { return desc_.type(); } +proto::VarType::Type VarDesc::GetType() const { return desc_.type().type(); } -void VarDesc::SetType(proto::VarDesc::VarType type) { desc_.set_type(type); } +void VarDesc::SetType(proto::VarType::Type type) { + desc_.mutable_type()->set_type(type); +} void VarDesc::SetShape(const std::vector &dims) { VectorToRepeated(dims, mutable_tensor_desc()->mutable_dims()); } void VarDesc::SetTensorDescNum(size_t num) { - switch (desc_.type()) { - case proto::VarDesc::READER: { - auto *lod_tensors_ptr = desc_.mutable_reader()->mutable_lod_tensor(); + switch (desc_.type().type()) { + case proto::VarType::READER: { + auto *lod_tensors_ptr = + desc_.mutable_type()->mutable_reader()->mutable_lod_tensor(); lod_tensors_ptr->Clear(); for (size_t i = 0; i < num; ++i) { lod_tensors_ptr->Add(); @@ -44,9 +47,9 @@ void VarDesc::SetTensorDescNum(size_t num) { } size_t VarDesc::GetTensorDescNum() const { - switch (desc_.type()) { - case proto::VarDesc::READER: - return desc_.reader().lod_tensor_size(); + switch (desc_.type().type()) { + case proto::VarType::READER: + return desc_.type().reader().lod_tensor_size(); break; default: PADDLE_THROW( @@ -64,7 +67,7 @@ void VarDesc::SetShapes( << "). The Reader is going to be reinitialized."; SetTensorDescNum(multiple_dims.size()); } - std::vector tensors = mutable_tensor_descs(); + std::vector tensors = mutable_tensor_descs(); for (size_t i = 0; i < multiple_dims.size(); ++i) { VectorToRepeated(multiple_dims[i], tensors[i]->mutable_dims()); } @@ -75,7 +78,7 @@ std::vector VarDesc::GetShape() const { } std::vector> VarDesc::GetShapes() const { - std::vector descs = tensor_descs(); + std::vector descs = tensor_descs(); std::vector> res; res.reserve(descs.size()); for (const auto &tensor_desc : descs) { @@ -84,12 +87,18 @@ std::vector> VarDesc::GetShapes() const { return res; } -void VarDesc::SetDataType(proto::DataType data_type) { - mutable_tensor_desc()->set_data_type(data_type); +void VarDesc::SetDataType(proto::VarType::Type data_type) { + switch (desc_.type().type()) { + case proto::VarType::CHANNEL: + mutable_channel_desc()->set_data_type(data_type); + break; + default: + mutable_tensor_desc()->set_data_type(data_type); + } } void VarDesc::SetDataTypes( - const std::vector &multiple_data_type) { + const std::vector &multiple_data_type) { if (multiple_data_type.size() != GetTensorDescNum()) { VLOG(3) << "WARNING: The number of given data types(" << multiple_data_type.size() @@ -98,19 +107,26 @@ void VarDesc::SetDataTypes( << "). The Reader is going to be reinitialized."; SetTensorDescNum(multiple_data_type.size()); } - std::vector tensor_descs = mutable_tensor_descs(); + std::vector tensor_descs = + mutable_tensor_descs(); for (size_t i = 0; i < multiple_data_type.size(); ++i) { tensor_descs[i]->set_data_type(multiple_data_type[i]); } } -proto::DataType VarDesc::GetDataType() const { - return tensor_desc().data_type(); +proto::VarType::Type VarDesc::GetDataType() const { + switch (desc_.type().type()) { + case proto::VarType::CHANNEL: + return channel_desc().data_type(); + break; + default: + return tensor_desc().data_type(); + } } -std::vector VarDesc::GetDataTypes() const { - std::vector descs = tensor_descs(); - std::vector res; +std::vector VarDesc::GetDataTypes() const { + std::vector descs = tensor_descs(); + std::vector res; res.reserve(descs.size()); for (const auto &tensor_desc : descs) { res.push_back(tensor_desc.data_type()); @@ -118,13 +134,24 @@ std::vector VarDesc::GetDataTypes() const { return res; } +void VarDesc::SetCapacity(int64_t capacity) { + switch (desc_.type().type()) { + case proto::VarType::CHANNEL: + desc_.mutable_type()->mutable_channel()->set_capacity(capacity); + break; + default: + PADDLE_THROW("Setting 'capacity' is not supported by the type of var %s.", + this->Name()); + } +} + void VarDesc::SetLoDLevel(int32_t lod_level) { - switch (desc_.type()) { - case proto::VarDesc::LOD_TENSOR: - desc_.mutable_lod_tensor()->set_lod_level(lod_level); + switch (desc_.type().type()) { + case proto::VarType::LOD_TENSOR: + desc_.mutable_type()->mutable_lod_tensor()->set_lod_level(lod_level); break; - case proto::VarDesc::LOD_TENSOR_ARRAY: - desc_.mutable_tensor_array()->set_lod_level(lod_level); + case proto::VarType::LOD_TENSOR_ARRAY: + desc_.mutable_type()->mutable_tensor_array()->set_lod_level(lod_level); break; default: PADDLE_THROW( @@ -142,10 +169,11 @@ void VarDesc::SetLoDLevels(const std::vector &multiple_lod_level) { << "). The Reader is going to be reinitialized."; SetTensorDescNum(multiple_lod_level.size()); } - switch (desc_.type()) { - case proto::VarDesc::READER: { + switch (desc_.type().type()) { + case proto::VarType::READER: { size_t i = 0; - for (auto &lod_tensor : *desc_.mutable_reader()->mutable_lod_tensor()) { + for (auto &lod_tensor : + *desc_.mutable_type()->mutable_reader()->mutable_lod_tensor()) { lod_tensor.set_lod_level(multiple_lod_level[i++]); } } break; @@ -157,11 +185,11 @@ void VarDesc::SetLoDLevels(const std::vector &multiple_lod_level) { } int32_t VarDesc::GetLoDLevel() const { - switch (desc_.type()) { - case proto::VarDesc::LOD_TENSOR: - return desc_.lod_tensor().lod_level(); - case proto::VarDesc::LOD_TENSOR_ARRAY: - return desc_.tensor_array().lod_level(); + switch (desc_.type().type()) { + case proto::VarType::LOD_TENSOR: + return desc_.type().lod_tensor().lod_level(); + case proto::VarType::LOD_TENSOR_ARRAY: + return desc_.type().tensor_array().lod_level(); default: PADDLE_THROW( "Getting 'lod_level' is not supported by the type of var %s.", @@ -171,10 +199,10 @@ int32_t VarDesc::GetLoDLevel() const { std::vector VarDesc::GetLoDLevels() const { std::vector res; - switch (desc_.type()) { - case proto::VarDesc::READER: - res.reserve(desc_.reader().lod_tensor_size()); - for (auto &lod_tensor : desc_.reader().lod_tensor()) { + switch (desc_.type().type()) { + case proto::VarType::READER: + res.reserve(desc_.type().reader().lod_tensor_size()); + for (auto &lod_tensor : desc_.type().reader().lod_tensor()) { res.push_back(lod_tensor.lod_level()); } return res; @@ -186,15 +214,29 @@ std::vector VarDesc::GetLoDLevels() const { } } -const proto::TensorDesc &VarDesc::tensor_desc() const { +const proto::VarType::ChannelDesc &VarDesc::channel_desc() const { PADDLE_ENFORCE(desc_.has_type(), "The var's type hasn't been set."); - switch (desc_.type()) { - case proto::VarDesc::SELECTED_ROWS: - return desc_.selected_rows(); - case proto::VarDesc::LOD_TENSOR: - return desc_.lod_tensor().tensor(); - case proto::VarDesc::LOD_TENSOR_ARRAY: - return desc_.tensor_array().tensor(); + PADDLE_ENFORCE(desc_.type().has_type(), "The var type hasn't been set."); + switch (desc_.type().type()) { + case proto::VarType::CHANNEL: + return desc_.type().channel(); + default: + PADDLE_THROW( + "Getting 'channel_desc' is not supported by the type of var %s.", + this->Name()); + } +} + +const proto::VarType::TensorDesc &VarDesc::tensor_desc() const { + PADDLE_ENFORCE(desc_.has_type(), "The var's type hasn't been set."); + PADDLE_ENFORCE(desc_.type().has_type(), "The var type hasn't been set."); + switch (desc_.type().type()) { + case proto::VarType::SELECTED_ROWS: + return desc_.type().selected_rows(); + case proto::VarType::LOD_TENSOR: + return desc_.type().lod_tensor().tensor(); + case proto::VarType::LOD_TENSOR_ARRAY: + return desc_.type().tensor_array().tensor(); default: PADDLE_THROW( "Getting 'tensor_desc' is not supported by the type of var %s.", @@ -202,13 +244,13 @@ const proto::TensorDesc &VarDesc::tensor_desc() const { } } -std::vector VarDesc::tensor_descs() const { +std::vector VarDesc::tensor_descs() const { PADDLE_ENFORCE(desc_.has_type(), "The var type hasn't been set."); - std::vector res; + std::vector res; res.reserve(GetTensorDescNum()); - switch (desc_.type()) { - case proto::VarDesc::READER: - for (const auto &lod_tensor : desc_.reader().lod_tensor()) { + switch (desc_.type().type()) { + case proto::VarType::READER: + for (const auto &lod_tensor : desc_.type().reader().lod_tensor()) { res.push_back(lod_tensor.tensor()); } return res; @@ -220,15 +262,30 @@ std::vector VarDesc::tensor_descs() const { } } -proto::TensorDesc *VarDesc::mutable_tensor_desc() { +proto::VarType::ChannelDesc *VarDesc::mutable_channel_desc() { + PADDLE_ENFORCE(desc_.has_type(), "The var type hasn't been set."); + PADDLE_ENFORCE(desc_.type().has_type(), "The var type hasn't been set."); + switch (desc_.type().type()) { + case proto::VarType::CHANNEL: + return desc_.mutable_type()->mutable_channel(); + default: + PADDLE_THROW( + "Getting 'mutable_channel_desc' is not supported by the type of var " + "%s.", + this->Name()); + } +} + +proto::VarType::TensorDesc *VarDesc::mutable_tensor_desc() { PADDLE_ENFORCE(desc_.has_type(), "The var type hasn't been set."); - switch (desc_.type()) { - case proto::VarDesc::SELECTED_ROWS: - return desc_.mutable_selected_rows(); - case proto::VarDesc::LOD_TENSOR: - return desc_.mutable_lod_tensor()->mutable_tensor(); - case proto::VarDesc::LOD_TENSOR_ARRAY: - return desc_.mutable_tensor_array()->mutable_tensor(); + PADDLE_ENFORCE(desc_.type().has_type(), "The var type hasn't been set."); + switch (desc_.type().type()) { + case proto::VarType::SELECTED_ROWS: + return desc_.mutable_type()->mutable_selected_rows(); + case proto::VarType::LOD_TENSOR: + return desc_.mutable_type()->mutable_lod_tensor()->mutable_tensor(); + case proto::VarType::LOD_TENSOR_ARRAY: + return desc_.mutable_type()->mutable_tensor_array()->mutable_tensor(); default: PADDLE_THROW( "Getting 'mutable_tensor_desc' is not supported by the type of var " @@ -237,13 +294,15 @@ proto::TensorDesc *VarDesc::mutable_tensor_desc() { } } -std::vector VarDesc::mutable_tensor_descs() { +std::vector VarDesc::mutable_tensor_descs() { PADDLE_ENFORCE(desc_.has_type(), "The var type hasn't been set."); - std::vector res; + PADDLE_ENFORCE(desc_.type().has_type(), "The var type hasn't been set."); + std::vector res; res.reserve(GetTensorDescNum()); - switch (desc_.type()) { - case proto::VarDesc::READER: - for (auto &lod_tensor : *desc_.mutable_reader()->mutable_lod_tensor()) { + switch (desc_.type().type()) { + case proto::VarType::READER: + for (auto &lod_tensor : + *desc_.mutable_type()->mutable_reader()->mutable_lod_tensor()) { res.push_back(lod_tensor.mutable_tensor()); } return res; diff --git a/paddle/fluid/framework/var_desc.h b/paddle/fluid/framework/var_desc.h index cdb1bc3ec09c890f2166190d591b6e6ee8b668a0..f62415fda67a506763494886eb499fbb09c5caa6 100644 --- a/paddle/fluid/framework/var_desc.h +++ b/paddle/fluid/framework/var_desc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ class VarDesc { public: explicit VarDesc(const std::string &name) { desc_.set_name(name); - desc_.set_type(proto::VarDesc::LOD_TENSOR); + desc_.mutable_type()->set_type(proto::VarType::LOD_TENSOR); } explicit VarDesc(const proto::VarDesc &desc) : desc_(desc) {} @@ -80,13 +80,16 @@ class VarDesc { std::vector> GetShapes() const; - void SetDataType(proto::DataType data_type); + void SetDataType(proto::VarType::Type data_type); - void SetDataTypes(const std::vector &multiple_data_type); + void SetDataTypes( + const std::vector &multiple_data_type); - proto::DataType GetDataType() const; + void SetCapacity(int64_t capacity); - std::vector GetDataTypes() const; + proto::VarType::Type GetDataType() const; + + std::vector GetDataTypes() const; void SetLoDLevel(int32_t lod_level); @@ -96,19 +99,21 @@ class VarDesc { std::vector GetLoDLevels() const; - proto::VarDesc::VarType GetType() const; + proto::VarType::Type GetType() const; - void SetType(proto::VarDesc::VarType type); + void SetType(proto::VarType::Type type); bool Persistable() const { return desc_.persistable(); } void SetPersistable(bool persistable) { desc_.set_persistable(persistable); } private: - const proto::TensorDesc &tensor_desc() const; - std::vector tensor_descs() const; - proto::TensorDesc *mutable_tensor_desc(); - std::vector mutable_tensor_descs(); + const proto::VarType::ChannelDesc &channel_desc() const; + const proto::VarType::TensorDesc &tensor_desc() const; + std::vector tensor_descs() const; + proto::VarType::ChannelDesc *mutable_channel_desc(); + proto::VarType::TensorDesc *mutable_tensor_desc(); + std::vector mutable_tensor_descs(); proto::VarDesc desc_; }; diff --git a/paddle/fluid/framework/var_type.h b/paddle/fluid/framework/var_type.h index 2dc4de529814bb0f7a5193b8e216343a4b1b3503..2b646d78f0b23ec3e065c891826856c2341d4ac1 100644 --- a/paddle/fluid/framework/var_type.h +++ b/paddle/fluid/framework/var_type.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #pragma once +#include "paddle/fluid/framework/channel.h" #include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/framework/lod_rank_table.h" #include "paddle/fluid/framework/lod_tensor.h" @@ -23,17 +24,19 @@ limitations under the License. */ namespace paddle { namespace framework { -inline proto::VarDesc::VarType ToVarType(std::type_index type) { +inline proto::VarType::Type ToVarType(std::type_index type) { if (type.hash_code() == typeid(LoDTensor).hash_code()) { - return proto::VarDesc_VarType_LOD_TENSOR; + return proto::VarType_Type_LOD_TENSOR; } else if (type.hash_code() == typeid(LoDRankTable).hash_code()) { - return proto::VarDesc_VarType_LOD_RANK_TABLE; + return proto::VarType_Type_LOD_RANK_TABLE; } else if (type.hash_code() == typeid(LoDTensorArray).hash_code()) { - return proto::VarDesc_VarType_LOD_TENSOR_ARRAY; + return proto::VarType_Type_LOD_TENSOR_ARRAY; } else if (type.hash_code() == typeid(SelectedRows).hash_code()) { - return proto::VarDesc_VarType_SELECTED_ROWS; + return proto::VarType_Type_SELECTED_ROWS; } else if (type.hash_code() == typeid(ReaderHolder).hash_code()) { - return proto::VarDesc_VarType_READER; + return proto::VarType_Type_READER; + } else if (type.hash_code() == typeid(ChannelHolder).hash_code()) { + return proto::VarType_Type_CHANNEL; } else { PADDLE_THROW("ToVarType:Unsupported type %s", type.name()); } @@ -42,21 +45,24 @@ inline proto::VarDesc::VarType ToVarType(std::type_index type) { template inline void VisitVarType(const framework::Variable& var, Visitor visitor) { switch (ToVarType(var.Type())) { - case proto::VarDesc_VarType_LOD_TENSOR: + case proto::VarType_Type_LOD_TENSOR: visitor(var.Get()); return; - case proto::VarDesc_VarType_LOD_RANK_TABLE: + case proto::VarType_Type_LOD_RANK_TABLE: visitor(var.Get()); return; - case proto::VarDesc_VarType_LOD_TENSOR_ARRAY: + case proto::VarType_Type_LOD_TENSOR_ARRAY: visitor(var.Get()); return; - case proto::VarDesc_VarType_SELECTED_ROWS: + case proto::VarType_Type_SELECTED_ROWS: visitor(var.Get()); return; - case proto::VarDesc_VarType_READER: + case proto::VarType_Type_READER: visitor(var.Get()); return; + case proto::VarType_Type_CHANNEL: + visitor(var.Get()); + return; default: PADDLE_THROW("Not supported visit type, %d", ToVarType(var.Type())); } diff --git a/paddle/fluid/framework/var_type_inference.h b/paddle/fluid/framework/var_type_inference.h index 44fd4cd622cbada7f10ade8928a69d4e3d1d9ec0..f3035cd712bdea517068b4c172bb2794d5fccddb 100644 --- a/paddle/fluid/framework/var_type_inference.h +++ b/paddle/fluid/framework/var_type_inference.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/var_type_inference_test.cc b/paddle/fluid/framework/var_type_inference_test.cc index 0ee589c821a77af7f6714fefd7bebff89218dad8..1dced845ed7849d9f5a6de16dfe627d52fdb5488 100644 --- a/paddle/fluid/framework/var_type_inference_test.cc +++ b/paddle/fluid/framework/var_type_inference_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -35,14 +35,14 @@ class SumOpVarTypeInference : public VarTypeInference { public: void operator()(const OpDesc &op_desc, BlockDesc *block) const override { auto &inputs = op_desc.Input("X"); - auto default_var_type = proto::VarDesc::SELECTED_ROWS; + auto default_var_type = proto::VarType::SELECTED_ROWS; bool any_input_is_lod_tensor = std::any_of( inputs.begin(), inputs.end(), [block](const std::string &name) { - return block->Var(name)->GetType() == proto::VarDesc::LOD_TENSOR; + return block->Var(name)->GetType() == proto::VarType::LOD_TENSOR; }); if (any_input_is_lod_tensor) { - default_var_type = proto::VarDesc::LOD_TENSOR; + default_var_type = proto::VarType::LOD_TENSOR; } auto out_var_name = op_desc.Output("Out").front(); @@ -67,19 +67,19 @@ TEST(InferVarType, sum_op) { op->SetInput("X", {"test_a", "test_b", "test_c"}); op->SetOutput("Out", {"test_out"}); - prog.MutableBlock(0)->Var("test_a")->SetType(proto::VarDesc::SELECTED_ROWS); - prog.MutableBlock(0)->Var("test_b")->SetType(proto::VarDesc::SELECTED_ROWS); - prog.MutableBlock(0)->Var("test_c")->SetType(proto::VarDesc::SELECTED_ROWS); + prog.MutableBlock(0)->Var("test_a")->SetType(proto::VarType::SELECTED_ROWS); + prog.MutableBlock(0)->Var("test_b")->SetType(proto::VarType::SELECTED_ROWS); + prog.MutableBlock(0)->Var("test_c")->SetType(proto::VarType::SELECTED_ROWS); prog.MutableBlock(0)->Var("test_out"); op->InferVarType(prog.MutableBlock(0)); - ASSERT_EQ(proto::VarDesc::SELECTED_ROWS, + ASSERT_EQ(proto::VarType::SELECTED_ROWS, prog.MutableBlock(0)->Var("test_out")->GetType()); - prog.MutableBlock(0)->Var("test_b")->SetType(proto::VarDesc::LOD_TENSOR); + prog.MutableBlock(0)->Var("test_b")->SetType(proto::VarType::LOD_TENSOR); op->InferVarType(prog.MutableBlock(0)); - ASSERT_EQ(proto::VarDesc::LOD_TENSOR, + ASSERT_EQ(proto::VarType::LOD_TENSOR, prog.MutableBlock(0)->Var("test_out")->GetType()); } @@ -90,16 +90,16 @@ TEST(InferVarType, sum_op_without_infer_var_type) { op->SetInput("X", {"test2_a", "test2_b", "test2_c"}); op->SetOutput("Out", {"test2_out"}); - prog.MutableBlock(0)->Var("test2_a")->SetType(proto::VarDesc::SELECTED_ROWS); - prog.MutableBlock(0)->Var("test2_b")->SetType(proto::VarDesc::SELECTED_ROWS); - prog.MutableBlock(0)->Var("test2_c")->SetType(proto::VarDesc::SELECTED_ROWS); + prog.MutableBlock(0)->Var("test2_a")->SetType(proto::VarType::SELECTED_ROWS); + prog.MutableBlock(0)->Var("test2_b")->SetType(proto::VarType::SELECTED_ROWS); + prog.MutableBlock(0)->Var("test2_c")->SetType(proto::VarType::SELECTED_ROWS); prog.MutableBlock(0)->Var("test2_out"); op->InferVarType(prog.MutableBlock(0)); - ASSERT_EQ(proto::VarDesc_VarType_LOD_TENSOR, + ASSERT_EQ(proto::VarType_Type_LOD_TENSOR, prog.MutableBlock(0)->Var("test2_out")->GetType()); } } // namespace framework -} // namespace paddle \ No newline at end of file +} // namespace paddle diff --git a/paddle/fluid/framework/variable.h b/paddle/fluid/framework/variable.h index 9fb8ca92d68203a0bf8ec6ecd30072374b5fe4af..87ddfe2ff9abfa3f4d99033686b197b10d8231fa 100644 --- a/paddle/fluid/framework/variable.h +++ b/paddle/fluid/framework/variable.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/framework/variable_test.cc b/paddle/fluid/framework/variable_test.cc index 8c14e506fd7fd480012135b316479e45bed5584e..c5c1d215f4a6affae0a3bdafacec40a2aee2ca19 100644 --- a/paddle/fluid/framework/variable_test.cc +++ b/paddle/fluid/framework/variable_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/inference/io.cc b/paddle/fluid/inference/io.cc index 8132347d630592db3d98e23a2c77b85568c70c38..80eb9889670744ae527ea29609b33631a021bfa8 100644 --- a/paddle/fluid/inference/io.cc +++ b/paddle/fluid/inference/io.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -34,8 +34,8 @@ void ReadBinaryFile(const std::string& filename, std::string& contents) { bool IsPersistable(const framework::VarDesc* var) { if (var->Persistable() && - var->GetType() != framework::proto::VarDesc::FEED_MINIBATCH && - var->GetType() != framework::proto::VarDesc::FETCH_LIST) { + var->GetType() != framework::proto::VarType::FEED_MINIBATCH && + var->GetType() != framework::proto::VarType::FETCH_LIST) { return true; } return false; diff --git a/paddle/fluid/inference/io.h b/paddle/fluid/inference/io.h index 9d7864060646d9a480ce6ced6a1f4364e83938c0..6817a6fca047c9336233697a7bee4e5e16eedd5e 100644 --- a/paddle/fluid/inference/io.h +++ b/paddle/fluid/inference/io.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/inference/tests/book/CMakeLists.txt b/paddle/fluid/inference/tests/book/CMakeLists.txt index 8db3e76e7671df401612be1a8f89d94ae9a72d7c..e7ffb00ec8d8926193fe510ebdb7185f75c90906 100644 --- a/paddle/fluid/inference/tests/book/CMakeLists.txt +++ b/paddle/fluid/inference/tests/book/CMakeLists.txt @@ -4,7 +4,7 @@ function(inference_test TARGET_NAME) set(multiValueArgs ARGS) cmake_parse_arguments(inference_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - set(PYTHON_TESTS_DIR ${PADDLE_SOURCE_DIR}/python/paddle/v2/fluid/tests) + set(PYTHON_TESTS_DIR ${PADDLE_SOURCE_DIR}/python/paddle/fluid/tests) set(arg_list "") if(inference_test_ARGS) foreach(arg ${inference_test_ARGS}) @@ -27,8 +27,8 @@ endfunction(inference_test) inference_test(fit_a_line) inference_test(image_classification ARGS vgg resnet) inference_test(label_semantic_roles) -inference_test(recognize_digits ARGS mlp) +inference_test(recognize_digits ARGS mlp conv) inference_test(recommender_system) #inference_test(rnn_encoder_decoder) -inference_test(understand_sentiment ARGS conv lstm) +inference_test(understand_sentiment ARGS conv) inference_test(word2vec) diff --git a/paddle/fluid/inference/tests/book/test_inference_fit_a_line.cc b/paddle/fluid/inference/tests/book/test_inference_fit_a_line.cc index fa18e69b3ac7e984172dd14a3cb8d48158dfb471..9ab808efec3abdb86724fb16725962958c5cf55c 100644 --- a/paddle/fluid/inference/tests/book/test_inference_fit_a_line.cc +++ b/paddle/fluid/inference/tests/book/test_inference_fit_a_line.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/inference/tests/book/test_inference_image_classification.cc b/paddle/fluid/inference/tests/book/test_inference_image_classification.cc index 27f17712bca4103e2556cb375339ca785f53bd4f..d6fc51301bc45d3ce01142c0f015e4bb69e519bf 100644 --- a/paddle/fluid/inference/tests/book/test_inference_image_classification.cc +++ b/paddle/fluid/inference/tests/book/test_inference_image_classification.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/inference/tests/book/test_inference_label_semantic_roles.cc b/paddle/fluid/inference/tests/book/test_inference_label_semantic_roles.cc index 7b75aea73f3c8a587e176db0b0070c8fa45926c5..184924016634bba26204d937744ca5fa87cd443c 100644 --- a/paddle/fluid/inference/tests/book/test_inference_label_semantic_roles.cc +++ b/paddle/fluid/inference/tests/book/test_inference_label_semantic_roles.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/inference/tests/book/test_inference_recognize_digits.cc b/paddle/fluid/inference/tests/book/test_inference_recognize_digits.cc index 99cf0f3095bf7f93d53272e0ae13242484d7128c..99bee94cb82633219df7a4a5c5bada15d2d3ce64 100644 --- a/paddle/fluid/inference/tests/book/test_inference_recognize_digits.cc +++ b/paddle/fluid/inference/tests/book/test_inference_recognize_digits.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ TEST(inference, recognize_digits_combine) { // Use normilized image pixels as input data, // which should be in the range [-1.0, 1.0]. SetupTensor( - input, {1, 28, 28}, static_cast(-1), static_cast(1)); + input, {1, 1, 28, 28}, static_cast(-1), static_cast(1)); std::vector cpu_feeds; cpu_feeds.push_back(&input); diff --git a/paddle/fluid/inference/tests/book/test_inference_recommender_system.cc b/paddle/fluid/inference/tests/book/test_inference_recommender_system.cc index 9208c2a59965ad5296238a23e89cd290b5e19740..b42a33c9a90b5feafaed343a197da0e4db11b7ea 100644 --- a/paddle/fluid/inference/tests/book/test_inference_recommender_system.cc +++ b/paddle/fluid/inference/tests/book/test_inference_recommender_system.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/inference/tests/book/test_inference_rnn_encoder_decoder.cc b/paddle/fluid/inference/tests/book/test_inference_rnn_encoder_decoder.cc index c88ca30cb781c1980d960c5e4e1137dcfd54afac..a0523905bd1631cd8768b1601e459cb9d110a84d 100644 --- a/paddle/fluid/inference/tests/book/test_inference_rnn_encoder_decoder.cc +++ b/paddle/fluid/inference/tests/book/test_inference_rnn_encoder_decoder.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/inference/tests/book/test_inference_understand_sentiment.cc b/paddle/fluid/inference/tests/book/test_inference_understand_sentiment.cc index 0167bc0a51e07788c8a3f9785a5d5af0251ebaf1..824b3274ebc7ba046e61798b3f61ef9924a75679 100644 --- a/paddle/fluid/inference/tests/book/test_inference_understand_sentiment.cc +++ b/paddle/fluid/inference/tests/book/test_inference_understand_sentiment.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/inference/tests/book/test_inference_word2vec.cc b/paddle/fluid/inference/tests/book/test_inference_word2vec.cc index a62b0a37c69f7ebd656ff52e71f6562266afa5c1..1481760c529c29a7290f476e2a22e1ded5ab7787 100644 --- a/paddle/fluid/inference/tests/book/test_inference_word2vec.cc +++ b/paddle/fluid/inference/tests/book/test_inference_word2vec.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/inference/tests/test_helper.h b/paddle/fluid/inference/tests/test_helper.h index 458c766cb0c19a2b96a11d4cd0c878ac8c3cba4b..49518e50d8541477234f17ac5b8709aeb57662ff 100644 --- a/paddle/fluid/inference/tests/test_helper.h +++ b/paddle/fluid/inference/tests/test_helper.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/buddy_allocator.cc b/paddle/fluid/memory/detail/buddy_allocator.cc index 2cee8271d27014815b19175ef93759d6a07b7e73..876837838648d6733b104a5496454f5dc58bbb71 100644 --- a/paddle/fluid/memory/detail/buddy_allocator.cc +++ b/paddle/fluid/memory/detail/buddy_allocator.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/buddy_allocator.h b/paddle/fluid/memory/detail/buddy_allocator.h index 644d79330680787f717920652708c0dd5bee1833..a4ee70c2586f37e3b2328dedfe28135e14d8b18d 100644 --- a/paddle/fluid/memory/detail/buddy_allocator.h +++ b/paddle/fluid/memory/detail/buddy_allocator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/memory_block.cc b/paddle/fluid/memory/detail/memory_block.cc index 23388cdd5b7c44ff91e10aadaa8cc25d8ef29d14..07123f2669c3a829ff28e9fab5a404047c5a09c7 100644 --- a/paddle/fluid/memory/detail/memory_block.cc +++ b/paddle/fluid/memory/detail/memory_block.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/memory_block.h b/paddle/fluid/memory/detail/memory_block.h index a4ca51b31b0df269b4b48f824bfd2b74f2a059fb..72b40b73177d086aa912416e7f9cb3cd4ad5b45e 100644 --- a/paddle/fluid/memory/detail/memory_block.h +++ b/paddle/fluid/memory/detail/memory_block.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/meta_cache.cc b/paddle/fluid/memory/detail/meta_cache.cc index 7d78811c7715b906aea1b88c13a4c3939db6387d..43249e842ad4d2419fed041e6c9056021e9663cd 100644 --- a/paddle/fluid/memory/detail/meta_cache.cc +++ b/paddle/fluid/memory/detail/meta_cache.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/meta_cache.h b/paddle/fluid/memory/detail/meta_cache.h index 635d6398e697de80d0606a200c2634a93468199d..3283d756a6e7f7f1750442039797846bdad51125 100644 --- a/paddle/fluid/memory/detail/meta_cache.h +++ b/paddle/fluid/memory/detail/meta_cache.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/meta_data.cc b/paddle/fluid/memory/detail/meta_data.cc index eae49ebdcffd03eeb192fb7e859666027336245b..ad862af1705835c495a30232aa2bba2d2a56ad89 100644 --- a/paddle/fluid/memory/detail/meta_data.cc +++ b/paddle/fluid/memory/detail/meta_data.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/meta_data.h b/paddle/fluid/memory/detail/meta_data.h index 368523701ef1a7b3bd869e1f0542c42c61448b40..14895ee8727e98186b1f1295321951e12753fef6 100644 --- a/paddle/fluid/memory/detail/meta_data.h +++ b/paddle/fluid/memory/detail/meta_data.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/system_allocator.cc b/paddle/fluid/memory/detail/system_allocator.cc index 1f07c5e789c42997b3c75167a26a5b09875bd498..8ac8978120ad5930cd80272189ac0a83a77b2617 100644 --- a/paddle/fluid/memory/detail/system_allocator.cc +++ b/paddle/fluid/memory/detail/system_allocator.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/system_allocator.h b/paddle/fluid/memory/detail/system_allocator.h index 552cab4f96ff21a6f3c66209eb62150e92996826..e93c2c1e3231f7f42794dd78121072dbdb6abc41 100644 --- a/paddle/fluid/memory/detail/system_allocator.h +++ b/paddle/fluid/memory/detail/system_allocator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/detail/system_allocator_test.cc b/paddle/fluid/memory/detail/system_allocator_test.cc index a850e480ec948b727980a8020df91958584aea02..d5df9e6897e9e788f14d2625e424c13949eeaa26 100644 --- a/paddle/fluid/memory/detail/system_allocator_test.cc +++ b/paddle/fluid/memory/detail/system_allocator_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/memcpy.cc b/paddle/fluid/memory/memcpy.cc index 8938b3613373a06620a6a0237b3de773c6421edd..b991360d0442ec2d258443a931a9dcf10b332f1e 100644 --- a/paddle/fluid/memory/memcpy.cc +++ b/paddle/fluid/memory/memcpy.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/memcpy.h b/paddle/fluid/memory/memcpy.h index 77d209c3fbe8256bc94b3eca866f0f7e17a93325..7b2b8eb0662fb1a6f690b7c10f84b35c717ba6ee 100644 --- a/paddle/fluid/memory/memcpy.h +++ b/paddle/fluid/memory/memcpy.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/memory.cc b/paddle/fluid/memory/memory.cc index 6eedab5d034192c071328b1be5c296227383287e..d07f89439a1ec37682f79799d5569cad2ab75818 100644 --- a/paddle/fluid/memory/memory.cc +++ b/paddle/fluid/memory/memory.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/memory.h b/paddle/fluid/memory/memory.h index a9166a6746e1985752ca18ffa7c429e5b35b55bb..7c5db815d6543f026ab99f7cf895a87db4e5a3d8 100644 --- a/paddle/fluid/memory/memory.h +++ b/paddle/fluid/memory/memory.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/memory/memory_test.cc b/paddle/fluid/memory/memory_test.cc index d7505ef0f36bc8765ba7634f286b67bccc6eacb6..ae98d0d52542c49620a5d598b1089c168d39ede4 100644 --- a/paddle/fluid/memory/memory_test.cc +++ b/paddle/fluid/memory/memory_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/CMakeLists.txt b/paddle/fluid/operators/CMakeLists.txt index cadfd735d7b3feb473c308b04417f0a1e0f22249..8f14fd376ae51eff0f56c5a8d679c49cec23bd68 100644 --- a/paddle/fluid/operators/CMakeLists.txt +++ b/paddle/fluid/operators/CMakeLists.txt @@ -176,6 +176,20 @@ op_library(pool_op SRCS pool_op.cc DEPS pooling) op_library(conv_transpose_op SRCS conv_transpose_op.cc DEPS vol2col) endif() +cc_library(batch_size_like SRCS batch_size_like.cc DEPS op_registry) + +op_library(fill_constant_batch_size_like_op + SRCS fill_constant_batch_size_like_op.cc fill_constant_batch_size_like_op.cu.cc + DEPS batch_size_like) + +op_library(uniform_random_batch_size_like_op + SRCS uniform_random_batch_size_like_op.cc + DEPS batch_size_like uniform_random_op) + +op_library(gaussian_random_batch_size_like_op + SRCS gaussian_random_batch_size_like_op.cc + DEPS batch_size_like gaussian_random_op) + # FIXME(typhoonzero): save/load depends lodtensor serialization functions op_library(save_op DEPS lod_tensor) op_library(load_op DEPS lod_tensor) diff --git a/paddle/fluid/operators/accuracy_op.cc b/paddle/fluid/operators/accuracy_op.cc index 43689b3b7da5a0f5157ec8bc5fcf19d643ddc4ca..ac10d759fecb56635d1303fd383a5f9ea18f0a4d 100644 --- a/paddle/fluid/operators/accuracy_op.cc +++ b/paddle/fluid/operators/accuracy_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/accuracy_op.cu b/paddle/fluid/operators/accuracy_op.cu index 4462b9ba5c0e902933c53130f72fe40f807bde4a..630a4a2df2ca8f6afe81be3c455d255a0693fcc3 100644 --- a/paddle/fluid/operators/accuracy_op.cu +++ b/paddle/fluid/operators/accuracy_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/accuracy_op.h b/paddle/fluid/operators/accuracy_op.h index b3ed1d3fe09ba044142ed69a463918d7e03a78e9..803244dd48efc634bf5e654a35cb3dd572842882 100644 --- a/paddle/fluid/operators/accuracy_op.h +++ b/paddle/fluid/operators/accuracy_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/activation_op.cc b/paddle/fluid/operators/activation_op.cc index c04dd8cb9163cf7b05fd09bcf7f1d2937368614f..d74c47b981e51f12d99098818c71f3f6ec455d98 100644 --- a/paddle/fluid/operators/activation_op.cc +++ b/paddle/fluid/operators/activation_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/activation_op.cu b/paddle/fluid/operators/activation_op.cu index b86a7926a978b987d9dbb51fba55e025aab5e7fd..b2633d017623c3a6a3bab2b416009d6d7c8fc1d4 100644 --- a/paddle/fluid/operators/activation_op.cu +++ b/paddle/fluid/operators/activation_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/activation_op.h b/paddle/fluid/operators/activation_op.h index 7a6ae2224c84cc17223f43046f06f08d11451439..8f791a6ca81c13a92fd8adf0d1620203bd4cf7d6 100644 --- a/paddle/fluid/operators/activation_op.h +++ b/paddle/fluid/operators/activation_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adadelta_op.cc b/paddle/fluid/operators/adadelta_op.cc index ececd47e6a6787a161405fec75dafda336fddfbf..c9ed221a6e662e8c213fe1d34ff85a3f77483a3c 100644 --- a/paddle/fluid/operators/adadelta_op.cc +++ b/paddle/fluid/operators/adadelta_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adadelta_op.cu b/paddle/fluid/operators/adadelta_op.cu index 733482f788df8dfe1224ebe0d4494111bf9f647b..fc10c6657476e7f87b2f703a1d0cb88eeebc35cf 100644 --- a/paddle/fluid/operators/adadelta_op.cu +++ b/paddle/fluid/operators/adadelta_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adadelta_op.h b/paddle/fluid/operators/adadelta_op.h index 82ced08710448293fb91a4fb0dea7ab216cd3da6..822458daf663d99bbb38d99205f51163a0df4c4d 100644 --- a/paddle/fluid/operators/adadelta_op.h +++ b/paddle/fluid/operators/adadelta_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adagrad_op.cc b/paddle/fluid/operators/adagrad_op.cc index 61c0ecd019b1d7811ee5cfd4b43358bdb0fba3d9..c990fe784380bf78a7f3594c0f49ef5e06e6caea 100644 --- a/paddle/fluid/operators/adagrad_op.cc +++ b/paddle/fluid/operators/adagrad_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adagrad_op.cu b/paddle/fluid/operators/adagrad_op.cu index 1117363c133fe02c0c6b0a563d0b3665efb7fb18..e798101ca6a3a44de749a2d2219295bd8911dfac 100644 --- a/paddle/fluid/operators/adagrad_op.cu +++ b/paddle/fluid/operators/adagrad_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adagrad_op.h b/paddle/fluid/operators/adagrad_op.h index ee503b2c36299c7550f6679fe6e4bca7c33c8eee..df520fcc898ff5514927dbdd845ecaecdcf3c147 100644 --- a/paddle/fluid/operators/adagrad_op.h +++ b/paddle/fluid/operators/adagrad_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adam_op.cc b/paddle/fluid/operators/adam_op.cc index 25da9336b28ca8d14bf01ce8ca13bd8b379e9b10..267dcab8104c337c8590180c8093098c756ab27d 100644 --- a/paddle/fluid/operators/adam_op.cc +++ b/paddle/fluid/operators/adam_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adam_op.cu b/paddle/fluid/operators/adam_op.cu index 85b806eb6a1c0ed28cd47331786b66fc2e3a21eb..77f1991002e6007e8b8dff4746739a90e836145d 100644 --- a/paddle/fluid/operators/adam_op.cu +++ b/paddle/fluid/operators/adam_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adam_op.h b/paddle/fluid/operators/adam_op.h index a51b46ef15778cf83d4d4f9c2d8f366b1c5d6b9f..b332b6716369ca355454dc57fbd6cc2cbc71c658 100644 --- a/paddle/fluid/operators/adam_op.h +++ b/paddle/fluid/operators/adam_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adamax_op.cc b/paddle/fluid/operators/adamax_op.cc index b2249b8f96da86438748ab5b2b0f748cc590b8f7..7e2f1cc66ebf8b7deebf55057a27129844129d5d 100644 --- a/paddle/fluid/operators/adamax_op.cc +++ b/paddle/fluid/operators/adamax_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adamax_op.cu b/paddle/fluid/operators/adamax_op.cu index 44a5d6c7bdeac94ceb710d981c6445c046528cb0..05cafd7a8eef79588d1d5724084586cb9b51d3d4 100644 --- a/paddle/fluid/operators/adamax_op.cu +++ b/paddle/fluid/operators/adamax_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/adamax_op.h b/paddle/fluid/operators/adamax_op.h index 124453c0eceb4caa53bf63a8d9e8c4b90a2213c9..de644676fd9c3fabdbf01d2fd9c69858c2627ed3 100644 --- a/paddle/fluid/operators/adamax_op.h +++ b/paddle/fluid/operators/adamax_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/array_operator.h b/paddle/fluid/operators/array_operator.h index 4ffb414ecea350006e5a370a0b25ae304cace89c..dbcc7abb0996268b5a3571ba113d9cc56f6f65a3 100644 --- a/paddle/fluid/operators/array_operator.h +++ b/paddle/fluid/operators/array_operator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ class ArrayOp : public framework::OperatorBase { if (platform::is_gpu_place(i_tensor.place())) { // FIXME: Avoid copy from GPU to CPU framework::Tensor t; - framework::Copy(i_tensor, platform::CPUPlace(), dev_ctx, &t); + framework::TensorCopy(i_tensor, platform::CPUPlace(), dev_ctx, &t); dev_ctx.Wait(); offset = static_cast(*t.data()); } else { diff --git a/paddle/fluid/operators/array_to_lod_tensor_op.cc b/paddle/fluid/operators/array_to_lod_tensor_op.cc index 69464c4cff52400d8a25a692c5df8d2fe06230e4..5db2e4540ef170079328f24ac8d30f7b1901fa1e 100644 --- a/paddle/fluid/operators/array_to_lod_tensor_op.cc +++ b/paddle/fluid/operators/array_to_lod_tensor_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -112,8 +112,8 @@ class ArrayToLoDTensorOp : public framework::OperatorBase { platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(place); - framework::Copy(x[x_idx].Slice(start_offset, end_offset), place, - dev_ctx, &slice); + framework::TensorCopy(x[x_idx].Slice(start_offset, end_offset), place, + dev_ctx, &slice); out_offset += len; } } diff --git a/paddle/fluid/operators/assign_op.cc b/paddle/fluid/operators/assign_op.cc index b72e72b12f8a6155b6eb3be1468b8dbc7bd48d4e..39ae3c0040d04a6d901f1d6c992d547a6778c28e 100644 --- a/paddle/fluid/operators/assign_op.cc +++ b/paddle/fluid/operators/assign_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ class AssignFunctor { out_rows.set_height(rows.height()); auto &t = rows.value(); auto *m = out_rows.mutable_value(); - framework::Copy(t, t.place(), dev_ctx_, m); + framework::TensorCopy(t, t.place(), dev_ctx_, m); } template @@ -57,7 +57,7 @@ class AssignFunctor { void copy_tensor(const framework::LoDTensor &lod_tensor, framework::LoDTensor *out) const { auto &out_tensor = *out; - Copy(lod_tensor, lod_tensor.place(), dev_ctx_, &out_tensor); + TensorCopy(lod_tensor, lod_tensor.place(), dev_ctx_, &out_tensor); out_tensor.set_lod(lod_tensor.lod()); } @@ -115,8 +115,8 @@ class AssignInferShape : public framework::InferShapeBase { void operator()(framework::InferShapeContext *context) const override { if (context->HasInput("X")) { auto type = context->GetInputsVarType("X")[0]; - if (type == framework::proto::VarDesc_VarType_SELECTED_ROWS || - type == framework::proto::VarDesc_VarType_LOD_TENSOR) { + if (type == framework::proto::VarType::SELECTED_ROWS || + type == framework::proto::VarType::LOD_TENSOR) { context->SetOutputDim("Out", context->GetInputDim("X")); } } diff --git a/paddle/fluid/operators/assign_value_op.cc b/paddle/fluid/operators/assign_value_op.cc index 835043d9ab49a20a73d5dd0fff936cb3e9473b1e..e8123cb1a490be642d1061bba8129f63e681d3c3 100644 --- a/paddle/fluid/operators/assign_value_op.cc +++ b/paddle/fluid/operators/assign_value_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -36,7 +36,8 @@ class AssignValueOp : public framework::OperatorWithKernel { framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext &ctx) const override { return framework::OpKernelType( - framework::proto::DataType(ctx.Attr("dtype")), ctx.GetPlace()); + framework::proto::VarType::Type(ctx.Attr("dtype")), + ctx.GetPlace()); } }; @@ -49,8 +50,8 @@ class AssignValueOpMaker : public framework::OpProtoAndCheckerMaker { "(vector) " "Shape of values."); AddAttr("dtype", "data type of values") - .InEnum({framework::proto::DataType::INT32, - framework::proto::DataType::FP32}); + .InEnum({framework::proto::VarType::INT32, + framework::proto::VarType::FP32}); AddAttr>("fp32_values", "store the float values") .SetDefault({}); AddAttr>("int32_values", "store the int values") diff --git a/paddle/fluid/operators/assign_value_op.cu.cc b/paddle/fluid/operators/assign_value_op.cu.cc index 616163f97b9b917187ff66339c01f95289f2f618..08bfde5dc92de9c675e5b9b85f8e65a3bab8631c 100644 --- a/paddle/fluid/operators/assign_value_op.cu.cc +++ b/paddle/fluid/operators/assign_value_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/assign_value_op.h b/paddle/fluid/operators/assign_value_op.h index 33a344cad596a079faf2582ee1d9dc497531465a..c7b1a55a5cd52bd2bacbdea3ee22c75c2a2c12d5 100644 --- a/paddle/fluid/operators/assign_value_op.h +++ b/paddle/fluid/operators/assign_value_op.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ class AssignValueKernel : public framework::OpKernel { int dtype = ctx.Attr("dtype"); const char* value_name = nullptr; switch (dtype) { - case framework::proto::DataType::INT32: + case framework::proto::VarType::INT32: value_name = "int32_values"; break; - case framework::proto::DataType::FP32: + case framework::proto::VarType::FP32: value_name = "fp32_values"; break; default: @@ -41,7 +41,7 @@ class AssignValueKernel : public framework::OpKernel { break; } auto values = ctx.Attr>(value_name); - framework::CopyFromVector(values, ctx.device_context(), out); + framework::TensorFromVector(values, ctx.device_context(), out); out->Resize(framework::make_ddim(shape)); } }; diff --git a/paddle/fluid/operators/auc_op.cc b/paddle/fluid/operators/auc_op.cc index 8ac08ea4a19b981b0dc8dac43e4ae5de7b09bb5d..71de78b1181daf4bd0b6d73508638857bafcf560 100644 --- a/paddle/fluid/operators/auc_op.cc +++ b/paddle/fluid/operators/auc_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/auc_op.h b/paddle/fluid/operators/auc_op.h index e648db70974087f84020f45c568fb0c1924a88dd..f4e8208c3f2e238a4acecab4579fc955092d5978 100644 --- a/paddle/fluid/operators/auc_op.h +++ b/paddle/fluid/operators/auc_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/batch_norm_op.cc b/paddle/fluid/operators/batch_norm_op.cc index 506c25d50d453ef841e6885c412ccff38f25cebb..215ae229aff96d76fc948e19bdb42db319af65dc 100644 --- a/paddle/fluid/operators/batch_norm_op.cc +++ b/paddle/fluid/operators/batch_norm_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/batch_norm_op.cu.cc b/paddle/fluid/operators/batch_norm_op.cu.cc index b9c97211e14c0ef3a99a7e2b5cbfd8b267d40c1e..2d1556efc66826ea9847de8311ccecdee0ea7871 100644 --- a/paddle/fluid/operators/batch_norm_op.cu.cc +++ b/paddle/fluid/operators/batch_norm_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/batch_norm_op.h b/paddle/fluid/operators/batch_norm_op.h index fa9942ad099f4a28a3abc68c676edeeb827aacd0..9e5fc41598f29336074335f3624a2300ad018d09 100644 --- a/paddle/fluid/operators/batch_norm_op.h +++ b/paddle/fluid/operators/batch_norm_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/batch_size_like.cc b/paddle/fluid/operators/batch_size_like.cc new file mode 100644 index 0000000000000000000000000000000000000000..4d4a6d4c472fe2dedb0cd37bff7bbf5bdad3ead7 --- /dev/null +++ b/paddle/fluid/operators/batch_size_like.cc @@ -0,0 +1,64 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#include "paddle/fluid/operators/batch_size_like.h" + +namespace paddle { +namespace operators { + +void BatchSizeLikeOp::InferShape(framework::InferShapeContext *ctx) const { + PADDLE_ENFORCE(ctx->HasInput("Input"), + "Input(Input) of %s should not be null.", Type()); + PADDLE_ENFORCE(ctx->HasOutput("Out"), "Output(Out) of %s should not be null.", + Type()); + + auto &shape = ctx->Attrs().Get>("shape"); + PADDLE_ENFORCE_GT(shape.size(), 0); + std::vector shape_int64(shape.size(), 0); + std::transform(shape.begin(), shape.end(), shape_int64.begin(), + [](int a) { return static_cast(a); }); + auto output_dim = framework::make_ddim(shape_int64); + + int input_dim_idx = ctx->Attrs().Get("input_dim_idx"); + PADDLE_ENFORCE_GE(input_dim_idx, 0); + PADDLE_ENFORCE_GT(ctx->GetInputDim("Input").size(), input_dim_idx); + + int output_dim_idx = ctx->Attrs().Get("output_dim_idx"); + PADDLE_ENFORCE_GE(output_dim_idx, 0); + PADDLE_ENFORCE_GT(static_cast(shape.size()), output_dim_idx); + + output_dim[output_dim_idx] = ctx->GetInputDim("Input")[input_dim_idx]; + ctx->SetOutputDim("Out", output_dim); +} + +BatchSizeLikeOpMaker::BatchSizeLikeOpMaker(OpProto *proto, + OpAttrChecker *op_checker) + : framework::OpProtoAndCheckerMaker(proto, op_checker) { + AddInput("Input", + "(Tensor) Tensor " + "whose input_dim_idx'th dimension specifies the batch_size"); + AddOutput("Out", + "(Tensor) Tensor of specified shape will be filled " + "with the specified value"); + AddAttr>("shape", "(vector) The shape of the output"); + AddAttr("input_dim_idx", + "(int, default 0) The index of input's batch size dimension") + .SetDefault(0); + AddAttr("output_dim_idx", + "(int, default 0) The index of output's batch size dimension") + .SetDefault(0); +} + +} // namespace operators +} // namespace paddle diff --git a/paddle/fluid/operators/batch_size_like.h b/paddle/fluid/operators/batch_size_like.h new file mode 100644 index 0000000000000000000000000000000000000000..87e8f053a73a23cd9e231ada6501d0d9344bb1a6 --- /dev/null +++ b/paddle/fluid/operators/batch_size_like.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#pragma once + +#include "paddle/fluid/framework/op_registry.h" +#include "paddle/fluid/operators/math/math_function.h" + +namespace paddle { +namespace operators { + +class BatchSizeLikeOp : public framework::OperatorWithKernel { + public: + using framework::OperatorWithKernel::OperatorWithKernel; + + void InferShape(framework::InferShapeContext *ctx) const override; +}; + +class BatchSizeLikeOpMaker : public framework::OpProtoAndCheckerMaker { + public: + BatchSizeLikeOpMaker(OpProto *proto, OpAttrChecker *op_checker); +}; + +} // namespace operators +} // namespace paddle diff --git a/paddle/fluid/operators/beam_search_decode_op.cc b/paddle/fluid/operators/beam_search_decode_op.cc index 6d3efcfeb8497a78d56180898e5e3a66e52ff22d..718f469d38c3c6b7272c1531fae0a1e9ad2e8e3e 100644 --- a/paddle/fluid/operators/beam_search_decode_op.cc +++ b/paddle/fluid/operators/beam_search_decode_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -128,10 +128,10 @@ class BeamSearchDecodeInferVarType : public framework::VarTypeInference { void operator()(const framework::OpDesc& op_desc, framework::BlockDesc* block) const override { for (auto& o : op_desc.Output("SentenceIds")) { - block->Var(o)->SetType(framework::proto::VarDesc::LOD_TENSOR); + block->Var(o)->SetType(framework::proto::VarType::LOD_TENSOR); } for (auto& o : op_desc.Output("SentenceScores")) { - block->Var(o)->SetType(framework::proto::VarDesc::LOD_TENSOR); + block->Var(o)->SetType(framework::proto::VarType::LOD_TENSOR); } } }; diff --git a/paddle/fluid/operators/beam_search_decode_op.h b/paddle/fluid/operators/beam_search_decode_op.h index aeecb8d39acf1e2761aec62b89322c9cbbfe7445..3cc6ed310575473fae8e91a8507fb9146107e841 100644 --- a/paddle/fluid/operators/beam_search_decode_op.h +++ b/paddle/fluid/operators/beam_search_decode_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -232,12 +232,12 @@ void BeamSearchDecoder::ConvertSentenceVectorToLodTensor( id_tensor->set_lod(lod); id_tensor->Resize({static_cast(id_data.size())}); id_tensor->mutable_data(paddle::platform::CPUPlace()); - framework::CopyFromVector(id_data, cpu_ctx, id_tensor); + framework::TensorFromVector(id_data, cpu_ctx, id_tensor); score_tensor->set_lod(lod); score_tensor->Resize({static_cast(score_data.size())}); score_tensor->mutable_data(paddle::platform::CPUPlace()); - framework::CopyFromVector(score_data, cpu_ctx, score_tensor); + framework::TensorFromVector(score_data, cpu_ctx, score_tensor); } template diff --git a/paddle/fluid/operators/beam_search_decode_op_test.cc b/paddle/fluid/operators/beam_search_decode_op_test.cc index 24f87279d5eaa19715c31b2228c7a22d4723efae..c3faf46e09bb40d01049fd9cfd79836c1d2bd5bb 100644 --- a/paddle/fluid/operators/beam_search_decode_op_test.cc +++ b/paddle/fluid/operators/beam_search_decode_op_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/beam_search_op.cc b/paddle/fluid/operators/beam_search_op.cc index 6f4c8c7e06ee17b4cf3880db7bc8ddfbb88df3b8..e848b1f12cb9f1ce1d37e0e0233bfc361dc35a33 100644 --- a/paddle/fluid/operators/beam_search_op.cc +++ b/paddle/fluid/operators/beam_search_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -240,10 +240,10 @@ class BeamSearchInferVarType : public framework::VarTypeInference { void operator()(const framework::OpDesc &op_desc, framework::BlockDesc *block) const override { for (auto &o : op_desc.Output("selected_ids")) { - block->Var(o)->SetType(framework::proto::VarDesc::LOD_TENSOR); + block->Var(o)->SetType(framework::proto::VarType::LOD_TENSOR); } for (auto &o : op_desc.Output("selected_scores")) { - block->Var(o)->SetType(framework::proto::VarDesc::LOD_TENSOR); + block->Var(o)->SetType(framework::proto::VarType::LOD_TENSOR); } } }; diff --git a/paddle/fluid/operators/beam_search_op.h b/paddle/fluid/operators/beam_search_op.h index bfbe78097d2f20ae4c5efa594d17f931c7ea5920..b333ef4e6c73be15dfea2cadb153d2484b3daaf7 100644 --- a/paddle/fluid/operators/beam_search_op.h +++ b/paddle/fluid/operators/beam_search_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/beam_search_op_test.cc b/paddle/fluid/operators/beam_search_op_test.cc index ea2afda4d492ccde8889a394201b398eeff3badb..ec666359aa2bd81f1323b54f9a03235740c3a696 100644 --- a/paddle/fluid/operators/beam_search_op_test.cc +++ b/paddle/fluid/operators/beam_search_op_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/bilinear_tensor_product_op.cc b/paddle/fluid/operators/bilinear_tensor_product_op.cc index cc378b1b4536273e4364a488eb7a4ca2cc706782..2ec984d8e0f07b741f5e36f281134c0469079afd 100644 --- a/paddle/fluid/operators/bilinear_tensor_product_op.cc +++ b/paddle/fluid/operators/bilinear_tensor_product_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/bilinear_tensor_product_op.cu b/paddle/fluid/operators/bilinear_tensor_product_op.cu index 2cec48ee69ac500c0b0ba84f4b6fc20415f4b82c..9426ffbe174c7daf9f24525f5f7ca12d986042f4 100644 --- a/paddle/fluid/operators/bilinear_tensor_product_op.cu +++ b/paddle/fluid/operators/bilinear_tensor_product_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/bilinear_tensor_product_op.h b/paddle/fluid/operators/bilinear_tensor_product_op.h index 626fa957c42c02c978519c1869cd5f0679d22a26..ca80e6085c4f8b242cd26803202475cd50474bcd 100644 --- a/paddle/fluid/operators/bilinear_tensor_product_op.h +++ b/paddle/fluid/operators/bilinear_tensor_product_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/bipartite_match_op.cc b/paddle/fluid/operators/bipartite_match_op.cc index d614bf704382da7743b2128fa57a147e8db33d24..c536cf6b6b822c8d9553d7d2cf57902e5e6e5343 100644 --- a/paddle/fluid/operators/bipartite_match_op.cc +++ b/paddle/fluid/operators/bipartite_match_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/box_coder_op.cc b/paddle/fluid/operators/box_coder_op.cc index 8e0fee22d8d828978fe74bd48e46ea6c8063150d..1fc201286f335f9b3e1ef87c85c0b02fc0b29e4b 100644 --- a/paddle/fluid/operators/box_coder_op.cc +++ b/paddle/fluid/operators/box_coder_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/box_coder_op.cu b/paddle/fluid/operators/box_coder_op.cu index dd9299ceacdf2507f51f895c71041c1645dd8371..7ab242edfa3bae0c394d2ca8c0b32e2c5761fa70 100644 --- a/paddle/fluid/operators/box_coder_op.cu +++ b/paddle/fluid/operators/box_coder_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/box_coder_op.h b/paddle/fluid/operators/box_coder_op.h index c41bcc212b8fcfc4a274a53db4b25161ecdb3fe5..5e105aff52673af54970b5d7f05dc1bc39bbc901 100644 --- a/paddle/fluid/operators/box_coder_op.h +++ b/paddle/fluid/operators/box_coder_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/cast_op.cc b/paddle/fluid/operators/cast_op.cc index 364c21f7619910784d63047f3abb3713f1bfd0fc..a5ec47d84fe423f77de494e342931a6d278049d2 100644 --- a/paddle/fluid/operators/cast_op.cc +++ b/paddle/fluid/operators/cast_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cast_op.cu b/paddle/fluid/operators/cast_op.cu index fb597be9d93af12afb608bf87382c283ddf78e7c..507e9a531aae70e60bc6748bfab800310d6e0c21 100644 --- a/paddle/fluid/operators/cast_op.cu +++ b/paddle/fluid/operators/cast_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cast_op.h b/paddle/fluid/operators/cast_op.h index 9ab4961cef4bd6e7d4e592581b51d7d4eb896ec7..6220e57f5941d89cbf0aea268b85ad55af6132cc 100644 --- a/paddle/fluid/operators/cast_op.h +++ b/paddle/fluid/operators/cast_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -55,7 +55,8 @@ class CastOpKernel : public framework::OpKernel { auto* in = context.Input("X"); auto* out = context.Output("Out"); framework::VisitDataType( - static_cast(context.Attr("out_dtype")), + static_cast( + context.Attr("out_dtype")), CastOpFunctor( in, out, context.template device_context())); } diff --git a/paddle/fluid/operators/chunk_eval_op.cc b/paddle/fluid/operators/chunk_eval_op.cc index 080e4d80da4752a0c6bea86c0a9f503cf46e8878..77d3cffe7c19affe66223363eba26e2d77cdcd43 100644 --- a/paddle/fluid/operators/chunk_eval_op.cc +++ b/paddle/fluid/operators/chunk_eval_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ class ChunkEvalOp : public framework::OperatorWithKernel { protected: framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext &ctx) const override { - return framework::OpKernelType(framework::proto::DataType::FP32, + return framework::OpKernelType(framework::proto::VarType::FP32, platform::CPUPlace()); } }; diff --git a/paddle/fluid/operators/chunk_eval_op.h b/paddle/fluid/operators/chunk_eval_op.h index 3dca3d2c0f99c3b2d447ffe4516c1b6c379b13f2..9e97f7c7762ed6bded94be35ae8a094466e0aec0 100644 --- a/paddle/fluid/operators/chunk_eval_op.h +++ b/paddle/fluid/operators/chunk_eval_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/clip_by_norm_op.cc b/paddle/fluid/operators/clip_by_norm_op.cc index 89df118c06f4df6444fc1f61b5ddde48f6ad8ba7..f43726b4793f284f14226f90c94ac6eebf632bd5 100644 --- a/paddle/fluid/operators/clip_by_norm_op.cc +++ b/paddle/fluid/operators/clip_by_norm_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/clip_by_norm_op.cu b/paddle/fluid/operators/clip_by_norm_op.cu index a466b335914f1fde6865c6cc375f4ef009632e41..788eab7cb2bc57971b85159d0482367551862bf5 100644 --- a/paddle/fluid/operators/clip_by_norm_op.cu +++ b/paddle/fluid/operators/clip_by_norm_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/clip_by_norm_op.h b/paddle/fluid/operators/clip_by_norm_op.h index 82bcf07657bfbf1df6b541b3953285622fb25a87..5af0eb0b2ada66d5ae7d521d80e213f9e61f826f 100644 --- a/paddle/fluid/operators/clip_by_norm_op.h +++ b/paddle/fluid/operators/clip_by_norm_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/clip_op.cc b/paddle/fluid/operators/clip_op.cc index 76b2cefbf9dd67c5036b6ecfe35a9d53a54467a9..a3b67964c79268e6ce07018501c46163847897ad 100644 --- a/paddle/fluid/operators/clip_op.cc +++ b/paddle/fluid/operators/clip_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/clip_op.cu b/paddle/fluid/operators/clip_op.cu index 7b044d6e699d59dda04fa19468c17faf1e0a0eb7..10bee444f6b9683686df77f0815e3c30348236cd 100644 --- a/paddle/fluid/operators/clip_op.cu +++ b/paddle/fluid/operators/clip_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/clip_op.h b/paddle/fluid/operators/clip_op.h index aecd6f83bfaf4deab4271e859bea10feecacab62..85607a6b0e4239b063ba75888e6859a5d85eafc9 100644 --- a/paddle/fluid/operators/clip_op.h +++ b/paddle/fluid/operators/clip_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/compare_op.cc b/paddle/fluid/operators/compare_op.cc index b1f09fb0029affe671d63874cf3d3db86476c367..86f7046058c7001fcaa588727b1cdc0f3f20c35f 100644 --- a/paddle/fluid/operators/compare_op.cc +++ b/paddle/fluid/operators/compare_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ class CompareOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle -#define REGISTER_LOGICAL_OP(op_type, _equation) \ +#define REGISTER_COMPARE_OP(op_type, _equation) \ struct _##op_type##Comment { \ static char type[]; \ static char equation[]; \ @@ -96,11 +96,17 @@ class CompareOp : public framework::OperatorWithKernel { ::paddle::operators::CompareOpInferShape<_##op_type##Comment>, \ ::paddle::framework::EmptyGradOpMaker); -REGISTER_LOGICAL_OP(less_than, "Out = X < Y"); -REGISTER_LOGICAL_KERNEL(less_than, CPU, paddle::operators::LessThanFunctor); -REGISTER_LOGICAL_OP(less_equal, "Out = X <= Y"); -REGISTER_LOGICAL_KERNEL(less_equal, CPU, paddle::operators::LessEqualFunctor); -REGISTER_LOGICAL_OP(equal, "Out = X == Y"); -REGISTER_LOGICAL_KERNEL(equal, CPU, paddle::operators::EqualFunctor); -REGISTER_LOGICAL_OP(not_equal, "Out = X != Y"); -REGISTER_LOGICAL_KERNEL(not_equal, CPU, paddle::operators::NotEqualFunctor); +REGISTER_COMPARE_OP(less_than, "Out = X < Y"); +REGISTER_COMPARE_KERNEL(less_than, CPU, paddle::operators::LessThanFunctor); +REGISTER_COMPARE_OP(less_equal, "Out = X <= Y"); +REGISTER_COMPARE_KERNEL(less_equal, CPU, paddle::operators::LessEqualFunctor); +REGISTER_COMPARE_OP(greater_than, "Out = X > Y"); +REGISTER_COMPARE_KERNEL(greater_than, CPU, + paddle::operators::GreaterThanFunctor); +REGISTER_COMPARE_OP(greater_equal, "Out = X >= Y"); +REGISTER_COMPARE_KERNEL(greater_equal, CPU, + paddle::operators::GreaterEqualFunctor); +REGISTER_COMPARE_OP(equal, "Out = X == Y"); +REGISTER_COMPARE_KERNEL(equal, CPU, paddle::operators::EqualFunctor); +REGISTER_COMPARE_OP(not_equal, "Out = X != Y"); +REGISTER_COMPARE_KERNEL(not_equal, CPU, paddle::operators::NotEqualFunctor); diff --git a/paddle/fluid/operators/compare_op.cu b/paddle/fluid/operators/compare_op.cu index 00263a2ade4502e732d53b871665185f8d0fa9f1..1bf85c64fb5b4d79c62118959fd72b13ed1c63ed 100644 --- a/paddle/fluid/operators/compare_op.cu +++ b/paddle/fluid/operators/compare_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +14,11 @@ limitations under the License. */ #include "paddle/fluid/operators/compare_op.h" -REGISTER_LOGICAL_KERNEL(less_than, CUDA, paddle::operators::LessThanFunctor); -REGISTER_LOGICAL_KERNEL(less_equal, CUDA, paddle::operators::LessEqualFunctor); -REGISTER_LOGICAL_KERNEL(equal, CUDA, paddle::operators::EqualFunctor); -REGISTER_LOGICAL_KERNEL(not_equal, CUDA, paddle::operators::NotEqualFunctor); +REGISTER_COMPARE_KERNEL(less_than, CUDA, paddle::operators::LessThanFunctor); +REGISTER_COMPARE_KERNEL(less_equal, CUDA, paddle::operators::LessEqualFunctor); +REGISTER_COMPARE_KERNEL(greater_than, CUDA, + paddle::operators::GreaterThanFunctor); +REGISTER_COMPARE_KERNEL(greater_equal, CUDA, + paddle::operators::GreaterEqualFunctor); +REGISTER_COMPARE_KERNEL(equal, CUDA, paddle::operators::EqualFunctor); +REGISTER_COMPARE_KERNEL(not_equal, CUDA, paddle::operators::NotEqualFunctor); diff --git a/paddle/fluid/operators/compare_op.h b/paddle/fluid/operators/compare_op.h index c651335268fee08c08bcac6247f5a2ff92784330..1cbabdaf6767815c1fedba0eabec9b5de678e047 100644 --- a/paddle/fluid/operators/compare_op.h +++ b/paddle/fluid/operators/compare_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -34,6 +34,18 @@ struct LessEqualFunctor { HOSTDEVICE bool operator()(const T& a, const T& b) const { return a <= b; } }; +template +struct GreaterThanFunctor { + using ELEM_TYPE = T; + HOSTDEVICE bool operator()(const T& a, const T& b) const { return a > b; } +}; + +template +struct GreaterEqualFunctor { + using ELEM_TYPE = T; + HOSTDEVICE bool operator()(const T& a, const T& b) const { return a >= b; } +}; + template struct EqualFunctor { using ELEM_TYPE = T; @@ -67,7 +79,6 @@ class CompareOpKernel auto* x = context.Input("X"); auto* y = context.Input("Y"); auto* z = context.Output("Out"); - z->mutable_data(context.GetPlace()); int axis = context.Attr("axis"); ElementwiseComputeEx(context, x, y, axis, Functor(), z); @@ -77,7 +88,7 @@ class CompareOpKernel } // namespace operators } // namespace paddle -#define REGISTER_LOGICAL_KERNEL(op_type, dev, functor) \ +#define REGISTER_COMPARE_KERNEL(op_type, dev, functor) \ REGISTER_OP_##dev##_KERNEL( \ op_type, ::paddle::operators::CompareOpKernel< \ ::paddle::platform::dev##DeviceContext, functor>, \ diff --git a/paddle/fluid/operators/concat_op.cc b/paddle/fluid/operators/concat_op.cc index 68eb5412beb02d9dc948eeb188a2d5b1cdb0c5b3..bdce8f0a6f5f817d2010e8b4de28a7d1be4cc08b 100644 --- a/paddle/fluid/operators/concat_op.cc +++ b/paddle/fluid/operators/concat_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/concat_op.cu.cc b/paddle/fluid/operators/concat_op.cu.cc index 143bda6116775611e399ad805708474621d33b96..590eca9d066ff7549939e62ddbfedc8ab76bb5e7 100644 --- a/paddle/fluid/operators/concat_op.cu.cc +++ b/paddle/fluid/operators/concat_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/concat_op.h b/paddle/fluid/operators/concat_op.h index 878e53058567500aeb9fe854a1a65ed5380572a8..eb0e43ad2d84f681f39ed4adc5a27f6d3ab00f08 100644 --- a/paddle/fluid/operators/concat_op.h +++ b/paddle/fluid/operators/concat_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ class ConcatKernel : public framework::OpKernel { auto in_stride = framework::stride_numel(in->dims()); StridedNumelCopyWithAxis(ctx.device_context(), axis, out->data() + output_offset, out_stride, - in->data(), in_stride); + in->data(), in_stride, in_stride[axis]); output_offset += in_stride[axis]; } } @@ -59,7 +59,7 @@ class ConcatGradKernel : public framework::OpKernel { auto out_stride = framework::stride_numel(out->dims()); StridedNumelCopyWithAxis(ctx.device_context(), axis, out->data(), out_stride, in->data() + input_offset, - in_stride); + in_stride, out_stride[axis]); input_offset += out_stride[axis]; } } diff --git a/paddle/fluid/operators/cond_op.cc b/paddle/fluid/operators/cond_op.cc index d63748a61cec0f10269e05bcef3bb0d10345000d..15dce9e3e28fa0200e332534f42752838da4db92 100644 --- a/paddle/fluid/operators/cond_op.cc +++ b/paddle/fluid/operators/cond_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cond_op.h b/paddle/fluid/operators/cond_op.h index 0bb14bc8c2cfabeeb13e1e1afd51b034742b74f0..a04fae2182005d4eb08305e943449977bfb637f9 100644 --- a/paddle/fluid/operators/cond_op.h +++ b/paddle/fluid/operators/cond_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conditional_block_op.cc b/paddle/fluid/operators/conditional_block_op.cc index 228b0998360550348fdd30c842a394e8f8ce5935..337b34e8f0bf4cb89753235205be9eb058dd01ab 100644 --- a/paddle/fluid/operators/conditional_block_op.cc +++ b/paddle/fluid/operators/conditional_block_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_cudnn_op.cu.cc b/paddle/fluid/operators/conv_cudnn_op.cu.cc index a729d376ac8c3dc49ec06271c3ffef6406a20b28..ff0fbf21f86269885df5491afab7443df813f13f 100644 --- a/paddle/fluid/operators/conv_cudnn_op.cu.cc +++ b/paddle/fluid/operators/conv_cudnn_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_op.cc b/paddle/fluid/operators/conv_op.cc index a047e579163cfe9cd0d053f337b7a92339466a96..2ecece707314f1e8b1b0bc9ad28f53ec5e1d405e 100644 --- a/paddle/fluid/operators/conv_op.cc +++ b/paddle/fluid/operators/conv_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -60,8 +60,9 @@ void ConvOp::InferShape(framework::InferShapeContext* ctx) const { "Due to the settings of paddings, filter_dims and " "dilations, the output size is less than 0, please check " "again."); - output_shape.push_back(OutputSize(in_dims[i + 2], filter_dims[i + 2], - dilations[i], paddings[i], strides[i])); + output_shape.push_back(ConvOutputSize(in_dims[i + 2], filter_dims[i + 2], + dilations[i], paddings[i], + strides[i])); } ctx->SetOutputDim("Output", framework::make_ddim(output_shape)); ctx->ShareLoD("Input", "Output"); diff --git a/paddle/fluid/operators/conv_op.cu.cc b/paddle/fluid/operators/conv_op.cu.cc index b2129d3b461249b5d1b317edde924ffc04f4f90f..d07593f5c02e9129c1f333667baccb0531bc31f9 100644 --- a/paddle/fluid/operators/conv_op.cu.cc +++ b/paddle/fluid/operators/conv_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_op.h b/paddle/fluid/operators/conv_op.h index 1156e6c8fe3263607d4dcd1af0c9996acd9368fb..c93c2e73f720ae025a4ad4f8146a7c6c3c382eea 100644 --- a/paddle/fluid/operators/conv_op.h +++ b/paddle/fluid/operators/conv_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,8 +28,8 @@ using Tensor = framework::Tensor; // Base convolution operator definations for other conv // like operators to reuse the implementation. -inline int OutputSize(int input_size, int filter_size, int dilation, - int padding, int stride) { +inline int ConvOutputSize(int input_size, int filter_size, int dilation, + int padding, int stride) { const int dkernel = dilation * (filter_size - 1) + 1; const int output_size = (input_size + 2 * padding - dkernel) / stride + 1; return output_size; diff --git a/paddle/fluid/operators/conv_shift_op.cc b/paddle/fluid/operators/conv_shift_op.cc index a96aac63e09b47c9afe99b2e622a718839ba047c..a1a0b00208fe77ad462062b5d0cb0c5f3065f584 100644 --- a/paddle/fluid/operators/conv_shift_op.cc +++ b/paddle/fluid/operators/conv_shift_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_shift_op.cu b/paddle/fluid/operators/conv_shift_op.cu index 9818707ce3b98afe25050336d85e3b05919620f3..344bbade7055aa8e0aede61dd31dab246bddd169 100644 --- a/paddle/fluid/operators/conv_shift_op.cu +++ b/paddle/fluid/operators/conv_shift_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_shift_op.h b/paddle/fluid/operators/conv_shift_op.h index 987a690895e2a7428f058eb2d8366f9c7572912b..6d8ddd793738ac2c352235ebf9eb8f2fd0ee3ca3 100644 --- a/paddle/fluid/operators/conv_shift_op.h +++ b/paddle/fluid/operators/conv_shift_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc b/paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc index 0aed4ebeffa7312c218bb892fbcdf9cd9cdc53ca..901682edbb01c563be6ea407228336b14f942778 100644 --- a/paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc +++ b/paddle/fluid/operators/conv_transpose_cudnn_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_transpose_op.cc b/paddle/fluid/operators/conv_transpose_op.cc index 974cffad92871c1a855c86a7a2e56f8e65819428..b2a3cfc89f18eff24c941c664b1184b4485ab895 100644 --- a/paddle/fluid/operators/conv_transpose_op.cc +++ b/paddle/fluid/operators/conv_transpose_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_transpose_op.cu.cc b/paddle/fluid/operators/conv_transpose_op.cu.cc index ed90c6ec6265cc914a172b6c7217a204981e7fd1..640fa7d14a079debeceb54d8775c4ede7da1b536 100644 --- a/paddle/fluid/operators/conv_transpose_op.cu.cc +++ b/paddle/fluid/operators/conv_transpose_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/conv_transpose_op.h b/paddle/fluid/operators/conv_transpose_op.h index f512575468626edfb3e36c007e26b05faff0a06d..d4e4b641ece9ed120904ded6f8baed65a2666213 100644 --- a/paddle/fluid/operators/conv_transpose_op.h +++ b/paddle/fluid/operators/conv_transpose_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cos_sim_op.cc b/paddle/fluid/operators/cos_sim_op.cc index 57c5a6025a03fbafadb56a3dbec9c4cfab5e979a..4c8af408f62453eaf22cc23d19844e8ca7625bfa 100644 --- a/paddle/fluid/operators/cos_sim_op.cc +++ b/paddle/fluid/operators/cos_sim_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cos_sim_op.cu b/paddle/fluid/operators/cos_sim_op.cu index c8cf363cdc4009bd8fa233a52435dcc6ea56cf3c..82205e9c75402e368a2d1e161d471e35ff7356ea 100644 --- a/paddle/fluid/operators/cos_sim_op.cu +++ b/paddle/fluid/operators/cos_sim_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cos_sim_op.h b/paddle/fluid/operators/cos_sim_op.h index 9cd8b196daf6e4afe9bde4d91db0110430cd7324..76cfc680518a3caaa68abc48cedf82ce7d21c8b8 100644 --- a/paddle/fluid/operators/cos_sim_op.h +++ b/paddle/fluid/operators/cos_sim_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/create_reader_op.cc b/paddle/fluid/operators/create_reader_op.cc index 1393f1a66baaf3b53f797aa61fd42ac3cf54f8db..17ed7e24eca9ae923ef71cca7d4c0005eda271f1 100644 --- a/paddle/fluid/operators/create_reader_op.cc +++ b/paddle/fluid/operators/create_reader_op.cc @@ -84,7 +84,7 @@ class CreateFileReaderInferVarType : public framework::VarTypeInference { framework::BlockDesc* block) const override { std::string reader_name = op_desc.Output("Out")[0]; framework::VarDesc* reader = block->FindVarRecursive(reader_name); - reader->SetType(framework::proto::VarDesc::READER); + reader->SetType(framework::proto::VarType::READER); } }; @@ -97,7 +97,7 @@ class CreateDecoratedReaderInferVarType : public framework::VarTypeInference { framework::VarDesc* in_reader = block->FindVarRecursive(in_reader_name); std::string out_reader_name = op_desc.Output("Out")[0]; framework::VarDesc* out_reader = block->FindVarRecursive(out_reader_name); - out_reader->SetType(framework::proto::VarDesc::READER); + out_reader->SetType(framework::proto::VarType::READER); out_reader->SetDataTypes(in_reader->GetDataTypes()); } }; @@ -147,7 +147,7 @@ class CreateRandomDataGeneratorOpMaker AddComment(R"DOC( CreateRandomDataGenerator Operator - This Op creates a random reader. + This Op creates a random reader. The reader generates random data instead of really reading from files. Generated data follow an uniform distribution between 'min' and 'max'. )DOC"); @@ -183,7 +183,7 @@ class CreateShuffleReaderOpMaker : public framework::OpProtoAndCheckerMaker { CreateShuffleReader Operator A shuffle reader takes another reader as its 'underlying reader' - and yields the underlying reader's outputs in a shuffled order. + and yields the underlying reader's outputs in a shuffled order. )DOC"); } }; @@ -218,8 +218,8 @@ class CreateBatchReaderOpMaker : public framework::OpProtoAndCheckerMaker { AddComment(R"DOC( CreateBatchReader Operator - A batch reader takes another reader as its 'underlying reader', - gathers the underlying reader's outputs and then yields them in batches. + A batch reader takes another reader as its 'underlying reader', + gathers the underlying reader's outputs and then yields them in batches. )DOC"); } }; diff --git a/paddle/fluid/operators/crf_decoding_op.cc b/paddle/fluid/operators/crf_decoding_op.cc index e3c1fc95a3be574635ab8a99aa29b71bd8dbc71e..a83013c428a77a0ead545d87852e1017bc927edf 100644 --- a/paddle/fluid/operators/crf_decoding_op.cc +++ b/paddle/fluid/operators/crf_decoding_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/crf_decoding_op.h b/paddle/fluid/operators/crf_decoding_op.h index c3c161eec5f541b9f60a36064d7e8c350078c664..2b2a733fb9f162755e5c548fec617937d86689dd 100644 --- a/paddle/fluid/operators/crf_decoding_op.h +++ b/paddle/fluid/operators/crf_decoding_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/crop_op.cc b/paddle/fluid/operators/crop_op.cc index 8e80f77e497ee21ccd5322b544376f20cb7de012..fd7ea70c64fafd0a7ea55ec1e3a29eb66d84a2c6 100644 --- a/paddle/fluid/operators/crop_op.cc +++ b/paddle/fluid/operators/crop_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/crop_op.cu b/paddle/fluid/operators/crop_op.cu index f3610675aae1572380ca9b778ac3251c1951678b..1a391860463dba14ad0de755ceb659bc9f64adc9 100644 --- a/paddle/fluid/operators/crop_op.cu +++ b/paddle/fluid/operators/crop_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/crop_op.h b/paddle/fluid/operators/crop_op.h index 9c7c0446d4c0baf1ba59eb860a928341eed7cce0..c5ac6849789587f2f41588f79bd538f7b79a7478 100644 --- a/paddle/fluid/operators/crop_op.h +++ b/paddle/fluid/operators/crop_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cross_entropy_op.cc b/paddle/fluid/operators/cross_entropy_op.cc index 5e34b248b6aa696eaa03c7e1b4236a76a9081ef0..55810371c8d354483138b0673721a1ea39fa6f35 100644 --- a/paddle/fluid/operators/cross_entropy_op.cc +++ b/paddle/fluid/operators/cross_entropy_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cross_entropy_op.cu b/paddle/fluid/operators/cross_entropy_op.cu index de0976c69fc65ebc2ef7df9025d6071545e91c33..6449149d4b55962e84baafffc0c2c03f8108866f 100644 --- a/paddle/fluid/operators/cross_entropy_op.cu +++ b/paddle/fluid/operators/cross_entropy_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cross_entropy_op.h b/paddle/fluid/operators/cross_entropy_op.h index 4a5b20ecb70887dd03865e53f168dad818195b16..ec315695a68befc2e3de798fdb3fa146a903aaff 100644 --- a/paddle/fluid/operators/cross_entropy_op.h +++ b/paddle/fluid/operators/cross_entropy_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/ctc_align_op.cc b/paddle/fluid/operators/ctc_align_op.cc index 3c7db78813e3bdd90d1c65e3af26208ae2a9ba21..19e7649660edd0bc90bc6a9537b1cdbb2e7e8ebc 100644 --- a/paddle/fluid/operators/ctc_align_op.cc +++ b/paddle/fluid/operators/ctc_align_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/ctc_align_op.cu b/paddle/fluid/operators/ctc_align_op.cu index f629e0a9f15192c4d0d6fa5b8a122811d11ca415..54e0b1d9ad83c5f01f3f0dfbc2a95c642c0aaadc 100644 --- a/paddle/fluid/operators/ctc_align_op.cu +++ b/paddle/fluid/operators/ctc_align_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/ctc_align_op.h b/paddle/fluid/operators/ctc_align_op.h index 1ef034c2f5b566e3cf720e295953fd7a69dd5812..70698d99589ae9e2e18ec8b1c1bb3bc8c7476131 100644 --- a/paddle/fluid/operators/ctc_align_op.h +++ b/paddle/fluid/operators/ctc_align_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cum_op.h b/paddle/fluid/operators/cum_op.h index 3b2249147848b790833d09a0abe0370057ddd617..999fdcff90784ed089cd620a4f0a908f196bcdda 100644 --- a/paddle/fluid/operators/cum_op.h +++ b/paddle/fluid/operators/cum_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cumsum_op.cc b/paddle/fluid/operators/cumsum_op.cc index d15d4e3db35c4cd27f7b990a39a40af57acd5a65..0da6f188523a78693929307a08601e04002bc8ec 100644 --- a/paddle/fluid/operators/cumsum_op.cc +++ b/paddle/fluid/operators/cumsum_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/cumsum_op.cu b/paddle/fluid/operators/cumsum_op.cu index e063cc0f65a5d63f8f558c5f16e548a1e1fcd4f6..70e2a1de5e24302646611cfea3b8dbe1562274e2 100644 --- a/paddle/fluid/operators/cumsum_op.cu +++ b/paddle/fluid/operators/cumsum_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/decayed_adagrad_op.cc b/paddle/fluid/operators/decayed_adagrad_op.cc index d827155919ed060df6bb45bbb54c286e81cb6c81..5eeb3dee095e330174f35fa8eebd418bf764b132 100644 --- a/paddle/fluid/operators/decayed_adagrad_op.cc +++ b/paddle/fluid/operators/decayed_adagrad_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/decayed_adagrad_op.cu b/paddle/fluid/operators/decayed_adagrad_op.cu index 215d6dbc7d80405bf2fdd340c280c299de9e8cc7..7da16acf05eefc21cbe3dd0540dcbf69022431de 100644 --- a/paddle/fluid/operators/decayed_adagrad_op.cu +++ b/paddle/fluid/operators/decayed_adagrad_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/decayed_adagrad_op.h b/paddle/fluid/operators/decayed_adagrad_op.h index 52b67586ea3d138f738956c450416698042590fa..a46af078e0c6b4bf1faca0570b6a97b026864f13 100644 --- a/paddle/fluid/operators/decayed_adagrad_op.h +++ b/paddle/fluid/operators/decayed_adagrad_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detail/grpc_client.cc b/paddle/fluid/operators/detail/grpc_client.cc index 0d395d347ba4f48bae6b879c1daa3adb6f838e77..ee9044b1f5d46dc725c9583d0d90ab5681d2850c 100644 --- a/paddle/fluid/operators/detail/grpc_client.cc +++ b/paddle/fluid/operators/detail/grpc_client.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detail/grpc_client.h b/paddle/fluid/operators/detail/grpc_client.h index 314fe8168f0ecdae7b5d2737279050f54185e02a..669838810de240358857300c1014aa622c17f808 100644 --- a/paddle/fluid/operators/detail/grpc_client.h +++ b/paddle/fluid/operators/detail/grpc_client.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detail/grpc_server.cc b/paddle/fluid/operators/detail/grpc_server.cc index 96f4ea797b1d8e82fa1c2a52a8b353259906bac2..2a567516614aac39da9d069824f598ed26c5fb0c 100644 --- a/paddle/fluid/operators/detail/grpc_server.cc +++ b/paddle/fluid/operators/detail/grpc_server.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detail/grpc_server.h b/paddle/fluid/operators/detail/grpc_server.h index 1382d1731838c72008ef782d1c398f534f23f7e6..e9402ff6aafe73684b57442c03ee4c573a902a46 100644 --- a/paddle/fluid/operators/detail/grpc_server.h +++ b/paddle/fluid/operators/detail/grpc_server.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detail/safe_ref.h b/paddle/fluid/operators/detail/safe_ref.h index ff2a156f3d0e3c5c55354375ca81adf433a49686..9cb5851deba6b16261d4499afcfb867d9d706498 100644 --- a/paddle/fluid/operators/detail/safe_ref.h +++ b/paddle/fluid/operators/detail/safe_ref.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detail/sendrecvop_utils.cc b/paddle/fluid/operators/detail/sendrecvop_utils.cc index ba3ae6add6099cb232a5e0df82550b9c2628c05c..169fd40fd950a74e61a4ed06a370f25b533957db 100644 --- a/paddle/fluid/operators/detail/sendrecvop_utils.cc +++ b/paddle/fluid/operators/detail/sendrecvop_utils.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,11 +24,11 @@ void SerializeToMessage(const std::string& name, const framework::Variable* var, msg->set_varname(name); std::ostringstream oss; switch (framework::ToVarType(var->Type())) { - case framework::proto::VarDesc_VarType_LOD_TENSOR: + case framework::proto::VarType_Type_LOD_TENSOR: msg->set_type(sendrecv::VarType::LOD_TENSOR); framework::SerializeToStream(oss, var->Get(), ctx); break; - case framework::proto::VarDesc_VarType_SELECTED_ROWS: + case framework::proto::VarType_Type_SELECTED_ROWS: msg->set_type(sendrecv::VarType::SELECTED_ROWS); framework::SerializeToStream(oss, var->Get(), ctx); diff --git a/paddle/fluid/operators/detail/sendrecvop_utils.h b/paddle/fluid/operators/detail/sendrecvop_utils.h index fed887c02796463b4b1b7a747883c702c2a95a72..670d0e162473750d0a5f8e9025ef1cf9a9ef407c 100644 --- a/paddle/fluid/operators/detail/sendrecvop_utils.h +++ b/paddle/fluid/operators/detail/sendrecvop_utils.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detail/simple_block_queue.h b/paddle/fluid/operators/detail/simple_block_queue.h index c7f5ff4b5f494ce80b4ee792afb44841e9c8a2f2..36b58b0c6700b5af7eaea92d2b0c32adaba35bb8 100644 --- a/paddle/fluid/operators/detail/simple_block_queue.h +++ b/paddle/fluid/operators/detail/simple_block_queue.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detail/strided_memcpy.h b/paddle/fluid/operators/detail/strided_memcpy.h index d7a7eed50b961b0efc04a2a636178fa6578cbf3a..bac5cdc99c0133b1e6da3f6a23bc0512ca4177f5 100644 --- a/paddle/fluid/operators/detail/strided_memcpy.h +++ b/paddle/fluid/operators/detail/strided_memcpy.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detection_map_op.cc b/paddle/fluid/operators/detection_map_op.cc index 48308a11b4b313ec19b578110b9e369f4bfc52bf..0af3ba621aa5c3ee0599249ce868cfda72eddd18 100644 --- a/paddle/fluid/operators/detection_map_op.cc +++ b/paddle/fluid/operators/detection_map_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detection_map_op.h b/paddle/fluid/operators/detection_map_op.h index 0f5f588e9c448a6d84d388848aa5701f2b4882dd..92e05108393f9c8fa9259d16d2dd4c6685f2c1e2 100644 --- a/paddle/fluid/operators/detection_map_op.h +++ b/paddle/fluid/operators/detection_map_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -151,7 +151,7 @@ class DetectionMAPOpKernel : public framework::OpKernel { for (int n = 0; n < batch_size; ++n) { std::map> boxes; - for (int i = label_index[n]; i < label_index[n + 1]; ++i) { + for (size_t i = label_index[n]; i < label_index[n + 1]; ++i) { Box box(labels(i, 2), labels(i, 3), labels(i, 4), labels(i, 5)); int label = labels(i, 0); auto is_difficult = labels(i, 1); @@ -167,7 +167,7 @@ class DetectionMAPOpKernel : public framework::OpKernel { auto detect_index = detect_lod[0]; for (int n = 0; n < batch_size; ++n) { std::map>> boxes; - for (int i = detect_index[n]; i < detect_index[n + 1]; ++i) { + for (size_t i = detect_index[n]; i < detect_index[n + 1]; ++i) { Box box(detect(i, 2), detect(i, 3), detect(i, 4), detect(i, 5)); int label = detect(i, 0); auto score = detect(i, 1); @@ -269,8 +269,8 @@ class DetectionMAPOpKernel : public framework::OpKernel { std::map>>& pos) { const T* pos_data = pos_tensor.data(); auto pos_data_lod = pos_tensor.lod(); - for (int i = 0; i < pos_data_lod.size(); ++i) { - for (int j = pos_data_lod[0][i]; j < pos_data_lod[0][i + 1]; ++j) { + for (size_t i = 0; i < pos_data_lod.size(); ++i) { + for (size_t j = pos_data_lod[0][i]; j < pos_data_lod[0][i + 1]; ++j) { T score = pos_data[j * 2]; int flag = 1; if (pos_data[j * 2 + 1] < kEPS) flag = 0; diff --git a/paddle/fluid/operators/detection_output_op.cc b/paddle/fluid/operators/detection_output_op.cc index 6dee5222959f00141cf5c09257d4a2c96b9e3746..f7520475917ff23535f11ccfde0ee915112bba30 100644 --- a/paddle/fluid/operators/detection_output_op.cc +++ b/paddle/fluid/operators/detection_output_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detection_output_op.cu.cc b/paddle/fluid/operators/detection_output_op.cu.cc index 309e03a25be95362b11689f873bafe68570c42e4..0f48765c9c67c1d3fa32b19d5e87b2acaa3c486a 100644 --- a/paddle/fluid/operators/detection_output_op.cu.cc +++ b/paddle/fluid/operators/detection_output_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/detection_output_op.h b/paddle/fluid/operators/detection_output_op.h index 05e5b72bd354329d575c33a88189cfbc64abfea9..af9081c93436776b6ca6ee7139e340054111e440 100644 --- a/paddle/fluid/operators/detection_output_op.h +++ b/paddle/fluid/operators/detection_output_op.h @@ -1,16 +1,16 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -Indicesou may obtain a copy of the License at + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + Indicesou may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #pragma once #include "paddle/fluid/framework/op_registry.h" @@ -98,16 +98,16 @@ class DetectionOutputKernel : public framework::OpKernel { T* conf_data = conf_tensor.data(); if (platform::is_gpu_place(context.GetPlace())) { loc_cpu.mutable_data(loc_tensor.dims(), platform::CPUPlace()); - framework::Copy(loc_tensor, platform::CPUPlace(), - context.device_context(), &loc_cpu); + framework::TensorCopy(loc_tensor, platform::CPUPlace(), + context.device_context(), &loc_cpu); loc_data = loc_cpu.data(); conf_cpu.mutable_data(conf_tensor.dims(), platform::CPUPlace()); - framework::Copy(conf_tensor, platform::CPUPlace(), - context.device_context(), &conf_cpu); + framework::TensorCopy(conf_tensor, platform::CPUPlace(), + context.device_context(), &conf_cpu); conf_data = conf_cpu.data(); priorbox_cpu.mutable_data(in_priorbox->dims(), platform::CPUPlace()); - framework::Copy(*in_priorbox, platform::CPUPlace(), - context.device_context(), &priorbox_cpu); + framework::TensorCopy(*in_priorbox, platform::CPUPlace(), + context.device_context(), &priorbox_cpu); priorbox_data = priorbox_cpu.data(); } // get decode bboxes @@ -158,8 +158,8 @@ class DetectionOutputKernel : public framework::OpKernel { batch_size, all_indices, all_decoded_bboxes, out_data); if (platform::is_gpu_place(context.GetPlace())) { - framework::Copy(out_cpu, platform::CUDAPlace(), context.device_context(), - out); + framework::TensorCopy(out_cpu, platform::CUDAPlace(), + context.device_context(), out); } } }; diff --git a/paddle/fluid/operators/dropout_op.cc b/paddle/fluid/operators/dropout_op.cc index e1dc900512cb2c20cc1a39b5d11a78f5eb905dc5..1074ed6acc22a81f46c466d917ef973945a12898 100644 --- a/paddle/fluid/operators/dropout_op.cc +++ b/paddle/fluid/operators/dropout_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/dropout_op.cu b/paddle/fluid/operators/dropout_op.cu index 4ae9f4ce54d27dd1ad0312b5ad8d78a4cb904c79..d6f9c04359d733cb4f3f0586e9239ee67deb7078 100644 --- a/paddle/fluid/operators/dropout_op.cu +++ b/paddle/fluid/operators/dropout_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,24 +23,23 @@ namespace paddle { namespace operators { template -struct MaskGenerator { - AttrType dropout_prob; - int seed; +__global__ void RandomGenerator(const size_t n, const int seed, + const AttrType dropout_prob, const T* src, + T* mask_data, T* dst) { + thrust::minstd_rand rng; + rng.seed(seed); + thrust::uniform_real_distribution dist(0, 1); - __host__ __device__ MaskGenerator(AttrType dropout_prob, int seed) - : dropout_prob(dropout_prob), seed(seed) {} - - inline __host__ __device__ T operator()(const unsigned int n) const { - thrust::minstd_rand rng; - rng.seed(seed); - thrust::uniform_real_distribution dist(0, 1); - rng.discard(n); + int idx = blockDim.x * blockIdx.x + threadIdx.x; + for (; idx < n; idx += blockDim.x * gridDim.x) { if (dist(rng) < dropout_prob) { - return static_cast(0); + mask_data[idx] = static_cast(0); + } else { + mask_data[idx] = static_cast(1); } - return static_cast(1); + dst[idx] = mask_data[idx] * src[idx]; } -}; +} // It seems that Eigen::Tensor::setRandom in GPU will SEGFAULT. // Use std::random and thrust::random(thrust is a std library in CUDA) to @@ -61,18 +60,19 @@ class GPUDropoutKernel : public framework::OpKernel { if (!context.Attr("is_test")) { auto* mask = context.Output("Mask"); auto* mask_data = mask->mutable_data(context.GetPlace()); - int size = framework::product(mask->dims()); + size_t size = framework::product(mask->dims()); + auto* x_data = x->data(); + auto* y_data = y->mutable_data(context.GetPlace()); std::random_device rnd; int seed = context.Attr("fix_seed") ? context.Attr("seed") : rnd(); - thrust::counting_iterator index_sequence_begin(0); - thrust::transform(index_sequence_begin, index_sequence_begin + size, - thrust::device_ptr(mask_data), - MaskGenerator(dropout_prob, seed)); - auto M = EigenMatrix::Reshape(*mask, 1); - Y.device(place) = X * M; + int threads = 512; + int grid = (x->numel() + threads - 1) / threads; + RandomGenerator<<>>( + size, seed, dropout_prob, x_data, mask_data, y_data); } else { Y.device(place) = X * (1.0f - dropout_prob); } diff --git a/paddle/fluid/operators/dropout_op.h b/paddle/fluid/operators/dropout_op.h index 9dd1f33669ccf89202abe4a80bd9796411f630ba..209e4dec1756dc65fbf147c4dbbf0913d3c6ef7e 100644 --- a/paddle/fluid/operators/dropout_op.h +++ b/paddle/fluid/operators/dropout_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/edit_distance_op.cc b/paddle/fluid/operators/edit_distance_op.cc index ae82408da71f9424a7a64dc9d3e42759707683b9..c7f037d2df4372d0c4e3a261c0dff1fd6704d182 100644 --- a/paddle/fluid/operators/edit_distance_op.cc +++ b/paddle/fluid/operators/edit_distance_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ class EditDistanceOp : public framework::OperatorWithKernel { protected: framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext &ctx) const override { - return framework::OpKernelType(framework::proto::DataType::FP32, + return framework::OpKernelType(framework::proto::VarType::FP32, ctx.device_context()); } }; diff --git a/paddle/fluid/operators/edit_distance_op.cu b/paddle/fluid/operators/edit_distance_op.cu index bdfead75e71752549f44a8b3c9b9e4501e8845a3..3b89ad5d49c339cf05abc0f8577e895f30dddfd4 100644 --- a/paddle/fluid/operators/edit_distance_op.cu +++ b/paddle/fluid/operators/edit_distance_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/edit_distance_op.h b/paddle/fluid/operators/edit_distance_op.h index 205e16e6bfe6b2d1678fca258ce1e70d29eff331..73d0af490b3730c01fcd2842ced388583b7acbe6 100644 --- a/paddle/fluid/operators/edit_distance_op.h +++ b/paddle/fluid/operators/edit_distance_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_add_op.cc b/paddle/fluid/operators/elementwise_add_op.cc index 5b9947b8c935fd2b4739162cbd2f98dc965cec2a..e9068fcd50ba9309a37939788ca8f67f1f6e25cd 100644 --- a/paddle/fluid/operators/elementwise_add_op.cc +++ b/paddle/fluid/operators/elementwise_add_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_add_op.cu b/paddle/fluid/operators/elementwise_add_op.cu index 2ac3a998ec46528ccb72fad1f5d73ce88992d995..19dc4a52152e2a7aa71476d4f0ef692d0af97b4a 100644 --- a/paddle/fluid/operators/elementwise_add_op.cu +++ b/paddle/fluid/operators/elementwise_add_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_add_op.h b/paddle/fluid/operators/elementwise_add_op.h index 248e3b9d617fadd914f27ad02861e27078600b61..253964562c8d34e0fda3b4760761206895f749aa 100644 --- a/paddle/fluid/operators/elementwise_add_op.h +++ b/paddle/fluid/operators/elementwise_add_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -41,59 +41,8 @@ class ElementwiseAddKernel : public framework::OpKernel { }; template -struct ElementwiseAddGradFunctor { - template - void operator()(Device d, X x, Y y, Z z, dX dx, dY dy, dZ dz) { - auto dz_e = framework::EigenVector::Flatten(*dz); - if (dx) { - auto dx_e = framework::EigenVector::Flatten(*dx); - dx_e.device(d) = dz_e; - } - if (dy) { - auto dy_e = framework::EigenVector::Flatten(*dy); - dy_e.device(d) = dz_e; - } - } -}; - -template -struct ElementwiseAddBroadCastGradFunctor { - template - void operator()(Device d, X x, Y y, Z z, dX dx, dY dy, dZ dz, Pre pre, N n) { - auto dz_e = framework::EigenVector::Flatten(*dz); - if (dx) { - auto dx_e = framework::EigenVector::Flatten(*dx); - dx_e.device(d) = dz_e; - } - - if (dy) { - auto dy_e = framework::EigenVector::Flatten(*dy); - dy_e.device(d) = dz_e.reshape(Eigen::DSizes(pre, n)) - .sum(Eigen::array{{0}}); - } - } -}; - -template -struct ElementwiseAddBroadCast2GradFunctor { - template - void operator()(Device d, X x, Y y, Z z, dX dx, dY dy, dZ dz, Pre pre, N n, - Post post) { - auto dz_e = framework::EigenVector::Flatten(*dz); - if (dx) { - auto dx_e = framework::EigenVector::Flatten(*dx); - dx_e.device(d) = dz_e; - } - - if (dy) { - auto dy_e = framework::EigenVector::Flatten(*dy); - dy_e.device(d) = dz_e.reshape(Eigen::DSizes(pre, n, post)) - .sum(Eigen::array{{0, 2}}); - } - } +struct IdentityGrad { + HOSTDEVICE T operator()(T x, T y, T out, T dout) const { return dout; } }; template @@ -109,10 +58,9 @@ class ElementwiseAddGradKernel : public framework::OpKernel { auto* dx = ctx.Output(framework::GradVarName("X")); auto* dy = ctx.Output(framework::GradVarName("Y")); int axis = ctx.Attr("axis"); - ElementwiseGradCompute, - ElementwiseAddBroadCastGradFunctor, - ElementwiseAddBroadCast2GradFunctor>( - ctx, x, y, out, dout, axis, dx, dy); + ElemwiseGradCompute, IdentityGrad>( + ctx, *x, *y, *out, *dout, axis, dx, dy, IdentityGrad(), + IdentityGrad()); } }; diff --git a/paddle/fluid/operators/elementwise_div_op.cc b/paddle/fluid/operators/elementwise_div_op.cc index 818ae82f44ccd159b36944e67521c3b730214539..6f9a090c8ea660d023acece096b48d29aa2f35f7 100644 --- a/paddle/fluid/operators/elementwise_div_op.cc +++ b/paddle/fluid/operators/elementwise_div_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_div_op.cu b/paddle/fluid/operators/elementwise_div_op.cu index d1bb7a474c06f68d33412512a9eb99757634d18e..588d1f7420241ba1697e5141e4e4a2870f2dc87c 100644 --- a/paddle/fluid/operators/elementwise_div_op.cu +++ b/paddle/fluid/operators/elementwise_div_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_div_op.h b/paddle/fluid/operators/elementwise_div_op.h index 8e0726d9465fa988646f6f8dc74857a3bedf43e8..6bcc577456b13f7930e07c24564953e93c5339ed 100644 --- a/paddle/fluid/operators/elementwise_div_op.h +++ b/paddle/fluid/operators/elementwise_div_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_max_op.cc b/paddle/fluid/operators/elementwise_max_op.cc index 1331bcadc8ce9a114d3dd7604273a3512e821e91..61da7c59441df22d71316b13f131399d3cd55f3a 100644 --- a/paddle/fluid/operators/elementwise_max_op.cc +++ b/paddle/fluid/operators/elementwise_max_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_max_op.cu b/paddle/fluid/operators/elementwise_max_op.cu index 7f0259ad0024c1a9b640f73ade5711b6eaa8f871..32c99835d66d8b11b72af162230aa383c7e4a57c 100644 --- a/paddle/fluid/operators/elementwise_max_op.cu +++ b/paddle/fluid/operators/elementwise_max_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_max_op.h b/paddle/fluid/operators/elementwise_max_op.h index e1db9bcc01104c3462b562b7a37b5817e867d7e4..ab3a3d58275e8a48a92aa0c8a50af072e83ac968 100644 --- a/paddle/fluid/operators/elementwise_max_op.h +++ b/paddle/fluid/operators/elementwise_max_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_min_op.cc b/paddle/fluid/operators/elementwise_min_op.cc index 1d69099c8e6bd8e11a605758f553a9edd9cc322e..c74ff36db17579182e3c7e93a5adc5fe79fbcadd 100644 --- a/paddle/fluid/operators/elementwise_min_op.cc +++ b/paddle/fluid/operators/elementwise_min_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_min_op.cu b/paddle/fluid/operators/elementwise_min_op.cu index ed53204735056477b5c59ce5082d377501409c65..a237c9c503ec998fd74fec50a1d7949279bb38f0 100644 --- a/paddle/fluid/operators/elementwise_min_op.cu +++ b/paddle/fluid/operators/elementwise_min_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_min_op.h b/paddle/fluid/operators/elementwise_min_op.h index bfe213dd4318aef8b1fb299ba40981d2feef8f9d..f0eec9d2468b519473f813d71127d670adb08250 100644 --- a/paddle/fluid/operators/elementwise_min_op.h +++ b/paddle/fluid/operators/elementwise_min_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_mul_op.cc b/paddle/fluid/operators/elementwise_mul_op.cc index 0cb96f21d1b5049f9c7193f0a951e08986884c70..5d7f2cdffd11dfef8df22175dd0570b277c0e13a 100644 --- a/paddle/fluid/operators/elementwise_mul_op.cc +++ b/paddle/fluid/operators/elementwise_mul_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_mul_op.cu b/paddle/fluid/operators/elementwise_mul_op.cu index d72b6250eed24adbfc18e95a659a82b8e9916bc1..2fb1b4bee689c059625e3dbd59f80c541ace83a0 100644 --- a/paddle/fluid/operators/elementwise_mul_op.cu +++ b/paddle/fluid/operators/elementwise_mul_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_mul_op.h b/paddle/fluid/operators/elementwise_mul_op.h index dc292eb1e7295780aacb0c34730044c3c8759cb7..46d69ed87d4c2eeae674730b00858b6358b97773 100644 --- a/paddle/fluid/operators/elementwise_mul_op.h +++ b/paddle/fluid/operators/elementwise_mul_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_op.h b/paddle/fluid/operators/elementwise_op.h index 38f83d7ad36d3cb6b42a283fec3c431b51747d4e..06bcd0be646e7dff72b46b1c9031464de21b3c6a 100644 --- a/paddle/fluid/operators/elementwise_op.h +++ b/paddle/fluid/operators/elementwise_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_op_function.h b/paddle/fluid/operators/elementwise_op_function.h index c1269382a447d4f8d089c5fc392495d418123e48..5c7830353093ebbf6a5216be497ea6f1f1c21909 100644 --- a/paddle/fluid/operators/elementwise_op_function.h +++ b/paddle/fluid/operators/elementwise_op_function.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,9 +20,11 @@ limitations under the License. */ #ifdef __NVCC__ #include +constexpr int ELEMWISE_MAX_BLOCK_DIM = 1024; #endif #include "paddle/fluid/operators/math/math_function.h" +#include "paddle/fluid/platform/for_range.h" namespace paddle { namespace operators { @@ -33,10 +35,10 @@ namespace operators { * For example: * 1. shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1 * pre=2, n=3*4, post=5 - * x.shape(2, 12, 5) * y.shape(1,12,1).broadcast(2,12,5) + * x.shape(2, 12, 5) * y.shape(1, 12, 1).broadcast(2, 12, 5) * 2. shape(X) = (2, 3, 4, 5), shape(Y) = (4,5) * pre=2*3, n=4*5, post=1 - * x.shape(2, 3, 20) * y.shape(1,1,20).broadcast(2,3,20) + * x.shape(6, 20, 1) * y.shape(1, 20, 1).broadcast(6, 20, 1) */ inline void get_mid_dims(const framework::DDim& x_dims, const framework::DDim& y_dims, const int axis, @@ -311,10 +313,261 @@ EIGEN_FUNCTOR(Mul, EIGEN_MUL); #define EIGEN_DIV(x, y) ((x) / (y)) EIGEN_FUNCTOR(Div, EIGEN_DIV); +template +struct ElemwiseGradNoBroadcast { + const T* x_; + const T* y_; + const T* out_; + const T* dout_; + + HOSTDEVICE void operator()(size_t i) { + if (dx_ != nullptr) { + dx_[i] = dx_op_(x_[i], y_[i], out_[i], dout_[i]); + } + if (dy_ != nullptr) { + dy_[i] = dx_op_(x_[i], y_[i], out_[i], dout_[i]); + } + } + + DX_OP dx_op_; + DY_OP dy_op_; + T* dx_; + T* dy_; +}; + +template +static void ElemwiseGradBroadcast1CPU(const T* x, const T* y, const T* out, + const T* dout, int h, int w, DX_OP dx_op, + DY_OP dy_op, T* dx, T* dy) { + for (int i = 0; i < h; ++i) { + for (int j = 0; j < w; ++j) { + int x_offset = i * w + j; + if (dx != nullptr) { + dx[x_offset] = dx_op(x[x_offset], y[j], out[x_offset], dout[x_offset]); + } + if (dy != nullptr) { + T tmp = dy_op(x[x_offset], y[j], out[x_offset], dout[x_offset]); + if (i == 0) { + dy[j] = tmp; + } else { + dy[j] += tmp; + } + } + } + } +} +#ifdef __NVCC__ +template +static __global__ void ElemwiseGradBroadcast1CUDAKernel( + const T* x, const T* y, const T* out, const T* dout, int h, int w, + DX_OP dx_op, DY_OP dy_op, T* dx, T* dy) { + extern __shared__ char shm_buffer[]; + T* shm = reinterpret_cast(shm_buffer); + + int j = blockIdx.x; + int i = threadIdx.x; + int tid = threadIdx.x; + shm[tid] = 0; + + do { + int x_offset = i * w + j; + if (dx) { + dx[x_offset] = dx_op(x[x_offset], y[j], out[x_offset], dout[x_offset]); + } + if (dy) { + shm[tid] += dy_op(x[x_offset], y[j], out[x_offset], dout[x_offset]); + } + i += ELEMWISE_MAX_BLOCK_DIM; + } while (i < h); + + if (dy) { + __syncthreads(); + + h = h > ELEMWISE_MAX_BLOCK_DIM ? ELEMWISE_MAX_BLOCK_DIM : h; + + // Sum, could be optimized + if (threadIdx.x == 0) { + for (int k = 1; k < h; ++k) { + shm[0] += shm[k]; + } + dy[j] = shm[0]; + } + } +} + +template +static void ElemwiseGradBroadcast1CUDA(cudaStream_t stream, const T* x, + const T* y, const T* out, const T* dout, + int h, int w, DX_OP dx_op, DY_OP dy_op, + T* dx, T* dy) { + int block_size = std::min(ELEMWISE_MAX_BLOCK_DIM, h); + int gird_size = w; + int shared_mem_size = block_size * sizeof(T); + ElemwiseGradBroadcast1CUDAKernel<<>>(x, y, out, dout, h, w, dx_op, + dy_op, dx, dy); +} + +#endif + +template +static void ElemwiseGradBroadcast2CPU(const T* x, const T* y, const T* out, + const T* dout, int pre, int n, int post, + DX_OP dx_op, DY_OP dy_op, T* dx, T* dy) { + for (int i = 0; i < pre; ++i) { + for (int j = 0; j < n; ++j) { + for (int k = 0; k < post; ++k) { + int x_offset = i * n * post + j * post + k; + if (dx != nullptr) { + dx[x_offset] = + dx_op(x[x_offset], y[j], out[x_offset], dout[x_offset]); + } + if (dy != nullptr) { + T tmp = dy_op(x[x_offset], y[j], out[x_offset], dout[x_offset]); + if (i == 0 && k == 0) { + dy[j] = tmp; + } else { + dy[j] += tmp; + } + } + } + } + } +} + +#ifdef __NVCC__ + +template +static __global__ void ElemwiseGradBroadcast2CUDAKernel( + const T* x, const T* y, const T* out, const T* dout, int pre, int n, + int post, DX_OP dx_op, DY_OP dy_op, T* dx, T* dy) { + int tid = threadIdx.x; + int j = blockIdx.x; + + extern __shared__ char shm_buffer[]; + T* shm = reinterpret_cast(shm_buffer); + shm[tid] = 0; + int ttid = tid; + + while (true) { + int i = ttid / post; + int k = ttid % post; + if (i >= pre) break; + + int x_offset = i * n * post + j * post + k; + + if (dx != nullptr) { + dx[x_offset] = dx_op(x[x_offset], y[j], out[x_offset], dout[x_offset]); + } + + if (dy != nullptr) { + shm[tid] += dy_op(x[x_offset], y[j], out[x_offset], dout[x_offset]); + } + + ttid += ELEMWISE_MAX_BLOCK_DIM; + } + + if (dy) { + __syncthreads(); + int h = pre * post; + h = h > ELEMWISE_MAX_BLOCK_DIM ? ELEMWISE_MAX_BLOCK_DIM : h; + + // Sum, could be optimized + if (tid == 0) { + for (int i = 1; i < h; ++i) { + shm[0] += shm[i]; + } + dy[j] = shm[0]; + } + } +} + +template +static void ElemwiseGradBroadcast2CUDA(cudaStream_t stream, const T* x, + const T* y, const T* out, const T* dout, + int pre, int n, int post, DX_OP dx_op, + DY_OP dy_op, T* dx, T* dy) { + int block_size = std::min(ELEMWISE_MAX_BLOCK_DIM, pre * post); + int gird_size = n; + int shared_mem_size = block_size * sizeof(T); + ElemwiseGradBroadcast2CUDAKernel<<>>(x, y, out, dout, pre, n, post, + dx_op, dy_op, dx, dy); +} + +#endif + +template +void ElemwiseGradCompute(const framework::ExecutionContext& ctx, + const framework::Tensor& x, const framework::Tensor& y, + const framework::Tensor& out, + const framework::Tensor& dout, int axis, + framework::Tensor* dx, framework::Tensor* dy, + DX_OP dx_op, DY_OP dy_op) { + if (x.dims() == y.dims()) { + size_t N = static_cast(framework::product(x.dims())); + platform::ForRange for_range( + ctx.template device_context(), N); + for_range(ElemwiseGradNoBroadcast{ + x.data(), y.data(), out.data(), dout.data(), dx_op, dy_op, + dx == nullptr ? nullptr : dx->mutable_data(ctx.GetPlace()), + dy == nullptr ? nullptr : dy->mutable_data(ctx.GetPlace())}); + } else { // Y is a scalar + auto x_dim = x.dims(); + auto y_dim = y.dims(); + + if (y_dim.size() == 1 && y_dim[0] == 1) { + // y is a scalar + auto extended_dims = framework::vectorize(x_dim); + extended_dims.push_back(1); + x_dim = framework::make_ddim(extended_dims); + } + + axis = (axis == -1 ? x_dim.size() - y_dim.size() : axis); + int pre, n, post; + get_mid_dims(x_dim, y_dim, axis, pre, n, post); + if (post == 1) { + int h = pre; + int w = n; + if (platform::is_gpu_place(ctx.GetPlace())) { +#ifdef __NVCC__ + ElemwiseGradBroadcast1CUDA( + ctx.template device_context().stream(), x.data(), + y.data(), out.data(), dout.data(), h, w, dx_op, dy_op, + dx == nullptr ? nullptr : dx->mutable_data(ctx.GetPlace()), + dy == nullptr ? nullptr : dy->mutable_data(ctx.GetPlace())); +#endif + } else { + ElemwiseGradBroadcast1CPU( + x.data(), y.data(), out.data(), dout.data(), h, w, + dx_op, dy_op, + dx == nullptr ? nullptr : dx->mutable_data(ctx.GetPlace()), + dy == nullptr ? nullptr : dy->mutable_data(ctx.GetPlace())); + } + } else { + if (platform::is_gpu_place(ctx.GetPlace())) { +#ifdef __NVCC__ + ElemwiseGradBroadcast2CUDA( + ctx.template device_context().stream(), x.data(), + y.data(), out.data(), dout.data(), pre, n, post, dx_op, + dy_op, + dx == nullptr ? nullptr : dx->mutable_data(ctx.GetPlace()), + dy == nullptr ? nullptr : dy->mutable_data(ctx.GetPlace())); +#endif + } else { + ElemwiseGradBroadcast2CPU( + x.data(), y.data(), out.data(), dout.data(), pre, n, + post, dx_op, dy_op, + dx == nullptr ? nullptr : dx->mutable_data(ctx.GetPlace()), + dy == nullptr ? nullptr : dy->mutable_data(ctx.GetPlace())); + } + } + } +}; + template void ElementwiseGradCompute(const framework::ExecutionContext& ctx, - const framework::Tensor* x, const framework::Tensor* y, const framework::Tensor* out, diff --git a/paddle/fluid/operators/elementwise_pow_op.cc b/paddle/fluid/operators/elementwise_pow_op.cc index 911b5dbd2501e6c5ef6177a23592fadeb3383002..60302c5e59f8ce595861405713045b05d90002e3 100644 --- a/paddle/fluid/operators/elementwise_pow_op.cc +++ b/paddle/fluid/operators/elementwise_pow_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_pow_op.cu b/paddle/fluid/operators/elementwise_pow_op.cu index 2996600738fe11c3fef67c3f4c5660ff05e37957..1f19ebd470973137b465381e498ab07a36323c14 100644 --- a/paddle/fluid/operators/elementwise_pow_op.cu +++ b/paddle/fluid/operators/elementwise_pow_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/elementwise_pow_op.h b/paddle/fluid/operators/elementwise_pow_op.h index b793c1eae0ec3a796897c7d81ac061f80ccffdb6..8c1c5f9f98018d8d4368a9333e2004141615775d 100644 --- a/paddle/fluid/operators/elementwise_pow_op.h +++ b/paddle/fluid/operators/elementwise_pow_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_sub_op.cc b/paddle/fluid/operators/elementwise_sub_op.cc index 46ce01c7cf5bf4930d05535e22f1d54073838071..6f770820c80310a183018b586cb7545ca1e9de51 100644 --- a/paddle/fluid/operators/elementwise_sub_op.cc +++ b/paddle/fluid/operators/elementwise_sub_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_sub_op.cu b/paddle/fluid/operators/elementwise_sub_op.cu index eb09d6c5edcb6e8460de71d76077fd103d799847..8709f686f9af1bf4dacbc2dfc3e2d5dcc1c59b9a 100644 --- a/paddle/fluid/operators/elementwise_sub_op.cu +++ b/paddle/fluid/operators/elementwise_sub_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/elementwise_sub_op.h b/paddle/fluid/operators/elementwise_sub_op.h index af2d497b9ae8f892aa272211ee2158d063d13909..a8fc242ed79ecee77dc5bb56882a1a15f872fccf 100644 --- a/paddle/fluid/operators/elementwise_sub_op.h +++ b/paddle/fluid/operators/elementwise_sub_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/expand_op.cc b/paddle/fluid/operators/expand_op.cc index ccb9a94856fe868c8069510a7c557dfb8c22c369..51a66bd832fbdface953d9b7b509b32ce26d33ca 100644 --- a/paddle/fluid/operators/expand_op.cc +++ b/paddle/fluid/operators/expand_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/expand_op.cu b/paddle/fluid/operators/expand_op.cu index 8a9f39708beec3e0d32d65245c63f8ccf9df8604..60363bfc86d7d1a79d7b018cee43a41c1247a994 100644 --- a/paddle/fluid/operators/expand_op.cu +++ b/paddle/fluid/operators/expand_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/expand_op.h b/paddle/fluid/operators/expand_op.h index 8df1cd34d7dc5093b9bdcd3d015be4f9958d089d..2c2d5c7c42c0cc918199eff054d1656f01a281e8 100644 --- a/paddle/fluid/operators/expand_op.h +++ b/paddle/fluid/operators/expand_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -126,7 +126,8 @@ class ExpandGradKernel : public framework::OpKernel { auto* in0 = context.Input(framework::GradVarName("Out")); auto* out0 = context.Output(framework::GradVarName("X")); out0->mutable_data(context.GetPlace()); - framework::Copy(*in0, context.GetPlace(), context.device_context(), out0); + framework::TensorCopy(*in0, context.GetPlace(), context.device_context(), + out0); } else { switch (dims) { REP_EXPAND_GRAD_TEMPLATE(72) diff --git a/paddle/fluid/operators/feed_op.cc b/paddle/fluid/operators/feed_op.cc index 41fa69a0972ef8ad528f2a04b0260c40155ffd3e..90c31877f6a87d1e237283d489353b4aba26c97b 100644 --- a/paddle/fluid/operators/feed_op.cc +++ b/paddle/fluid/operators/feed_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ class FeedOp : public framework::OperatorBase { if (platform::is_same_place(feed_item.place(), place)) { out_item->ShareDataWith(feed_item); } else { - framework::Copy(feed_item, place, dev_ctx, out_item); + framework::TensorCopy(feed_item, place, dev_ctx, out_item); } out_item->set_lod(feed_item.lod()); } diff --git a/paddle/fluid/operators/fetch_op.cc b/paddle/fluid/operators/fetch_op.cc index 6cb5565013dcacac33e828386f1ea8909e831c1a..d66f01d1b7ce8528a7c0177b2889aff7e0c5a12b 100644 --- a/paddle/fluid/operators/fetch_op.cc +++ b/paddle/fluid/operators/fetch_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ class FetchOp : public framework::OperatorBase { platform::DeviceContextPool &pool = platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(src_item.place()); - Copy(src_item, platform::CPUPlace(), dev_ctx, &dst_item); + TensorCopy(src_item, platform::CPUPlace(), dev_ctx, &dst_item); dev_ctx.Wait(); dst_item.set_lod(src_item.lod()); diff --git a/paddle/fluid/operators/fill_constant_batch_size_like_op.cc b/paddle/fluid/operators/fill_constant_batch_size_like_op.cc index e6992ba371c1dd61f7f6fa293be586818350fb3f..72da80baaf9bb3286f09b7ae5fcf24326b391906 100644 --- a/paddle/fluid/operators/fill_constant_batch_size_like_op.cc +++ b/paddle/fluid/operators/fill_constant_batch_size_like_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,72 +13,30 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/fill_constant_batch_size_like_op.h" +#include "paddle/fluid/operators/batch_size_like.h" namespace paddle { namespace operators { -class FillConstantBatchSizeLikeOp : public framework::OperatorWithKernel { - public: - using framework::OperatorWithKernel::OperatorWithKernel; - - void InferShape(framework::InferShapeContext *ctx) const override { - PADDLE_ENFORCE( - ctx->HasInput("Input"), - "Input(Input) of FillConstantBatchSizeLikeOp should not be null."); - PADDLE_ENFORCE( - ctx->HasOutput("Out"), - "Output(Out) of FillConstantBatchSizeLikeOp should not be null."); - - auto &shape = ctx->Attrs().Get>("shape"); - PADDLE_ENFORCE_GT(shape.size(), 0); - std::vector shape_int64(shape.size(), 0); - std::transform(shape.begin(), shape.end(), shape_int64.begin(), - [](int a) { return static_cast(a); }); - auto output_dim = framework::make_ddim(shape_int64); - - int input_dim_idx = ctx->Attrs().Get("input_dim_idx"); - PADDLE_ENFORCE_GE(input_dim_idx, 0); - PADDLE_ENFORCE_GT(ctx->GetInputDim("Input").size(), input_dim_idx); - - int output_dim_idx = ctx->Attrs().Get("output_dim_idx"); - PADDLE_ENFORCE_GE(output_dim_idx, 0); - PADDLE_ENFORCE_GT(static_cast(shape.size()), output_dim_idx); - - output_dim[output_dim_idx] = ctx->GetInputDim("Input")[input_dim_idx]; - ctx->SetOutputDim("Out", output_dim); - } - +class FillConstantBatchSizeLikeOp : public BatchSizeLikeOp { protected: + using BatchSizeLikeOp::BatchSizeLikeOp; framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext &ctx) const override { return framework::OpKernelType( - static_cast(ctx.Attr("dtype")), + static_cast(ctx.Attr("dtype")), ctx.device_context()); } }; -class FillConstantBatchSizeLikeOpMaker - : public framework::OpProtoAndCheckerMaker { +class FillConstantBatchSizeLikeOpMaker : public BatchSizeLikeOpMaker { public: FillConstantBatchSizeLikeOpMaker(OpProto *proto, OpAttrChecker *op_checker) - : framework::OpProtoAndCheckerMaker(proto, op_checker) { + : BatchSizeLikeOpMaker(proto, op_checker) { AddAttr("dtype", "(int, default 5 (FP32)) " "Output data type") - .SetDefault(framework::proto::DataType::FP32); - AddInput("Input", - "(Tensor) Tensor " - "whose dim_idx th dimension is used to specify the batch_size"); - AddOutput("Out", - "(Tensor) Tensor of specified shape will be filled " - "with the specified value"); - AddAttr>("shape", "(vector) The shape of the output"); - AddAttr("input_dim_idx", - "(int, default 0) The index of input's batch size dimension") - .SetDefault(0); - AddAttr("output_dim_idx", - "(int, default 0) The index of output's batch size dimension") - .SetDefault(0); + .SetDefault(framework::proto::VarType::FP32); AddAttr("value", "(float, default 0) The value to be filled") .SetDefault(0.0f); AddComment(R"DOC( diff --git a/paddle/fluid/operators/fill_constant_batch_size_like_op.cu.cc b/paddle/fluid/operators/fill_constant_batch_size_like_op.cu.cc index b4f4d2a50305e2582f23ceed931d655f9690e110..2cbbd05bfbb5dfea161cc69bc32ecfc77e7d8f18 100644 --- a/paddle/fluid/operators/fill_constant_batch_size_like_op.cu.cc +++ b/paddle/fluid/operators/fill_constant_batch_size_like_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/fill_constant_batch_size_like_op.h b/paddle/fluid/operators/fill_constant_batch_size_like_op.h index da4a20d99a13533019d57fca42b1b49780200b79..2a7df149a9f4b03676f172da980c927d7fa5e8a4 100644 --- a/paddle/fluid/operators/fill_constant_batch_size_like_op.h +++ b/paddle/fluid/operators/fill_constant_batch_size_like_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/fill_constant_op.cc b/paddle/fluid/operators/fill_constant_op.cc index 6dd58d28db23ff3de8a27e898a9b539787d08718..07e0a80f8d644d4d011f2821785d49ece6cecfb5 100644 --- a/paddle/fluid/operators/fill_constant_op.cc +++ b/paddle/fluid/operators/fill_constant_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ class FillConstantOp : public framework::OperatorBase { void RunImpl(const framework::Scope &scope, const platform::Place &dev_place) const override { auto data_type = - static_cast(Attr("dtype")); + static_cast(Attr("dtype")); auto value = Attr("value"); auto force_cpu = Attr("force_cpu"); auto &out = @@ -64,7 +64,7 @@ class FillConstantOpMaker : public framework::OpProtoAndCheckerMaker { AddAttr("dtype", "(int, default 5 (FP32)) " "Output data type") - .SetDefault(framework::proto::DataType::FP32); + .SetDefault(framework::proto::VarType::FP32); AddAttr>("shape", "(vector) The shape of the output"); AddAttr("value", "(float, default 0) The value to be filled") .SetDefault(0.0f); diff --git a/paddle/fluid/operators/fill_op.cc b/paddle/fluid/operators/fill_op.cc index 0b97c9c2827ac1be4e99c647dbedc2d9b8730e41..ee8a2fc353f86cdabd35459a9195c3aa35f63e31 100644 --- a/paddle/fluid/operators/fill_op.cc +++ b/paddle/fluid/operators/fill_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -51,7 +51,8 @@ class FillOp : public framework::OperatorBase { "Cannot find variable %s", Output("Out")) .GetMutable()); out.Resize(framework::make_ddim(Attr>("shape"))); - auto dtype = static_cast(Attr("dtype")); + auto dtype = + static_cast(Attr("dtype")); platform::CPUPlace cpu; auto force_cpu = Attr("force_cpu"); out.mutable_data(force_cpu ? cpu : place, framework::ToTypeIndex(dtype)); @@ -74,7 +75,7 @@ class FillOp : public framework::OperatorBase { platform::DeviceContextPool &pool = platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(place); - framework::Copy(tensor, place, dev_ctx, &out); + framework::TensorCopy(tensor, place, dev_ctx, &out); } } }; @@ -93,7 +94,7 @@ Fill an tensor with `value` and `shape`. The type of the tensor is specify by "value", "The float values of tensor, which are flatten in row major"); AddAttr>("shape", "The shape of output tensor"); AddAttr("dtype", "The data type of output tensor, Default is float") - .SetDefault(framework::proto::DataType::FP32); + .SetDefault(framework::proto::VarType::FP32); AddAttr("force_cpu", "Whether the output tensor must be at CPU memory or not. " "Default is false.") diff --git a/paddle/fluid/operators/fill_zeros_like_op.cc b/paddle/fluid/operators/fill_zeros_like_op.cc index 958bfb1557d9fa39534caef594818aa97bbe03a6..58c814ba6413626a48310da595a13238994f5ef1 100644 --- a/paddle/fluid/operators/fill_zeros_like_op.cc +++ b/paddle/fluid/operators/fill_zeros_like_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/fill_zeros_like_op.cu.cc b/paddle/fluid/operators/fill_zeros_like_op.cu.cc index 07078573d8aaa1d72f876f4be68ff70d8a56d8a1..95381774606b2d8e74519befc9a6f7a3ac20aa45 100644 --- a/paddle/fluid/operators/fill_zeros_like_op.cu.cc +++ b/paddle/fluid/operators/fill_zeros_like_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/fill_zeros_like_op.h b/paddle/fluid/operators/fill_zeros_like_op.h index 141c3809e9aa3e2984bf802418f8ddf7d92fa446..4bbe0df6b6890122381c87494e510cf125792377 100644 --- a/paddle/fluid/operators/fill_zeros_like_op.h +++ b/paddle/fluid/operators/fill_zeros_like_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/ftrl_op.cc b/paddle/fluid/operators/ftrl_op.cc index e72a173751e9b163b6083df474c2b46c76ed459d..0a456f0981e5753a7de5a6f2ba029681beb347a5 100644 --- a/paddle/fluid/operators/ftrl_op.cc +++ b/paddle/fluid/operators/ftrl_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/ftrl_op.cu b/paddle/fluid/operators/ftrl_op.cu index dbdfcb927e0aff373a716c5e0eace96bec38e9ad..e7371c80da1d1cbb39247b50d8c6537ee8e948f8 100644 --- a/paddle/fluid/operators/ftrl_op.cu +++ b/paddle/fluid/operators/ftrl_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/ftrl_op.h b/paddle/fluid/operators/ftrl_op.h index 0a9405fcef1fa405ab14ba7c797b99c2259892f7..6f821e7e9944214fc5ebdf6bc7db8789b8ada6b9 100644 --- a/paddle/fluid/operators/ftrl_op.h +++ b/paddle/fluid/operators/ftrl_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gather.cu.h b/paddle/fluid/operators/gather.cu.h index af5898e29ecaed5a4d2cf8372a3bb20f192fc776..d74d4db92528d69492ab7b90a98d3775dadc35d1 100644 --- a/paddle/fluid/operators/gather.cu.h +++ b/paddle/fluid/operators/gather.cu.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gather.h b/paddle/fluid/operators/gather.h index 287732eeb6e5249f631bc3e39cd18bc050f9fc3b..d15cb55647ade2415041b11099974484835f55eb 100644 --- a/paddle/fluid/operators/gather.h +++ b/paddle/fluid/operators/gather.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gather_op.cc b/paddle/fluid/operators/gather_op.cc index dceeb71ee3552bcb462014b5f08a59d4406497ad..6be06b8816ce65641b49d7b7b3861cdd8460feaa 100644 --- a/paddle/fluid/operators/gather_op.cc +++ b/paddle/fluid/operators/gather_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gather_op.cu b/paddle/fluid/operators/gather_op.cu index 484f4232624e862aff7c0aff337b4e5df65d5be3..3819549c7112c5e4a6de1a9aee54e469dd5a4618 100644 --- a/paddle/fluid/operators/gather_op.cu +++ b/paddle/fluid/operators/gather_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gather_op.h b/paddle/fluid/operators/gather_op.h index 7ba4a31c81be025978c6c2a325792eea2eb353a7..5a8b1ebbe3fe5f242a4d6395c921c75247587c6a 100644 --- a/paddle/fluid/operators/gather_op.h +++ b/paddle/fluid/operators/gather_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gather_test.cc b/paddle/fluid/operators/gather_test.cc index 4d86cf5ce334705d16435f542cc33be454edabb7..7625bd45d968720099a973a6988484ec8332d1c1 100644 --- a/paddle/fluid/operators/gather_test.cc +++ b/paddle/fluid/operators/gather_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gaussian_random_batch_size_like_op.cc b/paddle/fluid/operators/gaussian_random_batch_size_like_op.cc new file mode 100644 index 0000000000000000000000000000000000000000..53c706a83e5bfb9e93d485141314e8b652d73593 --- /dev/null +++ b/paddle/fluid/operators/gaussian_random_batch_size_like_op.cc @@ -0,0 +1,73 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#include "paddle/fluid/framework/op_registry.h" +#include "paddle/fluid/framework/operator.h" +#include "paddle/fluid/operators/batch_size_like.h" + +namespace paddle { +namespace operators { + +class GaussianRandomBatchSizeLikeOp : public BatchSizeLikeOp { + protected: + using BatchSizeLikeOp::BatchSizeLikeOp; + + framework::OpKernelType GetExpectedKernelType( + const framework::ExecutionContext &ctx) const override { + return framework::OpKernelType( + static_cast(ctx.Attr("dtype")), + ctx.GetPlace()); + } +}; + +class GaussianRandomBatchSizeLikeOpMaker : public BatchSizeLikeOpMaker { + public: + GaussianRandomBatchSizeLikeOpMaker(OpProto *proto, OpAttrChecker *op_checker) + : BatchSizeLikeOpMaker(proto, op_checker) { + AddAttr("mean", + "(float, default 0.0) " + "mean of random tensor.") + .SetDefault(.0f); + AddAttr("std", + "(float, default 1.0) " + "std of random tensor.") + .SetDefault(1.0f); + AddAttr("seed", + "(int, default 0) " + "Random seed of generator." + "0 means use system wide seed." + "Note that if seed is not 0, this operator will always " + "generate the same random numbers every time.") + .SetDefault(0); + AddAttr("dtype", + "(int, default 5(FP32)) " + "Output data type.") + .SetDefault(framework::proto::VarType::FP32); + + AddComment(R"DOC( +GaussianRandom Operator. + +Used to initialize tensors with gaussian random generator. +)DOC"); + } +}; + +} // namespace operators +} // namespace paddle + +REGISTER_OP_WITHOUT_GRADIENT( + gaussian_random_batch_size_like, + paddle::operators::GaussianRandomBatchSizeLikeOp, + paddle::operators::GaussianRandomBatchSizeLikeOpMaker); +// Kernels are registered in gaussian_random_op.cc and gaussian_random_op.cu diff --git a/paddle/fluid/operators/gaussian_random_op.cc b/paddle/fluid/operators/gaussian_random_op.cc index b090f8759765039eadfc900361bcdabe215c2225..4d197637b3f49f7e63f5b1a5cba212d1bf774f7e 100644 --- a/paddle/fluid/operators/gaussian_random_op.cc +++ b/paddle/fluid/operators/gaussian_random_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ class GaussianRandomOp : public framework::OperatorWithKernel { framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext& ctx) const override { return framework::OpKernelType( - static_cast(ctx.Attr("dtype")), + static_cast(ctx.Attr("dtype")), ctx.device_context()); } }; @@ -88,12 +88,14 @@ class GaussianRandomOpMaker : public framework::OpProtoAndCheckerMaker { AddAttr("seed", "(int, default 0) " "Random seed of generator." - "0 means use system wide seed.") + "0 means use system wide seed." + "Note that if seed is not 0, this operator will always " + "generate the same random numbers every time.") .SetDefault(0); AddAttr("dtype", "(int, default 5(FP32)) " "Output data type.") - .SetDefault(framework::proto::DataType::FP32); + .SetDefault(framework::proto::VarType::FP32); AddComment(R"DOC( GaussianRandom Operator. @@ -110,4 +112,8 @@ Used to initialize tensors with gaussian random generator. namespace ops = paddle::operators; REGISTER_OP_WITHOUT_GRADIENT(gaussian_random, ops::GaussianRandomOp, ops::GaussianRandomOpMaker); -REGISTER_OP_CPU_KERNEL(gaussian_random, ops::CPUGaussianRandomKernel); +REGISTER_OP_CPU_KERNEL(gaussian_random, ops::CPUGaussianRandomKernel, + ops::CPUGaussianRandomKernel); +REGISTER_OP_CPU_KERNEL(gaussian_random_batch_size_like, + ops::CPUGaussianRandomKernel, + ops::CPUGaussianRandomKernel); diff --git a/paddle/fluid/operators/gaussian_random_op.cu b/paddle/fluid/operators/gaussian_random_op.cu index 70d655d4bb259bf33765fa42e46a19510ffca35d..7784856417e579fd43f79fa331d46df8af6c36b8 100644 --- a/paddle/fluid/operators/gaussian_random_op.cu +++ b/paddle/fluid/operators/gaussian_random_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -61,4 +61,8 @@ class GPUGaussianRandomKernel : public framework::OpKernel { } // namespace paddle REGISTER_OP_CUDA_KERNEL(gaussian_random, - paddle::operators::GPUGaussianRandomKernel); + paddle::operators::GPUGaussianRandomKernel, + paddle::operators::GPUGaussianRandomKernel); +REGISTER_OP_CUDA_KERNEL(gaussian_random_batch_size_like, + paddle::operators::GPUGaussianRandomKernel, + paddle::operators::GPUGaussianRandomKernel); diff --git a/paddle/fluid/operators/get_places_op.cc b/paddle/fluid/operators/get_places_op.cc index ef635048bd4faa2dc0067152f5f7472acbfe47af..9002ce4717c6e75e7204ef62094e4680bba3f88b 100644 --- a/paddle/fluid/operators/get_places_op.cc +++ b/paddle/fluid/operators/get_places_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -98,7 +98,7 @@ class GetPlacesInferVarType : public framework::VarTypeInference { framework::BlockDesc *block) const override { for (auto &o_name : op_desc.Output("Out")) { block->FindRecursiveOrCreateVar(o_name).SetType( - framework::proto::VarDesc::PLACE_LIST); + framework::proto::VarType::PLACE_LIST); } } }; diff --git a/paddle/fluid/operators/gru_op.cc b/paddle/fluid/operators/gru_op.cc index 1436e55b0e13b8b327a61e7c91294fa958b146c4..2a91dcbcd418fcd61445b7d744789bdeee11d2f2 100644 --- a/paddle/fluid/operators/gru_op.cc +++ b/paddle/fluid/operators/gru_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gru_op.cu.cc b/paddle/fluid/operators/gru_op.cu.cc index e908d01d2920af8bdbbdc694944e62a86bad327a..baf455a840314d1ab94eb8e0a2e5c660ba4202da 100644 --- a/paddle/fluid/operators/gru_op.cu.cc +++ b/paddle/fluid/operators/gru_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gru_op.h b/paddle/fluid/operators/gru_op.h index 37f3ae1a837c77bd5e3696abbd9ae14257a7f5d7..0886bebc41d8b0f28745e88685f3954f86c823a1 100644 --- a/paddle/fluid/operators/gru_op.h +++ b/paddle/fluid/operators/gru_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gru_unit_op.cc b/paddle/fluid/operators/gru_unit_op.cc index 21ad3aeb492ee18d465edea6ec0fca7e49d1366b..f4c766db0a12b9d2167b0ee3b1d7666c4f1813f1 100644 --- a/paddle/fluid/operators/gru_unit_op.cc +++ b/paddle/fluid/operators/gru_unit_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gru_unit_op.cu b/paddle/fluid/operators/gru_unit_op.cu index 88b707fd1314ec5f12b507edc64a56ea9895a9d6..fc92b3d4a7a5a933f31b21d18238de386b3afb4d 100644 --- a/paddle/fluid/operators/gru_unit_op.cu +++ b/paddle/fluid/operators/gru_unit_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/gru_unit_op.h b/paddle/fluid/operators/gru_unit_op.h index c4031a5a575e59488c1a6cd77c3da88ea6af423e..15d91ca30593871e2b343eb0e5c0b76aa8055968 100644 --- a/paddle/fluid/operators/gru_unit_op.h +++ b/paddle/fluid/operators/gru_unit_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/hinge_loss_op.cc b/paddle/fluid/operators/hinge_loss_op.cc index f644c22c9f1bdde6edc0126186361baccfbfcfb0..efe84f14098028675cb332efd9545c9709528cb3 100644 --- a/paddle/fluid/operators/hinge_loss_op.cc +++ b/paddle/fluid/operators/hinge_loss_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/hinge_loss_op.cu b/paddle/fluid/operators/hinge_loss_op.cu index cb53a9b7f4aaeeee71ed81c507feb0e9c946a541..9c0a85bee6e28865225c1848ea5a378f48932ceb 100644 --- a/paddle/fluid/operators/hinge_loss_op.cu +++ b/paddle/fluid/operators/hinge_loss_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/hinge_loss_op.h b/paddle/fluid/operators/hinge_loss_op.h index 1e924d236ea1d3208a8f425f76be8d455714a51f..10c17a0982fd7995056aeb1f70648fd78b3d9c05 100644 --- a/paddle/fluid/operators/hinge_loss_op.h +++ b/paddle/fluid/operators/hinge_loss_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/huber_loss_op.cc b/paddle/fluid/operators/huber_loss_op.cc index dc1f609dcfa23dff82812e72c16b1d62a93ca9a6..134b23b4612b478f9aeb06454c9fd9a6c25fffb4 100644 --- a/paddle/fluid/operators/huber_loss_op.cc +++ b/paddle/fluid/operators/huber_loss_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/huber_loss_op.cu b/paddle/fluid/operators/huber_loss_op.cu index ef5120c69d4fda533625ace9bab504be39385ec9..659464df9dc0e7c8cd276bd0bbf7072361aa3abf 100644 --- a/paddle/fluid/operators/huber_loss_op.cu +++ b/paddle/fluid/operators/huber_loss_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/huber_loss_op.h b/paddle/fluid/operators/huber_loss_op.h index caca89fcf63d27c7717de522e38f6ff0cab0d8f6..9efda3dfc9871f197e0a66329772df2caedc4da4 100644 --- a/paddle/fluid/operators/huber_loss_op.h +++ b/paddle/fluid/operators/huber_loss_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/im2sequence_op.cc b/paddle/fluid/operators/im2sequence_op.cc index 936e5fe49eda40dff6d8aa5fd626d443ee8dbe75..048391549dd8df24cc215d04431c306ac4c7e5be 100644 --- a/paddle/fluid/operators/im2sequence_op.cc +++ b/paddle/fluid/operators/im2sequence_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -41,10 +41,10 @@ class Im2SequenceOp : public framework::OperatorWithKernel { int img_height = in_dim[2]; int img_width = in_dim[3]; - int output_height = OutputSize(img_height, kernels[0], paddings[0], - paddings[2], strides[0]); - int output_width = - OutputSize(img_width, kernels[1], paddings[1], paddings[3], strides[1]); + int output_height = Im2SeqOutputSize(img_height, kernels[0], paddings[0], + paddings[2], strides[0]); + int output_width = Im2SeqOutputSize(img_width, kernels[1], paddings[1], + paddings[3], strides[1]); ctx->SetOutputDim("Out", {batch_size * output_height * output_width, img_channels * kernels[0] * kernels[1]}); diff --git a/paddle/fluid/operators/im2sequence_op.cu b/paddle/fluid/operators/im2sequence_op.cu index 1e7bf4631224620ad5c65f750ed0c0c22e936dcf..e0a5a90c1c3c47ea45b3f83ae969c1861783ff60 100644 --- a/paddle/fluid/operators/im2sequence_op.cu +++ b/paddle/fluid/operators/im2sequence_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/im2sequence_op.h b/paddle/fluid/operators/im2sequence_op.h index 59456f0ea2996bb20bd48806a7258e31518a5ea3..a6a83fefbc6266fa718dcad78b3a018526f124db 100644 --- a/paddle/fluid/operators/im2sequence_op.h +++ b/paddle/fluid/operators/im2sequence_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. @@ -26,8 +26,8 @@ namespace operators { using Tensor = framework::Tensor; using LoDTensor = framework::LoDTensor; -inline int OutputSize(int input_size, int filter_size, int padding_0, - int padding_1, int stride) { +inline int Im2SeqOutputSize(int input_size, int filter_size, int padding_0, + int padding_1, int stride) { const int output_size = (input_size + padding_0 + padding_1 - filter_size) / stride + 1; return output_size; @@ -53,10 +53,10 @@ class Im2SequenceKernel : public framework::OpKernel { auto kernels = ctx.Attr>("kernels"); auto strides = ctx.Attr>("strides"); auto paddings = ctx.Attr>("paddings"); - int output_height = OutputSize(img_height, kernels[0], paddings[0], - paddings[2], strides[0]); - int output_width = - OutputSize(img_width, kernels[1], paddings[1], paddings[3], strides[1]); + int output_height = Im2SeqOutputSize(img_height, kernels[0], paddings[0], + paddings[2], strides[0]); + int output_width = Im2SeqOutputSize(img_width, kernels[1], paddings[1], + paddings[3], strides[1]); const std::vector dilations({1, 1}); @@ -109,10 +109,10 @@ class Im2SequenceGradKernel : public framework::OpKernel { auto kernels = ctx.Attr>("kernels"); auto strides = ctx.Attr>("strides"); auto paddings = ctx.Attr>("paddings"); - int output_height = OutputSize(img_height, kernels[0], paddings[0], - paddings[2], strides[0]); - int output_width = - OutputSize(img_width, kernels[1], paddings[1], paddings[3], strides[1]); + int output_height = Im2SeqOutputSize(img_height, kernels[0], paddings[0], + paddings[2], strides[0]); + int output_width = Im2SeqOutputSize(img_width, kernels[1], paddings[1], + paddings[3], strides[1]); const std::vector dilations({1, 1}); diff --git a/paddle/fluid/operators/increment_op.cc b/paddle/fluid/operators/increment_op.cc index de4949584b7b20bec7b31f2ad1b69053ee9ffc0f..6b5c3db13c0929ae0dd2fb2c981867df0a36c1ce 100644 --- a/paddle/fluid/operators/increment_op.cc +++ b/paddle/fluid/operators/increment_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/iou_similarity_op.cc b/paddle/fluid/operators/iou_similarity_op.cc index c2e452cdfaa71cae53c2bfe259bae7f80cd259d7..ffbd7c7814c3fdec9fef0580ccd1ea3661ac0012 100755 --- a/paddle/fluid/operators/iou_similarity_op.cc +++ b/paddle/fluid/operators/iou_similarity_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/iou_similarity_op.cu b/paddle/fluid/operators/iou_similarity_op.cu index f8df1f4aa4c4894b59fe373a9e0cb697dfb96b62..f40a388d62e66a110656ebb71094d46b5ac147eb 100755 --- a/paddle/fluid/operators/iou_similarity_op.cu +++ b/paddle/fluid/operators/iou_similarity_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/iou_similarity_op.h b/paddle/fluid/operators/iou_similarity_op.h index 2fb1b5f70703f9c88a532644d88a8b5df45404f0..c76448c736847a536be2021a8a5fef23bef23a50 100644 --- a/paddle/fluid/operators/iou_similarity_op.h +++ b/paddle/fluid/operators/iou_similarity_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/is_empty_op.cc b/paddle/fluid/operators/is_empty_op.cc index dac8505e3f2cb33b35b6184184e4762078a19c49..2a7be90dab1cc23ffe5e1c296c37a4bbeacb7d8e 100644 --- a/paddle/fluid/operators/is_empty_op.cc +++ b/paddle/fluid/operators/is_empty_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/l1_norm_op.cc b/paddle/fluid/operators/l1_norm_op.cc index 974ee404f8364ed66e9e213f857ea89993e1d6af..963b0587c386c72c05f8cc5d0b63074e9e726579 100644 --- a/paddle/fluid/operators/l1_norm_op.cc +++ b/paddle/fluid/operators/l1_norm_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/l1_norm_op.cu b/paddle/fluid/operators/l1_norm_op.cu index 5e9e864a346298a670db63c664491c336a9bd36a..1b48571dd7378c1c2a6628662024bc7bcc08d2a6 100644 --- a/paddle/fluid/operators/l1_norm_op.cu +++ b/paddle/fluid/operators/l1_norm_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/l1_norm_op.h b/paddle/fluid/operators/l1_norm_op.h index 7ddf2ac6a9046d4d8c2130b459f2385ef4e1301a..7c6503bb2150a89dd2d38e3eb05d1da28446cb63 100644 --- a/paddle/fluid/operators/l1_norm_op.h +++ b/paddle/fluid/operators/l1_norm_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/label_smooth_op.cc b/paddle/fluid/operators/label_smooth_op.cc index c018965beefb362ae845d132e34ded1bb2911629..eef25f8a06ddb3311f3cfea21b64d8f7d7e58f24 100644 --- a/paddle/fluid/operators/label_smooth_op.cc +++ b/paddle/fluid/operators/label_smooth_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/label_smooth_op.cu b/paddle/fluid/operators/label_smooth_op.cu index 4a40a4e9ec82199afae3ae77bb2296a2fa95b0a5..ab259b48e35b92d6d7545f52550aee0b7ce773e5 100644 --- a/paddle/fluid/operators/label_smooth_op.cu +++ b/paddle/fluid/operators/label_smooth_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/label_smooth_op.h b/paddle/fluid/operators/label_smooth_op.h index 15752377f663fcb526b8306158e1e90d743c6cb6..f56fd95e96526c59e040fbbd2812360e59570a08 100644 --- a/paddle/fluid/operators/label_smooth_op.h +++ b/paddle/fluid/operators/label_smooth_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/layer_norm_op.cc b/paddle/fluid/operators/layer_norm_op.cc index 60e37ed01b3cad428dc0184634b4d36c9f24f9c5..88b3b08af57eaf2d1086d778e3313c3dea6300fb 100644 --- a/paddle/fluid/operators/layer_norm_op.cc +++ b/paddle/fluid/operators/layer_norm_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/layer_norm_op.cu b/paddle/fluid/operators/layer_norm_op.cu index aa54fd54155ce19298ad9f80c930ad08e542d71c..6840e1e08f3d5bc84a05f15e30982c7cfb59680b 100644 --- a/paddle/fluid/operators/layer_norm_op.cu +++ b/paddle/fluid/operators/layer_norm_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/layer_norm_op.h b/paddle/fluid/operators/layer_norm_op.h index 60c0b07add172520dc8062d3d5e8e4e69758e1f1..605b5c258ca57b1a63c9b741a1a30dcb9fca2248 100644 --- a/paddle/fluid/operators/layer_norm_op.h +++ b/paddle/fluid/operators/layer_norm_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -196,7 +196,7 @@ class LayerNormGradKernel : public framework::OpKernel { // dy_dx ElementwiseComputeEx, DeviceContext, T>( ctx, &d_y, scale, /*axis*/ 1, MulFunctor(), &temp); - framework::Copy(temp, ctx.GetPlace(), ctx.device_context(), d_x); + framework::TensorCopy(temp, ctx.GetPlace(), ctx.device_context(), d_x); // dy_dmean_dx row_mean(dev_ctx, temp, &temp_vec); @@ -208,7 +208,7 @@ class LayerNormGradKernel : public framework::OpKernel { ctx, &temp, &temp_norm, /*axis*/ 0, MulFunctor(), &temp); } else { // dy_dx - framework::Copy(d_y, ctx.GetPlace(), ctx.device_context(), d_x); + framework::TensorCopy(d_y, ctx.GetPlace(), ctx.device_context(), d_x); // dy_dmean_dx row_mean(dev_ctx, d_y, &temp_vec); diff --git a/paddle/fluid/operators/linear_chain_crf_op.cc b/paddle/fluid/operators/linear_chain_crf_op.cc index 3e1dfa494872b6f187ee0b3cca399308a1cab42a..ef568a578b0b97ea402a2a521f0fe1431013d1b7 100644 --- a/paddle/fluid/operators/linear_chain_crf_op.cc +++ b/paddle/fluid/operators/linear_chain_crf_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/linear_chain_crf_op.cu b/paddle/fluid/operators/linear_chain_crf_op.cu index 6e04e76eebc71def814fed65a469ef5f9f1b16b0..4f7738e8c361d02f80f9c15859a9d3667e74f65c 100644 --- a/paddle/fluid/operators/linear_chain_crf_op.cu +++ b/paddle/fluid/operators/linear_chain_crf_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/linear_chain_crf_op.h b/paddle/fluid/operators/linear_chain_crf_op.h index 15b64c09bf366b356683c47c82a6dbf9529d9b58..800a1303e1a427e7bd5e6c04354b8a5fbd816712 100644 --- a/paddle/fluid/operators/linear_chain_crf_op.h +++ b/paddle/fluid/operators/linear_chain_crf_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/listen_and_serv_op.cc b/paddle/fluid/operators/listen_and_serv_op.cc index 426dd0dc0e95b7952de1b603a943fc725889685e..ee0e3533ce028992af3d4558e3fd198a09c4816b 100644 --- a/paddle/fluid/operators/listen_and_serv_op.cc +++ b/paddle/fluid/operators/listen_and_serv_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -75,15 +75,8 @@ class ListenAndServOp : public framework::OperatorBase { server_thread_->join(); } - std::string GetGradVarNameForTrainer(const std::string &varname) const { - if (grads_counter_.find(varname) == grads_counter_.end()) { - grads_counter_[varname] = 0; - } - return string::Sprintf("%s.trainer_%d", varname, grads_counter_[varname]++); - } - - void Run(const framework::Scope &scope, - const platform::Place &dev_place) const override { + void RunImpl(const framework::Scope &scope, + const platform::Place &dev_place) const override { platform::DeviceContextPool &pool = platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(dev_place); framework::Scope &recv_scope = scope.NewScope(); @@ -91,8 +84,7 @@ class ListenAndServOp : public framework::OperatorBase { // FIXME(Yancey1989): initialize rpc server with lazy mode. rpc_service_->SetScope(&recv_scope); rpc_service_->SetDevCtx(&dev_ctx); - auto param_list = Attr>("ParamList"); - auto grad_list = Attr>("GradList"); + auto ins = Inputs("X"); auto fan_in = Attr("Fanin"); auto *block = Attr(kOptimizeBlock); @@ -109,40 +101,24 @@ class ListenAndServOp : public framework::OperatorBase { // the gradients arrives, just add suffix 0~n and merge the gradient. rpc_service_->SetCond(0); size_t recv_var_cnt = 0; - size_t update_param_cnt = 0; int batch_barrier = 0; while (batch_barrier != fan_in) { const detail::MessageWithName &v = rpc_service_->Get(); - auto grad_var_name = v.first; - if (grad_var_name == LISTEN_TERMINATE_MESSAGE) { + auto recv_var_name = v.first; + if (recv_var_name == LISTEN_TERMINATE_MESSAGE) { LOG(INFO) << "received terminate message and exit"; exit_flag = true; break; - } else if (grad_var_name == BATCH_BARRIER_MESSAGE) { + } else if (recv_var_name == BATCH_BARRIER_MESSAGE) { VLOG(3) << "recv batch barrier message"; batch_barrier++; continue; } else { - // receive a variable + VLOG(3) << "received grad: " << recv_var_name; recv_var_cnt++; - auto it = - std::find(grad_list.begin(), grad_list.end(), grad_var_name); - std::string param_var_name; - if (it != grad_list.end()) { - param_var_name = param_list[it - grad_list.begin()]; - update_param_cnt++; - VLOG(3) << "received grad: " << grad_var_name - << " updating param: " << param_var_name; - } else { - VLOG(3) << "received variable: " << grad_var_name - << " no need to update param"; - } - if (fan_in > 1 && !param_var_name.empty()) { - grad_var_name = this->GetGradVarNameForTrainer(grad_var_name); - } - auto *var = recv_scope.FindVar(grad_var_name); + auto *var = recv_scope.FindVar(recv_var_name); if (var == nullptr) { - LOG(ERROR) << "Can not find server side var: " << grad_var_name; + LOG(ERROR) << "Can not find server side var: " << recv_var_name; PADDLE_THROW("Can not find server side var"); } detail::DeserializeFromMessage(v.second, dev_ctx, var); @@ -151,29 +127,26 @@ class ListenAndServOp : public framework::OperatorBase { } } } - VLOG(3) << "recv " << recv_var_cnt << " parmeters for one barrier."; if (exit_flag) { rpc_service_->ShutDown(); } - VLOG(3) << "run optimize graph..."; try { executor.Run(*program, &recv_scope, block->ID(), /*global_block*/ false /*create_local_scope*/, false /*create_vars*/); } catch (std::exception &e) { LOG(ERROR) << "run sub program error " << e.what(); } - // Reset the received sparse variables, the sum operator would not // sum the input sparse variables which rows is empty at the next // mini-batch. - // TOOD(Yancey1989): move the reset action into an operator, we couldn't + // TODO(Yancey1989): move the reset action into an operator, we couldn't // have any hide logic in the operator. for (auto &var : sparse_vars) { var->GetMutable()->mutable_rows()->clear(); } rpc_service_->SetCond(1); - rpc_service_->WaitClientGet(update_param_cnt); - grads_counter_.clear(); + // FIXME(typhoonzero): use another condition to sync wait clients get. + rpc_service_->WaitClientGet(ins.size()); sparse_vars.clear(); } // while(true) } @@ -181,13 +154,13 @@ class ListenAndServOp : public framework::OperatorBase { protected: std::shared_ptr rpc_service_; std::shared_ptr server_thread_; - mutable std::unordered_map grads_counter_; }; class ListenAndServOpMaker : public framework::OpProtoAndCheckerMaker { public: ListenAndServOpMaker(OpProto *proto, OpAttrChecker *op_checker) : OpProtoAndCheckerMaker(proto, op_checker) { + AddInput("X", "(Tensor) Variables that server recv.").AsDuplicable(); AddComment(R"DOC( ListenAndServ operator @@ -201,16 +174,7 @@ from send_op and send back variables to recv_op. .AddCustomChecker([](const std::string &ip) { return !ip.empty(); }); AddAttr(kOptimizeBlock, "BlockID to run on server side."); - AddAttr>( - "ParamList", "type list of string", - "grad->param name mapping to find which parameters to optimize.") - .SetDefault({}); - AddAttr>( - "GradList", "type list of string", - "grad->param name mapping to find which parameters to optimize.") - .SetDefault({}); - AddAttr("Fanin", "type int", - "Number of trainers in the current cluster job") + AddAttr("Fanin", "How many clients send to this server.") .SetDefault(1); } }; diff --git a/paddle/fluid/operators/load_combine_op.cc b/paddle/fluid/operators/load_combine_op.cc index d043702ebae627951927f2dbec893d40f77f0c73..e5353144e91455fc71460459e6e799b54f750f71 100644 --- a/paddle/fluid/operators/load_combine_op.cc +++ b/paddle/fluid/operators/load_combine_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ class LoadCombineOp : public framework::OperatorBase { out_var->Clear(); tensor = out_var->GetMutable(); tensor->set_lod(cpu_tensor.lod()); - Copy(cpu_tensor, place, dev_ctx, tensor); + TensorCopy(cpu_tensor, place, dev_ctx, tensor); } } } diff --git a/paddle/fluid/operators/load_op.cc b/paddle/fluid/operators/load_op.cc index 9393cccfc66ec930db6ef68bd6f3c5065ceea80e..05f809ac5628420251957116bb2390b4502f11b8 100644 --- a/paddle/fluid/operators/load_op.cc +++ b/paddle/fluid/operators/load_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ class LoadOp : public framework::OperatorBase { out_var->Clear(); tensor = out_var->GetMutable(); tensor->set_lod(cpu_tensor.lod()); - Copy(cpu_tensor, place, dev_ctx, tensor); + TensorCopy(cpu_tensor, place, dev_ctx, tensor); } } }; diff --git a/paddle/fluid/operators/lod_array_length_op.cc b/paddle/fluid/operators/lod_array_length_op.cc index daa57c20450f1f92cb0bb500e37d0d8c49c05758..e6212405770093455ec89bde9dc0a092b956fc83 100644 --- a/paddle/fluid/operators/lod_array_length_op.cc +++ b/paddle/fluid/operators/lod_array_length_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lod_rank_table_op.cc b/paddle/fluid/operators/lod_rank_table_op.cc index 3264766d6b693244f8dbfa6462b9c7aa13d5b5ec..590b44e14f518c3c60c141c9a0dfe7f2b96f69c6 100644 --- a/paddle/fluid/operators/lod_rank_table_op.cc +++ b/paddle/fluid/operators/lod_rank_table_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ class LoDRankTableInferVarType : public framework::VarTypeInference { framework::BlockDesc *block) const override { for (auto &o : op_desc.Output("Out")) { block->FindRecursiveOrCreateVar(o).SetType( - framework::proto::VarDesc::LOD_RANK_TABLE); + framework::proto::VarType::LOD_RANK_TABLE); } } }; diff --git a/paddle/fluid/operators/lod_reset_op.cc b/paddle/fluid/operators/lod_reset_op.cc index 55ae71c1815470925b2bb153fc647b331dcc9ba4..6a66297cb843ead1a507a6867c1c562224861cbf 100644 --- a/paddle/fluid/operators/lod_reset_op.cc +++ b/paddle/fluid/operators/lod_reset_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lod_reset_op.cu b/paddle/fluid/operators/lod_reset_op.cu index 8bfc8bd3bf06037d7fcd387dee0514a1e4c6a0f9..b0e87a851a77a1cc98d419a63d4d9e5e1b9dd163 100644 --- a/paddle/fluid/operators/lod_reset_op.cu +++ b/paddle/fluid/operators/lod_reset_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lod_reset_op.h b/paddle/fluid/operators/lod_reset_op.h index a10efee0bdd8c58d23c05bb85f0f882d801848fe..8186d4f8262101edc723af390eee1aec4fa6f3a5 100644 --- a/paddle/fluid/operators/lod_reset_op.h +++ b/paddle/fluid/operators/lod_reset_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -33,8 +33,8 @@ class LoDResetKernel : public framework::OpKernel { auto* lod = lod_t->data(); if (platform::is_gpu_place(ctx.GetPlace())) { framework::Tensor lod_cpu; - framework::Copy(*lod_t, platform::CPUPlace(), ctx.device_context(), - &lod_cpu); + framework::TensorCopy(*lod_t, platform::CPUPlace(), + ctx.device_context(), &lod_cpu); lod = lod_cpu.data(); } level0 = std::vector(lod, lod + lod_t->numel()); diff --git a/paddle/fluid/operators/lod_tensor_to_array_op.cc b/paddle/fluid/operators/lod_tensor_to_array_op.cc index d6e24dc976a1ebe2afa182618d09839b105381c1..543495ce4e66c0955c9ce1b0db480088069b36db 100644 --- a/paddle/fluid/operators/lod_tensor_to_array_op.cc +++ b/paddle/fluid/operators/lod_tensor_to_array_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -94,9 +94,9 @@ class LoDTensorToArrayOp : public framework::OperatorBase { platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(place); - framework::Copy(x.Slice(static_cast(each_range.begin), - static_cast(each_range.end)), - x.place(), dev_ctx, &slice); + framework::TensorCopy(x.Slice(static_cast(each_range.begin), + static_cast(each_range.end)), + x.place(), dev_ctx, &slice); offset += len; } } @@ -138,7 +138,7 @@ class LoDTensorToArrayInferVarType : public framework::VarTypeInference { void operator()(const framework::OpDesc &op_desc, framework::BlockDesc *block) const override { for (auto &out_var : op_desc.Output("Out")) { - block->Var(out_var)->SetType(framework::proto::VarDesc::LOD_TENSOR_ARRAY); + block->Var(out_var)->SetType(framework::proto::VarType::LOD_TENSOR_ARRAY); } } }; diff --git a/paddle/fluid/operators/log_loss_op.cc b/paddle/fluid/operators/log_loss_op.cc index 6c5cd2956811329a1ac5da9e42e808c2684dc771..f44996d8ac746a33750a979eff2cbbc84e10214b 100644 --- a/paddle/fluid/operators/log_loss_op.cc +++ b/paddle/fluid/operators/log_loss_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/log_loss_op.cu b/paddle/fluid/operators/log_loss_op.cu index c164a6d04056c2e9d9302b609c1ff4f2b2c4a3f3..e8bf7d8159bf8b16bf4397e7765918c060124db3 100644 --- a/paddle/fluid/operators/log_loss_op.cu +++ b/paddle/fluid/operators/log_loss_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/log_loss_op.h b/paddle/fluid/operators/log_loss_op.h index 67fac7cfe55d1d50063afac925863a8fb2eb63a8..e62de17a98603109786e49725537867c3fe7831a 100644 --- a/paddle/fluid/operators/log_loss_op.h +++ b/paddle/fluid/operators/log_loss_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/logical_op.cc b/paddle/fluid/operators/logical_op.cc index ff49895df1979bde9dc9f9c7b92601a2a65241da..6a7db31cf36f31064259abeb0348e682be9f917c 100644 --- a/paddle/fluid/operators/logical_op.cc +++ b/paddle/fluid/operators/logical_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/logical_op.cu b/paddle/fluid/operators/logical_op.cu index 2b17444061252b714cd9bbaadc7fcf877628ef89..7ffe4dfc268b1ad3894dd54cb13c2f424818aa05 100644 --- a/paddle/fluid/operators/logical_op.cu +++ b/paddle/fluid/operators/logical_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/logical_op.h b/paddle/fluid/operators/logical_op.h index f6d5866c2c8e4ce54e9556a1acf69414dba523d2..4a83e0fda6e4ecdb1112f096eb37159337c37147 100644 --- a/paddle/fluid/operators/logical_op.h +++ b/paddle/fluid/operators/logical_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lookup_table_op.cc b/paddle/fluid/operators/lookup_table_op.cc index 2c555f1a3fa228215812b7d3291e882b0d42bb64..3acdca17afc2fea05fb81871e6e03d72691fe91e 100644 --- a/paddle/fluid/operators/lookup_table_op.cc +++ b/paddle/fluid/operators/lookup_table_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -123,11 +123,11 @@ class LookupTableOpGradVarTypeInference : public framework::VarTypeInference { VLOG(3) << "lookup_table_grad op " << framework::GradVarName("W") << " is set to SelectedRows"; block->Var(out_var_name) - ->SetType(framework::proto::VarDesc::SELECTED_ROWS); + ->SetType(framework::proto::VarType::SELECTED_ROWS); } else { VLOG(3) << "lookup_table_grad op " << framework::GradVarName("W") << " is set to LoDTensor"; - block->Var(out_var_name)->SetType(framework::proto::VarDesc::LOD_TENSOR); + block->Var(out_var_name)->SetType(framework::proto::VarType::LOD_TENSOR); } } }; diff --git a/paddle/fluid/operators/lookup_table_op.cu b/paddle/fluid/operators/lookup_table_op.cu index 801adba5a440ebda9506717603e8f9665ea9e6ba..923340f46102d888f549c79684ae0ae2f78ed038 100644 --- a/paddle/fluid/operators/lookup_table_op.cu +++ b/paddle/fluid/operators/lookup_table_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lookup_table_op.h b/paddle/fluid/operators/lookup_table_op.h index d264496882a9e1828953d843d4a18fe4c16b1d24..d88b034e919f1127ac3c424e87e4a5f81a598dc8 100644 --- a/paddle/fluid/operators/lookup_table_op.h +++ b/paddle/fluid/operators/lookup_table_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lrn_op.cc b/paddle/fluid/operators/lrn_op.cc index c84507f231c6d3c4c5d6e33719fafc2752876f03..b0c213d637c244e4cbacbe75218537973efed047 100644 --- a/paddle/fluid/operators/lrn_op.cc +++ b/paddle/fluid/operators/lrn_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lrn_op.cu b/paddle/fluid/operators/lrn_op.cu index 03112bf3e03595a521c22cd914f414f026970c10..64f3fea6be24e60c6fcef3190c0df4e01953b133 100644 --- a/paddle/fluid/operators/lrn_op.cu +++ b/paddle/fluid/operators/lrn_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lrn_op.h b/paddle/fluid/operators/lrn_op.h index b7b78b459145bae5483e3f12b3d872c679823740..95796f7eecd2bcd61aab7944f557ca568b03e027 100644 --- a/paddle/fluid/operators/lrn_op.h +++ b/paddle/fluid/operators/lrn_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstm_op.cc b/paddle/fluid/operators/lstm_op.cc index d1f1b5f235f991e7a4d84c815bc5dda74ab64752..d75537741ef1d13b61ad6e244b2bba1ae5509da5 100644 --- a/paddle/fluid/operators/lstm_op.cc +++ b/paddle/fluid/operators/lstm_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstm_op.cu.cc b/paddle/fluid/operators/lstm_op.cu.cc index 679d02b1f9a1d1f0313b5c8109285c92734e3e5a..c1cbfada41d04b52faf74dcfe76bcbb35edfa71b 100644 --- a/paddle/fluid/operators/lstm_op.cu.cc +++ b/paddle/fluid/operators/lstm_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstm_op.h b/paddle/fluid/operators/lstm_op.h index 1c48495533cf5dbf1f46176cff936f7f988a3d48..11f9f223b5d9a8091c51c93cee3f9c23b62e5573 100644 --- a/paddle/fluid/operators/lstm_op.h +++ b/paddle/fluid/operators/lstm_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstm_unit_op.cc b/paddle/fluid/operators/lstm_unit_op.cc index 3d33d47e0c3ba8b83be2c06e9884d90e9bb1012e..b3c9d7c34d1ac54fb3e15a60bcc470f392bf5027 100644 --- a/paddle/fluid/operators/lstm_unit_op.cc +++ b/paddle/fluid/operators/lstm_unit_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstm_unit_op.cu b/paddle/fluid/operators/lstm_unit_op.cu index 12ebffca37f995111bbeb2a1e8b30ea2fe35c74d..76245a1b5a9c8ba9c7ee7d7c03a95e2595a01591 100644 --- a/paddle/fluid/operators/lstm_unit_op.cu +++ b/paddle/fluid/operators/lstm_unit_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstm_unit_op.h b/paddle/fluid/operators/lstm_unit_op.h index 9f2370fe690a45f49c0138fbd1303d7bfd6dacd0..4ead9c22934dde6e42f9ede47cc1ddf502948fc4 100644 --- a/paddle/fluid/operators/lstm_unit_op.h +++ b/paddle/fluid/operators/lstm_unit_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstmp_op.cc b/paddle/fluid/operators/lstmp_op.cc index 2d30edf5c3cbabe7223a459a5f60b7b9aa51af9a..a881ef82ec3cefa826f5f0856cc4fc13c7d7afc0 100644 --- a/paddle/fluid/operators/lstmp_op.cc +++ b/paddle/fluid/operators/lstmp_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstmp_op.cu b/paddle/fluid/operators/lstmp_op.cu index bcefb94c75b8577fefb1ee3b440dc5fb045562d5..f601b897af69a3e9f3b1d86d5873e99cca4d988f 100644 --- a/paddle/fluid/operators/lstmp_op.cu +++ b/paddle/fluid/operators/lstmp_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/lstmp_op.h b/paddle/fluid/operators/lstmp_op.h index 22ef4721860a493fded98cf32b40a2aceb851a5c..dfa7f74d5116b4e3f1508f8bef94c598711e8124 100644 --- a/paddle/fluid/operators/lstmp_op.h +++ b/paddle/fluid/operators/lstmp_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/margin_rank_loss_op.cc b/paddle/fluid/operators/margin_rank_loss_op.cc index fc31befb20526e84aae1804756d2d44a785aa229..b146b5088321efcee5a4511b3fedd047a0d54f00 100644 --- a/paddle/fluid/operators/margin_rank_loss_op.cc +++ b/paddle/fluid/operators/margin_rank_loss_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/margin_rank_loss_op.cu b/paddle/fluid/operators/margin_rank_loss_op.cu index ca4593a48d6d3eccff81dfd621ea1198e5bad880..d7e77e923029ea65bcf7bdb40f98b693107ba3a9 100644 --- a/paddle/fluid/operators/margin_rank_loss_op.cu +++ b/paddle/fluid/operators/margin_rank_loss_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/margin_rank_loss_op.h b/paddle/fluid/operators/margin_rank_loss_op.h index 934a5da0f804f7cf7dc176a9ee4e1b72261ef008..c1bf44510766b03935c2290916d21979b4aab7fd 100644 --- a/paddle/fluid/operators/margin_rank_loss_op.h +++ b/paddle/fluid/operators/margin_rank_loss_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/context_project.cc b/paddle/fluid/operators/math/context_project.cc index b73d976d1b3e6dcf99e5cc525263282b1253c600..537d0b47868fb68d59e3b3556a54ba85d5f06960 100644 --- a/paddle/fluid/operators/math/context_project.cc +++ b/paddle/fluid/operators/math/context_project.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/context_project.cu b/paddle/fluid/operators/math/context_project.cu index bbd36a6e8f54833f15ee0c991228c10b7f74f272..16205c0e145ef70666d4eca564488d80bde26d2e 100644 --- a/paddle/fluid/operators/math/context_project.cu +++ b/paddle/fluid/operators/math/context_project.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/context_project.h b/paddle/fluid/operators/math/context_project.h index 2fe593ec3af9d07a2cbafc69e8d3a52e2c43e76b..4da94383af6c927a2db3337be6e82ca95a8cb036 100644 --- a/paddle/fluid/operators/math/context_project.h +++ b/paddle/fluid/operators/math/context_project.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -149,7 +149,8 @@ class ContextProjectFunctor { Tensor out_t_sub = out_t.Slice(k * context_length, k * context_length + padding_size); Tensor w_sub = padding_data.Slice(k, k + padding_size); - framework::Copy(w_sub, context.GetPlace(), context, &out_t_sub); + framework::TensorCopy(w_sub, context.GetPlace(), context, + &out_t_sub); } } if (down_pad > 0) { // add down pad @@ -179,7 +180,8 @@ class ContextProjectFunctor { (down_pad_begin_row + t) * context_length); Tensor w_sub = padding_data.Slice( up_pad + padding_idx, up_pad + padding_idx + padding_size); - framework::Copy(w_sub, context.GetPlace(), context, &out_t_sub); + framework::TensorCopy(w_sub, context.GetPlace(), context, + &out_t_sub); } } out_t.Resize({sequence_height, context_length * sequence_width}); diff --git a/paddle/fluid/operators/math/cos_sim_functor.cc b/paddle/fluid/operators/math/cos_sim_functor.cc index 701a9c23c0da3afbb643e9a821b7b74e69170710..cbe16999124a67ac764afade92f7320a12129cd1 100644 --- a/paddle/fluid/operators/math/cos_sim_functor.cc +++ b/paddle/fluid/operators/math/cos_sim_functor.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/cos_sim_functor.cu b/paddle/fluid/operators/math/cos_sim_functor.cu index 0323680870ad835afca5a896f80d3abde0aad11c..55c1e726335dfe010e39847ac90b84cc49955360 100644 --- a/paddle/fluid/operators/math/cos_sim_functor.cu +++ b/paddle/fluid/operators/math/cos_sim_functor.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/cos_sim_functor.h b/paddle/fluid/operators/math/cos_sim_functor.h index 445d94f975f3448cc09c21be8e0a13d73d002382..30ea5e60e87b5b7838d840c4d5b53d904281ab2a 100644 --- a/paddle/fluid/operators/math/cos_sim_functor.h +++ b/paddle/fluid/operators/math/cos_sim_functor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/cross_entropy.cc b/paddle/fluid/operators/math/cross_entropy.cc index 76abd03ff8b75e595461f41301c41ffe57d78686..fc0fca5ad3370633b2f60db65fdb7c01c417dc50 100644 --- a/paddle/fluid/operators/math/cross_entropy.cc +++ b/paddle/fluid/operators/math/cross_entropy.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/cross_entropy.cu b/paddle/fluid/operators/math/cross_entropy.cu index 39222c484c2fe847aec70b65d3d01745b8eea336..f4935c2813c9f84699f1182df6a9adb613190506 100644 --- a/paddle/fluid/operators/math/cross_entropy.cu +++ b/paddle/fluid/operators/math/cross_entropy.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/cross_entropy.h b/paddle/fluid/operators/math/cross_entropy.h index 2fe216a805383ae0d7e8d008af2838652fcf87c6..adc5b3fe47cd3bf524eb56747b6bd51e345a2eb6 100644 --- a/paddle/fluid/operators/math/cross_entropy.h +++ b/paddle/fluid/operators/math/cross_entropy.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/depthwise_conv.cu b/paddle/fluid/operators/math/depthwise_conv.cu index 7b75e593071eaeb72bcfc687b6ff22b7cf4f143f..a5e6e4031bbaddc2d09c660d34a975b2a496bc63 100644 --- a/paddle/fluid/operators/math/depthwise_conv.cu +++ b/paddle/fluid/operators/math/depthwise_conv.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 paddlepaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 paddlepaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/depthwise_conv.h b/paddle/fluid/operators/math/depthwise_conv.h index c3081e7a0deb4afc47d826753ecb2556aa6f4522..081bda891d044041f6814964e7076e28e812039c 100644 --- a/paddle/fluid/operators/math/depthwise_conv.h +++ b/paddle/fluid/operators/math/depthwise_conv.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detail/activation_functions.h b/paddle/fluid/operators/math/detail/activation_functions.h index 3af7ba790c489b2fc34b3cb6d56849ce789d2430..d205ebf210818b91c3cf6d4563fca1e56702bcf9 100644 --- a/paddle/fluid/operators/math/detail/activation_functions.h +++ b/paddle/fluid/operators/math/detail/activation_functions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detail/avx_functions.cc b/paddle/fluid/operators/math/detail/avx_functions.cc index 838cd30e3d503ddb4734f1114e741fd40b1939c0..b95109d3f73505fa6b5438326804a2b348fb3668 100644 --- a/paddle/fluid/operators/math/detail/avx_functions.cc +++ b/paddle/fluid/operators/math/detail/avx_functions.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detail/gru_cpu_kernel.h b/paddle/fluid/operators/math/detail/gru_cpu_kernel.h index 75c5c8eb29a34047a22779edcc0fc2f5fbcbab6f..1e5ff8ef46db960ddf88ebf03041893b176c1950 100644 --- a/paddle/fluid/operators/math/detail/gru_cpu_kernel.h +++ b/paddle/fluid/operators/math/detail/gru_cpu_kernel.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detail/gru_gpu_kernel.h b/paddle/fluid/operators/math/detail/gru_gpu_kernel.h index fbf69d4a85883a68f137945ed8978acb9108b77b..657652562780ae9932a4394335bfa3c3b397bb80 100644 --- a/paddle/fluid/operators/math/detail/gru_gpu_kernel.h +++ b/paddle/fluid/operators/math/detail/gru_gpu_kernel.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detail/gru_kernel.h b/paddle/fluid/operators/math/detail/gru_kernel.h index 705787e2ff76630fbcb23e646c91f74fa2feea24..991f2e758c2c3b4acc93c1eb84dbd196d623b5cc 100644 --- a/paddle/fluid/operators/math/detail/gru_kernel.h +++ b/paddle/fluid/operators/math/detail/gru_kernel.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detail/lstm_cpu_kernel.h b/paddle/fluid/operators/math/detail/lstm_cpu_kernel.h index bf26509ba17774f55c4f7592ff3afb7bcfcaa336..6ad77830fd7a9809c4922878cc8ccdff1e8e0ef7 100644 --- a/paddle/fluid/operators/math/detail/lstm_cpu_kernel.h +++ b/paddle/fluid/operators/math/detail/lstm_cpu_kernel.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detail/lstm_gpu_kernel.h b/paddle/fluid/operators/math/detail/lstm_gpu_kernel.h index 7865d0c0ba12c6150d87ea22e9c597e90b57e1ba..ee7b16da4187e0f7f7839eff5c8753d2eb4f9c6d 100644 --- a/paddle/fluid/operators/math/detail/lstm_gpu_kernel.h +++ b/paddle/fluid/operators/math/detail/lstm_gpu_kernel.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detail/lstm_kernel.h b/paddle/fluid/operators/math/detail/lstm_kernel.h index 0679cc62ba91fce540d9f6e227729a96a1553173..9080634f2b3fc122a420e049314f53abd50376e0 100644 --- a/paddle/fluid/operators/math/detail/lstm_kernel.h +++ b/paddle/fluid/operators/math/detail/lstm_kernel.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/detection_util.h b/paddle/fluid/operators/math/detection_util.h index 13e5d406c11a10dc87533a2ca07d14f4684446f5..c31764cfaf5bbdfea2f3ed06f31f97965a8858ed 100644 --- a/paddle/fluid/operators/math/detection_util.h +++ b/paddle/fluid/operators/math/detection_util.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/gru_compute.cc b/paddle/fluid/operators/math/gru_compute.cc index 100318041679e38b37fd1ef1f071d4e682889756..3f044b775138c495052bec3d19121bf26c37cb37 100644 --- a/paddle/fluid/operators/math/gru_compute.cc +++ b/paddle/fluid/operators/math/gru_compute.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/math/gru_compute.cu b/paddle/fluid/operators/math/gru_compute.cu index 0d5d5d7a743150c397a5b8356d1b3add88c509b6..27caf3383dd6cd94779391b722bba1d6b74772c0 100644 --- a/paddle/fluid/operators/math/gru_compute.cu +++ b/paddle/fluid/operators/math/gru_compute.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/math/gru_compute.h b/paddle/fluid/operators/math/gru_compute.h index 93e19cf55782facfd95affdc77dcf78c511d8bbd..c5816b16cd90410fcc48929931c25d0d561ad653 100644 --- a/paddle/fluid/operators/math/gru_compute.h +++ b/paddle/fluid/operators/math/gru_compute.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/math/im2col.cc b/paddle/fluid/operators/math/im2col.cc index c298b00bb4cb9df8f9a54b4420edb07aed9cf891..123e10586f60f65d6c31a7c1f837bf32610d4ea5 100644 --- a/paddle/fluid/operators/math/im2col.cc +++ b/paddle/fluid/operators/math/im2col.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/im2col.cu b/paddle/fluid/operators/math/im2col.cu index c26343aacf524c4381a8bba1e4e0d1a07bee6d6e..f41c78140fb601cd27a4e9997a736f46e903efc7 100644 --- a/paddle/fluid/operators/math/im2col.cu +++ b/paddle/fluid/operators/math/im2col.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/im2col.h b/paddle/fluid/operators/math/im2col.h index 525c0f5dda102ef92a9d79832fecc10f99ccd900..451ec9d53498caa6d53a28dbfc764775d3ed3ecf 100644 --- a/paddle/fluid/operators/math/im2col.h +++ b/paddle/fluid/operators/math/im2col.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/im2col_test.cc b/paddle/fluid/operators/math/im2col_test.cc index 59d6a84b892fc32aceb5622a856a5c648a3ade5b..b3978536bca7dc276bf5417bed36761a2d496536 100644 --- a/paddle/fluid/operators/math/im2col_test.cc +++ b/paddle/fluid/operators/math/im2col_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ void testIm2col() { if (paddle::platform::is_cpu_place(*place)) { input = input_tmp; } else { - Copy(input_tmp, *place, *context, &input); + TensorCopy(input_tmp, *place, *context, &input); } output_cfo.mutable_data( {1, filter_size, filter_size, output_height, output_width}, *place); @@ -87,7 +87,7 @@ void testIm2col() { if (paddle::platform::is_cpu_place(*place)) { out_cfo_ptr = output_cfo.data(); } else { - Copy(output_cfo, paddle::platform::CPUPlace(), *context, &output_tmp); + TensorCopy(output_cfo, paddle::platform::CPUPlace(), *context, &output_tmp); out_cfo_ptr = output_tmp.data(); } for (int i = 0; i < 6; ++i) { @@ -98,7 +98,7 @@ void testIm2col() { if (paddle::platform::is_cpu_place(*place)) { out_ocf_ptr = output_ocf.data(); } else { - Copy(output_ocf, paddle::platform::CPUPlace(), *context, &output_tmp); + TensorCopy(output_ocf, paddle::platform::CPUPlace(), *context, &output_tmp); out_ocf_ptr = output_tmp.data(); } @@ -119,7 +119,7 @@ void testIm2col() { if (paddle::platform::is_cpu_place(*place)) { input = input_tmp; } else { - Copy(input_tmp, *place, *context, &input); + TensorCopy(input_tmp, *place, *context, &input); } col2im(*context, output_cfo, dilation, stride, padding, &input); @@ -128,7 +128,7 @@ void testIm2col() { if (paddle::platform::is_cpu_place(*place)) { in_ptr = input.data(); } else { - Copy(input, paddle::platform::CPUPlace(), *context, &input_tmp); + TensorCopy(input, paddle::platform::CPUPlace(), *context, &input_tmp); in_ptr = input_tmp.data(); } for (int i = 0; i < 6; ++i) { @@ -140,7 +140,7 @@ void testIm2col() { if (paddle::platform::is_cpu_place(*place)) { input = input_tmp; } else { - Copy(input_tmp, *place, *context, &input); + TensorCopy(input_tmp, *place, *context, &input); } col2im_ocf(*context, output_ocf, dilation, stride, padding, &input); @@ -148,7 +148,7 @@ void testIm2col() { if (paddle::platform::is_cpu_place(*place)) { in_ptr = input.data(); } else { - Copy(input, paddle::platform::CPUPlace(), *context, &input_tmp); + TensorCopy(input, paddle::platform::CPUPlace(), *context, &input_tmp); in_ptr = input_tmp.data(); } for (int i = 0; i < 6; ++i) { diff --git a/paddle/fluid/operators/math/lstm_compute.cc b/paddle/fluid/operators/math/lstm_compute.cc index 09eb89ec58d107f547a5c83908a9d2a541aa95f4..b6882b4fd8e6db8592a282410888d5625bae742a 100644 --- a/paddle/fluid/operators/math/lstm_compute.cc +++ b/paddle/fluid/operators/math/lstm_compute.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/lstm_compute.cu b/paddle/fluid/operators/math/lstm_compute.cu index adedee28bd010c611b9c6901c55bf67e73d3639b..1233000083d6efc31fcbc527e8e9efb83224b4e3 100644 --- a/paddle/fluid/operators/math/lstm_compute.cu +++ b/paddle/fluid/operators/math/lstm_compute.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/lstm_compute.h b/paddle/fluid/operators/math/lstm_compute.h index 8610e96cf1abb0e5a64cd60c6bab3a8c08754587..ca2f78e6f318ce39bd2272bbce20f6a6f98fe430 100644 --- a/paddle/fluid/operators/math/lstm_compute.h +++ b/paddle/fluid/operators/math/lstm_compute.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/math_function.cc b/paddle/fluid/operators/math/math_function.cc index 2636dbddde67955a99663aa93df1425b9e1ec2ce..41eab3ade207a592e1a72cd22580f18723167eff 100644 --- a/paddle/fluid/operators/math/math_function.cc +++ b/paddle/fluid/operators/math/math_function.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/math_function.cu b/paddle/fluid/operators/math/math_function.cu index 5764da71c8491e27493774569bb663f6a6e835c3..f8d0349ac5cd96791bcb508230f5ff6d594c0e05 100644 --- a/paddle/fluid/operators/math/math_function.cu +++ b/paddle/fluid/operators/math/math_function.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/math_function.h b/paddle/fluid/operators/math/math_function.h index 84916af1f8e5bd55920685b4897858f2da9fde92..47e2386d0578265330088eeac6c57fe2518f951a 100644 --- a/paddle/fluid/operators/math/math_function.h +++ b/paddle/fluid/operators/math/math_function.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/math_function_impl.h b/paddle/fluid/operators/math/math_function_impl.h index a55ed6c58bafafed1d58ff47fb433a9ae58b8261..f9d4e4532428e3387ae39621d155434f05eb89d3 100644 --- a/paddle/fluid/operators/math/math_function_impl.h +++ b/paddle/fluid/operators/math/math_function_impl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/math_function_test.cc b/paddle/fluid/operators/math/math_function_test.cc index 6cd8e8b35abeb6d321bb075d7b88f0abd8f0fc59..25a9d0111eee45b28adff012b705cbfa2407d2b6 100644 --- a/paddle/fluid/operators/math/math_function_test.cc +++ b/paddle/fluid/operators/math/math_function_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/math_function_test.cu b/paddle/fluid/operators/math/math_function_test.cu index 2ef53a8209940e52390cfe52978f3b32b6dabae6..207d6a87bce178e446253ae2d880b6dd743cfc83 100644 --- a/paddle/fluid/operators/math/math_function_test.cu +++ b/paddle/fluid/operators/math/math_function_test.cu @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -29,15 +29,15 @@ TEST(math_function, notrans_mul_trans) { auto* gpu_place = new paddle::platform::CUDAPlace(0); paddle::platform::CUDADeviceContext context(*gpu_place); - paddle::framework::Copy(input1, *gpu_place, context, &input1_gpu); - paddle::framework::Copy(input1, *gpu_place, context, &input2_gpu); + paddle::framework::TensorCopy(input1, *gpu_place, context, &input1_gpu); + paddle::framework::TensorCopy(input1, *gpu_place, context, &input2_gpu); out_gpu.mutable_data({2, 2}, *gpu_place); paddle::operators::math::matmul( context, input1_gpu, false, input2_gpu, true, 1, &out_gpu, 0); - paddle::framework::Copy(out_gpu, *cpu_place, context, &out); + paddle::framework::TensorCopy(out_gpu, *cpu_place, context, &out); float* out_ptr = out.data(); context.Wait(); @@ -63,15 +63,15 @@ TEST(math_function, trans_mul_notrans) { auto* gpu_place = new paddle::platform::CUDAPlace(0); paddle::platform::CUDADeviceContext context(*gpu_place); - paddle::framework::Copy(input1, *gpu_place, context, &input1_gpu); - paddle::framework::Copy(input1, *gpu_place, context, &input2_gpu); + paddle::framework::TensorCopy(input1, *gpu_place, context, &input1_gpu); + paddle::framework::TensorCopy(input1, *gpu_place, context, &input2_gpu); out_gpu.mutable_data({3, 3}, *gpu_place); paddle::operators::math::matmul( context, input1_gpu, true, input2_gpu, false, 1, &out_gpu, 0); - paddle::framework::Copy(out_gpu, *cpu_place, context, &out); + paddle::framework::TensorCopy(out_gpu, *cpu_place, context, &out); float* out_ptr = out.data(); context.Wait(); @@ -112,9 +112,9 @@ TEST(math_function, gemm_notrans_cublas) { auto* gpu_place = new paddle::platform::CUDAPlace(0); paddle::platform::CUDADeviceContext context(*gpu_place); - paddle::framework::Copy(input1, *gpu_place, context, &input1_gpu); - paddle::framework::Copy(input2, *gpu_place, context, &input2_gpu); - paddle::framework::Copy(input3, *gpu_place, context, &input3_gpu); + paddle::framework::TensorCopy(input1, *gpu_place, context, &input1_gpu); + paddle::framework::TensorCopy(input2, *gpu_place, context, &input2_gpu); + paddle::framework::TensorCopy(input3, *gpu_place, context, &input3_gpu); float* a = input1_gpu.data(); float* b = input2_gpu.data(); float* c = input3_gpu.mutable_data(*gpu_place); @@ -122,7 +122,7 @@ TEST(math_function, gemm_notrans_cublas) { paddle::operators::math::gemm( context, false, false, m, n, k, 1, a, 3, b + 1, 4, 1, c + 1, 4); - paddle::framework::Copy(input3_gpu, *cpu_place, context, &input3); + paddle::framework::TensorCopy(input3_gpu, *cpu_place, context, &input3); // numpy code: // a = np.arange(6).reshape(2, 3) @@ -167,9 +167,9 @@ TEST(math_function, gemm_trans_cublas) { auto* gpu_place = new paddle::platform::CUDAPlace(0); paddle::platform::CUDADeviceContext context(*gpu_place); - paddle::framework::Copy(input1, *gpu_place, context, &input1_gpu); - paddle::framework::Copy(input2, *gpu_place, context, &input2_gpu); - paddle::framework::Copy(input3, *gpu_place, context, &input3_gpu); + paddle::framework::TensorCopy(input1, *gpu_place, context, &input1_gpu); + paddle::framework::TensorCopy(input2, *gpu_place, context, &input2_gpu); + paddle::framework::TensorCopy(input3, *gpu_place, context, &input3_gpu); float* a = input1_gpu.data(); float* b = input2_gpu.data(); float* c = input3_gpu.mutable_data(*gpu_place); @@ -177,7 +177,7 @@ TEST(math_function, gemm_trans_cublas) { paddle::operators::math::gemm( context, false, true, m, n, k, 1, a, 3, b + 3, 3, 1, c + 1, 4); - paddle::framework::Copy(input3_gpu, *cpu_place, context, &input3); + paddle::framework::TensorCopy(input3_gpu, *cpu_place, context, &input3); context.Wait(); EXPECT_EQ(input3_ptr[0], 0); @@ -218,15 +218,15 @@ void GemvTest(int m, int n, bool trans) { } paddle::platform::CUDADeviceContext context(*gpu_place); - paddle::framework::Copy(mat_a, *gpu_place, context, &g_mat_a); - paddle::framework::Copy(vec_b, *gpu_place, context, &g_vec_b); + paddle::framework::TensorCopy(mat_a, *gpu_place, context, &g_mat_a); + paddle::framework::TensorCopy(vec_b, *gpu_place, context, &g_vec_b); paddle::operators::math::gemv( context, trans, static_cast(m), static_cast(n), 1., g_data_a, g_data_b, 0., g_data_c); - paddle::framework::Copy(g_vec_c, paddle::platform::CPUPlace(), context, - &vec_c); + paddle::framework::TensorCopy(g_vec_c, paddle::platform::CPUPlace(), context, + &vec_c); if (!trans) { for (int i = 0; i < m; ++i) { diff --git a/paddle/fluid/operators/math/matmul.h b/paddle/fluid/operators/math/matmul.h index 50f79979d99141c8074c55d2b767285dced49f60..6e2d35cd0f3581c742197a66842696a8e3a936b1 100644 --- a/paddle/fluid/operators/math/matmul.h +++ b/paddle/fluid/operators/math/matmul.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/maxouting.cc b/paddle/fluid/operators/math/maxouting.cc index 746328cd45ada637132ac661c87f4ac4710aeaa4..730f71e96b63d16b2da0bd1412d7e07fe1861d0a 100644 --- a/paddle/fluid/operators/math/maxouting.cc +++ b/paddle/fluid/operators/math/maxouting.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/maxouting.cu b/paddle/fluid/operators/math/maxouting.cu index 68e5dfc3c551958c1f201341b8a704d9306ef150..1e1a6a221c71c9d9cb9fda468360cb502c5ea52f 100644 --- a/paddle/fluid/operators/math/maxouting.cu +++ b/paddle/fluid/operators/math/maxouting.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 paddlepaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 paddlepaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/maxouting.h b/paddle/fluid/operators/math/maxouting.h index 0e81790f0aba422f6676cd329def95a642a12239..4166fb54946b7082f5f7dc0e232f636a1d2f8a13 100644 --- a/paddle/fluid/operators/math/maxouting.h +++ b/paddle/fluid/operators/math/maxouting.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/pooling.cc b/paddle/fluid/operators/math/pooling.cc index 9adb142f14ea984c598855cf30838f0a1f2e5015..97a2e81c84c060a8be57db6274839ee39edf466c 100644 --- a/paddle/fluid/operators/math/pooling.cc +++ b/paddle/fluid/operators/math/pooling.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/pooling.cu b/paddle/fluid/operators/math/pooling.cu index c65632de9066251a94ab3c32d4382d44f4120c2a..274263c69c535249fceee11075c5948b1fc34358 100644 --- a/paddle/fluid/operators/math/pooling.cu +++ b/paddle/fluid/operators/math/pooling.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 paddlepaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 paddlepaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/pooling.h b/paddle/fluid/operators/math/pooling.h index 1195038f6a067fde776df8013a2a81e7003489a1..74cb42f0d02086a6776b22d57832757ae3ffc470 100644 --- a/paddle/fluid/operators/math/pooling.h +++ b/paddle/fluid/operators/math/pooling.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sampler.cc b/paddle/fluid/operators/math/sampler.cc index 4f1cbfe31ac68499a51eda600b38b879f7ca055f..3ec6538d7fb0a902f468aa848c3064bd0260fabb 100644 --- a/paddle/fluid/operators/math/sampler.cc +++ b/paddle/fluid/operators/math/sampler.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sampler.h b/paddle/fluid/operators/math/sampler.h index 8f82089e7bd9e0ae6282459b650c225d6765faee..9d6a6c28c4304019d0347a30be605e1374c169ee 100644 --- a/paddle/fluid/operators/math/sampler.h +++ b/paddle/fluid/operators/math/sampler.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/selected_rows_functor.cc b/paddle/fluid/operators/math/selected_rows_functor.cc index 01aa37ab35ce906133f6195df5d7014b4fb23d16..5da3d15277cff8b413a116819b17f50061632b5d 100644 --- a/paddle/fluid/operators/math/selected_rows_functor.cc +++ b/paddle/fluid/operators/math/selected_rows_functor.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/selected_rows_functor.cu b/paddle/fluid/operators/math/selected_rows_functor.cu index ee3b5d52058f7f04d5eeda1d033171f9eae0d772..5d78fd9d213556204d56087128dc84fe6a91e97d 100644 --- a/paddle/fluid/operators/math/selected_rows_functor.cu +++ b/paddle/fluid/operators/math/selected_rows_functor.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/selected_rows_functor.h b/paddle/fluid/operators/math/selected_rows_functor.h index 510a9ed8be6336448971de305279f607282f7658..18304f83f8706f822ce628e2374b00a71f1cc171 100644 --- a/paddle/fluid/operators/math/selected_rows_functor.h +++ b/paddle/fluid/operators/math/selected_rows_functor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/selected_rows_functor_test.cc b/paddle/fluid/operators/math/selected_rows_functor_test.cc index db6b41cd52049a32239eca1a39cd730c11ddc2d8..679b6568ad09ce3a42a7ad4222310711e707d9a8 100644 --- a/paddle/fluid/operators/math/selected_rows_functor_test.cc +++ b/paddle/fluid/operators/math/selected_rows_functor_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/selected_rows_functor_test.cu b/paddle/fluid/operators/math/selected_rows_functor_test.cu index b3c4bc9244f9ca1771c5f435788cf3789d7c4574..942d9b13fc1a8f578da779351be9ba9de7fcce33 100644 --- a/paddle/fluid/operators/math/selected_rows_functor_test.cu +++ b/paddle/fluid/operators/math/selected_rows_functor_test.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ TEST(selected_rows_functor, gpu_add) { EXPECT_EQ(out_rows[6], 9); Tensor out_cpu; - Copy(*out_value, cpu_place, ctx, &out_cpu); + TensorCopy(*out_value, cpu_place, ctx, &out_cpu); ctx.Wait(); auto* out_cpu_data = out_cpu.data(); @@ -94,7 +94,7 @@ TEST(selected_rows_functor, gpu_add) { add_tensor_functor(ctx, *output, *tensor1, tensor2.get()); Tensor tensor2_cpu; - Copy(*tensor2, cpu_place, ctx, &tensor2_cpu); + TensorCopy(*tensor2, cpu_place, ctx, &tensor2_cpu); ctx.Wait(); auto* tensor2_cpu_data = tensor2_cpu.data(); @@ -167,7 +167,7 @@ TEST(selected_rows_functor, gpu_add_to) { EXPECT_EQ(out_rows[6], 9); Tensor out_cpu; - Copy(*out_value, cpu_place, ctx, &out_cpu); + TensorCopy(*out_value, cpu_place, ctx, &out_cpu); ctx.Wait(); auto* out_cpu_data = out_cpu.data(); @@ -191,7 +191,7 @@ TEST(selected_rows_functor, gpu_add_to) { add_to_tensor_functor(ctx, *output, tensor1.get()); Tensor tensor1_cpu; - Copy(*tensor1, cpu_place, ctx, &tensor1_cpu); + TensorCopy(*tensor1, cpu_place, ctx, &tensor1_cpu); ctx.Wait(); auto* tensor1_cpu_data = tensor1_cpu.data(); diff --git a/paddle/fluid/operators/math/sequence2batch.cc b/paddle/fluid/operators/math/sequence2batch.cc index 0485070fd9b722bdf9011452b2545e065f46d2ac..72bf2ab17016157f22bcf180090660346ed4f60d 100644 --- a/paddle/fluid/operators/math/sequence2batch.cc +++ b/paddle/fluid/operators/math/sequence2batch.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence2batch.cu b/paddle/fluid/operators/math/sequence2batch.cu index 450be80ea2fe67aa0e537f06e15f07b38c5751ea..3185f10d4180437ab5a3f78df8583613edd9ed43 100644 --- a/paddle/fluid/operators/math/sequence2batch.cu +++ b/paddle/fluid/operators/math/sequence2batch.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence2batch.h b/paddle/fluid/operators/math/sequence2batch.h index 00bd25ab613b198e539368f3233d71618dfc758f..e78aafd37d1dda91a035f3ed850537e80f188cb2 100644 --- a/paddle/fluid/operators/math/sequence2batch.h +++ b/paddle/fluid/operators/math/sequence2batch.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence_padding.cc b/paddle/fluid/operators/math/sequence_padding.cc index ad8cd825676c77cc204bbb02f88f422d945f1a2c..38bd3b99758555a24b3b8eb0de06cca8e424fcb2 100644 --- a/paddle/fluid/operators/math/sequence_padding.cc +++ b/paddle/fluid/operators/math/sequence_padding.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence_padding.cu b/paddle/fluid/operators/math/sequence_padding.cu index c1a390577840db2424185da19f5a5d2b231f25b6..c044e6fc32bab8f72a0dce45b4abdb1174a0d72f 100644 --- a/paddle/fluid/operators/math/sequence_padding.cu +++ b/paddle/fluid/operators/math/sequence_padding.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -97,7 +97,7 @@ class PaddingLoDTensorFunctor { "width of sequence in LoDTensor seq."); if (!norm_by_times && num_sequences == 1UL) { - Copy(seq, context.GetPlace(), context, &padding); + TensorCopy(seq, context.GetPlace(), context, &padding); padding.Resize(padding_dims); return; } @@ -172,7 +172,7 @@ class UnpaddingLoDTensorFunctor { "width of sequence in LoDTensor seq."); if (!norm_by_times && num_sequences == 1UL) { - Copy(padding, context.GetPlace(), context, &seq); + TensorCopy(padding, context.GetPlace(), context, &seq); seq.Resize(seq_dims); return; } diff --git a/paddle/fluid/operators/math/sequence_padding.h b/paddle/fluid/operators/math/sequence_padding.h index 0d84f9dcb3802d82cd385957f66ffe28269b8dfc..17f044b9d6667ed6a45bf5a0c2362c351d2c2beb 100644 --- a/paddle/fluid/operators/math/sequence_padding.h +++ b/paddle/fluid/operators/math/sequence_padding.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence_padding_test.cc b/paddle/fluid/operators/math/sequence_padding_test.cc index 147cb37da2bbb1bad6fc423b3936a1446e17de15..bece46e75374cc38512d77c9d6b2fc6584e39db2 100644 --- a/paddle/fluid/operators/math/sequence_padding_test.cc +++ b/paddle/fluid/operators/math/sequence_padding_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ void TestSequencePadding(const paddle::framework::LoD& lod, if (paddle::platform::is_cpu_place(*place)) { seq = cpu_seq; } else { - Copy(cpu_seq, *place, *context, &seq); + TensorCopy(cpu_seq, *place, *context, &seq); seq.set_lod(lod); } @@ -63,7 +63,7 @@ void TestSequencePadding(const paddle::framework::LoD& lod, if (paddle::platform::is_cpu_place(*place)) { cpu_seq_back = seq_back; } else { - Copy(seq_back, paddle::platform::CPUPlace(), *context, &cpu_seq_back); + TensorCopy(seq_back, paddle::platform::CPUPlace(), *context, &cpu_seq_back); cpu_seq_back.set_lod(lod); } diff --git a/paddle/fluid/operators/math/sequence_pooling.cc b/paddle/fluid/operators/math/sequence_pooling.cc index b3b87ec93e19c4dcf99fbacf8f882f9f065430de..f7a6f2bdf4e3b7896df39acfa51fa20577b20f3b 100644 --- a/paddle/fluid/operators/math/sequence_pooling.cc +++ b/paddle/fluid/operators/math/sequence_pooling.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence_pooling.cu b/paddle/fluid/operators/math/sequence_pooling.cu index c4267e992a78fd7e80a45ca1dcc1d81ca0f6e8f5..d61407c020142f046f41f71a56702fd6106df628 100644 --- a/paddle/fluid/operators/math/sequence_pooling.cu +++ b/paddle/fluid/operators/math/sequence_pooling.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence_pooling.h b/paddle/fluid/operators/math/sequence_pooling.h index 9ba9cad74b54b3d0835ba5f89f6498f9309875cc..ecb76884f670df1aee64ed65c3bb0cf09c5beaff 100644 --- a/paddle/fluid/operators/math/sequence_pooling.h +++ b/paddle/fluid/operators/math/sequence_pooling.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence_scale.cc b/paddle/fluid/operators/math/sequence_scale.cc index 427689b9718db6ed8cbb8525712404c1498faf20..2c46d4183b5ccd6db909e4142797f97a626c43d5 100644 --- a/paddle/fluid/operators/math/sequence_scale.cc +++ b/paddle/fluid/operators/math/sequence_scale.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence_scale.cu b/paddle/fluid/operators/math/sequence_scale.cu index 7c081ed7f4547c4e1200ea7554f83696e404d021..74085153c62354771f6126b58746229b5564f2d0 100644 --- a/paddle/fluid/operators/math/sequence_scale.cu +++ b/paddle/fluid/operators/math/sequence_scale.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/sequence_scale.h b/paddle/fluid/operators/math/sequence_scale.h index e8e07fd3156cc516c904a1d3d510a7c6eed5b8a0..6cdcbe21cbf82881679d90de470f342f75b3e2f3 100644 --- a/paddle/fluid/operators/math/sequence_scale.h +++ b/paddle/fluid/operators/math/sequence_scale.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/softmax.cc b/paddle/fluid/operators/math/softmax.cc index eab31ec567d15a52661bf5ab2373819d8e1e7ddf..78c65af24a8c5fa57e33415acc3018790bf70790 100644 --- a/paddle/fluid/operators/math/softmax.cc +++ b/paddle/fluid/operators/math/softmax.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/softmax.cu b/paddle/fluid/operators/math/softmax.cu index 733d7eeee6d08241783b8f854b25863f9b756c80..38e93fdf15d99eb447948378a599891074c10fc5 100644 --- a/paddle/fluid/operators/math/softmax.cu +++ b/paddle/fluid/operators/math/softmax.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/softmax.h b/paddle/fluid/operators/math/softmax.h index b7d67d5f12d83f015297e75c730de27566e5489b..14b2690c2a4e764058270953214a07aee8053444 100644 --- a/paddle/fluid/operators/math/softmax.h +++ b/paddle/fluid/operators/math/softmax.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/softmax_impl.h b/paddle/fluid/operators/math/softmax_impl.h index f7c61cb647e899e25f3d9806c993395e898794ab..3e123f7bf5512618538fd35aa7e74b82586a5448 100644 --- a/paddle/fluid/operators/math/softmax_impl.h +++ b/paddle/fluid/operators/math/softmax_impl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/unpooling.cc b/paddle/fluid/operators/math/unpooling.cc index e02bc02e0022b82085e29ac6c83677c0accfce49..13f0845bb8579615381c06072eb1e32507ffd3cf 100644 --- a/paddle/fluid/operators/math/unpooling.cc +++ b/paddle/fluid/operators/math/unpooling.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/unpooling.cu b/paddle/fluid/operators/math/unpooling.cu index 2e74270fdf16b470ab6438a3283525c725b2d01b..367f343d51712d38edbb7eb50b41433258cf8c9d 100644 --- a/paddle/fluid/operators/math/unpooling.cu +++ b/paddle/fluid/operators/math/unpooling.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 paddlepaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 paddlepaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/unpooling.h b/paddle/fluid/operators/math/unpooling.h index f245ba7ba873e7f217c577e0c895f9a8d48e9cdf..74ca39d114e266be3ed8278f5e941d685c7b0d3d 100644 --- a/paddle/fluid/operators/math/unpooling.h +++ b/paddle/fluid/operators/math/unpooling.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/vol2col.cc b/paddle/fluid/operators/math/vol2col.cc index ded0bbc74477656310cb4d464c5709173f20f505..09e9f85cca349be1dc46a3f3a0b2d919485d6fa1 100644 --- a/paddle/fluid/operators/math/vol2col.cc +++ b/paddle/fluid/operators/math/vol2col.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/vol2col.cu b/paddle/fluid/operators/math/vol2col.cu index 35ef24c7f5ffe793a4aefe69807da5ffcf5ced4a..619730d394d075d05a016e421fd75c4549015216 100644 --- a/paddle/fluid/operators/math/vol2col.cu +++ b/paddle/fluid/operators/math/vol2col.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/vol2col.h b/paddle/fluid/operators/math/vol2col.h index 3ce38b2d11f7c64f1004a73ecfc7d85a5a6346ba..dbc2ed7a6939cfb5dca61082decb8960e5f9ebda 100644 --- a/paddle/fluid/operators/math/vol2col.h +++ b/paddle/fluid/operators/math/vol2col.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/math/vol2col_test.cc b/paddle/fluid/operators/math/vol2col_test.cc index af0a900f80e9bec2c5cfd0ec7dc66beabba049d7..eb91f862e39d9f158200f69fd48e7245dde47171 100644 --- a/paddle/fluid/operators/math/vol2col_test.cc +++ b/paddle/fluid/operators/math/vol2col_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ void testVol2col() { if (paddle::platform::is_cpu_place(*place)) { input = input_tmp; } else { - Copy(input_tmp, *place, *context, &input); + paddle::framework::TensorCopy(input_tmp, *place, *context, &input); } output.mutable_data({1, filter_size, filter_size, filter_size, output_depth, output_height, output_width}, @@ -85,7 +85,7 @@ void testVol2col() { if (paddle::platform::is_cpu_place(*place)) { out_cfo_ptr = output.data(); } else { - Copy(output, paddle::platform::CPUPlace(), *context, &output_tmp); + TensorCopy(output, paddle::platform::CPUPlace(), *context, &output_tmp); out_cfo_ptr = output_tmp.data(); } @@ -99,7 +99,7 @@ void testVol2col() { if (paddle::platform::is_cpu_place(*place)) { input = input_tmp; } else { - Copy(input_tmp, *place, *context, &input); + TensorCopy(input_tmp, *place, *context, &input); } paddle::operators::math::Col2VolFunctor col2vol; @@ -109,7 +109,7 @@ void testVol2col() { if (paddle::platform::is_cpu_place(*place)) { in_ptr = input.data(); } else { - Copy(input, paddle::platform::CPUPlace(), *context, &input_tmp); + TensorCopy(input, paddle::platform::CPUPlace(), *context, &input_tmp); in_ptr = input_tmp.data(); } diff --git a/paddle/fluid/operators/matmul_op.cc b/paddle/fluid/operators/matmul_op.cc index 267b0057bf4894705b7e6eddb8e2e2eaa5c18c8e..85855928521b8b4cc5e8746b0b5f841cc2587618 100644 --- a/paddle/fluid/operators/matmul_op.cc +++ b/paddle/fluid/operators/matmul_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/matmul_op.cu.cc b/paddle/fluid/operators/matmul_op.cu.cc index 988787f0fe40ccdb266327dbff400a72f5dc448b..e021bbe645399e410cde5c3ff7035d4d68c71744 100644 --- a/paddle/fluid/operators/matmul_op.cu.cc +++ b/paddle/fluid/operators/matmul_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/matmul_op.h b/paddle/fluid/operators/matmul_op.h index f4cae3c91cb03980b915a70242e368852322b365..1cd8fe55dcbd23eae771550a363bf0a07e9bf585 100644 --- a/paddle/fluid/operators/matmul_op.h +++ b/paddle/fluid/operators/matmul_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/max_sequence_len_op.cc b/paddle/fluid/operators/max_sequence_len_op.cc index cef0dc307dbe97473e9041f51c25eca7cc9a0f1a..4cd7c89b48a2442ee7a5074abbf0f3dd9ea3bcb4 100644 --- a/paddle/fluid/operators/max_sequence_len_op.cc +++ b/paddle/fluid/operators/max_sequence_len_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/maxout_op.cc b/paddle/fluid/operators/maxout_op.cc index 8ce12cd4c4d93327dfcf9eb40ae1ff429f703419..efaae7d5f2d20484d90f79d9e13ec2f5ed6e06c9 100644 --- a/paddle/fluid/operators/maxout_op.cc +++ b/paddle/fluid/operators/maxout_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/maxout_op.cu.cc b/paddle/fluid/operators/maxout_op.cu.cc index f3f45c90cde754bcbf985092c5cbf31f134a2eee..be1e81bb869a3a5144b72ef54af22f75b2146bc5 100644 --- a/paddle/fluid/operators/maxout_op.cu.cc +++ b/paddle/fluid/operators/maxout_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/maxout_op.h b/paddle/fluid/operators/maxout_op.h index e5de3e3760b99c9bde9dd86e8851dc2f65e4b2d2..5b9e003cb0978d400d8386f2ff492a83332d5e78 100644 --- a/paddle/fluid/operators/maxout_op.h +++ b/paddle/fluid/operators/maxout_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/mean_op.cc b/paddle/fluid/operators/mean_op.cc index 1043820345a21cc3a7bbdf45d2914f9319c8e708..a134796bfcaa9dea2483ace9f5045e257916daba 100644 --- a/paddle/fluid/operators/mean_op.cc +++ b/paddle/fluid/operators/mean_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/mean_op.cu b/paddle/fluid/operators/mean_op.cu index ccf2248760a551174953b8b55dc9a69454074885..91e0ab28efc21d4376524c8ecf66b429d51d8847 100644 --- a/paddle/fluid/operators/mean_op.cu +++ b/paddle/fluid/operators/mean_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/mean_op.h b/paddle/fluid/operators/mean_op.h index ae162287da6a5b9e826dec9552262e73468ee58a..362e9f9ae8b2f0f77198e3f3939211ae1117b27b 100644 --- a/paddle/fluid/operators/mean_op.h +++ b/paddle/fluid/operators/mean_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/merge_lod_tensor_op.cc b/paddle/fluid/operators/merge_lod_tensor_op.cc index 88e67b6b86a3731cc2caf5529aa4892c6d605a86..4ebf20cbba69bee09dfddb8e928ddc95665e4731 100644 --- a/paddle/fluid/operators/merge_lod_tensor_op.cc +++ b/paddle/fluid/operators/merge_lod_tensor_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -51,7 +51,8 @@ class MergeLoDTensorOp : public framework::OperatorBase { cpu_mask->ShareDataWith(mask); } else if (platform::is_gpu_place(mask.place())) { #ifdef PADDLE_WITH_CUDA - framework::Copy(mask, platform::CPUPlace(), dev_ctx, cpu_mask.get()); + framework::TensorCopy(mask, platform::CPUPlace(), dev_ctx, + cpu_mask.get()); #else PADDLE_THROW("Not supported GPU, Please compile WITH_GPU option"); #endif @@ -106,8 +107,8 @@ class MergeLoDTensorOp : public framework::OperatorBase { continue; } auto slice = out->Slice(out_offset, out_offset + len); - framework::Copy(input->Slice(start_offset, end_offset), place, dev_ctx, - &slice); + framework::TensorCopy(input->Slice(start_offset, end_offset), place, + dev_ctx, &slice); out_offset += len; (*in_idx) += 1; } diff --git a/paddle/fluid/operators/mine_hard_examples_op.cc b/paddle/fluid/operators/mine_hard_examples_op.cc index 73a6c0b679310ac4108a915836b5ed497853b38b..b7e9f4e2248882103a3926c309d6fc455442c917 100644 --- a/paddle/fluid/operators/mine_hard_examples_op.cc +++ b/paddle/fluid/operators/mine_hard_examples_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -67,7 +67,8 @@ class MineHardExamplesKernel : public framework::OpKernel { auto out_match_indices = ctx.Output("UpdatedMatchIndices"); - framework::Copy(*in_matched_indices, ctx.GetPlace(), out_match_indices); + framework::TensorCopy(*in_matched_indices, ctx.GetPlace(), + out_match_indices); int batch_size = in_matched_indices->dims()[0]; int prior_num = in_matched_indices->dims()[1]; @@ -237,6 +238,8 @@ class MineHardExamplesOp : public framework::OperatorWithKernel { } ctx->SetOutputDim("UpdatedMatchIndices", idx_dims); + // The first dimension of NegIndices will be set correcttly in Compute. + ctx->SetOutputDim("NegIndices", {-1, 1}); } protected: diff --git a/paddle/fluid/operators/minus_op.cc b/paddle/fluid/operators/minus_op.cc index 8a35d668ccfa8a95cd41c4a943aad6ff915cc7dd..7de9d94979fdc3f3352c556cc8b655ad4bc7e201 100644 --- a/paddle/fluid/operators/minus_op.cc +++ b/paddle/fluid/operators/minus_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/minus_op.cu b/paddle/fluid/operators/minus_op.cu index ce0b1fdc0419fead915511581270fb9984df9dc5..956d935da9b96696e9148fc4dfab23a6a6c29016 100644 --- a/paddle/fluid/operators/minus_op.cu +++ b/paddle/fluid/operators/minus_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/minus_op.h b/paddle/fluid/operators/minus_op.h index dc94cbbeca264536669716beb5318432ba9689a4..7791b1456a81516e48db645501c717d9c4cf8749 100644 --- a/paddle/fluid/operators/minus_op.h +++ b/paddle/fluid/operators/minus_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/modified_huber_loss_op.cc b/paddle/fluid/operators/modified_huber_loss_op.cc index f2d16531658d42556756e75895b7250a529f13df..a8fbd48c4da5b2d0585688e3100f9fe62ac5aa1f 100644 --- a/paddle/fluid/operators/modified_huber_loss_op.cc +++ b/paddle/fluid/operators/modified_huber_loss_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/modified_huber_loss_op.cu b/paddle/fluid/operators/modified_huber_loss_op.cu index 69ac2b1ed546a4755cd4e8d52a7f8b98b4f0e7b9..71bfacb9283850d4fb2939a6380594fcf1c0cfbb 100644 --- a/paddle/fluid/operators/modified_huber_loss_op.cu +++ b/paddle/fluid/operators/modified_huber_loss_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/modified_huber_loss_op.h b/paddle/fluid/operators/modified_huber_loss_op.h index a470a45e13b55a33a8485cac2038ce1cc761a3f3..d2b6d0c4bab1619f10f68bd9bf22f975c4c2dfd7 100644 --- a/paddle/fluid/operators/modified_huber_loss_op.h +++ b/paddle/fluid/operators/modified_huber_loss_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/momentum_op.cc b/paddle/fluid/operators/momentum_op.cc index a3950ac99da93687596f62c6f020f4add1fb04ba..6c70970e15f0d63ebe2134c6bc8163339ba30e75 100644 --- a/paddle/fluid/operators/momentum_op.cc +++ b/paddle/fluid/operators/momentum_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/momentum_op.cu b/paddle/fluid/operators/momentum_op.cu index 28a14cd4b219b86ba4922a3485b99c2c861a74d9..da4a6af298f61a20e60ff1b8358f30bb0aca2280 100644 --- a/paddle/fluid/operators/momentum_op.cu +++ b/paddle/fluid/operators/momentum_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/momentum_op.h b/paddle/fluid/operators/momentum_op.h index fdab86b24eefe15b85f4ca6a49e54ea67c1e7bdf..04a1929b84a93af6465bacfe7974a1530296946d 100644 --- a/paddle/fluid/operators/momentum_op.h +++ b/paddle/fluid/operators/momentum_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/mul_op.cc b/paddle/fluid/operators/mul_op.cc index c9375d8ea1297f5201b6294f61119f6b5603d988..e7bed2c39735b66c19e738c91f4977e46571143b 100644 --- a/paddle/fluid/operators/mul_op.cc +++ b/paddle/fluid/operators/mul_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/mul_op.cu.cc b/paddle/fluid/operators/mul_op.cu.cc index 6f605fd84fb802a079f9ed13afc032cc2d6c2b0c..0667530e943856576ae8c9fe4856cb6aa1448e4e 100644 --- a/paddle/fluid/operators/mul_op.cu.cc +++ b/paddle/fluid/operators/mul_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/mul_op.h b/paddle/fluid/operators/mul_op.h index 745989f07f3646ab5d59f3d292030f3eb52dac49..38311cf87265ad0f1f815734cbf69bd682d62e62 100644 --- a/paddle/fluid/operators/mul_op.h +++ b/paddle/fluid/operators/mul_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/multiclass_nms_op.cc b/paddle/fluid/operators/multiclass_nms_op.cc index 168e6f85d6ac9f8d6522afe871d82e708da63227..2565e7e9efad415c5e4db2489afa9553683b7b0a 100644 --- a/paddle/fluid/operators/multiclass_nms_op.cc +++ b/paddle/fluid/operators/multiclass_nms_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/multiplex_op.cc b/paddle/fluid/operators/multiplex_op.cc index f89b00376ba7a759419fa60efe80575b6a8d1f2e..b698c1bf8a05e053db07db34712a13c8074ee4d0 100644 --- a/paddle/fluid/operators/multiplex_op.cc +++ b/paddle/fluid/operators/multiplex_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/multiplex_op.cu b/paddle/fluid/operators/multiplex_op.cu index 3ef7ef1dfcd04d59573bc6c726fef757f5f2ce23..45a2550793511f7cb8c20644ac79e9e88629ce7b 100644 --- a/paddle/fluid/operators/multiplex_op.cu +++ b/paddle/fluid/operators/multiplex_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ class MultiplexGPUKernel : public framework::OpKernel { auto cols = ins[0]->numel() / rows; // copy index to cpu Tensor index_t_cpu; - Copy(*ids, platform::CPUPlace(), ctx.device_context(), &index_t_cpu); + TensorCopy(*ids, platform::CPUPlace(), ctx.device_context(), &index_t_cpu); auto* index = index_t_cpu.data(); auto stream = ctx.cuda_device_context().stream(); platform::CUDAPlace place = boost::get(ctx.GetPlace()); @@ -69,7 +69,7 @@ class MultiplexGradGPUKernel : public framework::OpKernel { auto cols = ins[0]->numel() / rows; // copy index to cpu Tensor index_t_cpu; - Copy(*ids, platform::CPUPlace(), ctx.device_context(), &index_t_cpu); + TensorCopy(*ids, platform::CPUPlace(), ctx.device_context(), &index_t_cpu); auto* index = index_t_cpu.data(); auto stream = ctx.cuda_device_context().stream(); diff --git a/paddle/fluid/operators/multiplex_op.h b/paddle/fluid/operators/multiplex_op.h index 682117cb1b4581560d6b4a615d97e2d18a91ffd6..87de000971941c39ee84e1bca46e2cd18e262fd8 100644 --- a/paddle/fluid/operators/multiplex_op.h +++ b/paddle/fluid/operators/multiplex_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/nccl/nccl_gpu_common.cc b/paddle/fluid/operators/nccl/nccl_gpu_common.cc index 2a8ce932ec51a3d85ef04a2c07e08186929632f2..fa6aafceb06aefd9b4d318cbfbc9eb6152262bdd 100644 --- a/paddle/fluid/operators/nccl/nccl_gpu_common.cc +++ b/paddle/fluid/operators/nccl/nccl_gpu_common.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/nccl/nccl_gpu_common.h b/paddle/fluid/operators/nccl/nccl_gpu_common.h index 6e78613239e6c401bad5aa80746000c5b47cd031..be8c8a8f2c3cc53db992e121c1728f8a254988c0 100644 --- a/paddle/fluid/operators/nccl/nccl_gpu_common.h +++ b/paddle/fluid/operators/nccl/nccl_gpu_common.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/nccl_op.cc b/paddle/fluid/operators/nccl_op.cc index 703e8dd00fc8e613344db11065d6a45afa2a0cc8..0994bba782b42be994ae479f4c9c4de5a2e384ed 100644 --- a/paddle/fluid/operators/nccl_op.cc +++ b/paddle/fluid/operators/nccl_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/operators/nccl/nccl_gpu_common.h" +#include "paddle/fluid/operators/nccl/nccl_gpu_common.h" namespace paddle { namespace operators { +static constexpr char kParallelScopes[] = "parallel_scopes"; + // NCCLinitOp class NCCLInitOp : public framework::OperatorBase { public: @@ -29,11 +32,22 @@ class NCCLInitOp : public framework::OperatorBase { private: void RunImpl(const framework::Scope &scope, const platform::Place &place) const override { + PADDLE_ENFORCE_NOT_NULL(scope.FindVar(Input(kParallelScopes)), + "Can not find variable '%s' in the scope.", + kParallelScopes); const auto &name = Output("Communicator"); PADDLE_ENFORCE_NOT_NULL(scope.FindVar(name), "Can not find variable '%s' in the scope.", name); - std::vector gpus = Attr>("gpus"); - PADDLE_ENFORCE(!gpus.empty(), "Attr(gpus) should not be empty."); + // A parallel do may not use all the gpus. For example, the batch size is 7 + // in the last batch while we have 8 gpu. In this case, parallel_do will + // create 7 parallel scopes, so should ncclInitOp create 7 gpu peers + auto ¶llel_scopes = scope.FindVar(Input(kParallelScopes)) + ->Get>(); + std::vector gpus(parallel_scopes.size()); + for (int i = 0; i < static_cast(parallel_scopes.size()); ++i) { + gpus[i] = i; + } + PADDLE_ENFORCE(!gpus.empty(), "NCCL init with 0 gpus."); if (scope.FindVar(name) == nullptr) { PADDLE_THROW("Output(Communicator) is needed for ncclInit operator."); @@ -45,17 +59,29 @@ class NCCLInitOp : public framework::OperatorBase { } }; +class NCCLInitOpVarTypeInference : public framework::VarTypeInference { + public: + void operator()(const framework::OpDesc &op_desc, + framework::BlockDesc *block) const override { + auto out_var_name = op_desc.Output("Communicator").front(); + auto &out_var = block->FindRecursiveOrCreateVar(out_var_name); + auto var_type = framework::proto::VarType::NCCL_COM; + out_var.SetType(var_type); + } +}; + +class NCCLInitOpShapeInference : public framework::InferShapeBase { + public: + void operator()(framework::InferShapeContext *ctx) const override {} +}; + class NCCLInitOpMaker : public framework::OpProtoAndCheckerMaker { public: NCCLInitOpMaker(OpProto *proto, OpAttrChecker *op_checker) : OpProtoAndCheckerMaker(proto, op_checker) { + AddInput(kParallelScopes, "The working place of parallel do."); AddOutput("Communicator", "Create Communicator for communicating between gpus"); - AddAttr>("gpus", "(vector) GPU id lists"); - AddAttr("dtype", - "(int, default 5 (FP32)) " - "Output data type") - .SetDefault(framework::proto::DataType::FP32); AddComment(R"DOC( NCCLInit Operator. @@ -78,7 +104,7 @@ class NCCLAllReduceOp : public framework::OperatorWithKernel { ctx->HasInput("Communicator"), " Input(Communicator) of AllReduce op input should not be NULL"); PADDLE_ENFORCE(ctx->HasOutput("Out"), - " Input(X) of AllReduce op input should not be NULL"); + " Output(Out) of AllReduce op output should not be NULL"); auto x_dims = ctx->GetInputsDim("X"); @@ -215,7 +241,9 @@ Bcast the tensors. namespace ops = paddle::operators; REGISTER_OPERATOR(ncclInit, ops::NCCLInitOp, - paddle::framework::EmptyGradOpMaker, ops::NCCLInitOpMaker); + paddle::framework::EmptyGradOpMaker, ops::NCCLInitOpMaker, + ops::NCCLInitOpVarTypeInference, + ops::NCCLInitOpShapeInference); REGISTER_OP_WITHOUT_GRADIENT(ncclAllReduce, ops::NCCLAllReduceOp, ops::NCCLAllReduceOpMaker); diff --git a/paddle/fluid/operators/nccl_op.cu.cc b/paddle/fluid/operators/nccl_op.cu.cc index 333aed2903e7873aa799bd34468b2e05ef2e556c..fc83aa2ac2231c208e1933209985432717b4e36e 100644 --- a/paddle/fluid/operators/nccl_op.cu.cc +++ b/paddle/fluid/operators/nccl_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/nccl_op_test.cu.cc b/paddle/fluid/operators/nccl_op_test.cu.cc index 212ed2f9b63de5061dc3a2eb86508d8a4c305f89..b4021a5dacd80a042042eadf9f5d1a932f0f00a2 100644 --- a/paddle/fluid/operators/nccl_op_test.cu.cc +++ b/paddle/fluid/operators/nccl_op_test.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -98,7 +98,7 @@ class NCCLTester : public ::testing::Test { send_tensor->mutable_data(kDims, place); std::vector send_vector(f::product(kDims), gpu_id); - paddle::framework::CopyFromVector(send_vector, *ctx, send_tensor); + paddle::framework::TensorFromVector(send_vector, *ctx, send_tensor); ctx->Wait(); VLOG(1) << "Send Tensor filled with elements " << send_tensor->numel(); } diff --git a/paddle/fluid/operators/nce_op.cc b/paddle/fluid/operators/nce_op.cc index 0841313a1042ea4099473fdc0293d9bae4a7c8c3..99f38529bbb5a36cd944a01940b5579195f2d601 100644 --- a/paddle/fluid/operators/nce_op.cc +++ b/paddle/fluid/operators/nce_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/nce_op.h b/paddle/fluid/operators/nce_op.h index 624c2d9bbd3245a11c8cfff2dd7cae6e5b25f106..94207638473374ddf7e23d211d6cde93f112f492 100644 --- a/paddle/fluid/operators/nce_op.h +++ b/paddle/fluid/operators/nce_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/net_op.cc b/paddle/fluid/operators/net_op.cc index c0ca5873adcc92a39f20a162796e7581ea10c63f..0c2da744177b602246719d701257fc1b509ad81e 100644 --- a/paddle/fluid/operators/net_op.cc +++ b/paddle/fluid/operators/net_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/net_op.h b/paddle/fluid/operators/net_op.h index 479ba386a70adaff09ae31e24c449fc18a9853b1..cbf8820cf4991bc24893f13646364dea0955a128 100644 --- a/paddle/fluid/operators/net_op.h +++ b/paddle/fluid/operators/net_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/net_op_test.cc b/paddle/fluid/operators/net_op_test.cc index 265f15e82ed29824ed65917dbe45e5edf9dc8993..3b5f57548585398c441fd8038ba8b053c27392cf 100644 --- a/paddle/fluid/operators/net_op_test.cc +++ b/paddle/fluid/operators/net_op_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/norm_op.cc b/paddle/fluid/operators/norm_op.cc index ee85b1a90a85f8c6ec57900c4c7d0dd319a0186a..5345c5bdb0f1e2d96233595f89028993606d2399 100644 --- a/paddle/fluid/operators/norm_op.cc +++ b/paddle/fluid/operators/norm_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/norm_op.cu b/paddle/fluid/operators/norm_op.cu index 438bb3b86e79c526f70a23d3c7f6cc13f72e0463..d1d9be50742b54a3b6f068fd43ec4b16696183bf 100644 --- a/paddle/fluid/operators/norm_op.cu +++ b/paddle/fluid/operators/norm_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/norm_op.h b/paddle/fluid/operators/norm_op.h index db74c9b02a74afc6bd0e59da97e64a3e556b97dc..0ad29e8a0385c46a07842930378ed7a040564437 100644 --- a/paddle/fluid/operators/norm_op.h +++ b/paddle/fluid/operators/norm_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/one_hot_op.cc b/paddle/fluid/operators/one_hot_op.cc index 2c3a60da729d6f4edb8e7e3aa0c81cd3140855c0..1d42dfdd765166c9596abc08ce8abd534453bc63 100644 --- a/paddle/fluid/operators/one_hot_op.cc +++ b/paddle/fluid/operators/one_hot_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ class OneHotOpMaker : public framework::OpProtoAndCheckerMaker { AddAttr("dtype", "An integer to specify the data type of one-hot " "vector. The default value is FP32.") - .SetDefault(paddle::framework::proto::DataType::FP32); + .SetDefault(paddle::framework::proto::VarType::FP32); AddComment(R"DOC( One Hot Operator. This operator creates the one-hot representations for input index values. The following example will help to explain the function of this diff --git a/paddle/fluid/operators/one_hot_op.cu b/paddle/fluid/operators/one_hot_op.cu index 6a8061edaab61661f57b17cd5e065c5c84edb906..240ac895e2c8391322411d347384f4834995eb7c 100644 --- a/paddle/fluid/operators/one_hot_op.cu +++ b/paddle/fluid/operators/one_hot_op.cu @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -65,7 +65,8 @@ class OneHotCUDAKernel : public framework::OpKernel { int depth = context.Attr("depth"); framework::VisitDataType( - static_cast(context.Attr("dtype")), + static_cast( + context.Attr("dtype")), OneHotOpCUDAFunctor( in, out, depth, context.template device_context())); } diff --git a/paddle/fluid/operators/one_hot_op.h b/paddle/fluid/operators/one_hot_op.h index ddac6edd0ec73a932dcf9c6ca7d7d63853467f1c..7e77f25089c4bd0297b0eb5a0ed7555cc0af5a9f 100644 --- a/paddle/fluid/operators/one_hot_op.h +++ b/paddle/fluid/operators/one_hot_op.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -58,7 +58,8 @@ class OneHotKernel : public framework::OpKernel { int depth = context.Attr("depth"); framework::VisitDataType( - static_cast(context.Attr("dtype")), + static_cast( + context.Attr("dtype")), OneHotOpFunctor( in, out, depth, context.template device_context())); } diff --git a/paddle/fluid/operators/pad_op.cc b/paddle/fluid/operators/pad_op.cc index 4b021fde7cba699327e1874d569a14c3139a4c32..d2a0106f80144e3550d73ea22f8e012426eb01ae 100644 --- a/paddle/fluid/operators/pad_op.cc +++ b/paddle/fluid/operators/pad_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/pad_op.cu b/paddle/fluid/operators/pad_op.cu index 203c31440371440b5e942452dab08978e2136275..9cddef9cf1d3c43701a4f0ed3f70dcb30c1dbd02 100644 --- a/paddle/fluid/operators/pad_op.cu +++ b/paddle/fluid/operators/pad_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/pad_op.h b/paddle/fluid/operators/pad_op.h index 244d8f9b6cf51ab249e991ed129e99da67ff9e62..a36abe3789574cb64f05001e34d534cf352a60b2 100644 --- a/paddle/fluid/operators/pad_op.h +++ b/paddle/fluid/operators/pad_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/parallel_do_op.cc b/paddle/fluid/operators/parallel_do_op.cc index d791d11172869d42b08c059b900e729bcc9b5d96..bf4d0476df32d7454d4064cb6ee454e6ad5d6fc5 100644 --- a/paddle/fluid/operators/parallel_do_op.cc +++ b/paddle/fluid/operators/parallel_do_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ static constexpr char kOutputs[] = "outputs"; static constexpr char kParallelScopes[] = "parallel_scopes"; static constexpr char kParallelBlock[] = "sub_block"; +static constexpr char kUseNCCL[] = "use_nccl"; using LoDTensor = framework::LoDTensor; using SelectedRows = framework::SelectedRows; @@ -78,7 +79,7 @@ inline void CopyOrShare(const framework::Variable &src, dst->GetMutable()->ShareDataWith(src.Get()); dst->GetMutable()->set_lod(src.Get().lod()); } else { - Copy(src.Get(), dst_place, dst->GetMutable()); + TensorCopy(src.Get(), dst_place, dst->GetMutable()); } } else if (src.IsType()) { auto &src_sr = src.Get(); @@ -88,7 +89,7 @@ inline void CopyOrShare(const framework::Variable &src, dst_sr->mutable_value()->ShareDataWith(src_sr.value()); dst_sr->set_rows(src_sr.rows()); } else { - Copy(src_sr.value(), dst_place, dst_sr->mutable_value()); + TensorCopy(src_sr.value(), dst_place, dst_sr->mutable_value()); } } else { PADDLE_THROW("Expect LoDTensor/SelectedRows, get %s", src.Type().name()); @@ -146,7 +147,7 @@ class ParallelDoOp : public framework::OperatorBase { auto &place = places[i]; auto *sub_scope = sub_scopes[i]; auto *dst = sub_scope->Var(param)->GetMutable(); - framework::Copy(src, place, dst); + framework::TensorCopy(src, place, dst); } } WaitOnPlaces(places); @@ -194,6 +195,8 @@ class ParallelDoOpProtoMaker : public framework::OpProtoAndCheckerMaker { AddOutput(kOutputs, "").AsDuplicable(); AddOutput(kParallelScopes, ""); AddAttr(kParallelBlock, ""); + AddAttr(kUseNCCL, "true if we use nccl on backward") + .SetDefault(false); AddComment(R"DOC( ParallelDo Operator. )DOC"); @@ -216,7 +219,6 @@ class ParallelDoGradOp : public framework::OperatorBase { auto &sub_scopes = scope.FindVar(Input(kParallelScopes)) ->Get>(); - auto &places = scope.FindVar(Input(kPlaces))->Get(); // feed output@grad @@ -243,7 +245,24 @@ class ParallelDoGradOp : public framework::OperatorBase { } WaitOnPlaces(places); - AccumulateGrad(scope, place, sub_scopes, places); + // NCCL allreduce op will be added by backward, + // so no need to explicitly accumulate grad + if (!(Attr(kUseNCCL))) { + AccumulateGrad(scope, place, sub_scopes, places); + } else { + for (auto &place : places) { + PADDLE_ENFORCE(platform::is_gpu_place(place), + "NCCL only supports cuda place"); + } + } + for (auto &s : Outputs(framework::GradVarName(kParameters))) { + if (s == framework::kEmptyVarName) { + continue; + } + VLOG(3) << "Moving " << s; + CopyOrShare(*sub_scopes[0]->FindVar(s), place, scope.FindVar(s)); + } + WaitOnPlaces(places); } void AccumulateGrad(const framework::Scope &scope, @@ -251,6 +270,9 @@ class ParallelDoGradOp : public framework::OperatorBase { const std::vector &sub_scopes, const platform::PlaceList &places) const { for (auto &s : Outputs(framework::GradVarName(kParameters))) { + if (s == framework::kEmptyVarName) { + continue; + } VLOG(3) << "Accumulating " << s; if (s == framework::kEmptyVarName) continue; std::string tmp_name; diff --git a/paddle/fluid/operators/pool_cudnn_op.cu.cc b/paddle/fluid/operators/pool_cudnn_op.cu.cc index 75984b7721c48526c6d11c4b82004dba1c166cc4..781d96981e4c033d9287ab3de9860dfd9fcd2875 100644 --- a/paddle/fluid/operators/pool_cudnn_op.cu.cc +++ b/paddle/fluid/operators/pool_cudnn_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/pool_op.cc b/paddle/fluid/operators/pool_op.cc index 9dd33eefc5fd18ba08dce5ea8dff791cda54332c..c7729ad1322588c0558a136dbd5d48f757d38412 100644 --- a/paddle/fluid/operators/pool_op.cc +++ b/paddle/fluid/operators/pool_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ limitations under the License. */ namespace paddle { namespace operators { -int OutputSizePool(int input_size, int filter_size, int padding, int stride) { +int PoolOutputSize(int input_size, int filter_size, int padding, int stride) { int output_size = (input_size - filter_size + 2 * padding) / stride + 1; return output_size; } @@ -55,7 +55,7 @@ void PoolOp::InferShape(framework::InferShapeContext *ctx) const { std::vector output_shape({in_x_dims[0], in_x_dims[1]}); for (size_t i = 0; i < ksize.size(); ++i) { output_shape.push_back( - OutputSizePool(in_x_dims[i + 2], ksize[i], paddings[i], strides[i])); + PoolOutputSize(in_x_dims[i + 2], ksize[i], paddings[i], strides[i])); } ctx->SetOutputDim("Out", framework::make_ddim(output_shape)); ctx->ShareLoD("X", "Out"); diff --git a/paddle/fluid/operators/pool_op.cu.cc b/paddle/fluid/operators/pool_op.cu.cc index 14486c07402af387ee11a127ba193ac9ac36c8a2..37bc14e2cbb3437a750c416d39b7b914370961b0 100644 --- a/paddle/fluid/operators/pool_op.cu.cc +++ b/paddle/fluid/operators/pool_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/pool_op.h b/paddle/fluid/operators/pool_op.h index 4cabd634d66e402282f17ed8724129a3e6e1ff43..2fec50ef25e0d2621a87963acdf142d24970329d 100644 --- a/paddle/fluid/operators/pool_op.h +++ b/paddle/fluid/operators/pool_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/pool_with_index_op.cc b/paddle/fluid/operators/pool_with_index_op.cc index ef6d5d867b2d38b3ca26deb1cbd9f16ca9846d0f..4df0a14577ca13ddd79424fc324eb689913b20a0 100644 --- a/paddle/fluid/operators/pool_with_index_op.cc +++ b/paddle/fluid/operators/pool_with_index_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ limitations under the License. */ namespace paddle { namespace operators { -inline int OutputSizeMaxPool(int input_size, int filter_size, int padding, +inline int MaxPoolOutputSize(int input_size, int filter_size, int padding, int stride) { int output_size = (input_size - filter_size + 2 * padding) / stride + 1; return output_size; @@ -61,7 +61,7 @@ class MaxPoolWithIndexOp : public framework::OperatorWithKernel { std::vector output_shape({in_x_dims[0], in_x_dims[1]}); for (size_t i = 0; i < ksize.size(); ++i) { - output_shape.push_back(OutputSizeMaxPool(in_x_dims[i + 2], ksize[i], + output_shape.push_back(MaxPoolOutputSize(in_x_dims[i + 2], ksize[i], paddings[i], strides[i])); } ctx->SetOutputDim("Out", framework::make_ddim(output_shape)); diff --git a/paddle/fluid/operators/pool_with_index_op.cu.cc b/paddle/fluid/operators/pool_with_index_op.cu.cc index 722a4d1e2a4a4ad5c1268483db46e5e9d5d4a33b..5fc418b6fdd19eddfd27b4a1b3e2554d7b2f37e6 100644 --- a/paddle/fluid/operators/pool_with_index_op.cu.cc +++ b/paddle/fluid/operators/pool_with_index_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/pool_with_index_op.h b/paddle/fluid/operators/pool_with_index_op.h index da7ef9df73a51aabc208521880168144de6f392c..83e7bd138ae25c6d3e09c3d01178d6887205bf98 100644 --- a/paddle/fluid/operators/pool_with_index_op.h +++ b/paddle/fluid/operators/pool_with_index_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/precision_recall_op.cc b/paddle/fluid/operators/precision_recall_op.cc index 30d594719c7274b90a88127028035a49c25e32e7..c34b0d072bdb2f5b97dd4615ff9338d98f2bfbe5 100644 --- a/paddle/fluid/operators/precision_recall_op.cc +++ b/paddle/fluid/operators/precision_recall_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/precision_recall_op.h b/paddle/fluid/operators/precision_recall_op.h index 7dae86b76fc8d50e2ed5fe353920b68f7a846fb1..d6d4a5adc3ed0760f2a1356c70eda275c3195969 100644 --- a/paddle/fluid/operators/precision_recall_op.h +++ b/paddle/fluid/operators/precision_recall_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/prelu_op.cc b/paddle/fluid/operators/prelu_op.cc index 22b970d971221e86a25e0b72f3d3704e5cee5d7f..447b854544b72043ea09c09c134af3a48c305561 100644 --- a/paddle/fluid/operators/prelu_op.cc +++ b/paddle/fluid/operators/prelu_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/prelu_op.cu b/paddle/fluid/operators/prelu_op.cu index 038b09a493c5064d5419260b2fbfdf56b6bb5982..37d934a29046be04a1721b7330c813f663f61aed 100644 --- a/paddle/fluid/operators/prelu_op.cu +++ b/paddle/fluid/operators/prelu_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/prelu_op.h b/paddle/fluid/operators/prelu_op.h index 85ad75d479001ec5dad1b796d4932c7e6c4ab7af..a6197d354833a2f4173003ad2a970c487ad9a65b 100644 --- a/paddle/fluid/operators/prelu_op.h +++ b/paddle/fluid/operators/prelu_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/print_op.cc b/paddle/fluid/operators/print_op.cc index 4d12fdbb6b62d1d7095d10aa6f33d12598a8e99e..fc09b4aa1da87e56678790785467e9f4080a20ea 100644 --- a/paddle/fluid/operators/print_op.cc +++ b/paddle/fluid/operators/print_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ struct Formater { } private: - void PrintMessage() { CLOG << std::time(nullptr) << "\t" << message; } + void PrintMessage() { CLOG << std::time(nullptr) << "\t" << message << "\t"; } void PrintName() { if (!name.empty()) { CLOG << "Tensor[" << name << "]" << std::endl; @@ -85,15 +85,16 @@ struct Formater { // print float if (dtype.hash_code() == typeid(float).hash_code()) { Display(size); - } - if (dtype.hash_code() == typeid(double).hash_code()) { + } else if (dtype.hash_code() == typeid(double).hash_code()) { Display(size); - } - if (dtype.hash_code() == typeid(int).hash_code()) { + } else if (dtype.hash_code() == typeid(int).hash_code()) { Display(size); - } - if (dtype.hash_code() == typeid(int64_t).hash_code()) { + } else if (dtype.hash_code() == typeid(int64_t).hash_code()) { Display(size); + } else if (dtype.hash_code() == typeid(bool).hash_code()) { + Display(size); + } else { + CLOG << "\tdata: unprintable type: " << dtype.name() << std::endl; } } @@ -178,10 +179,11 @@ class TensorPrintOp : public framework::OperatorBase { } else { // copy data to cpu to print platform::CPUPlace place; - framework::Copy(in_tensor, place, &printed_tensor); + framework::TensorCopy(in_tensor, place, &printed_tensor); } Formater formater; + formater.message = Attr("message"); if (Attr("print_tensor_name")) { formater.name = printed_var_name; } diff --git a/paddle/fluid/operators/prior_box_op.cc b/paddle/fluid/operators/prior_box_op.cc index 1385a6cdce838b7f376cd784a8eaa63f591c7ef2..922b2bd237a1ec54aea895a05ccd78cd624e88ae 100644 --- a/paddle/fluid/operators/prior_box_op.cc +++ b/paddle/fluid/operators/prior_box_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/prior_box_op.h b/paddle/fluid/operators/prior_box_op.h index e2c9514ed0814f21fec6c4184b7e971c4528d489..0113d2f09af90eec32632180741db3a1fc40c724 100644 --- a/paddle/fluid/operators/prior_box_op.h +++ b/paddle/fluid/operators/prior_box_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/proximal_adagrad_op.cc b/paddle/fluid/operators/proximal_adagrad_op.cc index d9e3894c576a94c094c0f4b72e3b6519c4ec26e1..38cd97c17b16a4cc64f7e6d52150fae392df6036 100644 --- a/paddle/fluid/operators/proximal_adagrad_op.cc +++ b/paddle/fluid/operators/proximal_adagrad_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/proximal_adagrad_op.cu b/paddle/fluid/operators/proximal_adagrad_op.cu index 54c75b3abb8e84b2aa55d044e79423cf86523d76..7e0226c62bfd5d4804cc70c00391237deec33ebb 100644 --- a/paddle/fluid/operators/proximal_adagrad_op.cu +++ b/paddle/fluid/operators/proximal_adagrad_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/proximal_adagrad_op.h b/paddle/fluid/operators/proximal_adagrad_op.h index 70205a8d11f757d08150a81d1369133778ad996c..91416450a60d683eeb33462258ff8325dae76e6e 100644 --- a/paddle/fluid/operators/proximal_adagrad_op.h +++ b/paddle/fluid/operators/proximal_adagrad_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/proximal_gd_op.cc b/paddle/fluid/operators/proximal_gd_op.cc index de7c6843c8ba7c1cc9229a11707de7a1400deee1..efb4e1ac204ce79bfad7d77038f342be09e8f0e8 100644 --- a/paddle/fluid/operators/proximal_gd_op.cc +++ b/paddle/fluid/operators/proximal_gd_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/proximal_gd_op.cu b/paddle/fluid/operators/proximal_gd_op.cu index 97b672e872c99783ef4c0cd085e4b86380a06e10..32ee9ab74cd58fd6f48b6c34e108f31315adaf71 100644 --- a/paddle/fluid/operators/proximal_gd_op.cu +++ b/paddle/fluid/operators/proximal_gd_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/proximal_gd_op.h b/paddle/fluid/operators/proximal_gd_op.h index 8372380f25277e7774b72e144e00ea80e76a71e0..d49badf16d510c13847b8921360544bbb6078e05 100644 --- a/paddle/fluid/operators/proximal_gd_op.h +++ b/paddle/fluid/operators/proximal_gd_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/rank_loss_op.cc b/paddle/fluid/operators/rank_loss_op.cc index 222ca73d2acfa8cc3d6fa6a3badce4606be9bcb0..767eef56861ea075ec2450b1456e7c5c807ce25d 100644 --- a/paddle/fluid/operators/rank_loss_op.cc +++ b/paddle/fluid/operators/rank_loss_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/rank_loss_op.cu b/paddle/fluid/operators/rank_loss_op.cu index 1b182ced70d2a234237f1de822c3dc81047ebda7..ed805279892d0f045fdde94b30c9bc7b19348a9a 100644 --- a/paddle/fluid/operators/rank_loss_op.cu +++ b/paddle/fluid/operators/rank_loss_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/rank_loss_op.h b/paddle/fluid/operators/rank_loss_op.h index 08bb2c28218e8c478af426b560efc9a4b6161696..28626c0e2e697cef29db3b969fa55a1da78dd8a4 100644 --- a/paddle/fluid/operators/rank_loss_op.h +++ b/paddle/fluid/operators/rank_loss_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/read_op.cc b/paddle/fluid/operators/read_op.cc index 127df82ff13b89de42e45113a21d6f5e7c2f20ed..62beab82d4f2b0b795d5d32f50352172de6870cc 100644 --- a/paddle/fluid/operators/read_op.cc +++ b/paddle/fluid/operators/read_op.cc @@ -45,7 +45,7 @@ class ReadInferVarType : public framework::VarTypeInference { PADDLE_ENFORCE_EQ(dtypes.size(), out_names.size()); for (size_t i = 0; i < dtypes.size(); ++i) { framework::VarDesc& out = block->FindRecursiveOrCreateVar(out_names[i]); - out.SetType(framework::proto::VarDesc::LOD_TENSOR); + out.SetType(framework::proto::VarType::LOD_TENSOR); out.SetDataType(dtypes[i]); } } diff --git a/paddle/fluid/operators/recurrent_op.cc b/paddle/fluid/operators/recurrent_op.cc index 33a744a5b7fef5802569a305d18746f04ed88136..00241e768217db0a611c00bbc72e2fb83ade73b4 100644 --- a/paddle/fluid/operators/recurrent_op.cc +++ b/paddle/fluid/operators/recurrent_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -291,7 +291,7 @@ class RecurrentOp : public RecurrentBase { auto dst_out = dst_tensor->Slice(seq_offset, seq_offset + 1); // Explicit copy output since the local RNN scope can be destroyed // early. - framework::Copy(src_tensor, place, dev_ctx, &dst_out); + framework::TensorCopy(src_tensor, place, dev_ctx, &dst_out); }); scopes.Next(); @@ -378,7 +378,7 @@ class RecurrentGradOp : public RecurrentBase { auto *cur_grad_var = cur_scope.Var(cur_grad); auto cur_grad_tensor = cur_grad_var->GetMutable(); - framework::Copy(ex_tensor, place, dev_ctx, cur_grad_tensor); + framework::TensorCopy(ex_tensor, place, dev_ctx, cur_grad_tensor); } } @@ -452,7 +452,7 @@ class RecurrentGradOp : public RecurrentBase { } auto dst = outside->Slice(seq_offset, seq_offset + 1); - framework::Copy(inside, place, dev_ctx, &dst); + framework::TensorCopy(inside, place, dev_ctx, &dst); }); VLOG(5) << "Link outside gradient finished "; @@ -465,7 +465,7 @@ class RecurrentGradOp : public RecurrentBase { framework::LoDTensor *outside) { outside->Resize(inside.dims()); outside->mutable_data(place, inside.type()); - framework::Copy(inside, place, dev_ctx, outside); + framework::TensorCopy(inside, place, dev_ctx, outside); }); VLOG(5) << "Link initialize state gradient finished "; } diff --git a/paddle/fluid/operators/recv_op.cc b/paddle/fluid/operators/recv_op.cc index c093f60ceed4171ee4ab7f0e5757af2ee5950270..083c1fae5e2016ada6309aba78bdfa6ad7fef89c 100644 --- a/paddle/fluid/operators/recv_op.cc +++ b/paddle/fluid/operators/recv_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,8 +32,8 @@ class RecvOp : public framework::OperatorBase { const framework::AttributeMap& attrs) : OperatorBase(type, inputs, outputs, attrs) {} - void Run(const framework::Scope& scope, - const platform::Place& place) const override { + void RunImpl(const framework::Scope& scope, + const platform::Place& place) const override { auto outs = Outputs("Out"); std::vector epmap = Attr>("epmap"); diff --git a/paddle/fluid/operators/reduce_op.cc b/paddle/fluid/operators/reduce_op.cc index f4d9d4cc07b1f76ed04e17bc1cc65293163fb6f2..69e8f8081e93cb74177eac1a57e0eaf284951e3f 100644 --- a/paddle/fluid/operators/reduce_op.cc +++ b/paddle/fluid/operators/reduce_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/reduce_op.cu b/paddle/fluid/operators/reduce_op.cu index 1ca107ebfe9b617bd5e952965543549a8d92a5b1..ae29587f55847315b1d84f1344677e753fe01a9b 100644 --- a/paddle/fluid/operators/reduce_op.cu +++ b/paddle/fluid/operators/reduce_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/reduce_op.h b/paddle/fluid/operators/reduce_op.h index a153cf272b5dd8abcba1bc7d3d02c480702eae4d..ec23325e571277d6dc78c18303692f5b483d278b 100644 --- a/paddle/fluid/operators/reduce_op.h +++ b/paddle/fluid/operators/reduce_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/reorder_lod_tensor_by_rank_op.cc b/paddle/fluid/operators/reorder_lod_tensor_by_rank_op.cc index 79ba9e543b892d051995d4bafb0ceaaf09838cd2..5c3e1f5678df0270c837ed407d1e6cc662276880 100644 --- a/paddle/fluid/operators/reorder_lod_tensor_by_rank_op.cc +++ b/paddle/fluid/operators/reorder_lod_tensor_by_rank_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -170,7 +170,7 @@ class ReorderLoDTensorByRankTableBase : public framework::OperatorBase { platform::DeviceContextPool &pool = platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(place); - framework::Copy(x_sliced, out_sliced.place(), dev_ctx, &out_sliced); + framework::TensorCopy(x_sliced, out_sliced.place(), dev_ctx, &out_sliced); out_offset += len; return out_offset; } diff --git a/paddle/fluid/operators/reshape_op.cc b/paddle/fluid/operators/reshape_op.cc index b4f80cc06abaa536d1b1097850047fd370246dee..a90ffb4ff3e6e1bfcc0d00bc4714b3067fdede6c 100644 --- a/paddle/fluid/operators/reshape_op.cc +++ b/paddle/fluid/operators/reshape_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/reshape_op.cu b/paddle/fluid/operators/reshape_op.cu index f9ae6da29e54187b2d6aedb833a2aa4ca95cacba..d5ceaf784c0e4b1c8d527958be31d5186c2823d3 100644 --- a/paddle/fluid/operators/reshape_op.cu +++ b/paddle/fluid/operators/reshape_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/reshape_op.h b/paddle/fluid/operators/reshape_op.h index a17ba7c619490977b837c565ef1f4cc0780d5c61..1357bce4b7e7dcde616ec15df6617db5573df1d3 100644 --- a/paddle/fluid/operators/reshape_op.h +++ b/paddle/fluid/operators/reshape_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ class ReshapeKernel : public framework::OpKernel { auto* in = ctx.Input("X"); auto out_dims = out->dims(); out->mutable_data(ctx.GetPlace()); - framework::Copy(*in, ctx.GetPlace(), ctx.device_context(), out); + framework::TensorCopy(*in, ctx.GetPlace(), ctx.device_context(), out); out->Resize(out_dims); } }; @@ -42,7 +42,7 @@ class ReshapeGradKernel : public framework::OpKernel { d_x->mutable_data(ctx.GetPlace()); auto in_dims = d_x->dims(); - framework::Copy(*d_out, ctx.GetPlace(), ctx.device_context(), d_x); + framework::TensorCopy(*d_out, ctx.GetPlace(), ctx.device_context(), d_x); d_x->Resize(in_dims); } }; diff --git a/paddle/fluid/operators/rmsprop_op.cc b/paddle/fluid/operators/rmsprop_op.cc index 06d3ccafefd4cc163b806aeb5d2a582c686f10cb..a8855b3ccd1686c75953e762ce42cc27b26202e6 100644 --- a/paddle/fluid/operators/rmsprop_op.cc +++ b/paddle/fluid/operators/rmsprop_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/rmsprop_op.cu b/paddle/fluid/operators/rmsprop_op.cu index a909c942791d2e2e4d9887d4c9265383a93ca137..cdc473769598be5aac87a14613d9acdd5c1a1204 100644 --- a/paddle/fluid/operators/rmsprop_op.cu +++ b/paddle/fluid/operators/rmsprop_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/rmsprop_op.h b/paddle/fluid/operators/rmsprop_op.h index 469c102a4721ca45026112e3166dc0807ba93292..12836f43bde47ac87eb0af33dea501593b659a5d 100644 --- a/paddle/fluid/operators/rmsprop_op.h +++ b/paddle/fluid/operators/rmsprop_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/rnn_memory_helper_op.cc b/paddle/fluid/operators/rnn_memory_helper_op.cc index e9329a0e7e279e2bdd3c45986580c87aa5d0b1fe..70f205d887ef710aeed02905713200ce32988987 100644 --- a/paddle/fluid/operators/rnn_memory_helper_op.cc +++ b/paddle/fluid/operators/rnn_memory_helper_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ class RNNMemoryHelperOpInfoMaker : public framework::OpProtoAndCheckerMaker { AddAttr("dtype", "(int, default 5 (FP32)) " "Output data type") - .SetDefault(framework::proto::DataType::FP32); + .SetDefault(framework::proto::VarType::FP32); AddComment(""); } }; @@ -126,7 +126,7 @@ class RNNMemoryHelperGradOpInfoMaker AddAttr("dtype", "(int, default 5 (FP32)) " "Output data type") - .SetDefault(framework::proto::DataType::FP32); + .SetDefault(framework::proto::VarType::FP32); AddComment(""); } }; diff --git a/paddle/fluid/operators/roi_pool_op.cc b/paddle/fluid/operators/roi_pool_op.cc index 09238f89a775979b8b1866d410e6ad1ef772f9d7..6d4861f0428834b1893c3a10a83920f0a62b5455 100644 --- a/paddle/fluid/operators/roi_pool_op.cc +++ b/paddle/fluid/operators/roi_pool_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/roi_pool_op.cu b/paddle/fluid/operators/roi_pool_op.cu index 0e8fc9ec7a68cffeb45f8ece3e5bde39d1e71e92..1931629d1340758edb6664a5e3ffdba126b33717 100644 --- a/paddle/fluid/operators/roi_pool_op.cu +++ b/paddle/fluid/operators/roi_pool_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/roi_pool_op.h b/paddle/fluid/operators/roi_pool_op.h index 15f3b36fcd16bf72b9b09f58a3019b24538eec12..f38c5a3c0c9952b37f7db468ea00470a00b5ff6f 100644 --- a/paddle/fluid/operators/roi_pool_op.h +++ b/paddle/fluid/operators/roi_pool_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/row_conv_op.cc b/paddle/fluid/operators/row_conv_op.cc index 92661ea9716a89a66c27fa21543d81b5a280bcdd..d34beeb6508084f4d680fad9bac99ea474d274d3 100644 --- a/paddle/fluid/operators/row_conv_op.cc +++ b/paddle/fluid/operators/row_conv_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/row_conv_op.cu b/paddle/fluid/operators/row_conv_op.cu index 832072edf810099d142c82930abfd7f198a7d1b8..67083455a7579a4bbb6d9598a77b68a8375cf815 100644 --- a/paddle/fluid/operators/row_conv_op.cu +++ b/paddle/fluid/operators/row_conv_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/row_conv_op.h b/paddle/fluid/operators/row_conv_op.h index 59164b5215910630b4641501bc0b0c0e941911c2..fb999568f81b4034a683e2bc155692dffbf82f82 100644 --- a/paddle/fluid/operators/row_conv_op.h +++ b/paddle/fluid/operators/row_conv_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/save_combine_op.cc b/paddle/fluid/operators/save_combine_op.cc index e3953e4b08082c08e1bbf77a834d4a895b327f83..94703393bfa53124d16e34ae4373773eece5f11f 100644 --- a/paddle/fluid/operators/save_combine_op.cc +++ b/paddle/fluid/operators/save_combine_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/save_load_combine_op_test.cc b/paddle/fluid/operators/save_load_combine_op_test.cc index f8325bac6bc59602e81d38cb857b7b8e133be2cc..286f75df4ca2daff24b696c6bcb0c3df32875875 100644 --- a/paddle/fluid/operators/save_load_combine_op_test.cc +++ b/paddle/fluid/operators/save_load_combine_op_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/save_load_op_test.cc b/paddle/fluid/operators/save_load_op_test.cc index da4573a8ed936cf607123590ca41fb8f630930f3..a7ba1e0ae1d22a22cf2943c9aaf0c394ef4ae326 100644 --- a/paddle/fluid/operators/save_load_op_test.cc +++ b/paddle/fluid/operators/save_load_op_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/save_op.cc b/paddle/fluid/operators/save_op.cc index 85ba8e01182c2cd01aa599ddbce68b6b2d9aa5f4..4a715c4baab2da7b7af86ada22ee88a16b05a814 100644 --- a/paddle/fluid/operators/save_op.cc +++ b/paddle/fluid/operators/save_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scale_op.cc b/paddle/fluid/operators/scale_op.cc index 017fc2c00e4016052179acfe328cdda42d6f84de..b16d06df8d0f7f57a5ec2f2be9a2cbb12a8ba55d 100644 --- a/paddle/fluid/operators/scale_op.cc +++ b/paddle/fluid/operators/scale_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scale_op.cu b/paddle/fluid/operators/scale_op.cu index a9b46077aa07406fef2cba5b18d190501ce2f92a..04c802da12958a53626f533833c2709110531136 100644 --- a/paddle/fluid/operators/scale_op.cu +++ b/paddle/fluid/operators/scale_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scale_op.h b/paddle/fluid/operators/scale_op.h index b1c2964ca6385dc6fb81f61a3e5bb042f5d7019f..c6a59b76adcd6b4d3e7db5e7c7185f266f46841f 100644 --- a/paddle/fluid/operators/scale_op.h +++ b/paddle/fluid/operators/scale_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scatter.cu.h b/paddle/fluid/operators/scatter.cu.h index 0f1b9426a745ac293bd756da6ee750119879429e..ac7d69bfb549fd98c76fcf834e8d3ad9bec2ef23 100644 --- a/paddle/fluid/operators/scatter.cu.h +++ b/paddle/fluid/operators/scatter.cu.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scatter.h b/paddle/fluid/operators/scatter.h index 70cae1286caf10323e8e424853f1dc14f84b110c..39af717615c01f5c121e32b176b74d05be738531 100644 --- a/paddle/fluid/operators/scatter.h +++ b/paddle/fluid/operators/scatter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scatter_op.cc b/paddle/fluid/operators/scatter_op.cc index e35930af53463e18e5ecca3cf41b91ed58a7c4c2..3fb8b56d2676f90ff7e1cefa46c459ee37f63ca8 100644 --- a/paddle/fluid/operators/scatter_op.cc +++ b/paddle/fluid/operators/scatter_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scatter_op.cu b/paddle/fluid/operators/scatter_op.cu index f9eaae33a802ed1a45184a24757e3883fad5e639..bdabb29fa680f8f87873b4381acf0dbd2b6195d0 100644 --- a/paddle/fluid/operators/scatter_op.cu +++ b/paddle/fluid/operators/scatter_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scatter_op.h b/paddle/fluid/operators/scatter_op.h index 65d10546328780e09bb57876acf2326d98803847..3c6e7ece320229e1a311ef6d7a27387d40be3c2a 100644 --- a/paddle/fluid/operators/scatter_op.h +++ b/paddle/fluid/operators/scatter_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/scatter_test.cc b/paddle/fluid/operators/scatter_test.cc index 8fb5ef96af34e5bd2dc0802ea76456a8b47749ab..b67af3c3710eafc57b660a48e4c340d5eefe7e5b 100644 --- a/paddle/fluid/operators/scatter_test.cc +++ b/paddle/fluid/operators/scatter_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/send_op.cc b/paddle/fluid/operators/send_op.cc index b241f738cbf60c0698b869da771807ec7e2c33af..58850bf566e00f88de19305110e2ef696b73467e 100644 --- a/paddle/fluid/operators/send_op.cc +++ b/paddle/fluid/operators/send_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -48,8 +48,8 @@ class SendOp : public framework::OperatorBase { const framework::AttributeMap& attrs) : OperatorBase(type, inputs, outputs, attrs) {} - void Run(const framework::Scope& scope, - const platform::Place& place) const override { + void RunImpl(const framework::Scope& scope, + const platform::Place& place) const override { auto ins = Inputs("X"); auto outs = Outputs("Out"); std::vector epmap = Attr>("epmap"); diff --git a/paddle/fluid/operators/send_recv_op_test.cc b/paddle/fluid/operators/send_recv_op_test.cc index 37a3d246d713adb68ffa20e8b2faad32843b1eaa..008c012a32e0c88dfb0c05d7e485ffc367b3cac5 100644 --- a/paddle/fluid/operators/send_recv_op_test.cc +++ b/paddle/fluid/operators/send_recv_op_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_concat_op.cc b/paddle/fluid/operators/sequence_concat_op.cc index 4ddf800d85e11aa631255c1b1ec5c12f6e0f221c..126753edd09e8bd0f9d5a08936afbc6326b29ace 100644 --- a/paddle/fluid/operators/sequence_concat_op.cc +++ b/paddle/fluid/operators/sequence_concat_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_concat_op.cu.cc b/paddle/fluid/operators/sequence_concat_op.cu.cc index c5a280ef9e2515114f5dd6826e55a304066973aa..43860b7c51712bf481d54c4f157ee608678c6940 100644 --- a/paddle/fluid/operators/sequence_concat_op.cu.cc +++ b/paddle/fluid/operators/sequence_concat_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_concat_op.h b/paddle/fluid/operators/sequence_concat_op.h index 9121196369f1bee20abc56a33b9da8bc4a43f315..9f04c4199130de3cead6f23ef111453ca752c0e3 100644 --- a/paddle/fluid/operators/sequence_concat_op.h +++ b/paddle/fluid/operators/sequence_concat_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_conv_op.cc b/paddle/fluid/operators/sequence_conv_op.cc index af9938b18069d65648fbbf0deae31eff088b791f..ec1f3a5da8c1fc8933b3720802ea901695195dec 100644 --- a/paddle/fluid/operators/sequence_conv_op.cc +++ b/paddle/fluid/operators/sequence_conv_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_conv_op.cu.cc b/paddle/fluid/operators/sequence_conv_op.cu.cc index 36f9e8da95d8c963c74fb6c8e75c777b7ba03095..de482b7f10bafc4ac6f3838670e2da9a86374c26 100644 --- a/paddle/fluid/operators/sequence_conv_op.cu.cc +++ b/paddle/fluid/operators/sequence_conv_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_conv_op.h b/paddle/fluid/operators/sequence_conv_op.h index 1c81067fea2370458cf6abe8e5465b4c674fbf09..ee48339c52e348e7b3060bbdd462177375aee9f5 100644 --- a/paddle/fluid/operators/sequence_conv_op.h +++ b/paddle/fluid/operators/sequence_conv_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_erase_op.cc b/paddle/fluid/operators/sequence_erase_op.cc index 2e0adf8b1900f7b7c43001459a7e7c494d854274..32b9d7f7c1528a365cd21122e4df0e3c1407a49e 100644 --- a/paddle/fluid/operators/sequence_erase_op.cc +++ b/paddle/fluid/operators/sequence_erase_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_erase_op.cu b/paddle/fluid/operators/sequence_erase_op.cu index 43fc352fe78d03fb54dd90a43e3d37b0646cefce..fc9b91c351defb92246e0966b9993fd1e288aaac 100644 --- a/paddle/fluid/operators/sequence_erase_op.cu +++ b/paddle/fluid/operators/sequence_erase_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_erase_op.h b/paddle/fluid/operators/sequence_erase_op.h index e151279c7fc20d5e04048080a9432cb723334b75..b490c34f543875f73e0862c08c25bcb57611e2f4 100644 --- a/paddle/fluid/operators/sequence_erase_op.h +++ b/paddle/fluid/operators/sequence_erase_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_expand_op.cc b/paddle/fluid/operators/sequence_expand_op.cc index 28645e01b84df3c51016a3feb237c416a0d78b49..a5d84d629b2e50763dac9bc571ac490414a8a406 100644 --- a/paddle/fluid/operators/sequence_expand_op.cc +++ b/paddle/fluid/operators/sequence_expand_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_expand_op.cu b/paddle/fluid/operators/sequence_expand_op.cu index 5ac76d83da618680502d0add51ae68ac117ad2aa..26622d23afa1c703e237628bcb11db8f1da73210 100644 --- a/paddle/fluid/operators/sequence_expand_op.cu +++ b/paddle/fluid/operators/sequence_expand_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_expand_op.h b/paddle/fluid/operators/sequence_expand_op.h index 8010627ff6f5acbf300b0f3f9281e60b4ebfa94e..76dde976db2d19e307ae7406be8280f9b4987187 100644 --- a/paddle/fluid/operators/sequence_expand_op.h +++ b/paddle/fluid/operators/sequence_expand_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_pool_op.cc b/paddle/fluid/operators/sequence_pool_op.cc index 2cfb336b2e0b31ab20182a36d806506b6af4c139..3d4d54a3a3f292d34b1a7645a0db4bdd3208ba6d 100644 --- a/paddle/fluid/operators/sequence_pool_op.cc +++ b/paddle/fluid/operators/sequence_pool_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_pool_op.cu b/paddle/fluid/operators/sequence_pool_op.cu index 364769c39bd1b94935630eb8c16c0e27787139e1..2bf0697af3c74ee922a832fecaa2cd2399a06849 100644 --- a/paddle/fluid/operators/sequence_pool_op.cu +++ b/paddle/fluid/operators/sequence_pool_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_pool_op.h b/paddle/fluid/operators/sequence_pool_op.h index 7b67e6201ebb04b3fbda3520347c580fd9501098..8706ff14aa20714e77d5625fc1f6287ee9b4a8a6 100644 --- a/paddle/fluid/operators/sequence_pool_op.h +++ b/paddle/fluid/operators/sequence_pool_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_reshape_op.cc b/paddle/fluid/operators/sequence_reshape_op.cc index c4e42d3eeb5555be693946ccde30ef87f88d0f32..a2999650b8903f9d819a8e8011421349e098b219 100644 --- a/paddle/fluid/operators/sequence_reshape_op.cc +++ b/paddle/fluid/operators/sequence_reshape_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_reshape_op.cu b/paddle/fluid/operators/sequence_reshape_op.cu index 5ca3497396eaa6c811c69af4acf4fa3092cff42a..232e031c0b022497d9e5141750dbf8fccffc7615 100644 --- a/paddle/fluid/operators/sequence_reshape_op.cu +++ b/paddle/fluid/operators/sequence_reshape_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_reshape_op.h b/paddle/fluid/operators/sequence_reshape_op.h index 7a5d1261da917c6e596ff7b85afbfd95ff90f12a..2893808ee9ceca12924efb4884d7fd6783e94e35 100644 --- a/paddle/fluid/operators/sequence_reshape_op.h +++ b/paddle/fluid/operators/sequence_reshape_op.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ class SequenceReshapeKernel : public framework::OpKernel { } } - framework::Copy(*in, context.GetPlace(), out); + framework::TensorCopy(*in, context.GetPlace(), out); out->Resize({static_cast(out->lod()[0].back()), out_width}); } }; @@ -77,7 +77,7 @@ class SequenceReshapeGradKernel : public framework::OpKernel { context.Output(framework::GradVarName("X")); xg_tensor_ptr->mutable_data(context.GetPlace()); - framework::Copy(*outg_tensor_ptr, context.GetPlace(), xg_tensor_ptr); + framework::TensorCopy(*outg_tensor_ptr, context.GetPlace(), xg_tensor_ptr); xg_tensor_ptr->Resize(x_tensor_ptr->dims()); } }; diff --git a/paddle/fluid/operators/sequence_slice_op.cc b/paddle/fluid/operators/sequence_slice_op.cc index 87b8eff64621290ebd75d2cb76d7c684655b884f..d09e5bca56b226100d2d0cf3a030c77703bfa76e 100644 --- a/paddle/fluid/operators/sequence_slice_op.cc +++ b/paddle/fluid/operators/sequence_slice_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_slice_op.cu b/paddle/fluid/operators/sequence_slice_op.cu index 041fabdf9a2dc73540ab45e5e86aa1ef71bed4dc..059e802df0ebdba68f758decfb8b54a362996335 100755 --- a/paddle/fluid/operators/sequence_slice_op.cu +++ b/paddle/fluid/operators/sequence_slice_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_slice_op.h b/paddle/fluid/operators/sequence_slice_op.h index 65c36a32aa12c628db5c4f0c104d3977e625ad97..b9c565cac9581a2e830697c1136919062eef345c 100644 --- a/paddle/fluid/operators/sequence_slice_op.h +++ b/paddle/fluid/operators/sequence_slice_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -66,13 +66,13 @@ class SequenceSliceOpKernel : public framework::OpKernel { if (platform::is_gpu_place(ctx.GetPlace())) { offset_cpu.mutable_data(offset->dims(), platform::CPUPlace()); - framework::Copy(*offset, platform::CPUPlace(), ctx.device_context(), - &offset_cpu); + framework::TensorCopy(*offset, platform::CPUPlace(), ctx.device_context(), + &offset_cpu); offset_data = offset_cpu.data(); length_cpu.mutable_data(length->dims(), platform::CPUPlace()); - framework::Copy(*length, platform::CPUPlace(), ctx.device_context(), - &length_cpu); + framework::TensorCopy(*length, platform::CPUPlace(), ctx.device_context(), + &length_cpu); length_data = length_cpu.data(); } @@ -127,13 +127,13 @@ class SequenceSliceGradOpKernel : public framework::OpKernel { if (platform::is_gpu_place(ctx.GetPlace())) { offset_cpu.mutable_data(offset->dims(), platform::CPUPlace()); - framework::Copy(*offset, platform::CPUPlace(), ctx.device_context(), - &offset_cpu); + framework::TensorCopy(*offset, platform::CPUPlace(), ctx.device_context(), + &offset_cpu); offset_data = offset_cpu.data(); length_cpu.mutable_data(length->dims(), platform::CPUPlace()); - framework::Copy(*length, platform::CPUPlace(), ctx.device_context(), - &length_cpu); + framework::TensorCopy(*length, platform::CPUPlace(), ctx.device_context(), + &length_cpu); length_data = length_cpu.data(); } diff --git a/paddle/fluid/operators/sequence_softmax_op.cc b/paddle/fluid/operators/sequence_softmax_op.cc index f966b7162077943dd78d601743b3a3e2e103444b..7e685eb3dc7b12ef38f06b37d99a1212cfbc992c 100644 --- a/paddle/fluid/operators/sequence_softmax_op.cc +++ b/paddle/fluid/operators/sequence_softmax_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_softmax_op.cu.cc b/paddle/fluid/operators/sequence_softmax_op.cu.cc index c42dfd7540954616eb7bf012160a98211c3caf1b..295c68c5b936d6522666a4cc4e621db6f5f5f3ed 100644 --- a/paddle/fluid/operators/sequence_softmax_op.cu.cc +++ b/paddle/fluid/operators/sequence_softmax_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sequence_softmax_op.h b/paddle/fluid/operators/sequence_softmax_op.h index e6c21c67b3362835b2ff87045a213b2636556346..cb93a02b8386ed50ff176fc25b88449b7eb16902 100644 --- a/paddle/fluid/operators/sequence_softmax_op.h +++ b/paddle/fluid/operators/sequence_softmax_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sgd_op.cc b/paddle/fluid/operators/sgd_op.cc index f1e23a62f4ec52b40cfa1febc98fbfb045f45efd..7cc73de8788e3dceb763b6f5a1519459d0fb05dd 100644 --- a/paddle/fluid/operators/sgd_op.cc +++ b/paddle/fluid/operators/sgd_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sgd_op.cu b/paddle/fluid/operators/sgd_op.cu index 09374e20494be2eebba913bd90a7c32e1aa0015b..9d211541c0bf729393b8190edb18e101d5e07d1a 100644 --- a/paddle/fluid/operators/sgd_op.cu +++ b/paddle/fluid/operators/sgd_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sgd_op.h b/paddle/fluid/operators/sgd_op.h index f1eaaecdb1eef1b42ea5d3b7315133c665b50df6..2fec84815a9ecc63675de88816b23cfaa75aca65 100644 --- a/paddle/fluid/operators/sgd_op.h +++ b/paddle/fluid/operators/sgd_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/shrink_rnn_memory_op.cc b/paddle/fluid/operators/shrink_rnn_memory_op.cc index 7fe0526381d1fc18ad0552c321875af42df0f6dc..a1871a8e7fb27d351f9d333966baa63c6f32ae01 100644 --- a/paddle/fluid/operators/shrink_rnn_memory_op.cc +++ b/paddle/fluid/operators/shrink_rnn_memory_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -133,7 +133,7 @@ class ShrinkRNNMemoryGradOp : public ArrayOp { auto &dout_tensor = dout_var->Get(); auto height = dout_tensor.dims()[0]; auto slice = dx_tensor.Slice(0, static_cast(height)); - framework::Copy(dout_tensor, dout_tensor.place(), dev_ctx, &slice); + framework::TensorCopy(dout_tensor, dout_tensor.place(), dev_ctx, &slice); if (dx_tensor.dims()[0] > height) { auto rest_tensor = dx_tensor.Slice( static_cast(height), static_cast(dx_tensor.dims()[0])); diff --git a/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc b/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc index 3188415a2bd4434704ca95b92427094023527019..7b93f19bb2f7102824852aa181e3728f79025121 100644 --- a/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc +++ b/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cu b/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cu index daa9d3e4fa5aeba77f770f69d6057ced98741eaa..9aadac1a416034a3510dea2916d7577efbc2f8c2 100644 --- a/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cu +++ b/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.h b/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.h index 977849f7627bc3f5b08a5f34bd300ab1442c6276..faef72866eb491887bbf221d32a8121b21fc3c66 100644 --- a/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.h +++ b/paddle/fluid/operators/sigmoid_cross_entropy_with_logits_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sign_op.cc b/paddle/fluid/operators/sign_op.cc index 54b962538b8426141c9ab1b9269c0ed8bd5a8496..8f8b7abd03212c12ca351e551621e63b4c7148c2 100644 --- a/paddle/fluid/operators/sign_op.cc +++ b/paddle/fluid/operators/sign_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sign_op.cu b/paddle/fluid/operators/sign_op.cu index 93cdb311eb4961a7754f9adfe14a15f3b2d0ca58..e0d7a87e6485a74dd1cdee1a05abc42eef460990 100644 --- a/paddle/fluid/operators/sign_op.cu +++ b/paddle/fluid/operators/sign_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sign_op.h b/paddle/fluid/operators/sign_op.h index 1c2ebebee40d9b64dd8b658b904e631ba294e41e..b99934daee17e2b8a9295b488c0483e47187a009 100644 --- a/paddle/fluid/operators/sign_op.h +++ b/paddle/fluid/operators/sign_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/smooth_l1_loss_op.cc b/paddle/fluid/operators/smooth_l1_loss_op.cc index e6eede23ee367200f9a2b531d1cbd402ceea6b54..658eb0195212cc3038fce6aab0ec3804efc59edf 100644 --- a/paddle/fluid/operators/smooth_l1_loss_op.cc +++ b/paddle/fluid/operators/smooth_l1_loss_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/smooth_l1_loss_op.cu b/paddle/fluid/operators/smooth_l1_loss_op.cu index 94c0d6cd299075541f0ef66cbc0bd48a8f4d51b3..dfbb5c905884b57413587a4f6c33b0238b740c73 100644 --- a/paddle/fluid/operators/smooth_l1_loss_op.cu +++ b/paddle/fluid/operators/smooth_l1_loss_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/smooth_l1_loss_op.h b/paddle/fluid/operators/smooth_l1_loss_op.h index 325ad824e1874281873b5e41ab62db0fa43040d0..efe3afba18e8f3368f2e21f91adc5aa935bf713a 100644 --- a/paddle/fluid/operators/smooth_l1_loss_op.h +++ b/paddle/fluid/operators/smooth_l1_loss_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/softmax_op.cc b/paddle/fluid/operators/softmax_op.cc index 1d9462d08b9cc06df2d0dca568dbbe1c50dc948f..09275ef290e8c78dc0902033e904cc4e7ccd7adb 100644 --- a/paddle/fluid/operators/softmax_op.cc +++ b/paddle/fluid/operators/softmax_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/softmax_op.cu.cc b/paddle/fluid/operators/softmax_op.cu.cc index c53d8a2bc82dcfafc178b67299769b2e06109eb3..dbd13fd38a33d4068a5b5d47cd92a81293f6e748 100644 --- a/paddle/fluid/operators/softmax_op.cu.cc +++ b/paddle/fluid/operators/softmax_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/softmax_op.h b/paddle/fluid/operators/softmax_op.h index 9287f0231031675b09c941f19c1df1fefc993506..600da45a0bbb69b76d59c981e195fc03a49b0504 100644 --- a/paddle/fluid/operators/softmax_op.h +++ b/paddle/fluid/operators/softmax_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/softmax_with_cross_entropy_op.cc b/paddle/fluid/operators/softmax_with_cross_entropy_op.cc index 79d56cb97d38ebd725668442c29229ef22f5b05e..857e5733573497b56520daa7860f4feb4e01cda7 100644 --- a/paddle/fluid/operators/softmax_with_cross_entropy_op.cc +++ b/paddle/fluid/operators/softmax_with_cross_entropy_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/softmax_with_cross_entropy_op.cu b/paddle/fluid/operators/softmax_with_cross_entropy_op.cu index 410d9e8887c593249495e08424467b4be15c9bcb..39b246a5bedb2819fc9b7fc407cfe03e59af0b68 100644 --- a/paddle/fluid/operators/softmax_with_cross_entropy_op.cu +++ b/paddle/fluid/operators/softmax_with_cross_entropy_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/softmax_with_cross_entropy_op.h b/paddle/fluid/operators/softmax_with_cross_entropy_op.h index 0927efd42ceb35cc4183f84d160c44f35f6cc3f5..dd6f6aca5ada7aa215d3b3444194fc53efeb7020 100644 --- a/paddle/fluid/operators/softmax_with_cross_entropy_op.h +++ b/paddle/fluid/operators/softmax_with_cross_entropy_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/split_lod_tensor_op.cc b/paddle/fluid/operators/split_lod_tensor_op.cc index f9600d99a36f59feddfbb5295b8b21ca6d5034cd..3222cce239988b170501f2b99e9f1253036b7fbc 100644 --- a/paddle/fluid/operators/split_lod_tensor_op.cc +++ b/paddle/fluid/operators/split_lod_tensor_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -55,7 +55,8 @@ class SplitLoDTensorOp : public framework::OperatorBase { cpu_mask->ShareDataWith(mask); } else if (platform::is_gpu_place(mask.place())) { #ifdef PADDLE_WITH_CUDA - framework::Copy(mask, platform::CPUPlace(), dev_ctx, cpu_mask.get()); + framework::TensorCopy(mask, platform::CPUPlace(), dev_ctx, + cpu_mask.get()); #else PADDLE_THROW("Not supported GPU, Please compile WITH_GPU option"); #endif @@ -113,9 +114,9 @@ class SplitLoDTensorOp : public framework::OperatorBase { // out[offset: offset+len] = x[each_range.begin: each_range.end] auto slice = out->Slice(static_cast(offset), static_cast(offset + len)); - framework::Copy(x.Slice(static_cast(each_range.begin), - static_cast(each_range.end)), - x.place(), dev_ctx, &slice); + framework::TensorCopy(x.Slice(static_cast(each_range.begin), + static_cast(each_range.end)), + x.place(), dev_ctx, &slice); offset += len; } } diff --git a/paddle/fluid/operators/split_op.cc b/paddle/fluid/operators/split_op.cc index f8bc22fe1d3d24866b5bf2506ed0ff585d259cc2..dffac772f11bee2fa3dcdf469a86adc57369b54d 100644 --- a/paddle/fluid/operators/split_op.cc +++ b/paddle/fluid/operators/split_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/split_op.cu.cc b/paddle/fluid/operators/split_op.cu.cc index 279691c759e988ea26a62e1263198d2a9d878cf9..efa378af857a8881f25c76379ba7cf81e64c80bb 100644 --- a/paddle/fluid/operators/split_op.cu.cc +++ b/paddle/fluid/operators/split_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/split_op.h b/paddle/fluid/operators/split_op.h index 06bcf82620bec57346c30b029d23ad8417252248..ae8562c0c503fec13dff61e04845ba0832848f5f 100644 --- a/paddle/fluid/operators/split_op.h +++ b/paddle/fluid/operators/split_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ class SplitOpKernel : public framework::OpKernel { auto out_stride = framework::stride_numel(out->dims()); StridedNumelCopyWithAxis(ctx.device_context(), axis, out->data(), out_stride, in->data() + input_offset, - in_stride); + in_stride, out_stride[axis]); input_offset += out_stride[axis]; } } diff --git a/paddle/fluid/operators/split_selected_rows_op.cc b/paddle/fluid/operators/split_selected_rows_op.cc index c30280f6545ee30afb46395ac0eb5efbba462c56..b0e21e01ecc55d666f43aee621e9b5a05b347e1d 100644 --- a/paddle/fluid/operators/split_selected_rows_op.cc +++ b/paddle/fluid/operators/split_selected_rows_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/split_selected_rows_op.cu b/paddle/fluid/operators/split_selected_rows_op.cu index 0bbf1ecfaefeddd426b1055d93ce39a138abec28..7250917036f611816a457e250b08f028f50f769d 100644 --- a/paddle/fluid/operators/split_selected_rows_op.cu +++ b/paddle/fluid/operators/split_selected_rows_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/split_selected_rows_op.h b/paddle/fluid/operators/split_selected_rows_op.h index af44b09b70095cb891bd6cabceb59daf118ecd22..23baf8e72eca87f3865fc2b63ce2de96f799dce3 100644 --- a/paddle/fluid/operators/split_selected_rows_op.h +++ b/paddle/fluid/operators/split_selected_rows_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/spp_op.cc b/paddle/fluid/operators/spp_op.cc index e6755b12000463b111fe65dbdf2c140a060d968b..f1c4415f27d54ad09e5cb3659bd16abd82e38215 100644 --- a/paddle/fluid/operators/spp_op.cc +++ b/paddle/fluid/operators/spp_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/spp_op.cu.cc b/paddle/fluid/operators/spp_op.cu.cc index cad2ca5ef8e16ee6ea6943f61da33367099e0937..7fe63d17c0dcc21f307dfc3089a84732c1c86889 100644 --- a/paddle/fluid/operators/spp_op.cu.cc +++ b/paddle/fluid/operators/spp_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/spp_op.h b/paddle/fluid/operators/spp_op.h index 1da1f805807fc648b3a54de91842f163b356435b..3d2f22632570fe2a28a822370a400390c78b533a 100644 --- a/paddle/fluid/operators/spp_op.h +++ b/paddle/fluid/operators/spp_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/squared_l2_distance_op.cc b/paddle/fluid/operators/squared_l2_distance_op.cc index c1d0c2c7f392cae3dc30611a0f077c1af7b68cbe..1c5e87040a8dd74b98d8e31bfe351ea256e01f15 100644 --- a/paddle/fluid/operators/squared_l2_distance_op.cc +++ b/paddle/fluid/operators/squared_l2_distance_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/squared_l2_distance_op.cu b/paddle/fluid/operators/squared_l2_distance_op.cu index 959e7afac99bd2565890cb6a296bc908f250a16c..3e80ae8dd22077c0f9bbdedc24e84f6c339c5a26 100644 --- a/paddle/fluid/operators/squared_l2_distance_op.cu +++ b/paddle/fluid/operators/squared_l2_distance_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/squared_l2_distance_op.h b/paddle/fluid/operators/squared_l2_distance_op.h index aab241247e5e92f43a997f3d29c8e7d7d44d7711..e0133d33e6a840d2d06832393a064df978cb9cbc 100644 --- a/paddle/fluid/operators/squared_l2_distance_op.h +++ b/paddle/fluid/operators/squared_l2_distance_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/squared_l2_norm_op.cc b/paddle/fluid/operators/squared_l2_norm_op.cc index a43cc22994b1b15a4acf0fd89b956bf05d3f35c8..b64df2a218860be3adb3954e07b036c05bf05c8e 100644 --- a/paddle/fluid/operators/squared_l2_norm_op.cc +++ b/paddle/fluid/operators/squared_l2_norm_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/squared_l2_norm_op.cu b/paddle/fluid/operators/squared_l2_norm_op.cu index 52f4ab79b2189b269b7d0685dccedc52b627ad8d..87830413da3f141f01a97966ae0e2b0501ed600a 100644 --- a/paddle/fluid/operators/squared_l2_norm_op.cu +++ b/paddle/fluid/operators/squared_l2_norm_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/squared_l2_norm_op.h b/paddle/fluid/operators/squared_l2_norm_op.h index 56524636b8f1b063266fda0997e91a703131adff..b32db4569e7ac0008074300c31e094de95afee30 100644 --- a/paddle/fluid/operators/squared_l2_norm_op.h +++ b/paddle/fluid/operators/squared_l2_norm_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/strided_memcpy.h b/paddle/fluid/operators/strided_memcpy.h index 385124305e2d9afd62313ca46178b4916cd6405d..22c1db82e9f5aff6aa9a311cd1093b33fa7e6db9 100644 --- a/paddle/fluid/operators/strided_memcpy.h +++ b/paddle/fluid/operators/strided_memcpy.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -54,7 +54,8 @@ inline void StridedNumelCopyWithAxis(const platform::DeviceContext& ctx, int64_t axis, T* dst, const framework::DDim& dst_stride_numel, const T* src, - const framework::DDim& src_stride_numel) { + const framework::DDim& src_stride_numel, + int64_t size) { int64_t before = dst_stride_numel[0] / dst_stride_numel[axis]; int64_t src_after = src_stride_numel[axis]; int64_t dst_after = dst_stride_numel[axis]; @@ -82,15 +83,14 @@ inline void StridedNumelCopyWithAxis(const platform::DeviceContext& ctx, if (platform::is_cpu_place(place)) { auto& cpu_place = boost::get(place); memory::Copy(cpu_place, dst + i * dst_after, cpu_place, - src + i * src_after, sizeof(T) * src_after); + src + i * src_after, sizeof(T) * size); } else { #ifdef PADDLE_WITH_CUDA auto& gpu_place = boost::get(place); auto& cuda_ctx = reinterpret_cast(ctx); memory::Copy(gpu_place, dst + i * dst_after, gpu_place, - src + i * src_after, sizeof(T) * src_after, - cuda_ctx.stream()); + src + i * src_after, sizeof(T) * size, cuda_ctx.stream()); #else PADDLE_THROW("Paddle is not compiled with GPU"); #endif diff --git a/paddle/fluid/operators/strided_memcpy_test.cc b/paddle/fluid/operators/strided_memcpy_test.cc index a369941a993c02744cb7de0d6c6c878f56d5e0fe..a6ca82d16f216c98055fb92b4575a357b8b10348 100644 --- a/paddle/fluid/operators/strided_memcpy_test.cc +++ b/paddle/fluid/operators/strided_memcpy_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/sum_op.cc b/paddle/fluid/operators/sum_op.cc index 96f851720aea2ddd643e1e6251fee314e26cbf95..c3abb3ea4a53126c22c817069e8ad955b202f09d 100644 --- a/paddle/fluid/operators/sum_op.cc +++ b/paddle/fluid/operators/sum_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -29,7 +29,7 @@ class SumOp : public framework::OperatorWithKernel { "Output(Out) of SumOp should not be null."); if (ctx->IsRuntime() && ctx->GetOutputsVarType("Out")[0] == - framework::proto::VarDesc::LOD_TENSOR_ARRAY) { + framework::proto::VarType::LOD_TENSOR_ARRAY) { return; // skip runtime infershape when is tensor array; } @@ -73,7 +73,8 @@ class SumOp : public framework::OperatorWithKernel { "Sum operator should have at least one tensor"); return framework::OpKernelType( - static_cast(dtype), ctx.device_context()); + static_cast(dtype), + ctx.device_context()); } else if (x_vars[0]->IsType()) { return framework::OpKernelType( framework::ToDataType( @@ -118,7 +119,7 @@ class SumOpVarTypeInference : public framework::VarTypeInference { void operator()(const framework::OpDesc& op_desc, framework::BlockDesc* block) const override { auto& inputs = op_desc.Input("X"); - auto var_type = framework::proto::VarDesc::SELECTED_ROWS; + auto var_type = framework::proto::VarType::SELECTED_ROWS; for (auto& name : op_desc.Input("X")) { VLOG(10) << name << " " @@ -128,12 +129,12 @@ class SumOpVarTypeInference : public framework::VarTypeInference { bool any_input_is_lod_tensor = std::any_of( inputs.begin(), inputs.end(), [block](const std::string& name) { return block->FindRecursiveOrCreateVar(name).GetType() == - framework::proto::VarDesc::LOD_TENSOR; + framework::proto::VarType::LOD_TENSOR; }); auto is_tensor_array = [block](const std::string& name) { return block->FindRecursiveOrCreateVar(name).GetType() == - framework::proto::VarDesc::LOD_TENSOR_ARRAY; + framework::proto::VarType::LOD_TENSOR_ARRAY; }; bool any_input_is_tensor_array = @@ -151,9 +152,9 @@ class SumOpVarTypeInference : public framework::VarTypeInference { PADDLE_ENFORCE(all_inputs_are_tensor_array, "Not all inputs are tensor array:\n%s", os.str()); } - var_type = framework::proto::VarDesc::LOD_TENSOR_ARRAY; + var_type = framework::proto::VarType::LOD_TENSOR_ARRAY; } else if (any_input_is_lod_tensor) { - var_type = framework::proto::VarDesc::LOD_TENSOR; + var_type = framework::proto::VarType::LOD_TENSOR; } auto out_var_name = op_desc.Output("Out").front(); diff --git a/paddle/fluid/operators/sum_op.cu b/paddle/fluid/operators/sum_op.cu index 8d8f90d7510bae854a0507adaf8998fb7aea3b58..89bcd1bbc86dc29cb7b98cbef3057a8f98c74555 100644 --- a/paddle/fluid/operators/sum_op.cu +++ b/paddle/fluid/operators/sum_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/operators/sum_op.h b/paddle/fluid/operators/sum_op.h index 08218b6836e2f10ba220523d6241fb0ee4c0b3f2..48b2d2779aeeb168cf87e61557e01d5cbde476b3 100644 --- a/paddle/fluid/operators/sum_op.h +++ b/paddle/fluid/operators/sum_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -137,8 +137,8 @@ class SumKernel : public framework::OpKernel { out_array.resize(i + 1); } if (out_array[i].numel() == 0) { - framework::Copy(in_array[i], in_array[i].place(), - context.device_context(), &out_array[i]); + framework::TensorCopy(in_array[i], in_array[i].place(), + context.device_context(), &out_array[i]); out_array[i].set_lod(in_array[i].lod()); } else { PADDLE_ENFORCE(out_array[i].lod() == in_array[i].lod()); diff --git a/paddle/fluid/operators/target_assign_op.cc b/paddle/fluid/operators/target_assign_op.cc index bafb830df930bc8d910898f7f2a33c61c6ff824b..a894b12fa35a121eff0b8f9d2d0eecc5ae5185f3 100644 --- a/paddle/fluid/operators/target_assign_op.cc +++ b/paddle/fluid/operators/target_assign_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/target_assign_op.cu b/paddle/fluid/operators/target_assign_op.cu index fa02b8aac9052ac5126d705fe16eff47385e1b05..24664f99b20f92108220d27ec58e8fdf3ba6193c 100644 --- a/paddle/fluid/operators/target_assign_op.cu +++ b/paddle/fluid/operators/target_assign_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/target_assign_op.h b/paddle/fluid/operators/target_assign_op.h index a1b2fe6f3505e6c96340125bc3ad184b34218f47..3d529737414d54f05e8c82ede1d6068e5d261110 100644 --- a/paddle/fluid/operators/target_assign_op.h +++ b/paddle/fluid/operators/target_assign_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/tensor_array_read_write_op.cc b/paddle/fluid/operators/tensor_array_read_write_op.cc index 704ee964c908c44d84316985429a6551b770e33f..2636812c42985536e7ca3475c03bbd8d1638ece6 100644 --- a/paddle/fluid/operators/tensor_array_read_write_op.cc +++ b/paddle/fluid/operators/tensor_array_read_write_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ class WriteToArrayOp : public ArrayOp { platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(place); - Copy(x_tensor, place, dev_ctx, out_tensor); + TensorCopy(x_tensor, place, dev_ctx, out_tensor); out_tensor->set_lod(x_tensor.lod()); } else { VLOG(10) << "WARNING: The input tensor 'x_tensor' holds no memory, so " @@ -108,7 +108,7 @@ class WriteToArrayInferVarType : public framework::VarTypeInference { auto out_name = op_desc.Output("Out")[0]; VLOG(10) << "Set Variable " << out_name << " as LOD_TENSOR_ARRAY"; auto &out = block->FindRecursiveOrCreateVar(out_name); - out.SetType(framework::proto::VarDesc::LOD_TENSOR_ARRAY); + out.SetType(framework::proto::VarType::LOD_TENSOR_ARRAY); auto *x = block->FindVarRecursive(x_name); if (x != nullptr) { out.SetDataType(x->GetDataType()); @@ -138,7 +138,7 @@ class ReadFromArrayOp : public ArrayOp { platform::DeviceContextPool &pool = platform::DeviceContextPool::Instance(); auto &dev_ctx = *pool.Get(place); - framework::Copy(x_array[offset], place, dev_ctx, out_tensor); + framework::TensorCopy(x_array[offset], place, dev_ctx, out_tensor); out_tensor->set_lod(x_array[offset].lod()); } else { VLOG(10) << "offset " << offset << " >= " << x_array.size(); diff --git a/paddle/fluid/operators/top_k_op.cc b/paddle/fluid/operators/top_k_op.cc index c81ea860d0c9fa5498de2d149e3d05d080ad729f..2e4e8caed5327f4ca9038c376de2ec831354917e 100644 --- a/paddle/fluid/operators/top_k_op.cc +++ b/paddle/fluid/operators/top_k_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/top_k_op.cu b/paddle/fluid/operators/top_k_op.cu index 5390cb5063bcc302f5ff9cfe96bd421b477eeb3f..bfd26c2f2294f954adc81a1719650c46372098c4 100644 --- a/paddle/fluid/operators/top_k_op.cu +++ b/paddle/fluid/operators/top_k_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/top_k_op.h b/paddle/fluid/operators/top_k_op.h index e32b35150070b30c3ccbbb9483c1f24b1d205919..42828b7e6564d7da91d608d63fbc0615ef6c4f97 100644 --- a/paddle/fluid/operators/top_k_op.h +++ b/paddle/fluid/operators/top_k_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/transpose_op.cc b/paddle/fluid/operators/transpose_op.cc index a3d8acffc269c1abe98d2de39dcf09fbf3d825f3..87b1f530e08df7022d112b26e28511a982052126 100644 --- a/paddle/fluid/operators/transpose_op.cc +++ b/paddle/fluid/operators/transpose_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/transpose_op.cu.cc b/paddle/fluid/operators/transpose_op.cu.cc index f8667ab369e1de9c2b74ba902242355d1660d24a..bcd1fb631394bc33b6fc162cfa7cbb20d55a654b 100644 --- a/paddle/fluid/operators/transpose_op.cu.cc +++ b/paddle/fluid/operators/transpose_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/transpose_op.h b/paddle/fluid/operators/transpose_op.h index 1fb419474ab078efa64523454bbbbb6176a58d40..90f16499a6f52514bfed3dbeb4176ccc956b23d7 100644 --- a/paddle/fluid/operators/transpose_op.h +++ b/paddle/fluid/operators/transpose_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/uniform_random_batch_size_like_op.cc b/paddle/fluid/operators/uniform_random_batch_size_like_op.cc new file mode 100644 index 0000000000000000000000000000000000000000..00f00bb403db5e40939a1502b2219fb4d36d58e5 --- /dev/null +++ b/paddle/fluid/operators/uniform_random_batch_size_like_op.cc @@ -0,0 +1,72 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#include "paddle/fluid/framework/op_registry.h" +#include "paddle/fluid/framework/operator.h" +#include "paddle/fluid/operators/batch_size_like.h" + +namespace paddle { +namespace operators { + +class UniformRandomBatchSizeLikeOp : public BatchSizeLikeOp { + protected: + using BatchSizeLikeOp::BatchSizeLikeOp; + + framework::OpKernelType GetExpectedKernelType( + const framework::ExecutionContext &ctx) const override { + return framework::OpKernelType( + static_cast(ctx.Attr("dtype")), + ctx.GetPlace()); + } +}; + +class UniformRandomBatchSizeLikeOpMaker : public BatchSizeLikeOpMaker { + public: + UniformRandomBatchSizeLikeOpMaker(OpProto *proto, OpAttrChecker *op_checker) + : BatchSizeLikeOpMaker(proto, op_checker) { + AddComment(R"DOC( +Uniform random operator + +This operator initializes a tensor with the same batch_size as the Input tensor + with random values sampled from a uniform distribution. + +)DOC"); + AddAttr("min", + "(float, default -1.0) " + "Minimum value of uniform random") + .SetDefault(-1.0f); + AddAttr("max", + "(float, default 1.0) " + "Maximun value of uniform random") + .SetDefault(1.0f); + AddAttr("seed", + "(int, default 0) " + "Random seed used for generating samples. " + "0 means use a seed generated by the system." + "Note that if seed is not 0, this operator will always " + "generate the same random numbers every time.") + .SetDefault(0); + AddAttr("dtype", "(int, default 5(FP32)) Output tensor data type") + .SetDefault(framework::proto::VarType::FP32); + } +}; + +} // namespace operators +} // namespace paddle + +REGISTER_OP_WITHOUT_GRADIENT( + uniform_random_batch_size_like, + paddle::operators::UniformRandomBatchSizeLikeOp, + paddle::operators::UniformRandomBatchSizeLikeOpMaker); +// Kernels are registered in uniform_random_op.cc and uniform_random_op.cu diff --git a/paddle/fluid/operators/uniform_random_op.cc b/paddle/fluid/operators/uniform_random_op.cc index b6fea1d4485fd7f88375c96511c85396b707bf1c..87699362b2b5a14750a01345098ec5e6cc9be115 100644 --- a/paddle/fluid/operators/uniform_random_op.cc +++ b/paddle/fluid/operators/uniform_random_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ class UniformRandomOp : public framework::OperatorWithKernel { framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext& ctx) const override { return framework::OpKernelType( - static_cast(ctx.Attr("dtype")), + static_cast(ctx.Attr("dtype")), ctx.GetPlace()); } }; @@ -79,7 +79,7 @@ class UniformRandomOpMaker : public framework::OpProtoAndCheckerMaker { AddComment(R"DOC( Uniform random operator. -This operator initializes a tensor with random values sampled from a +This operator initializes a tensor with random values sampled from a uniform distribution. )DOC"); @@ -96,10 +96,12 @@ uniform distribution. AddAttr("seed", "(int, default 0) " "Random seed used for generating samples. " - "0 means use a seed generated by the system.") + "0 means use a seed generated by the system." + "Note that if seed is not 0, this operator will always " + "generate the same random numbers every time.") .SetDefault(0); AddAttr("dtype", "(int, default 5(FP32)) Output tensor data type") - .SetDefault(framework::proto::DataType::FP32); + .SetDefault(framework::proto::VarType::FP32); } }; } // namespace operators @@ -110,3 +112,6 @@ REGISTER_OP_WITHOUT_GRADIENT(uniform_random, paddle::operators::UniformRandomOp, REGISTER_OP_CPU_KERNEL(uniform_random, paddle::operators::CPUUniformRandomKernel, paddle::operators::CPUUniformRandomKernel); +REGISTER_OP_CPU_KERNEL(uniform_random_batch_size_like, + paddle::operators::CPUUniformRandomKernel, + paddle::operators::CPUUniformRandomKernel); diff --git a/paddle/fluid/operators/uniform_random_op.cu b/paddle/fluid/operators/uniform_random_op.cu index 9afca68e59f8c0eedaf38be4b51343b9cb043f65..1232cd1eb332441b12e59a34b2c2f75669925fd0 100644 --- a/paddle/fluid/operators/uniform_random_op.cu +++ b/paddle/fluid/operators/uniform_random_op.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -66,3 +66,6 @@ class GPUUniformRandomKernel : public framework::OpKernel { REGISTER_OP_CUDA_KERNEL(uniform_random, paddle::operators::GPUUniformRandomKernel, paddle::operators::GPUUniformRandomKernel); +REGISTER_OP_CUDA_KERNEL(uniform_random_batch_size_like, + paddle::operators::GPUUniformRandomKernel, + paddle::operators::GPUUniformRandomKernel); diff --git a/paddle/fluid/operators/unpool_op.cc b/paddle/fluid/operators/unpool_op.cc index 2e0b271fed69772a53a776f290d524565df3dc94..0ca7ea00fafc5cf7ab240e1e41710d3b791dfbfb 100644 --- a/paddle/fluid/operators/unpool_op.cc +++ b/paddle/fluid/operators/unpool_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ Paper: http://www.matthewzeiler.com/wp-content/uploads/2017/07/iccv2011.pdf } }; -int OutputSize(int input_size, int ksize, int padding, int stride) { +int UnpoolOutputSize(int input_size, int ksize, int padding, int stride) { int output_size = (input_size - 1) * stride - 2 * padding + ksize; return output_size; } @@ -101,8 +101,8 @@ class UnpoolOp : public framework::OperatorWithKernel { PADDLE_ENFORCE_EQ(in_x_dims, in_y_dims); std::vector output_shape({in_x_dims[0], in_x_dims[1]}); for (size_t i = 0; i < ksize.size(); ++i) { - output_shape.push_back( - OutputSize(in_x_dims[i + 2], ksize[i], paddings[i], strides[i])); + output_shape.push_back(UnpoolOutputSize(in_x_dims[i + 2], ksize[i], + paddings[i], strides[i])); } ctx->SetOutputDim("Out", framework::make_ddim(output_shape)); } diff --git a/paddle/fluid/operators/unpool_op.cu.cc b/paddle/fluid/operators/unpool_op.cu.cc index 15d81eb296ba35d9f67426083870c1a83ff66ee5..7c59a0feaa472e57b3c9505a88de6743cbf71a74 100644 --- a/paddle/fluid/operators/unpool_op.cu.cc +++ b/paddle/fluid/operators/unpool_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/unpool_op.h b/paddle/fluid/operators/unpool_op.h index ceed5507391b40491d4a26bbc51e8c861e1bf1c2..a4421045756bd39728fc14c06efd11a56c7e55af 100644 --- a/paddle/fluid/operators/unpool_op.h +++ b/paddle/fluid/operators/unpool_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/warpctc_op.cc b/paddle/fluid/operators/warpctc_op.cc index 1c05fed0b47c3bb3582e4b261ef188146d41820e..940bf4fe7baa6a01a2143374b502c61d0b55fd77 100644 --- a/paddle/fluid/operators/warpctc_op.cc +++ b/paddle/fluid/operators/warpctc_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/warpctc_op.cu.cc b/paddle/fluid/operators/warpctc_op.cu.cc index 9ee7f970a9a5f7deaab8a98278cf1a7c051cfbd2..6f8559f542f6034661b6ff346beccd9626e2370a 100644 --- a/paddle/fluid/operators/warpctc_op.cu.cc +++ b/paddle/fluid/operators/warpctc_op.cu.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/operators/warpctc_op.h b/paddle/fluid/operators/warpctc_op.h index a1de71627ee7e511a03231c11831cf54755a145e..3e3e3089315ab9365925c38b9bce5fb0120d37c3 100644 --- a/paddle/fluid/operators/warpctc_op.h +++ b/paddle/fluid/operators/warpctc_op.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -185,7 +185,8 @@ class WarpCTCKernel : public framework::OpKernel { // warpctc accesses labels in CPU memory Tensor warpctc_label; - Copy(*label, platform::CPUPlace(), ctx.device_context(), &warpctc_label); + TensorCopy(*label, platform::CPUPlace(), ctx.device_context(), + &warpctc_label); const int* warpctc_label_data = warpctc_label.data(); // warpctc stores loss in CPU memory Tensor warpctc_loss; @@ -200,7 +201,7 @@ class WarpCTCKernel : public framework::OpKernel { sequence_width, num_sequences, blank, warpctc_loss_data); // Copy the loss back - Copy(warpctc_loss, ctx.GetPlace(), ctx.device_context(), loss); + TensorCopy(warpctc_loss, ctx.GetPlace(), ctx.device_context(), loss); } }; diff --git a/paddle/fluid/operators/while_op.cc b/paddle/fluid/operators/while_op.cc index a7a05cc5f79da6c1e6945a83f997e54041d2045d..8b62b242cf8745378eb216db10605388b294ca75 100644 --- a/paddle/fluid/operators/while_op.cc +++ b/paddle/fluid/operators/while_op.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -231,7 +231,8 @@ class WhileGradOpDescMaker : public framework::SingleGradOpDescMaker { while_grad->SetInput(kStepScopes, Output(kStepScopes)); auto *grad_block = this->grad_block_[0]; - auto *fwd_block = grad_block->ParentBlock(); + auto *fwd_block = grad_block->ForwardBlock(); + auto *parent_block = grad_block->ParentBlock(); // Not all of IGs will be generated by inner gradient operators of while op. // Ignore IGs that is not generated by the inside block. @@ -260,33 +261,37 @@ class WhileGradOpDescMaker : public framework::SingleGradOpDescMaker { for (auto &o : Output(kOutputs)) { block_ins.insert(o); } - std::unordered_set extra_inputs; + std::unordered_set output_grads; for (const auto *op : grad_block->AllOps()) { for (auto &input_name : op->InputArgumentNames()) { // If the input of Op has been recorded or is generated by the forward // block, do not make it as input again. + + // The input is located in I/O or other op's outputs or the variable is + // located in grad_block's parents if (block_ins.find(input_name) != block_ins.end() || - fwd_block->FindVar(input_name) != nullptr) { + (fwd_block->FindVarRecursive(input_name) != nullptr || + parent_block->FindVarRecursive(input_name) != nullptr)) { continue; } - extra_inputs.insert(input_name); + output_grads.insert(input_name); } for (auto &output_name : op->OutputArgumentNames()) { block_ins.insert(output_name); } } - std::vector extra_inputs_list; - extra_inputs_list.resize(extra_inputs.size()); - std::copy(extra_inputs.begin(), extra_inputs.end(), - extra_inputs_list.begin()); - while_grad->SetInput(framework::GradVarName(kOutputs), extra_inputs_list); + std::vector output_grads_list; + output_grads_list.resize(output_grads.size()); + std::copy(output_grads.begin(), output_grads.end(), + output_grads_list.begin()); + while_grad->SetInput(framework::GradVarName(kOutputs), output_grads_list); while_grad->SetAttrMap(this->Attrs()); while_grad->SetBlockAttr(kStepBlock, *grad_block); // record the original output gradient names, since the gradient name of // while operator could be renamed. - while_grad->SetAttr("original_output_grad", extra_inputs_list); + while_grad->SetAttr("original_output_grad", output_grads_list); return std::unique_ptr(while_grad); } @@ -330,10 +335,10 @@ class WhileGradOpShapeInference : public framework::InferShapeBase { continue; } auto dims = ctx->GetInputsElementDim(kX, i); - if (var_types[i] == framework::proto::VarDesc::LOD_TENSOR) { + if (var_types[i] == framework::proto::VarType::LOD_TENSOR) { names_to_set.push_back(pg_names[i]); dims_to_set.push_back(dims); - } else if (var_types[i] == framework::proto::VarDesc::LOD_TENSOR_ARRAY) { + } else if (var_types[i] == framework::proto::VarType::LOD_TENSOR_ARRAY) { // not sure how to set the dim of LOD_TENSOR_ARRAY names_to_set.push_back(pg_names[i]); dims_to_set.push_back(dims); diff --git a/paddle/fluid/platform/CMakeLists.txt b/paddle/fluid/platform/CMakeLists.txt index 5ce4b3de39d93e1935c6349ae446dec11d2fa986..0d0cee21d14f29c03ebabcb921ecc4f29f352b55 100644 --- a/paddle/fluid/platform/CMakeLists.txt +++ b/paddle/fluid/platform/CMakeLists.txt @@ -1,5 +1,5 @@ if(WITH_GPU) - cc_library(enforce SRCS enforce.cc DEPS nccl) + cc_library(enforce SRCS enforce.cc DEPS) else() cc_library(enforce SRCS enforce.cc) endif() @@ -27,7 +27,7 @@ ELSE() set(MKLDNN_CTX_DEPS) ENDIF() -# memcpy deoends on device_context, here add deps individually for +# memcpy depends on device_context, here add deps individually for # avoiding cycle dependencies cc_library(device_context SRCS device_context.cc DEPS memory buddy_allocator system_allocator memory_block meta_data meta_cache place eigen3 ${GPU_CTX_DEPS} ${MKLDNN_CTX_DEPS}) @@ -39,3 +39,6 @@ nv_test(nccl_test SRCS nccl_test.cu DEPS dynload_cuda gpu_info device_context) cc_library(profiler SRCS profiler.cc DEPS device_context) cc_test(profiler_test SRCS profiler_test.cc DEPS profiler) + +nv_test(float16_gpu_test SRCS float16_test.cu) +cc_test(float16_test SRCS float16_test.cc) diff --git a/paddle/fluid/platform/assert.h b/paddle/fluid/platform/assert.h index 1f5a8f6a195738ec3b0681aff8565885258a91fb..123d3598f4f4753f70889e415aff0f41b7d212f7 100644 --- a/paddle/fluid/platform/assert.h +++ b/paddle/fluid/platform/assert.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/call_once.h b/paddle/fluid/platform/call_once.h index 44a4d38f679ddf6c317e52132b6cf3eb2f0a0649..fa34972c38d6e7f77a7e178d68592f9886748fa1 100644 --- a/paddle/fluid/platform/call_once.h +++ b/paddle/fluid/platform/call_once.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/cpu_info.cc b/paddle/fluid/platform/cpu_info.cc index 47473aead0e512005a63e60b01170b41500dd1f6..8db08edba805e41d33ec6a6a4b338cca0d4906ef 100644 --- a/paddle/fluid/platform/cpu_info.cc +++ b/paddle/fluid/platform/cpu_info.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/cpu_info.h b/paddle/fluid/platform/cpu_info.h index 8df7c7b4bca5bc88f6ed95d6ab82c81b73918e92..a930151bd15a33d5b8861c6239e7dd964822f0f6 100644 --- a/paddle/fluid/platform/cpu_info.h +++ b/paddle/fluid/platform/cpu_info.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/cpu_info_test.cc b/paddle/fluid/platform/cpu_info_test.cc index 046758c594ff59ade06ae9904bb67b8418a539fe..78332f90cd96d80cca0cf865f4815aaf18463253 100644 --- a/paddle/fluid/platform/cpu_info_test.cc +++ b/paddle/fluid/platform/cpu_info_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/cuda_helper.h b/paddle/fluid/platform/cuda_helper.h index 376bb0e6887c797c3c1019e92f738a62d01a9c51..881d611d4ac26f992036f639097815aff625227b 100644 --- a/paddle/fluid/platform/cuda_helper.h +++ b/paddle/fluid/platform/cuda_helper.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/cuda_profiler.h b/paddle/fluid/platform/cuda_profiler.h index 67d5f626d41c0fae280062533d6c1d1074341164..ebd6aebd7688549c6fb14466cfa461b90a9fdde0 100644 --- a/paddle/fluid/platform/cuda_profiler.h +++ b/paddle/fluid/platform/cuda_profiler.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/cudnn_helper.h b/paddle/fluid/platform/cudnn_helper.h index f2daa4f4fcc6fe43c2950b413024df7e301abf50..48c967de1155a705b76f0285a4baed52d7ce1f58 100644 --- a/paddle/fluid/platform/cudnn_helper.h +++ b/paddle/fluid/platform/cudnn_helper.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/cudnn_helper_test.cc b/paddle/fluid/platform/cudnn_helper_test.cc index cd0bd3fe3ed115c4a91723e1023851456da74890..517df6863499f20d7b66d15ef114a689700be5b2 100644 --- a/paddle/fluid/platform/cudnn_helper_test.cc +++ b/paddle/fluid/platform/cudnn_helper_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/details/device_ptr_cast.h b/paddle/fluid/platform/details/device_ptr_cast.h index 4015491fcdc3554029aa771ab7da1b2f3424321f..1c502a19c056c7fe434e68d568a0f59bf6315b95 100644 --- a/paddle/fluid/platform/details/device_ptr_cast.h +++ b/paddle/fluid/platform/details/device_ptr_cast.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/device_context.cc b/paddle/fluid/platform/device_context.cc index c4da846bb1c25abc3d31006657652abaa5a11add..7da6e04d0a8b81bcb5fb6b105ebdd5b908cf8f1d 100644 --- a/paddle/fluid/platform/device_context.cc +++ b/paddle/fluid/platform/device_context.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/platform/device_context.h b/paddle/fluid/platform/device_context.h index 10b581f41a1e9473a2f85d3e5d2e40ee1fdaa1af..a294ba5101528c9ac0007bdcfc5255a0c2674aad 100644 --- a/paddle/fluid/platform/device_context.h +++ b/paddle/fluid/platform/device_context.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/fluid/platform/device_context_test.cu b/paddle/fluid/platform/device_context_test.cu index f4dae6e90a8d12fc2dccab6fd3c6881e58e80fed..9d8d07362ce3a0d0c2a009c9844db0a3bdaf01cb 100644 --- a/paddle/fluid/platform/device_context_test.cu +++ b/paddle/fluid/platform/device_context_test.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/CMakeLists.txt b/paddle/fluid/platform/dynload/CMakeLists.txt index cf2081b434961c17c1b65509909699788d2b9ad9..264b4ebf2c06d9e688a32a223dff3ec079333fd9 100644 --- a/paddle/fluid/platform/dynload/CMakeLists.txt +++ b/paddle/fluid/platform/dynload/CMakeLists.txt @@ -1,4 +1,4 @@ cc_library(dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags enforce) nv_library(dynload_cuda SRCS cublas.cc cudnn.cc curand.cc nccl.cc - DEPS dynamic_loader nccl) + DEPS dynamic_loader) cc_library(dynload_warpctc SRCS warpctc.cc DEPS dynamic_loader warpctc) diff --git a/paddle/fluid/platform/dynload/cublas.cc b/paddle/fluid/platform/dynload/cublas.cc index c599712554b1d6183c896eb7fc6ac5bbf71d67fc..e90e3105f0809b3c7507a86fa5a3d61864290fcb 100644 --- a/paddle/fluid/platform/dynload/cublas.cc +++ b/paddle/fluid/platform/dynload/cublas.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/cublas.h b/paddle/fluid/platform/dynload/cublas.h index 05f69e506515ac092c8509fba26e5b7a0f0823f7..580ed9bb57fca942bb76b9f7bf76f48ea281a0de 100644 --- a/paddle/fluid/platform/dynload/cublas.h +++ b/paddle/fluid/platform/dynload/cublas.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/cudnn.cc b/paddle/fluid/platform/dynload/cudnn.cc index 0b1c4c4f9609ebb61674c07f6cfd615d9674dfcd..c65b060ab46cfcd38292be66dd5f2123f88bae63 100644 --- a/paddle/fluid/platform/dynload/cudnn.cc +++ b/paddle/fluid/platform/dynload/cudnn.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/cudnn.h b/paddle/fluid/platform/dynload/cudnn.h index 00dfbc83872ed04d2b4e840e3f6ac31e89a8a3cd..81acc445bd3803dede158ff09507a72fb6e293ac 100644 --- a/paddle/fluid/platform/dynload/cudnn.h +++ b/paddle/fluid/platform/dynload/cudnn.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/curand.cc b/paddle/fluid/platform/dynload/curand.cc index eac690b1458a4e53f6958b77d01d2c3c9f26f6eb..ce83ebc84fe7bbd91e1c7e46f98a7f0d8b4a7394 100644 --- a/paddle/fluid/platform/dynload/curand.cc +++ b/paddle/fluid/platform/dynload/curand.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/curand.h b/paddle/fluid/platform/dynload/curand.h index ce3115b3ce0dbaa30af63bfc15908f81c16309d1..1b3ff962d6edceb37deb94cc7daead7346d25352 100644 --- a/paddle/fluid/platform/dynload/curand.h +++ b/paddle/fluid/platform/dynload/curand.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/dynamic_loader.cc b/paddle/fluid/platform/dynload/dynamic_loader.cc index eb00f93b7cde0a39beb4adabd910eef634c2581c..db1eb41f28e67ee4ed6b276714db989bd25ece2e 100644 --- a/paddle/fluid/platform/dynload/dynamic_loader.cc +++ b/paddle/fluid/platform/dynload/dynamic_loader.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/dynamic_loader.h b/paddle/fluid/platform/dynload/dynamic_loader.h index 7b0c8c16d7484480550f3c753fe52d1f04651900..4ffc335332698d1aba262edf2800965e72de77cb 100644 --- a/paddle/fluid/platform/dynload/dynamic_loader.h +++ b/paddle/fluid/platform/dynload/dynamic_loader.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/nccl.cc b/paddle/fluid/platform/dynload/nccl.cc index 1dc3e96f04a4f98e5cf0cb7848a99213ca082b79..3edc70c46d03ddcc751e865676928c47fcb48e69 100644 --- a/paddle/fluid/platform/dynload/nccl.cc +++ b/paddle/fluid/platform/dynload/nccl.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/nccl.h b/paddle/fluid/platform/dynload/nccl.h index 349a4d0ba325fe1f7c23873c82dce0d35d295340..dc78bcb44d3316a1ecee0c8d70dcb4777a9e2de4 100644 --- a/paddle/fluid/platform/dynload/nccl.h +++ b/paddle/fluid/platform/dynload/nccl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/warpctc.cc b/paddle/fluid/platform/dynload/warpctc.cc index 84de2cae94790ca44c8c0f87d75a45a1b7001a64..4a150048959c52e88515e196390aae57a4e9c12e 100644 --- a/paddle/fluid/platform/dynload/warpctc.cc +++ b/paddle/fluid/platform/dynload/warpctc.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/dynload/warpctc.h b/paddle/fluid/platform/dynload/warpctc.h index f1955818dede54b0d9c53cb33b95c6102b854d7b..f5ded0eb6b1107c886641e848f5040a7a2d806a5 100644 --- a/paddle/fluid/platform/dynload/warpctc.h +++ b/paddle/fluid/platform/dynload/warpctc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/enforce.cc b/paddle/fluid/platform/enforce.cc index 55cd80943cf18545d3cac6f3ebddee1030d62b37..6d0c656781af474fe0e858327d223539bf8f8692 100644 --- a/paddle/fluid/platform/enforce.cc +++ b/paddle/fluid/platform/enforce.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/enforce.h b/paddle/fluid/platform/enforce.h index 86e1792801598793f4963f70b4e4c927a9d71893..d303fd6d63f8424c1c88a31eb3fa6f2136e0e430 100644 --- a/paddle/fluid/platform/enforce.h +++ b/paddle/fluid/platform/enforce.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/enforce_test.cc b/paddle/fluid/platform/enforce_test.cc index baa34a5c7b453cf4e142147b22515e08d6ea7127..bb9a3543ff267dadf3dfee260a320d292a1ba3cb 100644 --- a/paddle/fluid/platform/enforce_test.cc +++ b/paddle/fluid/platform/enforce_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/math/float16.h b/paddle/fluid/platform/float16.h similarity index 91% rename from paddle/math/float16.h rename to paddle/fluid/platform/float16.h index 63248d36f9d010547271a95505e5414ff770b8d8..5832bd9ce303d48496e8c15324fd7e4a39484eb4 100644 --- a/paddle/math/float16.h +++ b/paddle/fluid/platform/float16.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -62,20 +62,26 @@ limitations under the License. */ #define PADDLE_ALIGN(x) __attribute__((aligned(x))) namespace paddle { +namespace platform { // Use PADDLE_ALIGNED(2) to ensure that each float16 will be allocated // and aligned at least on a 2-byte boundary, which leads to efficient // memory access of float16 struct and also makes float16 compatible // with CUDA half, ARM float16_t, and Eigen::half data types. struct PADDLE_ALIGN(2) float16 { -public: + public: uint16_t x; - // Constructors - HOSTDEVICE inline float16() : x(0) {} - - HOSTDEVICE inline float16(const float16& h) : x(h.x) {} + // The following defaulted special class member functions + // are added to make float16 pass the std::is_trivial test + float16() = default; + float16(const float16& o) = default; + float16& operator=(const float16& o) = default; + float16(float16&& o) = default; + float16& operator=(float16&& o) = default; + ~float16() = default; +// Constructors #ifdef PADDLE_CUDA_FP16 HOSTDEVICE inline explicit float16(const half& h) { #if CUDA_VERSION >= 9000 @@ -136,11 +142,6 @@ public: HOSTDEVICE inline explicit float16(const T& val) : x(float16(static_cast(val)).x) {} - HOSTDEVICE inline float16& operator=(const float16& rhs) { - x = rhs.x; - return *this; - } - // Assignment operators #ifdef PADDLE_CUDA_FP16 HOSTDEVICE inline float16& operator=(const half& rhs) { @@ -319,7 +320,7 @@ public: return static_cast(float(*this)); } -private: + private: union Bits { float f; int32_t si; @@ -485,8 +486,7 @@ HOST inline float16 operator+(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&(res.x)) : // clobbers "memory", "v0", "v1"); @@ -502,8 +502,7 @@ HOST inline float16 operator-(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&(res.x)) : // clobbers "memory", "v0", "v1"); @@ -519,8 +518,7 @@ HOST inline float16 operator*(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&(res.x)) : // clobbers "memory", "v0", "v1"); @@ -536,8 +534,7 @@ HOST inline float16 operator/(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&(res.x)) : // clobbers "memory", "v0", "v1"); @@ -588,8 +585,7 @@ HOST inline bool operator==(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&res) : // clobbers "memory", "v0", "v1"); @@ -609,8 +605,7 @@ HOST inline bool operator<(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&res) : // clobbers "memory", "v0", "v1"); @@ -626,8 +621,7 @@ HOST inline bool operator<=(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&res) : // clobbers "memory", "v0", "v1"); @@ -643,8 +637,7 @@ HOST inline bool operator>(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&res) : // clobbers "memory", "v0", "v1"); @@ -660,8 +653,7 @@ HOST inline bool operator>=(const float16& a, const float16& b) { "st1 {v0.h}[0], [%[res_ptr]]\n" : // outputs : // inputs - [a_ptr] "r"(&(a.x)), - [b_ptr] "r"(&(b.x)), + [a_ptr] "r"(&(a.x)), [b_ptr] "r"(&(b.x)), [res_ptr] "r"(&res) : // clobbers "memory", "v0", "v1"); @@ -736,4 +728,25 @@ HOSTDEVICE inline bool operator>=(const float16& a, const float16& b) { return float(a) >= float(b); } #endif + +} // namespace platform } // namespace paddle + +namespace std { + +// Override the std::is_pod::value for float16 +// The reason is that different compilers implemented std::is_pod based on +// different C++ standards. float16 class is a plain old data in C++11 given +// that it is both trivial and standard_layout. +// However, std::is_pod in nvcc 8.0 host c++ compiler follows C++0x and is +// more restricted in that you cannot provide any customized +// constructor in float16. Hence, we override is_pod here following C++11 +// so that .cu files can be successfully compiled by nvcc. +template <> +struct is_pod { + static const bool value = + is_trivial::value && + is_standard_layout::value; +}; + +} // namespace std diff --git a/paddle/math/tests/test_float16.cpp b/paddle/fluid/platform/float16_test.cc similarity index 80% rename from paddle/math/tests/test_float16.cpp rename to paddle/fluid/platform/float16_test.cc index 74cc55aa3792f5e9f86b4f56f28dad97f35996a0..b716ad9df41330bd6e22937381d24e33fa3a7914 100644 --- a/paddle/math/tests/test_float16.cpp +++ b/paddle/fluid/platform/float16_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,11 +9,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/math/float16.h" +#include "paddle/fluid/platform/float16.h" +#include "paddle/fluid/framework/init.h" +#include "paddle/fluid/framework/lod_tensor.h" #include namespace paddle { +namespace platform { TEST(float16, conversion_cpu) { // Explicit conversion from Eigen::half @@ -54,13 +57,9 @@ TEST(float16, conversion_cpu) { EXPECT_EQ(float16(true).x, 0x3c00); EXPECT_EQ(float16(false).x, 0x0000); - // Default constructor - float16 v_def; - EXPECT_EQ(v_def.x, 0x0000); - // Assignment operator float16 v_assign; - v_assign = v_def; + v_assign = float16(0); EXPECT_EQ(v_assign.x, 0x0000); v_assign = Eigen::half(1.0f); EXPECT_EQ(v_assign.x, 0x3c00); @@ -116,4 +115,27 @@ TEST(float16, comparison_cpu) { EXPECT_FALSE(float16(-0.0f) > float16(0.0f)); } +TEST(float16, lod_tensor_cpu) { + framework::LoDTensor lod_tensor; + + std::vector input_data = {float16(1.0f), float16(0.5f), + float16(0.33333f), float16(0.0f)}; + EXPECT_EQ(input_data[0].x, 0x3c00); + EXPECT_EQ(input_data[1].x, 0x3800); + EXPECT_EQ(input_data[2].x, 0x3555); + EXPECT_EQ(input_data[3].x, 0x0000); + + lod_tensor.Resize({4, 1}); + lod_tensor.set_lod(framework::LoD({{0, 2, 4}})); + float16* data_ptr = lod_tensor.mutable_data(CPUPlace()); + + EXPECT_NE(data_ptr, nullptr); + EXPECT_EQ(input_data.size(), static_cast(lod_tensor.numel())); + for (size_t i = 0; i < input_data.size(); ++i) { + data_ptr[i] = input_data[i]; + EXPECT_EQ(data_ptr[i].x, input_data[i].x); + } +} + +} // namespace platform } // namespace paddle diff --git a/paddle/math/tests/test_float16.cu b/paddle/fluid/platform/float16_test.cu similarity index 88% rename from paddle/math/tests/test_float16.cu rename to paddle/fluid/platform/float16_test.cu index 4b520feaaf552302a969d8caee8aa28cc143304b..567209df4edc483bcb5c6264c62034ddff50c413 100644 --- a/paddle/math/tests/test_float16.cu +++ b/paddle/fluid/platform/float16_test.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -9,10 +9,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/math/float16.h" +#include "paddle/fluid/platform/float16.h" #include +#include "paddle/fluid/framework/lod_tensor.h" +#include "paddle/fluid/framework/tensor_util.h" #include "paddle/utils/Logging.h" #define ARITHMETIC_KERNEL(op_type, sign) \ @@ -108,6 +110,7 @@ limitations under the License. */ #ifdef PADDLE_CUDA_FP16 namespace paddle { +namespace platform { #if CUDA_VERSION < 9000 ARITHMETIC_KERNEL(Add, +) @@ -209,5 +212,35 @@ TEST(float16, conversion_on_gpu) { EXPECT_EQ(v_assign.x, 0x3c00); } +TEST(float16, lod_tensor_on_gpu) { + framework::LoDTensor src_tensor; + framework::LoDTensor gpu_tensor; + framework::LoDTensor dst_tensor; + + float16* src_ptr = src_tensor.mutable_data( + framework::make_ddim({2, 2}), CPUPlace()); + + float16 arr[4] = {float16(1.0f), float16(0.5f), float16(0.33333f), + float16(0.0f)}; + memcpy(src_ptr, arr, 4 * sizeof(float16)); + + // CPU LoDTensor to GPU LoDTensor + CUDAPlace gpu_place(0); + CUDADeviceContext gpu_ctx(gpu_place); + framework::TensorCopy(src_tensor, gpu_place, gpu_ctx, &gpu_tensor); + + // GPU LoDTensor to CPU LoDTensor + framework::TensorCopy(gpu_tensor, CPUPlace(), gpu_ctx, &dst_tensor); + + // Sync before comparing LoDTensors + gpu_ctx.Wait(); + const float16* dst_ptr = dst_tensor.data(); + ASSERT_NE(src_ptr, dst_ptr); + for (size_t i = 0; i < 4; ++i) { + EXPECT_EQ(src_ptr[i].x, dst_ptr[i].x); + } +} + +} // namespace platform } // namespace paddle #endif // PADDLE_CUDA_FP16 diff --git a/paddle/fluid/platform/for_range.h b/paddle/fluid/platform/for_range.h index 0e695328c394cd5cd1a14f42b7c82e8899e2167b..c153e80fe42aecb33d3aa97874d2881bce9029be 100644 --- a/paddle/fluid/platform/for_range.h +++ b/paddle/fluid/platform/for_range.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/gpu_info.cc b/paddle/fluid/platform/gpu_info.cc index 1797f59a9c9731d28febe32d268d2b07073550eb..05e1eae853e20b3fd86438c03f52628179a311ca 100644 --- a/paddle/fluid/platform/gpu_info.cc +++ b/paddle/fluid/platform/gpu_info.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/gpu_info.h b/paddle/fluid/platform/gpu_info.h index d05131fa4196057d19a8ae57bf4574c666e409cf..3d4883d8078daa2b55d8ea792b47e93e4f4feec8 100644 --- a/paddle/fluid/platform/gpu_info.h +++ b/paddle/fluid/platform/gpu_info.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/hostdevice.h b/paddle/fluid/platform/hostdevice.h index fa4659ed2988a2199d8a8450f825d31fd0ca5907..c0dc92a52176406a0333ffb6423fb68021beb7c1 100644 --- a/paddle/fluid/platform/hostdevice.h +++ b/paddle/fluid/platform/hostdevice.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/macros.h b/paddle/fluid/platform/macros.h index feae7bdd77e3a0d02f33fb33991648408f542d0e..4cc04b090519637ab0b8d3740b8a12f216218cae 100644 --- a/paddle/fluid/platform/macros.h +++ b/paddle/fluid/platform/macros.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ limitations under the License. */ #define DISABLE_COPY_AND_ASSIGN(classname) \ private: \ classname(const classname&) = delete; \ - classname(const classname&&) = delete; \ + classname(classname&&) = delete; \ classname& operator=(const classname&) = delete; \ - classname& operator=(const classname&&) = delete + classname& operator=(classname&&) = delete #endif diff --git a/paddle/fluid/platform/mkldnn_helper.h b/paddle/fluid/platform/mkldnn_helper.h index cd52a8b4c434071a030a8e7a8a70fc3adba8460c..6d71f352c6eda12e2bc032ecbc26cfefe320f703 100644 --- a/paddle/fluid/platform/mkldnn_helper.h +++ b/paddle/fluid/platform/mkldnn_helper.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/nccl_test.cu b/paddle/fluid/platform/nccl_test.cu index 75b95aff1a41dac70f1b732938c648ca55b2a973..32a293796c09e5254c5eb48d11fa74617b3465ac 100644 --- a/paddle/fluid/platform/nccl_test.cu +++ b/paddle/fluid/platform/nccl_test.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -89,6 +89,7 @@ TEST(NCCL, all_reduce) { VLOG(1) << "Invoking ncclAllReduce"; + dynload::ncclGroupStart(); for (int i = 0; i < dev_count; ++i) { VLOG(1) << "Invoking ncclAllReduce with device " << i; SetDeviceId(i); @@ -97,6 +98,7 @@ TEST(NCCL, all_reduce) { ncclSum, comms[i], data[i]->dev_ctx.stream())); VLOG(1) << "Invoked ncclAllReduce for device " << i; } + dynload::ncclGroupEnd(); VLOG(1) << "Invoked ncclAllReduce"; @@ -127,9 +129,6 @@ TEST(NCCL, all_reduce) { } // namespace paddle int main(int argc, char** argv) { - // FIXME(tonyyang-svail): - // Due to the driver issue on our CI, disable for now - return 0; dev_count = paddle::platform::GetCUDADeviceCount(); if (dev_count <= 1) { LOG(WARNING) diff --git a/paddle/fluid/platform/place.cc b/paddle/fluid/platform/place.cc index e99b75d761abcf065070f463d578171797383cea..de8f958eb012cb1ac563cbbbac8951e439bf8f33 100644 --- a/paddle/fluid/platform/place.cc +++ b/paddle/fluid/platform/place.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/place.h b/paddle/fluid/platform/place.h index 2977a41036e84fc5aabd69c24cc9e62391b7dc38..501bddfc6ec8b5d0bf554b0911c32e47fd51ec15 100644 --- a/paddle/fluid/platform/place.h +++ b/paddle/fluid/platform/place.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/place_test.cc b/paddle/fluid/platform/place_test.cc index f248902d91c1ffad1364a2f1078a41626b61ac22..6a919c56252243ddfbd653b768bcea3bdea77831 100644 --- a/paddle/fluid/platform/place_test.cc +++ b/paddle/fluid/platform/place_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/profiler.cc b/paddle/fluid/platform/profiler.cc index 28d2675f799a2d398d43dc31c550f0d84424116e..4804df7966dfedf7264eebaad3a42ed92739b096 100644 --- a/paddle/fluid/platform/profiler.cc +++ b/paddle/fluid/platform/profiler.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/profiler.h b/paddle/fluid/platform/profiler.h index 0bc5e666cb4f28b99169435cb3dd52829c35a2c2..a3d22df70057e7967d9fc349ea0cbd73ceb8e0e9 100644 --- a/paddle/fluid/platform/profiler.h +++ b/paddle/fluid/platform/profiler.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/profiler_test.cc b/paddle/fluid/platform/profiler_test.cc index d2525c38b6fb98ea9bac49f7eb28e755bd7fa9a2..dae4d2206e0a1ec6ef99122460a15c064efe58fd 100644 --- a/paddle/fluid/platform/profiler_test.cc +++ b/paddle/fluid/platform/profiler_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/transform.h b/paddle/fluid/platform/transform.h index 879daed19102c85cc5ea03933f8324023cec0fe2..917c48b47f8d70cd821d45dfbc6bafa494710ffa 100644 --- a/paddle/fluid/platform/transform.h +++ b/paddle/fluid/platform/transform.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/transform_test.cu b/paddle/fluid/platform/transform_test.cu index 0e4b9edc2fd45e9c00f5339948172f6267210363..7b5cfd8f43473dc6bc784e98bd26fdd9e0ba9994 100644 --- a/paddle/fluid/platform/transform_test.cu +++ b/paddle/fluid/platform/transform_test.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/platform/variant.h b/paddle/fluid/platform/variant.h index ea6ef8fddf5171731fa1fd323983bf7d90ecdd9a..05ca33137de8db5291c8e38fc03457d05092cea8 100644 --- a/paddle/fluid/platform/variant.h +++ b/paddle/fluid/platform/variant.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/pybind/const_value.cc b/paddle/fluid/pybind/const_value.cc index 098252a83d3b7e2926bf737ce7f2b3794046f28f..6657b25ed2443c1ac9cb0a09098968d3181fc6ba 100644 --- a/paddle/fluid/pybind/const_value.cc +++ b/paddle/fluid/pybind/const_value.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/pybind/const_value.h b/paddle/fluid/pybind/const_value.h index 67d14ac9ff01d1754dd8dd165b638db12c9d0ea0..79e71e039dea6585aaf8193f1417c6ab3fbf6f76 100644 --- a/paddle/fluid/pybind/const_value.h +++ b/paddle/fluid/pybind/const_value.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/pybind/exception.cc b/paddle/fluid/pybind/exception.cc index 7398a88541bcbf338ca9568595d0dc7b16eff118..4bd3ecf728dedaf74a554f77b114065f2d515786 100644 --- a/paddle/fluid/pybind/exception.cc +++ b/paddle/fluid/pybind/exception.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/pybind/exception.h b/paddle/fluid/pybind/exception.h index 43e91a706300e561a20d88abe80d9b6654bd2171..bc6b0c067978959d4cdafec51db9574927b34b21 100644 --- a/paddle/fluid/pybind/exception.h +++ b/paddle/fluid/pybind/exception.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/pybind/protobuf.cc b/paddle/fluid/pybind/protobuf.cc index 4aefcf1a1cdcb3ad2408ded2f76a69570eccb41d..b725be79529c5ccdde12446b5b5c09eaf47550e6 100644 --- a/paddle/fluid/pybind/protobuf.cc +++ b/paddle/fluid/pybind/protobuf.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -155,6 +155,8 @@ void BindBlockDesc(py::module &m) { py::class_(m, "BlockDesc", "") .def_property_readonly("id", &BlockDesc::ID) .def_property_readonly("parent", &BlockDesc::Parent) + .def("get_forward_block_idx", &BlockDesc::ForwardBlockID) + .def("set_forward_block_idx", &BlockDesc::SetForwardBlockID) .def("append_op", &BlockDesc::AppendOp, py::return_value_policy::reference) .def("prepend_op", &BlockDesc::PrependOp, @@ -170,6 +172,14 @@ void BindBlockDesc(py::module &m) { [](BlockDesc &self, py::bytes byte_name) { std::string name = byte_name; return self.HasVar(name); + }, + py::return_value_policy::reference) + .def("rename_var", + [](BlockDesc &self, const py::bytes &byte_name, + const py::bytes &byte_name_new) { + std::string name = byte_name; + std::string new_name = byte_name_new; + self.RenameVar(name, new_name); }) .def("has_var_recursive", [](BlockDesc &self, py::bytes byte_name) { @@ -195,19 +205,10 @@ void BindBlockDesc(py::module &m) { } void BindVarDsec(py::module &m) { - py::enum_(m, "DataType", "") - .value("BOOL", proto::DataType::BOOL) - .value("INT16", proto::DataType::INT16) - .value("INT32", proto::DataType::INT32) - .value("INT64", proto::DataType::INT64) - .value("FP16", proto::DataType::FP16) - .value("FP32", proto::DataType::FP32) - .value("FP64", proto::DataType::FP64); - py::class_ var_desc(m, "VarDesc", ""); var_desc .def("name", - [](const VarDesc &self) { + [](VarDesc &self) { py::bytes name = self.Name(); return name; }, @@ -217,6 +218,7 @@ void BindVarDsec(py::module &m) { .def("set_shapes", &VarDesc::SetShapes) .def("set_dtype", &VarDesc::SetDataType) .def("set_dtypes", &VarDesc::SetDataTypes) + .def("set_capacity", &VarDesc::SetCapacity) .def("shape", &VarDesc::GetShape, py::return_value_policy::reference) .def("shapes", &VarDesc::GetShapes, py::return_value_policy::reference) .def("dtype", &VarDesc::GetDataType, py::return_value_policy::reference) @@ -232,16 +234,25 @@ void BindVarDsec(py::module &m) { .def("persistable", &VarDesc::Persistable) .def("set_persistable", &VarDesc::SetPersistable); - py::enum_(var_desc, "VarType", "") - .value("LOD_TENSOR", proto::VarDesc::LOD_TENSOR) - .value("SELECTED_ROWS", proto::VarDesc::SELECTED_ROWS) - .value("FEED_MINIBATCH", proto::VarDesc::FEED_MINIBATCH) - .value("FETCH_LIST", proto::VarDesc::FETCH_LIST) - .value("STEP_SCOPES", proto::VarDesc::STEP_SCOPES) - .value("LOD_RANK_TABLE", proto::VarDesc::LOD_RANK_TABLE) - .value("LOD_TENSOR_ARRAY", proto::VarDesc::LOD_TENSOR_ARRAY) - .value("PLACE_LIST", proto::VarDesc::PLACE_LIST) - .value("READER", proto::VarDesc::READER); + py::enum_(var_desc, "VarType", "") + .value("BOOL", proto::VarType::BOOL) + .value("INT16", proto::VarType::INT16) + .value("INT32", proto::VarType::INT32) + .value("INT64", proto::VarType::INT64) + .value("FP16", proto::VarType::FP16) + .value("FP32", proto::VarType::FP32) + .value("FP64", proto::VarType::FP64) + .value("LOD_TENSOR", proto::VarType::LOD_TENSOR) + .value("SELECTED_ROWS", proto::VarType::SELECTED_ROWS) + .value("FEED_MINIBATCH", proto::VarType::FEED_MINIBATCH) + .value("FETCH_LIST", proto::VarType::FETCH_LIST) + .value("STEP_SCOPES", proto::VarType::STEP_SCOPES) + .value("LOD_RANK_TABLE", proto::VarType::LOD_RANK_TABLE) + .value("LOD_TENSOR_ARRAY", proto::VarType::LOD_TENSOR_ARRAY) + .value("CHANNEL", proto::VarType::CHANNEL) + .value("PLACE_LIST", proto::VarType::PLACE_LIST) + .value("READER", proto::VarType::READER) + .value("NCCL_COM", proto::VarType::NCCL_COM); } void BindOpDesc(py::module &m) { diff --git a/paddle/fluid/pybind/protobuf.h b/paddle/fluid/pybind/protobuf.h index c828e4583d259a462ece4145c7beb75e249e8429..d0dc8936b3df50ca12315f113fbb36b0f98bb53f 100644 --- a/paddle/fluid/pybind/protobuf.h +++ b/paddle/fluid/pybind/protobuf.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 85a6700a61405b2e3b40455fe96b54e810ff86b5..b3e03f33470810a685dc7bfe29f8da50454b2238 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ limitations under the License. */ #include // for call_once #include #include "paddle/fluid/framework/backward.h" +#include "paddle/fluid/framework/channel.h" #include "paddle/fluid/framework/executor.h" #include "paddle/fluid/framework/feed_fetch_method.h" #include "paddle/fluid/framework/framework.pb.h" @@ -48,11 +49,6 @@ PYBIND11_MAKE_OPAQUE(paddle::framework::LoDTensorArray); namespace paddle { namespace pybind { -static size_t UniqueIntegerGenerator(const std::string &prefix) { - static std::unordered_map> generators; - return generators[prefix].fetch_add(1); -} - bool IsCompiledWithCUDA() { #ifndef PADDLE_WITH_CUDA return false; @@ -409,7 +405,6 @@ All parameter, weight, gradient are variables in Paddle. (void (Executor::*)(const ProgramDesc &, Scope *, int, bool, bool)) & Executor::Run); - m.def("unique_integer", UniqueIntegerGenerator); m.def("init_gflags", framework::InitGflags); m.def("init_glog", framework::InitGLOG); m.def("init_devices", &framework::InitDevices); diff --git a/paddle/fluid/pybind/tensor_py.h b/paddle/fluid/pybind/tensor_py.h index 0261709f1e47afce268471e1c7586937b6d4a6b9..1b0916ea0370d95a0c7dd149ee3f7b294c5e2351 100644 --- a/paddle/fluid/pybind/tensor_py.h +++ b/paddle/fluid/pybind/tensor_py.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -101,7 +101,7 @@ T TensorGetElement(framework::Tensor &self, size_t offset) { return self.data()[offset]; } else { std::shared_ptr dst(new framework::Tensor); - framework::Copy(self, platform::CPUPlace(), dst.get()); + framework::TensorCopy(self, platform::CPUPlace(), dst.get()); return dst->data()[offset]; } } @@ -111,9 +111,9 @@ template void TensorSetElement(framework::Tensor &self, size_t offset, T elem) { if (platform::is_gpu_place(self.place())) { std::shared_ptr dst(new framework::Tensor); - framework::Copy(self, platform::CPUPlace(), dst.get()); + framework::TensorCopy(self, platform::CPUPlace(), dst.get()); dst->data()[offset] = elem; - framework::Copy(*dst.get(), self.place(), &self); + framework::TensorCopy(*dst.get(), self.place(), &self); } else if (platform::is_cpu_place(self.place())) { self.data()[offset] = elem; diff --git a/paddle/fluid/string/piece.cc b/paddle/fluid/string/piece.cc index 560413dff1f0e41789275701fd6c61394e95e13c..454f5d8d38c5f02598cddaab555334a1e8a398da 100644 --- a/paddle/fluid/string/piece.cc +++ b/paddle/fluid/string/piece.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/string/piece.h b/paddle/fluid/string/piece.h index f2bb6b2c76164fbe63a9b53ec41385014f240ffd..8dda484eaac4d62b758e57ac5e81bfe68a5c60d4 100644 --- a/paddle/fluid/string/piece.h +++ b/paddle/fluid/string/piece.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/string/piece_test.cc b/paddle/fluid/string/piece_test.cc index fc17d315b9df99374bb3a7b0a94e385a4abb7b5e..80b712b08ccbcc3fc33e26f8c8c5b0531a71d974 100644 --- a/paddle/fluid/string/piece_test.cc +++ b/paddle/fluid/string/piece_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/string/printf.h b/paddle/fluid/string/printf.h index b55ae21b87ee6a3d158812e5ff872a03288abd20..693cf9d6dfeea0735801e64fe74b9770c258c553 100644 --- a/paddle/fluid/string/printf.h +++ b/paddle/fluid/string/printf.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/string/printf_test.cc b/paddle/fluid/string/printf_test.cc index 6ca59bdefdbe2b23b49c844e893adb939c3d5a6f..b6a60c8d6b7f15f8e5572cf5bb1e7f04ee1c1598 100644 --- a/paddle/fluid/string/printf_test.cc +++ b/paddle/fluid/string/printf_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/string/tinyformat/tinyformat.h b/paddle/fluid/string/tinyformat/tinyformat.h index d1a2c47f1a9f258aefbdcce88513e05dda308fa0..a5c1798e1002759a4ea560747453b0e9836b9624 100644 --- a/paddle/fluid/string/tinyformat/tinyformat.h +++ b/paddle/fluid/string/tinyformat/tinyformat.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/fluid/string/to_string.h b/paddle/fluid/string/to_string.h index 178edc18951f94291a63566516df36956f25f67b..8caf149420393ec81131389d7787bee925f4a27d 100644 --- a/paddle/fluid/string/to_string.h +++ b/paddle/fluid/string/to_string.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/fluid/string/to_string_test.cc b/paddle/fluid/string/to_string_test.cc index 1e890f572eb842eba49b859807083f4e5af57df8..8fc293af0e473994ac13f6615d3f6195c8c5f04c 100644 --- a/paddle/fluid/string/to_string_test.cc +++ b/paddle/fluid/string/to_string_test.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/BlockExpandOp.cpp b/paddle/function/BlockExpandOp.cpp index bd0fe119ce46df9c333258c9c1ad7b5b2bdc544f..aa53853e08716ff0dd8dce7c73766d9543bed2b9 100644 --- a/paddle/function/BlockExpandOp.cpp +++ b/paddle/function/BlockExpandOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/BlockExpandOpTest.cpp b/paddle/function/BlockExpandOpTest.cpp index 59193a3ec3d0fabe7c841372394204ab568f5a2b..8fca4f6fdc82082986b2ec3469aa8f78990bc8a7 100644 --- a/paddle/function/BlockExpandOpTest.cpp +++ b/paddle/function/BlockExpandOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/BufferArg.cpp b/paddle/function/BufferArg.cpp index 2b70036e3ff7de9e8786bade03e220a4916db4c2..2dc931c5d7e727679d435470544e60f9b5ce2bde 100644 --- a/paddle/function/BufferArg.cpp +++ b/paddle/function/BufferArg.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/BufferArg.h b/paddle/function/BufferArg.h index 0dc7792f646457c22ee4791f18814afaa3809f7b..89ee09837db69d79bbd678312f02f6dc87e8067c 100644 --- a/paddle/function/BufferArg.h +++ b/paddle/function/BufferArg.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/BufferArgTest.cpp b/paddle/function/BufferArgTest.cpp index 6b8e1e2da9775ccd03c84cc86ad226f3c00ab7fe..1a6e0110afb64c8b4f164d71e31e5f9bfcdee4a8 100644 --- a/paddle/function/BufferArgTest.cpp +++ b/paddle/function/BufferArgTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ContextProjectionOp.cpp b/paddle/function/ContextProjectionOp.cpp index 23916c0f4b6319004ca0793bc9305b8a1dd0ae89..904b0958e6f2c1b8fb8cf56f3cd7d07ad8e24f19 100644 --- a/paddle/function/ContextProjectionOp.cpp +++ b/paddle/function/ContextProjectionOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ContextProjectionOp.h b/paddle/function/ContextProjectionOp.h index 6f7d936379a5378e6fd85dd86618d1b6094bd14f..822734a78e6732a3441f571c71d910a76241055b 100644 --- a/paddle/function/ContextProjectionOp.h +++ b/paddle/function/ContextProjectionOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ContextProjectionOpGpu.cu b/paddle/function/ContextProjectionOpGpu.cu index 4492dea5d8a6f8580a13f3059401c87fa2164085..0a4d865e2c4fb0f5f802d4ba8a9c48cdf09d4cea 100644 --- a/paddle/function/ContextProjectionOpGpu.cu +++ b/paddle/function/ContextProjectionOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ContextProjectionOpTest.cpp b/paddle/function/ContextProjectionOpTest.cpp index 9e9dd20e6f3abe3bd087e434d7b64eec5bfadcfb..d805c3ae927321fc74946e202b98401b6b3cd0f7 100644 --- a/paddle/function/ContextProjectionOpTest.cpp +++ b/paddle/function/ContextProjectionOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ConvOp.h b/paddle/function/ConvOp.h index 062ea25a11470dd9ecdafb278dee9a2e0979f00b..7d23d0079c8f62b2c8912dfcb9f191c622a60bc9 100644 --- a/paddle/function/ConvOp.h +++ b/paddle/function/ConvOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ConvOpTest.h b/paddle/function/ConvOpTest.h index d8d3c792df236ab0fd412b0cf77f275355848627..5eac6089786e65c69a37bd3521e86f5dc836f0eb 100644 --- a/paddle/function/ConvOpTest.h +++ b/paddle/function/ConvOpTest.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CosSimOp.cpp b/paddle/function/CosSimOp.cpp index 2e5c281f37d8ffb1062121b5dc5b4f790ab52089..81bccc1a9c7d614763a10e3838271b57eef2c603 100644 --- a/paddle/function/CosSimOp.cpp +++ b/paddle/function/CosSimOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CosSimOp.h b/paddle/function/CosSimOp.h index be73064e6375bf1e6c6a7ca6de52e9b9b755880b..2d377eb3bef4f6cf79945746c7dea4ff6f754fbd 100644 --- a/paddle/function/CosSimOp.h +++ b/paddle/function/CosSimOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CosSimOpGpu.cu b/paddle/function/CosSimOpGpu.cu index a1f88f479b5818e3864129a4dac723bceed76fcf..9fe50529ac4daeec4c7fe69d667c51dfc7512197 100644 --- a/paddle/function/CosSimOpGpu.cu +++ b/paddle/function/CosSimOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CosSimOpTest.cpp b/paddle/function/CosSimOpTest.cpp index f6c0041101f50f8f47d45e0fe0fe1064e0f9cb69..42b02da0cb07a57e030a3edb08bea23203efd688 100644 --- a/paddle/function/CosSimOpTest.cpp +++ b/paddle/function/CosSimOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CropOp.cpp b/paddle/function/CropOp.cpp index 46f98f12c1f150fdf3ed53a7a96e5cf0020e14a4..7aa527d21615e19257bd003d0563b5e26b2fcb2f 100644 --- a/paddle/function/CropOp.cpp +++ b/paddle/function/CropOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CropOp.h b/paddle/function/CropOp.h index 87986fbdc7e33aeb24d947e82a5d67ba23f532de..05d4b163b37d5434184924552255cfc1e4e6f061 100644 --- a/paddle/function/CropOp.h +++ b/paddle/function/CropOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CropOpGpu.cu b/paddle/function/CropOpGpu.cu index 241356a9ca0b673c86ff4c39594722211e2d224e..5615062433717911f147ecc65fb844a24a4ced4f 100644 --- a/paddle/function/CropOpGpu.cu +++ b/paddle/function/CropOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CropOpTest.cpp b/paddle/function/CropOpTest.cpp index 6f11abfdf6f752857e0a75c62fb2b5c089c206d9..10c83a0321fd890186aa942ed1beae06814158d6 100644 --- a/paddle/function/CropOpTest.cpp +++ b/paddle/function/CropOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CrossMapNormalOp.cpp b/paddle/function/CrossMapNormalOp.cpp index 9e88669d37bd50179dcc0464e8c1cd6e2fed74db..75c0fc2a3d047a9162d49809a717629f2270872d 100644 --- a/paddle/function/CrossMapNormalOp.cpp +++ b/paddle/function/CrossMapNormalOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CrossMapNormalOp.h b/paddle/function/CrossMapNormalOp.h index b1e401ad0a2f5bf8fa3df3fcda2e678714dcd4b3..bb9cdf20216c6fbd0e61f8098cfe78a4b4580a35 100644 --- a/paddle/function/CrossMapNormalOp.h +++ b/paddle/function/CrossMapNormalOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CrossMapNormalOpGpu.cu b/paddle/function/CrossMapNormalOpGpu.cu index 88b991ff6a1f028b333e82e2801ed2e9251aa36d..938827610afbd8c1ea943365ac47b2cd55e2b5b1 100644 --- a/paddle/function/CrossMapNormalOpGpu.cu +++ b/paddle/function/CrossMapNormalOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/CrossMapNormalOpTest.cpp b/paddle/function/CrossMapNormalOpTest.cpp index 3b390db77f085aecfd65a9aa64e68ecc189163c1..dec52adde22d57ea074eb4a9ad6a7ac2111751d3 100644 --- a/paddle/function/CrossMapNormalOpTest.cpp +++ b/paddle/function/CrossMapNormalOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/DepthwiseConvOp.cpp b/paddle/function/DepthwiseConvOp.cpp index 9863e3ae1d5fcb1eece5267fd4f2a6b593b799df..46651345b45e4ced9a3ef3373af437d939a66716 100644 --- a/paddle/function/DepthwiseConvOp.cpp +++ b/paddle/function/DepthwiseConvOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/DepthwiseConvOp.h b/paddle/function/DepthwiseConvOp.h index 1bf70e52f34626405b49571e023ac60926713eef..6700747314fa8377828dab0c436eb4b2053f46f6 100644 --- a/paddle/function/DepthwiseConvOp.h +++ b/paddle/function/DepthwiseConvOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/DepthwiseConvOpGpu.cu b/paddle/function/DepthwiseConvOpGpu.cu index 2d722dfcfca0f328edeecf185ea37b8512b91907..cd1d55a416c84c6327226ffaae4d5d9d5be81038 100644 --- a/paddle/function/DepthwiseConvOpGpu.cu +++ b/paddle/function/DepthwiseConvOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/DepthwiseConvOpTest.cpp b/paddle/function/DepthwiseConvOpTest.cpp index b1a90da7db2b647dd384e3772820294140e5ec9d..caf8f3597ffa283f2ae6fe8eb130df936c22a50c 100644 --- a/paddle/function/DepthwiseConvOpTest.cpp +++ b/paddle/function/DepthwiseConvOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/EigenGemm.cpp b/paddle/function/EigenGemm.cpp index 644098a9e7873fb59b6343e805163e4892f060a8..bac4659e62b107dd80ef95dd0907b3da4becffbc 100644 --- a/paddle/function/EigenGemm.cpp +++ b/paddle/function/EigenGemm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/Function.cpp b/paddle/function/Function.cpp index f71c0f681b3bc524ba96c55f1dcad30ef59478c8..344358fd3d3d217b5b653d897391538049848858 100644 --- a/paddle/function/Function.cpp +++ b/paddle/function/Function.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/Function.h b/paddle/function/Function.h index 15eb35b7f7dac1b98f2d8694707d83b84bda0f2e..01288ef92e7b59d7958e6e23daf641b30a60eed1 100644 --- a/paddle/function/Function.h +++ b/paddle/function/Function.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/FunctionTest.cpp b/paddle/function/FunctionTest.cpp index 7b0b1c6adbd36a6cbe9b89e9518fbe07fb1db368..f5e6ca3f515a7fcd1498979703a0a59ddca40742 100644 --- a/paddle/function/FunctionTest.cpp +++ b/paddle/function/FunctionTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/FunctionTest.h b/paddle/function/FunctionTest.h index 370940532ef40335be54a3e6467de0409e923ec4..56c3537b6a96c8042d172f8aca2163fa18c813c1 100644 --- a/paddle/function/FunctionTest.h +++ b/paddle/function/FunctionTest.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/GemmConvOp.cpp b/paddle/function/GemmConvOp.cpp index a9876cec2aabf7d116443b685391ee9d20bc1370..2b7c6f9eab223c8d6a2107ff4605ac6e60295f7d 100644 --- a/paddle/function/GemmConvOp.cpp +++ b/paddle/function/GemmConvOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/GemmConvOpTest.cpp b/paddle/function/GemmConvOpTest.cpp index b5b5e1f35b79e422b14f7495bc321533cc1d618a..a30b7c90bb082a1f256fe37f09048d6fdc45804c 100644 --- a/paddle/function/GemmConvOpTest.cpp +++ b/paddle/function/GemmConvOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/GemmFunctor.cpp b/paddle/function/GemmFunctor.cpp index 9e25ee58a12490a1454436b3fe4a89176478d5c0..0b1fe1b67d8fd6caf86a08bc05e250b1936e9f85 100644 --- a/paddle/function/GemmFunctor.cpp +++ b/paddle/function/GemmFunctor.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/GemmFunctor.h b/paddle/function/GemmFunctor.h index 0809953b4eb17c25eadcce7f474a3dab0469bba1..df63fc64f84a12ea3558005f5b3cac3d6ac6ede1 100644 --- a/paddle/function/GemmFunctor.h +++ b/paddle/function/GemmFunctor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/GruFunctor.h b/paddle/function/GruFunctor.h index 9f6392198ea360502f313cbe15dfae46ece69758..d5a30c332764f3dfb4f9abe885f989f3202205b1 100644 --- a/paddle/function/GruFunctor.h +++ b/paddle/function/GruFunctor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/Im2Col.h b/paddle/function/Im2Col.h index 915119e291caaa223249cf8e37078723621517b0..6a0778700037c142d62fdb99667403ade806f7c1 100644 --- a/paddle/function/Im2Col.h +++ b/paddle/function/Im2Col.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/Im2ColOp.cpp b/paddle/function/Im2ColOp.cpp index f864d42f8075209c70ca2e16a70e4f2c9d58eef4..ad2aed8f3c237cf9c0f7f0dcc4900cac807e25ea 100644 --- a/paddle/function/Im2ColOp.cpp +++ b/paddle/function/Im2ColOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/Im2ColOpGpu.cu b/paddle/function/Im2ColOpGpu.cu index 71da11b95557d7b59de5ea6c65d1d43db42f211c..a944a0ee687fefc5e002096b9c5b869495554167 100644 --- a/paddle/function/Im2ColOpGpu.cu +++ b/paddle/function/Im2ColOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/Im2ColTest.cpp b/paddle/function/Im2ColTest.cpp index fe44a8bf79005efb87c56f6a79f46421129bab22..967c5b91536608364b4181707b843799b1764c3f 100644 --- a/paddle/function/Im2ColTest.cpp +++ b/paddle/function/Im2ColTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/MulOp.cpp b/paddle/function/MulOp.cpp index 704a8c41325ef86067a3bd8ed6d772b77df147c5..90cd4a2b6d1bfb2529e1c966cf7a1fb904a844d7 100644 --- a/paddle/function/MulOp.cpp +++ b/paddle/function/MulOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/MulOp.h b/paddle/function/MulOp.h index b6016a6ab6e9d6549b359573ecc2b33900a58365..e6057be4e54b3cc2b3502b9a93825d4b53037c91 100644 --- a/paddle/function/MulOp.h +++ b/paddle/function/MulOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/MulOpGpu.cu b/paddle/function/MulOpGpu.cu index 9449b89056b4b1740cb4c3de630348b1b361d61e..d63416a8e45346089bac23100742b8afc99b8e77 100644 --- a/paddle/function/MulOpGpu.cu +++ b/paddle/function/MulOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/MulOpTest.cpp b/paddle/function/MulOpTest.cpp index d31eb0c74f25f5c2ef910264bdf2779e16b1a004..4e1ebd749c0cd083c025e43a321d6992a11786ff 100644 --- a/paddle/function/MulOpTest.cpp +++ b/paddle/function/MulOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/NaiveConvOp.cpp b/paddle/function/NaiveConvOp.cpp index e0692fa06d6e0c35cfa742ca3eac7fe2037b1a80..22d3b33d0f4a730691234c6c742978abd72294a6 100644 --- a/paddle/function/NaiveConvOp.cpp +++ b/paddle/function/NaiveConvOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/PadOp.cpp b/paddle/function/PadOp.cpp index eed2f2e3089b6b6167ef7c5a7acb7ecaa08945e1..db6dd518ca5df9d852e545b37f61f1141c81f57c 100644 --- a/paddle/function/PadOp.cpp +++ b/paddle/function/PadOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/PadOp.h b/paddle/function/PadOp.h index 0e226ec7370b9897ebdc697ee528b90a37e4ec56..4b0aa4014bbb3e94a2f8632a6be7009a99f3fe32 100644 --- a/paddle/function/PadOp.h +++ b/paddle/function/PadOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/PadOpGpu.cu b/paddle/function/PadOpGpu.cu index 5b6f4e6832aea4bcfe22e530f5f25ef5815729f1..01d9b5c3b2af60fe82a9b03ac6322a619e7805ef 100644 --- a/paddle/function/PadOpGpu.cu +++ b/paddle/function/PadOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/PadOpTest.cpp b/paddle/function/PadOpTest.cpp index e286f4e5b8a42348b9d23fd4c3ad44194ca1f299..a4474f8549887f03f77448eccbe40911379a36ca 100644 --- a/paddle/function/PadOpTest.cpp +++ b/paddle/function/PadOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/RowConvOp.cpp b/paddle/function/RowConvOp.cpp index 7c802d66273c6f7aa56b2f460e3dff4401967517..925860346e1a53065b0fe4ccbd26853afc8898a1 100644 --- a/paddle/function/RowConvOp.cpp +++ b/paddle/function/RowConvOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/RowConvOp.h b/paddle/function/RowConvOp.h index 2c5de6151aa2ed73ace1569d880b1c3677c195c4..bfe775e014d56b574db10da9ca560d9d78888f57 100644 --- a/paddle/function/RowConvOp.h +++ b/paddle/function/RowConvOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/RowConvOpGpu.cu b/paddle/function/RowConvOpGpu.cu index b0cbd9fd1df9a35d6cc1cb5312099d8b45197944..9d8a6d80bb2c95a9aa8eb3666fd637402c932559 100644 --- a/paddle/function/RowConvOpGpu.cu +++ b/paddle/function/RowConvOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/RowConvOpTest.cpp b/paddle/function/RowConvOpTest.cpp index f52d18b0491ec444e2fe89fe8fb5c1baa128823e..bbc29ad6a6b58b5d7619b26a52c07c3e7bb385b2 100644 --- a/paddle/function/RowConvOpTest.cpp +++ b/paddle/function/RowConvOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ScaleSubRegionOp.cpp b/paddle/function/ScaleSubRegionOp.cpp index a080505d7df83a6c0a9d88fbcb7863fc0e1f7b21..6ed6eb2dba477722664ca4a29f4689114f368846 100644 --- a/paddle/function/ScaleSubRegionOp.cpp +++ b/paddle/function/ScaleSubRegionOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ScaleSubRegionOp.h b/paddle/function/ScaleSubRegionOp.h index 0480c8577f3fbf3bc9e94b635df96a31b103e9e3..ed7d6b8ad3caa14b0379bc9887ff5fd1a83ac1cc 100644 --- a/paddle/function/ScaleSubRegionOp.h +++ b/paddle/function/ScaleSubRegionOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ScaleSubRegionOpGpu.cu b/paddle/function/ScaleSubRegionOpGpu.cu index 8aae2e44c3fdc8b516e66ecfd2e04f466a17dde9..9784c51ae03d4b67ce52a16be5d6ab98bb1ce4d4 100644 --- a/paddle/function/ScaleSubRegionOpGpu.cu +++ b/paddle/function/ScaleSubRegionOpGpu.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/ScaleSubRegionOpTest.cpp b/paddle/function/ScaleSubRegionOpTest.cpp index 43331f258dddaa43cbc8cc77519e299de7e98290..dd6ee67108948cf1158d7e3788dd67bfef70409a 100644 --- a/paddle/function/ScaleSubRegionOpTest.cpp +++ b/paddle/function/ScaleSubRegionOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/SwitchOp.cpp b/paddle/function/SwitchOp.cpp index 597723a2dded6a6a116e05b7d4c942cd633e2c99..50e1d6c04c54fed5b847aa10dbb253f00cfa42d4 100644 --- a/paddle/function/SwitchOp.cpp +++ b/paddle/function/SwitchOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/SwitchOp.h b/paddle/function/SwitchOp.h index e4c1c3ac922f88c3e5424b5943082810aabfacdb..b5eb0883cb6d3f1affe6b28bbfe31d1acde88025 100644 --- a/paddle/function/SwitchOp.h +++ b/paddle/function/SwitchOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/SwitchOpTest.cpp b/paddle/function/SwitchOpTest.cpp index 03b0dd66ddcbab713969ed747601ecb1b2eb7955..08e5a613c06c9ca4b9ea2aedad225797f6d38039 100644 --- a/paddle/function/SwitchOpTest.cpp +++ b/paddle/function/SwitchOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/TensorShape.h b/paddle/function/TensorShape.h index cda58f19dfa4a8b80efc97570c83ca38fd7adf27..02d38c32c007325a928910d136d48214ba5f6bc3 100644 --- a/paddle/function/TensorShape.h +++ b/paddle/function/TensorShape.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/TensorShapeTest.cpp b/paddle/function/TensorShapeTest.cpp index e55d516d4ac8e86b05911ac1a4e7095f53e2ea3c..4d692b9b97acb60f0124f8ac87acced470f16b3a 100644 --- a/paddle/function/TensorShapeTest.cpp +++ b/paddle/function/TensorShapeTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/TensorType.h b/paddle/function/TensorType.h index 8308bbd8ad4fe1b97b35b779f27d2bf4534f0fa6..b384591bd8852bbdc61bf9aa678ce613732c369a 100644 --- a/paddle/function/TensorType.h +++ b/paddle/function/TensorType.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/TensorTypeTest.cpp b/paddle/function/TensorTypeTest.cpp index d1c559a91e294853fa6e19f9115bc008ae56915c..d0cd63147a8e112d5d5fefa4509d398acaf478b8 100644 --- a/paddle/function/TensorTypeTest.cpp +++ b/paddle/function/TensorTypeTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/neon/NeonDepthwiseConv.cpp b/paddle/function/neon/NeonDepthwiseConv.cpp index 38aa6670612b0771cdd8f1805a6d1bd9f281bdc1..d3298c753853ca6d212a619cf8d0bd9356a8dbd7 100644 --- a/paddle/function/neon/NeonDepthwiseConv.cpp +++ b/paddle/function/neon/NeonDepthwiseConv.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/neon/NeonDepthwiseConv.h b/paddle/function/neon/NeonDepthwiseConv.h index 98a86d278f39e70472793e6a1d38f7dae469fd62..8b2cba263e7b30e9d6a001f40cc74e54541dc882 100644 --- a/paddle/function/neon/NeonDepthwiseConv.h +++ b/paddle/function/neon/NeonDepthwiseConv.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/neon/NeonDepthwiseConvTranspose.cpp b/paddle/function/neon/NeonDepthwiseConvTranspose.cpp index 49ca4bc8a0947ba329bd991e9f7d001623901a67..d443d3fa4902f998230651c5c64355d93c4c4f6a 100644 --- a/paddle/function/neon/NeonDepthwiseConvTranspose.cpp +++ b/paddle/function/neon/NeonDepthwiseConvTranspose.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/neon/neon_util.h b/paddle/function/neon/neon_util.h index e2db0450675084345ad55559d8988c5375801cc9..95076b1387a77f84efa9c8f46e72bd84ed5b65a2 100644 --- a/paddle/function/neon/neon_util.h +++ b/paddle/function/neon/neon_util.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/nnpack/NNPACKConvOp.cpp b/paddle/function/nnpack/NNPACKConvOp.cpp index 6ccc487cf1c26b181b025cc62c93807c8a2848ef..3cdba4f2ed0dad42035fe2d0de87ad5aeeef20ca 100644 --- a/paddle/function/nnpack/NNPACKConvOp.cpp +++ b/paddle/function/nnpack/NNPACKConvOp.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/function/nnpack/NNPACKConvOpTest.cpp b/paddle/function/nnpack/NNPACKConvOpTest.cpp index 4dd3982487f3567f461ddaea8c5dc719fff04736..c80ffb5d5d255465e9a2fa251fb9a6c61f96e7ec 100644 --- a/paddle/function/nnpack/NNPACKConvOpTest.cpp +++ b/paddle/function/nnpack/NNPACKConvOpTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/activations/ActivationFunction.cpp b/paddle/gserver/activations/ActivationFunction.cpp index 57c890e4884da38e2087d89dc199e20af51495ea..8d8f01234fe3859989e44fe6147105fb72b832ff 100644 --- a/paddle/gserver/activations/ActivationFunction.cpp +++ b/paddle/gserver/activations/ActivationFunction.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/activations/ActivationFunction.h b/paddle/gserver/activations/ActivationFunction.h index f208224e304a79125679c6f3a5c0be09552465ef..0f4b0fe0abb85403d42fc8a2ac28560e10058c20 100644 --- a/paddle/gserver/activations/ActivationFunction.h +++ b/paddle/gserver/activations/ActivationFunction.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/activations/MKLDNNActivation.cpp b/paddle/gserver/activations/MKLDNNActivation.cpp index f3ccd68160859795f28a40f8d0d4032adb289ccf..56ffb839344aabe43eaae0bd46e6dbf95e4d8f20 100644 --- a/paddle/gserver/activations/MKLDNNActivation.cpp +++ b/paddle/gserver/activations/MKLDNNActivation.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/activations/MKLDNNActivation.h b/paddle/gserver/activations/MKLDNNActivation.h index dd16421fd6e93b49c30b1d3b601f95980afec57b..392b32c70dae3728e13ee64f09f135c015c122cf 100644 --- a/paddle/gserver/activations/MKLDNNActivation.h +++ b/paddle/gserver/activations/MKLDNNActivation.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/DataProvider.cpp b/paddle/gserver/dataproviders/DataProvider.cpp index 106cf5b6228e636026ded558d0f591022f1ae586..580cf821c685b3daf7f015bc137c6d5ea31ef100 100644 --- a/paddle/gserver/dataproviders/DataProvider.cpp +++ b/paddle/gserver/dataproviders/DataProvider.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/DataProvider.h b/paddle/gserver/dataproviders/DataProvider.h index 265dbb54933540ff8b0d1e2e2d985b4b7fa51ecd..4851168abab7179d552648c88923a529d55e6a7e 100644 --- a/paddle/gserver/dataproviders/DataProvider.h +++ b/paddle/gserver/dataproviders/DataProvider.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/DataProviderGroup.h b/paddle/gserver/dataproviders/DataProviderGroup.h index 69ac2590b9cc8de95228fe2a83480e2c1e03db0a..768e54fe82bedd6faca5ad9eb2b6f2ee0017dc3d 100644 --- a/paddle/gserver/dataproviders/DataProviderGroup.h +++ b/paddle/gserver/dataproviders/DataProviderGroup.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/MultiDataProvider.cpp b/paddle/gserver/dataproviders/MultiDataProvider.cpp index 46fe053768e480c5f69f597c49f363cb966a4168..f71947ef3946284b7ecfb50851100fe43bd78857 100644 --- a/paddle/gserver/dataproviders/MultiDataProvider.cpp +++ b/paddle/gserver/dataproviders/MultiDataProvider.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/MultiDataProvider.h b/paddle/gserver/dataproviders/MultiDataProvider.h index 4c8fb2cd0ddf5d3b6304445508195b5c95dd6ab2..9a863c896773d71a99e21660fc13e3dd477a0c12 100644 --- a/paddle/gserver/dataproviders/MultiDataProvider.h +++ b/paddle/gserver/dataproviders/MultiDataProvider.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/ProtoReader.h b/paddle/gserver/dataproviders/ProtoReader.h index 4e6f58a5292bec276994fde0764278d12d7ae9d5..786703f4dee4802bb967f9d15fb69ebcbc15d997 100644 --- a/paddle/gserver/dataproviders/ProtoReader.h +++ b/paddle/gserver/dataproviders/ProtoReader.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/PyDataProvider.cpp b/paddle/gserver/dataproviders/PyDataProvider.cpp index b53790e764b9f9ad668abd1f4125695e3533a027..dadf1b4cf27f248c7353aaad50dc22d4f6431cca 100644 --- a/paddle/gserver/dataproviders/PyDataProvider.cpp +++ b/paddle/gserver/dataproviders/PyDataProvider.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/PyDataProvider.h b/paddle/gserver/dataproviders/PyDataProvider.h index 1401c13a1e611fda3000ec4af826ba0e66a3998a..e53354c9e43ea9dc58fd4bd38a533025b6f17482 100644 --- a/paddle/gserver/dataproviders/PyDataProvider.h +++ b/paddle/gserver/dataproviders/PyDataProvider.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/dataproviders/PyDataProvider2.cpp b/paddle/gserver/dataproviders/PyDataProvider2.cpp index b8079dc0796d0e300e65ac6b6b8d3bc826b1e504..e3e4457f9b72c5edb8082fdf378ae662b4aee42f 100644 --- a/paddle/gserver/dataproviders/PyDataProvider2.cpp +++ b/paddle/gserver/dataproviders/PyDataProvider2.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/evaluators/CTCErrorEvaluator.cpp b/paddle/gserver/evaluators/CTCErrorEvaluator.cpp index 92087fa32b1e48b50fbf447ec6f3c43e2a510220..0f680de776f4755ca5fe83c86ea759d88f93ed01 100644 --- a/paddle/gserver/evaluators/CTCErrorEvaluator.cpp +++ b/paddle/gserver/evaluators/CTCErrorEvaluator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/evaluators/ChunkEvaluator.cpp b/paddle/gserver/evaluators/ChunkEvaluator.cpp index a2ab15eedee4aaa7b47504d50e25300359f18173..755b91d05caf33745e66415e7b111ba348c575d9 100644 --- a/paddle/gserver/evaluators/ChunkEvaluator.cpp +++ b/paddle/gserver/evaluators/ChunkEvaluator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/evaluators/DetectionMAPEvaluator.cpp b/paddle/gserver/evaluators/DetectionMAPEvaluator.cpp index 9b825db574cf8bac2cf7b7538d0583a8adc2c158..f43ef5dd51407236a3a36b300b33f92a9fad885a 100644 --- a/paddle/gserver/evaluators/DetectionMAPEvaluator.cpp +++ b/paddle/gserver/evaluators/DetectionMAPEvaluator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/evaluators/Evaluator.cpp b/paddle/gserver/evaluators/Evaluator.cpp index 8e66b1f0db5d8a365a5aa9b98d2fb3f867458411..79478e7fac63a49c494105d53a6944b4b89e6c63 100644 --- a/paddle/gserver/evaluators/Evaluator.cpp +++ b/paddle/gserver/evaluators/Evaluator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/evaluators/Evaluator.h b/paddle/gserver/evaluators/Evaluator.h index 90203553e0a5fe8cc8183274f374da178bae30d0..be2032992c455fe2b442dbe05d84128ef8ebf82f 100644 --- a/paddle/gserver/evaluators/Evaluator.h +++ b/paddle/gserver/evaluators/Evaluator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/GradientMachine.cpp b/paddle/gserver/gradientmachines/GradientMachine.cpp index de5faf5e1e2b3e73bc07fe7f1635110f4efd7eec..654024e8a47c1e538f25823da78dce6a7a093975 100644 --- a/paddle/gserver/gradientmachines/GradientMachine.cpp +++ b/paddle/gserver/gradientmachines/GradientMachine.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/GradientMachine.h b/paddle/gserver/gradientmachines/GradientMachine.h index 4ab54a5022a3d30215c7557bca2e69c4d011fc5f..60936c311d1b0119186c76d5c95b8819294446ce 100644 --- a/paddle/gserver/gradientmachines/GradientMachine.h +++ b/paddle/gserver/gradientmachines/GradientMachine.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/GradientMachineMode.cpp b/paddle/gserver/gradientmachines/GradientMachineMode.cpp index 3583fb4de88acd1c68b1a1f56ea393bb630ba356..9a0b2643e03f9a1a978f9bd2fcd583d6dde948c8 100644 --- a/paddle/gserver/gradientmachines/GradientMachineMode.cpp +++ b/paddle/gserver/gradientmachines/GradientMachineMode.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/GradientMachineMode.h b/paddle/gserver/gradientmachines/GradientMachineMode.h index 7bc885fe99ed3831aa111561dd1cd20d499d5e53..898b68fbbc329145109ad0ae4b97c872d4f9a37c 100644 --- a/paddle/gserver/gradientmachines/GradientMachineMode.h +++ b/paddle/gserver/gradientmachines/GradientMachineMode.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/MultiGradientMachine.cpp b/paddle/gserver/gradientmachines/MultiGradientMachine.cpp index 018da6c76dc27a74b074ec52c18347beba8164fc..3f46cc98cdef17d14c253c732814bcba005fd667 100644 --- a/paddle/gserver/gradientmachines/MultiGradientMachine.cpp +++ b/paddle/gserver/gradientmachines/MultiGradientMachine.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/MultiGradientMachine.h b/paddle/gserver/gradientmachines/MultiGradientMachine.h index 5e7622f929fd57de6e38855528a752b5586c4cd1..83d2651f34b3698848427f29b1a90e606e57950e 100644 --- a/paddle/gserver/gradientmachines/MultiGradientMachine.h +++ b/paddle/gserver/gradientmachines/MultiGradientMachine.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/MultiNetwork.cpp b/paddle/gserver/gradientmachines/MultiNetwork.cpp index 5f52a5f3d48a4e7e6b7ec62fe007516273be361b..a1140402b8baaae20e20802ebf87462e301b60f9 100644 --- a/paddle/gserver/gradientmachines/MultiNetwork.cpp +++ b/paddle/gserver/gradientmachines/MultiNetwork.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/MultiNetwork.h b/paddle/gserver/gradientmachines/MultiNetwork.h index 3ac2888c5733299bc63d742d014e6c1b5cd0333b..186a9ad0a39cd7815aea6738e6c6bc4a0c944aa9 100644 --- a/paddle/gserver/gradientmachines/MultiNetwork.h +++ b/paddle/gserver/gradientmachines/MultiNetwork.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/NeuralNetwork.cpp b/paddle/gserver/gradientmachines/NeuralNetwork.cpp index 1f2aa61b6f86eebf7b002f1e48aa56d1d14d4820..a3c13df3dbad973505d8919bce8b95348527e273 100644 --- a/paddle/gserver/gradientmachines/NeuralNetwork.cpp +++ b/paddle/gserver/gradientmachines/NeuralNetwork.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/NeuralNetwork.h b/paddle/gserver/gradientmachines/NeuralNetwork.h index 968e198cf6608c47089d40fc98c6691f9e5bda5c..5b32f844f742c07c8bee6638cb46dc00285f49b0 100644 --- a/paddle/gserver/gradientmachines/NeuralNetwork.h +++ b/paddle/gserver/gradientmachines/NeuralNetwork.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/ParallelNeuralNetwork.cpp b/paddle/gserver/gradientmachines/ParallelNeuralNetwork.cpp index c6e3a3b321efb06a1678ec760c514fe1181cd3d7..85cfc59fbef7017f8dea7fdfecd18aa3e75a871c 100644 --- a/paddle/gserver/gradientmachines/ParallelNeuralNetwork.cpp +++ b/paddle/gserver/gradientmachines/ParallelNeuralNetwork.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/ParallelNeuralNetwork.h b/paddle/gserver/gradientmachines/ParallelNeuralNetwork.h index 39f5682a58e653cabaf4f3d3382d1e0bac5dece9..e3b6812123141e8e0afb9368fb06f2b34f526800 100644 --- a/paddle/gserver/gradientmachines/ParallelNeuralNetwork.h +++ b/paddle/gserver/gradientmachines/ParallelNeuralNetwork.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp b/paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp index 9f29b97466910f1daf88e3ca86f92d10661462c5..2429b5d1a0a5ccf66db365b82c494c53d8e1fd4b 100644 --- a/paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp +++ b/paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/gradientmachines/RecurrentGradientMachine.h b/paddle/gserver/gradientmachines/RecurrentGradientMachine.h index c16fae6d1770e616fdcfabd440624c9be9753c91..0032b72cdae44588af976f1ac542149545f551f1 100644 --- a/paddle/gserver/gradientmachines/RecurrentGradientMachine.h +++ b/paddle/gserver/gradientmachines/RecurrentGradientMachine.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/AddtoLayer.cpp b/paddle/gserver/layers/AddtoLayer.cpp index 5338530113e8428ceff58a340394a3bbb21f644e..75e17f52df64253232dc8fc042d0a1a8e7d98e26 100644 --- a/paddle/gserver/layers/AddtoLayer.cpp +++ b/paddle/gserver/layers/AddtoLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/AddtoLayer.h b/paddle/gserver/layers/AddtoLayer.h index 4e98c174b462763d3c2714770f66951981afa9f8..1d000630567cb1116ab0ff69e42380fc0eae6173 100644 --- a/paddle/gserver/layers/AddtoLayer.h +++ b/paddle/gserver/layers/AddtoLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/AgentLayer.cpp b/paddle/gserver/layers/AgentLayer.cpp index bdae7e623ae0472d4fe5ef3a88fc1e93bbf1e52c..e2f73f88f59278c6e6e6f0a1fe8457393d53f44a 100644 --- a/paddle/gserver/layers/AgentLayer.cpp +++ b/paddle/gserver/layers/AgentLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/AgentLayer.h b/paddle/gserver/layers/AgentLayer.h index 29681b29c6a9a10715548839f2d365eb4a0c7381..da0ac4530836205757399ac8eb64dd003740a53f 100644 --- a/paddle/gserver/layers/AgentLayer.h +++ b/paddle/gserver/layers/AgentLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/AverageLayer.cpp b/paddle/gserver/layers/AverageLayer.cpp index 96cc4288c6faad4b80c790ed2ce6f5128ea83b6d..b3787b1448a272d2879b372d34406aacc6c0bbfb 100644 --- a/paddle/gserver/layers/AverageLayer.cpp +++ b/paddle/gserver/layers/AverageLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/AverageLayer.h b/paddle/gserver/layers/AverageLayer.h index db4a17bfb07de98fc092621a378c4fc23fa3adab..24602d2a9c3e08cf76f6f98b5f9e3f593118e6e1 100644 --- a/paddle/gserver/layers/AverageLayer.h +++ b/paddle/gserver/layers/AverageLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/BatchNormBaseLayer.cpp b/paddle/gserver/layers/BatchNormBaseLayer.cpp index 925af31289d0c8ca534a30a16b14bfd2df90b013..a3516f9423e62df0192485c4476357ac51dc27a4 100644 --- a/paddle/gserver/layers/BatchNormBaseLayer.cpp +++ b/paddle/gserver/layers/BatchNormBaseLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/BatchNormBaseLayer.h b/paddle/gserver/layers/BatchNormBaseLayer.h index 2ac3cd9d670d0fcf9c40ad2f117d5a72479663a3..69d642af4f12593e8db8a726310e6b1934c8e3be 100644 --- a/paddle/gserver/layers/BatchNormBaseLayer.h +++ b/paddle/gserver/layers/BatchNormBaseLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/BatchNormalizationLayer.cpp b/paddle/gserver/layers/BatchNormalizationLayer.cpp index 25ab5cd927792d18f78bc1fa33eee4029b427cc7..59831dd9049d70198721989b4a515df39e015968 100644 --- a/paddle/gserver/layers/BatchNormalizationLayer.cpp +++ b/paddle/gserver/layers/BatchNormalizationLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/BatchNormalizationLayer.h b/paddle/gserver/layers/BatchNormalizationLayer.h index 1fdb5e2070259a14ab6f70957c9cf03f0699f734..95add69215e3ea0b0225d0a245fe37905c33127b 100644 --- a/paddle/gserver/layers/BatchNormalizationLayer.h +++ b/paddle/gserver/layers/BatchNormalizationLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/BilinearInterpLayer.cpp b/paddle/gserver/layers/BilinearInterpLayer.cpp index 1976cb00175d467ca0d94660d754264582bfe832..9775914596ce3253aada71fbe7197410414fede5 100644 --- a/paddle/gserver/layers/BilinearInterpLayer.cpp +++ b/paddle/gserver/layers/BilinearInterpLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/BilinearInterpLayer.h b/paddle/gserver/layers/BilinearInterpLayer.h index 27c269f2781c99e4f166ef1052cbf03a773ad57e..acd320420f4bbfe313f3ae77577ffc6b5cbfbfdf 100644 --- a/paddle/gserver/layers/BilinearInterpLayer.h +++ b/paddle/gserver/layers/BilinearInterpLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/BlockExpandLayer.cpp b/paddle/gserver/layers/BlockExpandLayer.cpp index 3b1f34635917290c6e4a9230b546892cc5cb7bfa..793d24e884a6f76c2aa897b3d03f3adc3e201265 100644 --- a/paddle/gserver/layers/BlockExpandLayer.cpp +++ b/paddle/gserver/layers/BlockExpandLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/BlockExpandLayer.h b/paddle/gserver/layers/BlockExpandLayer.h index 15ce73ab8b2ca16ba1e9329ed5c00dc7239e8b93..1797b64036b5cb9f97477d5a44b2f58e2d6c0cd4 100644 --- a/paddle/gserver/layers/BlockExpandLayer.h +++ b/paddle/gserver/layers/BlockExpandLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CRFDecodingLayer.cpp b/paddle/gserver/layers/CRFDecodingLayer.cpp index 191176ce985a8e12e33562f0cab73da6bbe667e6..4afed7e29565eae662506116e9b7aff03b61a9f9 100644 --- a/paddle/gserver/layers/CRFDecodingLayer.cpp +++ b/paddle/gserver/layers/CRFDecodingLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CRFDecodingLayer.h b/paddle/gserver/layers/CRFDecodingLayer.h index 3cbcac6cf62decd43844cc442fc5e4f973d0acfc..fba3cebac1a375008c58d21c458d9e0b98305ffa 100644 --- a/paddle/gserver/layers/CRFDecodingLayer.h +++ b/paddle/gserver/layers/CRFDecodingLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CRFLayer.cpp b/paddle/gserver/layers/CRFLayer.cpp index 867303b4fa0d490297ab152fc2ad266e92e29baf..8b87a533a2ba832dc8882196046898e10708c916 100644 --- a/paddle/gserver/layers/CRFLayer.cpp +++ b/paddle/gserver/layers/CRFLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CRFLayer.h b/paddle/gserver/layers/CRFLayer.h index 00ec13cede97401b4c8a308df6fac27e47692146..cb5bd05568cc79c0093d6af0791cf0b3ce2dae47 100644 --- a/paddle/gserver/layers/CRFLayer.h +++ b/paddle/gserver/layers/CRFLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CTCLayer.cpp b/paddle/gserver/layers/CTCLayer.cpp index 14ec851551848b0e8182909537a26d37a1286ac3..64eb15cd0dd23e180c61664a2ae24999e41b9bfb 100644 --- a/paddle/gserver/layers/CTCLayer.cpp +++ b/paddle/gserver/layers/CTCLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CTCLayer.h b/paddle/gserver/layers/CTCLayer.h index f7a515f312d075c54b4aab2557175c70fdbd9875..fcbc42565e9340903d05aca2d0ba2091ffe20be0 100644 --- a/paddle/gserver/layers/CTCLayer.h +++ b/paddle/gserver/layers/CTCLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ClipLayer.cpp b/paddle/gserver/layers/ClipLayer.cpp index 13f16c953793b82183237188b56eb61d76ecd2fd..dbc3337499788af5a9b6f68a6016e94c2072d61b 100644 --- a/paddle/gserver/layers/ClipLayer.cpp +++ b/paddle/gserver/layers/ClipLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConcatenateLayer.cpp b/paddle/gserver/layers/ConcatenateLayer.cpp index c5fc4cf4f81a55a4c57e92dce64c06acd404badd..f5ab29a509e45e72c71ba122c73aeba1b3b6a827 100644 --- a/paddle/gserver/layers/ConcatenateLayer.cpp +++ b/paddle/gserver/layers/ConcatenateLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ContextProjection.cpp b/paddle/gserver/layers/ContextProjection.cpp index d7042af1c25e7432e5b1efbb89cd8fd3f63fb4ae..10c3cef0da61af76a6b0a207e4b914276a2fa39b 100644 --- a/paddle/gserver/layers/ContextProjection.cpp +++ b/paddle/gserver/layers/ContextProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ContextProjection.h b/paddle/gserver/layers/ContextProjection.h index c87d6ed1d6d46b391ccf8722f6d110614be1fe78..e30f98f58d2be9ac538f6385efe68990b705ac5f 100644 --- a/paddle/gserver/layers/ContextProjection.h +++ b/paddle/gserver/layers/ContextProjection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Conv3DLayer.cpp b/paddle/gserver/layers/Conv3DLayer.cpp index 9deda2de989a55d34510560c49b213ea1a52fd07..b38de86b1591f987a63478d019019f87c88cee20 100644 --- a/paddle/gserver/layers/Conv3DLayer.cpp +++ b/paddle/gserver/layers/Conv3DLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Conv3DLayer.h b/paddle/gserver/layers/Conv3DLayer.h index b622508d0ce1b0938c44f5c7f1371a34c86b2c1d..5ab5ff3d4af07449484c441958c31c8fb06de894 100644 --- a/paddle/gserver/layers/Conv3DLayer.h +++ b/paddle/gserver/layers/Conv3DLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvBaseLayer.cpp b/paddle/gserver/layers/ConvBaseLayer.cpp index b848ab6bdd44f8fe81cbbf63b35a321599fd93fe..56bf4f9fcb187f73409076b826b738f62d19516a 100644 --- a/paddle/gserver/layers/ConvBaseLayer.cpp +++ b/paddle/gserver/layers/ConvBaseLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvBaseLayer.h b/paddle/gserver/layers/ConvBaseLayer.h index ccd170d9d85f573dff7340c26b2038c17a548471..93869fe68d15b1cf38296fa8e2f6197dc74f879f 100644 --- a/paddle/gserver/layers/ConvBaseLayer.h +++ b/paddle/gserver/layers/ConvBaseLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvBaseOperator.cpp b/paddle/gserver/layers/ConvBaseOperator.cpp index 5469c41c87468001232f7bae0d5b6bf26693b9e0..317e7d5c607683efa1e93aba9bc9ba472d37d60d 100644 --- a/paddle/gserver/layers/ConvBaseOperator.cpp +++ b/paddle/gserver/layers/ConvBaseOperator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvBaseOperator.h b/paddle/gserver/layers/ConvBaseOperator.h index 2d42169cde2a80a26edcf98bc2d728e00b075728..27fb0362d3c9518a263eac54206e00974d08eb20 100644 --- a/paddle/gserver/layers/ConvBaseOperator.h +++ b/paddle/gserver/layers/ConvBaseOperator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvBaseProjection.cpp b/paddle/gserver/layers/ConvBaseProjection.cpp index 19efed7b52ee07a5c509d069c286ccc3b21602f4..39f433b78fe7ce22cc7f93b87d96ed19c10fc2e9 100644 --- a/paddle/gserver/layers/ConvBaseProjection.cpp +++ b/paddle/gserver/layers/ConvBaseProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvBaseProjection.h b/paddle/gserver/layers/ConvBaseProjection.h index bb7ffa627b745f45b0f210cdb58ef87d6990af73..ba76d236d901187093a2e372a61c5d29d661e8bb 100644 --- a/paddle/gserver/layers/ConvBaseProjection.h +++ b/paddle/gserver/layers/ConvBaseProjection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvOperator.cpp b/paddle/gserver/layers/ConvOperator.cpp index 80932c8c509e3cb013c7e0051cbf4d8ccced0228..45498b92d32e0fa72adbe95a98e8d30c7f8929e2 100644 --- a/paddle/gserver/layers/ConvOperator.cpp +++ b/paddle/gserver/layers/ConvOperator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvOperator.h b/paddle/gserver/layers/ConvOperator.h index 0f3546c67ac174628044d5fb6e5c7bce06f37995..fbdb7bb1cd2b81bd72912dffdc9d059c520068a8 100644 --- a/paddle/gserver/layers/ConvOperator.h +++ b/paddle/gserver/layers/ConvOperator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvProjection.cpp b/paddle/gserver/layers/ConvProjection.cpp index 6f0106b713d93494ba9baa5c7afa0a6b1f167262..f382e6cab12a833ce555c948f41e1086093bd78e 100644 --- a/paddle/gserver/layers/ConvProjection.cpp +++ b/paddle/gserver/layers/ConvProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvProjection.h b/paddle/gserver/layers/ConvProjection.h index b7d7cc9a275529a02a5d8e82d28ed79cb7ce0b43..e8ecb99431a421d4b52228600909568b0808649a 100644 --- a/paddle/gserver/layers/ConvProjection.h +++ b/paddle/gserver/layers/ConvProjection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvShiftLayer.cpp b/paddle/gserver/layers/ConvShiftLayer.cpp index 002be415691f0b3df93835915dcbc9d455231422..fb877710196835e025466f37b5da27bcf80a3db4 100644 --- a/paddle/gserver/layers/ConvShiftLayer.cpp +++ b/paddle/gserver/layers/ConvShiftLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvTransOperator.cpp b/paddle/gserver/layers/ConvTransOperator.cpp index db026337a473f7edf1a7c0db320f60ff3048eb9c..ac41d6f9a4f86364930e27ee401406432e731b65 100644 --- a/paddle/gserver/layers/ConvTransOperator.cpp +++ b/paddle/gserver/layers/ConvTransOperator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvTransOperator.h b/paddle/gserver/layers/ConvTransOperator.h index ca08dc9aa77d59b45635c16cdd5064c5c3b5f96d..1bf58f2bfb78ae7dee433455ece37d908b113045 100644 --- a/paddle/gserver/layers/ConvTransOperator.h +++ b/paddle/gserver/layers/ConvTransOperator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvTransProjection.cpp b/paddle/gserver/layers/ConvTransProjection.cpp index e7f081c0232d185c223fc2f48ca79dc84c7f721d..242ce34a607057069a4d0a31e9b70d56279d37ab 100644 --- a/paddle/gserver/layers/ConvTransProjection.cpp +++ b/paddle/gserver/layers/ConvTransProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvTransProjection.h b/paddle/gserver/layers/ConvTransProjection.h index 6508d17b2409aa0cc11cdafb306604816f010718..269b2694c82ea076102633537d7c961139a19a43 100644 --- a/paddle/gserver/layers/ConvTransProjection.h +++ b/paddle/gserver/layers/ConvTransProjection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ConvexCombinationLayer.cpp b/paddle/gserver/layers/ConvexCombinationLayer.cpp index 32eb3bf604acaa8f2060882b545efeeb40f8218d..dce751940c1bf1695a034a3c551412dcb9b7b8b5 100644 --- a/paddle/gserver/layers/ConvexCombinationLayer.cpp +++ b/paddle/gserver/layers/ConvexCombinationLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CosSimLayer.cpp b/paddle/gserver/layers/CosSimLayer.cpp index 57ba124e40cbd098fa8b0012ff31d6935b16862a..4e44a5e8dfdad98bff0cd0f405b4227340a45728 100644 --- a/paddle/gserver/layers/CosSimLayer.cpp +++ b/paddle/gserver/layers/CosSimLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CosSimLayer.h b/paddle/gserver/layers/CosSimLayer.h index 8afaee62c2dcacba006846df0111fcbe8f7575e4..675cdb16b563faa7acf9e701096bd334ed661160 100644 --- a/paddle/gserver/layers/CosSimLayer.h +++ b/paddle/gserver/layers/CosSimLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CosSimVecMatLayer.cpp b/paddle/gserver/layers/CosSimVecMatLayer.cpp index 0f887d8adfa053e8fe88ac4fa4e2a9ba08ac07b5..685b4e8ef376b76b3058eeba82d803d460e7105c 100644 --- a/paddle/gserver/layers/CosSimVecMatLayer.cpp +++ b/paddle/gserver/layers/CosSimVecMatLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CostLayer.cpp b/paddle/gserver/layers/CostLayer.cpp index 0bb6f84c22eefbfb3678d6f15651f22c91454c2c..484f803a8387a16152c5911d7d5c72b0111283ae 100644 --- a/paddle/gserver/layers/CostLayer.cpp +++ b/paddle/gserver/layers/CostLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CostLayer.h b/paddle/gserver/layers/CostLayer.h index 0f655b48eea051c41ce17c0a41189b26188cc866..306c067ed1c040555d2b03996cc0749faf0ea68c 100644 --- a/paddle/gserver/layers/CostLayer.h +++ b/paddle/gserver/layers/CostLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CropLayer.cpp b/paddle/gserver/layers/CropLayer.cpp index 69ad913420bdb6e1b2ed0618b7f9b78d7477be99..bc97ca2f9e0cdc86f82baa0ce3fbafde2db0c10f 100644 --- a/paddle/gserver/layers/CropLayer.cpp +++ b/paddle/gserver/layers/CropLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CropLayer.h b/paddle/gserver/layers/CropLayer.h index 6b6202621023575c1c83049ecbd019656c726e3f..1a85911ef75e992df587a60cfc9a727eafa4cc76 100644 --- a/paddle/gserver/layers/CropLayer.h +++ b/paddle/gserver/layers/CropLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CrossChannelNormLayer.cpp b/paddle/gserver/layers/CrossChannelNormLayer.cpp index d72503217f1c9533d0c78a2a1a853559f2a1294f..644450291ee8a308accf7a1fe096332cc8c241dc 100644 --- a/paddle/gserver/layers/CrossChannelNormLayer.cpp +++ b/paddle/gserver/layers/CrossChannelNormLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CrossEntropyOverBeam.cpp b/paddle/gserver/layers/CrossEntropyOverBeam.cpp index 578bdbbe72120abccc63ed13d11e1dec65d41e44..f3bf214858702ec820020bc554359c58b1ffcfe3 100644 --- a/paddle/gserver/layers/CrossEntropyOverBeam.cpp +++ b/paddle/gserver/layers/CrossEntropyOverBeam.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CrossEntropyOverBeam.h b/paddle/gserver/layers/CrossEntropyOverBeam.h index 5643556f43370912a730d9895658d8944f50dced..b47a2933c255c264ba780b2d87c9fbe53cb5665d 100644 --- a/paddle/gserver/layers/CrossEntropyOverBeam.h +++ b/paddle/gserver/layers/CrossEntropyOverBeam.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CudnnBatchNormLayer.cpp b/paddle/gserver/layers/CudnnBatchNormLayer.cpp index 8390b55026c895b661cb514714ba92c05a7bf02e..9a29e6a55e95334def2b83dc4a794e07a7fd5154 100644 --- a/paddle/gserver/layers/CudnnBatchNormLayer.cpp +++ b/paddle/gserver/layers/CudnnBatchNormLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CudnnBatchNormLayer.h b/paddle/gserver/layers/CudnnBatchNormLayer.h index 1a3f0c0cbf8a1540e77cef70c753c91298728484..aa279f73d66770384815cad4d9e2ee0b04a4a1ad 100644 --- a/paddle/gserver/layers/CudnnBatchNormLayer.h +++ b/paddle/gserver/layers/CudnnBatchNormLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CudnnConvBaseLayer.cpp b/paddle/gserver/layers/CudnnConvBaseLayer.cpp index 9e954615cddf2566ea336d1c947985fd916e8cc4..6d0a40a60710603900a9b89980d38b2d7638ad60 100644 --- a/paddle/gserver/layers/CudnnConvBaseLayer.cpp +++ b/paddle/gserver/layers/CudnnConvBaseLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CudnnConvBaseLayer.h b/paddle/gserver/layers/CudnnConvBaseLayer.h index 93a05f94c7717f9170818b9d5ce3d27a6d18cef5..698104e4fbd2556f426001687a581153f32773d8 100644 --- a/paddle/gserver/layers/CudnnConvBaseLayer.h +++ b/paddle/gserver/layers/CudnnConvBaseLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CudnnPoolLayer.cpp b/paddle/gserver/layers/CudnnPoolLayer.cpp index 810a1af2d09c63c3787a1ac225c2c7de4238d609..ac6d2168f43590a6acd70f6641ff729327894ea0 100644 --- a/paddle/gserver/layers/CudnnPoolLayer.cpp +++ b/paddle/gserver/layers/CudnnPoolLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/CudnnPoolLayer.h b/paddle/gserver/layers/CudnnPoolLayer.h index f0aa22fe3af90c9233330c15fc56c3696a624446..9eb4fc6138b0bce59660406705d15291eb38af9b 100644 --- a/paddle/gserver/layers/CudnnPoolLayer.h +++ b/paddle/gserver/layers/CudnnPoolLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DataLayer.cpp b/paddle/gserver/layers/DataLayer.cpp index 3551df4e172f0237685127b0b3869554d9c5f97d..4cadaa76631ed793d041a5c1f9aa3a543c8e134f 100644 --- a/paddle/gserver/layers/DataLayer.cpp +++ b/paddle/gserver/layers/DataLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DataLayer.h b/paddle/gserver/layers/DataLayer.h index a9cf1f943c260a934564a19aecda28c24ccff43c..4b12afe0efe81843b58e459ca1e58b4f7f4a1664 100644 --- a/paddle/gserver/layers/DataLayer.h +++ b/paddle/gserver/layers/DataLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DataNormLayer.cpp b/paddle/gserver/layers/DataNormLayer.cpp index afd532c949fbc4ada53d65a92c858b7c6a11a382..86da4d6f957e2ce0afc53d69f9d57c234f8f178f 100644 --- a/paddle/gserver/layers/DataNormLayer.cpp +++ b/paddle/gserver/layers/DataNormLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DataNormLayer.h b/paddle/gserver/layers/DataNormLayer.h index f0fd044e5b83430a4028a227c7d5a31b6fa86f20..2a2a2a4aa76e8e315d9d66da1b738d6d615d10f2 100644 --- a/paddle/gserver/layers/DataNormLayer.h +++ b/paddle/gserver/layers/DataNormLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DeConv3DLayer.cpp b/paddle/gserver/layers/DeConv3DLayer.cpp index 3eea638649e8ebfdd7efa18615977a9e1344c695..db6d6e073c08c35c5a71b2b18ab0103d42ccd318 100644 --- a/paddle/gserver/layers/DeConv3DLayer.cpp +++ b/paddle/gserver/layers/DeConv3DLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DeConv3DLayer.h b/paddle/gserver/layers/DeConv3DLayer.h index a2a3d3f8273ed77065224c27df6f711f09f34bbc..57d51cdec66930b9b79c0c0395da66922cd53ae4 100644 --- a/paddle/gserver/layers/DeConv3DLayer.h +++ b/paddle/gserver/layers/DeConv3DLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DetectionOutputLayer.cpp b/paddle/gserver/layers/DetectionOutputLayer.cpp index f9040f7ae746f9ae1736cd477d3a69a2c49e9d34..93fe046c6a87f26c4db7b8e17df1c4dc4343884f 100644 --- a/paddle/gserver/layers/DetectionOutputLayer.cpp +++ b/paddle/gserver/layers/DetectionOutputLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DetectionOutputLayer.h b/paddle/gserver/layers/DetectionOutputLayer.h index a232af0a69141e238ae38c519a204cce25e9598d..174a6e5d9acb476276b66627b4aabce2ae6c1037 100644 --- a/paddle/gserver/layers/DetectionOutputLayer.h +++ b/paddle/gserver/layers/DetectionOutputLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DetectionUtil.cpp b/paddle/gserver/layers/DetectionUtil.cpp index d83674f45a70212a8adc94a31ff58eb0e01baa00..0dc45e5a7517820369dba245822fd9f880f96757 100644 --- a/paddle/gserver/layers/DetectionUtil.cpp +++ b/paddle/gserver/layers/DetectionUtil.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DetectionUtil.h b/paddle/gserver/layers/DetectionUtil.h index 641ed873b4c8645b6455e5ef5e63593e3005b770..d6502fcf8fb12a434632876c25ac3ca23b87e60e 100644 --- a/paddle/gserver/layers/DetectionUtil.h +++ b/paddle/gserver/layers/DetectionUtil.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DotMulOperator.cpp b/paddle/gserver/layers/DotMulOperator.cpp index 55dabd79d014a08f5a8bf3628483207984c917d0..68db2929adee1336e52abfcb8e6495e589afa683 100644 --- a/paddle/gserver/layers/DotMulOperator.cpp +++ b/paddle/gserver/layers/DotMulOperator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DotMulProjection.cpp b/paddle/gserver/layers/DotMulProjection.cpp index 0a1ede3618cb7ae91d5f90fc6bac498c07acc38e..86453aae84142f9f534182d085f4a96a2c7a3e15 100644 --- a/paddle/gserver/layers/DotMulProjection.cpp +++ b/paddle/gserver/layers/DotMulProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/DotProdLayer.cpp b/paddle/gserver/layers/DotProdLayer.cpp index 9e2dbe3c3c416f606d2938701f26288642b55267..5148d93e27d199b0c373221cedd4f03d6d32c8ab 100644 --- a/paddle/gserver/layers/DotProdLayer.cpp +++ b/paddle/gserver/layers/DotProdLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/EosIdCheckLayer.cpp b/paddle/gserver/layers/EosIdCheckLayer.cpp index 686f1fa0543cb3629ac223316e595e642a9e7d76..470a5b8ea208ad0acb64e3067881e0d183e1dc39 100644 --- a/paddle/gserver/layers/EosIdCheckLayer.cpp +++ b/paddle/gserver/layers/EosIdCheckLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ExpandConvLayer.cpp b/paddle/gserver/layers/ExpandConvLayer.cpp index 7ff0c73721d3de93aa7fa5fae58876884592c51f..3a8478658249bfb0886e904aec43e50fe3618f79 100644 --- a/paddle/gserver/layers/ExpandConvLayer.cpp +++ b/paddle/gserver/layers/ExpandConvLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ExpandConvLayer.h b/paddle/gserver/layers/ExpandConvLayer.h index a0873de19253f2496bc0c2fba550b3199dfc7486..be968155efd0b8f19503c996ccd329379c6b1104 100644 --- a/paddle/gserver/layers/ExpandConvLayer.h +++ b/paddle/gserver/layers/ExpandConvLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ExpandLayer.cpp b/paddle/gserver/layers/ExpandLayer.cpp index de5acfde05add701a1a71815b90522a11350fc9b..6b5776754017bca8f8c14170ecfb4faa4109e0b5 100644 --- a/paddle/gserver/layers/ExpandLayer.cpp +++ b/paddle/gserver/layers/ExpandLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ExpandLayer.h b/paddle/gserver/layers/ExpandLayer.h index c21b3350e2bc4b136eaf50f96799f479a13df6bd..04bbfcbd04931fa11d11a9fcc74f0e4f19767f1b 100644 --- a/paddle/gserver/layers/ExpandLayer.h +++ b/paddle/gserver/layers/ExpandLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/FactorizationMachineLayer.cpp b/paddle/gserver/layers/FactorizationMachineLayer.cpp index be26b9ba88c279036f73b0a0baaff164755fe067..1744faada2ebd9f2c88ba9a3952b6b2646729e3b 100644 --- a/paddle/gserver/layers/FactorizationMachineLayer.cpp +++ b/paddle/gserver/layers/FactorizationMachineLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/FactorizationMachineLayer.h b/paddle/gserver/layers/FactorizationMachineLayer.h index df20a49934d5dd444f127842c8fdb7c77f4ebeb1..684da4e65a461d46204c348b3374b0e9e00eb389 100644 --- a/paddle/gserver/layers/FactorizationMachineLayer.h +++ b/paddle/gserver/layers/FactorizationMachineLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/FeatureMapExpandLayer.cpp b/paddle/gserver/layers/FeatureMapExpandLayer.cpp index 8a2ae6b49fcc13ed22eca2a33c8296827812bff9..81b98da45bc4b9b8ef0723dd6ea2db809860e219 100644 --- a/paddle/gserver/layers/FeatureMapExpandLayer.cpp +++ b/paddle/gserver/layers/FeatureMapExpandLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/FullMatrixProjection.cpp b/paddle/gserver/layers/FullMatrixProjection.cpp index b8b6f403d6a02833305e2e10e6c3f6a178d4f0fd..b9f1bc99fab506cc616503608a581702b8e41d01 100644 --- a/paddle/gserver/layers/FullMatrixProjection.cpp +++ b/paddle/gserver/layers/FullMatrixProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/FullMatrixProjection.h b/paddle/gserver/layers/FullMatrixProjection.h index 58499f2e1ee815b2e11b68fecdb06ed3abe24756..7c4cd1a7066d427f54e1a280a956acb025e6dc16 100644 --- a/paddle/gserver/layers/FullMatrixProjection.h +++ b/paddle/gserver/layers/FullMatrixProjection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/FullyConnectedLayer.cpp b/paddle/gserver/layers/FullyConnectedLayer.cpp index d8a667ff8dc026b21308f0a43827f2e4342e1913..21ffa01d95a460b4b6edc2b02d63c19b32d0b070 100644 --- a/paddle/gserver/layers/FullyConnectedLayer.cpp +++ b/paddle/gserver/layers/FullyConnectedLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/FullyConnectedLayer.h b/paddle/gserver/layers/FullyConnectedLayer.h index 64e7a050125aa92b414e58c7678bf87efd01103f..e66aeeb7334c9c871749196d77474a02ecf82b09 100644 --- a/paddle/gserver/layers/FullyConnectedLayer.h +++ b/paddle/gserver/layers/FullyConnectedLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/GatedRecurrentLayer.cpp b/paddle/gserver/layers/GatedRecurrentLayer.cpp index d3aeea921801da301b2829736059130aec14cef6..9d38849fdf97e6099e39384dd7e6546de9180462 100644 --- a/paddle/gserver/layers/GatedRecurrentLayer.cpp +++ b/paddle/gserver/layers/GatedRecurrentLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/GatedRecurrentLayer.h b/paddle/gserver/layers/GatedRecurrentLayer.h index 58dd760eb870e9570f8a406f098f69c5fdf6477a..f0a3a823018f3943b0295c172b19d0fe9d0674b4 100644 --- a/paddle/gserver/layers/GatedRecurrentLayer.h +++ b/paddle/gserver/layers/GatedRecurrentLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/GetOutputLayer.cpp b/paddle/gserver/layers/GetOutputLayer.cpp index 4e29efd4612b18e655ba7674a3fd7890ce3f0e79..f255681f3e678e51f069522f965fd2776680b595 100644 --- a/paddle/gserver/layers/GetOutputLayer.cpp +++ b/paddle/gserver/layers/GetOutputLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/GruCompute.cpp b/paddle/gserver/layers/GruCompute.cpp index 148516391c6cad8feff34b9bd1c10c27d1a8a0e6..48ddbc413e6c915be6e86704f96e919932ca2970 100644 --- a/paddle/gserver/layers/GruCompute.cpp +++ b/paddle/gserver/layers/GruCompute.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/GruCompute.cu b/paddle/gserver/layers/GruCompute.cu index b4f5c54b14767586cb7b7e2c86cc069e2063ccfd..54be6b804753df76c0ffe3edee234dc8842f1df4 100644 --- a/paddle/gserver/layers/GruCompute.cu +++ b/paddle/gserver/layers/GruCompute.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/GruCompute.h b/paddle/gserver/layers/GruCompute.h index 3340e38e62cc396fd619cfa2a1fad57b0a8cf4c7..fb6bc56422002b4d4080ccb8438767b27ceef064 100644 --- a/paddle/gserver/layers/GruCompute.h +++ b/paddle/gserver/layers/GruCompute.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/GruStepLayer.cpp b/paddle/gserver/layers/GruStepLayer.cpp index 5b5cb25f9269a30f79d602b342411d0e6bfa429b..917c50250c1c04d6c8f113c8d42ef029e1028606 100644 --- a/paddle/gserver/layers/GruStepLayer.cpp +++ b/paddle/gserver/layers/GruStepLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/HierarchicalSigmoidLayer.cpp b/paddle/gserver/layers/HierarchicalSigmoidLayer.cpp index 236f8096bdb6e024cf3c9c73eba422616a777a23..3e720f179ee66baa73f40b8f5f19bfb4090831c0 100644 --- a/paddle/gserver/layers/HierarchicalSigmoidLayer.cpp +++ b/paddle/gserver/layers/HierarchicalSigmoidLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/HierarchicalSigmoidLayer.h b/paddle/gserver/layers/HierarchicalSigmoidLayer.h index 7f896e61ca26e3e22b99b65b1285384a121f7f02..10e501f1807ef6ba03d326a1bcf257ede0ee850a 100644 --- a/paddle/gserver/layers/HierarchicalSigmoidLayer.h +++ b/paddle/gserver/layers/HierarchicalSigmoidLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/IdentityProjection.cpp b/paddle/gserver/layers/IdentityProjection.cpp index f1d41a33d40f120d5de8b2bfe9cf3271eefa08be..6c70f77acc0c890e11a4929ea013d7745d8bbed0 100644 --- a/paddle/gserver/layers/IdentityProjection.cpp +++ b/paddle/gserver/layers/IdentityProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/InterpolationLayer.cpp b/paddle/gserver/layers/InterpolationLayer.cpp index eac7428571980baf6b2ddb8b2cc85b9c98afa5d6..0ac92024bc7eddf05ce023708537d0aa7bab6426 100644 --- a/paddle/gserver/layers/InterpolationLayer.cpp +++ b/paddle/gserver/layers/InterpolationLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/KmaxSeqScoreLayer.cpp b/paddle/gserver/layers/KmaxSeqScoreLayer.cpp index d5407555b248d79a5156a5ea354042d43ecda02c..0ea960902efc10007896b3f4ce915dea79d0d12d 100644 --- a/paddle/gserver/layers/KmaxSeqScoreLayer.cpp +++ b/paddle/gserver/layers/KmaxSeqScoreLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/L2DistanceLayer.cpp b/paddle/gserver/layers/L2DistanceLayer.cpp index c71df1b92cef9b19001a0984953a260fbdd1d762..c8cca3762cc3ecd6c04d7d2b804bc588c281bfb4 100644 --- a/paddle/gserver/layers/L2DistanceLayer.cpp +++ b/paddle/gserver/layers/L2DistanceLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/L2DistanceLayer.h b/paddle/gserver/layers/L2DistanceLayer.h index 9b12847a10e64a713635c0df079507b23a73c257..97f35daf7860fb3b082ef03203327e09dca67371 100644 --- a/paddle/gserver/layers/L2DistanceLayer.h +++ b/paddle/gserver/layers/L2DistanceLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Layer.cpp b/paddle/gserver/layers/Layer.cpp index b55b86221cd411addfa8c5e93f8089f5ed9b0557..32e2f4c9dd06e0ef7314b24719235c0be297961f 100644 --- a/paddle/gserver/layers/Layer.cpp +++ b/paddle/gserver/layers/Layer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Layer.h b/paddle/gserver/layers/Layer.h index 9813a556076bc2666869a85225feaf10f345217a..8da342a00f72ee1196c4af24104ce92c6bbf9f5c 100644 --- a/paddle/gserver/layers/Layer.h +++ b/paddle/gserver/layers/Layer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LinearChainCRF.cpp b/paddle/gserver/layers/LinearChainCRF.cpp index abaa1802b763a49f748214dbd4dec1d2bac53b59..315fc25fab30d80bd24a72a9a3ed5c3c6ba33629 100644 --- a/paddle/gserver/layers/LinearChainCRF.cpp +++ b/paddle/gserver/layers/LinearChainCRF.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LinearChainCRF.h b/paddle/gserver/layers/LinearChainCRF.h index 8daf1e14a6fa98bef41f4f32bff439df8302adfd..1ea4c7e105703b76601499bf3944648cdc98ec99 100644 --- a/paddle/gserver/layers/LinearChainCRF.h +++ b/paddle/gserver/layers/LinearChainCRF.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LinearChainCTC.cpp b/paddle/gserver/layers/LinearChainCTC.cpp index cb2b249110dbd736a46a713480eca12e59cb391b..1fad545b7a56bf9c0f0da219b4ab2e5190d44d52 100644 --- a/paddle/gserver/layers/LinearChainCTC.cpp +++ b/paddle/gserver/layers/LinearChainCTC.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LinearChainCTC.h b/paddle/gserver/layers/LinearChainCTC.h index 737c9d5c3188f4499267bb9536e1a75ef4871f23..0b774277dc8cf27f48c6905168cdea047365c99d 100644 --- a/paddle/gserver/layers/LinearChainCTC.h +++ b/paddle/gserver/layers/LinearChainCTC.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LstmCompute.cpp b/paddle/gserver/layers/LstmCompute.cpp index 4c4297096423762355a5ee028cac252432cc1956..ea30f6d6b1b8586569407af6baac2c14034e709c 100644 --- a/paddle/gserver/layers/LstmCompute.cpp +++ b/paddle/gserver/layers/LstmCompute.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LstmCompute.cu b/paddle/gserver/layers/LstmCompute.cu index d3f59b52a4b3163f47a969d9a08ecd139a099e33..3f15edcacabdae42bb1871833430361ebeb22fc8 100644 --- a/paddle/gserver/layers/LstmCompute.cu +++ b/paddle/gserver/layers/LstmCompute.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LstmCompute.h b/paddle/gserver/layers/LstmCompute.h index 2588fad2793961da2b2af889e8985f49540f1bda..b7d55eb1f984d102802cab87ba12ca9c69a2f4be 100644 --- a/paddle/gserver/layers/LstmCompute.h +++ b/paddle/gserver/layers/LstmCompute.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LstmLayer.cpp b/paddle/gserver/layers/LstmLayer.cpp index 01cc5fec8b9704e48dbe9b2e67840a344ac383ca..f65ae6a3e69cb5f0a7e6073d17bfd0beae91cd5d 100644 --- a/paddle/gserver/layers/LstmLayer.cpp +++ b/paddle/gserver/layers/LstmLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LstmLayer.h b/paddle/gserver/layers/LstmLayer.h index c45a52d2e9aaf41a8e02495cc2deae60ab13650a..4568b13ade5555e3cff703ceda1bbce3007c409d 100644 --- a/paddle/gserver/layers/LstmLayer.h +++ b/paddle/gserver/layers/LstmLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/LstmStepLayer.cpp b/paddle/gserver/layers/LstmStepLayer.cpp index 568277a90c62c73a811dcbf66782a4bdc4021b81..8faaa1c4e138fe1ec04b1911449d05528bb5b8b5 100644 --- a/paddle/gserver/layers/LstmStepLayer.cpp +++ b/paddle/gserver/layers/LstmStepLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MDLstmLayer.cpp b/paddle/gserver/layers/MDLstmLayer.cpp index be0f2a07d4aae253b7b18dbe406c4b94bf96bc8e..7cfdb3ff25096ad06c09434cdee48b5f85d650af 100644 --- a/paddle/gserver/layers/MDLstmLayer.cpp +++ b/paddle/gserver/layers/MDLstmLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNAddtoLayer.cpp b/paddle/gserver/layers/MKLDNNAddtoLayer.cpp index 39bffc26f7ddcd159130c492115b41080e32ce7f..544b4082fa0a396af61b54fce2cb672243e59afb 100644 --- a/paddle/gserver/layers/MKLDNNAddtoLayer.cpp +++ b/paddle/gserver/layers/MKLDNNAddtoLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNAddtoLayer.h b/paddle/gserver/layers/MKLDNNAddtoLayer.h index 0ea3e208e5fab8cbed8b53390a9381e6f2bb5733..e40e2f2251a1b739958773b8e6dc95a70ed58c76 100644 --- a/paddle/gserver/layers/MKLDNNAddtoLayer.h +++ b/paddle/gserver/layers/MKLDNNAddtoLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNBase.h b/paddle/gserver/layers/MKLDNNBase.h index af02a37cad668708f77ecf423549a8ec993e54fb..d84e2859407711c13c475a19e140e2f5f51e61c2 100644 --- a/paddle/gserver/layers/MKLDNNBase.h +++ b/paddle/gserver/layers/MKLDNNBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNBatchNormLayer.cpp b/paddle/gserver/layers/MKLDNNBatchNormLayer.cpp index 7faca0f8b7f54fa0a09e8fdab11064c8c26df375..dbdfaff32f729a0654eec8e2189d4ae23dfca1cb 100644 --- a/paddle/gserver/layers/MKLDNNBatchNormLayer.cpp +++ b/paddle/gserver/layers/MKLDNNBatchNormLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNBatchNormLayer.h b/paddle/gserver/layers/MKLDNNBatchNormLayer.h index 1cf33cb34fa9cd7c9b8487a0a4a0011fb129e311..93e182206a1ab1f06087cb808bb266ddea1468c9 100644 --- a/paddle/gserver/layers/MKLDNNBatchNormLayer.h +++ b/paddle/gserver/layers/MKLDNNBatchNormLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNConcatLayer.cpp b/paddle/gserver/layers/MKLDNNConcatLayer.cpp index 520ccc1a995e966de73080b61a8c20cbee722267..beed6176e118f3b12a4d02a0ec717792bc93364d 100644 --- a/paddle/gserver/layers/MKLDNNConcatLayer.cpp +++ b/paddle/gserver/layers/MKLDNNConcatLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNConcatLayer.h b/paddle/gserver/layers/MKLDNNConcatLayer.h index 37f3a26c5ed5db10cdba507368874c9557fb75ef..f7abdabfb51df27f8db4e6d4d88c80546eeba248 100644 --- a/paddle/gserver/layers/MKLDNNConcatLayer.h +++ b/paddle/gserver/layers/MKLDNNConcatLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNConvLayer.cpp b/paddle/gserver/layers/MKLDNNConvLayer.cpp index ab1d0f7b049a349c00c6e23deb37d789382de64f..a442a0a01369f4ceb27ba4a1976df7f6e25b832f 100644 --- a/paddle/gserver/layers/MKLDNNConvLayer.cpp +++ b/paddle/gserver/layers/MKLDNNConvLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNConvLayer.h b/paddle/gserver/layers/MKLDNNConvLayer.h index 3e754a0e65771879e836c13d63d5a5c8be3a699a..29c8735fbb91e7418797874238eb87759420f181 100644 --- a/paddle/gserver/layers/MKLDNNConvLayer.h +++ b/paddle/gserver/layers/MKLDNNConvLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNFcLayer.cpp b/paddle/gserver/layers/MKLDNNFcLayer.cpp index c8778bdd077c4b6d170140be92bdcdd7e8e81bb2..0c7e6f16e24a65b552cebcbd2111926cefc211f4 100644 --- a/paddle/gserver/layers/MKLDNNFcLayer.cpp +++ b/paddle/gserver/layers/MKLDNNFcLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNFcLayer.h b/paddle/gserver/layers/MKLDNNFcLayer.h index 283dc9b540531f6009ae6e2485b7c12d4e5cf2e3..0d41a4379d677f86f672852fec09b1241009597b 100644 --- a/paddle/gserver/layers/MKLDNNFcLayer.h +++ b/paddle/gserver/layers/MKLDNNFcLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNLRNLayer.cpp b/paddle/gserver/layers/MKLDNNLRNLayer.cpp index ac217f1363dbd0360645bbe07cd71a17cc931a79..88513ab8bca3899775be7822083b51120a04d6e4 100644 --- a/paddle/gserver/layers/MKLDNNLRNLayer.cpp +++ b/paddle/gserver/layers/MKLDNNLRNLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNLRNLayer.h b/paddle/gserver/layers/MKLDNNLRNLayer.h index cfe5621252c71a1de9a0a42a2a88e221e3e56972..b503ee55947294d7c44d1760058f8c26bceed142 100644 --- a/paddle/gserver/layers/MKLDNNLRNLayer.h +++ b/paddle/gserver/layers/MKLDNNLRNLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNLayer.cpp b/paddle/gserver/layers/MKLDNNLayer.cpp index 2d0fff608c3932ede57ddcbb6a85cda255b77246..f0acffe871626c992bf28351c72710168e3d0426 100644 --- a/paddle/gserver/layers/MKLDNNLayer.cpp +++ b/paddle/gserver/layers/MKLDNNLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNLayer.h b/paddle/gserver/layers/MKLDNNLayer.h index 3ba39f18b6ae4b38c17b3b72a359fd514e6dad5b..4a7eb74ce3a13ed38be3548d8ce34382c594205a 100644 --- a/paddle/gserver/layers/MKLDNNLayer.h +++ b/paddle/gserver/layers/MKLDNNLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNPoolLayer.cpp b/paddle/gserver/layers/MKLDNNPoolLayer.cpp index a8252593c8fbb8013ab909e74a057850ba54bcaa..3be848c7496aac616903cb09844c5eadd320e91c 100644 --- a/paddle/gserver/layers/MKLDNNPoolLayer.cpp +++ b/paddle/gserver/layers/MKLDNNPoolLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLDNNPoolLayer.h b/paddle/gserver/layers/MKLDNNPoolLayer.h index dad60156f0ef7caa059ff6c70d1040e7e34c938f..12821cda7308602dd2fe834f52c614e6112b7cea 100644 --- a/paddle/gserver/layers/MKLDNNPoolLayer.h +++ b/paddle/gserver/layers/MKLDNNPoolLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLPackedRecurrentLayer.cpp b/paddle/gserver/layers/MKLPackedRecurrentLayer.cpp index dd75555fae134664d92ba9f8ffdea8af78166b7e..d928ebc3248f57b13f4380ddcdfec767bbd083ff 100644 --- a/paddle/gserver/layers/MKLPackedRecurrentLayer.cpp +++ b/paddle/gserver/layers/MKLPackedRecurrentLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLPackedRecurrentLayer.h b/paddle/gserver/layers/MKLPackedRecurrentLayer.h index bded523a8fbd6ff18f28859bd2a1bf3c1a25e2a0..37eb362d45215edc736984f8da784fe74bb43f2b 100644 --- a/paddle/gserver/layers/MKLPackedRecurrentLayer.h +++ b/paddle/gserver/layers/MKLPackedRecurrentLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MKLPackedWeight.h b/paddle/gserver/layers/MKLPackedWeight.h index 15d5093beb43e2f086601c2616ace033da34f341..28b8a7db7cc3d2be12d6ce9291de1e415cf77bbc 100644 --- a/paddle/gserver/layers/MKLPackedWeight.h +++ b/paddle/gserver/layers/MKLPackedWeight.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MaxIdLayer.cpp b/paddle/gserver/layers/MaxIdLayer.cpp index 9e72b167cd963ae4928bf85503214dd7cee31148..84e375d7441ce3ccd8a5df94df22d85d104b5d96 100644 --- a/paddle/gserver/layers/MaxIdLayer.cpp +++ b/paddle/gserver/layers/MaxIdLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MaxLayer.cpp b/paddle/gserver/layers/MaxLayer.cpp index 23629e1986834f0195685cb1ec35358209de6a5b..7ee2e0dd946d6f332f6b8454f977601b0ee8d249 100644 --- a/paddle/gserver/layers/MaxLayer.cpp +++ b/paddle/gserver/layers/MaxLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MaxLayer.h b/paddle/gserver/layers/MaxLayer.h index fa536fce2b4818337520478a6590bae36b26d09a..9dbc672652dc2670a775f02ecd3a9de9919c8ae0 100644 --- a/paddle/gserver/layers/MaxLayer.h +++ b/paddle/gserver/layers/MaxLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MaxOutLayer.cpp b/paddle/gserver/layers/MaxOutLayer.cpp index 3a86a95321d8843338267df374dae169271410f5..919f62a45ba0729827b50e09479b4f0153a061a5 100644 --- a/paddle/gserver/layers/MaxOutLayer.cpp +++ b/paddle/gserver/layers/MaxOutLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MaxOutLayer.h b/paddle/gserver/layers/MaxOutLayer.h index 73fd8536be56b2c620fbfdea1937f3acd593bf05..1fb371836bacb9e02cc32eabfd21bf24165b0734 100644 --- a/paddle/gserver/layers/MaxOutLayer.h +++ b/paddle/gserver/layers/MaxOutLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MaxPoolWithMaskLayer.cpp b/paddle/gserver/layers/MaxPoolWithMaskLayer.cpp index d810a58d9a3aea4333806dc9805d3444c3772ba3..e594e22b5eaa6027fdf5bbd09ab93774d9a798be 100644 --- a/paddle/gserver/layers/MaxPoolWithMaskLayer.cpp +++ b/paddle/gserver/layers/MaxPoolWithMaskLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MaxPoolWithMaskLayer.h b/paddle/gserver/layers/MaxPoolWithMaskLayer.h index e0174add9d944930289f2bdf78d9f730fd1fcc7d..74cc8acf3515b10257ffb185061344fbcc94a337 100644 --- a/paddle/gserver/layers/MaxPoolWithMaskLayer.h +++ b/paddle/gserver/layers/MaxPoolWithMaskLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MixedLayer.cpp b/paddle/gserver/layers/MixedLayer.cpp index 2525b1984b80a4200923c007d3021d468745133e..7dcb30b98d6e6b08929d5fecba0833c8b1989725 100644 --- a/paddle/gserver/layers/MixedLayer.cpp +++ b/paddle/gserver/layers/MixedLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MixedLayer.h b/paddle/gserver/layers/MixedLayer.h index 755c9deb8b1be34b6f44a7b30b107f99102a3853..a1a43c52e4f503178a66ad8aa6c12bec89566081 100644 --- a/paddle/gserver/layers/MixedLayer.h +++ b/paddle/gserver/layers/MixedLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MultiBoxLossLayer.cpp b/paddle/gserver/layers/MultiBoxLossLayer.cpp index bbf1166dceddb1dbd672c42e8af22c113d2e3f54..335e9a6ac4786188903aab0d793fb71623734f57 100644 --- a/paddle/gserver/layers/MultiBoxLossLayer.cpp +++ b/paddle/gserver/layers/MultiBoxLossLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MultinomialSampler.cpp b/paddle/gserver/layers/MultinomialSampler.cpp index 0b285ed20f7ad86575aad3f5cbe710108fd75733..e74ed795a1532eab93cfe0e4b1312ef99ec1662f 100644 --- a/paddle/gserver/layers/MultinomialSampler.cpp +++ b/paddle/gserver/layers/MultinomialSampler.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MultinomialSampler.h b/paddle/gserver/layers/MultinomialSampler.h index 546ef9c1f24d1bc8abe68ba8b2fe6ab55f4b03e5..1f9e818ee5d21188e3bd39d1225912a1a2ae1598 100644 --- a/paddle/gserver/layers/MultinomialSampler.h +++ b/paddle/gserver/layers/MultinomialSampler.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/MultiplexLayer.cpp b/paddle/gserver/layers/MultiplexLayer.cpp index 297972b3cd9e4dfba94e2597053ab7c7c560c9dd..82857f8c3ef3e39ec451c1f26bac4996c12350a5 100644 --- a/paddle/gserver/layers/MultiplexLayer.cpp +++ b/paddle/gserver/layers/MultiplexLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/NCELayer.cpp b/paddle/gserver/layers/NCELayer.cpp index 0bc2ef11829337d9b765ef00066289494eb984b3..d3d7b1fd9ac3c366d11c3060848e89c24a16a70b 100644 --- a/paddle/gserver/layers/NCELayer.cpp +++ b/paddle/gserver/layers/NCELayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/NormLayer.cpp b/paddle/gserver/layers/NormLayer.cpp index caef7100929c7e3df4904b577cb7c2178466ddfc..4678f6fa9ab184870fc2651def18f47da9a0cc01 100644 --- a/paddle/gserver/layers/NormLayer.cpp +++ b/paddle/gserver/layers/NormLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/NormLayer.h b/paddle/gserver/layers/NormLayer.h index 7c238ac944e52c3a83c2aa5deac18de3aff6db61..c89cbbfce9d9e35a6dd300864ee094ef8f9e283a 100644 --- a/paddle/gserver/layers/NormLayer.h +++ b/paddle/gserver/layers/NormLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/NormProjectionLayer.cpp b/paddle/gserver/layers/NormProjectionLayer.cpp index 4331009de7e98d2326049e563e46a55a20366507..3013bbdbc791546897fca51e73a056f2c843e63f 100644 --- a/paddle/gserver/layers/NormProjectionLayer.cpp +++ b/paddle/gserver/layers/NormProjectionLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/NormProjectionLayer.h b/paddle/gserver/layers/NormProjectionLayer.h index 2997ae8848c438fa13037ccf03c1faca9ad73224..898b5823a9011c4b66e045c54afba070dd5cf772 100644 --- a/paddle/gserver/layers/NormProjectionLayer.h +++ b/paddle/gserver/layers/NormProjectionLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Operator.cpp b/paddle/gserver/layers/Operator.cpp index a638933914fc489a1d2e4fea9d6144d76cc50cdf..5b9cf8d15d6f585fda35011cae504a36514e445d 100644 --- a/paddle/gserver/layers/Operator.cpp +++ b/paddle/gserver/layers/Operator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Operator.h b/paddle/gserver/layers/Operator.h index 6fd331382f243039fa38b2762b2d5edede60d868..a620926cccd3004d7bef57976047a190b4b566e2 100644 --- a/paddle/gserver/layers/Operator.h +++ b/paddle/gserver/layers/Operator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/OuterProdLayer.cpp b/paddle/gserver/layers/OuterProdLayer.cpp index 283fdb003a2bb9474eac7a379ceb2c02027cfc5f..75f4abf93e5db11dc688f8f2e0b2a36bf70fbccc 100644 --- a/paddle/gserver/layers/OuterProdLayer.cpp +++ b/paddle/gserver/layers/OuterProdLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PadLayer.cpp b/paddle/gserver/layers/PadLayer.cpp index a5ed7e057aea8f065ee752f8c0f0d2d9bdddfc8b..b1910e108b5b2f7b55a2aa1527b96e6b8a16f348 100644 --- a/paddle/gserver/layers/PadLayer.cpp +++ b/paddle/gserver/layers/PadLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PadLayer.h b/paddle/gserver/layers/PadLayer.h index fe9388d8cc260ed599af0113361f4687f3f4a18b..7e09d7f8a0d4dfd5300298ad0514b69781d87016 100644 --- a/paddle/gserver/layers/PadLayer.h +++ b/paddle/gserver/layers/PadLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ParameterReluLayer.cpp b/paddle/gserver/layers/ParameterReluLayer.cpp index 836c1981ba1843ec280d64799cd3ac0d1d03f374..12d04fc1c3ca169179beafc372a07a2e6d0a1773 100644 --- a/paddle/gserver/layers/ParameterReluLayer.cpp +++ b/paddle/gserver/layers/ParameterReluLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ParameterReluLayer.h b/paddle/gserver/layers/ParameterReluLayer.h index 9a11b81ebf1f5c06355fc107b00aa69b65148ed5..3725fa4a1199285b703590255af492ebffdaab2c 100644 --- a/paddle/gserver/layers/ParameterReluLayer.h +++ b/paddle/gserver/layers/ParameterReluLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Pool3DLayer.cpp b/paddle/gserver/layers/Pool3DLayer.cpp index 199f21adb1a5923b590e4f0e716fc67effb2a2d1..3ac9eb0d8198814c9f01fe101a60ab1f1f431062 100644 --- a/paddle/gserver/layers/Pool3DLayer.cpp +++ b/paddle/gserver/layers/Pool3DLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Pool3DLayer.h b/paddle/gserver/layers/Pool3DLayer.h index 8329a02f571bf3b5422134c756c248f77fd517b1..59ee73f7cb9fb4287c12f3c7d0cacfc812484770 100644 --- a/paddle/gserver/layers/Pool3DLayer.h +++ b/paddle/gserver/layers/Pool3DLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PoolLayer.cpp b/paddle/gserver/layers/PoolLayer.cpp index fceb389d06d8d2cb0357186bf83edda9957c6c19..ee589e6be51b1e66984f5a1d808b73aab962821d 100644 --- a/paddle/gserver/layers/PoolLayer.cpp +++ b/paddle/gserver/layers/PoolLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PoolLayer.h b/paddle/gserver/layers/PoolLayer.h index 9df672a935868e9c61f4dd1fd47a9c309b214f12..58d5fb0a095e8326f9b6f9cb2a97bb88022ceed8 100644 --- a/paddle/gserver/layers/PoolLayer.h +++ b/paddle/gserver/layers/PoolLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PoolProjection.cpp b/paddle/gserver/layers/PoolProjection.cpp index 6a9de394cee3769784a38f5512b15f52b1ed6fa1..73ce88adf25b16e0ae8c416ddccd969336f5fdeb 100644 --- a/paddle/gserver/layers/PoolProjection.cpp +++ b/paddle/gserver/layers/PoolProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PoolProjection.h b/paddle/gserver/layers/PoolProjection.h index a0412714bca7a273e999e4d6bd552e833d20d69c..c99287dbf0f4503c180b9b4e9e46abafa67bf64d 100644 --- a/paddle/gserver/layers/PoolProjection.h +++ b/paddle/gserver/layers/PoolProjection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PoolProjectionLayer.cpp b/paddle/gserver/layers/PoolProjectionLayer.cpp index ed5011ab8990620acb12f3ca6c488ce403336d45..73d320e67ec09513f419ecdd45a57fc5c54df5ed 100644 --- a/paddle/gserver/layers/PoolProjectionLayer.cpp +++ b/paddle/gserver/layers/PoolProjectionLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PoolProjectionLayer.h b/paddle/gserver/layers/PoolProjectionLayer.h index e31116de8ccb1f6b847c9fff47961bedfad1a79c..5a97a7769aaeebcfd4fe2c10d8ac0cc8892f68e3 100644 --- a/paddle/gserver/layers/PoolProjectionLayer.h +++ b/paddle/gserver/layers/PoolProjectionLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PowerLayer.cpp b/paddle/gserver/layers/PowerLayer.cpp index 31c34b43e2995a2bf7f4d16629a8172a7e76c8e1..18f650fcdaded5ad7199510594b873fc18c3d7b5 100644 --- a/paddle/gserver/layers/PowerLayer.cpp +++ b/paddle/gserver/layers/PowerLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PrintLayer.cpp b/paddle/gserver/layers/PrintLayer.cpp index e83ae34bbe7d31b9bb7c16bc3fa84db7bd4e33d2..5a527d598dd5e11ae0b74a32c9b9884e73ed45a8 100644 --- a/paddle/gserver/layers/PrintLayer.cpp +++ b/paddle/gserver/layers/PrintLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/PriorBox.cpp b/paddle/gserver/layers/PriorBox.cpp index 8faf032f550836579522016b4fff3db7e94746e3..af2cc05a954b3a6857c1015104a57339282840b8 100644 --- a/paddle/gserver/layers/PriorBox.cpp +++ b/paddle/gserver/layers/PriorBox.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Projection.cpp b/paddle/gserver/layers/Projection.cpp index 974b3cf059fff24de2b5f4cdcf6f9c05ceedee8d..96d61e7f67be294a05a84db75bb7e700e4303b7a 100644 --- a/paddle/gserver/layers/Projection.cpp +++ b/paddle/gserver/layers/Projection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/Projection.h b/paddle/gserver/layers/Projection.h index 778a7fe13d8a2b669831396e69546446b4745e61..1f0b96c79ec7313cd9c5ff9139a455b3269b222b 100644 --- a/paddle/gserver/layers/Projection.h +++ b/paddle/gserver/layers/Projection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ROIPoolLayer.cpp b/paddle/gserver/layers/ROIPoolLayer.cpp index 7d7c30b4d89e2dd137e7fc7de3159c07bbab9fb4..b5cbc0c704a1a87ecfe6d7d980aff30238cd6aad 100644 --- a/paddle/gserver/layers/ROIPoolLayer.cpp +++ b/paddle/gserver/layers/ROIPoolLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ROIPoolLayer.h b/paddle/gserver/layers/ROIPoolLayer.h index 4f07e49d6fd1eda9fa7bd46e4cec771a75f571be..b1735e9748dc3956aade010f33303b55d4f9f439 100644 --- a/paddle/gserver/layers/ROIPoolLayer.h +++ b/paddle/gserver/layers/ROIPoolLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/RecurrentLayer.cpp b/paddle/gserver/layers/RecurrentLayer.cpp index 6bd42c06cadf755e8703f3fc299d0e6248dd1478..3fc5bd15edd3180a301723bb6cb115b207684b61 100644 --- a/paddle/gserver/layers/RecurrentLayer.cpp +++ b/paddle/gserver/layers/RecurrentLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/RecurrentLayer.h b/paddle/gserver/layers/RecurrentLayer.h index f40dbe150fa93becfc26f6ea9e55e40eaf208860..8fd4fe6b78ae6474f3cfcec605f25b72af8295bb 100644 --- a/paddle/gserver/layers/RecurrentLayer.h +++ b/paddle/gserver/layers/RecurrentLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/RecurrentLayerGroup.cpp b/paddle/gserver/layers/RecurrentLayerGroup.cpp index 78a74ff19a38cd205f3a46900bf716e2e1b1e4d5..27e8b5868e6d85cf004945d7cb086d6d57487f9f 100644 --- a/paddle/gserver/layers/RecurrentLayerGroup.cpp +++ b/paddle/gserver/layers/RecurrentLayerGroup.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ResizeLayer.cpp b/paddle/gserver/layers/ResizeLayer.cpp index eb3b63c106901f89dd75cc2a495477b240d40e3c..831f4c3b7e103bc51d870cfa44616980adca08e8 100644 --- a/paddle/gserver/layers/ResizeLayer.cpp +++ b/paddle/gserver/layers/ResizeLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/RotateLayer.cpp b/paddle/gserver/layers/RotateLayer.cpp index 7c71088d786ab218bf0f71b577985c023dd1436f..f205d1a91949cc0eb541fefe426be3a2c0886140 100644 --- a/paddle/gserver/layers/RotateLayer.cpp +++ b/paddle/gserver/layers/RotateLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/RotateLayer.h b/paddle/gserver/layers/RotateLayer.h index d05c2065cb1cb81452c54ee1858c34cb46e6c7f6..3b619921ab741e1236a495e497e18e265bd6e110 100644 --- a/paddle/gserver/layers/RotateLayer.h +++ b/paddle/gserver/layers/RotateLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/RowConvLayer.cpp b/paddle/gserver/layers/RowConvLayer.cpp index 54d77999ad5b30a8d9f4feaa02d81417957544a7..63b499e486fd24b5f816ee0e897b040ee5007581 100644 --- a/paddle/gserver/layers/RowConvLayer.cpp +++ b/paddle/gserver/layers/RowConvLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/RowConvLayer.h b/paddle/gserver/layers/RowConvLayer.h index b3bdda2f3542b312eda531695c975ff2dfc29c93..ba0af1de68a5f77d9ffefac6ef5193bb9d1b4f83 100644 --- a/paddle/gserver/layers/RowConvLayer.h +++ b/paddle/gserver/layers/RowConvLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/RowL2NormLayer.cpp b/paddle/gserver/layers/RowL2NormLayer.cpp index 0d609be43b73a86d0d0f7b60be993836e2ea6fff..7ff0c9bae927cae2bc6a332bc0bde013e07edd0a 100644 --- a/paddle/gserver/layers/RowL2NormLayer.cpp +++ b/paddle/gserver/layers/RowL2NormLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SamplingIdLayer.cpp b/paddle/gserver/layers/SamplingIdLayer.cpp index 2538d99bb71fa1ce6546730b817a49347fe3c5d8..2edd915d226edfd7e48df1a066d5a6f51f259511 100644 --- a/paddle/gserver/layers/SamplingIdLayer.cpp +++ b/paddle/gserver/layers/SamplingIdLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ScaleShiftLayer.cpp b/paddle/gserver/layers/ScaleShiftLayer.cpp index 35fd038ab43a8a8b08bc328b3d1b08a7bbedd0a1..799d1fe51a65da10bef637894931627315daf0a2 100644 --- a/paddle/gserver/layers/ScaleShiftLayer.cpp +++ b/paddle/gserver/layers/ScaleShiftLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ScaleSubRegionLayer.cpp b/paddle/gserver/layers/ScaleSubRegionLayer.cpp index aa6778aef4e893208fd064ca22e217c6c4d960f9..68a0ff735844679df1393473355f54ee616c09bd 100644 --- a/paddle/gserver/layers/ScaleSubRegionLayer.cpp +++ b/paddle/gserver/layers/ScaleSubRegionLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ScaleSubRegionLayer.h b/paddle/gserver/layers/ScaleSubRegionLayer.h index a27c56de93bb6fdde0f95cd4c5abe5dfabe4e858..6e861be4858cfc21a42ef7293652d5cdf81be5f5 100644 --- a/paddle/gserver/layers/ScaleSubRegionLayer.h +++ b/paddle/gserver/layers/ScaleSubRegionLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ScalingLayer.cpp b/paddle/gserver/layers/ScalingLayer.cpp index a38ee0857a767981eb24e79e96bf6115e9c63720..1d98a7373d172d40cddc9b4611cb00434f17e00b 100644 --- a/paddle/gserver/layers/ScalingLayer.cpp +++ b/paddle/gserver/layers/ScalingLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ScalingProjection.cpp b/paddle/gserver/layers/ScalingProjection.cpp index ddb8c8711018ad9c92ef2f3bf26325aa5bffef89..99b5b68f543842d23f20b626fddd66b677ebe059 100644 --- a/paddle/gserver/layers/ScalingProjection.cpp +++ b/paddle/gserver/layers/ScalingProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SelectiveFullyConnectedLayer.cpp b/paddle/gserver/layers/SelectiveFullyConnectedLayer.cpp index d9a91de8a6f4daf514f089a3d63cb519223bfdd0..43c98993f3f6f74c034c59176378c3ea97a9c19b 100644 --- a/paddle/gserver/layers/SelectiveFullyConnectedLayer.cpp +++ b/paddle/gserver/layers/SelectiveFullyConnectedLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SelectiveFullyConnectedLayer.h b/paddle/gserver/layers/SelectiveFullyConnectedLayer.h index 99126fdba542bd142341039af27c3af72b391ca7..81564074185a5d9fc80d4d3a64af998098ab5472 100644 --- a/paddle/gserver/layers/SelectiveFullyConnectedLayer.h +++ b/paddle/gserver/layers/SelectiveFullyConnectedLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SequenceConcatLayer.cpp b/paddle/gserver/layers/SequenceConcatLayer.cpp index 4b24d8f0c852e1bdc887d4ee1465b9ad05d210bb..cf573f3f33fcd70c6768b164f158cb1f545414fc 100644 --- a/paddle/gserver/layers/SequenceConcatLayer.cpp +++ b/paddle/gserver/layers/SequenceConcatLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SequenceLastInstanceLayer.cpp b/paddle/gserver/layers/SequenceLastInstanceLayer.cpp index 323cc47df199a6cb5e8e87cad4aaf51a92c36f81..6c4ae775c16ac76e237fb8f8ee5ec9ed8f11802e 100644 --- a/paddle/gserver/layers/SequenceLastInstanceLayer.cpp +++ b/paddle/gserver/layers/SequenceLastInstanceLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SequencePoolLayer.cpp b/paddle/gserver/layers/SequencePoolLayer.cpp index 2a693b110a562ce3938643c919bfb1a4d3cd1f80..650ab425d1fcca56d8862200f37dd5bb36a67240 100644 --- a/paddle/gserver/layers/SequencePoolLayer.cpp +++ b/paddle/gserver/layers/SequencePoolLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SequencePoolLayer.h b/paddle/gserver/layers/SequencePoolLayer.h index e207afd1dce80e646b220c5be601fd3a6bd36bac..254e4cc6b3aacf21565cb03e5bdb52a2beb9fea8 100644 --- a/paddle/gserver/layers/SequencePoolLayer.h +++ b/paddle/gserver/layers/SequencePoolLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SequenceReshapeLayer.cpp b/paddle/gserver/layers/SequenceReshapeLayer.cpp index 822974407283c9ee6d0efee71bc945bc418b1942..fb96669917236b98809f1cda0d023600f1e76731 100644 --- a/paddle/gserver/layers/SequenceReshapeLayer.cpp +++ b/paddle/gserver/layers/SequenceReshapeLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SequenceSliceLayer.cpp b/paddle/gserver/layers/SequenceSliceLayer.cpp index ce68ca449429711eeee692be750a4a2f1dac61a6..1b7c33477ea64c1cdb7c8e85d7a5302b299d7552 100644 --- a/paddle/gserver/layers/SequenceSliceLayer.cpp +++ b/paddle/gserver/layers/SequenceSliceLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SequenceToBatch.cpp b/paddle/gserver/layers/SequenceToBatch.cpp index 6b769378d24838364701d0f128a7308c6195cc41..5d0d588e67ad814fe82bb4a89e819829ee32b3b5 100644 --- a/paddle/gserver/layers/SequenceToBatch.cpp +++ b/paddle/gserver/layers/SequenceToBatch.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SequenceToBatch.h b/paddle/gserver/layers/SequenceToBatch.h index 17e735a135cba8b43caf0ed9e06bb53903b5cd6a..8743a5ef10f61970d3d48b105b9da29bcd10ba83 100644 --- a/paddle/gserver/layers/SequenceToBatch.h +++ b/paddle/gserver/layers/SequenceToBatch.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SliceProjection.cpp b/paddle/gserver/layers/SliceProjection.cpp index 267dd6154b1b21cc9b936384d438a2c3bdf0c246..5627ad1eb3a49a73261bc2197cbd3735489509d2 100644 --- a/paddle/gserver/layers/SliceProjection.cpp +++ b/paddle/gserver/layers/SliceProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SlopeInterceptLayer.cpp b/paddle/gserver/layers/SlopeInterceptLayer.cpp index faf98744a7fdcf9c2c1712d783f153739ccc8eca..c94a07e5da7442bba1ce7e9c09c4ffea3e5cd4ac 100644 --- a/paddle/gserver/layers/SlopeInterceptLayer.cpp +++ b/paddle/gserver/layers/SlopeInterceptLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SpatialPyramidPoolLayer.cpp b/paddle/gserver/layers/SpatialPyramidPoolLayer.cpp index 14fe88ff8a5a1440ad1c98850e571f84813fec3e..b445a399ef691ce6b6a8b6ff927b8c8e1f04dcfd 100644 --- a/paddle/gserver/layers/SpatialPyramidPoolLayer.cpp +++ b/paddle/gserver/layers/SpatialPyramidPoolLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SpatialPyramidPoolLayer.h b/paddle/gserver/layers/SpatialPyramidPoolLayer.h index 7d3cb80443801a947e3d529beb002561c4ac1964..6cb5fdf83e2b88ce4adb392807a1fdbac253c51c 100644 --- a/paddle/gserver/layers/SpatialPyramidPoolLayer.h +++ b/paddle/gserver/layers/SpatialPyramidPoolLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SubNestedSequenceLayer.cpp b/paddle/gserver/layers/SubNestedSequenceLayer.cpp index e9bee77212065effdac78cba590caed2e9155f0a..db240ab0c96510263d90b291f6396ac51a73fbbd 100644 --- a/paddle/gserver/layers/SubNestedSequenceLayer.cpp +++ b/paddle/gserver/layers/SubNestedSequenceLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SubSequenceLayer.cpp b/paddle/gserver/layers/SubSequenceLayer.cpp index 00d8ce017aa0121217688a1afc1fe31b4c3619ec..808627f09273950bb6f52a4a6e497bcb8ea170f7 100644 --- a/paddle/gserver/layers/SubSequenceLayer.cpp +++ b/paddle/gserver/layers/SubSequenceLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SumToOneNormLayer.cpp b/paddle/gserver/layers/SumToOneNormLayer.cpp index 00f8519550bcff9bb706b1a28dc0dfcdc06cc54a..ffbe14925300ad1ffbd33f43a6c0afadddd231e6 100644 --- a/paddle/gserver/layers/SumToOneNormLayer.cpp +++ b/paddle/gserver/layers/SumToOneNormLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SwitchOrderLayer.cpp b/paddle/gserver/layers/SwitchOrderLayer.cpp index e97809141a93106f9e6ebaf40c7e8aa9c6010557..704735de38bd373c0714de6bb4e139d1505c5451 100644 --- a/paddle/gserver/layers/SwitchOrderLayer.cpp +++ b/paddle/gserver/layers/SwitchOrderLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/SwitchOrderLayer.h b/paddle/gserver/layers/SwitchOrderLayer.h index 47b1f7f73ee783b3eae3c9cfe08b1459cef16a71..882437f4434c2e61a5b08328d2f79c1e7f589204 100644 --- a/paddle/gserver/layers/SwitchOrderLayer.h +++ b/paddle/gserver/layers/SwitchOrderLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/TableProjection.cpp b/paddle/gserver/layers/TableProjection.cpp index 270acdd34baa2ba5d68718598cab5c3928cc1e9a..326e241d07558cdb3c70afc1b112dc32c949d1f0 100644 --- a/paddle/gserver/layers/TableProjection.cpp +++ b/paddle/gserver/layers/TableProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/TableProjection.h b/paddle/gserver/layers/TableProjection.h index fb6c0e17c2da181aab23a1860fef993dd254955d..ffb05e68f068a7b9abb0db5cea6133e64300cb55 100644 --- a/paddle/gserver/layers/TableProjection.h +++ b/paddle/gserver/layers/TableProjection.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/TensorLayer.cpp b/paddle/gserver/layers/TensorLayer.cpp index 5be88d7c05dae5c43805bc62ce95dc2efcac3df6..b2271c63ef76d85574cf7f71b18aef4239938b8e 100644 --- a/paddle/gserver/layers/TensorLayer.cpp +++ b/paddle/gserver/layers/TensorLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/TensorLayer.h b/paddle/gserver/layers/TensorLayer.h index 43992f692d3ce40fa095c8e0190bae01dc2ac3c1..8a323aa15f6f3761c45b6ca7e3be8f15621a189e 100644 --- a/paddle/gserver/layers/TensorLayer.h +++ b/paddle/gserver/layers/TensorLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/TransLayer.cpp b/paddle/gserver/layers/TransLayer.cpp index 4150f1727d8a1a3c1ed21b01944040977d2db315..cf87ca53d1def32708400c507da673c3a6ec0a87 100644 --- a/paddle/gserver/layers/TransLayer.cpp +++ b/paddle/gserver/layers/TransLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/TransLayer.h b/paddle/gserver/layers/TransLayer.h index be10bb74f6b218f0b12dc9f20db9a6ee8af7a478..03d094862459c80aee8899c0352ffce732db08af 100644 --- a/paddle/gserver/layers/TransLayer.h +++ b/paddle/gserver/layers/TransLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/TransposedFullMatrixProjection.cpp b/paddle/gserver/layers/TransposedFullMatrixProjection.cpp index 2a12499e5b5f10cda1a4d5b09946613eafc10ff7..755389f7074c252c0fad396e629c6ffedc74b531 100644 --- a/paddle/gserver/layers/TransposedFullMatrixProjection.cpp +++ b/paddle/gserver/layers/TransposedFullMatrixProjection.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ValidationLayer.cpp b/paddle/gserver/layers/ValidationLayer.cpp index 5127bcaba336b72dc76c832892e057724aeb3471..b626825a7b45fdb09cd8f9e8cc6727e218ab2940 100644 --- a/paddle/gserver/layers/ValidationLayer.cpp +++ b/paddle/gserver/layers/ValidationLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/ValidationLayer.h b/paddle/gserver/layers/ValidationLayer.h index c8b2634a1366ed03846f2331726d04232b5d32ee..f412d685c0541537bd4318fec2dae06215c4afbe 100644 --- a/paddle/gserver/layers/ValidationLayer.h +++ b/paddle/gserver/layers/ValidationLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/WarpCTCLayer.cpp b/paddle/gserver/layers/WarpCTCLayer.cpp index 94e926a8d8f678c91b5c0614a78ba829869ec150..6b1656a523d4ac630ec3fd8d934ab44844a0d1f8 100644 --- a/paddle/gserver/layers/WarpCTCLayer.cpp +++ b/paddle/gserver/layers/WarpCTCLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/layers/WarpCTCLayer.h b/paddle/gserver/layers/WarpCTCLayer.h index 7e8d7379d267886805db2eb7983a4dabbf949914..6f6be359c0aa46a4f3775f8405e1aa51ca1ae147 100644 --- a/paddle/gserver/layers/WarpCTCLayer.h +++ b/paddle/gserver/layers/WarpCTCLayer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/LayerGradUtil.cpp b/paddle/gserver/tests/LayerGradUtil.cpp index cd957c7c0bca4c6089cc07e8f4226b8260190f07..f08c1cd1d50d3ead5373a7af64619c8c0ddc78be 100644 --- a/paddle/gserver/tests/LayerGradUtil.cpp +++ b/paddle/gserver/tests/LayerGradUtil.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/LayerGradUtil.h b/paddle/gserver/tests/LayerGradUtil.h index e10a27eedfa3d207d77a9bf1c5bfb23480dcca69..1999b2204b1728bd60b1e107dfe7b10718e752a5 100644 --- a/paddle/gserver/tests/LayerGradUtil.h +++ b/paddle/gserver/tests/LayerGradUtil.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/MKLDNNTester.cpp b/paddle/gserver/tests/MKLDNNTester.cpp index afe1608eab8eaf1217a7a0c8a2774e37c5ea83f4..d2a9761a4e16832a0722d4375cc11adb42524a8c 100644 --- a/paddle/gserver/tests/MKLDNNTester.cpp +++ b/paddle/gserver/tests/MKLDNNTester.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/MKLDNNTester.h b/paddle/gserver/tests/MKLDNNTester.h index 9d61533c0b6f20c41130d7b7c15ad93392b2d24c..c1faa6fd90e06d8c742e97c9ce51eeba3c24a550 100644 --- a/paddle/gserver/tests/MKLDNNTester.h +++ b/paddle/gserver/tests/MKLDNNTester.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/img_conv_cudnn.py b/paddle/gserver/tests/img_conv_cudnn.py index 0ea6d6bae66b0a307748bd0d0fa9a53ed5f7927d..fd889ee1ce882e8bf3b1cc9605548d4aadfc4662 100644 --- a/paddle/gserver/tests/img_conv_cudnn.py +++ b/paddle/gserver/tests/img_conv_cudnn.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/img_conv_exconv.py b/paddle/gserver/tests/img_conv_exconv.py index c618cdab27c52d70042b0a118f7f6fe935a6b9d7..5aca6da5acf3320c72bd617241166b2925dcd027 100644 --- a/paddle/gserver/tests/img_conv_exconv.py +++ b/paddle/gserver/tests/img_conv_exconv.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/pyDataProvider.py b/paddle/gserver/tests/pyDataProvider.py index d2ad5888b5a4c79d8b663ce8c2f313184151beb6..85ea90d6eec25eb709b19d06a18c7a955078be04 100644 --- a/paddle/gserver/tests/pyDataProvider.py +++ b/paddle/gserver/tests/pyDataProvider.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/rnn_data_provider.py b/paddle/gserver/tests/rnn_data_provider.py index 063a4127e542d23012359a2eac0045bf69a51356..18b2191f44e3c85a8db767e3ec242d1fbcfb087a 100644 --- a/paddle/gserver/tests/rnn_data_provider.py +++ b/paddle/gserver/tests/rnn_data_provider.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/sequenceGen.py b/paddle/gserver/tests/sequenceGen.py index 04a1732d61c8618984d16550acf7c94da1bd3578..d5ec8ac23f1f4af7178ac432832bc0c5b4c9eb65 100644 --- a/paddle/gserver/tests/sequenceGen.py +++ b/paddle/gserver/tests/sequenceGen.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/sequence_nest_rnn_multi_unequalength_inputs.py b/paddle/gserver/tests/sequence_nest_rnn_multi_unequalength_inputs.py index aeaaa221f9fab981af88cfd63c30349e1b02a0ee..569d3c094b6f5517dad0f1e04f98de12aaef9633 100644 --- a/paddle/gserver/tests/sequence_nest_rnn_multi_unequalength_inputs.py +++ b/paddle/gserver/tests/sequence_nest_rnn_multi_unequalength_inputs.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/sequence_recurrent.py b/paddle/gserver/tests/sequence_recurrent.py index 8786a5465db82d786d3772357b02ab837073a576..b88c09084e1bc167a177b59566e9794ac4d616c7 100644 --- a/paddle/gserver/tests/sequence_recurrent.py +++ b/paddle/gserver/tests/sequence_recurrent.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/sequence_recurrent_group.py b/paddle/gserver/tests/sequence_recurrent_group.py index 8b5a3d49838c9bb49321a9d7514fc0241e6d67cd..0daf746700231d302550004b1c10729e36807b8b 100644 --- a/paddle/gserver/tests/sequence_recurrent_group.py +++ b/paddle/gserver/tests/sequence_recurrent_group.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/sequence_rnn_matched_inputs.py b/paddle/gserver/tests/sequence_rnn_matched_inputs.py index 0c55f2cf9d07b194aa06f88892f831f1a9ce6436..41a581e0ccd59588d1bcce9345056bea9d80b73d 100644 --- a/paddle/gserver/tests/sequence_rnn_matched_inputs.py +++ b/paddle/gserver/tests/sequence_rnn_matched_inputs.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/sequence_rnn_mixed_inputs.py b/paddle/gserver/tests/sequence_rnn_mixed_inputs.py index 22b376b91aa4736d16fead698105466d679dd248..ae89d8e2bb6f672eaf697ae4d24895b89f76544f 100644 --- a/paddle/gserver/tests/sequence_rnn_mixed_inputs.py +++ b/paddle/gserver/tests/sequence_rnn_mixed_inputs.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/sequence_rnn_multi_unequalength_inputs.py b/paddle/gserver/tests/sequence_rnn_multi_unequalength_inputs.py index 3ce87490bbd0f30a3c42b947b073adb2a6c5b51c..6473fb3f3eddc803282911a156c489e4ba39aded 100644 --- a/paddle/gserver/tests/sequence_rnn_multi_unequalength_inputs.py +++ b/paddle/gserver/tests/sequence_rnn_multi_unequalength_inputs.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_ActivationGrad.cpp b/paddle/gserver/tests/test_ActivationGrad.cpp index f4c2a07c4426da36ff0b0570339a3a972dadec1f..b5e4af26dc123be3748adb4faed5fe1656ca44b3 100644 --- a/paddle/gserver/tests/test_ActivationGrad.cpp +++ b/paddle/gserver/tests/test_ActivationGrad.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_BatchNorm.cpp b/paddle/gserver/tests/test_BatchNorm.cpp index 41116f480957153eca33d211d09095903d6a00d9..a3ec66c75829c5ef0ae834656ee82e40be76c892 100644 --- a/paddle/gserver/tests/test_BatchNorm.cpp +++ b/paddle/gserver/tests/test_BatchNorm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_CRFLayerGrad.cpp b/paddle/gserver/tests/test_CRFLayerGrad.cpp index f010066ebc6c33eff17715ba20b4e238583f1966..9f3d2936569af8f1923a471f4d262e9a472649c0 100644 --- a/paddle/gserver/tests/test_CRFLayerGrad.cpp +++ b/paddle/gserver/tests/test_CRFLayerGrad.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_CompareSparse.cpp b/paddle/gserver/tests/test_CompareSparse.cpp index 2495d8b60a56713ba554156d2d9b25e4f6a567d7..2fbc404125a9364ac44a990f8ec92962cf7d1298 100644 --- a/paddle/gserver/tests/test_CompareSparse.cpp +++ b/paddle/gserver/tests/test_CompareSparse.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_CompareTwoNets.cpp b/paddle/gserver/tests/test_CompareTwoNets.cpp index 801d9607565910b1f7f68a9c4532de5877e44f30..1c9b4002a34ca5a9b668be69bd0ad392eb763803 100644 --- a/paddle/gserver/tests/test_CompareTwoNets.cpp +++ b/paddle/gserver/tests/test_CompareTwoNets.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_ConvTrans.cpp b/paddle/gserver/tests/test_ConvTrans.cpp index 5f2f9665478ad4bdfb00421ec57b3ecc1b41b417..2e394a74b7d53fc53727d817c06479d545ade65d 100644 --- a/paddle/gserver/tests/test_ConvTrans.cpp +++ b/paddle/gserver/tests/test_ConvTrans.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_ConvUnify.cpp b/paddle/gserver/tests/test_ConvUnify.cpp index 8634355b5206f5cde0aa0717df50ade39e173ae7..ba820d9a2acabf95ff816705e4df124bb95da077 100644 --- a/paddle/gserver/tests/test_ConvUnify.cpp +++ b/paddle/gserver/tests/test_ConvUnify.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp b/paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp index 477638426fe91f2c5b1f4d5011496385f07c2e90..0041ed30939d1a6111a2db753da6172bb65e374b 100644 --- a/paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp +++ b/paddle/gserver/tests/test_CrossEntropyOverBeamGrad.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_DetectionOutput.cpp b/paddle/gserver/tests/test_DetectionOutput.cpp index dc39c97a87f8b346dc9cc09d6158b1b4069bcf2d..486521426553c76729fa4c287b8fbc5f9c064b61 100644 --- a/paddle/gserver/tests/test_DetectionOutput.cpp +++ b/paddle/gserver/tests/test_DetectionOutput.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_Evaluator.cpp b/paddle/gserver/tests/test_Evaluator.cpp index 62a131171fa5ae973cb3069151a582aaeac9ee0e..4a8843f3affe7b1d4f3172be733aefc085c9e7a5 100644 --- a/paddle/gserver/tests/test_Evaluator.cpp +++ b/paddle/gserver/tests/test_Evaluator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_Expand.cpp b/paddle/gserver/tests/test_Expand.cpp index d32bf0152f77bba098daa508fe448784ac013549..fa1c86d13f4b3d5d9f6e0e5c4442818154134cef 100644 --- a/paddle/gserver/tests/test_Expand.cpp +++ b/paddle/gserver/tests/test_Expand.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_KmaxSeqScore.cpp b/paddle/gserver/tests/test_KmaxSeqScore.cpp index ffe5cfb8dbb55d0b70a5699969abaa101f05f9ce..168ffbdac8cd6fb0ee4fa62e3766905c30d1844b 100644 --- a/paddle/gserver/tests/test_KmaxSeqScore.cpp +++ b/paddle/gserver/tests/test_KmaxSeqScore.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_LayerGrad.cpp b/paddle/gserver/tests/test_LayerGrad.cpp index aab02f16849582db4b41087046b810463a855e1a..1254d580505512dc8fd7e34a053a7538832d271f 100644 --- a/paddle/gserver/tests/test_LayerGrad.cpp +++ b/paddle/gserver/tests/test_LayerGrad.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_LinearChainCRF.cpp b/paddle/gserver/tests/test_LinearChainCRF.cpp index b37277054c58a5f71cc4649fc6c062ca8dc1d4c9..423c31e27d7ca223f1cbff8f030b006d3889f0bb 100644 --- a/paddle/gserver/tests/test_LinearChainCRF.cpp +++ b/paddle/gserver/tests/test_LinearChainCRF.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_MKLDNN.cpp b/paddle/gserver/tests/test_MKLDNN.cpp index ad1dbc3ee2bfd00a94de06f1e1b2ffe64f19b417..a34a3f6206171fb1e0563ab9ef8550bc890359ce 100644 --- a/paddle/gserver/tests/test_MKLDNN.cpp +++ b/paddle/gserver/tests/test_MKLDNN.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_MaxPoolingWithMaskOutput.cpp b/paddle/gserver/tests/test_MaxPoolingWithMaskOutput.cpp index 16438886df94cab9d29d05924bb047e6c7f1f6fa..5188d2abed899a210de66084109034ee381cd078 100644 --- a/paddle/gserver/tests/test_MaxPoolingWithMaskOutput.cpp +++ b/paddle/gserver/tests/test_MaxPoolingWithMaskOutput.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_MultinomialSampler.cpp b/paddle/gserver/tests/test_MultinomialSampler.cpp index eadf40ade091ae8b3e19d7dc6c999288e8e88c1b..4a295ea9d51788f988fe79f8439cc7769f661d8e 100644 --- a/paddle/gserver/tests/test_MultinomialSampler.cpp +++ b/paddle/gserver/tests/test_MultinomialSampler.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_NetworkCompare.cpp b/paddle/gserver/tests/test_NetworkCompare.cpp index 2b92211936aad1a034369bda0830bed3438cf401..fda3f2f7934adde09303f443ca5e8de6a7d077cd 100644 --- a/paddle/gserver/tests/test_NetworkCompare.cpp +++ b/paddle/gserver/tests/test_NetworkCompare.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_PriorBox.cpp b/paddle/gserver/tests/test_PriorBox.cpp index 8dc5568784295b5a2e7d4decd178d612432a1a18..10d512ec45f8b7afaf21eaac98cfc13e84c85efc 100644 --- a/paddle/gserver/tests/test_PriorBox.cpp +++ b/paddle/gserver/tests/test_PriorBox.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_PyDataProvider.cpp b/paddle/gserver/tests/test_PyDataProvider.cpp index fe54799259d86064c4fcaec0e53707247981a1b4..a1dee9795077b835392469b5085e9728679a1664 100644 --- a/paddle/gserver/tests/test_PyDataProvider.cpp +++ b/paddle/gserver/tests/test_PyDataProvider.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_PyDataProvider2.cpp b/paddle/gserver/tests/test_PyDataProvider2.cpp index 7e193eb31a03e6a6b8b0b02e89608a0e02b9e248..b39fb3534509ebde2702c02e35800fe3ed6016c3 100644 --- a/paddle/gserver/tests/test_PyDataProvider2.cpp +++ b/paddle/gserver/tests/test_PyDataProvider2.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_PyDataProvider2.py b/paddle/gserver/tests/test_PyDataProvider2.py index 044aede98e684a432c48b3ea5bb82a4a677682d4..461d80b9e681cabc20b2c44fdf7afa8dc9c9bf5b 100644 --- a/paddle/gserver/tests/test_PyDataProvider2.py +++ b/paddle/gserver/tests/test_PyDataProvider2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_RecurrentGradientMachine.cpp b/paddle/gserver/tests/test_RecurrentGradientMachine.cpp index 6b19eb0ce520a625ac68582d5c1e11c168127dc7..72324fcf29cc60867005da25b35a8075fd590a89 100644 --- a/paddle/gserver/tests/test_RecurrentGradientMachine.cpp +++ b/paddle/gserver/tests/test_RecurrentGradientMachine.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_RecurrentLayer.cpp b/paddle/gserver/tests/test_RecurrentLayer.cpp index 0e130843339a1030f86f4d48891499bac20e9ca2..e5ce922f15749cb18b93f64e0e08f437c5633065 100644 --- a/paddle/gserver/tests/test_RecurrentLayer.cpp +++ b/paddle/gserver/tests/test_RecurrentLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_SelectiveFCLayer.cpp b/paddle/gserver/tests/test_SelectiveFCLayer.cpp index d164e382c4a804aef2417135b64cf709474d12f1..583e3bc545a3b5eb158490a8ccc5ea7060c7c6ab 100644 --- a/paddle/gserver/tests/test_SelectiveFCLayer.cpp +++ b/paddle/gserver/tests/test_SelectiveFCLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_SeqSliceLayerGrad.cpp b/paddle/gserver/tests/test_SeqSliceLayerGrad.cpp index 3dbffc563462973bdc1da529d486b2a2d5a677d3..406ca63b6ee030a0882e05294d8d355d84531385 100644 --- a/paddle/gserver/tests/test_SeqSliceLayerGrad.cpp +++ b/paddle/gserver/tests/test_SeqSliceLayerGrad.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve. +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/gserver/tests/test_WarpCTCLayer.cpp b/paddle/gserver/tests/test_WarpCTCLayer.cpp index da829460061d38f363317e33daeb65cfa705bb8e..f2299d7da2a51e4015793ae531af002aed1f6b2f 100644 --- a/paddle/gserver/tests/test_WarpCTCLayer.cpp +++ b/paddle/gserver/tests/test_WarpCTCLayer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/Allocator.h b/paddle/math/Allocator.h index 17563bf5e1649361b83b896bf864b922296a5487..ae60f6fe5fa142bdffeafc31b5816b8fcc94ad5c 100644 --- a/paddle/math/Allocator.h +++ b/paddle/math/Allocator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/BaseMatrix.cu b/paddle/math/BaseMatrix.cu index e3eff59dc575ee43552e401bc887f885a9804b61..7b57419e5a510ba50aff0b47681d1294607e31f9 100644 --- a/paddle/math/BaseMatrix.cu +++ b/paddle/math/BaseMatrix.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/BaseMatrix.h b/paddle/math/BaseMatrix.h index 12ad2d45a0bbff182e78da6efb3c5ff4c6b59b55..00ce5a19491048f3339d608ac37669816a9ad3f5 100644 --- a/paddle/math/BaseMatrix.h +++ b/paddle/math/BaseMatrix.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/CpuSparseMatrix.cpp b/paddle/math/CpuSparseMatrix.cpp index dc6979cf5a5229fb09866189f28217889d58c2d0..023450ffb794086399d7131ba5faa4dbefeaaf7d 100644 --- a/paddle/math/CpuSparseMatrix.cpp +++ b/paddle/math/CpuSparseMatrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/CpuSparseMatrix.h b/paddle/math/CpuSparseMatrix.h index 522b436a2a69179d3f4f17c919d5ba024102db7b..22b6b71688bd555cf8bf8a29088ad01b092d67cf 100644 --- a/paddle/math/CpuSparseMatrix.h +++ b/paddle/math/CpuSparseMatrix.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/ExecViaCpu.h b/paddle/math/ExecViaCpu.h index 1e03cc5f45a96f20e49482fdfc8eba5c7124fe00..9b2a3c2b8accd384aac896e86ef8315a744633e1 100644 --- a/paddle/math/ExecViaCpu.h +++ b/paddle/math/ExecViaCpu.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MKLDNNMatrix.cpp b/paddle/math/MKLDNNMatrix.cpp index a710479bab82ed52122cf59bb14a05ccbd4aa05c..52036c5f80313cf624bcebb6bd9aded53a78277d 100644 --- a/paddle/math/MKLDNNMatrix.cpp +++ b/paddle/math/MKLDNNMatrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MKLDNNMatrix.h b/paddle/math/MKLDNNMatrix.h index 39d40a1f61609a649d3341c170d24b0604921ac2..e1fb81679adf4658a58ceee73c8d5da6c0b61050 100644 --- a/paddle/math/MKLDNNMatrix.h +++ b/paddle/math/MKLDNNMatrix.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MathFunctions.cpp b/paddle/math/MathFunctions.cpp index 28ab54b450c96b4bdefdf36813595766162b1434..b2ff4bc3232a8e5d5d7b49bf49c62fe756d303f4 100644 --- a/paddle/math/MathFunctions.cpp +++ b/paddle/math/MathFunctions.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MathFunctions.h b/paddle/math/MathFunctions.h index 29fe36e3a4bd5e5d372480950a03142822262d41..f4cf6bd6c2c06f95cda098af389b37b7ff2983eb 100644 --- a/paddle/math/MathFunctions.h +++ b/paddle/math/MathFunctions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MathUtils.cpp b/paddle/math/MathUtils.cpp index 980b6e138873046468f278c2f0b16938be82b81c..b2afdbcd51a3cf5d3e6f3e2bb14902bf78fe68c8 100644 --- a/paddle/math/MathUtils.cpp +++ b/paddle/math/MathUtils.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MathUtils.h b/paddle/math/MathUtils.h index f2b298013877d59e1fa0eca4feb09e4f6608fdf5..597485d9c54a2942134f58d308b387ff0bdf061b 100644 --- a/paddle/math/MathUtils.h +++ b/paddle/math/MathUtils.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/Matrix.cpp b/paddle/math/Matrix.cpp index cc86b12be08ba987f9682ebf3fda56c2f07fb576..35359d4b5a8fb9715317257538a6e2e38fc16b60 100644 --- a/paddle/math/Matrix.cpp +++ b/paddle/math/Matrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/Matrix.h b/paddle/math/Matrix.h index c8e690e6421668bdade4e50a61882c915b2ddc7c..631e69edc1b0f5c4ef4a115d4bd5ea29fc418018 100644 --- a/paddle/math/Matrix.h +++ b/paddle/math/Matrix.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MatrixBitCode.cpp b/paddle/math/MatrixBitCode.cpp index cea912d3ca02715c203814d13529aadfd9d3b7fb..61a9923bc2e6f358738f80de4a30d83c0cc00656 100644 --- a/paddle/math/MatrixBitCode.cpp +++ b/paddle/math/MatrixBitCode.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MemoryHandle.cpp b/paddle/math/MemoryHandle.cpp index 84afb5944c3ea4aa3b8f44646b23d18b2903281b..1563314e92115e9e009b80b934d2fb83f4a7121e 100644 --- a/paddle/math/MemoryHandle.cpp +++ b/paddle/math/MemoryHandle.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/MemoryHandle.h b/paddle/math/MemoryHandle.h index 0828d377c90c9fc93b79078ffed0d0b911b99c04..03ee413c1218376635c4696ebb774c584aa67aa4 100644 --- a/paddle/math/MemoryHandle.h +++ b/paddle/math/MemoryHandle.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/NEONFunctions.cpp b/paddle/math/NEONFunctions.cpp index 0f8314942290a71dd327437b8a6da2d64fe48444..953d5bb8c8148ff15adcac0267419a2e48f76267 100644 --- a/paddle/math/NEONFunctions.cpp +++ b/paddle/math/NEONFunctions.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/NEONFunctions.h b/paddle/math/NEONFunctions.h index d67b2f47a85a963949d23415e4f6881658203bb7..33edd9d518daede1a4416d66639519bde7d03efb 100644 --- a/paddle/math/NEONFunctions.h +++ b/paddle/math/NEONFunctions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/PoolAllocator.cpp b/paddle/math/PoolAllocator.cpp index 4282c7243a801c4116885cfa91d78c635e49ea94..b6ad168856acc1f1e93ea1a000e5dcc670acbdf7 100644 --- a/paddle/math/PoolAllocator.cpp +++ b/paddle/math/PoolAllocator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/PoolAllocator.h b/paddle/math/PoolAllocator.h index c06efa9ac77a5659b242d039c38455e2ee9b0db6..90141fef3fd43fe221874cc50e688f6db9e2dee6 100644 --- a/paddle/math/PoolAllocator.h +++ b/paddle/math/PoolAllocator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/RowBuffer.h b/paddle/math/RowBuffer.h index e457d71f1b357aecae48107688499edd7271a5db..2e4d11a86bf8bd1308b2972f549bc7c201044785 100644 --- a/paddle/math/RowBuffer.h +++ b/paddle/math/RowBuffer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/SIMDFunctions.cpp b/paddle/math/SIMDFunctions.cpp index d66d543a61450b47b7758b50eaecc107c6fe3576..3cfc5d6f1e033e7cbaa0813b4dad443f7ea0ee55 100644 --- a/paddle/math/SIMDFunctions.cpp +++ b/paddle/math/SIMDFunctions.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/SIMDFunctions.h b/paddle/math/SIMDFunctions.h index 76909720f6aef0eea7cdf0dfe618237403d52c99..5b1dfea9d3c088a3fed98a350f1c1e3d865b6ba9 100644 --- a/paddle/math/SIMDFunctions.h +++ b/paddle/math/SIMDFunctions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/SparseMatrix.cpp b/paddle/math/SparseMatrix.cpp index 284b68d590ba655395c0186d8ea86d6855c6fc50..1faa343dbcef3d20b29b272a8da37f8e2bba654b 100644 --- a/paddle/math/SparseMatrix.cpp +++ b/paddle/math/SparseMatrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/SparseMatrix.h b/paddle/math/SparseMatrix.h index e0a3c6d2286521f6030867b747099514a16df5cf..7c525f4edf3d53544c195f8e253c27a03854a793 100644 --- a/paddle/math/SparseMatrix.h +++ b/paddle/math/SparseMatrix.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/SparseRowMatrix.cpp b/paddle/math/SparseRowMatrix.cpp index b086433fe535225ad05453b7d13c3846f5ce3c2b..4254175aabc8c32edb243d4a82c2e34c81393f74 100644 --- a/paddle/math/SparseRowMatrix.cpp +++ b/paddle/math/SparseRowMatrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/SparseRowMatrix.h b/paddle/math/SparseRowMatrix.h index ca7a6806da3a58ad5fffdbb6505319964c25bc6f..3920de32df7de925d6e22e17b93b15bff8785675 100644 --- a/paddle/math/SparseRowMatrix.h +++ b/paddle/math/SparseRowMatrix.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/Storage.cpp b/paddle/math/Storage.cpp index a2ef731ecbcd18ca4bd0b2381de04650a2686c2d..5982bf2e5637ff4b4af6baae47e40b68e0c07c86 100644 --- a/paddle/math/Storage.cpp +++ b/paddle/math/Storage.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/Storage.h b/paddle/math/Storage.h index 06a66b5f14643153f82a1596096fc28d3e47e3fd..ba8f4689a1e896304aa14821b40fc8ff0c304bb2 100644 --- a/paddle/math/Storage.h +++ b/paddle/math/Storage.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/TensorApply.h b/paddle/math/TensorApply.h index 11c7acb44129a3b5bf680a4b5f9ff465d44b0965..7d79cae5a11851b190afbb9ac94efdf2ba2510b7 100644 --- a/paddle/math/TensorApply.h +++ b/paddle/math/TensorApply.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/TensorAssign.h b/paddle/math/TensorAssign.h index 943fb5649e4f1b791ab38479ca61c3fe11fc698e..113d98c16b22b06971040b1a1ce52c696f6c3c14 100644 --- a/paddle/math/TensorAssign.h +++ b/paddle/math/TensorAssign.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/TensorEvaluate.h b/paddle/math/TensorEvaluate.h index 687bad37113b7426ff04ed5b2ad9449da4b88bb9..2a722016e777a131ef14636a6871d29d9b131044 100644 --- a/paddle/math/TensorEvaluate.h +++ b/paddle/math/TensorEvaluate.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/TensorExpression.h b/paddle/math/TensorExpression.h index 6fd60e7f3c65ea8e31fd1aaaa61b6ad8956ff1cd..83229ae65dd1f4ed6b885c3d6195b3758b8ba039 100644 --- a/paddle/math/TensorExpression.h +++ b/paddle/math/TensorExpression.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/TrainingAlgorithmOp.cu b/paddle/math/TrainingAlgorithmOp.cu index fc746b85339de596d5ddc5811a8164094c13f63f..b844768d3b9fd05b5a0eada5e315b9e91588a4ee 100644 --- a/paddle/math/TrainingAlgorithmOp.cu +++ b/paddle/math/TrainingAlgorithmOp.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/TrainingAlgorithmOp.h b/paddle/math/TrainingAlgorithmOp.h index 881a8d72d888083ad87a536c127009d68c51076e..fe40fc2d36e796bd4be7b7fc1e12a6eafa5d4700 100644 --- a/paddle/math/TrainingAlgorithmOp.h +++ b/paddle/math/TrainingAlgorithmOp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/Vector.cpp b/paddle/math/Vector.cpp index 346008439c35a2bcbcd2e9dfd36d689e01d7495f..2a47ed7ef81a2e969757c244370cc346b13e1c03 100644 --- a/paddle/math/Vector.cpp +++ b/paddle/math/Vector.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/Vector.h b/paddle/math/Vector.h index f965a5809209da313c78a545c44e7aa39e95ac65..3efbc769dff5aa1dbc9d5015b0cbac313710d70d 100644 --- a/paddle/math/Vector.h +++ b/paddle/math/Vector.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/CMakeLists.txt b/paddle/math/tests/CMakeLists.txt index dcd2a34583417993a4bf2976f7a3bc5a10d496ac..d8b7f9e3fc74040189ade83049e4a1c3348e08de 100644 --- a/paddle/math/tests/CMakeLists.txt +++ b/paddle/math/tests/CMakeLists.txt @@ -22,7 +22,6 @@ if(WITH_GPU) link_paddle_test(test_Tensor) CUDA_ADD_EXECUTABLE(test_lazyAssign test_lazyAssign.cu) link_paddle_test(test_lazyAssign) - nv_test(test_float16_gpu SRCS test_float16.cu) else() compile_cu_as_cpp(test_Tensor.cu) add_unittest(test_Tensor test_Tensor.cu) @@ -34,4 +33,3 @@ add_simple_unittest(test_FPException) add_simple_unittest(test_GpuProfiler) add_simple_unittest(test_BaseMatrix) add_simple_unittest(test_Matrix) -add_simple_unittest(test_float16) diff --git a/paddle/math/tests/OriginalOptimizerApi.h b/paddle/math/tests/OriginalOptimizerApi.h index 0188372771d97942a0761c673d40d040528ff59a..e30d784b232dd7d477877d3f7c90cd185357328c 100644 --- a/paddle/math/tests/OriginalOptimizerApi.h +++ b/paddle/math/tests/OriginalOptimizerApi.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/PerfUtils.h b/paddle/math/tests/PerfUtils.h index 9c6a63ce6c03c0db993d4bb52fe536e82ba2d726..bee2351e2fb80f9ccef670535c92485389f0c51a 100644 --- a/paddle/math/tests/PerfUtils.h +++ b/paddle/math/tests/PerfUtils.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/TensorCheck.h b/paddle/math/tests/TensorCheck.h index b998e5772e70d0a0ec79dc4064dcbaa2c302efd2..f4332ede36356bc666612a240448c1be71e5170e 100644 --- a/paddle/math/tests/TensorCheck.h +++ b/paddle/math/tests/TensorCheck.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/TestUtils.h b/paddle/math/tests/TestUtils.h index 713f407f496099c04e5834b2bdcf7b1cf5a86a3a..d2b9706432f84fa082e071eb09d2ffe7402a085f 100644 --- a/paddle/math/tests/TestUtils.h +++ b/paddle/math/tests/TestUtils.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_Allocator.cpp b/paddle/math/tests/test_Allocator.cpp index 1fecf659e5080c7d25f5f76b92b15f75eaab6ce3..84bc1c1d9e0a8368a69c1e53a63056eb45b9239f 100644 --- a/paddle/math/tests/test_Allocator.cpp +++ b/paddle/math/tests/test_Allocator.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_BaseMatrix.cpp b/paddle/math/tests/test_BaseMatrix.cpp index 1766257860b0b13e9f0ce898438e7c2d644f545e..6f7beb60c8f535d51b18c4984b89d1972f4c82bd 100644 --- a/paddle/math/tests/test_BaseMatrix.cpp +++ b/paddle/math/tests/test_BaseMatrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_CpuGpuVector.cpp b/paddle/math/tests/test_CpuGpuVector.cpp index c72f89c8244b1209e490b09387c2ee6352426ce1..395541a76ae5e5497fdaa8b4870e421cbf62608a 100644 --- a/paddle/math/tests/test_CpuGpuVector.cpp +++ b/paddle/math/tests/test_CpuGpuVector.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_ExecViaCpu.cpp b/paddle/math/tests/test_ExecViaCpu.cpp index 25e0ba11ded96dd78aedc3c297507d0555d80d74..513c7b440e0aa6f20cc8209a3624f32f4892225b 100644 --- a/paddle/math/tests/test_ExecViaCpu.cpp +++ b/paddle/math/tests/test_ExecViaCpu.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_FPException.cpp b/paddle/math/tests/test_FPException.cpp index 3836f7fc0fe577c463c9a476d49b21f2967043e5..d87fdcda9edc8644301b7fe77f4c0c751d5a774a 100644 --- a/paddle/math/tests/test_FPException.cpp +++ b/paddle/math/tests/test_FPException.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_GpuProfiler.cpp b/paddle/math/tests/test_GpuProfiler.cpp index d9f146f0d1f63480ddee784071b43ff85da0b15c..828159660bae1ad1c0b56fd7202f0357549877ca 100644 --- a/paddle/math/tests/test_GpuProfiler.cpp +++ b/paddle/math/tests/test_GpuProfiler.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_Matrix.cpp b/paddle/math/tests/test_Matrix.cpp index 2f99fa3581e14b91acc0b294856619f4ae2b3483..a9407a31f334a1bea0293ad772229dafc6705936 100644 --- a/paddle/math/tests/test_Matrix.cpp +++ b/paddle/math/tests/test_Matrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_RowBuffer.cpp b/paddle/math/tests/test_RowBuffer.cpp index 8cc4c69a1a4d8afec08bf7fb13408e135a06c09c..e38de853e03874be3fd3582f7b39b1d490886d78 100644 --- a/paddle/math/tests/test_RowBuffer.cpp +++ b/paddle/math/tests/test_RowBuffer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_SIMDFunctions.cpp b/paddle/math/tests/test_SIMDFunctions.cpp index e8f9b26ff240f9c339404a919c14eb3e3704c1de..b692679436ee7bd3b8c4a675e969e15b065cc534 100644 --- a/paddle/math/tests/test_SIMDFunctions.cpp +++ b/paddle/math/tests/test_SIMDFunctions.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_SparseMatrix.cpp b/paddle/math/tests/test_SparseMatrix.cpp index 8abbe8d82e02b7d1738fe7e6d0c8d494166e7892..dbcbeb8d506cf22c026bb7299bf7f71de488cb4a 100644 --- a/paddle/math/tests/test_SparseMatrix.cpp +++ b/paddle/math/tests/test_SparseMatrix.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_Tensor.cu b/paddle/math/tests/test_Tensor.cu index d03698dee25fdd6dd49f2a3fdb5c605333440f49..acb2da86d0f41d12fced97d1ddaf5be00959fb82 100644 --- a/paddle/math/tests/test_Tensor.cu +++ b/paddle/math/tests/test_Tensor.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_TrainingAlgorithm.cpp b/paddle/math/tests/test_TrainingAlgorithm.cpp index 5ae0aa036f6bfc1e5bd4e955277c4efff8c739ce..fb146176ca8eb97a9cdbaf9ebd5c4997a8439718 100644 --- a/paddle/math/tests/test_TrainingAlgorithm.cpp +++ b/paddle/math/tests/test_TrainingAlgorithm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_batchTranspose.cpp b/paddle/math/tests/test_batchTranspose.cpp index b70a61976402fd0a7cfee8382fd926fcf28486d5..ccfd6d5aae212fdc574456682b50bc19ae81714e 100644 --- a/paddle/math/tests/test_batchTranspose.cpp +++ b/paddle/math/tests/test_batchTranspose.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_lazyAssign.cu b/paddle/math/tests/test_lazyAssign.cu index 04f23cff55db45c39049538545430bc5996cce5d..cbd74bbfe33270f351632b58d7e89f8e60d15b83 100644 --- a/paddle/math/tests/test_lazyAssign.cu +++ b/paddle/math/tests/test_lazyAssign.cu @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_matrixCompare.cpp b/paddle/math/tests/test_matrixCompare.cpp index afb8d9d599b15a0b6d19b7ecca5e91b623695dea..e45ddd433faf18dbcd647b305db3a36d38c90825 100644 --- a/paddle/math/tests/test_matrixCompare.cpp +++ b/paddle/math/tests/test_matrixCompare.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_matrixUtil.h b/paddle/math/tests/test_matrixUtil.h index 47f461474622d13ea2f922a77348c78b450ec37f..86297547dcd83ca87d1c87a8489f7af2f3e9f492 100644 --- a/paddle/math/tests/test_matrixUtil.h +++ b/paddle/math/tests/test_matrixUtil.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_perturbation.cpp b/paddle/math/tests/test_perturbation.cpp index c7c07c817a08d78ddcbf8218e8c4a9d22f4990bc..ef99dab60a874846d04c5ce07d38b2857640ad7b 100644 --- a/paddle/math/tests/test_perturbation.cpp +++ b/paddle/math/tests/test_perturbation.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/math/tests/test_sparseMatrixCompare.cpp b/paddle/math/tests/test_sparseMatrixCompare.cpp index 2b2a391b9d04a9f7fa4986a6b6dd5cd8e5385f1f..12647d21a29936e169b893ec8119b64fec9af580 100644 --- a/paddle/math/tests/test_sparseMatrixCompare.cpp +++ b/paddle/math/tests/test_sparseMatrixCompare.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/adadelta_optimizer.cc b/paddle/optimizer/adadelta_optimizer.cc index 8ca048257e53af21f327ee1b8f24b9e2e5d54060..1faeb0cd31e4a748331d5c5c3569df89bcdd4600 100644 --- a/paddle/optimizer/adadelta_optimizer.cc +++ b/paddle/optimizer/adadelta_optimizer.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/adadelta_optimizer.h b/paddle/optimizer/adadelta_optimizer.h index 48f1ae175041cc1cfa11787c44317dd173430928..74df9d54be734fedec8aeddff5f50b1d1aefb1d3 100644 --- a/paddle/optimizer/adadelta_optimizer.h +++ b/paddle/optimizer/adadelta_optimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/adagrad_optimizer.cc b/paddle/optimizer/adagrad_optimizer.cc index c6d39a366adcd40e7298e1f1bed48c15f517a217..5ac65dbd72092679575edf5e2eb357c0f6609e34 100644 --- a/paddle/optimizer/adagrad_optimizer.cc +++ b/paddle/optimizer/adagrad_optimizer.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/adagrad_optimizer.h b/paddle/optimizer/adagrad_optimizer.h index b0cff061f5c311d2356bab4965ec65c5eca3dbb8..1d58402d78ff9ada8b084a472d46c96580d01e5b 100644 --- a/paddle/optimizer/adagrad_optimizer.h +++ b/paddle/optimizer/adagrad_optimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/adam_optimizer.cc b/paddle/optimizer/adam_optimizer.cc index 8a384b59c47df321438e3a3bc245a2398a7ef6d1..9a4ff5ecc0f93c06b20dfd91d4fbcf6e81fa066c 100644 --- a/paddle/optimizer/adam_optimizer.cc +++ b/paddle/optimizer/adam_optimizer.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/adam_optimizer.h b/paddle/optimizer/adam_optimizer.h index 7df40064df31536cead9eba4ce827452cf0dce38..7977226c8602745d5733021a51fc03d932b0921a 100644 --- a/paddle/optimizer/adam_optimizer.h +++ b/paddle/optimizer/adam_optimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/lr_policy.h b/paddle/optimizer/lr_policy.h index 9a44a776f2b032bc2c3452a739caf0994e25891b..14422d1f42fc45d5e9a560c45259d4003a0b3d11 100644 --- a/paddle/optimizer/lr_policy.h +++ b/paddle/optimizer/lr_policy.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/optimizer.cc b/paddle/optimizer/optimizer.cc index 3af44484363654befe85c8511d7c0791d5a33ab8..e583aebd77a07b770bc6726393836c212e3f02fc 100644 --- a/paddle/optimizer/optimizer.cc +++ b/paddle/optimizer/optimizer.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/optimizer.h b/paddle/optimizer/optimizer.h index 516e612167f557f043d3fe29789bec4b73405755..c079de921fa1f77dca0b2c3da85decf67d627034 100644 --- a/paddle/optimizer/optimizer.h +++ b/paddle/optimizer/optimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/parameter_optimizer.cc b/paddle/optimizer/parameter_optimizer.cc index 1603e5fdc8a69d8b117f02b9c950a5374625c632..f9474b315d519037be4beea2c6011d9e8366e0b1 100644 --- a/paddle/optimizer/parameter_optimizer.cc +++ b/paddle/optimizer/parameter_optimizer.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/parameter_optimizer.h b/paddle/optimizer/parameter_optimizer.h index 1f501c49e1d7a8018f3274ae1128ca230b9298bb..c7cf8db3ee05c75c171b68bcbcb06a5ae8fa5b48 100644 --- a/paddle/optimizer/parameter_optimizer.h +++ b/paddle/optimizer/parameter_optimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/parameter_optimizer_test.cc b/paddle/optimizer/parameter_optimizer_test.cc index 2bcfca55cc5c9720f16e715dd85bf15c6f2efbbe..d663e2fd007febd3b9f0f43d213d63d2b20656b8 100644 --- a/paddle/optimizer/parameter_optimizer_test.cc +++ b/paddle/optimizer/parameter_optimizer_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/serialization.h b/paddle/optimizer/serialization.h index 98548ddb7aa22558c83aff7454834caa89017388..bf12eed15f0190b8e856163c68690f3f6eef9a12 100644 --- a/paddle/optimizer/serialization.h +++ b/paddle/optimizer/serialization.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/serialization_test.cc b/paddle/optimizer/serialization_test.cc index 25a8f5d351e3e85ab5d8dee8b639d962f8fc9990..93ee1f492f06d45614822cfa6acb41c962426df1 100644 --- a/paddle/optimizer/serialization_test.cc +++ b/paddle/optimizer/serialization_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/sgd_optimizer.cc b/paddle/optimizer/sgd_optimizer.cc index ee80f543fc4c1d87ba56540fc581816df8a39793..c1e2064de75f1c1be0503a4425fe4a691071731b 100644 --- a/paddle/optimizer/sgd_optimizer.cc +++ b/paddle/optimizer/sgd_optimizer.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/sgd_optimizer.h b/paddle/optimizer/sgd_optimizer.h index 16a4df9973ef6a599a8ecee6be5903f13799771c..f504d98adb8a01fd69ff313075b4c417222c765e 100644 --- a/paddle/optimizer/sgd_optimizer.h +++ b/paddle/optimizer/sgd_optimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/optimizer/tensor.h b/paddle/optimizer/tensor.h index e999e9bda129a85306f73afc75f3936fefb4c006..fd32398a237e7e08a198707347cd3c0a4ed77bb3 100644 --- a/paddle/optimizer/tensor.h +++ b/paddle/optimizer/tensor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/paddle/parameter/Argument.cpp b/paddle/parameter/Argument.cpp index 8dbef0b22e7b2f14c62586f86e686356b6e9c68e..cfdaf8998b04e0307bc442dec0df734452634c67 100644 --- a/paddle/parameter/Argument.cpp +++ b/paddle/parameter/Argument.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/Argument.h b/paddle/parameter/Argument.h index 7b59199dded5b3f5d030e389d8bfcac1668fd127..e580d38216b699360fb30f135be8052ab56abf66 100644 --- a/paddle/parameter/Argument.h +++ b/paddle/parameter/Argument.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/paddle/parameter/AverageOptimizer.cpp b/paddle/parameter/AverageOptimizer.cpp index e51ca5652090e6fba5e2070fc8f8c1d10e9ecc7a..75998d81dd9c8be35fe45e903dc1cd69068f83c6 100644 --- a/paddle/parameter/AverageOptimizer.cpp +++ b/paddle/parameter/AverageOptimizer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/AverageOptimizer.h b/paddle/parameter/AverageOptimizer.h index 9fd3f75baa6dd54620e7e7a93f14deb598999cf4..4ad3c18d56abf16d1274c5b3b8e0347b85e64dea 100644 --- a/paddle/parameter/AverageOptimizer.h +++ b/paddle/parameter/AverageOptimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/FirstOrderOptimizer.cpp b/paddle/parameter/FirstOrderOptimizer.cpp index 5938b2210c7174c9a0ce659220825b74af007db5..5e280bcac3389179181d2eda58c08e579e867ecc 100644 --- a/paddle/parameter/FirstOrderOptimizer.cpp +++ b/paddle/parameter/FirstOrderOptimizer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/FirstOrderOptimizer.h b/paddle/parameter/FirstOrderOptimizer.h index 5b0c52a30dfbc34f0db4a03366e31da54b86c9fc..047989fcad52afc1d4d4c347258d0fb2f069f3d4 100644 --- a/paddle/parameter/FirstOrderOptimizer.h +++ b/paddle/parameter/FirstOrderOptimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/LearningRateScheduler.cpp b/paddle/parameter/LearningRateScheduler.cpp index 66448b2c5f6f440c3a7fdec2bd552d8dc7d0927f..b6b58e3ddad6a0e8811bf56502c3f2f0c8728f5c 100644 --- a/paddle/parameter/LearningRateScheduler.cpp +++ b/paddle/parameter/LearningRateScheduler.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/LearningRateScheduler.h b/paddle/parameter/LearningRateScheduler.h index 53b9dba446e1c5908c1b990b026e6fbd4d8fd260..aea99a1c204b46e937135cbde22360a12d087ae2 100644 --- a/paddle/parameter/LearningRateScheduler.h +++ b/paddle/parameter/LearningRateScheduler.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/OptimizerFunctions.cpp b/paddle/parameter/OptimizerFunctions.cpp index a4af1b470585937827305100e3fbf603e67c8241..b7f920b89ccc7d024079ac504819c10703eb550d 100644 --- a/paddle/parameter/OptimizerFunctions.cpp +++ b/paddle/parameter/OptimizerFunctions.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/OptimizerFunctions.h b/paddle/parameter/OptimizerFunctions.h index 4f7370b6baf2b92469e73d54ecb25a23d73c3506..57f6fc9d40ec8e9d245a9d4b0835e16157ab0aae 100644 --- a/paddle/parameter/OptimizerFunctions.h +++ b/paddle/parameter/OptimizerFunctions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/OptimizerWithRegularizer.cpp b/paddle/parameter/OptimizerWithRegularizer.cpp index 7910b12444938a0555c211bb3dfd0f4209e480ec..9e914ae4ecebe23d0b19640a6d1cc86421f38df7 100644 --- a/paddle/parameter/OptimizerWithRegularizer.cpp +++ b/paddle/parameter/OptimizerWithRegularizer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/OptimizerWithRegularizer.h b/paddle/parameter/OptimizerWithRegularizer.h index 0e1c444d280886866c3b153988b1887a43c161c6..7219d96d924dfa26d3ab52b8c6a2ce1249e4f45c 100644 --- a/paddle/parameter/OptimizerWithRegularizer.h +++ b/paddle/parameter/OptimizerWithRegularizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/Parameter.cpp b/paddle/parameter/Parameter.cpp index 3b0f09cea6eb34915f21b11fcea6028821a8c3ff..0e6ea90f3d582e843c62bda000313eb71289d5b4 100644 --- a/paddle/parameter/Parameter.cpp +++ b/paddle/parameter/Parameter.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/Parameter.h b/paddle/parameter/Parameter.h index 04f12efaac15a21ef54ae71074b6d474e2b66c04..24ac10f3fe5977553332a9a8402d6795577b5ad8 100644 --- a/paddle/parameter/Parameter.h +++ b/paddle/parameter/Parameter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ParameterOptimizer.cpp b/paddle/parameter/ParameterOptimizer.cpp index 7c8c6978e22c0e3cb3a3bdf8a7709a091cc2292b..638daa58f1e5f3f416d7f90ad2662a523eaf6741 100644 --- a/paddle/parameter/ParameterOptimizer.cpp +++ b/paddle/parameter/ParameterOptimizer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ParameterOptimizer.h b/paddle/parameter/ParameterOptimizer.h index f98ba569b569379b30d034739a7f84aaf97108db..a8d0ca72f21d04e0e65a9dd6a07e8f53b23e4223 100644 --- a/paddle/parameter/ParameterOptimizer.h +++ b/paddle/parameter/ParameterOptimizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ParameterUpdateFunctions.cpp b/paddle/parameter/ParameterUpdateFunctions.cpp index d60cb363830ff26a1f5054fb4cebf37afdfd1d03..db1153c2d6430e453d776b92b63152c311771668 100644 --- a/paddle/parameter/ParameterUpdateFunctions.cpp +++ b/paddle/parameter/ParameterUpdateFunctions.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ParameterUpdateFunctions.h b/paddle/parameter/ParameterUpdateFunctions.h index 0fca280149c30f0241ec988dfd6719a5519808f4..7434baa2d3d6297cc6d8d99b46cff516d6ac49f9 100644 --- a/paddle/parameter/ParameterUpdateFunctions.h +++ b/paddle/parameter/ParameterUpdateFunctions.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ParameterUpdaterBase.cpp b/paddle/parameter/ParameterUpdaterBase.cpp index 458cae886a440a2949d379a507de73192abc47a7..7815856b45d93406597b332469de1c57a7781da5 100644 --- a/paddle/parameter/ParameterUpdaterBase.cpp +++ b/paddle/parameter/ParameterUpdaterBase.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ParameterUpdaterBase.h b/paddle/parameter/ParameterUpdaterBase.h index 6265c828a1a254d01dc975b0155e7ac69df49a31..717e1c6721b6e4d3ff81172eb06213677c3bff98 100644 --- a/paddle/parameter/ParameterUpdaterBase.h +++ b/paddle/parameter/ParameterUpdaterBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ParameterUpdaterHook.cpp b/paddle/parameter/ParameterUpdaterHook.cpp index c8b47687f5d3c00f6609b858103a5fec526b970a..e6aec3c34820764b3515f47f13a432961de1a673 100644 --- a/paddle/parameter/ParameterUpdaterHook.cpp +++ b/paddle/parameter/ParameterUpdaterHook.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ParameterUpdaterHook.h b/paddle/parameter/ParameterUpdaterHook.h index 1f4506441da725e13ed2b0f339e6e2f5f30bcc6a..d30530ec393c097bf77e5e376e3c4dc84b321ed8 100644 --- a/paddle/parameter/ParameterUpdaterHook.h +++ b/paddle/parameter/ParameterUpdaterHook.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/Regularizer.cpp b/paddle/parameter/Regularizer.cpp index 8511900150363a2247d508833eeb42b2d87beec1..d223fd2df679af1e983e84f48a4d3b0715ce1569 100644 --- a/paddle/parameter/Regularizer.cpp +++ b/paddle/parameter/Regularizer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/Regularizer.h b/paddle/parameter/Regularizer.h index 6d5477309812da4dda4bb7a4a869a2fde7f6bcf0..6bed7b0ddfe7b72c697af60f5243f9037999d54a 100644 --- a/paddle/parameter/Regularizer.h +++ b/paddle/parameter/Regularizer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ThreadLocalBuffer.cpp b/paddle/parameter/ThreadLocalBuffer.cpp index b21dd15245cf7c3d0418d37e6e8925c9e906f482..550e41dfdaab98d3710a1141709206132ebecdce 100644 --- a/paddle/parameter/ThreadLocalBuffer.cpp +++ b/paddle/parameter/ThreadLocalBuffer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/ThreadLocalBuffer.h b/paddle/parameter/ThreadLocalBuffer.h index c916519c974a5bdeea407dcc1bc6d196756874ee..07c96e59d0bc0a58ce9956a54e7de359896e5618 100644 --- a/paddle/parameter/ThreadLocalBuffer.h +++ b/paddle/parameter/ThreadLocalBuffer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/Weight.cpp b/paddle/parameter/Weight.cpp index 3738a58d7f84081db9b6179cef9361322553a627..ba4ddce69fb9c2ad0fa937efca5ba470247978e4 100644 --- a/paddle/parameter/Weight.cpp +++ b/paddle/parameter/Weight.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/Weight.h b/paddle/parameter/Weight.h index 6e7a49154e87b89929cea066872c282f9410e776..7314c29d0db92db06d5b921c09de39d3b0029ef3 100644 --- a/paddle/parameter/Weight.h +++ b/paddle/parameter/Weight.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/tests/test_argument.cpp b/paddle/parameter/tests/test_argument.cpp index 19df6ea95745609a4eb7487d422e61d2f0b269cc..54ceb3e08714e37abb5d491c8973bee631b993be 100644 --- a/paddle/parameter/tests/test_argument.cpp +++ b/paddle/parameter/tests/test_argument.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/parameter/tests/test_common.cpp b/paddle/parameter/tests/test_common.cpp index 64d204aea10c8a7905d90fac6ebccde3c9da1edc..6e10becabbbbb8861095fed5aab9ac1e05bcac91 100644 --- a/paddle/parameter/tests/test_common.cpp +++ b/paddle/parameter/tests/test_common.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/BaseClient.cpp b/paddle/pserver/BaseClient.cpp index 0e031a7e20cbc975f0dc368fb1523c1f63d8646b..a6204ef47ea553246ddadbb2eae6cc714cafe594 100644 --- a/paddle/pserver/BaseClient.cpp +++ b/paddle/pserver/BaseClient.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/BaseClient.h b/paddle/pserver/BaseClient.h index 667bc451d16aa1436ac5d74dd96edbd70556edd0..a932d34712f56de1cbbf84a9db4476f862febca0 100644 --- a/paddle/pserver/BaseClient.h +++ b/paddle/pserver/BaseClient.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/LightNetwork.cpp b/paddle/pserver/LightNetwork.cpp index 0e8e5a83a47bee3436450e6bf7db5e26dc037016..4c0da2217e880b7509ea5f42da5ac7ffe93a53ec 100644 --- a/paddle/pserver/LightNetwork.cpp +++ b/paddle/pserver/LightNetwork.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/LightNetwork.h b/paddle/pserver/LightNetwork.h index c4a06deb940e8f39af2fcb6de54de1b6cb2d1483..2aaa26a5c708f9c01f006136619f599bcfe0db71 100644 --- a/paddle/pserver/LightNetwork.h +++ b/paddle/pserver/LightNetwork.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ParameterClient2.cpp b/paddle/pserver/ParameterClient2.cpp index 9562c649867a8f82f0262a049398b2f17026a983..43e4902b0f0f73840624041f19ba7f4eb9a45844 100644 --- a/paddle/pserver/ParameterClient2.cpp +++ b/paddle/pserver/ParameterClient2.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ParameterClient2.h b/paddle/pserver/ParameterClient2.h index 29b9eeacddf2945dd22b7b17fc87c7c74b868896..d63273ccbc8ed30d9df50d9f8b1a4d1e4fba6720 100644 --- a/paddle/pserver/ParameterClient2.h +++ b/paddle/pserver/ParameterClient2.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ParameterServer2.cpp b/paddle/pserver/ParameterServer2.cpp index 54f5c4c0fb4994871edc7a1e52237c9f903ce63b..f8814714c29a9776adde6a979a84241f733f65bd 100644 --- a/paddle/pserver/ParameterServer2.cpp +++ b/paddle/pserver/ParameterServer2.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ParameterServer2.h b/paddle/pserver/ParameterServer2.h index f7d3587b88c4ab1d4e37a259c622fc7c2d5532a3..3ed06b6b045802bcfd48bcff6bd0c1b34e9bbb86 100644 --- a/paddle/pserver/ParameterServer2.h +++ b/paddle/pserver/ParameterServer2.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ParameterServer2Main.cpp b/paddle/pserver/ParameterServer2Main.cpp index 845a2c27e242cfbe31679fea6eae13d2b400ec81..dfbae0cd0f58faa58d9c7110050144226affdfed 100644 --- a/paddle/pserver/ParameterServer2Main.cpp +++ b/paddle/pserver/ParameterServer2Main.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ParameterServerController.cpp b/paddle/pserver/ParameterServerController.cpp index 1d11a2e1acbc0f091901f3854ca99490d89ebe36..2a7dcc15aa63e39704a523202d3559765b709702 100644 --- a/paddle/pserver/ParameterServerController.cpp +++ b/paddle/pserver/ParameterServerController.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ParameterServerController.h b/paddle/pserver/ParameterServerController.h index fe9bb0b4d02339d0d31d5bc2942932e1f876098b..3a9bc74edf240a12fe1f7bd266f0311555349311 100644 --- a/paddle/pserver/ParameterServerController.h +++ b/paddle/pserver/ParameterServerController.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ProtoServer.cpp b/paddle/pserver/ProtoServer.cpp index 410317ece28ec79dd668e91ff9fbed11f20a5acc..6b7948a7d0aba262360b201690b53b58be87be08 100644 --- a/paddle/pserver/ProtoServer.cpp +++ b/paddle/pserver/ProtoServer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/ProtoServer.h b/paddle/pserver/ProtoServer.h index 3acdcc27dab532f964dc97636be020138180e780..3f78799dbfe1d4b80249e8cb27f269e6358903dd 100644 --- a/paddle/pserver/ProtoServer.h +++ b/paddle/pserver/ProtoServer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/RDMANetwork.h b/paddle/pserver/RDMANetwork.h index caef65134bf798851c0b826f7cc8bf2ab64b3f58..83db6b9df71274c3a8eb3403457877b68f2b6dea 100644 --- a/paddle/pserver/RDMANetwork.h +++ b/paddle/pserver/RDMANetwork.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/SocketChannel.cpp b/paddle/pserver/SocketChannel.cpp index 12e3bc6552fcf26d8ccb32ca43d23142e3aba8e0..72e6943408a1856db214262ff0b0698a2eb89a91 100644 --- a/paddle/pserver/SocketChannel.cpp +++ b/paddle/pserver/SocketChannel.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/SocketChannel.h b/paddle/pserver/SocketChannel.h index 6c3dd20d7be60a53bfcf443d22888109ff9e3935..c0f30d0db760045a8c0cb001fcadaae8f0c03f9d 100644 --- a/paddle/pserver/SocketChannel.h +++ b/paddle/pserver/SocketChannel.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/SparseParameterDistribution.cpp b/paddle/pserver/SparseParameterDistribution.cpp index 6dd725db30cd6d50539d1b2b30ab9e42a081c7b3..bb247f389cc26b32ff79d36bdf5c81ba8591dc58 100644 --- a/paddle/pserver/SparseParameterDistribution.cpp +++ b/paddle/pserver/SparseParameterDistribution.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/SparseParameterDistribution.h b/paddle/pserver/SparseParameterDistribution.h index 24b14106cf64060afa61ecede9e981301ea5634a..13f199548d56262e77e91e45052f3e435dea407c 100644 --- a/paddle/pserver/SparseParameterDistribution.h +++ b/paddle/pserver/SparseParameterDistribution.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/test/SocketTest.cpp b/paddle/pserver/test/SocketTest.cpp index b43461d61bab21747e85090bbf7af21a87a670c6..6019dccaadf7fab5a1db7183c07cbbd9562dab2e 100644 --- a/paddle/pserver/test/SocketTest.cpp +++ b/paddle/pserver/test/SocketTest.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/test/test_ParameterServer2.cpp b/paddle/pserver/test/test_ParameterServer2.cpp index 8e7231a9e1aee7b61f8dfa42f1367b79fee81a2b..e742cd0871da865e02a60a125a936eea8f15e575 100644 --- a/paddle/pserver/test/test_ParameterServer2.cpp +++ b/paddle/pserver/test/test_ParameterServer2.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/pserver/test/test_ProtoServer.cpp b/paddle/pserver/test/test_ProtoServer.cpp index ad8ffed9c1c8e4bdef27689ab21950db6b5cf0a2..d68a8d2180cc3081346106132799498f6dc3fa20 100644 --- a/paddle/pserver/test/test_ProtoServer.cpp +++ b/paddle/pserver/test/test_ProtoServer.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/paddle/scripts/cluster_train_v2/openmpi/start_mpi_train.sh b/paddle/scripts/cluster_train_v2/openmpi/start_mpi_train.sh index c645495448f9844de5ae9024b6a0f41452522765..2a7f46362749a68c341635bec1b34e72e3b86686 100644 --- a/paddle/scripts/cluster_train_v2/openmpi/start_mpi_train.sh +++ b/paddle/scripts/cluster_train_v2/openmpi/start_mpi_train.sh @@ -15,10 +15,14 @@ PADDLE_CLUSTER_TRAIN=True env # start pserver -stdbuf -oL nohup paddle pserver --port=$PADDLE_INIT_PORT --ports_num=$PADDLE_INIT_PORTS_NUM \ - --ports_num_for_sparse=$PADDLE_INIT_PORTS_NUM_FOR_SPARSE --nics=$NICS \ +stdbuf -oL nohup paddle pserver \ + --port=$PADDLE_INIT_PORT \ + --ports_num=$PADDLE_INIT_PORTS_NUM \ + --ports_num_for_sparse=$PADDLE_INIT_PORTS_NUM_FOR_SPARSE \ + --nics=$NICS \ --comment=paddle_cluster_pserver \ - --num_gradient_servers=$PADDLE_INIT_NUM_GRADIENT_SERVERS &> logs/pserver.log & + --num_gradient_servers=$PADDLE_INIT_NUM_GRADIENT_SERVERS \ + &> logs/pserver.log & # start trainer # NOTE: train.py will use the above environment variables as configuration diff --git a/paddle/scripts/docker/build.sh b/paddle/scripts/docker/build.sh index 442a7ea883052e73a5d50d5558f57732be93fb3a..8ec3d0c657400165c2225238f21facfb6c84df7c 100644 --- a/paddle/scripts/docker/build.sh +++ b/paddle/scripts/docker/build.sh @@ -34,6 +34,7 @@ function cmake_gen() { Configuring cmake in /paddle/build ... -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} ${PYTHON_FLAGS} + -DWITH_DSO=ON -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU:-OFF} -DWITH_DISTRIBUTE=${WITH_DISTRIBUTE:-OFF} @@ -57,6 +58,7 @@ EOF cmake .. \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} \ ${PYTHON_FLAGS} \ + -DWITH_DSO=ON \ -DWITH_DOC=OFF \ -DWITH_GPU=${WITH_GPU:-OFF} \ -DWITH_DISTRIBUTE=${WITH_DISTRIBUTE:-OFF} \ @@ -169,9 +171,9 @@ EOF EOF if [[ ${WITH_GPU} == "ON" ]]; then - NCCL_DEPS="apt-get install -y libnccl-dev &&" + NCCL_DEPS="apt-get install -y libnccl2=2.1.2-1+cuda8.0 libnccl-dev=2.1.2-1+cuda8.0 &&" else - NCCL_DEPS="" + NCCL_DEPS="" fi cat >> /paddle/build/Dockerfile < ${PADDLE_SOURCE_DIR}/python/paddle/v2/fluid/core.so +add_custom_command(OUTPUT ${PADDLE_SOURCE_DIR}/python/paddle/fluid/core.so + COMMAND cmake -E copy $ ${PADDLE_SOURCE_DIR}/python/paddle/fluid/core.so DEPENDS paddle_pybind) -add_custom_target(copy_paddle_pybind ALL DEPENDS ${PADDLE_SOURCE_DIR}/python/paddle/v2/fluid/core.so) +add_custom_target(copy_paddle_pybind ALL DEPENDS ${PADDLE_SOURCE_DIR}/python/paddle/fluid/core.so) add_custom_command(OUTPUT ${PADDLE_PYTHON_BUILD_DIR}/.timestamp @@ -72,7 +74,7 @@ if (WITH_TESTING) add_subdirectory(paddle/v2/tests) add_subdirectory(paddle/v2/reader/tests) add_subdirectory(paddle/v2/plot/tests) - add_subdirectory(paddle/v2/fluid/tests) + add_subdirectory(paddle/fluid/tests) endif() endif() install(DIRECTORY ${PADDLE_PYTHON_PACKAGE_DIR} diff --git a/python/paddle/v2/fluid/.gitignore b/python/paddle/fluid/.gitignore similarity index 100% rename from python/paddle/v2/fluid/.gitignore rename to python/paddle/fluid/.gitignore diff --git a/python/paddle/v2/fluid/__init__.py b/python/paddle/fluid/__init__.py similarity index 90% rename from python/paddle/v2/fluid/__init__.py rename to python/paddle/fluid/__init__.py index 73acbf3e009965f9eaaade77d2fe4cf4f99d4379..39d13d3ab5fb8340509e01b0bd1de6f66ce99c21 100644 --- a/python/paddle/v2/fluid/__init__.py +++ b/python/paddle/fluid/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -34,13 +34,16 @@ from data_feeder import DataFeeder from core import LoDTensor, CPUPlace, CUDAPlace from distribute_transpiler import DistributeTranspiler from distribute_transpiler_simple import SimpleDistributeTranspiler +from concurrency import (Go, make_channel, channel_send, channel_recv, + channel_close) import clip from memory_optimization_transpiler import memory_optimize import profiler +import unique_name Tensor = LoDTensor -__all__ = framework.__all__ + executor.__all__ + [ +__all__ = framework.__all__ + executor.__all__ + concurrency.__all__ + [ 'io', 'initializer', 'layers', @@ -61,6 +64,7 @@ __all__ = framework.__all__ + executor.__all__ + [ 'DistributeTranspiler', 'memory_optimize', 'profiler', + 'unique_name', ] diff --git a/python/paddle/v2/fluid/backward.py b/python/paddle/fluid/backward.py similarity index 82% rename from python/paddle/v2/fluid/backward.py rename to python/paddle/fluid/backward.py index 29243c90e872ca4a7d1ce6f84f6297b865655da1..58fa7f1bebc082df11e07f5f97927b417af3e4e8 100644 --- a/python/paddle/v2/fluid/backward.py +++ b/python/paddle/fluid/backward.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.v2.fluid import framework as framework +from paddle.fluid import framework as framework from . import core import collections import copy +import unique_name __all__ = [ 'append_backward', @@ -68,7 +69,7 @@ def _infer_var_data_type_(grad_var_name, block): fwd_var = block.desc.find_var_recursive(fwd_name.encode("ascii")) grad_var.set_dtype(fwd_var.dtype()) else: - grad_var.set_dtype(core.DataType.FP32) + grad_var.set_dtype(core.VarDesc.VarType.FP32) def _all_in_set_(cands, s): @@ -199,12 +200,76 @@ def _remove_no_grad_branch_(op_descs, no_grad_set): return op_descs +import proto.framework_pb2 as framework_pb2 + + +def serialize_op_decs(op_desc): + protostr = op_desc.serialize_to_string() + proto = framework_pb2.OpDesc.FromString(str(protostr)) + return proto.__str__() + + +def _callback_lookup_(op): + """ + Only used in _append_backward_ops_ + Build and returns a callback function for certain op. For example + + parallel_do: AllReduce + + :param op: + :return: callback function + """ + if op.type == 'parallel_do' and op.attr('use_nccl'): + param_names = set(op.input('parameters')) + param_grad_names = [n + "@GRAD" for n in param_names] + + class ParallelDoCallBack(object): + def __init__(self, param_grad_names, parallel_scopes_name): + self.has_inserted_nccl_init = False + self.param_grad_names = param_grad_names + self.parallel_scopes_name = parallel_scopes_name + + def __call__(self, block, context): + if not self.has_inserted_nccl_init: + op_desc = _create_op_desc_( + "ncclInit", + {"parallel_scopes": self.parallel_scopes_name}, + {"Communicator": ['nccl_com__do_not_change_']}, {}) + block.program.global_block().desc.append_op().copy_from( + op_desc) + self.has_inserted_nccl_init = True + + current_op_desc = context["__current_op_desc__"] + for o_param in current_op_desc.output_names(): + for o_argu in current_op_desc.output(o_param): + if o_argu in self.param_grad_names: + allreduce_out_name = o_argu + "__nccl_all_reduce__" + op_desc = _create_op_desc_( + "ncclAllReduce", { + "X": [o_argu], + "Communicator": + ['nccl_com__do_not_change_'] + }, {"Out": [allreduce_out_name]}, + {"reduction": "ncclSum"}) + block.desc.append_op().copy_from(op_desc) + + op_desc = _create_op_desc_( + "assign", {"X": [allreduce_out_name]}, + {"Out": [o_argu]}, {}) + block.desc.append_op().copy_from(op_desc) + + return ParallelDoCallBack(param_grad_names, + op.output("parallel_scopes")) + else: + return None + + def _append_backward_ops_(block, ops, target_block, no_grad_dict, grad_to_var, - callback=None): + callbacks=None): """ Create all grad ops, and insert them into given block @@ -220,14 +285,11 @@ def _append_backward_ops_(block, val(str): corresponding forward variable name callback(callable object): a callable object used to decorate new generated grad ops """ - if callback is None: - - def empty_callback(block, context): - pass - - callback = empty_callback - elif not hasattr(callback, '__call__'): - raise ValueError("'callback' must be a callable object.") + if callbacks is not None: + assert (isinstance(callbacks, list)) + for cb in callbacks: + if not hasattr(cb, '__call__'): + raise ValueError("'callback' must be a callable object.") # grad_op_descs holds created grad_op, and will be appended to target_block grad_op_descs = [] @@ -237,9 +299,21 @@ def _append_backward_ops_(block, # If the op has its own sub-block, deal with the sub-block first if op.has_attr("sub_block"): sub_block = program.block(op.block_attr("sub_block")) - grad_sub_block = program.create_block(parent_idx=sub_block.idx) - _append_backward_ops_(sub_block, sub_block.ops, grad_sub_block, - no_grad_dict, grad_to_var) + grad_sub_block = program.create_block() + grad_sub_block.set_forward_block_idx(sub_block.idx) + cb = _callback_lookup_(op) + if cb is not None: + if callbacks is None: + new_callbacks = [cb] + else: + new_callbacks = callbacks + [_callback_lookup_(op)] + _append_backward_ops_(sub_block, sub_block.ops, grad_sub_block, + no_grad_dict, grad_to_var, new_callbacks) + else: + _append_backward_ops_(sub_block, sub_block.ops, grad_sub_block, + no_grad_dict, grad_to_var, callbacks) + + program.rollback() grad_sub_block_list.append(grad_sub_block.desc) # Getting op's corresponding grad_op @@ -258,7 +332,11 @@ def _append_backward_ops_(block, for op_desc in grad_op_descs: new_op_desc = target_block.desc.append_op() new_op_desc.copy_from(op_desc) - callback(block=target_block, context=grad_to_var) + grad_to_var["__current_op_desc__"] = new_op_desc + if callbacks is not None: + assert (isinstance(callbacks, list)) + for cb in callbacks: + cb(block=target_block, context=grad_to_var) def _append_backward_vars_(block, start_op_idx, grad_to_var, grad_info_map): @@ -296,6 +374,9 @@ def _append_backward_vars_(block, start_op_idx, grad_to_var, grad_info_map): # infer_shape and infer_type op_desc.infer_var_type(block.desc) op_desc.infer_shape(block.desc) + # ncclInit dones't need to set data_type + if op_desc.type() == 'ncclInit': + continue for arg in op_desc.output_arg_names(): if arg in new_vars: _infer_var_data_type_(arg, block) @@ -311,7 +392,7 @@ def _rename_grad_(block, start_op_idx, grad_to_var, target_grad_map): for name in op_desc.output_arg_names(): if block.desc.find_var(name.encode("ascii")): - new_name = "%s_%s" % (name, core.unique_integer(name)) + new_name = unique_name.generate(name) op_desc.rename_output(name, new_name) var_map[name] = new_name @@ -335,7 +416,8 @@ def _get_stop_gradients_(program): return no_grad_dict -def append_backward(loss, parameter_list=None, no_grad_set=None, callback=None): +def append_backward(loss, parameter_list=None, no_grad_set=None, + callbacks=None): """ Append backward part to main_program @@ -351,6 +433,8 @@ def append_backward(loss, parameter_list=None, no_grad_set=None, callback=None): (list[(Variable,Variable)]): list of (parameter, gradient) pair. """ assert isinstance(loss, framework.Variable) + if callbacks is not None: + isinstance(callbacks, list) program = loss.block.program if no_grad_set is None: @@ -378,7 +462,7 @@ def append_backward(loss, parameter_list=None, no_grad_set=None, callback=None): no_grad_dict[0].update(map(_append_grad_suffix_, block_no_grad_set)) _append_backward_ops_(root_block, op_path, root_block, no_grad_dict, - grad_to_var, callback) + grad_to_var, callbacks) # Because calc_gradient may be called multiple times, # we need rename the internal gradient variables so that they have diff --git a/python/paddle/v2/fluid/clip.py b/python/paddle/fluid/clip.py similarity index 99% rename from python/paddle/v2/fluid/clip.py rename to python/paddle/fluid/clip.py index fdbc8524abb7d6687983b026ca8e65e61c3dfd1a..12add9e686910c3936cf17fe87a5d0b78443b270 100644 --- a/python/paddle/v2/fluid/clip.py +++ b/python/paddle/fluid/clip.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/fluid/concurrency.py b/python/paddle/fluid/concurrency.py new file mode 100644 index 0000000000000000000000000000000000000000..5f868b6e86d349eed137cfef36e5438d3db019c2 --- /dev/null +++ b/python/paddle/fluid/concurrency.py @@ -0,0 +1,86 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# TODO: Variables: make_channel +# TODO: Operators: send, close_channel, recv, go, select +from layers.control_flow import BlockGuard +from layer_helper import LayerHelper + +__all__ = [ + 'Go', + 'make_channel', + 'channel_send', + 'channel_recv', + 'channel_close', +] + + +class Go(BlockGuard): + def __init__(self, name=None): + self.helper = LayerHelper("go", name=name) + super(Go, self).__init__(self.helper.main_program) + + def __enter__(self): + super(Go, self).__enter__() + + def __exit__(self, exc_type, exc_val, exc_tb): + if exc_type is not None: + return False + self.construct_go_op() + return super(Go, self).__exit__(exc_type, exc_val, exc_tb) + + def construct_go_op(self): + main_program = self.helper.main_program + go_block = main_program.current_block() + parent_block = main_program.block(main_program.current_block() + .parent_idx) + + x_name_list = set() + out_vars = set() + for op in go_block.ops: + # Iterate over all operators, get all the inputs + # and add as input to the Go operator. + for iname in op.input_names: + for in_var_name in op.input(iname): + x_name_list.add(in_var_name) + + # Iterate over all operators , get all the outputs + # add to the output list of Go operator only if + # they exist in the parent block. + for oname in op.output_names: + for out_var_name in op.output(oname): + if out_var_name in parent_block.vars: + out_vars.add(parent_block.var(out_var_name)) + + parent_block.append_op( + type='go', + inputs={'X': [parent_block.var(x_name) for x_name in x_name_list]}, + outputs={'Out': out_vars}, + attrs={'sub_block': go_block}) + + +def make_channel(dtype, size=0): + return True + + +def channel_send(channel, value): + return True + + +def channel_recv(channel): + return True + + +def channel_close(channel): + return True diff --git a/python/paddle/v2/fluid/data_feeder.py b/python/paddle/fluid/data_feeder.py similarity index 89% rename from python/paddle/v2/fluid/data_feeder.py rename to python/paddle/fluid/data_feeder.py index a3b22a8633eae02c570f2a4c4caf4a6152649ef8..ac02401c79b787716b2e5f43e0d1c5686cf2bd13 100644 --- a/python/paddle/v2/fluid/data_feeder.py +++ b/python/paddle/fluid/data_feeder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,13 +27,13 @@ class DataToLoDTensorConverter(object): self.place = place self.lod_level = lod_level self.shape = shape - if dtype == core.DataType.FP32: + if dtype == core.VarDesc.VarType.FP32: self.dtype = 'float32' - elif dtype == core.DataType.INT64: + elif dtype == core.VarDesc.VarType.INT64: self.dtype = 'int64' - elif dtype == core.DataType.FP64: + elif dtype == core.VarDesc.VarType.FP64: self.dtype = 'float64' - elif dtype == core.DataType.INT32: + elif dtype == core.VarDesc.VarType.INT32: self.dtype = 'int32' else: raise ValueError("dtype must be any of [int32, float32, int64, " @@ -107,6 +107,9 @@ class DataFeeder(object): dtype=dtype)) for each_sample in iterable: + assert len(each_sample) == len(converter), ( + "The number of fields in data (%s) does not match " + + "len(feed_list) (%s)") % (len(each_sample), len(converter)) for each_converter, each_slot in six.zip(converter, each_sample): each_converter.feed(each_slot) ret_dict = {} diff --git a/python/paddle/v2/fluid/debuger.py b/python/paddle/fluid/debuger.py similarity index 99% rename from python/paddle/v2/fluid/debuger.py rename to python/paddle/fluid/debuger.py index db1808c64745ac153962c050b08993450dd93c06..b7a906654a7ed60d610fc2e9801bf6108e555dcb 100644 --- a/python/paddle/v2/fluid/debuger.py +++ b/python/paddle/fluid/debuger.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/default_scope_funcs.py b/python/paddle/fluid/default_scope_funcs.py similarity index 92% rename from python/paddle/v2/fluid/default_scope_funcs.py rename to python/paddle/fluid/default_scope_funcs.py index a27280208b8184c6539274afb1ddd6bda2861205..f8faf6942524612ccc63713240bb289eeeaf75eb 100644 --- a/python/paddle/v2/fluid/default_scope_funcs.py +++ b/python/paddle/fluid/default_scope_funcs.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ A `scoped_function` will take a `function` as input. That function will be invoked in a new local scope. """ -import paddle.v2.fluid.core +import paddle.fluid.core import threading __tl_scope__ = threading.local() @@ -44,13 +44,13 @@ __all__ = [ def get_cur_scope(): """ Get current scope. - :rtype: paddle.v2.fluid.core.Scope + :rtype: paddle.fluid.core.Scope """ cur_scope_stack = getattr(__tl_scope__, 'cur_scope', None) if cur_scope_stack is None: __tl_scope__.cur_scope = list() if len(__tl_scope__.cur_scope) == 0: - __tl_scope__.cur_scope.append(paddle.v2.fluid.core.Scope()) + __tl_scope__.cur_scope.append(paddle.fluid.core.Scope()) return __tl_scope__.cur_scope[-1] diff --git a/python/paddle/v2/fluid/distribute_transpiler.py b/python/paddle/fluid/distribute_transpiler.py similarity index 78% rename from python/paddle/v2/fluid/distribute_transpiler.py rename to python/paddle/fluid/distribute_transpiler.py index e4675e24b178b2f1745c2b38270ac381ebfe6550..2fcf3753c5f1211d3b27f38fbdc8d097c437c79a 100644 --- a/python/paddle/v2/fluid/distribute_transpiler.py +++ b/python/paddle/fluid/distribute_transpiler.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ from __future__ import print_function import framework -from framework import Program, default_main_program, Parameter, Variable +from framework import Program, default_main_program, default_startup_program, Parameter, Variable import optimizer from layer_helper import LayerHelper from distributed_spliter import * @@ -133,6 +133,7 @@ class DistributeTranspiler: def transpile(self, optimize_ops, params_grads, + trainer_id, program=None, pservers="127.0.0.1:6174", trainers=1, @@ -146,13 +147,37 @@ class DistributeTranspiler: Use different methods to split trainable variables to different parameter servers. + Steps to transpile trainer: + 1. split variable to multiple blocks, aligned by product(dim[1:]) (width). + 2. rename splited grad variables to add trainer_id suffix ".trainer_%d". + 3. modify trainer program add split_op to each grad variable. + 4. append send_op to send splited variables to server and fetch + params(splited blocks or origin param) from server. + 5. append concat_op to merge splited blocks to update local weights. + + Steps to transpile pserver: + 1. create new program for parameter server. + 2. create params and grad variables that assigned to current server instance. + 3. create a sub-block in the server side program + 4. append ops that should run on current server instance. + 5. add listen_and_serv op + :param optimize_ops: op list of optimization, should be the - return value of Optimizer.minimize + return value of Optimizer.minimize :type optimize_ops: list - :param program: program to optimize, default is default_main_program + :param params_grads: list of tuple(weight, gradient) + :type params_grads: list + :param trainer_id: one unique id for each trainer in a job. + :type trainer_id: int + :param program: program to transpile, default is default_main_program + :type program: Program :param pservers: parameter server endpoints like "m1:6174,m2:6174" :type pservers: string - :return: return a list of programs + :param trainers: total number of workers/trainers in the job + :type trainers: int + :param split_method: A function to determin how to split variables + to different servers equally. + :type split_method: function """ assert (callable(split_method)) if program is None: @@ -160,25 +185,19 @@ class DistributeTranspiler: self.program = program self.trainers = trainers self.optimize_ops = optimize_ops - # steps to transpile: - # 1. split variable to multiple blocks, aligned by product(dim[1:]) (width). - # 2. modify trainer program add split_op to each Grad. - # 3. append send_op to trainer. - # 4. append concat_op to trainer to update local weights. - # 5. create new program for parameter server. - # 6. create parameter server program by split_method generated endpoint->VarBlock - + # TODO(typhoonzero): currently trainer_id is fetched from cluster system + # like Kubernetes, we should port this to use etcd later when developing + # fluid distributed training with fault-tolerance. + self.trainer_id = trainer_id pserver_endpoints = pservers.split(",") # step1 param_list = [pg[0] for pg in params_grads] grad_list = [pg[1] for pg in params_grads] - # TODO: add split selected rows support grad_blocks = split_dense_variable(grad_list, len(pserver_endpoints)) param_blocks = split_dense_variable(param_list, len(pserver_endpoints)) # step2 grad_var_mapping = self._append_split_op(program, grad_blocks) - # step3 send_inputs = [] send_outputs = [] @@ -191,7 +210,6 @@ class DistributeTranspiler: for b in param_blocks: varname, block_id, _ = b.split(":") send_outputs.append(param_var_mapping[varname][int(block_id)]) - # let send_op know which endpoint to send which var to, eplist has the same # order as send_inputs. eplist = split_method(send_inputs, pserver_endpoints) @@ -207,12 +225,12 @@ class DistributeTranspiler: rpc_client_var = program.global_block().create_var( name="RPC_CLIENT_VAR", - psersistable=True, + persistable=True, dtype='float32', # dtype and shape is not used in fact shape=[0]) # create send_op - send_op = program.global_block().append_op( + program.global_block().append_op( type="send", inputs={"X": send_inputs}, outputs={"Out": send_outputs, @@ -224,29 +242,158 @@ class DistributeTranspiler: if len(splited_var) <= 1: continue orig_param = program.global_block().vars[varname] - concat = program.global_block().append_op( + program.global_block().append_op( type="concat", inputs={"X": splited_var}, outputs={"Out": [orig_param]}, attrs={"axis": 0}) - self.lr_param_mapping = self._create_lr_param_mapping() + def get_trainer_program(self): + # remove optimize ops and add a send op to main_program + self.program.global_block().delete_ops(self.optimize_ops) + return self.program - def _create_lr_param_mapping(self): - lr_mapping = dict() - for _, opt_op in enumerate(self.optimize_ops): - if not opt_op.inputs or not opt_op.inputs.has_key("LearningRate") \ - or not opt_op.inputs.has_key("Param"): - continue - lr = opt_op.inputs["LearningRate"].name - param = opt_op.inputs["Param"].name - if not lr_mapping.has_key(lr): - lr_mapping.update({lr: list()}) - lr_mapping[lr].append(param) - return lr_mapping - - def _create_vars_from_blocklist(self, program, block_list): - # Create respective variables using the block_list + def get_pserver_program(self, endpoint): + """ + Get pserver side program using the endpoint. + NOTE: assume blocks of the same variable is not distributed + on the same pserver, only change param/grad varnames for + trainers to fetch. + """ + # step1 + pserver_program = Program() + # step2 + recv_inputs = [] + for v in self.param_grad_ep_mapping[endpoint]["params"]: + self._clone_var(pserver_program.global_block(), v) + for v in self.param_grad_ep_mapping[endpoint]["grads"]: + # create vars for each trainer in global scope, so + # we don't need to create them when grad arrives. + # change client side var name to origin name by + # removing ".trainer_%d" suffix + suff_idx = v.name.find(".trainer_") + if suff_idx >= 0: + orig_var_name = v.name[:suff_idx] + pserver_program.global_block().create_var( + name=orig_var_name, + persistable=True, + dtype=v.dtype, + shape=v.shape) + print("create origin var: ", orig_var_name) + for trainer_id in xrange(self.trainers): + var = pserver_program.global_block().create_var( + name="%s.trainer_%d" % (orig_var_name, trainer_id), + persistable=False, + dtype=v.dtype, + shape=v.shape) + recv_inputs.append(var) + print("create per trainer var: ", var.name) + # step3 + optimize_block = pserver_program.create_block(0) + # step 4 + # Create a union-find data struct from optimize ops, + # If two ops are connected, we could add these two ops + # into one set. + ufind = self._create_ufind(self.optimize_ops) + # step 4.2 + # Iterate through the ops and append optimize op which + # located on current pserver + opt_op_on_pserver = [] + for _, op in enumerate(self.optimize_ops): + if self._is_opt_op(op) and self._is_opt_op_on_pserver(endpoint, op): + opt_op_on_pserver.append(op) + # step 4.3 + # Iterate through the ops, and if an op and the optimize ops + # which located on current pserver are in one set, then + # append it into the sub program. + for _, op in enumerate(self.optimize_ops): + for _, opt_op in enumerate(opt_op_on_pserver): + if ufind.is_connected(op, opt_op): + if self._is_opt_op(op): + self._append_pserver_ops(optimize_block, op, endpoint) + else: + self._append_pserver_non_opt_ops(optimize_block, op) + break + # step5 append the listen_and_serv op + pserver_program.global_block().append_op( + type="listen_and_serv", + inputs={'X': recv_inputs}, + outputs={}, + attrs={ + "OptimizeBlock": optimize_block, + "endpoint": endpoint, + "Fanin": self.trainers + }) + pserver_program.sync_with_cpp() + return pserver_program + + def get_startup_program(self, endpoint, pserver_program): + """ + Get startup program for current parameter server. + Modify operator input variables if there are variables that + were split to several blocks. + """ + s_prog = Program() + orig_s_prog = framework.default_startup_program() + params = self.param_grad_ep_mapping[endpoint]["params"] + + def _get_splited_name_and_shape(varname): + for idx, splited_param in enumerate(params): + pname = splited_param.name + if same_or_split_var(pname, varname) and varname != pname: + return pname, splited_param.shape + return "", [] + + # 1. create vars in pserver program to startup program + pserver_vars = pserver_program.global_block().vars + created_var_map = dict() + for _, var in pserver_vars.iteritems(): + tmpvar = s_prog.global_block().create_var( + name=var.name, + persistable=var.persistable, + dtype=var.dtype, + shape=var.shape) + created_var_map[var.name] = tmpvar + + # 2. rename op outputs + for op in orig_s_prog.global_block().ops: + new_inputs = dict() + new_outputs = dict() + # do not append startup op if var is not on this pserver + op_on_pserver = False + for key in op.output_names: + newname, _ = _get_splited_name_and_shape(op.output(key)[0]) + if newname: + op_on_pserver = True + new_outputs[key] = created_var_map[newname] + elif op.output(key)[0] in pserver_vars: + op_on_pserver = True + new_outputs[key] = pserver_vars[op.output(key)[0]] + + # most startup program ops have no inputs + new_inputs = self._get_input_map_from_op(pserver_vars, op) + + if op_on_pserver: + if op.type in [ + "gaussian_random", "fill_constant", "uniform_random" + ]: + op.attrs["shape"] = new_outputs["Out"].shape + s_prog.global_block().append_op( + type=op.type, + inputs=new_inputs, + outputs=new_outputs, + attrs=op.attrs) + return s_prog + + # ====================== private transpiler functions ===================== + def _create_vars_from_blocklist(self, + program, + block_list, + add_trainer_suffix=False): + """ + NOTE: only grads need to be named for different trainers, use + add_trainer_suffix to rename the grad vars. + """ block_map = dict() var_mapping = dict() for block_str in block_list: @@ -255,11 +402,20 @@ class DistributeTranspiler: block_map[varname] = [] block_map[varname].append((long(offset), long(size))) for varname, splited in block_map.iteritems(): - orig_var = program.global_block().vars[varname] - var_mapping[varname] = [] + orig_var = program.global_block().var(varname) if len(splited) == 1: - var_mapping[varname] = [orig_var] + if add_trainer_suffix: + new_var_name = "%s.trainer_%d" % \ + (orig_var.name, self.trainer_id) + program.global_block().rename_var(varname, new_var_name) + var_mapping[varname] = \ + [program.global_block().var(new_var_name)] + else: + var_mapping[varname] = \ + [program.global_block().var(orig_var.name)] continue + + var_mapping[varname] = [] orig_shape = orig_var.shape orig_dim1_flatten = 1 if len(orig_shape) >= 2: @@ -271,13 +427,21 @@ class DistributeTranspiler: splited_shape = [rows] if len(orig_shape) >= 2: splited_shape.extend(orig_shape[1:]) + new_var_name = "" + if add_trainer_suffix: + new_var_name = "%s.block%d.trainer_%d" % \ + (varname, i, self.trainer_id) + else: + new_var_name = "%s.block%d" % \ + (varname, i) var = program.global_block().create_var( - name="%s.block%d" % (varname, i), - psersistable=False, + name=new_var_name, + persistable=False, dtype=orig_var.dtype, type=orig_var.type, shape=splited_shape) # flattend splited var var_mapping[varname].append(var) + program.global_block().sync_with_cpp() return var_mapping def _clone_var(self, block, var): @@ -288,13 +452,12 @@ class DistributeTranspiler: dtype=var.dtype, type=var.type, lod_level=var.lod_level, - # HACK: let all param in pserver be persistable so the child - # program in recv can get them persistable=True) def _append_split_op(self, program, gradblocks): # Split variables that need to be split and append respective ops - var_mapping = self._create_vars_from_blocklist(program, gradblocks) + var_mapping = self._create_vars_from_blocklist( + program, gradblocks, add_trainer_suffix=True) for varname, splited_vars in var_mapping.iteritems(): # variable that don't need to split have empty splited_vars if len(splited_vars) <= 1: @@ -324,24 +487,6 @@ class DistributeTranspiler: "[LOD_TENSOR, SELECTED_ROWS]") return var_mapping - def get_trainer_program(self): - # remove optimize ops and add a send op to main_program - self.program.global_block().delete_ops(self.optimize_ops) - return self.program - - def _create_var_for_trainers(self, block, var, trainers): - # For each trainer, create the necessary variables - var_list = [] - for i in xrange(trainers): - var_each = block.create_var( - name="%s.trainer_%d" % (var.name, i), - psersistable=var.persistable, - dtype=var.dtype, - type=var.type, - shape=var.shape) - var_list.append(var_each) - return var_list - def _get_optimizer_input_shape(self, op_type, varkey, orig_shape, param_shape): """ @@ -369,18 +514,16 @@ class DistributeTranspiler: pass return orig_shape - def _fetch_var_names(self, param_dict): - res = [] - if not param_dict: - return res - for _, values in param_dict.iteritems(): - if not isinstance(values, list): - values = [values] - res += [v.name for v in values] - return res + def _orig_varname(self, varname): + suff_idx = varname.find(".trainer_") + orig_var_name = "" + if suff_idx >= 0: + orig_var_name = varname[:suff_idx] + return orig_var_name def _append_pserver_ops(self, optimize_block, opt_op, endpoint): program = optimize_block.program + pserver_block = program.global_block() new_inputs = dict() # update param/grad shape first, then other inputs like # moment can use the updated shape @@ -388,18 +531,23 @@ class DistributeTranspiler: if key == "Grad": grad_block = None for g in self.param_grad_ep_mapping[endpoint]["grads"]: - if same_or_split_var(g.name, opt_op.input(key)[0]): + if same_or_split_var( + self._orig_varname(g.name), opt_op.input(key)[0]): grad_block = g break if not grad_block: # do not append this op if current endpoint # is not dealing with this grad block return - merged_var = program.global_block().vars[grad_block.name] - # append merging ops if trainers > 1 + merged_var = \ + pserver_block.vars[self._orig_varname(grad_block.name)] if self.trainers > 1: - vars2merge = self._create_var_for_trainers( - program.global_block(), grad_block, self.trainers) + vars2merge = [] + for i in xrange(self.trainers): + per_trainer_name = "%s.trainer_%d" % \ + (self._orig_varname(grad_block.name), i) + vars2merge.append(pserver_block.vars[per_trainer_name]) + optimize_block.append_op( type="sum", inputs={"X": vars2merge}, @@ -419,29 +567,27 @@ class DistributeTranspiler: break if not param_block: return - tmpvar = program.global_block().create_var( + tmpvar = pserver_block.create_var( name=param_block.name, persistable=True, dtype=param_block.dtype, shape=param_block.shape) - new_inputs[key] = tmpvar elif key == "LearningRate": # leraning rate variable has already be created by non-optimize op, # don't create it once again. - new_inputs[key] = program.global_block().vars[opt_op.input(key)[ - 0]] + new_inputs[key] = pserver_block.vars[opt_op.input(key)[0]] for key in opt_op.input_names: new_shape = None if key in ["Param", "Grad", "LearningRate"]: continue - var = program.global_block().vars[opt_op.input(key)[0]] + var = self.program.global_block().vars[opt_op.input(key)[0]] # update accumulator variable shape param_shape = new_inputs["Param"].shape new_shape = self._get_optimizer_input_shape(opt_op.type, key, var.shape, param_shape) - tmpvar = program.global_block().create_var( + tmpvar = pserver_block.create_var( name=var.name, persistable=var.persistable, dtype=var.dtype, @@ -449,11 +595,14 @@ class DistributeTranspiler: new_inputs[key] = tmpvar # change output's ParamOut variable - opt_op.outputs["ParamOut"] = new_inputs["Param"] + outputs = self._get_output_map_from_op(self.program.global_block().vars, + opt_op) + outputs["ParamOut"] = new_inputs["Param"] + optimize_block.append_op( type=opt_op.type, inputs=new_inputs, - outputs=opt_op.outputs, + outputs=outputs, attrs=opt_op.attrs) def _append_pserver_non_opt_ops(self, optimize_block, opt_op): @@ -497,11 +646,12 @@ class DistributeTranspiler: # If one op's input is another op's output or # one op's output is another op's input, we say # the two operator is connected. - op1_input_names = self._fetch_var_names(op1.inputs) - op1_output_names = self._fetch_var_names(op1.outputs) + op1_input_names = op1.desc.input_arg_names() + op1_output_names = op1.desc.output_arg_names() + + op2_input_names = op2.desc.input_arg_names() + op2_output_names = op2.desc.output_arg_names() - op2_input_names = self._fetch_var_names(op2.inputs) - op2_output_names = self._fetch_var_names(op2.outputs) if set(op1_output_names) & set(op2_input_names) or \ set(op1_input_names) & set(op2_output_names): return True @@ -521,8 +671,8 @@ class DistributeTranspiler: def _is_opt_op(self, op): # NOTE: It's a HACK implement. # optimize op: SGDOptimize, MomentumOptimizer, AdamOptimizer and etc... - if op.inputs and op.inputs.has_key("Param") \ - and op.inputs.has_key("LearningRate"): + if "Param" in op.input_names and \ + "LearningRate" in op.input_names: return True return False @@ -530,88 +680,16 @@ class DistributeTranspiler: param_names = [ p.name for p in self.param_grad_ep_mapping[endpoint]["params"] ] - if op.inputs["Param"].name in param_names: + if op.input("Param") in param_names: return True else: for n in param_names: - param = op.inputs["Param"].name - if same_or_split_var(n, param) and n != op.inputs["Param"].name: + param = op.input("Param")[0] + if same_or_split_var(n, param) and n != param: return True return False return False - def get_pserver_program(self, endpoint): - """ - Get pserver side program using the endpoint - - NOTE: assume blocks of the same variable is not distributed - on the same pserver, only change param/grad varnames for - trainers to fetch. For each pserver endpoint, server side - program must be a sub-set of the original optimization program. - """ - # step5 - pserver_program = Program() - for v in self.param_grad_ep_mapping[endpoint]["params"]: - self._clone_var(pserver_program.global_block(), v) - for v in self.param_grad_ep_mapping[endpoint]["grads"]: - # create vars for each trainer in global scope, so - # we don't need to create them when grad arrives. - pserver_program.global_block().create_var( - name=v.name, persistable=True, dtype=v.dtype, shape=v.shape) - for trainer_id in xrange(self.trainers): - pserver_program.global_block().create_var( - name="%s.trainer_%d" % (v.name, trainer_id), - persistable=True, - dtype=v.dtype, - shape=v.shape) - - # step6 - optimize_block = pserver_program.create_block(0) - # step 6.1 - # Create a union-find data struct by optimize ops, - # If two ops are connected, we could add these two ops - # into one set. - ufind = self._create_ufind(self.optimize_ops) - # step 6.2 - # Iterate through the ops and append optimize op which - # located on current pserver - opt_op_on_pserver = [] - for _, op in enumerate(self.optimize_ops): - if self._is_opt_op(op) and self._is_opt_op_on_pserver(endpoint, op): - opt_op_on_pserver.append(op) - # step 6.3 - # Iterate through the ops, and if an op and the optimize ops - # which located on current pserver are in one set, then - # append it into the sub program. - for _, op in enumerate(self.optimize_ops): - for _, opt_op in enumerate(opt_op_on_pserver): - if ufind.is_connected(op, opt_op): - if self._is_opt_op(op): - self._append_pserver_ops(optimize_block, op, endpoint) - else: - self._append_pserver_non_opt_ops(optimize_block, op) - break - # Append the listen_and_serv op - pserver_program.global_block().append_op( - type="listen_and_serv", - inputs={}, - outputs={}, - attrs={ - "OptimizeBlock": optimize_block, - "endpoint": endpoint, - "ParamList": [ - p.name - for p in self.param_grad_ep_mapping[endpoint]["params"] - ], - "GradList": [ - p.name - for p in self.param_grad_ep_mapping[endpoint]["grads"] - ], - "Fanin": self.trainers - }) - pserver_program.sync_with_cpp() - return pserver_program - def _get_input_map_from_op(self, varmap, op): iomap = dict() for key in op.input_names: @@ -635,61 +713,3 @@ class DistributeTranspiler: else: iomap[key] = vars return iomap - - def get_startup_program(self, endpoint, pserver_program): - """ - Get startup program for current parameter server. - Modify operator input variables if there are variables that - were split to several blocks. - """ - s_prog = Program() - orig_s_prog = framework.default_startup_program() - params = self.param_grad_ep_mapping[endpoint]["params"] - - def _get_splited_name_and_shape(varname): - for idx, splited_param in enumerate(params): - pname = splited_param.name - if same_or_split_var(pname, varname) and varname != pname: - return pname, splited_param.shape - return "", [] - - # 1. create vars in pserver program to startup program - pserver_vars = pserver_program.global_block().vars - created_var_map = dict() - for _, var in pserver_vars.iteritems(): - tmpvar = s_prog.global_block().create_var( - name=var.name, - persistable=var.persistable, - dtype=var.dtype, - shape=var.shape) - created_var_map[var.name] = tmpvar - - # 2. rename op outputs - for op in orig_s_prog.global_block().ops: - new_inputs = dict() - new_outputs = dict() - # do not append startup op if var is not on this pserver - op_on_pserver = False - for key in op.output_names: - newname, _ = _get_splited_name_and_shape(op.output(key)[0]) - if newname: - op_on_pserver = True - new_outputs[key] = created_var_map[newname] - elif op.output(key)[0] in pserver_vars: - op_on_pserver = True - new_outputs[key] = pserver_vars[op.output(key)[0]] - - # most startup program ops have no inputs - new_inputs = self._get_input_map_from_op(pserver_vars, op) - - if op_on_pserver: - if op.type in [ - "gaussian_random", "fill_constant", "uniform_random" - ]: - op.attrs["shape"] = new_outputs["Out"].shape - s_prog.global_block().append_op( - type=op.type, - inputs=new_inputs, - outputs=new_outputs, - attrs=op.attrs) - return s_prog diff --git a/python/paddle/v2/fluid/distribute_transpiler_simple.py b/python/paddle/fluid/distribute_transpiler_simple.py similarity index 99% rename from python/paddle/v2/fluid/distribute_transpiler_simple.py rename to python/paddle/fluid/distribute_transpiler_simple.py index 73d9bed1ae9d81d66eb32675ea8473da248076f0..e94bbb6c39f7a017e2d0b79d050e6ff8e4371a14 100644 --- a/python/paddle/v2/fluid/distribute_transpiler_simple.py +++ b/python/paddle/fluid/distribute_transpiler_simple.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/distributed_spliter.py b/python/paddle/fluid/distributed_spliter.py similarity index 95% rename from python/paddle/v2/fluid/distributed_spliter.py rename to python/paddle/fluid/distributed_spliter.py index 8cf0b06786f2ccb5601af10aab39e7d0c22ae624..d288b27ba00970897d8121b82a9d51d5cf4ece09 100644 --- a/python/paddle/v2/fluid/distributed_spliter.py +++ b/python/paddle/fluid/distributed_spliter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/evaluator.py b/python/paddle/fluid/evaluator.py similarity index 97% rename from python/paddle/v2/fluid/evaluator.py rename to python/paddle/fluid/evaluator.py index 2686a5bdfcf0e2d26ce8f58cceff1967b06d835b..8cc49053337a25d917b85a69a453cf29b1597548 100644 --- a/python/paddle/v2/fluid/evaluator.py +++ b/python/paddle/fluid/evaluator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,8 @@ import numpy as np import layers -from framework import Program, unique_name, Variable, program_guard +from framework import Program, Variable, program_guard +import unique_name from layer_helper import LayerHelper __all__ = [ @@ -89,14 +90,14 @@ class Evaluator(object): Args: suffix(str): the state suffix. - dtype(str|core.DataType): the state data type + dtype(str|core.VarDesc.VarType): the state data type shape(tuple|list): the shape of state Returns: State variable """ state = self.helper.create_variable( - name="_".join([unique_name(self.helper.name), suffix]), + name="_".join([unique_name.generate(self.helper.name), suffix]), persistable=True, dtype=dtype, shape=shape) diff --git a/python/paddle/v2/fluid/executor.py b/python/paddle/fluid/executor.py similarity index 99% rename from python/paddle/v2/fluid/executor.py rename to python/paddle/fluid/executor.py index 01cbdb3ec487d6e2e60890619131de0067d40db9..e2749593057067ec04284940fff8f6a5284806ef 100644 --- a/python/paddle/v2/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/framework.py b/python/paddle/fluid/framework.py similarity index 88% rename from python/paddle/v2/fluid/framework.py rename to python/paddle/fluid/framework.py index a517db68c5886fbcbe19e6981aee5bf3971352e4..64441e8fa491dd71101c95e14bedf956eb61ee3e 100644 --- a/python/paddle/v2/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import numpy as np import proto.framework_pb2 as framework_pb2 from . import core +import unique_name __all__ = [ 'Block', @@ -47,44 +48,30 @@ def grad_var_name(var_name): return var_name + GRAD_VAR_SUFFIX -def unique_name(prefix): - """ - Generate unique names with prefix - - Args: - prefix(str): The prefix of return string - - Returns(str): A unique string with the prefix - - """ - uid = core.unique_integer(prefix) # unique during whole process. - return "_".join([prefix, str(uid)]) - - def convert_np_dtype_to_dtype_(np_dtype): """ Convert the data type in numpy to the data type in Paddle Args: np_dtype(np.dtype): the data type in numpy - Returns(core.DataType): the data type in Paddle + Returns(core.VarDesc.VarType): the data type in Paddle """ dtype = np.dtype(np_dtype) if dtype == np.float32: - return core.DataType.FP32 + return core.VarDesc.VarType.FP32 elif dtype == np.float64: - return core.DataType.FP64 + return core.VarDesc.VarType.FP64 elif dtype == np.float16: - return core.DataType.FP16 + return core.VarDesc.VarType.FP16 elif dtype == np.int32: - return core.DataType.INT32 + return core.VarDesc.VarType.INT32 elif dtype == np.int16: - return core.DataType.INT16 + return core.VarDesc.VarType.INT16 elif dtype == np.int64: - return core.DataType.INT64 + return core.VarDesc.VarType.INT64 elif dtype == np.bool: - return core.DataType.BOOL + return core.VarDesc.VarType.BOOL else: raise ValueError("Not supported numpy dtype " + str(dtype)) @@ -93,16 +80,19 @@ def dtype_is_floating(dtype): """ Check the data type is floating or not. Args: - dtype(np.dtype|core.DataType): data type. + dtype(np.dtype|core.VarDesc.VarType): data type. Could be numpy format or Paddle format Returns(bool): True if data type is a float value """ - if not isinstance(dtype, core.DataType): + if not isinstance(dtype, core.VarDesc.VarType): dtype = convert_np_dtype_to_dtype_(dtype) - return dtype in [core.DataType.FP16, core.DataType.FP32, core.DataType.FP64] + return dtype in [ + core.VarDesc.VarType.FP16, core.VarDesc.VarType.FP32, + core.VarDesc.VarType.FP64 + ] def _debug_string_(proto, throw_on_error=True): @@ -148,8 +138,8 @@ class Variable(object): framework.proto for details. shape(tuple|list|None): The shape of variable. -1 means the batch size. Some kinds of variable do not contain shape, just set it to None. - dtype(np.dtype|core.DataType|str): The data type of variable. - lod_level(int): The level of lod tensor. 0 means there is not a time + dtype(np.dtype|core.VarDesc.VarType|str): The data type of variable. + lod_level(int): The level of lod tensor. 0 means it is not a time series data. persistable(bool): True if the variable should be saved as check point. Defaults to False. @@ -172,7 +162,7 @@ class Variable(object): self.error_clip = error_clip if name is None: - name = Variable._unique_var_name_() + name = unique_name.generate('_generated_var') is_new_var = False self.desc = self.block.desc.find_var(name) @@ -200,7 +190,7 @@ class Variable(object): "shape is {1}; the new shape is {2}. They are not " "matched.".format(self.name, old_shape, shape)) if dtype is not None: - if not isinstance(dtype, core.DataType): + if not isinstance(dtype, core.VarDesc.VarType): dtype = convert_np_dtype_to_dtype_(dtype) if is_new_var: self.desc.set_dtype(dtype) @@ -283,6 +273,10 @@ class Variable(object): def name(self): return self.desc.name() + @name.setter + def name(self, new_name): + self.desc.set_name(new_name) + @property def shape(self): # convert to tuple, make it as same as numpy API. @@ -300,12 +294,6 @@ class Variable(object): def type(self): return self.desc.type() - @staticmethod - def _unique_var_name_(): - prefix = "_generated_var" - uid = core.unique_integer(prefix) # unique during whole process. - return "_".join([prefix, str(uid)]) - def set_error_clip(self, error_clip): self.error_clip = error_clip @@ -339,7 +327,7 @@ class OpProtoHolder(object): def __init__(self): assert not hasattr( self.__class__, - '_instance'), 'Please use `instance()` to get OpProtoHolder opject!' + '_instance'), 'Please use `instance()` to get OpProtoHolder object!' op_protos = get_all_op_protos() self.op_proto_map = {} for proto in op_protos: @@ -361,8 +349,8 @@ class OpProtoHolder(object): class Operator(object): """ - Python Operator class. The operator represents the build in instructs in a - Block. Users can use the build in instructs to describe their neural + Python Operator class. The operator represents the build in instructions in a + Block. Users can use the build in instructions to describe their neural network. """ @@ -400,9 +388,6 @@ class Operator(object): """ self.block = block self.desc = desc - # for clone a new operator - self.inputs = inputs - self.outputs = outputs self.attrs = attrs if len(self.desc.type()) != 0: return @@ -474,7 +459,7 @@ class Operator(object): raise TypeError("'attrs' should be a dict.") for attr in proto.attrs: attr_name = attr.name - if (not attr_name in attrs) or (attrs[attr_name] is None): + if (attr_name not in attrs) or (attrs[attr_name] is None): continue if isinstance(attrs[attr_name], Block): self.desc.set_block_attr(attr_name, attrs[attr_name].desc) @@ -490,7 +475,7 @@ class Operator(object): 'feed', 'fetch', 'save', 'load', 'recurrent', 'rnn_memory_helper_grad', 'conditional_block', 'while', 'send', 'recv', 'listen_and_serv', 'parallel_do', 'save_combine', - 'load_combine' + 'load_combine', 'ncclInit' } if type not in no_kernel_op_set: self.desc.infer_var_type(self.block.desc) @@ -531,6 +516,12 @@ class Operator(object): """ return self.desc.input(name) + def rename_input(self, old_name, new_name): + self.desc.rename_input(old_name, new_name) + + def rename_output(self, old_name, new_name): + self.desc.rename_output(old_name, new_name) + @property def input_names(self): """ @@ -540,6 +531,14 @@ class Operator(object): """ return self.desc.input_names() + @property + def input_arg_names(self): + return self.desc.input_arg_names() + + @property + def output_arg_names(self): + return self.desc.output_arg_names() + def output(self, name): """ Get output arguments by the output parameter name @@ -678,6 +677,13 @@ class Block(object): def parent_idx(self): return self.desc.parent + @property + def forward_block_idx(self): + return self.desc.get_forward_block_idx() + + def set_forward_block_idx(self, idx): + self.desc.set_forward_block_idx(idx) + @property def idx(self): return self.desc.id @@ -691,15 +697,32 @@ class Block(object): return v def var_recursive(self, name): - if self.has_var(name): - return self.var(name) - else: - if self.idx == 0: - raise ValueError("var %s is not in block(%d) nor its parents." % - name, self.idx) - else: - parent_block = self.program.block(self.parent_idx) - return parent_block.var_recursive(name) + frontier = list() + visited = set() + + frontier.append(self) + + prog = self.program + + while len(frontier) != 0: # BFS + cur = frontier[0] + frontier = frontier[1:] + + if id(cur) in visited: + continue + + if cur.has_var(name): + return cur.var(name) + + if cur.parent_idx != -1: + frontier.append(prog.block(cur.parent_idx)) + + if cur.forward_block_idx != -1: + frontier.append(prog.block(cur.forward_block_idx)) + + visited.add(id(cur)) + + raise ValueError("Var {0} is not found recursively".format(name)) def all_parameters(self): return list(self.iter_parameters()) @@ -709,7 +732,7 @@ class Block(object): if isinstance(item[1], Parameter)) def create_var(self, *args, **kwargs): - var = Variable(self, *args, **kwargs) + var = Variable(block=self, *args, **kwargs) if 'initializer' in kwargs: kwargs['initializer'](var, self) return var @@ -717,6 +740,60 @@ class Block(object): def has_var(self, name): return name in self.vars + def rename_var(self, name, new_name): + """ + Rename variable in vars and ops' inputs and outputs + """ + if not self.has_var(name): + raise ValueError("var %s is not in current" % name) + v = self.var(name) + stop_gradient = None + trainable = None + optimize_attr = None + regularizer = None + gradient_clip_attr = None + error_clip = None + if type(v) == Parameter: + stop_gradient = v.stop_gradient + trainable = v.trainable + optimize_attr = v.optimize_attr + regularizer = v.regularizer + gradient_clip_attr = v.gradient_clip_attr + error_clip = v.error_clip + elif type(v) == Variable: + error_clip = v.error_clip + stop_gradient = v.stop_gradient + else: + raise ValueError("unsupported var type: %s", type(v)) + + self.desc.rename_var(name, new_name) + d = self.desc.find_var(new_name) + var = None + if type(v) == Parameter: + var = Parameter( + self, + d.shape(), + d.dtype(), + name=new_name, + stop_gradient=stop_gradient, + trainable=trainable, + optimize_attr=optimize_attr, + regularizer=regularizer, + gradient_clip_attr=gradient_clip_attr, + error_clip=error_clip) + elif type(v) == Variable: + var = Variable( + self, + name=new_name, + error_clip=error_clip, + stop_gradient=stop_gradient) + + # rename the python side, sync_with_cpp will only add + # new vars/ops to python side. + self.vars[new_name] = var + del self.vars[name] + self.sync_with_cpp() + def create_parameter(self, *args, **kwargs): global_block = self.program.global_block() param = Parameter(global_block, *args, **kwargs) @@ -726,13 +803,13 @@ class Block(object): def append_op(self, *args, **kwargs): op_desc = self.desc.append_op() - op = Operator(self, op_desc, *args, **kwargs) + op = Operator(block=self, desc=op_desc, *args, **kwargs) self.ops.append(op) return op def delete_ops(self, ops): # remove from cpp - # FIXME(typhoonzero): remove only the first occuracy. + # FIXME(typhoonzero): remove only the first occurrence. try: start = list(self.ops).index(ops[0]) end = list(self.ops).index(ops[-1]) @@ -750,6 +827,11 @@ class Block(object): return op def sync_with_cpp(self): + """ + Sync with the desc on the c++ end. + + This method is used to synchronize the c++ desc instance generated by backward. + """ # sync variables from cpp for var in self.desc.all_vars(): if not self.has_var(var.name()): @@ -795,9 +877,9 @@ class Block(object): def copy_param_info_from(self, other): """ - Copy the information of parameters from other block + Copy the information of parameters from the other block Args: - other(Block): other block + other(Block): the other block Returns: None @@ -1143,6 +1225,6 @@ def get_var(name, program=None): if program is None: program = default_main_program() assert isinstance(name, str) - assert isinstance(name, Program) + assert isinstance(program, Program) return program.global_block().var(name) diff --git a/python/paddle/v2/fluid/graphviz.py b/python/paddle/fluid/graphviz.py similarity index 99% rename from python/paddle/v2/fluid/graphviz.py rename to python/paddle/fluid/graphviz.py index 5881119c39231282b5654cd60720a1d8a7877896..b8d21344fc8f65f4025f28a195dab2d371b30292 100644 --- a/python/paddle/v2/fluid/graphviz.py +++ b/python/paddle/fluid/graphviz.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/initializer.py b/python/paddle/fluid/initializer.py similarity index 99% rename from python/paddle/v2/fluid/initializer.py rename to python/paddle/fluid/initializer.py index 8c70fd90eff6d40c77ea4b74f5b04d6ab62401be..927f1e625a579737b98e60683d8d9ed90d5e7e03 100644 --- a/python/paddle/v2/fluid/initializer.py +++ b/python/paddle/fluid/initializer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/io.py b/python/paddle/fluid/io.py similarity index 98% rename from python/paddle/v2/fluid/io.py rename to python/paddle/fluid/io.py index 7146fd23b975985451a1cb74e58b4b3f1a10dfd7..1817caa94275e4efa47ec1a5a0aa861255c75561 100644 --- a/python/paddle/v2/fluid/io.py +++ b/python/paddle/fluid/io.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ import os -from paddle.v2.fluid.evaluator import Evaluator -from paddle.v2.fluid.framework import Program, Parameter, default_main_program, Variable +from paddle.fluid.evaluator import Evaluator +from paddle.fluid.framework import Program, Parameter, default_main_program, Variable from . import core __all__ = [ diff --git a/python/paddle/v2/fluid/layer_helper.py b/python/paddle/fluid/layer_helper.py similarity index 93% rename from python/paddle/v2/fluid/layer_helper.py rename to python/paddle/fluid/layer_helper.py index 2119ca12c8dea6463934aa68cb1b46ec687e3f72..6437dbb446e13d9ba24098dd936bfba395c6a566 100644 --- a/python/paddle/v2/fluid/layer_helper.py +++ b/python/paddle/fluid/layer_helper.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,9 +15,9 @@ import copy import itertools -from framework import Variable, Parameter, default_main_program, default_startup_program, \ - unique_name, dtype_is_floating -from paddle.v2.fluid.initializer import Constant, Xavier +from framework import Variable, Parameter, default_main_program, default_startup_program, dtype_is_floating +import unique_name +from paddle.fluid.initializer import Constant, Xavier from param_attr import ParamAttr, WeightNormParamAttr @@ -27,7 +27,7 @@ class LayerHelper(object): self.layer_type = layer_type name = self.kwargs.get('name', None) if name is None: - self.kwargs['name'] = unique_name(self.layer_type) + self.kwargs['name'] = unique_name.generate(self.layer_type) @property def name(self): @@ -117,17 +117,20 @@ class LayerHelper(object): block=self.startup_program.global_block()): if out is None: out = block.create_var( - name=unique_name(".".join([self.name, 'weight_norm_norm'])), + name=unique_name.generate(".".join( + [self.name, 'weight_norm_norm'])), dtype=dtype, persistable=False) abs_out = block.create_var( - name=unique_name(".".join([self.name, 'weight_norm_abs'])), + name=unique_name.generate(".".join( + [self.name, 'weight_norm_abs'])), dtype=dtype, persistable=False) block.append_op( type='abs', inputs={'X': x}, outputs={'Out': abs_out}) pow_out = block.create_var( - name=unique_name(".".join([self.name, 'weight_norm_pow'])), + name=unique_name.generate(".".join( + [self.name, 'weight_norm_pow'])), dtype=dtype, persistable=False) block.append_op( @@ -136,7 +139,8 @@ class LayerHelper(object): outputs={'Out': pow_out}, attrs={'factor': float(p)}) sum_out = block.create_var( - name=unique_name(".".join([self.name, 'weight_norm_sum'])), + name=unique_name.generate(".".join( + [self.name, 'weight_norm_sum'])), dtype=dtype, persistable=False) block.append_op( @@ -161,7 +165,7 @@ class LayerHelper(object): block=self.startup_program.global_block()): if out is None: out = block.create_var( - name=unique_name(".".join( + name=unique_name.generate(".".join( [self.name, 'weight_norm_reshape'])), dtype=dtype, persistable=False) @@ -178,7 +182,7 @@ class LayerHelper(object): block=self.startup_program.global_block()): if out is None: out = block.create_var( - name=unique_name(".".join( + name=unique_name.generate(".".join( [self.name, 'weight_norm_transpose'])), dtype=dtype, persistable=False) @@ -196,7 +200,8 @@ class LayerHelper(object): """Computes the norm over all dimensions except dim""" if out is None: out = block.create_var( - name=unique_name(".".join([self.name, 'weight_norm_norm'])), + name=unique_name.generate(".".join( + [self.name, 'weight_norm_norm'])), dtype=dtype, persistable=False) if dim is None: @@ -286,7 +291,7 @@ class LayerHelper(object): assert isinstance(attr, ParamAttr) suffix = 'b' if is_bias else 'w' if attr.name is None: - attr.name = unique_name(".".join([self.name, suffix])) + attr.name = unique_name.generate(".".join([self.name, suffix])) if default_initializer is None and attr.initializer is None: if is_bias: @@ -316,7 +321,7 @@ class LayerHelper(object): def create_tmp_variable(self, dtype, stop_gradient=False): return self.main_program.current_block().create_var( - name=unique_name(".".join([self.name, 'tmp'])), + name=unique_name.generate(".".join([self.name, 'tmp'])), dtype=dtype, persistable=False, stop_gradient=stop_gradient) diff --git a/python/paddle/v2/fluid/layers/__init__.py b/python/paddle/fluid/layers/__init__.py similarity index 88% rename from python/paddle/v2/fluid/layers/__init__.py rename to python/paddle/fluid/layers/__init__.py index cfbbf710b6ac63b9a0fe7d51b0d1940532e948fc..906a16a49f728526a41d1bc6da3a40e30bbfa33f 100644 --- a/python/paddle/v2/fluid/layers/__init__.py +++ b/python/paddle/fluid/layers/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ import ops from ops import * import nn from nn import * -import detection -from detection import * import io from io import * import tensor @@ -33,7 +31,6 @@ from detection import * __all__ = [] __all__ += math_op_patch.__all__ -__all__ += detection.__all__ __all__ += nn.__all__ __all__ += io.__all__ __all__ += tensor.__all__ diff --git a/python/paddle/v2/fluid/layers/control_flow.py b/python/paddle/fluid/layers/control_flow.py similarity index 96% rename from python/paddle/v2/fluid/layers/control_flow.py rename to python/paddle/fluid/layers/control_flow.py index 71a9459d556e2b3e25b1cd4ae768a8fb8ae41273..1bb1aa30ee1019c6f80eb64b6dc20459e7a3073b 100644 --- a/python/paddle/v2/fluid/layers/control_flow.py +++ b/python/paddle/fluid/layers/control_flow.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -174,7 +174,7 @@ def Print(input, print_tensor_type (bool): Print the tensor type. print_tensor_shape (bool): Print the tensor shape. print_tensor_lod (bool): Print the tensor lod. - print_phase (bool): Which phase to displace, including 'forward', + print_phase (str): Which phase to displace, including 'forward', 'backward' and 'both'. If set to 'backward' or 'both', will print the gradients of input tensor. @@ -237,12 +237,13 @@ class ParallelDo(object): ParallelDo class is used to create a ParallelDo. """ - def __init__(self, places, name=None): + def __init__(self, places, use_nccl=False, name=None): self.helper = LayerHelper("parallel_do", name=name) self.inputs = [] self.places = places self.outputs = [] self.status = StaticRNN.BEFORE_RNN_BLOCK + self.use_nccl = use_nccl def do(self): return BlockGuardWithCompletion(self) @@ -325,7 +326,8 @@ class ParallelDo(object): }, outputs={'outputs': outputs, 'parallel_scopes': [step_scope]}, - attrs={'sub_block': current_block}) + attrs={'sub_block': current_block, + 'use_nccl': self.use_nccl}) class BlockGuardWithCompletion(BlockGuard): @@ -426,7 +428,8 @@ class StaticRNN(object): raise ValueError( "if init is None, memory at least need shape and batch_ref") parent_block = self.parent_block() - var_name = unique_name("@".join([self.helper.name, "memory_boot"])) + var_name = unique_name.generate("@".join( + [self.helper.name, "memory_boot"])) boot_var = parent_block.create_var( name=var_name, shape=shape, @@ -448,7 +451,7 @@ class StaticRNN(object): return self.memory(init=boot_var) else: pre_mem = self.helper.create_variable( - name=unique_name("@".join([self.helper.name, "mem"])), + name=unique_name.generate("@".join([self.helper.name, "mem"])), dtype=init.dtype, shape=init.shape) self.memories[pre_mem.name] = StaticRNNMemoryLink( @@ -612,7 +615,7 @@ class While(object): if not isinstance(cond, Variable): raise TypeError("condition should be a variable") assert isinstance(cond, Variable) - if cond.dtype != core.DataType.BOOL: + if cond.dtype != core.VarDesc.VarType.BOOL: raise TypeError("condition should be a bool variable") if reduce(lambda a, b: a * b, cond.shape, 1) != 1: raise TypeError("condition should be a bool scalar") @@ -650,7 +653,8 @@ class While(object): parent_block.append_op( type='while', inputs={ - 'X': [parent_block.var(x_name) for x_name in x_name_list], + 'X': + [parent_block.var_recursive(x_name) for x_name in x_name_list], 'Condition': [self.cond_var] }, outputs={'Out': out_vars, @@ -707,7 +711,7 @@ def lod_rank_table(x, level=0): helper = LayerHelper("lod_rank_table", **locals()) table = helper.create_variable( type=core.VarDesc.VarType.LOD_RANK_TABLE, - name=unique_name("lod_rank_table")) + name=unique_name.generate("lod_rank_table")) helper.append_op( type='lod_rank_table', inputs={'X': x}, @@ -805,7 +809,7 @@ def lod_tensor_to_array(x, table): """ helper = LayerHelper("lod_tensor_to_array", **locals()) array = helper.create_variable( - name=unique_name("lod_tensor_to_array"), + name=unique_name.generate("lod_tensor_to_array"), type=core.VarDesc.VarType.LOD_TENSOR_ARRAY, dtype=x.dtype) helper.append_op( @@ -1262,11 +1266,11 @@ class IfElse(object): if id(x) not in self.input_table: parent_block = self.parent_block() out_true = parent_block.create_var( - name=unique_name('ifelse_input' + self.helper.name), + name=unique_name.generate('ifelse_input' + self.helper.name), dtype=x.dtype) out_false = parent_block.create_var( - name=unique_name('ifelse_input' + self.helper.name), + name=unique_name.generate('ifelse_input' + self.helper.name), dtype=x.dtype) parent_block.append_op( type='split_lod_tensor', @@ -1308,7 +1312,8 @@ class IfElse(object): raise TypeError("Each output should be a variable") # create outside tensor outside_out = parent_block.create_var( - name=unique_name("_".join([self.helper.name, 'output'])), + name=unique_name.generate("_".join( + [self.helper.name, 'output'])), dtype=each_out.dtype) out_table.append(outside_out) @@ -1371,7 +1376,7 @@ class DynamicRNN(object): parent_block = self._parent_block_() if self.lod_rank_table is None: self.lod_rank_table = parent_block.create_var( - name=unique_name('lod_rank_table'), + name=unique_name.generate('lod_rank_table'), type=core.VarDesc.VarType.LOD_RANK_TABLE) self.lod_rank_table.stop_gradient = True parent_block.append_op( @@ -1379,7 +1384,8 @@ class DynamicRNN(object): inputs={"X": x}, outputs={"Out": self.lod_rank_table}) self.max_seq_len = parent_block.create_var( - name=unique_name('dynamic_rnn_max_seq_len'), dtype='int64') + name=unique_name.generate('dynamic_rnn_max_seq_len'), + dtype='int64') self.max_seq_len.stop_gradient = False parent_block.append_op( type='max_sequence_len', @@ -1393,7 +1399,7 @@ class DynamicRNN(object): outputs={'Out': self.cond}) input_array = parent_block.create_var( - name=unique_name('dynamic_rnn_input_array'), + name=unique_name.generate('dynamic_rnn_input_array'), type=core.VarDesc.VarType.LOD_TENSOR_ARRAY, dtype=x.dtype) self.input_array.append((input_array, x.dtype)) @@ -1414,7 +1420,7 @@ class DynamicRNN(object): "static_input() must be called after step_input().") parent_block = self._parent_block_() x_reordered = parent_block.create_var( - name=unique_name("dynamic_rnn_static_input_reordered"), + name=unique_name.generate("dynamic_rnn_static_input_reordered"), type=core.VarDesc.VarType.LOD_TENSOR, dtype=x.dtype) parent_block.append_op( @@ -1476,7 +1482,7 @@ class DynamicRNN(object): 'invoked before ' 'memory(init=init, need_reordered=True, ...).') init_reordered = parent_block.create_var( - name=unique_name('dynamic_rnn_mem_init_reordered'), + name=unique_name.generate('dynamic_rnn_mem_init_reordered'), type=core.VarDesc.VarType.LOD_TENSOR, dtype=init.dtype) parent_block.append_op( @@ -1488,7 +1494,7 @@ class DynamicRNN(object): outputs={'Out': [init_reordered]}) init_tensor = init_reordered mem_array = parent_block.create_var( - name=unique_name('dynamic_rnn_mem_array'), + name=unique_name.generate('dynamic_rnn_mem_array'), type=core.VarDesc.VarType.LOD_TENSOR_ARRAY, dtype=init.dtype) parent_block.append_op( @@ -1508,9 +1514,10 @@ class DynamicRNN(object): ) parent_block = self._parent_block_() init = parent_block.create_var( - name=unique_name('mem_init'), dtype=dtype) + name=unique_name.generate('mem_init'), dtype=dtype) arr, dtype = self.input_array[0] - in0 = parent_block.create_var(name=unique_name('in0'), dtype=dtype) + in0 = parent_block.create_var( + name=unique_name.generate('in0'), dtype=dtype) parent_block.append_op( type='read_from_array', inputs={'X': [arr], @@ -1549,7 +1556,7 @@ class DynamicRNN(object): parent_block = self._parent_block_() for each in outputs: outside_array = parent_block.create_var( - name=unique_name("_".join( + name=unique_name.generate("_".join( [self.helper.name, "output_array", each.name])), type=core.VarDesc.VarType.LOD_TENSOR_ARRAY, dtype=each.dtype) diff --git a/python/paddle/fluid/layers/detection.py b/python/paddle/fluid/layers/detection.py new file mode 100644 index 0000000000000000000000000000000000000000..5ae4da1ea31d036217c5595f8b30842403896a7c --- /dev/null +++ b/python/paddle/fluid/layers/detection.py @@ -0,0 +1,717 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +All layers just related to the detection neural network. +""" + +from layer_function_generator import generate_layer_fn +from ..layer_helper import LayerHelper +import tensor +import ops +import nn +import math + +__all__ = [ + 'multi_box_head', + 'bipartite_match', + 'target_assign', + 'detection_output', + 'ssd_loss', +] + +__auto__ = [ + 'iou_similarity', + 'box_coder', +] + +__all__ += __auto__ + +for _OP in set(__auto__): + globals()[_OP] = generate_layer_fn(_OP) + + +def detection_output(scores, + loc, + prior_box, + prior_box_var, + background_label=0, + nms_threshold=0.3, + nms_top_k=400, + keep_top_k=200, + score_threshold=0.01, + nms_eta=1.0): + """ + **Detection Output Layer** + + This layer applies the NMS to the output of network and computes the + predict bounding box location. The output's shape of this layer could + be zero if there is no valid bounding box. + + Args: + scores(Variable): A 3-D Tensor with shape [N, C, M] represents the + predicted confidence predictions. N is the batch size, C is the + class number, M is number of bounding boxes. For each category + there are total M scores which corresponding M bounding boxes. + loc(Variable): A 3-D Tensor with shape [N, M, 4] represents the + predicted locations of M bounding bboxes. N is the batch size, + and each bounding box has four coordinate values and the layout + is [xmin, ymin, xmax, ymax]. + prior_box(Variable): A 2-D Tensor with shape [M, 4] holds M boxes, + each box is represented as [xmin, ymin, xmax, ymax], + [xmin, ymin] is the left top coordinate of the anchor box, + if the input is image feature map, they are close to the origin + of the coordinate system. [xmax, ymax] is the right bottom + coordinate of the anchor box. + prior_box_var(Variable): A 2-D Tensor with shape [M, 4] holds M group + of variance. + background_label(float): The index of background label, + the background label will be ignored. If set to -1, then all + categories will be considered. + nms_threshold(float): The threshold to be used in NMS. + nms_top_k(int): Maximum number of detections to be kept according + to the confidences aftern the filtering detections based on + score_threshold. + keep_top_k(int): Number of total bboxes to be kept per image after + NMS step. -1 means keeping all bboxes after NMS step. + score_threshold(float): Threshold to filter out bounding boxes with + low confidence score. If not provided, consider all boxes. + nms_eta(float): The parameter for adaptive NMS. + + Returns: + The detected bounding boxes which are a Tensor. + + Examples: + .. code-block:: python + + pb = layers.data(name='prior_box', shape=[10, 4], + append_batch_size=False, dtype='float32') + pbv = layers.data(name='prior_box_var', shape=[10, 4], + append_batch_size=False, dtype='float32') + loc = layers.data(name='target_box', shape=[21, 4], + append_batch_size=False, dtype='float32') + scores = layers.data(name='scores', shape=[2, 21, 10], + append_batch_size=False, dtype='float32') + nmsed_outs = fluid.layers.detection_output(scores=scores, + loc=loc, + prior_box=pb, + prior_box_var=pbv) + """ + + helper = LayerHelper("detection_output", **locals()) + decoded_box = box_coder( + prior_box=prior_box, + prior_box_var=prior_box_var, + target_box=loc, + code_type='decode_center_size') + + nmsed_outs = helper.create_tmp_variable(dtype=decoded_box.dtype) + helper.append_op( + type="multiclass_nms", + inputs={'Scores': scores, + 'BBoxes': decoded_box}, + outputs={'Out': nmsed_outs}, + attrs={ + 'background_label': 0, + 'nms_threshold': nms_threshold, + 'nms_top_k': nms_top_k, + 'keep_top_k': keep_top_k, + 'score_threshold': score_threshold, + 'nms_eta': 1.0 + }) + return nmsed_outs + + +def bipartite_match(dist_matrix, name=None): + """ + **Bipartite matchint operator** + + This operator is a greedy bipartite matching algorithm, which is used to + obtain the matching with the maximum distance based on the input + distance matrix. For input 2D matrix, the bipartite matching algorithm can + find the matched column for each row, also can find the matched row for + each column. And this operator only calculate matched indices from column + to row. For each instance, the number of matched indices is the number of + of columns of the input ditance matrix. + + There are two outputs to save matched indices and distance. + A simple description, this algothrim matched the best (maximum distance) + row entity to the column entity and the matched indices are not duplicated + in each row of ColToRowMatchIndices. If the column entity is not matched + any row entity, set -1 in ColToRowMatchIndices. + + Please note that the input DistMat can be LoDTensor (with LoD) or Tensor. + If LoDTensor with LoD, the height of ColToRowMatchIndices is batch size. + If Tensor, the height of ColToRowMatchIndices is 1. + + Args: + dist_matrix(Variable): This input is a 2-D LoDTensor with shape + [K, M]. It is pair-wise distance matrix between the entities + represented by each row and each column. For example, assumed one + entity is A with shape [K], another entity is B with shape [M]. The + dist_matirx[i][j] is the distance between A[i] and B[j]. The bigger + the distance is, the better macthing the pairs are. Please note, + This tensor can contain LoD information to represent a batch of + inputs. One instance of this batch can contain different numbers of + entities. + Returns: + match_indices(Variable): A 2-D Tensor with shape [N, M] in int type. + N is the batch size. If match_indices[i][j] is -1, it + means B[j] does not match any entity in i-th instance. + Otherwise, it means B[j] is matched to row + match_indices[i][j] in i-th instance. The row number of + i-th instance is saved in match_indices[i][j]. + match_distance(Variable): A 2-D Tensor with shape [N, M] in float type. + N is batch size. If match_indices[i][j] is -1, + match_distance[i][j] is also -1.0. Otherwise, assumed + match_distance[i][j] = d, and the row offsets of each instance + are called LoD. Then match_distance[i][j] = dist_matrix[d+LoD[i]][j]. + """ + helper = LayerHelper('bipartite_match', **locals()) + match_indices = helper.create_tmp_variable(dtype='int32') + match_distance = helper.create_tmp_variable(dtype=dist_matrix.dtype) + helper.append_op( + type='bipartite_match', + inputs={'DistMat': dist_matrix}, + outputs={ + 'ColToRowMatchIndices': match_indices, + 'ColToRowMatchDist': match_distance + }) + return match_indices, match_distance + + +def target_assign(input, + matched_indices, + negative_indices=None, + mismatch_value=None, + name=None): + """ + **Target assigner operator** + + This operator can be, for given the target bounding boxes or labels, + to assign classification and regression targets to each prediction as well as + weights to prediction. The weights is used to specify which prediction would + not contribute to training loss. + + For each instance, the output `out` and`out_weight` are assigned based on + `match_indices` and `negative_indices`. + Assumed that the row offset for each instance in `input` is called lod, + this operator assigns classification/regression targets by performing the + following steps: + + 1. Assigning all outpts based on `match_indices`: + + If id = match_indices[i][j] > 0, + + out[i][j][0 : K] = X[lod[i] + id][j % P][0 : K] + out_weight[i][j] = 1. + + Otherwise, + + out[j][j][0 : K] = {mismatch_value, mismatch_value, ...} + out_weight[i][j] = 0. + + 2. Assigning out_weight based on `neg_indices` if `neg_indices` is provided: + + Assumed that the row offset for each instance in `neg_indices` is called neg_lod, + for i-th instance and each `id` of neg_indices in this instance: + + out[i][id][0 : K] = {mismatch_value, mismatch_value, ...} + out_weight[i][id] = 1.0 + + Args: + inputs (Variable): This input is a 3D LoDTensor with shape [M, P, K]. + matched_indices (Variable): Tensor), The input matched indices + is 2D Tenosr with shape [N, P], If MatchIndices[i][j] is -1, + the j-th entity of column is not matched to any entity of row in + i-th instance. + negative_indices (Variable): The input negative example indices are + an optional input with shape [Neg, 1] and int32 type, where Neg is + the total number of negative example indices. + mismatch_value (float32): Fill this value to the mismatched location. + + Returns: + out (Variable): The output is a 3D Tensor with shape [N, P, K], + N and P is the same as they are in `neg_indices`, K is the + same as it in input of X. If `match_indices[i][j]`. + out_weight (Variable): The weight for output with the shape of [N, P, 1]. + """ + helper = LayerHelper('target_assign', **locals()) + out = helper.create_tmp_variable(dtype=input.dtype) + out_weight = helper.create_tmp_variable(dtype='float32') + helper.append_op( + type='target_assign', + inputs={ + 'X': input, + 'MatchIndices': matched_indices, + 'NegIndices': negative_indices + }, + outputs={'Out': out, + 'OutWeight': out_weight}, + attrs={'mismatch_value': mismatch_value}) + return out, out_weight + + +def ssd_loss(location, + confidence, + gt_box, + gt_label, + prior_box, + prior_box_var=None, + background_label=0, + overlap_threshold=0.5, + neg_pos_ratio=3.0, + neg_overlap=0.5, + loc_loss_weight=1.0, + conf_loss_weight=1.0, + match_type='per_prediction', + mining_type='max_negative', + sample_size=None): + """ + **Multi-box loss layer for object dection algorithm of SSD** + + This layer is to compute dection loss for SSD given the location offset + predictions, confidence predictions, prior boxes and ground-truth boudding + boxes and labels, and the type of hard example mining. The returned loss + is a weighted sum of the localization loss (or regression loss) and + confidence loss (or classification loss) by performing the following steps: + + 1. Find matched boundding box by bipartite matching algorithm. + 1.1 Compute IOU similarity between ground-truth boxes and prior boxes. + 1.2 Compute matched boundding box by bipartite matching algorithm. + 2. Compute confidence for mining hard examples + 2.1. Get the target label based on matched indices. + 2.2. Compute confidence loss. + 3. Apply hard example mining to get the negative example indices and update + the matched indices. + 4. Assign classification and regression targets + 4.1. Encoded bbox according to the prior boxes. + 4.2. Assign regression targets. + 4.3. Assign classification targets. + 5. Compute the overall objective loss. + 5.1 Compute confidence loss. + 5.1 Compute localization loss. + 5.3 Compute the overall weighted loss. + + Args: + location (Variable): The location predictions are a 3D Tensor with + shape [N, Np, 4], N is the batch size, Np is total number of + predictions for each instance. 4 is the number of coordinate values, + the layout is [xmin, ymin, xmax, ymax]. + confidence (Variable): The confidence predictions are a 3D Tensor + with shape [N, Np, C], N and Np are the same as they are in + `location`, C is the class number. + gt_box (Variable): The ground-truth boudding boxes (bboxes) are a 2D + LoDTensor with shape [Ng, 4], Ng is the total number of ground-truth + bboxes of mini-batch input. + gt_label (Variable): The ground-truth labels are a 2D LoDTensor + with shape [Ng, 1]. + prior_box (Variable): The prior boxes are a 2D Tensor with shape [Np, 4]. + prior_box_var (Variable): The variance of prior boxes are a 2D Tensor + with shape [Np, 4]. + background_label (int): The index of background label, 0 by default. + overlap_threshold (float): If match_type is 'per_prediction', use + `overlap_threshold` to determine the extra matching bboxes when + finding matched boxes. 0.5 by default. + neg_pos_ratio (float): The ratio of the negative boxes to the positive + boxes, used only when mining_type is max_negative, 3.0 by defalut. + neg_overlap (float): The negative overlap upper bound for the unmatched + predictions. Use only when mining_type is max_negative, + 0.5 by default. + sample_size (int): The max sample size of negative box, used only when + mining_type is hard_example. + loc_loss_weight (float): Weight for localization loss, 1.0 by default. + conf_loss_weight (float): Weight for confidence loss, 1.0 by default. + match_type (str): The type of matching method during training, should + be 'bipartite' or 'per_prediction'. + mining_type (str): The hard example mining type, should be 'hard_example' + or 'max_negative', now only support `max_negative`. + + Returns: + Variable: The weighted sum of the localization loss and confidence loss, + with shape [N * Np, 1], N and Np are the same as they are + in `location`. + + Raises: + ValueError: If mining_type is 'hard_example', now only support + mining type of `max_negative`. + + Examples: + .. code-block:: python + + pb = layers.data( + name='prior_box', + shape=[10, 4], + append_batch_size=False, + dtype='float32') + pbv = layers.data( + name='prior_box_var', + shape=[10, 4], + append_batch_size=False, + dtype='float32') + loc = layers.data(name='target_box', shape=[10, 4], dtype='float32') + scores = layers.data(name='scores', shape=[10, 21], dtype='float32') + gt_box = layers.data( + name='gt_box', shape=[4], lod_level=1, dtype='float32') + gt_label = layers.data( + name='gt_label', shape=[1], lod_level=1, dtype='float32') + loss = layers.ssd_loss(loc, scores, gt_box, gt_label, pb, pbv) + """ + + helper = LayerHelper('ssd_loss', **locals()) + if mining_type != 'max_negative': + raise ValueError("Only support mining_type == max_negative now.") + + num, num_prior, num_class = confidence.shape + + def __reshape_to_2d(var): + return ops.reshape(x=var, shape=[-1, var.shape[-1]]) + + # 1. Find matched boundding box by prior box. + # 1.1 Compute IOU similarity between ground-truth boxes and prior boxes. + iou = iou_similarity(x=gt_box, y=prior_box) + # 1.2 Compute matched boundding box by bipartite matching algorithm. + matched_indices, matched_dist = bipartite_match(iou) + + # 2. Compute confidence for mining hard examples + # 2.1. Get the target label based on matched indices + gt_label = ops.reshape(x=gt_label, shape=gt_label.shape + (1, )) + target_label, _ = target_assign( + gt_label, matched_indices, mismatch_value=background_label) + # 2.2. Compute confidence loss. + # Reshape confidence to 2D tensor. + confidence = __reshape_to_2d(confidence) + target_label = tensor.cast(x=target_label, dtype='int64') + target_label = __reshape_to_2d(target_label) + conf_loss = nn.softmax_with_cross_entropy(confidence, target_label) + + # 3. Mining hard examples + conf_loss = ops.reshape(x=conf_loss, shape=(num, num_prior)) + neg_indices = helper.create_tmp_variable(dtype='int32') + dtype = matched_indices.dtype + updated_matched_indices = helper.create_tmp_variable(dtype=dtype) + helper.append_op( + type='mine_hard_examples', + inputs={ + 'ClsLoss': conf_loss, + 'LocLoss': None, + 'MatchIndices': matched_indices, + 'MatchDist': matched_dist, + }, + outputs={ + 'NegIndices': neg_indices, + 'UpdatedMatchIndices': updated_matched_indices + }, + attrs={ + 'neg_pos_ratio': neg_pos_ratio, + 'neg_dist_threshold': neg_pos_ratio, + 'mining_type': mining_type, + 'sample_size': sample_size, + }) + + # 4. Assign classification and regression targets + # 4.1. Encoded bbox according to the prior boxes. + encoded_bbox = box_coder( + prior_box=prior_box, + prior_box_var=prior_box_var, + target_box=gt_box, + code_type='encode_center_size') + # 4.2. Assign regression targets + target_bbox, target_loc_weight = target_assign( + encoded_bbox, updated_matched_indices, mismatch_value=background_label) + # 4.3. Assign classification targets + target_label, target_conf_weight = target_assign( + gt_label, + updated_matched_indices, + negative_indices=neg_indices, + mismatch_value=background_label) + + # 5. Compute loss. + # 5.1 Compute confidence loss. + target_label = __reshape_to_2d(target_label) + target_label = tensor.cast(x=target_label, dtype='int64') + conf_loss = nn.softmax_with_cross_entropy(confidence, target_label) + target_conf_weight = __reshape_to_2d(target_conf_weight) + conf_loss = conf_loss * target_conf_weight + + # 5.2 Compute regression loss. + location = __reshape_to_2d(location) + target_bbox = __reshape_to_2d(target_bbox) + + loc_loss = nn.smooth_l1(location, target_bbox) + target_loc_weight = __reshape_to_2d(target_loc_weight) + loc_loss = loc_loss * target_loc_weight + + # 5.3 Compute overall weighted loss. + loss = conf_loss_weight * conf_loss + loc_loss_weight * loc_loss + return loss + + +def multi_box_head(inputs, + image, + base_size, + num_classes, + aspect_ratios, + min_ratio, + max_ratio, + min_sizes=None, + max_sizes=None, + steps=None, + step_w=None, + step_h=None, + offset=0.5, + variance=[0.1, 0.1, 0.1, 0.1], + flip=False, + clip=False, + kernel_size=1, + pad=0, + stride=1, + name=None): + """ + **Prior_boxes** + + Generate prior boxes for SSD(Single Shot MultiBox Detector) + algorithm. The details of this algorithm, please refer the + section 2.2 of SSD paper (SSD: Single Shot MultiBox Detector) + `_ . + + Args: + inputs(list|tuple): The list of input Variables, the format + of all Variables is NCHW. + image(Variable): The input image data of PriorBoxOp, + the layout is NCHW. + base_size(int): the base_size is used to get min_size + and max_size according to min_ratio and max_ratio. + num_classes(int): The number of classes. + aspect_ratios(list|tuple): the aspect ratios of generated prior + boxes. The length of input and aspect_ratios must be equal. + min_ratio(int): the min ratio of generated prior boxes. + max_ratio(int): the max ratio of generated prior boxes. + min_sizes(list|tuple|None): If `len(inputs) <=2`, + min_sizes must be set up, and the length of min_sizes + should equal to the length of inputs. Default: None. + max_sizes(list|tuple|None): If `len(inputs) <=2`, + max_sizes must be set up, and the length of min_sizes + should equal to the length of inputs. Default: None. + steps(list|tuple): If step_w and step_h are the same, + step_w and step_h can be replaced by steps. + step_w(list|tuple): Prior boxes step + across width. If step_w[i] == 0.0, the prior boxes step + across width of the inputs[i] will be automatically + calculated. Default: None. + step_h(list|tuple): Prior boxes step across height, If + step_h[i] == 0.0, the prior boxes step across height of + the inputs[i] will be automatically calculated. Default: None. + offset(float): Prior boxes center offset. Default: 0.5 + variance(list|tuple): the variances to be encoded in prior boxes. + Default:[0.1, 0.1, 0.1, 0.1]. + flip(bool): Whether to flip aspect ratios. Default:False. + clip(bool): Whether to clip out-of-boundary boxes. Default: False. + kernel_size(int): The kernel size of conv2d. Default: 1. + pad(int|list|tuple): The padding of conv2d. Default:0. + stride(int|list|tuple): The stride of conv2d. Default:1, + name(str): Name of the prior box layer. Default: None. + + Returns: + mbox_loc(list): The predicted boxes' location of the inputs. + The layout of each element is [N, H, W, Priors]. Priors + is the number of predicted boxof each position of each input. + mbox_conf(list): The predicted boxes' confidence of the inputs. + The layout of each element is [N, H, W, Priors]. Priors + is the number of predicted box of each position of each input. + boxes(Variable): the output prior boxes of PriorBox. + The layout is [num_priors, 4]. num_priors is the total + box count of each position of inputs. + Variances(Variable): the expanded variances of PriorBox. + The layout is [num_priors, 4]. num_priors is the total + box count of each position of inputs + + + Examples: + .. code-block:: python + mbox_locs, mbox_confs, box, var = layers.multi_box_head( + inputs=[conv1, conv2, conv3, conv4, conv5, conv5], + image=images, + num_classes=21, + min_ratio=20, + max_ratio=90, + aspect_ratios=[[2.], [2., 3.], [2., 3.], [2., 3.], [2.], [2.]], + base_size=300, + offset=0.5, + flip=True, + clip=True) + """ + + def _prior_box_(input, + image, + min_sizes, + max_sizes, + aspect_ratios, + variance, + flip=False, + clip=False, + step_w=0.0, + step_h=0.0, + offset=0.5, + name=None): + helper = LayerHelper("prior_box", **locals()) + dtype = helper.input_dtype() + + box = helper.create_tmp_variable(dtype) + var = helper.create_tmp_variable(dtype) + helper.append_op( + type="prior_box", + inputs={"Input": input, + "Image": image}, + outputs={"Boxes": box, + "Variances": var}, + attrs={ + 'min_sizes': min_sizes, + 'max_sizes': max_sizes, + 'aspect_ratios': aspect_ratios, + 'variances': variance, + 'flip': flip, + 'clip': clip, + 'step_w': step_w, + 'step_h': step_h, + 'offset': offset + }) + return box, var + + def _reshape_with_axis_(input, axis=1): + if not (axis > 0 and axis < len(input.shape)): + raise ValueError("The axis should be smaller than " + "the arity of input and bigger than 0.") + new_shape = [ + -1, reduce(lambda x, y: x * y, input.shape[axis:len(input.shape)]) + ] + out = ops.reshape(x=input, shape=new_shape) + return out + + def _is_list_or_tuple_(data): + return (isinstance(data, list) or isinstance(data, tuple)) + + def _is_list_or_tuple_and_equal(data, length, err_info): + if not (_is_list_or_tuple_(data) and len(data) == length): + raise ValueError(err_info) + + if not _is_list_or_tuple_(inputs): + raise ValueError('inputs should be a list or tuple.') + + num_layer = len(inputs) + + if num_layer <= 2: + assert min_sizes is not None and max_sizes is not None + assert len(min_sizes) == num_layer and len(max_sizes) == num_layer + else: + min_sizes = [] + max_sizes = [] + step = int(math.floor(((max_ratio - min_ratio)) / (num_layer - 2))) + for ratio in xrange(min_ratio, max_ratio + 1, step): + min_sizes.append(base_size * ratio / 100.) + max_sizes.append(base_size * (ratio + step) / 100.) + min_sizes = [base_size * .10] + min_sizes + max_sizes = [base_size * .20] + max_sizes + + if aspect_ratios: + _is_list_or_tuple_and_equal( + aspect_ratios, num_layer, + 'aspect_ratios should be list or tuple, and the length of inputs ' + 'and aspect_ratios should be the same.') + if step_h: + _is_list_or_tuple_and_equal( + step_h, num_layer, + 'step_h should be list or tuple, and the length of inputs and ' + 'step_h should be the same.') + if step_w: + _is_list_or_tuple_and_equal( + step_w, num_layer, + 'step_w should be list or tuple, and the length of inputs and ' + 'step_w should be the same.') + if steps: + _is_list_or_tuple_and_equal( + steps, num_layer, + 'steps should be list or tuple, and the length of inputs and ' + 'step_w should be the same.') + step_w = steps + step_h = steps + + mbox_locs = [] + mbox_confs = [] + box_results = [] + var_results = [] + for i, input in enumerate(inputs): + min_size = min_sizes[i] + max_size = max_sizes[i] + + if not _is_list_or_tuple_(min_size): + min_size = [min_size] + if not _is_list_or_tuple_(max_size): + max_size = [max_size] + if not (len(max_size) == len(min_size)): + raise ValueError( + 'the length of max_size and min_size should be equal.') + + aspect_ratio = [] + if aspect_ratios is not None: + aspect_ratio = aspect_ratios[i] + if not _is_list_or_tuple_(aspect_ratio): + aspect_ratio = [aspect_ratio] + + box, var = _prior_box_(input, image, min_size, max_size, aspect_ratio, + variance, flip, clip, step_w[i] + if step_w else 0.0, step_h[i] + if step_w else 0.0, offset) + + box_results.append(box) + var_results.append(var) + + num_boxes = box.shape[2] + + # get box_loc + num_loc_output = num_boxes * num_classes * 4 + mbox_loc = nn.conv2d( + input=input, + num_filters=num_loc_output, + filter_size=kernel_size, + padding=pad, + stride=stride) + + mbox_loc = nn.transpose(mbox_loc, perm=[0, 2, 3, 1]) + mbox_locs.append(mbox_loc) + + # get conf_loc + num_conf_output = num_boxes * num_classes + conf_loc = nn.conv2d( + input=input, + num_filters=num_conf_output, + filter_size=kernel_size, + padding=pad, + stride=stride) + conf_loc = nn.transpose(conf_loc, perm=[0, 2, 3, 1]) + mbox_confs.append(conf_loc) + + if len(box_results) == 1: + box = box_results[0] + var = var_results[0] + else: + reshaped_boxes = [] + reshaped_vars = [] + for i in range(len(box_results)): + reshaped_boxes.append(_reshape_with_axis_(box_results[i], axis=3)) + reshaped_vars.append(_reshape_with_axis_(var_results[i], axis=3)) + + box = tensor.concat(reshaped_boxes) + var = tensor.concat(reshaped_vars) + + return mbox_locs, mbox_confs, box, var diff --git a/python/paddle/v2/fluid/layers/device.py b/python/paddle/fluid/layers/device.py similarity index 87% rename from python/paddle/v2/fluid/layers/device.py rename to python/paddle/fluid/layers/device.py index 107511b5f4ab1108610bc1326f30e5d9ab407853..e0c1aab230aeed7fb858e91e7da7eae58032ee16 100644 --- a/python/paddle/v2/fluid/layers/device.py +++ b/python/paddle/fluid/layers/device.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,7 +25,8 @@ __all__ = ['get_places'] @autodoc() def get_places(device_count=None, device_type=None): helper = LayerHelper('get_places', **locals()) - out_places = helper.create_variable(name=unique_name(helper.name + ".out")) + out_places = helper.create_variable( + name=unique_name.generate(helper.name + ".out")) attrs = dict() if device_count is not None: attrs['device_count'] = int(device_count) diff --git a/python/paddle/v2/fluid/layers/io.py b/python/paddle/fluid/layers/io.py similarity index 99% rename from python/paddle/v2/fluid/layers/io.py rename to python/paddle/fluid/layers/io.py index 85e44a0e5149bd36f2787d9f2d516dbe4abdbb2e..af3ae54248a744e7e2fed8190aeeb0eb481cb315 100644 --- a/python/paddle/v2/fluid/layers/io.py +++ b/python/paddle/fluid/layers/io.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/layers/layer_function_generator.py b/python/paddle/fluid/layers/layer_function_generator.py similarity index 99% rename from python/paddle/v2/fluid/layers/layer_function_generator.py rename to python/paddle/fluid/layers/layer_function_generator.py index b0e4d1635f7b5d0afdfa677e6ec1e8f9245a9d54..88c9ae31b7902a1b098700839fb533c013b03103 100644 --- a/python/paddle/v2/fluid/layers/layer_function_generator.py +++ b/python/paddle/fluid/layers/layer_function_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/layers/math_op_patch.py b/python/paddle/fluid/layers/math_op_patch.py similarity index 95% rename from python/paddle/v2/fluid/layers/math_op_patch.py rename to python/paddle/fluid/layers/math_op_patch.py index d829bba1b101cc802ea29f32e0b7ecdb1ac448f5..faccc3ddf827e4211c9f2e61da7138e5d43f1d11 100644 --- a/python/paddle/v2/fluid/layers/math_op_patch.py +++ b/python/paddle/fluid/layers/math_op_patch.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ __all__ = ['monkey_patch_variable'] def monkey_patch_variable(): def unique_tmp_name(): - return unique_name("tmp") + return unique_name.generate("tmp") def safe_get_dtype(var): try: @@ -157,7 +157,9 @@ def monkey_patch_variable(): ("__eq__", "equal", False), ("__ne__", "not_equal", False), ("__lt__", "less_than", False), - ("__le__", "less_equal", False)): + ("__le__", "less_equal", False), + ("__gt__", "greater_than", False), + ("__ge__", "greater_equal", False)): setattr(Variable, method_name, _elemwise_method_creator_(method_name, op_type, reverse)) diff --git a/python/paddle/v2/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py similarity index 97% rename from python/paddle/v2/fluid/layers/nn.py rename to python/paddle/fluid/layers/nn.py index 051b5368180d3f7951b100c26fb7367372d9a343..3453dd945d558a93a854f99209a6ea8055875d84 100644 --- a/python/paddle/v2/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,6 +68,7 @@ __all__ = [ 'layer_norm', 'softmax_with_cross_entropy', 'smooth_l1', + 'one_hot', ] @@ -103,7 +104,7 @@ def fc(input, * :math:`X_i`: The input tensor. * :math:`W`: The weights created by this layer. * :math:`b`: The bias parameter created by this layer (if needed). - * :math:`Act`: The activation funtion. + * :math:`Act`: The activation function. * :math:`Out`: The output tensor. Args: @@ -220,7 +221,7 @@ def embedding(input, :math:`padding_idx < 0`, the padding_idx to use in lookup is :math:`size[0] + dim`. param_attr(ParamAttr): Parameters for this layer - dtype(np.dtype|core.DataType|str): The type of data : float32, float_16, int etc + dtype(np.dtype|core.VarDesc.VarType|str): The type of data : float32, float_16, int etc Returns: Variable: The tensor variable storing the embeddings of the \ @@ -831,12 +832,12 @@ def crf_decoding(input, param_attr, label=None): return viterbi_path -def cos_sim(X, Y, **kwargs): +def cos_sim(X, Y): """ This function performs the cosine similarity between two tensors X and Y and returns that as the output. """ - helper = LayerHelper('cos_sim', **kwargs) + helper = LayerHelper('cos_sim', **locals()) out = helper.create_tmp_variable(dtype=X.dtype) xnorm = helper.create_tmp_variable(dtype=X.dtype) ynorm = helper.create_tmp_variable(dtype=X.dtype) @@ -850,7 +851,7 @@ def cos_sim(X, Y, **kwargs): return out -def dropout(x, dropout_prob, is_test=False, seed=None, **kwargs): +def dropout(x, dropout_prob, is_test=False, seed=None): """ Computes dropout. @@ -879,7 +880,7 @@ def dropout(x, dropout_prob, is_test=False, seed=None, **kwargs): droped = fluid.layers.dropout(input=x, dropout_rate=0.5) """ - helper = LayerHelper('dropout', **kwargs) + helper = LayerHelper('dropout', **locals()) out = helper.create_tmp_variable(dtype=x.dtype) mask = helper.create_tmp_variable(dtype=x.dtype, stop_gradient=True) helper.append_op( @@ -896,7 +897,7 @@ def dropout(x, dropout_prob, is_test=False, seed=None, **kwargs): return out -def cross_entropy(input, label, **kwargs): +def cross_entropy(input, label, soft_label=False): """ **Cross Entropy Layer** @@ -905,15 +906,15 @@ def cross_entropy(input, label, **kwargs): computation. 1) One-hot cross-entropy: - `soft_label = False`, `Label[i, 0]` indicates the class index for sample i: + `soft_label = False`, `Label[i, 0]` indicates the class index for sample i: .. math:: Y[i] = -\log(X[i, Label[i]]) 2) Soft-label cross-entropy: - `soft_label = True`, `Label[i, j]` indicates the soft label of class j - for sample i: + `soft_label = True`, `Label[i, j]` indicates the soft label of class j + for sample i: .. math:: @@ -923,8 +924,8 @@ def cross_entropy(input, label, **kwargs): equals one. 3) One-hot cross-entropy with vecterized `label`: - As a special case of 2), when each row of 'label' has only one - non-zero element which is equal to 1, soft-label cross-entropy degenerates + As a special case of 2), when each row of 'label' has only one + non-zero element which is equal to 1, soft-label cross-entropy degenerates to a one-hot cross-entropy with one-hot label representation. Args: @@ -938,7 +939,7 @@ def cross_entropy(input, label, **kwargs): tensor with shape [N x 1]. When `soft_label` is set to `True`, `label` is a tensor with shape [N x D]. - soft_label (bool, via `**kwargs`): a flag indicating whether to + soft_label (bool): a flag indicating whether to interpretate the given labels as soft labels, default `False`. @@ -958,18 +959,18 @@ def cross_entropy(input, label, **kwargs): predict = fluid.layers.fc(input=net, size=classdim, act='softmax') cost = fluid.layers.cross_entropy(input=predict, label=label) """ - helper = LayerHelper('cross_entropy', **kwargs) + helper = LayerHelper('cross_entropy', **locals()) out = helper.create_tmp_variable(dtype=input.dtype) helper.append_op( type='cross_entropy', inputs={'X': [input], 'Label': [label]}, outputs={'Y': [out]}, - attrs=kwargs) + attrs={"soft_label": soft_label}) return out -def square_error_cost(input, label, **kwargs): +def square_error_cost(input, label): """ **Square error cost layer** @@ -1004,7 +1005,7 @@ def square_error_cost(input, label, **kwargs): cost = layers.square_error_cost(input=y_predict, label=y) """ - helper = LayerHelper('square_error_cost', **kwargs) + helper = LayerHelper('square_error_cost', **locals()) minus_out = helper.create_tmp_variable(dtype=input.dtype) helper.append_op( type='elementwise_sub', @@ -1019,12 +1020,12 @@ def square_error_cost(input, label, **kwargs): return square_out -def accuracy(input, label, k=1, correct=None, total=None, **kwargs): +def accuracy(input, label, k=1, correct=None, total=None): """ This function computes the accuracy using the input and label. The output is the top_k inputs and their indices. """ - helper = LayerHelper("accuracy", **kwargs) + helper = LayerHelper("accuracy", **locals()) topk_out = helper.create_tmp_variable(dtype=input.dtype) topk_indices = helper.create_tmp_variable(dtype="int64") helper.append_op( @@ -1057,13 +1058,12 @@ def chunk_eval(input, label, chunk_scheme, num_chunk_types, - excluded_chunk_types=None, - **kwargs): + excluded_chunk_types=None): """ This function computes and outputs the precision, recall and F1-score of chunk detection. """ - helper = LayerHelper("chunk_eval", **kwargs) + helper = LayerHelper("chunk_eval", **locals()) # prepare output precision = helper.create_tmp_variable(dtype="float32") @@ -1295,7 +1295,7 @@ def conv2d(input, return helper.append_activation(pre_act) -def sequence_pool(input, pool_type, **kwargs): +def sequence_pool(input, pool_type): """ This function add the operator for sequence pooling. It pools features of all time-steps of each instance, and is applied @@ -1345,7 +1345,7 @@ def sequence_pool(input, pool_type, **kwargs): sqrt_x = fluid.layers.sequence_pool(input=x, pool_type='sqrt') max_x = fluid.layers.sequence_pool(input=x, pool_type='max') """ - helper = LayerHelper('sequence_pool', input=input, **kwargs) + helper = LayerHelper('sequence_pool', **locals()) dtype = helper.input_dtype() pool_out = helper.create_tmp_variable(dtype) max_index = helper.create_tmp_variable(dtype) @@ -1365,7 +1365,7 @@ def sequence_pool(input, pool_type, **kwargs): return pool_out -def sequence_first_step(input, **kwargs): +def sequence_first_step(input): """ This funciton get the first step of sequence. @@ -1398,7 +1398,7 @@ def sequence_first_step(input, **kwargs): return sequence_pool(input=input, pool_type="first") -def sequence_last_step(input, **kwargs): +def sequence_last_step(input): """ This funciton get the last step of sequence. @@ -1519,21 +1519,21 @@ def batch_norm(input, bias = helper.create_parameter( attr=helper.bias_attr, shape=param_shape, dtype=dtype, is_bias=True) - mean = helper.create_global_variable( - name=moving_mean_name, - dtype=input.dtype, + mean = helper.create_parameter( + attr=ParamAttr( + name=moving_mean_name, initializer=Constant(0.0), trainable=False), shape=param_shape, - persistable=True, - stop_gradient=True) - helper.set_variable_initializer(var=mean, initializer=Constant(0.0)) + dtype=input.dtype) + mean.stop_gradient = True - variance = helper.create_global_variable( - name=moving_variance_name, - dtype=input.dtype, + variance = helper.create_parameter( + attr=ParamAttr( + name=moving_variance_name, + initializer=Constant(1.0), + trainable=False), shape=param_shape, - persistable=True, - stop_gradient=True) - helper.set_variable_initializer(var=variance, initializer=Constant(1.0)) + dtype=input.dtype) + variance.stop_gradient = True # create output # mean and mean_out share the same memory @@ -1580,7 +1580,7 @@ def layer_norm(input, """ **Layer Normalization** - Assume feature vectors exist on dimensions + Assume feature vectors exist on dimensions :attr:`begin_norm_axis ... rank(input)` and calculate the moment statistics along these dimensions for each feature vector :math:`a` with size :math:`H`, then normalize each feature vector using the corresponding @@ -1601,13 +1601,13 @@ def layer_norm(input, Args: input(Variable): The input tensor variable. - scale(bool): Whether to learn the adaptive gain :math:`g` after + scale(bool): Whether to learn the adaptive gain :math:`g` after normalization. - shift(bool): Whether to learn the adaptive bias :math:`b` after + shift(bool): Whether to learn the adaptive bias :math:`b` after normalization. - begin_norm_axis(bool): The normalization will be performed along + begin_norm_axis(bool): The normalization will be performed along dimensions from :attr:`begin_norm_axis` to :attr:`rank(input)`. - epsilon(float): The small value added to the variance to prevent + epsilon(float): The small value added to the variance to prevent division by zero. param_attr(ParamAttr|None): The parameter attribute for the learnable gain :math:`g`. @@ -2071,7 +2071,7 @@ def reduce_sum(input, dim=None, keep_dim=False, name=None): Tensor variable with a single element, otherwise must be in the range :math:`[-rank(input), rank(input))`. If :math:`dim < 0`, the dimension to reduce is :math:`rank + dim`. - keep_dim (bool): Whether to reserve the reduced dimension in the + keep_dim (bool|False): Whether to reserve the reduced dimension in the output Tensor. The result tensor will have one fewer dimension than the :attr:`input` unless :attr:`keep_dim` is true. name(str|None): A name for this layer(optional). If set None, the layer @@ -2338,7 +2338,8 @@ def l2_normalize(x, axis, epsilon=1e-12, name=None): normed = fluid.layers.l2_normalize(x=data, axis=1) """ - if len(x.shape) == 1: axis = 0 + if len(x.shape) == 1: + axis = 0 helper = LayerHelper("l2_normalize", **locals()) @@ -2656,7 +2657,7 @@ def ctc_greedy_decoder(input, blank, name=None): return ctc_out -def warpctc(input, label, blank=0, norm_by_times=False, **kwargs): +def warpctc(input, label, blank=0, norm_by_times=False): """ An operator integrating the open source Warp-CTC library (https://github.com/baidu-research/warp-ctc) @@ -2697,7 +2698,7 @@ def warpctc(input, label, blank=0, norm_by_times=False, **kwargs): cost = layers.warpctc(input=y_predict, label=y) """ - helper = LayerHelper('warpctc', **kwargs) + helper = LayerHelper('warpctc', **locals()) loss_out = helper.create_tmp_variable(dtype=input.dtype) grad_out = helper.create_tmp_variable(dtype=input.dtype) helper.append_op( @@ -3098,33 +3099,33 @@ def multiplex(inputs, index): def softmax_with_cross_entropy(logits, label, soft_label=False): """ **Softmax With Cross Entropy Operator.** - + Cross entropy loss with softmax is used as the output layer extensively. This operator computes the softmax normalized values for each row of the input tensor, after which cross-entropy loss is computed. This provides a more numerically stable gradient. - + Because this operator performs a softmax on logits internally, it expects unscaled logits. This operator should not be used with the output of softmax operator since that would produce incorrect results. - + When the attribute soft_label is set false, this operators expects mutually exclusive hard labels, each sample in a batch is in exactly one class with a probability of 1.0. Each sample in the batch will have a single label. - + The equation is as follows: - + 1) Hard label (one-hot label, so every sample has exactly one class) - + .. math:: loss_j = -\\text{logit}_{label_j} + \\log\\left(\\sum_{i=0}^{K}\\exp(\\text{logit}_i)\\right), j = 1,..., K - + 2) Soft label (each sample can have a distribution over all classes) .. math:: - + loss_j = -\\sum_{i=0}^{K}\\text{label}_i \\left(\\text{logit}_i - \\log\\left(\\sum_{i=0}^{K} \\exp(\\text{logit}_i)\\right)\\right), j = 1,...,K @@ -3169,7 +3170,7 @@ def smooth_l1(x, y, inside_weight=None, outside_weight=None, sigma=None): The operator takes the first dimension of X and Y as batch size. For each instance, it computes the smooth l1 loss element by element first and then sums all the losses. So the shape of Out is [batch_size, 1]. - + Args: x (Variable): A tensor with rank at least 2. The input value of smooth l1 loss op with shape [batch_size, dim1, ..., dimN]. @@ -3212,3 +3213,40 @@ def smooth_l1(x, y, inside_weight=None, outside_weight=None, sigma=None): 'Out': loss}, attrs={'sigma': sigma}) return loss + + +def one_hot(input, depth): + """ + One Hot Operator. This operator creates the one-hot representations for input + index values. The following example will help to explain the function of this + operator. + + Args: + input(Tensor/LodTensor): A Tensor/LodTensor of indices, last dimension must be 1. + depth(scalar): an interger defining the depth of the one hot dimension. + + Returns: + The one-hot tensor or LodTensor, same as input. + + Examples: + X is a LoDTensor: + X.lod = [[0, 1, 4]] + X.shape = [4, 1] + X.data = [[1], [1], [3], [0]] + set depth = 4 + Out is a LoDTensor: + Out.lod = [[0, 1, 4]] + Out.shape = [4, 4] + Out.data = [[0., 1., 0., 0.], + [0., 1., 0., 0.], + [0., 0., 0., 1.], + [1., 0., 0., 0.]] + """ + helper = LayerHelper("one_hot", **locals()) + one_hot_out = helper.create_tmp_variable(dtype='float32') + helper.append_op( + type="one_hot", + inputs={'X': input}, + attrs={'depth': depth}, + outputs={'Out': one_hot_out}) + return one_hot_out diff --git a/python/paddle/v2/fluid/layers/ops.py b/python/paddle/fluid/layers/ops.py similarity index 90% rename from python/paddle/v2/fluid/layers/ops.py rename to python/paddle/fluid/layers/ops.py index bb3f71abbb00793a32b8c288ee3ea255cc9c584d..0b88b639629ac73b16ec36aa5930c3d6a9665943 100644 --- a/python/paddle/v2/fluid/layers/ops.py +++ b/python/paddle/fluid/layers/ops.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,6 +66,9 @@ __all__ = [ 'logical_xor', 'logical_not', 'uniform_random', + 'uniform_random_batch_size_like', + 'gaussian_random', + 'gaussian_random_batch_size_like', 'cumsum', ] + __activations__ diff --git a/python/paddle/v2/fluid/layers/tensor.py b/python/paddle/fluid/layers/tensor.py similarity index 95% rename from python/paddle/v2/fluid/layers/tensor.py rename to python/paddle/fluid/layers/tensor.py index 2d4e0ab0cc66861d8bd31e196740688ab8fa6262..97e8f082cffe2b139fb40ddbf9b27f463f47c8ab 100644 --- a/python/paddle/v2/fluid/layers/tensor.py +++ b/python/paddle/fluid/layers/tensor.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ from ..param_attr import ParamAttr from ..framework import convert_np_dtype_to_dtype_ from ..framework import Variable from ..initializer import Constant, force_init_on_cpu -from ..core import DataType +from ..core import VarDesc import numpy __all__ = [ @@ -199,10 +199,10 @@ def assign(input, output): attrs={'scale': 1.0}) elif isinstance(input, numpy.ndarray): dtype = convert_np_dtype_to_dtype_(input.dtype) - if dtype == DataType.FP32: + if dtype == VarDesc.VarType.FP32: value_name = "fp32_values" values = [float(v) for v in input.flat] - elif dtype == DataType.INT32: + elif dtype == VarDesc.VarType.INT32: value_name = "int32_values" values = [int(v) for v in input.flat] else: @@ -236,7 +236,7 @@ def fill_constant(shape, dtype, value, force_cpu=False, out=None): Args: shape(tuple|list|None): Shape of the output tensor. - dtype(np.dtype|core.DataType|str): Data type of the output tensor. + dtype(np.dtype|core.VarDesc.VarType|str): Data type of the output tensor. value(float): The constant value used to initialize the output tensor. out(Variable): The output tensor. force_cpu(True|False): data should be on CPU if set true. @@ -285,7 +285,7 @@ def fill_constant_batch_size_like(input, Args: input(Variable): Tensor whose dimensions will be used to get batch size shape(tuple|list|None): Shape of output tensor - dtype(np.dtype|core.DataType|str): Data type of output tensor + dtype(np.dtype|core.VarDesc.VarType|str): Data type of output tensor value(float): Constant value to initialize the output tensor input_dim_idx(int): Index of input's batch size dimension output_dim_idx(int): Index of output's batch size dimension @@ -327,7 +327,7 @@ def ones(shape, dtype, force_cpu=False): Args: shape(tuple|list|None): Shape of output tensor - dtype(np.dtype|core.DataType|str): Data type of output tensor + dtype(np.dtype|core.VarDesc.VarType|str): Data type of output tensor Returns: Variable: The tensor variable storing the output @@ -351,7 +351,7 @@ def zeros(shape, dtype, force_cpu=False): Args: shape(tuple|list|None): Shape of output tensor - dtype(np.dtype|core.DataType|str): Data type of output tensor + dtype(np.dtype|core.VarDesc.VarType|str): Data type of output tensor Returns: Variable: The tensor variable storing the output diff --git a/python/paddle/v2/fluid/learning_rate_decay.py b/python/paddle/fluid/learning_rate_decay.py similarity index 100% rename from python/paddle/v2/fluid/learning_rate_decay.py rename to python/paddle/fluid/learning_rate_decay.py diff --git a/python/paddle/v2/fluid/memory_optimization_transpiler.py b/python/paddle/fluid/memory_optimization_transpiler.py similarity index 92% rename from python/paddle/v2/fluid/memory_optimization_transpiler.py rename to python/paddle/fluid/memory_optimization_transpiler.py index 53e0991ee8c318e0c95018b57ad48f404ce8beae..6952ca7fe49931b9ebc84e214569c47d632d2a06 100644 --- a/python/paddle/v2/fluid/memory_optimization_transpiler.py +++ b/python/paddle/fluid/memory_optimization_transpiler.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,13 +20,13 @@ from backward import _rename_arg_ from . import core dtype_to_size = { - core.DataType.FP16: 2, - core.DataType.FP32: 4, - core.DataType.FP64: 8, - core.DataType.INT16: 2, - core.DataType.INT32: 4, - core.DataType.INT64: 8, - core.DataType.BOOL: 1 + core.VarDesc.VarType.FP16: 2, + core.VarDesc.VarType.FP32: 4, + core.VarDesc.VarType.FP64: 8, + core.VarDesc.VarType.INT16: 2, + core.VarDesc.VarType.INT32: 4, + core.VarDesc.VarType.INT64: 8, + core.VarDesc.VarType.BOOL: 1 } @@ -223,15 +223,15 @@ def get_cfgs(input_program): # Find while/while_grad block pair for grad_id in while_grad_sub_block_ids: - parent_id = pdesc.block(grad_id).parent - if parent_id in while_sub_block_ids: - while_block_id_pair.append((parent_id, grad_id)) - while_sub_block_ids.remove(parent_id) + forward_id = pdesc.block(grad_id).get_forward_block_idx() + if forward_id in while_sub_block_ids: + while_block_id_pair.append((forward_id, grad_id)) + while_sub_block_ids.remove(forward_id) # Get while/while_grad block ops - for parent_id, grad_id in while_block_id_pair: + for forward_id, grad_id in while_block_id_pair: while_block_ops = [] - while_block = pdesc.block(parent_id) + while_block = pdesc.block(forward_id) while_block_op_size = while_block.op_size() for i in range(while_block_op_size): while_block_ops.append(while_block.op(i)) @@ -242,21 +242,21 @@ def get_cfgs(input_program): while_block_ops.append(while_grad_block.op(i)) while_op_output = set() - while_op_output.update(while_op_dict[parent_id].output_arg_names()) + while_op_output.update(while_op_dict[forward_id].output_arg_names()) while_op_output.update(while_op_dict[grad_id].output_arg_names()) ops_list.append((while_block_ops, while_block_op_size, while_op_output)) # Process rest while block ops - for parent_id in while_sub_block_ids: + for forward_id in while_sub_block_ids: while_block_ops = [] - while_block = pdesc.block(parent_id) + while_block = pdesc.block(forward_id) while_block_op_size = while_block.op_size() for i in range(while_block_op_size): while_block_ops.append(while_block.op(i)) while_op_output = set() - while_op_output.update(while_op_dict[parent_id].output_arg_names()) + while_op_output.update(while_op_dict[forward_id].output_arg_names()) ops_list.append((while_block_ops, while_block_op_size, while_op_output)) diff --git a/python/paddle/v2/fluid/net_drawer.py b/python/paddle/fluid/net_drawer.py similarity index 95% rename from python/paddle/v2/fluid/net_drawer.py rename to python/paddle/fluid/net_drawer.py index 9b126f51971acabba73db7bd6c33ba39e8876ca3..73946a0721dc4a6d03074a4708cf574951412e66 100644 --- a/python/paddle/v2/fluid/net_drawer.py +++ b/python/paddle/fluid/net_drawer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ import json import logging from collections import defaultdict -import paddle.v2.fluid.core as core -import paddle.v2.fluid.proto.framework_pb2 as framework_pb2 +import paddle.fluid.core as core +import paddle.fluid.proto.framework_pb2 as framework_pb2 logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) diff --git a/python/paddle/v2/fluid/nets.py b/python/paddle/fluid/nets.py similarity index 99% rename from python/paddle/v2/fluid/nets.py rename to python/paddle/fluid/nets.py index be7878f869b509fa1117e305aee662cc0123bbcc..c161d93854ae2b60b3d2b4d80612ac5efddc4c21 100644 --- a/python/paddle/v2/fluid/nets.py +++ b/python/paddle/fluid/nets.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/op.py b/python/paddle/fluid/op.py similarity index 98% rename from python/paddle/v2/fluid/op.py rename to python/paddle/fluid/op.py index f368e0c2d86b233cba49b312febf1293c91f91a2..0b76e94157e378b40baff641c466968e239d8a83 100644 --- a/python/paddle/v2/fluid/op.py +++ b/python/paddle/fluid/op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.core as core -import paddle.v2.fluid.proto.framework_pb2 as framework_pb2 +import paddle.fluid.core as core +import paddle.fluid.proto.framework_pb2 as framework_pb2 def get_all_op_protos(): diff --git a/python/paddle/v2/fluid/optimizer.py b/python/paddle/fluid/optimizer.py similarity index 91% rename from python/paddle/v2/fluid/optimizer.py rename to python/paddle/fluid/optimizer.py index f8a00e3a5fb4038a97a951a01c3a2f1a4488ae75..93a19de92e1654df2424019d764f1cbbe6314686 100644 --- a/python/paddle/v2/fluid/optimizer.py +++ b/python/paddle/fluid/optimizer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,8 @@ from collections import defaultdict import framework import layers from backward import append_backward -from framework import unique_name, program_guard +from framework import program_guard +import unique_name from initializer import Constant from layer_helper import LayerHelper from regularizer import append_regularization_ops @@ -35,10 +36,18 @@ class Optimizer(object): """ def __init__(self, learning_rate, global_step=None, regularization=None): - assert learning_rate is not None + if not isinstance(learning_rate, float) and \ + not isinstance(learning_rate, framework.Variable): + raise TypeError("learning rate should be float or Variable") self._global_step = global_step self.regularization = regularization - self._global_learning_rate = learning_rate + self._learning_rate = learning_rate + # each program should have a independent learning rate + # program -> Variable(learning_rate) + self._learning_rate_map = dict() + if isinstance(self._learning_rate, framework.Variable): + self._learning_rate_map[framework.default_main_program( + )] = self._learning_rate # Dictionary of accumulators. Some optimizer subclasses need to # allocate and manage extra variables associated with the parameters # to train. These variables are called accumulators. @@ -47,26 +56,33 @@ class Optimizer(object): self.helper = None def _create_global_learning_rate(self): - if isinstance(self._global_learning_rate, float): - self._global_learning_rate = layers.create_global_var( - name=unique_name("learning_rate"), - shape=[1], - value=float(self._global_learning_rate), - dtype='float32', - persistable=True) - - if not isinstance(self._global_learning_rate, framework.Variable): - raise ValueError("learning rate should be a Variable, " - "actual type is %s", - type(self._global_learning_rate)) - - @property - def global_learning_rate(self): + lr = self.global_learning_rate() + + if isinstance(lr, framework.Variable): + return + else: + if not isinstance(self._learning_rate, float): + raise TypeError( + "learning rate variable is create outside optimizer," + "can not create new learning rate variable for new program") + + # create learning rate in the current main program + self._learning_rate_map[framework.default_main_program( + )] = layers.create_global_var( + name=unique_name.generate("learning_rate"), + shape=[1], + value=float(self._learning_rate), + dtype='float32', + persistable=True) + + def global_learning_rate(self, program=None): """ get global decayed learning rate :return: """ - return self._global_learning_rate + if program is None: + program = framework.default_main_program() + return self._learning_rate_map.get(program, None) def _append_optimize_op(self, block, param_and_grad): """ append optimize operator to block and return all the added optimize_op @@ -77,7 +93,7 @@ class Optimizer(object): # create learning rate variable for every parameter param = param_and_grad[0] param_lr = param.optimize_attr['learning_rate'] - return self._global_learning_rate * param_lr + return self.global_learning_rate() * param_lr def _create_accumulators(self, block, parameters): """Create all accumulators needed by the parameters @@ -118,7 +134,7 @@ class Optimizer(object): assert isinstance(self.helper, LayerHelper) var = self.helper.create_global_variable( - name=unique_name(name), + name=unique_name.generate(name), persistable=True, dtype=dtype or param.dtype, type=param.type, @@ -225,7 +241,7 @@ class Optimizer(object): `create_optimization_pass()` into one. """ params_grads = append_backward(loss, parameter_list, no_grad_set, - error_clip_callback) + [error_clip_callback]) params_grads = append_gradient_clip_ops(params_grads) @@ -379,7 +395,7 @@ class AdamOptimizer(Optimizer): # Create beta1 and beta2 power tensors beta_shape = [1] self._beta1_pow_acc = self.helper.create_global_variable( - name=unique_name('beta1_pow_acc'), + name=unique_name.generate('beta1_pow_acc'), dtype='float32', shape=beta_shape, lod_level=0, @@ -388,7 +404,7 @@ class AdamOptimizer(Optimizer): self._beta1_pow_acc, initializer=Constant(self._beta1)) self._beta2_pow_acc = self.helper.create_global_variable( - name=unique_name('beta2_pow_acc'), + name=unique_name.generate('beta2_pow_acc'), dtype='float32', shape=beta_shape, lod_level=0, @@ -481,7 +497,7 @@ class AdamaxOptimizer(Optimizer): # Create beta1 power accumulator tensor beta_shape = [1] self._beta1_pow_acc = self.helper.create_global_variable( - name=unique_name('beta1_pow_acc'), + name=unique_name.generate('beta1_pow_acc'), dtype='float32', shape=beta_shape, lod_level=0, diff --git a/python/paddle/v2/fluid/param_attr.py b/python/paddle/fluid/param_attr.py similarity index 98% rename from python/paddle/v2/fluid/param_attr.py rename to python/paddle/fluid/param_attr.py index fc566b8a2480ce9256d610b4731405cd6d89b7e4..255cd2104325afa31449cbd3875499a7c5d7f572 100644 --- a/python/paddle/v2/fluid/param_attr.py +++ b/python/paddle/fluid/param_attr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/profiler.py b/python/paddle/fluid/profiler.py similarity index 98% rename from python/paddle/v2/fluid/profiler.py rename to python/paddle/fluid/profiler.py index d33a4c52a8873b1e376eb2077014130bdcad2e12..4611986c9969f12b71290cf8ee03a50a6ad76f94 100644 --- a/python/paddle/v2/fluid/profiler.py +++ b/python/paddle/fluid/profiler.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/regularizer.py b/python/paddle/fluid/regularizer.py similarity index 98% rename from python/paddle/v2/fluid/regularizer.py rename to python/paddle/fluid/regularizer.py index 0273da647afb6e95a136b5ecd0975347d9a378ff..a29f9a208ebefc75b531030c9f0de9487f2b136c 100644 --- a/python/paddle/v2/fluid/regularizer.py +++ b/python/paddle/fluid/regularizer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/.gitignore b/python/paddle/fluid/tests/.gitignore similarity index 100% rename from python/paddle/v2/fluid/tests/.gitignore rename to python/paddle/fluid/tests/.gitignore diff --git a/python/paddle/fluid/tests/CMakeLists.txt b/python/paddle/fluid/tests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ff7b1b027e0e17d233f2a8a1c9775ccfbe1797e --- /dev/null +++ b/python/paddle/fluid/tests/CMakeLists.txt @@ -0,0 +1,11 @@ +file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") +string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") + +foreach(src ${TEST_OPS}) + py_test(${src} SRCS ${src}.py) +endforeach() + +add_subdirectory(unittests) +add_subdirectory(book) +add_subdirectory(book_distribute) +add_subdirectory(book_memory_optimization) diff --git a/python/paddle/v2/fluid/tests/book/__init__.py b/python/paddle/fluid/tests/__init__.py similarity index 89% rename from python/paddle/v2/fluid/tests/book/__init__.py rename to python/paddle/fluid/tests/__init__.py index b94a21a7e406b833797f8f521c62a2351c2bc30a..eca2dce114b069bf9b455d77ce670d73b5047fd2 100644 --- a/python/paddle/v2/fluid/tests/book/__init__.py +++ b/python/paddle/fluid/tests/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/book/.gitignore b/python/paddle/fluid/tests/book/.gitignore similarity index 100% rename from python/paddle/v2/fluid/tests/book/.gitignore rename to python/paddle/fluid/tests/book/.gitignore diff --git a/python/paddle/v2/fluid/tests/book/CMakeLists.txt b/python/paddle/fluid/tests/book/CMakeLists.txt similarity index 100% rename from python/paddle/v2/fluid/tests/book/CMakeLists.txt rename to python/paddle/fluid/tests/book/CMakeLists.txt diff --git a/python/paddle/fluid/tests/book/__init__.py b/python/paddle/fluid/tests/book/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..eca2dce114b069bf9b455d77ce670d73b5047fd2 --- /dev/null +++ b/python/paddle/fluid/tests/book/__init__.py @@ -0,0 +1,13 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/python/paddle/v2/fluid/tests/book/notest_rnn_encoder_decoer.py b/python/paddle/fluid/tests/book/notest_rnn_encoder_decoer.py similarity index 97% rename from python/paddle/v2/fluid/tests/book/notest_rnn_encoder_decoer.py rename to python/paddle/fluid/tests/book/notest_rnn_encoder_decoer.py index 6d6ad504766506d072aacc8a612556cb904b9452..68c12d060ee2250483290228db132472c0bf4d75 100644 --- a/python/paddle/v2/fluid/tests/book/notest_rnn_encoder_decoer.py +++ b/python/paddle/fluid/tests/book/notest_rnn_encoder_decoer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,15 +14,15 @@ import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.layers as layers +import paddle.fluid as fluid +import paddle.fluid.core as core +import paddle.fluid.framework as framework +import paddle.fluid.layers as layers import contextlib import math import sys import unittest -from paddle.v2.fluid.executor import Executor +from paddle.fluid.executor import Executor dict_size = 30000 source_dict_dim = target_dict_dim = dict_size diff --git a/python/paddle/v2/fluid/tests/book/test_fit_a_line.py b/python/paddle/fluid/tests/book/test_fit_a_line.py similarity index 97% rename from python/paddle/v2/fluid/tests/book/test_fit_a_line.py rename to python/paddle/fluid/tests/book/test_fit_a_line.py index 2c8a192558187126cfb672615876dccbb18c40ae..fcd4f0a8e188c900c62a65216617a63d607683c3 100644 --- a/python/paddle/v2/fluid/tests/book/test_fit_a_line.py +++ b/python/paddle/fluid/tests/book/test_fit_a_line.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import contextlib import numpy import unittest diff --git a/python/paddle/v2/fluid/tests/book/test_image_classification.py b/python/paddle/fluid/tests/book/test_image_classification.py similarity index 98% rename from python/paddle/v2/fluid/tests/book/test_image_classification.py rename to python/paddle/fluid/tests/book/test_image_classification.py index aa3b02391954bc011f318827d1e9490803edc980..f4e45d82cbb6f685aa48d5855b05024fe0e6b47b 100644 --- a/python/paddle/v2/fluid/tests/book/test_image_classification.py +++ b/python/paddle/fluid/tests/book/test_image_classification.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ from __future__ import print_function import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import contextlib import math import sys diff --git a/python/paddle/v2/fluid/tests/book/test_label_semantic_roles.py b/python/paddle/fluid/tests/book/test_label_semantic_roles.py similarity index 98% rename from python/paddle/v2/fluid/tests/book/test_label_semantic_roles.py rename to python/paddle/fluid/tests/book/test_label_semantic_roles.py index d03fd2f422667e294e160bec2097a215ed014761..015a3c58d3a967f19bfbd8bc7054f18e37a5658e 100644 --- a/python/paddle/v2/fluid/tests/book/test_label_semantic_roles.py +++ b/python/paddle/fluid/tests/book/test_label_semantic_roles.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ import math import numpy as np import paddle.v2 as paddle import paddle.v2.dataset.conll05 as conll05 -import paddle.v2.fluid as fluid -from paddle.v2.fluid.initializer import init_on_cpu +import paddle.fluid as fluid +from paddle.fluid.initializer import init_on_cpu import contextlib import time import unittest diff --git a/python/paddle/v2/fluid/tests/book/test_machine_translation.py b/python/paddle/fluid/tests/book/test_machine_translation.py similarity index 97% rename from python/paddle/v2/fluid/tests/book/test_machine_translation.py rename to python/paddle/fluid/tests/book/test_machine_translation.py index 5716ddd3dda90958ad1008679e018542c4fb73d7..287ef7a752474e2a865b71c140d5f66977c9aa82 100644 --- a/python/paddle/v2/fluid/tests/book/test_machine_translation.py +++ b/python/paddle/fluid/tests/book/test_machine_translation.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,10 @@ import contextlib import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.layers as pd -from paddle.v2.fluid.executor import Executor +import paddle.fluid as fluid +import paddle.fluid.framework as framework +import paddle.fluid.layers as pd +from paddle.fluid.executor import Executor import unittest dict_size = 30000 diff --git a/python/paddle/v2/fluid/tests/book/test_recognize_digits.py b/python/paddle/fluid/tests/book/test_recognize_digits.py similarity index 96% rename from python/paddle/v2/fluid/tests/book/test_recognize_digits.py rename to python/paddle/fluid/tests/book/test_recognize_digits.py index 481bf6731dfcb0c90693918f9fbcdf599e0a9328..c0d3bd389f3fd34de69bfd5ff138f6010b39d6ca 100644 --- a/python/paddle/v2/fluid/tests/book/test_recognize_digits.py +++ b/python/paddle/fluid/tests/book/test_recognize_digits.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. from __future__ import print_function import argparse -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import paddle.v2 as paddle import sys import numpy @@ -146,7 +146,7 @@ def train(nn_type, # get test acc and loss acc_val = numpy.array(acc_set).mean() avg_loss_val = numpy.array(avg_loss_set).mean() - if float(acc_val) > 0.85: # test acc > 85% + if float(acc_val) > 0.2: # Smaller value to increase CI speed if save_dirname is not None: fluid.io.save_inference_model( save_dirname, ["img"], [prediction], @@ -249,8 +249,9 @@ def inject_all_tests(): for nn_type in ('mlp', 'conv'): inject_test_method(use_cuda, parallel, nn_type, True) - # One unit-test for saving parameters as separate files + # Two unit-test for saving parameters as separate files inject_test_method(False, False, 'mlp', False) + inject_test_method(False, False, 'conv', False) inject_all_tests() diff --git a/python/paddle/v2/fluid/tests/book/test_recommender_system.py b/python/paddle/fluid/tests/book/test_recommender_system.py similarity index 97% rename from python/paddle/v2/fluid/tests/book/test_recommender_system.py rename to python/paddle/fluid/tests/book/test_recommender_system.py index 72c2fea7531e23322f3664c834cb066a54961a23..56229299e82aae4f291a2e049c1dbb55f73a0cf3 100644 --- a/python/paddle/v2/fluid/tests/book/test_recommender_system.py +++ b/python/paddle/fluid/tests/book/test_recommender_system.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,12 +16,12 @@ import math import sys import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.nets as nets -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.optimizer import SGDOptimizer +import paddle.fluid as fluid +import paddle.fluid.framework as framework +import paddle.fluid.layers as layers +import paddle.fluid.nets as nets +from paddle.fluid.executor import Executor +from paddle.fluid.optimizer import SGDOptimizer IS_SPARSE = True USE_GPU = False diff --git a/python/paddle/v2/fluid/tests/book/test_understand_sentiment.py b/python/paddle/fluid/tests/book/test_understand_sentiment.py similarity index 54% rename from python/paddle/v2/fluid/tests/book/test_understand_sentiment.py rename to python/paddle/fluid/tests/book/test_understand_sentiment.py index a879e110f708a24f78dd7f50bc294a2e63b12f60..6d982c62032cffdf00621c8717ef52b5e3d3fb0b 100644 --- a/python/paddle/v2/fluid/tests/book/test_understand_sentiment.py +++ b/python/paddle/fluid/tests/book/test_understand_sentiment.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,9 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import print_function import unittest -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import paddle.v2 as paddle import contextlib import math @@ -23,7 +24,8 @@ import sys def convolution_net(data, label, input_dim, class_dim=2, emb_dim=32, hid_dim=32): - emb = fluid.layers.embedding(input=data, size=[input_dim, emb_dim]) + emb = fluid.layers.embedding( + input=data, size=[input_dim, emb_dim], is_sparse=True) conv_3 = fluid.nets.sequence_conv_pool( input=emb, num_filters=hid_dim, @@ -41,8 +43,46 @@ def convolution_net(data, label, input_dim, class_dim=2, emb_dim=32, act="softmax") cost = fluid.layers.cross_entropy(input=prediction, label=label) avg_cost = fluid.layers.mean(x=cost) - adam_optimizer = fluid.optimizer.Adam(learning_rate=0.002) - adam_optimizer.minimize(avg_cost) + accuracy = fluid.layers.accuracy(input=prediction, label=label) + return avg_cost, accuracy, prediction + + +def dyn_rnn_lstm(data, label, input_dim, class_dim=2, emb_dim=32, + lstm_size=128): + emb = fluid.layers.embedding( + input=data, size=[input_dim, emb_dim], is_sparse=True) + sentence = fluid.layers.fc(input=emb, size=lstm_size, act='tanh') + + rnn = fluid.layers.DynamicRNN() + with rnn.block(): + word = rnn.step_input(sentence) + prev_hidden = rnn.memory(value=0.0, shape=[lstm_size]) + prev_cell = rnn.memory(value=0.0, shape=[lstm_size]) + + def gate_common(ipt, hidden, size): + gate0 = fluid.layers.fc(input=ipt, size=size, bias_attr=True) + gate1 = fluid.layers.fc(input=hidden, size=size, bias_attr=False) + return gate0 + gate1 + + forget_gate = fluid.layers.sigmoid(x=gate_common(word, prev_hidden, + lstm_size)) + input_gate = fluid.layers.sigmoid(x=gate_common(word, prev_hidden, + lstm_size)) + output_gate = fluid.layers.sigmoid(x=gate_common(word, prev_hidden, + lstm_size)) + cell_gate = fluid.layers.sigmoid(x=gate_common(word, prev_hidden, + lstm_size)) + + cell = forget_gate * prev_cell + input_gate * cell_gate + hidden = output_gate * fluid.layers.tanh(x=cell) + rnn.update_memory(prev_cell, cell) + rnn.update_memory(prev_hidden, hidden) + rnn.output(hidden) + + last = fluid.layers.sequence_last_step(rnn()) + prediction = fluid.layers.fc(input=last, size=class_dim, act="softmax") + cost = fluid.layers.cross_entropy(input=prediction, label=label) + avg_cost = fluid.layers.mean(x=cost) accuracy = fluid.layers.accuracy(input=prediction, label=label) return avg_cost, accuracy, prediction @@ -56,7 +96,8 @@ def stacked_lstm_net(data, stacked_num=3): assert stacked_num % 2 == 1 - emb = fluid.layers.embedding(input=data, size=[input_dim, emb_dim]) + emb = fluid.layers.embedding( + input=data, size=[input_dim, emb_dim], is_sparse=True) # add bias attr # TODO(qijun) linear act @@ -79,8 +120,6 @@ def stacked_lstm_net(data, act='softmax') cost = fluid.layers.cross_entropy(input=prediction, label=label) avg_cost = fluid.layers.mean(x=cost) - adam_optimizer = fluid.optimizer.Adam(learning_rate=0.002) - adam_optimizer.minimize(avg_cost) accuracy = fluid.layers.accuracy(input=prediction, label=label) return avg_cost, accuracy, prediction @@ -93,7 +132,7 @@ def create_random_lodtensor(lod, place, low, high): return res -def train(word_dict, nn_type, use_cuda, save_dirname=None): +def train(word_dict, net_method, use_cuda, parallel=False, save_dirname=None): BATCH_SIZE = 128 PASS_NUM = 5 dict_dim = len(word_dict) @@ -103,12 +142,29 @@ def train(word_dict, nn_type, use_cuda, save_dirname=None): name="words", shape=[1], dtype="int64", lod_level=1) label = fluid.layers.data(name="label", shape=[1], dtype="int64") - if nn_type == "conv": - net_method = convolution_net + if not parallel: + cost, acc_out, prediction = net_method( + data, label, input_dim=dict_dim, class_dim=class_dim) else: - net_method = stacked_lstm_net - cost, acc_out, prediction = net_method( - data, label, input_dim=dict_dim, class_dim=class_dim) + places = fluid.layers.get_places() + pd = fluid.layers.ParallelDo(places) + with pd.do(): + cost, acc, _ = net_method( + pd.read_input(data), + pd.read_input(label), + input_dim=dict_dim, + class_dim=class_dim) + pd.write_output(cost) + pd.write_output(acc) + + cost, acc = pd() + cost = fluid.layers.mean(x=cost) + acc_out = fluid.layers.mean(x=acc) + prediction = None + assert save_dirname is None + + adagrad = fluid.optimizer.Adagrad(learning_rate=0.002) + adagrad.minimize(cost) train_data = paddle.batch( paddle.reader.shuffle( @@ -172,15 +228,17 @@ def infer(word_dict, use_cuda, save_dirname=None): print("Inference results: ", np_data) -def main(word_dict, nn_type, use_cuda): +def main(word_dict, net_method, use_cuda, parallel=False, save_dirname=None): if use_cuda and not fluid.core.is_compiled_with_cuda(): return - # Directory for saving the trained model - save_dirname = "understand_sentiment_" + nn_type + ".inference.model" - - train(word_dict, nn_type, use_cuda, save_dirname) - infer(word_dict, use_cuda, save_dirname) + train( + word_dict, + net_method, + use_cuda, + parallel=parallel, + save_dirname=save_dirname) + infer(use_cuda, save_dirname) class TestUnderstandSentiment(unittest.TestCase): @@ -199,19 +257,86 @@ class TestUnderstandSentiment(unittest.TestCase): def test_conv_cpu(self): with self.new_program_scope(): - main(self.word_dict, nn_type="conv", use_cuda=False) + main( + self.word_dict, + net_method=convolution_net, + use_cuda=False, + save_dirname="understand_sentiment_conv.inference.model") + + def test_conv_cpu_parallel(self): + with self.new_program_scope(): + main( + self.word_dict, + net_method=convolution_net, + use_cuda=False, + parallel=True) + @unittest.skip(reason="make CI faster") def test_stacked_lstm_cpu(self): with self.new_program_scope(): - main(self.word_dict, nn_type="lstm", use_cuda=False) + main( + self.word_dict, + net_method=stacked_lstm_net, + use_cuda=False, + save_dirname="understand_sentiment_stacked_lstm.inference.model") + + def test_stacked_lstm_cpu_parallel(self): + with self.new_program_scope(): + main( + self.word_dict, + net_method=stacked_lstm_net, + use_cuda=False, + parallel=True) def test_conv_gpu(self): with self.new_program_scope(): - main(self.word_dict, nn_type="conv", use_cuda=True) + main( + self.word_dict, + net_method=convolution_net, + use_cuda=True, + save_dirname="understand_sentiment_conv.inference.model") + def test_conv_gpu_parallel(self): + with self.new_program_scope(): + main( + self.word_dict, + net_method=convolution_net, + use_cuda=True, + parallel=True) + + @unittest.skip(reason="make CI faster") def test_stacked_lstm_gpu(self): with self.new_program_scope(): - main(self.word_dict, nn_type="lstm", use_cuda=True) + main( + self.word_dict, + net_method=stacked_lstm_net, + use_cuda=True, + save_dirname="understand_sentiment_stacked_lstm.inference.model") + + def test_stacked_lstm_gpu_parallel(self): + with self.new_program_scope(): + main( + self.word_dict, + net_method=stacked_lstm_net, + use_cuda=True, + parallel=True) + + @unittest.skip(reason='make CI faster') + def test_dynrnn_lstm_gpu(self): + with self.new_program_scope(): + main( + self.word_dict, + net_method=dyn_rnn_lstm, + use_cuda=True, + parallel=False) + + def test_dynrnn_lstm_gpu_parallel(self): + with self.new_program_scope(): + main( + self.word_dict, + net_method=dyn_rnn_lstm, + use_cuda=True, + parallel=True) if __name__ == '__main__': diff --git a/python/paddle/v2/fluid/tests/book/test_word2vec.py b/python/paddle/fluid/tests/book/test_word2vec.py similarity index 99% rename from python/paddle/v2/fluid/tests/book/test_word2vec.py rename to python/paddle/fluid/tests/book/test_word2vec.py index a9af95a7d991186bd4097efb07e290bf4bd769fc..6e735e992dfcd1cf421fa813ef6290861937f93e 100644 --- a/python/paddle/v2/fluid/tests/book/test_word2vec.py +++ b/python/paddle/fluid/tests/book/test_word2vec.py @@ -13,7 +13,7 @@ # limitations under the License. import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import unittest import os import numpy as np diff --git a/python/paddle/v2/fluid/tests/book_distribute/CMakeLists.txt b/python/paddle/fluid/tests/book_distribute/CMakeLists.txt similarity index 100% rename from python/paddle/v2/fluid/tests/book_distribute/CMakeLists.txt rename to python/paddle/fluid/tests/book_distribute/CMakeLists.txt diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_dist_fit_a_line.py b/python/paddle/fluid/tests/book_distribute/notest_dist_fit_a_line.py similarity index 96% rename from python/paddle/v2/fluid/tests/book_distribute/notest_dist_fit_a_line.py rename to python/paddle/fluid/tests/book_distribute/notest_dist_fit_a_line.py index 9774edebfb1de0ae73970d582c620f8a984a4ebf..b5fbffea368aa78f33bd1d1f85de7c2e830f2d44 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_dist_fit_a_line.py +++ b/python/paddle/fluid/tests/book_distribute/notest_dist_fit_a_line.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import os x = fluid.layers.data(name='x', shape=[13], dtype='float32') diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_dist_image_classification.py b/python/paddle/fluid/tests/book_distribute/notest_dist_image_classification.py similarity index 99% rename from python/paddle/v2/fluid/tests/book_distribute/notest_dist_image_classification.py rename to python/paddle/fluid/tests/book_distribute/notest_dist_image_classification.py index 298ecfc386b3ae093cf714a41f5072759cb2cf2e..9f807df8829db59833cafb9723371abc240da62d 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_dist_image_classification.py +++ b/python/paddle/fluid/tests/book_distribute/notest_dist_image_classification.py @@ -15,7 +15,7 @@ from __future__ import print_function import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import os import sys diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_dist_label_semantic_roles.py b/python/paddle/fluid/tests/book_distribute/notest_dist_label_semantic_roles.py similarity index 98% rename from python/paddle/v2/fluid/tests/book_distribute/notest_dist_label_semantic_roles.py rename to python/paddle/fluid/tests/book_distribute/notest_dist_label_semantic_roles.py index 08bb67b0a1f53c73b713238ab45ec8055726cf9c..533cdb5a9ba1546ba8d922b7651cd09d0c1a363c 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_dist_label_semantic_roles.py +++ b/python/paddle/fluid/tests/book_distribute/notest_dist_label_semantic_roles.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ import math import numpy as np import paddle.v2 as paddle import paddle.v2.dataset.conll05 as conll05 -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import time import os diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_dist_word2vec.py b/python/paddle/fluid/tests/book_distribute/notest_dist_word2vec.py similarity index 97% rename from python/paddle/v2/fluid/tests/book_distribute/notest_dist_word2vec.py rename to python/paddle/fluid/tests/book_distribute/notest_dist_word2vec.py index ec4c2d2721c27127625f0c7d9fee8155675ebd8d..bee022bf4e262f027871849a4e47cc04e91b8025 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_dist_word2vec.py +++ b/python/paddle/fluid/tests/book_distribute/notest_dist_word2vec.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ from __future__ import print_function import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import os PASS_NUM = 100 diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_machine_translation.py b/python/paddle/fluid/tests/book_distribute/notest_machine_translation.py similarity index 95% rename from python/paddle/v2/fluid/tests/book_distribute/notest_machine_translation.py rename to python/paddle/fluid/tests/book_distribute/notest_machine_translation.py index adeacd4adf2150e0302965d80457e26d07c6b96d..243d7f5073b5e21f6203907626e382d3daca0949 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_machine_translation.py +++ b/python/paddle/fluid/tests/book_distribute/notest_machine_translation.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.executor import Executor +import paddle.fluid as fluid +import paddle.fluid.core as core +import paddle.fluid.framework as framework +import paddle.fluid.layers as layers +from paddle.fluid.executor import Executor import os dict_size = 30000 diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_recognize_digits_conv_dist.py b/python/paddle/fluid/tests/book_distribute/notest_recognize_digits_conv_dist.py similarity index 92% rename from python/paddle/v2/fluid/tests/book_distribute/notest_recognize_digits_conv_dist.py rename to python/paddle/fluid/tests/book_distribute/notest_recognize_digits_conv_dist.py index f18ca05c78093ff4ca22bf8b30d59240ee55ee8b..223428f820c278d6b76f1339bd83c6e55e112ed9 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_recognize_digits_conv_dist.py +++ b/python/paddle/fluid/tests/book_distribute/notest_recognize_digits_conv_dist.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ from __future__ import print_function import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import os images = fluid.layers.data(name='pixel', shape=[1, 28, 28], dtype='float32') @@ -58,14 +58,19 @@ trainers = int(os.getenv("TRAINERS")) # total trainer count current_endpoint = os.getenv("SERVER_ENDPOINT") # current pserver endpoint training_role = os.getenv("TRAINING_ROLE", "TRAINER") # get the training role: trainer/pserver +if not current_endpoint: + print("need env SERVER_ENDPOINT") + exit(1) + t = fluid.DistributeTranspiler() t.transpile( - optimize_ops, params_grads, pservers=pserver_endpoints, trainers=trainers) + optimize_ops, + params_grads, + 0, + pservers=pserver_endpoints, + trainers=trainers) if training_role == "PSERVER": - if not current_endpoint: - print("need env SERVER_ENDPOINT") - exit(1) pserver_prog = t.get_pserver_program(current_endpoint) pserver_startup = t.get_startup_program(current_endpoint, pserver_prog) exe.run(pserver_startup) diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_recognize_digits_mlp_dist.py b/python/paddle/fluid/tests/book_distribute/notest_recognize_digits_mlp_dist.py similarity index 97% rename from python/paddle/v2/fluid/tests/book_distribute/notest_recognize_digits_mlp_dist.py rename to python/paddle/fluid/tests/book_distribute/notest_recognize_digits_mlp_dist.py index 7733248cb447ed953d8b05945d51370c4c293489..9fb356e78d24931b2b9aef7a72bef4b4982eba94 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_recognize_digits_mlp_dist.py +++ b/python/paddle/fluid/tests/book_distribute/notest_recognize_digits_mlp_dist.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ from __future__ import print_function import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import os BATCH_SIZE = 128 diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_recommender_system_dist.py b/python/paddle/fluid/tests/book_distribute/notest_recommender_system_dist.py similarity index 96% rename from python/paddle/v2/fluid/tests/book_distribute/notest_recommender_system_dist.py rename to python/paddle/fluid/tests/book_distribute/notest_recommender_system_dist.py index 2d8885e377b0a10d8b5bad4e8fcecb9cc6fc8b64..ea05fbb457fa4250590778988d05c5ee7b0124be 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_recommender_system_dist.py +++ b/python/paddle/fluid/tests/book_distribute/notest_recommender_system_dist.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +15,11 @@ import numpy as np import os import paddle.v2 as paddle -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.nets as nets -from paddle.v2.fluid.optimizer import SGDOptimizer +import paddle.fluid as fluid +import paddle.fluid.core as core +import paddle.fluid.layers as layers +import paddle.fluid.nets as nets +from paddle.fluid.optimizer import SGDOptimizer IS_SPARSE = True BATCH_SIZE = 256 diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_understand_sentiment_conv_dist.py b/python/paddle/fluid/tests/book_distribute/notest_understand_sentiment_conv_dist.py similarity index 97% rename from python/paddle/v2/fluid/tests/book_distribute/notest_understand_sentiment_conv_dist.py rename to python/paddle/fluid/tests/book_distribute/notest_understand_sentiment_conv_dist.py index 49f26d6b69a836cdc44244eb8938884637acf720..3b057c5d96204989055003e1520b7f35ce8d89c7 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_understand_sentiment_conv_dist.py +++ b/python/paddle/fluid/tests/book_distribute/notest_understand_sentiment_conv_dist.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ from __future__ import print_function import os import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid def convolution_net(data, label, input_dim, class_dim=2, emb_dim=32, diff --git a/python/paddle/v2/fluid/tests/book_distribute/notest_understand_sentiment_dynamic_lstm.py b/python/paddle/fluid/tests/book_distribute/notest_understand_sentiment_dynamic_lstm.py similarity index 98% rename from python/paddle/v2/fluid/tests/book_distribute/notest_understand_sentiment_dynamic_lstm.py rename to python/paddle/fluid/tests/book_distribute/notest_understand_sentiment_dynamic_lstm.py index bff376a0e2ee0fbb0d869e0dddf4460ed5dc4ac6..b6c85ebb40628ee2bb6d2ecbda8966045597092f 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/notest_understand_sentiment_dynamic_lstm.py +++ b/python/paddle/fluid/tests/book_distribute/notest_understand_sentiment_dynamic_lstm.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import numpy as np import os import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid def stacked_lstm_net(data, diff --git a/python/paddle/v2/fluid/tests/book_memory_optimization/CMakeLists.txt b/python/paddle/fluid/tests/book_memory_optimization/CMakeLists.txt similarity index 100% rename from python/paddle/v2/fluid/tests/book_memory_optimization/CMakeLists.txt rename to python/paddle/fluid/tests/book_memory_optimization/CMakeLists.txt diff --git a/python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_fit_a_line.py b/python/paddle/fluid/tests/book_memory_optimization/test_memopt_fit_a_line.py similarity index 95% rename from python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_fit_a_line.py rename to python/paddle/fluid/tests/book_memory_optimization/test_memopt_fit_a_line.py index 045db8390cd52689a2a803c3387c90776a44ee73..11250db9cbb77ca7747799470942ce5aa6f64034 100644 --- a/python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_fit_a_line.py +++ b/python/paddle/fluid/tests/book_memory_optimization/test_memopt_fit_a_line.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import math import sys diff --git a/python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py b/python/paddle/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py similarity index 98% rename from python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py rename to python/paddle/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py index 9fbb36d3638bd537020247d6f762afd4ed5d402f..64f55e08531dd47631fbd946de25436805ac9fdd 100644 --- a/python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py +++ b/python/paddle/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ from __future__ import print_function import sys import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import math import sys diff --git a/python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_machine_translation.py b/python/paddle/fluid/tests/book_memory_optimization/test_memopt_machine_translation.py similarity index 94% rename from python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_machine_translation.py rename to python/paddle/fluid/tests/book_memory_optimization/test_memopt_machine_translation.py index 48abaa8d87563b7132c5d8962bc33283a104e67a..c439401ea92defd3fe2fc5ff44f7e2c8d7a2ae74 100644 --- a/python/paddle/v2/fluid/tests/book_memory_optimization/test_memopt_machine_translation.py +++ b/python/paddle/fluid/tests/book_memory_optimization/test_memopt_machine_translation.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.executor import Executor +import paddle.fluid as fluid +import paddle.fluid.core as core +import paddle.fluid.framework as framework +import paddle.fluid.layers as layers +from paddle.fluid.executor import Executor import math import sys diff --git a/python/paddle/v2/fluid/tests/demo/fc_gan.py b/python/paddle/fluid/tests/demo/fc_gan.py similarity index 98% rename from python/paddle/v2/fluid/tests/demo/fc_gan.py rename to python/paddle/fluid/tests/demo/fc_gan.py index 0652c8134d58bcb6e5bba469ae16ff1ab4fdae4b..fd9d80fa94467c70d28e4c71f34ebf0f964e5145 100644 --- a/python/paddle/v2/fluid/tests/demo/fc_gan.py +++ b/python/paddle/fluid/tests/demo/fc_gan.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import matplotlib import numpy import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid matplotlib.use('Agg') import matplotlib.pyplot as plt diff --git a/python/paddle/fluid/tests/notest_concurrency.py b/python/paddle/fluid/tests/notest_concurrency.py new file mode 100644 index 0000000000000000000000000000000000000000..602d5f31eb311e8f87d3f5eae78cd41d64f61141 --- /dev/null +++ b/python/paddle/fluid/tests/notest_concurrency.py @@ -0,0 +1,38 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest +import paddle.fluid as fluid +import paddle.fluid.core as core +from paddle.fluid.executor import Executor + + +class TestRoutineOp(unittest.TestCase): + def test_simple_routine(self): + ch = fluid.make_channel(dtype=bool) + with fluid.Go(): + fluid.channel_send(ch, True) + + result = fluid.channel_recv(ch) + fluid.channel_close(ch) + + cpu = core.CPUPlace() + exe = Executor(cpu) + + outs = exe.run(fetch_list=[result]) + self.assertEqual(outs[0], True) + + +if __name__ == '__main__': + unittest.main() diff --git a/python/paddle/v2/fluid/tests/notest_csp.py b/python/paddle/fluid/tests/notest_csp.py similarity index 97% rename from python/paddle/v2/fluid/tests/notest_csp.py rename to python/paddle/fluid/tests/notest_csp.py index 7fe234a20b5222eb85e6bcea2fcb05c53ddd57e9..f4be833deebd2c82e060e66a8bcf590020625cf8 100644 --- a/python/paddle/v2/fluid/tests/notest_csp.py +++ b/python/paddle/fluid/tests/notest_csp.py @@ -13,7 +13,7 @@ # limitations under the License. import unittest -import paddle.v2.fluid as fluid +import paddle.fluid as fluid class TestCSPFramework(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_cpp_reader.py b/python/paddle/fluid/tests/test_cpp_reader.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_cpp_reader.py rename to python/paddle/fluid/tests/test_cpp_reader.py index 8d4f454611c1e8a62b54c937a217091a0150085c..b65592057817cef83bf2157c55bacea5bbe34ea1 100644 --- a/python/paddle/v2/fluid/tests/test_cpp_reader.py +++ b/python/paddle/fluid/tests/test_cpp_reader.py @@ -13,7 +13,7 @@ # limitations under the License. import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import numpy as np prog = fluid.framework.Program() @@ -22,7 +22,7 @@ block = prog.current_block() random_reader = block.create_var( type=fluid.core.VarDesc.VarType.READER, name="RandomDataGenerator") random_reader.desc.set_dtypes( - [fluid.core.DataType.FP32, fluid.core.DataType.FP32]) + [fluid.core.VarDesc.VarType.FP32, fluid.core.VarDesc.VarType.FP32]) create_random_data_generator_op = block.append_op( type="create_random_data_generator", diff --git a/python/paddle/v2/fluid/tests/test_data_feeder.py b/python/paddle/fluid/tests/test_data_feeder.py similarity index 90% rename from python/paddle/v2/fluid/tests/test_data_feeder.py rename to python/paddle/fluid/tests/test_data_feeder.py index f967221015821e409592aeec93ffda8e4a4f3252..861dd3174a21d59fe12e0b794ecb2a934946ac71 100644 --- a/python/paddle/v2/fluid/tests/test_data_feeder.py +++ b/python/paddle/fluid/tests/test_data_feeder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid as fluid +import paddle.fluid as fluid def test_converter(): diff --git a/python/paddle/fluid/tests/test_detection.py b/python/paddle/fluid/tests/test_detection.py new file mode 100644 index 0000000000000000000000000000000000000000..1dc6d107d214165dd42cb728a56a55baf9b157fb --- /dev/null +++ b/python/paddle/fluid/tests/test_detection.py @@ -0,0 +1,149 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import print_function +import paddle.fluid as fluid +import paddle.fluid.layers as layers +from paddle.fluid.framework import Program, program_guard +import unittest + + +class TestDetection(unittest.TestCase): + def test_detection_output(self): + program = Program() + with program_guard(program): + pb = layers.data( + name='prior_box', + shape=[10, 4], + append_batch_size=False, + dtype='float32') + pbv = layers.data( + name='prior_box_var', + shape=[10, 4], + append_batch_size=False, + dtype='float32') + loc = layers.data( + name='target_box', + shape=[20, 4], + append_batch_size=False, + dtype='float32') + scores = layers.data( + name='scores', + shape=[2, 20, 10], + append_batch_size=False, + dtype='float32') + out = layers.detection_output( + scores=scores, loc=loc, prior_box=pb, prior_box_var=pbv) + self.assertIsNotNone(out) + self.assertEqual(out.shape[-1], 6) + print(str(program)) + + def test_detection_api(self): + program = Program() + with program_guard(program): + x = layers.data(name='x', shape=[4], dtype='float32') + y = layers.data(name='y', shape=[4], dtype='float32') + z = layers.data(name='z', shape=[4], dtype='float32', lod_level=1) + iou = layers.iou_similarity(x=x, y=y) + bcoder = layers.box_coder( + prior_box=x, + prior_box_var=y, + target_box=z, + code_type='encode_center_size') + self.assertIsNotNone(iou) + self.assertIsNotNone(bcoder) + + matched_indices, matched_dist = layers.bipartite_match(iou) + self.assertIsNotNone(matched_indices) + self.assertIsNotNone(matched_dist) + + gt = layers.data( + name='gt', shape=[1, 1], dtype='int32', lod_level=1) + trg, trg_weight = layers.target_assign( + gt, matched_indices, mismatch_value=0) + self.assertIsNotNone(trg) + self.assertIsNotNone(trg_weight) + + gt2 = layers.data( + name='gt2', shape=[10, 4], dtype='float32', lod_level=1) + trg, trg_weight = layers.target_assign( + gt2, matched_indices, mismatch_value=0) + self.assertIsNotNone(trg) + self.assertIsNotNone(trg_weight) + + print(str(program)) + + def test_ssd_loss(self): + program = Program() + with program_guard(program): + pb = layers.data( + name='prior_box', + shape=[10, 4], + append_batch_size=False, + dtype='float32') + pbv = layers.data( + name='prior_box_var', + shape=[10, 4], + append_batch_size=False, + dtype='float32') + loc = layers.data(name='target_box', shape=[10, 4], dtype='float32') + scores = layers.data(name='scores', shape=[10, 21], dtype='float32') + gt_box = layers.data( + name='gt_box', shape=[4], lod_level=1, dtype='float32') + gt_label = layers.data( + name='gt_label', shape=[1], lod_level=1, dtype='int32') + loss = layers.ssd_loss(loc, scores, gt_box, gt_label, pb, pbv) + self.assertIsNotNone(loss) + self.assertEqual(loss.shape[-1], 1) + print(str(program)) + + +class TestMultiBoxHead(unittest.TestCase): + def test_multi_box_head(self): + data_shape = [3, 224, 224] + mbox_locs, mbox_confs, box, var = self.multi_box_head_output(data_shape) + + assert len(box.shape) == 2 + assert box.shape == var.shape + assert box.shape[1] == 4 + + for loc, conf in zip(mbox_locs, mbox_confs): + assert loc.shape[1:3] == conf.shape[1:3] + + def multi_box_head_output(self, data_shape): + images = fluid.layers.data( + name='pixel', shape=data_shape, dtype='float32') + conv1 = fluid.layers.conv2d(images, 3, 3, 2) + conv2 = fluid.layers.conv2d(conv1, 3, 3, 2) + conv3 = fluid.layers.conv2d(conv2, 3, 3, 2) + conv4 = fluid.layers.conv2d(conv3, 3, 3, 2) + conv5 = fluid.layers.conv2d(conv4, 3, 3, 2) + + mbox_locs, mbox_confs, box, var = layers.multi_box_head( + inputs=[conv1, conv2, conv3, conv4, conv5, conv5], + image=images, + num_classes=21, + min_ratio=20, + max_ratio=90, + aspect_ratios=[[2.], [2., 3.], [2., 3.], [2., 3.], [2.], [2.]], + base_size=300, + offset=0.5, + flip=True, + clip=True) + + return mbox_locs, mbox_confs, box, var + + +if __name__ == '__main__': + unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_error_clip.py b/python/paddle/fluid/tests/test_error_clip.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_error_clip.py rename to python/paddle/fluid/tests/test_error_clip.py index 6f7718f4d8751fc0514bafd342d9d4309d39b86b..f4c0dfa7a7f2417c3e2406f29653100d907c8606 100644 --- a/python/paddle/v2/fluid/tests/test_error_clip.py +++ b/python/paddle/fluid/tests/test_error_clip.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ from __future__ import print_function import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid BATCH_SIZE = 128 CLIP_MAX = 2e-6 @@ -43,7 +43,7 @@ prog_clip.block(0).var(hidden1.name).set_error_clip( avg_cost_clip = prog_clip.block(0).var(avg_cost.name) fluid.backward.append_backward(loss=avg_cost) fluid.backward.append_backward( - loss=avg_cost_clip, callback=fluid.clip.error_clip_callback) + loss=avg_cost_clip, callbacks=[fluid.clip.error_clip_callback]) hidden1_grad = prog.block(0).var(hidden1.name + "@GRAD") hidden1_grad_clip = prog_clip.block(0).var(hidden1.name + "@GRAD") diff --git a/python/paddle/v2/fluid/tests/test_gradient_clip.py b/python/paddle/fluid/tests/test_gradient_clip.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_gradient_clip.py rename to python/paddle/fluid/tests/test_gradient_clip.py index 9337791c21183fd7c2e5d6b9d47c99d762c93d46..ca0b129008b29a208567f5a862b12f307b3eae43 100644 --- a/python/paddle/v2/fluid/tests/test_gradient_clip.py +++ b/python/paddle/fluid/tests/test_gradient_clip.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ import numpy as np import paddle.v2 as paddle -import paddle.v2.fluid as fluid +import paddle.fluid as fluid BATCH_SIZE = 128 CLIP = 1 diff --git a/python/paddle/v2/fluid/tests/test_mnist_if_else_op.py b/python/paddle/fluid/tests/test_mnist_if_else_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_mnist_if_else_op.py rename to python/paddle/fluid/tests/test_mnist_if_else_op.py index 3288a0f007c8e593831692eb9a134e78804bdc2e..0b557942b0893e5af203d869ed8d235bbb85fba8 100644 --- a/python/paddle/v2/fluid/tests/test_mnist_if_else_op.py +++ b/python/paddle/fluid/tests/test_mnist_if_else_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.framework import Program, program_guard, default_main_program, default_startup_program -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.optimizer import MomentumOptimizer -import paddle.v2.fluid.core as core +import paddle.fluid.layers as layers +from paddle.fluid.framework import Program, program_guard, default_main_program, default_startup_program +from paddle.fluid.executor import Executor +from paddle.fluid.optimizer import MomentumOptimizer +import paddle.fluid.core as core import paddle.v2 as paddle import unittest import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_python_operator_overriding.py b/python/paddle/fluid/tests/test_python_operator_overriding.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_python_operator_overriding.py rename to python/paddle/fluid/tests/test_python_operator_overriding.py index e5198ec17d027f007b4a831ef2e427481f8ff8c4..b5ac97eac559e8c52a8949cfd63fc8671ba52514 100644 --- a/python/paddle/v2/fluid/tests/test_python_operator_overriding.py +++ b/python/paddle/fluid/tests/test_python_operator_overriding.py @@ -16,9 +16,9 @@ import unittest import numpy as np -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid as fluid +import paddle.fluid.layers as layers +import paddle.fluid.framework as framework +import paddle.fluid as fluid class TestPythonOperatorOverride(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9355f51311e33729c0cb8ff321010235aafa4063 --- /dev/null +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -0,0 +1,89 @@ +file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") +string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") + +if(NOT WITH_DISTRIBUTE) + list(REMOVE_ITEM TEST_OPS test_recv_op) +endif(NOT WITH_DISTRIBUTE) + +list(REMOVE_ITEM TEST_OPS test_seq_concat_op) # FIXME(helin): https://github.com/PaddlePaddle/Paddle/issues/8290 +list(REMOVE_ITEM TEST_OPS test_modified_huber_loss_op) # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/5184 +list(REMOVE_ITEM TEST_OPS test_lstm_unit_op) # # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/5185 +list(REMOVE_ITEM TEST_OPS test_nce) # IXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/7778 +list(REMOVE_ITEM TEST_OPS test_recurrent_op) # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/6152 +list(REMOVE_ITEM TEST_OPS test_cond_op) # FIXME(qijun): https://github.com/PaddlePaddle/Paddle/issues/5101#issuecomment-339814957 +list(REMOVE_ITEM TEST_OPS test_detection_output_op) # FIXME: detection_output_op will be rewritten. This unittest should be + +list(REMOVE_ITEM TEST_OPS op_test) # op_test is a helper python file, not a test +list(REMOVE_ITEM TEST_OPS decorators) # decorators is a helper python file, not a test + +function(py_test_modules TARGET_NAME) + if(WITH_TESTING) + set(options "") + set(oneValueArgs "") + set(multiValueArgs MODULES DEPS ARGS ENVS) + cmake_parse_arguments(py_test_modules "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + add_test(NAME ${TARGET_NAME} + COMMAND env PYTHONPATH=${PADDLE_PYTHON_BUILD_DIR}/lib-python ${py_test_modules_ENVS} + ${PYTHON_EXECUTABLE} -u -m unittest --verbose ${py_test_modules_MODULES} ${py_test_modules_ARGS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endif() +endfunction() + +# test time consuming OPs in a separate process for expliot parallism +list(REMOVE_ITEM TEST_OPS test_warpctc_op) +list(REMOVE_ITEM TEST_OPS test_dyn_rnn) +list(REMOVE_ITEM TEST_OPS test_mul_op) + +# tests that need to be run in separate process. +list(REMOVE_ITEM TEST_OPS test_multihead_attention) +list(REMOVE_ITEM TEST_OPS test_calc_gradient) +list(REMOVE_ITEM TEST_OPS test_while_op) +list(REMOVE_ITEM TEST_OPS test_lod_array_length_op) +list(REMOVE_ITEM TEST_OPS test_reorder_lod_tensor) +list(REMOVE_ITEM TEST_OPS test_profiler) +list(REMOVE_ITEM TEST_OPS test_normalization_wrapper) +list(REMOVE_ITEM TEST_OPS test_executor_and_mul) +list(REMOVE_ITEM TEST_OPS test_assign_value_op) +list(REMOVE_ITEM TEST_OPS test_array_read_write_op) +list(REMOVE_ITEM TEST_OPS test_lod_rank_table) +list(REMOVE_ITEM TEST_OPS test_weight_normalization) +list(REMOVE_ITEM TEST_OPS test_conditional_block) +list(REMOVE_ITEM TEST_OPS test_parameter) +list(REMOVE_ITEM TEST_OPS test_registry) +list(REMOVE_ITEM TEST_OPS test_fetch_var) +list(REMOVE_ITEM TEST_OPS test_parallel_op) +list(REMOVE_ITEM TEST_OPS test_dynrnn_static_input) + +# tests that can be bundled together in one python process for speed. +if(WITH_FAST_BUNDLE_TEST) + py_test_modules("test_all_ops" MODULES ${TEST_OPS}) +else() + foreach(TEST_OP ${TEST_OPS}) + py_test_modules(${TEST_OP} MODULES ${TEST_OP}) + endforeach(TEST_OP) +endif(WITH_FAST_BUNDLE_TEST) + +# tests with high overhead +py_test_modules(test_warpctc_op MODULES test_warpctc_op ENVS FLAGS_warpctc_dir=${WARPCTC_LIB_DIR}) +py_test_modules(test_train_dyn_rnn MODULES test_dyn_rnn) +py_test_modules(test_mul_op MODULES test_mul_op) + +# tests that need to be run in separate process. +py_test_modules(test_multihead_attention MODULES test_multihead_attention) +py_test_modules(test_calc_gradient MODULES test_calc_gradient) +py_test_modules(test_while_op MODULES test_while_op) +py_test_modules(test_lod_array_length_op MODULES test_lod_array_length_op) +py_test_modules(test_reorder_lod_tensor MODULES test_reorder_lod_tensor) +py_test_modules(test_profiler MODULES test_profiler) +py_test_modules(test_normalization_wrapper MODULES test_normalization_wrapper) +py_test_modules(test_executor_and_mul MODULES test_executor_and_mul) +py_test_modules(test_assign_value_op MODULES test_assign_value_op) +py_test_modules(test_array_read_write_op MODULES test_array_read_write_op) +py_test_modules(test_lod_rank_table MODULES test_lod_rank_table) +py_test_modules(test_weight_normalization MODULES test_weight_normalization) +py_test_modules(test_conditional_block MODULES test_conditional_block) +py_test_modules(test_parameter MODULES test_parameter) +py_test_modules(test_registry MODULES test_registry) +py_test_modules(test_fetch_var MODULES test_fetch_var) +py_test_modules(test_dynrnn_static_input MODULES test_dynrnn_static_input) +py_test_modules(test_parallel_op MODULES test_parallel_op) diff --git a/python/paddle/v2/fluid/tests/__init__.py b/python/paddle/fluid/tests/unittests/__init__.py similarity index 100% rename from python/paddle/v2/fluid/tests/__init__.py rename to python/paddle/fluid/tests/unittests/__init__.py diff --git a/python/paddle/v2/fluid/tests/decorators.py b/python/paddle/fluid/tests/unittests/decorators.py similarity index 92% rename from python/paddle/v2/fluid/tests/decorators.py rename to python/paddle/fluid/tests/unittests/decorators.py index 0a8a2ccc4dc2bdfbda1a502651559647ddd8f422..d1165e2a9199454dbcc1fda411afad20449bcc92 100644 --- a/python/paddle/v2/fluid/tests/decorators.py +++ b/python/paddle/fluid/tests/unittests/decorators.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid as fluid +import paddle.fluid as fluid __all__ = ['many_times', 'prog_scope'] diff --git a/python/paddle/v2/fluid/tests/op_test.py b/python/paddle/fluid/tests/unittests/op_test.py similarity index 95% rename from python/paddle/v2/fluid/tests/op_test.py rename to python/paddle/fluid/tests/unittests/op_test.py index f8475813c0cb7b8c8da8c9c7e0a4626615e609ac..f7e02595ec3b41ae7bb32353c258736968ca78d4 100644 --- a/python/paddle/v2/fluid/tests/op_test.py +++ b/python/paddle/fluid/tests/unittests/op_test.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,12 +16,12 @@ import unittest import numpy as np import random import itertools -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import collections -from paddle.v2.fluid.backward import append_backward -from paddle.v2.fluid.op import Operator -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.framework import Program, OpProtoHolder +from paddle.fluid.backward import append_backward +from paddle.fluid.op import Operator +from paddle.fluid.executor import Executor +from paddle.fluid.framework import Program, OpProtoHolder def randomize_probability(batch_size, class_num, dtype='float32'): @@ -119,9 +119,9 @@ def get_numeric_gradient(place, tensor_to_check = scope.find_var(input_to_check).get_tensor() tensor_size = product(tensor_to_check.get_dims()) tensor_to_check_dtype = tensor_to_check.dtype() - if tensor_to_check_dtype == core.DataType.FP32: + if tensor_to_check_dtype == core.VarDesc.VarType.FP32: tensor_to_check_dtype = np.float32 - elif tensor_to_check_dtype == core.DataType.FP64: + elif tensor_to_check_dtype == core.VarDesc.VarType.FP64: tensor_to_check_dtype = np.float64 else: raise ValueError("Not supported data type " + str( @@ -248,7 +248,11 @@ class OpTest(unittest.TestCase): return feed_map - def check_output_with_place(self, place, atol): + def calc_output(self, place): + outs, _ = self._calc_output(place) + return outs + + def _calc_output(self, place): op_proto = OpProtoHolder.instance().get_op_proto(self.op_type) program = Program() @@ -281,7 +285,10 @@ class OpTest(unittest.TestCase): feed=feed_map, fetch_list=fetch_list, return_numpy=False) + return outs, fetch_list + def check_output_with_place(self, place, atol): + outs, fetch_list = self._calc_output(place) for out_name, out_dup in Operator.get_op_outputs(self.op_type): if out_name not in self.outputs: continue @@ -340,6 +347,15 @@ class OpTest(unittest.TestCase): for place in places: self.check_output_with_place(place, atol) + def check_output_customized(self, checker): + places = [core.CPUPlace()] + if core.is_compiled_with_cuda() and core.op_support_gpu(self.op_type): + places.append(core.CUDAPlace(0)) + for place in places: + outs = self.calc_output(place) + outs = [np.array(out) for out in outs] + checker(outs) + def __assert_is_close(self, numeric_grads, analytic_grads, names, max_relative_error, msg_prefix): diff --git a/python/paddle/v2/fluid/tests/test_accuracy_op.py b/python/paddle/fluid/tests/unittests/test_accuracy_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_accuracy_op.py rename to python/paddle/fluid/tests/unittests/test_accuracy_op.py index ac3f3bdff44a870cb68d317d5a57e7a25270e6c3..212a87e529da83c40ba8852e81bdf43d4611897b 100644 --- a/python/paddle/v2/fluid/tests/test_accuracy_op.py +++ b/python/paddle/fluid/tests/unittests/test_accuracy_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_activation_op.py b/python/paddle/fluid/tests/unittests/test_activation_op.py similarity index 99% rename from python/paddle/v2/fluid/tests/test_activation_op.py rename to python/paddle/fluid/tests/unittests/test_activation_op.py index 1de5d446b8eaf57d3718dde7540c929996ee3432..eab41ebe711bd21bdc3b34ca83ab57388cc35ba2 100644 --- a/python/paddle/v2/fluid/tests/test_activation_op.py +++ b/python/paddle/fluid/tests/unittests/test_activation_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_adadelta_op.py b/python/paddle/fluid/tests/unittests/test_adadelta_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_adadelta_op.py rename to python/paddle/fluid/tests/unittests/test_adadelta_op.py index 949318d00776712ad08d335f7afdb9b7d9140c42..1b892e64c7654a1a3905672813452650885790a5 100644 --- a/python/paddle/v2/fluid/tests/test_adadelta_op.py +++ b/python/paddle/fluid/tests/unittests/test_adadelta_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_adagrad_op.py b/python/paddle/fluid/tests/unittests/test_adagrad_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_adagrad_op.py rename to python/paddle/fluid/tests/unittests/test_adagrad_op.py index 3556bcf8ba0d7f16b1d9bf50e46aebde83de2e25..2f0ea79f4d6afe91ee7e0d747f3d8f4884d8f9ee 100644 --- a/python/paddle/v2/fluid/tests/test_adagrad_op.py +++ b/python/paddle/fluid/tests/unittests/test_adagrad_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core -from paddle.v2.fluid.op import Operator +import paddle.fluid.core as core +from paddle.fluid.op import Operator from op_test import OpTest import math diff --git a/python/paddle/v2/fluid/tests/test_adam_op.py b/python/paddle/fluid/tests/unittests/test_adam_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_adam_op.py rename to python/paddle/fluid/tests/unittests/test_adam_op.py index df1fa8983c1984a9bb9f204aded148c17d3d609d..3c65f3d44adcebdca92f78f7834d4878a9fa3dfe 100644 --- a/python/paddle/v2/fluid/tests/test_adam_op.py +++ b/python/paddle/fluid/tests/unittests/test_adam_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ import unittest import numpy as np from op_test import OpTest -from paddle.v2.fluid import core -from paddle.v2.fluid.op import Operator +from paddle.fluid import core +from paddle.fluid.op import Operator class TestAdamOp1(OpTest): diff --git a/python/paddle/v2/fluid/tests/test_adamax_op.py b/python/paddle/fluid/tests/unittests/test_adamax_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_adamax_op.py rename to python/paddle/fluid/tests/unittests/test_adamax_op.py index e285c454f035936c9dd28bc41b9174f780201ba0..8099beefa583d152715334e83f0c6e8e4a3e7a0d 100644 --- a/python/paddle/v2/fluid/tests/test_adamax_op.py +++ b/python/paddle/fluid/tests/unittests/test_adamax_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_array_read_write_op.py b/python/paddle/fluid/tests/unittests/test_array_read_write_op.py similarity index 91% rename from python/paddle/v2/fluid/tests/test_array_read_write_op.py rename to python/paddle/fluid/tests/unittests/test_array_read_write_op.py index a32c24486e1f4340d913da3ea42e7c9ff4a48d90..380a8549b3ac3e34d3d2a41c829e6dca529fcbdf 100644 --- a/python/paddle/v2/fluid/tests/test_array_read_write_op.py +++ b/python/paddle/fluid/tests/unittests/test_array_read_write_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,11 +13,11 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.backward import append_backward -from paddle.v2.fluid.framework import default_main_program +import paddle.fluid.core as core +import paddle.fluid.layers as layers +from paddle.fluid.executor import Executor +from paddle.fluid.backward import append_backward +from paddle.fluid.framework import default_main_program import numpy diff --git a/python/paddle/v2/fluid/tests/test_assign_op.py b/python/paddle/fluid/tests/unittests/test_assign_op.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_assign_op.py rename to python/paddle/fluid/tests/unittests/test_assign_op.py index fbbfe0d02c4036ea3e971a9c0a9a2469ca62ad53..e93c02bd3ee9f710cbb9bff4e195dfc3caabe422 100644 --- a/python/paddle/v2/fluid/tests/test_assign_op.py +++ b/python/paddle/fluid/tests/unittests/test_assign_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_assign_value_op.py b/python/paddle/fluid/tests/unittests/test_assign_value_op.py similarity index 90% rename from python/paddle/v2/fluid/tests/test_assign_value_op.py rename to python/paddle/fluid/tests/unittests/test_assign_value_op.py index 93970f863b165c44c554a40e2fa60388800ce300..02f2e6eddc80fcce4ca5a444cff82db355c085ca 100644 --- a/python/paddle/v2/fluid/tests/test_assign_value_op.py +++ b/python/paddle/fluid/tests/unittests/test_assign_value_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid as fluid -import paddle.v2.fluid.layers as layers +import paddle.fluid as fluid +import paddle.fluid.layers as layers import op_test import numpy import unittest -import paddle.v2.fluid.framework as framework +import paddle.fluid.framework as framework class TestAssignValueOp(op_test.OpTest): diff --git a/python/paddle/v2/fluid/tests/test_auc_op.py b/python/paddle/fluid/tests/unittests/test_auc_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_auc_op.py rename to python/paddle/fluid/tests/unittests/test_auc_op.py index 5e4caedf5d612ea9d1a4bcf17beee69316f9266d..948836039be48ad74d5556100f06231bb89f26d3 100644 --- a/python/paddle/v2/fluid/tests/test_auc_op.py +++ b/python/paddle/fluid/tests/unittests/test_auc_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_batch_norm_op.py b/python/paddle/fluid/tests/unittests/test_batch_norm_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_batch_norm_op.py rename to python/paddle/fluid/tests/unittests/test_batch_norm_op.py index cf13166f255c782bdcec622d58d073a0943c8e1e..80e6fa6df3c21aa19feb571916f11c41ccd6bb10 100644 --- a/python/paddle/v2/fluid/tests/test_batch_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_batch_norm_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,9 +15,9 @@ import unittest import numpy as np from op_test import OpTest -import paddle.v2.fluid.core as core -from paddle.v2.fluid.op import Operator -from paddle.v2.fluid.framework import grad_var_name +import paddle.fluid.core as core +from paddle.fluid.op import Operator +from paddle.fluid.framework import grad_var_name def get_backward_op(scope, op, no_grad_set): @@ -140,9 +140,9 @@ def set_output_grad(scope, outputs, place, feed_dict=None): grad_tensor = scope.var(grad_var_name(name)).get_tensor() out_dtype = out_tensor.dtype() if data is None: - if out_dtype == core.DataType.FP64: + if out_dtype == core.VarDesc.VarType.FP64: data = np.ones(out_tensor.shape(), dtype=np.float64) - elif out_dtype == core.DataType.FP32: + elif out_dtype == core.VarDesc.VarType.FP32: data = np.ones(out_tensor.shape(), dtype=np.float32) else: raise ValueError("Not supported data type " + str(out_dtype)) diff --git a/python/paddle/v2/fluid/tests/test_beam_search_decode_op.py b/python/paddle/fluid/tests/unittests/test_beam_search_decode_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_beam_search_decode_op.py rename to python/paddle/fluid/tests/unittests/test_beam_search_decode_op.py index 36747849859fd54b34b5f5c25e9f5b4c779774fb..4ee00605e22ba45d9e46a8bba27712c3fd97872a 100644 --- a/python/paddle/v2/fluid/tests/test_beam_search_decode_op.py +++ b/python/paddle/fluid/tests/unittests/test_beam_search_decode_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core -from paddle.v2.fluid.op import Operator +import paddle.fluid.core as core +from paddle.fluid.op import Operator class TestBeamSearchDecodeOp(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_beam_search_op.py b/python/paddle/fluid/tests/unittests/test_beam_search_op.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_beam_search_op.py rename to python/paddle/fluid/tests/unittests/test_beam_search_op.py index 4da463df260efe48498207e9758f91d0bf95e7fe..bc708f3aff54f54d290684d68afa503a50a32dac 100644 --- a/python/paddle/v2/fluid/tests/test_beam_search_op.py +++ b/python/paddle/fluid/tests/unittests/test_beam_search_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,8 +13,8 @@ # limitations under the License. import logging -from paddle.v2.fluid.op import Operator, DynamicRecurrentOp -import paddle.v2.fluid.core as core +from paddle.fluid.op import Operator, DynamicRecurrentOp +import paddle.fluid.core as core import unittest import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_bilinear_tensor_product_op.py b/python/paddle/fluid/tests/unittests/test_bilinear_tensor_product_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_bilinear_tensor_product_op.py rename to python/paddle/fluid/tests/unittests/test_bilinear_tensor_product_op.py index 4b03f512c2f0d073fad3ba04b5e72adec13af6ed..d20a11e27eaac12534ea33c398247adb8db01d4b 100644 --- a/python/paddle/v2/fluid/tests/test_bilinear_tensor_product_op.py +++ b/python/paddle/fluid/tests/unittests/test_bilinear_tensor_product_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_bipartite_match_op.py b/python/paddle/fluid/tests/unittests/test_bipartite_match_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_bipartite_match_op.py rename to python/paddle/fluid/tests/unittests/test_bipartite_match_op.py index 4943bbb3388c3a476596b2fd4dd28605ee7be9e0..9f9af2f55e2e9a1c624fb95f1c113e24c2de4a89 100644 --- a/python/paddle/v2/fluid/tests/test_bipartite_match_op.py +++ b/python/paddle/fluid/tests/unittests/test_bipartite_match_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_box_coder_op.py b/python/paddle/fluid/tests/unittests/test_box_coder_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_box_coder_op.py rename to python/paddle/fluid/tests/unittests/test_box_coder_op.py index 0dc18476fd5dce7cd293f6cb85f419be7d88ec95..b83917609226f3ae0b0eda177484c364009400e5 100644 --- a/python/paddle/v2/fluid/tests/test_box_coder_op.py +++ b/python/paddle/fluid/tests/unittests/test_box_coder_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_calc_gradient.py b/python/paddle/fluid/tests/unittests/test_calc_gradient.py similarity index 80% rename from python/paddle/v2/fluid/tests/test_calc_gradient.py rename to python/paddle/fluid/tests/unittests/test_calc_gradient.py index c773e81768f50c6bd3865f8dd527f4d955a95229..15731fefc824b7e71a83d7527d022bdb92e8ed9b 100644 --- a/python/paddle/v2/fluid/tests/test_calc_gradient.py +++ b/python/paddle/fluid/tests/unittests/test_calc_gradient.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ import unittest -import paddle.v2.fluid as fluid -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.optimizer as optimizer -from paddle.v2.fluid.backward import calc_gradient +import paddle.fluid as fluid +import paddle.fluid.layers as layers +import paddle.fluid.framework as framework +import paddle.fluid.optimizer as optimizer +from paddle.fluid.backward import calc_gradient class TestCalcGradient(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_cast_op.py b/python/paddle/fluid/tests/unittests/test_cast_op.py similarity index 83% rename from python/paddle/v2/fluid/tests/test_cast_op.py rename to python/paddle/fluid/tests/unittests/test_cast_op.py index 327b246ed80596c10877734cdea083264a5b9309..8fb8d03828393ccfe57c0848d79b960c641ad39a 100644 --- a/python/paddle/v2/fluid/tests/test_cast_op.py +++ b/python/paddle/fluid/tests/unittests/test_cast_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import op_test import unittest import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core class TestCastOp(op_test.OpTest): @@ -24,8 +24,8 @@ class TestCastOp(op_test.OpTest): self.inputs = {'X': ipt.astype('float32')} self.outputs = {'Out': ipt.astype('float64')} self.attrs = { - 'in_dtype': int(core.DataType.FP32), - 'out_dtype': int(core.DataType.FP64) + 'in_dtype': int(core.VarDesc.VarType.FP32), + 'out_dtype': int(core.VarDesc.VarType.FP64) } self.op_type = 'cast' diff --git a/python/paddle/v2/fluid/tests/test_chunk_eval_op.py b/python/paddle/fluid/tests/unittests/test_chunk_eval_op.py similarity index 99% rename from python/paddle/v2/fluid/tests/test_chunk_eval_op.py rename to python/paddle/fluid/tests/unittests/test_chunk_eval_op.py index 5c3efe9baa7da6161e22b274fb5116ffaed68f1a..050df2801c98e8f4167cdd1b4dde858c9f9f07dd 100644 --- a/python/paddle/v2/fluid/tests/test_chunk_eval_op.py +++ b/python/paddle/fluid/tests/unittests/test_chunk_eval_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_clip_by_norm_op.py b/python/paddle/fluid/tests/unittests/test_clip_by_norm_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_clip_by_norm_op.py rename to python/paddle/fluid/tests/unittests/test_clip_by_norm_op.py index b30f321c79f3d3a4061ee2fc2fb55fb5fab95f27..129958fa2818418dccce91683a9424e6324c6ac2 100644 --- a/python/paddle/v2/fluid/tests/test_clip_by_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_clip_by_norm_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_clip_op.py b/python/paddle/fluid/tests/unittests/test_clip_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_clip_op.py rename to python/paddle/fluid/tests/unittests/test_clip_op.py index ef0b75e286797436d730278585e946d1d897edc2..3df80c8ec8fa39c0aaa2b8726fe3b37aef488442 100644 --- a/python/paddle/v2/fluid/tests/test_clip_op.py +++ b/python/paddle/fluid/tests/unittests/test_clip_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_compare_op.py b/python/paddle/fluid/tests/unittests/test_compare_op.py similarity index 83% rename from python/paddle/v2/fluid/tests/test_compare_op.py rename to python/paddle/fluid/tests/unittests/test_compare_op.py index c9be80fc45cd3428937998357b9dd9cbde1547cc..405afebae85eaae6f6af0012058ad58c8bb69a2f 100644 --- a/python/paddle/v2/fluid/tests/test_compare_op.py +++ b/python/paddle/fluid/tests/unittests/test_compare_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -38,7 +38,10 @@ def create_test_class(op_type, typename, callback): for _type_name in {'float32', 'float64', 'int32', 'int64'}: create_test_class('less_than', _type_name, lambda _a, _b: _a < _b) create_test_class('less_equal', _type_name, lambda _a, _b: _a <= _b) + create_test_class('greater_than', _type_name, lambda _a, _b: _a > _b) + create_test_class('greater_equal', _type_name, lambda _a, _b: _a >= _b) create_test_class('equal', _type_name, lambda _a, _b: _a == _b) + create_test_class('not_equal', _type_name, lambda _a, _b: _a != _b) if __name__ == '__main__': unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_concat_op.py b/python/paddle/fluid/tests/unittests/test_concat_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_concat_op.py rename to python/paddle/fluid/tests/unittests/test_concat_op.py index ea0a95ebec24477797c1a17096c61132248587e5..558f3a4dcbb8fe39c427d8b100f4488440e8b8cb 100644 --- a/python/paddle/v2/fluid/tests/test_concat_op.py +++ b/python/paddle/fluid/tests/unittests/test_concat_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_cond_op.py b/python/paddle/fluid/tests/unittests/test_cond_op.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_cond_op.py rename to python/paddle/fluid/tests/unittests/test_cond_op.py index 4b7ca0963e92ead0b4168ae732d70ff8497d38c0..66fbae961a2701e79da5222ae2689108335c4065 100644 --- a/python/paddle/v2/fluid/tests/test_cond_op.py +++ b/python/paddle/fluid/tests/unittests/test_cond_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,10 +13,10 @@ # limitations under the License. import logging -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import unittest import numpy as np -from paddle.v2.fluid.op import Operator, CondOp +from paddle.fluid.op import Operator, CondOp class PySimpleCond(object): @@ -125,7 +125,4 @@ class TestCondOp(unittest.TestCase): if __name__ == "__main__": - exit( - 0 - ) # FIXME(qijun): https://github.com/PaddlePaddle/Paddle/issues/5101#issuecomment-339814957 unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_conditional_block.py b/python/paddle/fluid/tests/unittests/test_conditional_block.py similarity index 82% rename from python/paddle/v2/fluid/tests/test_conditional_block.py rename to python/paddle/fluid/tests/unittests/test_conditional_block.py index 5ee729cfee6f432091c07f360f2d0c97c3801b99..fad97a28164bbb9c7e6a94040c644ba8fc790c0f 100644 --- a/python/paddle/v2/fluid/tests/test_conditional_block.py +++ b/python/paddle/fluid/tests/unittests/test_conditional_block.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,11 +13,11 @@ # limitations under the License. import unittest -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.core as core -from paddle.v2.fluid.framework import default_startup_program, default_main_program -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.backward import append_backward +import paddle.fluid.layers as layers +import paddle.fluid.core as core +from paddle.fluid.framework import default_startup_program, default_main_program +from paddle.fluid.executor import Executor +from paddle.fluid.backward import append_backward import numpy diff --git a/python/paddle/v2/fluid/tests/test_const_value.py b/python/paddle/fluid/tests/unittests/test_const_value.py similarity index 89% rename from python/paddle/v2/fluid/tests/test_const_value.py rename to python/paddle/fluid/tests/unittests/test_const_value.py index d5b7cfded1a943ad84493afe367bf33c5304db42..d1075d514e9b2b692f271f10a005815a66b421fb 100644 --- a/python/paddle/v2/fluid/tests/test_const_value.py +++ b/python/paddle/fluid/tests/unittests/test_const_value.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. import unittest -import paddle.v2.fluid.framework as framework +import paddle.fluid.framework as framework class ConditionalBlock(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_conv2d_op.py b/python/paddle/fluid/tests/unittests/test_conv2d_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_conv2d_op.py rename to python/paddle/fluid/tests/unittests/test_conv2d_op.py index 7512ea333e37d5f4f0102531d8d13f8c2a744b8d..1fada38a0359d4a0130d58ae2f8442fbfce21e2e 100644 --- a/python/paddle/v2/fluid/tests/test_conv2d_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv2d_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core from op_test import OpTest diff --git a/python/paddle/v2/fluid/tests/test_conv2d_transpose_op.py b/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_conv2d_transpose_op.py rename to python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py index 0c76e222c90c7a61c08240e6b3d25fbb5b979252..9831b7eb1269938cfcb1d6a3a2940836ee19ed56 100644 --- a/python/paddle/v2/fluid/tests/test_conv2d_transpose_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core from op_test import OpTest diff --git a/python/paddle/v2/fluid/tests/test_conv3d_op.py b/python/paddle/fluid/tests/unittests/test_conv3d_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_conv3d_op.py rename to python/paddle/fluid/tests/unittests/test_conv3d_op.py index 8121e3286597e5842138eac1801f4466db24f799..4d3df5e33c426c92213a199b4841f649446c6e28 100644 --- a/python/paddle/v2/fluid/tests/test_conv3d_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv3d_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core from op_test import OpTest diff --git a/python/paddle/v2/fluid/tests/test_conv3d_transpose_op.py b/python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_conv3d_transpose_op.py rename to python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py index 4934c5a34e519578183a577adf66b48e6c1047d5..a79bfa13d6ca21cac6640deb5a21ef457af984df 100644 --- a/python/paddle/v2/fluid/tests/test_conv3d_transpose_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core from op_test import OpTest diff --git a/python/paddle/v2/fluid/tests/test_conv_shift_op.py b/python/paddle/fluid/tests/unittests/test_conv_shift_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_conv_shift_op.py rename to python/paddle/fluid/tests/unittests/test_conv_shift_op.py index 7029d5a2eb433707ed7e7dd8acddbd0fef80e40c..5d4d244f439a671d895f9237b793e6c6bbf2895b 100644 --- a/python/paddle/v2/fluid/tests/test_conv_shift_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv_shift_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_cos_sim_op.py b/python/paddle/fluid/tests/unittests/test_cos_sim_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_cos_sim_op.py rename to python/paddle/fluid/tests/unittests/test_cos_sim_op.py index 33db12ba9c7b119259fc918a70c029a99aea0c68..1b27cd57670e6c9db5eae6b226989a5c772866ce 100644 --- a/python/paddle/v2/fluid/tests/test_cos_sim_op.py +++ b/python/paddle/fluid/tests/unittests/test_cos_sim_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_create_op_doc_string.py b/python/paddle/fluid/tests/unittests/test_create_op_doc_string.py similarity index 87% rename from python/paddle/v2/fluid/tests/test_create_op_doc_string.py rename to python/paddle/fluid/tests/unittests/test_create_op_doc_string.py index 2b7951ecea791b43ffe9123fda77ec80d626e065..5e6f9a20a93e467980f5a4f23fbcb6118317fe44 100644 --- a/python/paddle/v2/fluid/tests/test_create_op_doc_string.py +++ b/python/paddle/fluid/tests/unittests/test_create_op_doc_string.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. import unittest -import paddle.v2.fluid.layers as layers +import paddle.fluid.layers as layers class TestDocString(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_crf_decoding_op.py b/python/paddle/fluid/tests/unittests/test_crf_decoding_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_crf_decoding_op.py rename to python/paddle/fluid/tests/unittests/test_crf_decoding_op.py index f819387cdc4476187d108e7cffca7851baea5933..f397f542bb07519886d75618e2a915c2dbf61fce 100644 --- a/python/paddle/v2/fluid/tests/test_crf_decoding_op.py +++ b/python/paddle/fluid/tests/unittests/test_crf_decoding_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_crop_op.py b/python/paddle/fluid/tests/unittests/test_crop_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_crop_op.py rename to python/paddle/fluid/tests/unittests/test_crop_op.py index 36bf1761689c32928ea8f9e2996038ae94c92bdd..20cc3a643f1adfc04faad15e1b7baad3e22d9d29 100644 --- a/python/paddle/v2/fluid/tests/test_crop_op.py +++ b/python/paddle/fluid/tests/unittests/test_crop_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_cross_entropy_op.py b/python/paddle/fluid/tests/unittests/test_cross_entropy_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_cross_entropy_op.py rename to python/paddle/fluid/tests/unittests/test_cross_entropy_op.py index ae8e9be6de453e78f8e941641919a4c8eaae7e30..c5b9e92d69133e593a2ce223e83006eda590daa5 100644 --- a/python/paddle/v2/fluid/tests/test_cross_entropy_op.py +++ b/python/paddle/fluid/tests/unittests/test_cross_entropy_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_ctc_align.py b/python/paddle/fluid/tests/unittests/test_ctc_align.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_ctc_align.py rename to python/paddle/fluid/tests/unittests/test_ctc_align.py index cc815d8e9e16d36c4612009bd40414c454dc59fd..f166031a1cbbaa5e312f5c7919b39648d0dad013 100644 --- a/python/paddle/v2/fluid/tests/test_ctc_align.py +++ b/python/paddle/fluid/tests/unittests/test_ctc_align.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_cumsum_op.py b/python/paddle/fluid/tests/unittests/test_cumsum_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_cumsum_op.py rename to python/paddle/fluid/tests/unittests/test_cumsum_op.py index e45ef457306bbdd33508e560cb8d339e801bb5e4..04e7f0b94510987a1872c2d625ac4d29a3c6feba 100644 --- a/python/paddle/v2/fluid/tests/test_cumsum_op.py +++ b/python/paddle/fluid/tests/unittests/test_cumsum_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_decayed_adagrad_op.py b/python/paddle/fluid/tests/unittests/test_decayed_adagrad_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_decayed_adagrad_op.py rename to python/paddle/fluid/tests/unittests/test_decayed_adagrad_op.py index 78d4e3608e6f9fef247551a9ec8a70899bf8f86c..84c44d4817366518a2cbc3f0a777ab32b67f3d11 100644 --- a/python/paddle/v2/fluid/tests/test_decayed_adagrad_op.py +++ b/python/paddle/fluid/tests/unittests/test_decayed_adagrad_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_default_scope_funcs.py b/python/paddle/fluid/tests/unittests/test_default_scope_funcs.py similarity index 92% rename from python/paddle/v2/fluid/tests/test_default_scope_funcs.py rename to python/paddle/fluid/tests/unittests/test_default_scope_funcs.py index 5ff52f6d6b46f18a12fc508d8ce1a9fb20e6d6ca..a3bf7b544b91c70ffe3894219c118ec9887aba81 100644 --- a/python/paddle/v2/fluid/tests/test_default_scope_funcs.py +++ b/python/paddle/fluid/tests/unittests/test_default_scope_funcs.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.v2.fluid.default_scope_funcs import * +from paddle.fluid.default_scope_funcs import * import unittest diff --git a/python/paddle/v2/fluid/tests/test_detection_map_op.py b/python/paddle/fluid/tests/unittests/test_detection_map_op.py similarity index 100% rename from python/paddle/v2/fluid/tests/test_detection_map_op.py rename to python/paddle/fluid/tests/unittests/test_detection_map_op.py diff --git a/python/paddle/v2/fluid/tests/test_detection_output_op.py b/python/paddle/fluid/tests/unittests/test_detection_output_op.py similarity index 91% rename from python/paddle/v2/fluid/tests/test_detection_output_op.py rename to python/paddle/fluid/tests/unittests/test_detection_output_op.py index 8a5e06b38f5ed5336ef02bac7876610758b44258..94681319144ee3e0d51b57944f5692183578c01b 100644 --- a/python/paddle/v2/fluid/tests/test_detection_output_op.py +++ b/python/paddle/fluid/tests/unittests/test_detection_output_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,6 +68,4 @@ class TestUnpoolOp(OpTest): if __name__ == '__main__': - # FIXME: detection_output_op will be rewritten. This unittest should be - # enabled after rewriting. - exit(0) # temporary disable this unittest + unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_dropout_op.py b/python/paddle/fluid/tests/unittests/test_dropout_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_dropout_op.py rename to python/paddle/fluid/tests/unittests/test_dropout_op.py index b0c55df9f58834688846c5362113464996eb286a..60930a612c128cbf18e89711b9246d148e41ec58 100644 --- a/python/paddle/v2/fluid/tests/test_dropout_op.py +++ b/python/paddle/fluid/tests/unittests/test_dropout_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_dyn_rnn.py b/python/paddle/fluid/tests/unittests/test_dyn_rnn.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_dyn_rnn.py rename to python/paddle/fluid/tests/unittests/test_dyn_rnn.py index 2ac926c63c906767cb08c561b043b8a6cc6b36bd..0a3812a68d60c6bc44b1c275526dc0ac5c9e3b1c 100644 --- a/python/paddle/v2/fluid/tests/test_dyn_rnn.py +++ b/python/paddle/fluid/tests/unittests/test_dyn_rnn.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import paddle.v2 as paddle import unittest import numpy diff --git a/python/paddle/v2/fluid/tests/test_dynrnn_gradient_check.py b/python/paddle/fluid/tests/unittests/test_dynrnn_gradient_check.py similarity index 99% rename from python/paddle/v2/fluid/tests/test_dynrnn_gradient_check.py rename to python/paddle/fluid/tests/unittests/test_dynrnn_gradient_check.py index dd608432df411a670210148af81ff4a6d3151a85..f3dcbe3386a7241449ef7d7aa7982557ddb47823 100644 --- a/python/paddle/v2/fluid/tests/test_dynrnn_gradient_check.py +++ b/python/paddle/fluid/tests/unittests/test_dynrnn_gradient_check.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import numpy import random import collections -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import unittest from decorators import * diff --git a/python/paddle/v2/fluid/tests/test_dynrnn_static_input.py b/python/paddle/fluid/tests/unittests/test_dynrnn_static_input.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_dynrnn_static_input.py rename to python/paddle/fluid/tests/unittests/test_dynrnn_static_input.py index d14923b6b30d80e89f27221030f60edf947ae63d..c28177a1ae513bb84a220a7b945cbf619c2d8e83 100644 --- a/python/paddle/v2/fluid/tests/test_dynrnn_static_input.py +++ b/python/paddle/fluid/tests/unittests/test_dynrnn_static_input.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ import unittest import paddle.v2 as paddle -import paddle.v2.fluid.core as core -import paddle.v2.fluid as fluid -from paddle.v2.fluid.backward import append_backward -import paddle.v2.fluid.framework as framework -from paddle.v2.fluid.framework import Program, switch_main_program +import paddle.fluid.core as core +import paddle.fluid as fluid +from paddle.fluid.backward import append_backward +import paddle.fluid.framework as framework +from paddle.fluid.framework import Program, switch_main_program import bisect import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_edit_distance_op.py b/python/paddle/fluid/tests/unittests/test_edit_distance_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_edit_distance_op.py rename to python/paddle/fluid/tests/unittests/test_edit_distance_op.py index bebdc5cba36fc96d31162d0d7d43e52064ca8e2d..2957fb50586c8bce74bbf8066e0e9bf24d79cb7d 100644 --- a/python/paddle/v2/fluid/tests/test_edit_distance_op.py +++ b/python/paddle/fluid/tests/unittests/test_edit_distance_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_elementwise_add_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_add_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_elementwise_add_op.py rename to python/paddle/fluid/tests/unittests/test_elementwise_add_op.py index 3564772fb52882e9e58ea88caeb12c5e91137525..c8e930dad762b867d0148ebcdb3637b8cc9560ce 100644 --- a/python/paddle/v2/fluid/tests/test_elementwise_add_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_add_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_elementwise_div_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_div_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_elementwise_div_op.py rename to python/paddle/fluid/tests/unittests/test_elementwise_div_op.py index 77b113af7693c4a71a5a13c791cfb3e0420f4ff8..bfe022af6dac711e76678b79005d4cfff90c2a2b 100644 --- a/python/paddle/v2/fluid/tests/test_elementwise_div_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_div_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_elementwise_max_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_max_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_elementwise_max_op.py rename to python/paddle/fluid/tests/unittests/test_elementwise_max_op.py index 0fc15693b1d2fbd89a1659dfbe5de0fff8d15762..b6cd18a579520f921feed48cc86d8027f6a7bd1e 100644 --- a/python/paddle/v2/fluid/tests/test_elementwise_max_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_max_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_elementwise_min_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_min_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_elementwise_min_op.py rename to python/paddle/fluid/tests/unittests/test_elementwise_min_op.py index 51584d6980924f2f6dcaedf4eec7bc75de33564b..92099724fe65050b62c738f4e6c269a0ca3f4ef1 100644 --- a/python/paddle/v2/fluid/tests/test_elementwise_min_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_min_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_elementwise_mul_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_mul_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_elementwise_mul_op.py rename to python/paddle/fluid/tests/unittests/test_elementwise_mul_op.py index 12dfa6599cd634e1d806980f89e7c013b8eb8754..2742bb21d95ed3363e82a70b0172cc787878abd9 100644 --- a/python/paddle/v2/fluid/tests/test_elementwise_mul_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_mul_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_elementwise_pow_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_pow_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_elementwise_pow_op.py rename to python/paddle/fluid/tests/unittests/test_elementwise_pow_op.py index e31749df9baf10215fcd0cca3c1097f00c163ec7..a3fd18669c556701b2586e88ddbb89ca79549a86 100644 --- a/python/paddle/v2/fluid/tests/test_elementwise_pow_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_pow_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_elementwise_sub_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_elementwise_sub_op.py rename to python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py index cf53d85bbad81f393a6263f8742fc942d357135f..acf652d3fb9743d69b7f7e248ff7a3ee83fc4c50 100644 --- a/python/paddle/v2/fluid/tests/test_elementwise_sub_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_exception.py b/python/paddle/fluid/tests/unittests/test_exception.py similarity index 89% rename from python/paddle/v2/fluid/tests/test_exception.py rename to python/paddle/fluid/tests/unittests/test_exception.py index cd57ca586bfbc0773a2fd02d0c6d28182df2366b..bb7c0f88f6027807394e15aa6803da2ddc22f4e2 100644 --- a/python/paddle/v2/fluid/tests/test_exception.py +++ b/python/paddle/fluid/tests/unittests/test_exception.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import unittest diff --git a/python/paddle/v2/fluid/tests/test_executor_and_mul.py b/python/paddle/fluid/tests/unittests/test_executor_and_mul.py similarity index 87% rename from python/paddle/v2/fluid/tests/test_executor_and_mul.py rename to python/paddle/fluid/tests/unittests/test_executor_and_mul.py index 44f93be6cb3778822b849118396dc51084e66f6b..4958bef3ef4d101f934a2776efc21efdd24a9a4d 100644 --- a/python/paddle/v2/fluid/tests/test_executor_and_mul.py +++ b/python/paddle/fluid/tests/unittests/test_executor_and_mul.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,10 @@ import unittest import numpy -import paddle.v2.fluid.core as core +import paddle.fluid.core as core -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.layers import mul, data +from paddle.fluid.executor import Executor +from paddle.fluid.layers import mul, data class TestExecutor(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_expand_op.py b/python/paddle/fluid/tests/unittests/test_expand_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_expand_op.py rename to python/paddle/fluid/tests/unittests/test_expand_op.py index b1a1cbc0fae15b3e6159c9ec850ebde7cf19c228..a91e3aef5a18a681f3baf405da2beebb8c85360c 100644 --- a/python/paddle/v2/fluid/tests/test_expand_op.py +++ b/python/paddle/fluid/tests/unittests/test_expand_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_feed_fetch_method.py b/python/paddle/fluid/tests/unittests/test_feed_fetch_method.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_feed_fetch_method.py rename to python/paddle/fluid/tests/unittests/test_feed_fetch_method.py index 827a7590ff3ca6b32fb37dda67468f3b1f95ee1b..9d724a6479f061996359b1efcc5f61f0564331c7 100644 --- a/python/paddle/v2/fluid/tests/test_feed_fetch_method.py +++ b/python/paddle/fluid/tests/unittests/test_feed_fetch_method.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import unittest import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_fetch_var.py b/python/paddle/fluid/tests/unittests/test_fetch_var.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_fetch_var.py rename to python/paddle/fluid/tests/unittests/test_fetch_var.py index ed75a350b0bcb220c8435d60e1978c27da84a24c..46c3bbb6712c6276e48dd9328d7741a447f28b91 100644 --- a/python/paddle/v2/fluid/tests/test_fetch_var.py +++ b/python/paddle/fluid/tests/unittests/test_fetch_var.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid as fluid -import paddle.v2.fluid.layers as layers +import paddle.fluid as fluid +import paddle.fluid.layers as layers import op_test import numpy import unittest diff --git a/python/paddle/v2/fluid/tests/test_fill_constant_batch_size_like_op.py b/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_fill_constant_batch_size_like_op.py rename to python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py index f34a1ceb230208d6842f473636348e654154c2f4..66e3e2d51d118756d4881955b4df8eb4d2bbc094 100644 --- a/python/paddle/v2/fluid/tests/test_fill_constant_batch_size_like_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_fill_constant_op.py b/python/paddle/fluid/tests/unittests/test_fill_constant_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_fill_constant_op.py rename to python/paddle/fluid/tests/unittests/test_fill_constant_op.py index a05fa39729d4cd91c93cab935ba6f8cc68a57c52..5e2ddb218af8fcf4f686260296b57519ec7486b9 100644 --- a/python/paddle/v2/fluid/tests/test_fill_constant_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_constant_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_fill_op.py b/python/paddle/fluid/tests/unittests/test_fill_op.py similarity index 87% rename from python/paddle/v2/fluid/tests/test_fill_op.py rename to python/paddle/fluid/tests/unittests/test_fill_op.py index 901546f6f8965e3ffb55c6686c229061e15eae8d..762d29199e2127415ed7daabca63edcdbae3344f 100644 --- a/python/paddle/v2/fluid/tests/test_fill_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import unittest import numpy as np from op_test import OpTest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core class TestFillOp(OpTest): @@ -26,7 +26,7 @@ class TestFillOp(OpTest): self.attrs = { 'value': val.flatten().tolist(), 'shape': [100, 200], - 'dtype': int(core.DataType.FP64) + 'dtype': int(core.VarDesc.VarType.FP64) } self.outputs = {'Out': val.astype('float64')} diff --git a/python/paddle/v2/fluid/tests/test_fill_zeros_like_op.py b/python/paddle/fluid/tests/unittests/test_fill_zeros_like_op.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_fill_zeros_like_op.py rename to python/paddle/fluid/tests/unittests/test_fill_zeros_like_op.py index b7f0b96647d5fe645157498f15a8a5d0e4430c67..c9b3e4ba138f425fd2991bf637d2e32be3eb5168 100644 --- a/python/paddle/v2/fluid/tests/test_fill_zeros_like_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_zeros_like_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_framework_debug_str.py b/python/paddle/fluid/tests/unittests/test_framework_debug_str.py similarity index 88% rename from python/paddle/v2/fluid/tests/test_framework_debug_str.py rename to python/paddle/fluid/tests/unittests/test_framework_debug_str.py index f8fcfb2249bc635ce297381359db954bfd62df26..c906c74afe66b05e2ca0e1122677e2dc738351b8 100644 --- a/python/paddle/v2/fluid/tests/test_framework_debug_str.py +++ b/python/paddle/fluid/tests/unittests/test_framework_debug_str.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. import unittest -from paddle.v2.fluid.framework import Program +from paddle.fluid.framework import Program class TestDebugStringFramework(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_ftrl_op.py b/python/paddle/fluid/tests/unittests/test_ftrl_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_ftrl_op.py rename to python/paddle/fluid/tests/unittests/test_ftrl_op.py index 895337de0fb9885b3d78d0af23c03fd82a360497..5f7581391afb2bd57cb25695f3c0d4db8573c80c 100644 --- a/python/paddle/v2/fluid/tests/test_ftrl_op.py +++ b/python/paddle/fluid/tests/unittests/test_ftrl_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_gather_op.py b/python/paddle/fluid/tests/unittests/test_gather_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_gather_op.py rename to python/paddle/fluid/tests/unittests/test_gather_op.py index 76756367976c7056904d6d757ef9635261dc8985..6fd043c27e27db53c95be3630b6c08216e8e35f4 100644 --- a/python/paddle/v2/fluid/tests/test_gather_op.py +++ b/python/paddle/fluid/tests/unittests/test_gather_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py b/python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py new file mode 100644 index 0000000000000000000000000000000000000000..1398166a74e714e0e902532166cde5d94ccae5f6 --- /dev/null +++ b/python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py @@ -0,0 +1,46 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest +import numpy as np +from op_test import OpTest + + +class TestGaussianRandomBatchSizeLike(OpTest): + def setUp(self): + self.op_type = "gaussian_random_batch_size_like" + self.inputs = {'Input': np.zeros((500, 2000), dtype="float32")} + self.attrs = {'mean': 1., 'std': 2., 'shape': [-1, 2000]} + self.outputs = {'Out': np.zeros((500, 2000), dtype='float32')} + + def test_check_output(self): + self.check_output_customized(self.verify_output) + + def verify_output(self, outs): + self.assertEqual(outs[0].shape, (500, 2000)) + hist, _ = np.histogram(outs[0], range=(-3, 5)) + hist = hist.astype("float32") + hist /= float(outs[0].size) + data = np.random.normal(size=(500, 2000), loc=1, scale=2) + hist2, _ = np.histogram(data, range=(-3, 5)) + hist2 = hist2.astype("float32") + hist2 /= float(outs[0].size) + self.assertTrue( + np.allclose( + hist, hist2, rtol=0, atol=0.01), + "hist: " + str(hist) + " hist2: " + str(hist2)) + + +if __name__ == "__main__": + unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_gaussian_random_op.py b/python/paddle/fluid/tests/unittests/test_gaussian_random_op.py similarity index 89% rename from python/paddle/v2/fluid/tests/test_gaussian_random_op.py rename to python/paddle/fluid/tests/unittests/test_gaussian_random_op.py index 79beb8b1fcef610bc2f3e8d18da4345baa9b99c3..272caceaf38699438ccae41691bf26b2eb4d2a22 100644 --- a/python/paddle/v2/fluid/tests/test_gaussian_random_op.py +++ b/python/paddle/fluid/tests/unittests/test_gaussian_random_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,10 @@ import unittest import numpy -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core -from paddle.v2.fluid.op import Operator -from paddle.v2.fluid.executor import Executor +import paddle.fluid as fluid +import paddle.fluid.core as core +from paddle.fluid.op import Operator +from paddle.fluid.executor import Executor class TestGaussianRandomOp(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_get_places_op.py b/python/paddle/fluid/tests/unittests/test_get_places_op.py similarity index 90% rename from python/paddle/v2/fluid/tests/test_get_places_op.py rename to python/paddle/fluid/tests/unittests/test_get_places_op.py index 68698c5f4a2354595dcc0cb271ad9f57a35386e1..6dab1e22f0c50ab011d6b8e8944097600cf3fecc 100644 --- a/python/paddle/v2/fluid/tests/test_get_places_op.py +++ b/python/paddle/fluid/tests/unittests/test_get_places_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import decorators import unittest diff --git a/python/paddle/v2/fluid/tests/test_gru_op.py b/python/paddle/fluid/tests/unittests/test_gru_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_gru_op.py rename to python/paddle/fluid/tests/unittests/test_gru_op.py index 69cfd6c481cba30148b0f367711c7ee8c25acd3a..3a13eb872a8646cede126b667864dfc3784ebd0b 100644 --- a/python/paddle/v2/fluid/tests/test_gru_op.py +++ b/python/paddle/fluid/tests/unittests/test_gru_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_gru_unit_op.py b/python/paddle/fluid/tests/unittests/test_gru_unit_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_gru_unit_op.py rename to python/paddle/fluid/tests/unittests/test_gru_unit_op.py index 71f13c4513622579b5a8a718954e6b493b929ce1..c56b1eefd3a3dfe1478bd0526fa32077edcac9ba 100644 --- a/python/paddle/v2/fluid/tests/test_gru_unit_op.py +++ b/python/paddle/fluid/tests/unittests/test_gru_unit_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_hinge_loss_op.py b/python/paddle/fluid/tests/unittests/test_hinge_loss_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_hinge_loss_op.py rename to python/paddle/fluid/tests/unittests/test_hinge_loss_op.py index 71ff47316eccd9a9f0a34942feaea6722a4b28f5..70586c6be3da415fbccf4114615e6f7e08de0f0f 100644 --- a/python/paddle/v2/fluid/tests/test_hinge_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_hinge_loss_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_huber_loss_op.py b/python/paddle/fluid/tests/unittests/test_huber_loss_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_huber_loss_op.py rename to python/paddle/fluid/tests/unittests/test_huber_loss_op.py index e4560af77826a7368b305eb58515e4e44b450a78..a8d0a77625598e9d929a993db46ba95b0e07527a 100644 --- a/python/paddle/v2/fluid/tests/test_huber_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_huber_loss_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_im2sequence_op.py b/python/paddle/fluid/tests/unittests/test_im2sequence_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_im2sequence_op.py rename to python/paddle/fluid/tests/unittests/test_im2sequence_op.py index 2cab3e31a50034e3b1b362b59690e425aef1c399..4946475f11a4fc0ccaffeec6821d3976ea7c6560 100644 --- a/python/paddle/v2/fluid/tests/test_im2sequence_op.py +++ b/python/paddle/fluid/tests/unittests/test_im2sequence_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_image_classification_layer.py b/python/paddle/fluid/tests/unittests/test_image_classification_layer.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_image_classification_layer.py rename to python/paddle/fluid/tests/unittests/test_image_classification_layer.py index c64cfed5f583fb48588e479f862917a7b4d37c2c..6ecfa9ea213fe0cf57e18fa83bbb85c223727d71 100644 --- a/python/paddle/v2/fluid/tests/test_image_classification_layer.py +++ b/python/paddle/fluid/tests/unittests/test_image_classification_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,9 +14,9 @@ import unittest -import paddle.v2.fluid as fluid -import paddle.v2.fluid.nets as nets -from paddle.v2.fluid.framework import Program +import paddle.fluid as fluid +import paddle.fluid.nets as nets +from paddle.fluid.framework import Program def conv_block(input, num_filter, groups, dropouts): diff --git a/python/paddle/v2/fluid/tests/test_infer_shape.py b/python/paddle/fluid/tests/unittests/test_infer_shape.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_infer_shape.py rename to python/paddle/fluid/tests/unittests/test_infer_shape.py index 521096388a338ceda0c71f6b7963c06f85263c69..699a2d42467b7ac0dcf1939bde744ad2fcb29c97 100644 --- a/python/paddle/v2/fluid/tests/test_infer_shape.py +++ b/python/paddle/fluid/tests/unittests/test_infer_shape.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ import unittest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core class TestInferShape(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_inference_model_io.py b/python/paddle/fluid/tests/unittests/test_inference_model_io.py similarity index 87% rename from python/paddle/v2/fluid/tests/test_inference_model_io.py rename to python/paddle/fluid/tests/unittests/test_inference_model_io.py index adf428aa848268704c1749b360a4b499be2383e8..238ca7188b80f53fd3f84801e4fe6ac6ad4d0f97 100644 --- a/python/paddle/v2/fluid/tests/test_inference_model_io.py +++ b/python/paddle/fluid/tests/unittests/test_inference_model_io.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,13 +15,13 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core -import paddle.v2.fluid.executor as executor -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.optimizer as optimizer -from paddle.v2.fluid.framework import Program, program_guard -from paddle.v2.fluid.io import save_inference_model, load_inference_model +import paddle.fluid.executor as executor +import paddle.fluid.layers as layers +import paddle.fluid.optimizer as optimizer +from paddle.fluid.framework import Program, program_guard +from paddle.fluid.io import save_inference_model, load_inference_model class TestBook(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_initializer.py b/python/paddle/fluid/tests/unittests/test_initializer.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_initializer.py rename to python/paddle/fluid/tests/unittests/test_initializer.py index 67746b4d7d96a6bb039e05795f11f3cb117cf85c..587e2025e1045f63a5825f884d4dcad8b4685e62 100644 --- a/python/paddle/v2/fluid/tests/test_initializer.py +++ b/python/paddle/fluid/tests/unittests/test_initializer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ import numpy as np import unittest -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.initializer as initializer +import paddle.fluid.framework as framework +import paddle.fluid.initializer as initializer DELTA = 0.00001 diff --git a/python/paddle/v2/fluid/tests/test_iou_similarity_op.py b/python/paddle/fluid/tests/unittests/test_iou_similarity_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_iou_similarity_op.py rename to python/paddle/fluid/tests/unittests/test_iou_similarity_op.py index 128f2e4977195a563efcd26364cc6261da2dd685..e33436b63c0e0b41f5e4a5bc6190517d7c648277 100644 --- a/python/paddle/v2/fluid/tests/test_iou_similarity_op.py +++ b/python/paddle/fluid/tests/unittests/test_iou_similarity_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_is_empty_op.py b/python/paddle/fluid/tests/unittests/test_is_empty_op.py similarity index 91% rename from python/paddle/v2/fluid/tests/test_is_empty_op.py rename to python/paddle/fluid/tests/unittests/test_is_empty_op.py index 7c17e3d57aa3eb93d0bc82ca81a96a7a1866f15c..4d11cf226be2ba4ffbe015198fed3191f1e02f72 100644 --- a/python/paddle/v2/fluid/tests/test_is_empty_op.py +++ b/python/paddle/fluid/tests/unittests/test_is_empty_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ import unittest import numpy as np -from paddle.v2.fluid.op import Operator -import paddle.v2.fluid.core as core +from paddle.fluid.op import Operator +import paddle.fluid.core as core def create_tensor(scope, name, np_data): diff --git a/python/paddle/v2/fluid/tests/test_l1_norm_op.py b/python/paddle/fluid/tests/unittests/test_l1_norm_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_l1_norm_op.py rename to python/paddle/fluid/tests/unittests/test_l1_norm_op.py index bbc20878468371a547d2b9e275157dab51a79408..fa5b18a16f7a3e734ff8bb4f53240e8a9ce8fd8f 100644 --- a/python/paddle/v2/fluid/tests/test_l1_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_l1_norm_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_label_smooth_op.py b/python/paddle/fluid/tests/unittests/test_label_smooth_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_label_smooth_op.py rename to python/paddle/fluid/tests/unittests/test_label_smooth_op.py index 19a4df57446c0c83b415909df3e0246bf2716881..ca21289a0d48a123aed90bc557ccc732702b47f1 100644 --- a/python/paddle/v2/fluid/tests/test_label_smooth_op.py +++ b/python/paddle/fluid/tests/unittests/test_label_smooth_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_layer_norm_op.py b/python/paddle/fluid/tests/unittests/test_layer_norm_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_layer_norm_op.py rename to python/paddle/fluid/tests/unittests/test_layer_norm_op.py index 4460ffaf9c46966178497419a35ef4044464ac9f..8c67e45b7fc997012af5f678f21271ad8b220edc 100644 --- a/python/paddle/v2/fluid/tests/test_layer_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_layer_norm_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,9 +16,9 @@ import numpy as np from operator import mul from op_test import OpTest -import paddle.v2.fluid.core as core -from paddle.v2.fluid.op import Operator -from paddle.v2.fluid.framework import grad_var_name +import paddle.fluid.core as core +from paddle.fluid.op import Operator +from paddle.fluid.framework import grad_var_name np.random.random(123) @@ -97,9 +97,9 @@ def set_output_grad(scope, outputs, place, feed_dict=None): grad_tensor = scope.var(grad_var_name(name)).get_tensor() out_dtype = out_tensor.dtype() if data is None: - if out_dtype == core.DataType.FP64: + if out_dtype == core.VarDesc.VarType.FP64: data = np.ones(out_tensor.shape(), dtype=np.float64) - elif out_dtype == core.DataType.FP32: + elif out_dtype == core.VarDesc.VarType.FP32: data = np.ones(out_tensor.shape(), dtype=np.float32) else: raise ValueError("Not supported data type " + str(out_dtype)) diff --git a/python/paddle/v2/fluid/tests/test_layers.py b/python/paddle/fluid/tests/unittests/test_layers.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_layers.py rename to python/paddle/fluid/tests/unittests/test_layers.py index 50ef8204249250b5ca1555a5192bc3ed0ca108b9..bb673d3b541e6589e8979ced0b4aa25075b22a17 100644 --- a/python/paddle/v2/fluid/tests/test_layers.py +++ b/python/paddle/fluid/tests/unittests/test_layers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,10 @@ from __future__ import print_function import unittest -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.nets as nets -from paddle.v2.fluid.framework import Program, program_guard, default_main_program -from paddle.v2.fluid.param_attr import ParamAttr +import paddle.fluid.layers as layers +import paddle.fluid.nets as nets +from paddle.fluid.framework import Program, program_guard, default_main_program +from paddle.fluid.param_attr import ParamAttr import decorators diff --git a/python/paddle/v2/fluid/tests/test_learning_rate_decay.py b/python/paddle/fluid/tests/unittests/test_learning_rate_decay.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_learning_rate_decay.py rename to python/paddle/fluid/tests/unittests/test_learning_rate_decay.py index 1d6bab3d6c44b2b3403778d5db086e405bb30dee..595b05168920f3b9497172e502591cef82903cdc 100644 --- a/python/paddle/v2/fluid/tests/test_learning_rate_decay.py +++ b/python/paddle/fluid/tests/unittests/test_learning_rate_decay.py @@ -17,10 +17,10 @@ import unittest import math import copy -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid as fluid -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.learning_rate_decay as lr_decay +import paddle.fluid.framework as framework +import paddle.fluid as fluid +import paddle.fluid.layers as layers +import paddle.fluid.learning_rate_decay as lr_decay def exponential_decay(learning_rate, diff --git a/python/paddle/v2/fluid/tests/test_linear_chain_crf_op.py b/python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_linear_chain_crf_op.py rename to python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py index cbfd9d5e5b359b708e0e84c2c40ca0ef41cc35b6..f49f7635f76c9feb5b5593438cb445df9488c69b 100644 --- a/python/paddle/v2/fluid/tests/test_linear_chain_crf_op.py +++ b/python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_lod_array_length_op.py b/python/paddle/fluid/tests/unittests/test_lod_array_length_op.py similarity index 85% rename from python/paddle/v2/fluid/tests/test_lod_array_length_op.py rename to python/paddle/fluid/tests/unittests/test_lod_array_length_op.py index eff28368f1a6a78b8e7e9df7e281a1eb3b11288e..d8b4e40662568f580ccff0257512cb8809488f17 100644 --- a/python/paddle/v2/fluid/tests/test_lod_array_length_op.py +++ b/python/paddle/fluid/tests/unittests/test_lod_array_length_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,9 @@ # limitations under the License. import unittest -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.executor import Executor -import paddle.v2.fluid.core as core +import paddle.fluid.layers as layers +from paddle.fluid.executor import Executor +import paddle.fluid.core as core import numpy diff --git a/python/paddle/v2/fluid/tests/test_lod_rank_table.py b/python/paddle/fluid/tests/unittests/test_lod_rank_table.py similarity index 86% rename from python/paddle/v2/fluid/tests/test_lod_rank_table.py rename to python/paddle/fluid/tests/unittests/test_lod_rank_table.py index eb0392e8bf7111f223a54430ab7a6646a4f35f71..093eecb8370b8ae7e4c43ce7ca6f50f5d302bd60 100644 --- a/python/paddle/v2/fluid/tests/test_lod_rank_table.py +++ b/python/paddle/fluid/tests/unittests/test_lod_rank_table.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.v2.fluid.layers import lod_rank_table, data -from paddle.v2.fluid.executor import Executor -import paddle.v2.fluid.core as core +from paddle.fluid.layers import lod_rank_table, data +from paddle.fluid.executor import Executor +import paddle.fluid.core as core import numpy import unittest diff --git a/python/paddle/v2/fluid/tests/test_lod_reset_op.py b/python/paddle/fluid/tests/unittests/test_lod_reset_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_lod_reset_op.py rename to python/paddle/fluid/tests/unittests/test_lod_reset_op.py index 4ee360403e88c6a4f8d5fcc6d6ce8acc865e6277..3bf8230f8748dd87ec3c85b0cbd78df2e695a96b 100644 --- a/python/paddle/v2/fluid/tests/test_lod_reset_op.py +++ b/python/paddle/fluid/tests/unittests/test_lod_reset_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_lod_tensor_array.py b/python/paddle/fluid/tests/unittests/test_lod_tensor_array.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_lod_tensor_array.py rename to python/paddle/fluid/tests/unittests/test_lod_tensor_array.py index 0f3ac3c03dbe43c2e977a5e98faff31d6c231acd..63b17a5ccd62ed79b3d611e039c2b2705a133272 100644 --- a/python/paddle/v2/fluid/tests/test_lod_tensor_array.py +++ b/python/paddle/fluid/tests/unittests/test_lod_tensor_array.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import numpy diff --git a/python/paddle/v2/fluid/tests/test_lod_tensor_array_ops.py b/python/paddle/fluid/tests/unittests/test_lod_tensor_array_ops.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_lod_tensor_array_ops.py rename to python/paddle/fluid/tests/unittests/test_lod_tensor_array_ops.py index c2d04db99b969430f3a70e45c92967f548ba513b..de1a3d101d8343bf25be5fd6e8b7791d06b4ab02 100644 --- a/python/paddle/v2/fluid/tests/test_lod_tensor_array_ops.py +++ b/python/paddle/fluid/tests/unittests/test_lod_tensor_array_ops.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,12 +13,12 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import numpy -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.framework import Program, program_guard -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.backward import append_backward +import paddle.fluid.layers as layers +from paddle.fluid.framework import Program, program_guard +from paddle.fluid.executor import Executor +from paddle.fluid.backward import append_backward class TestCPULoDTensorArrayOps(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_log_loss_op.py b/python/paddle/fluid/tests/unittests/test_log_loss_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_log_loss_op.py rename to python/paddle/fluid/tests/unittests/test_log_loss_op.py index 338355d0c4d33a8927e689001bae3a236a0ecd3a..d3980b8db93ca517d16b6f782ba800ce839c3f45 100644 --- a/python/paddle/v2/fluid/tests/test_log_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_log_loss_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_logical_op.py b/python/paddle/fluid/tests/unittests/test_logical_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_logical_op.py rename to python/paddle/fluid/tests/unittests/test_logical_op.py index dd67dc561b0e2740d60c3bc21fae0a10ba648c5e..1d7dfe60f200459705a48664c1a5b22d2a5888d2 100644 --- a/python/paddle/v2/fluid/tests/test_logical_op.py +++ b/python/paddle/fluid/tests/unittests/test_logical_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_lookup_table_op.py b/python/paddle/fluid/tests/unittests/test_lookup_table_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_lookup_table_op.py rename to python/paddle/fluid/tests/unittests/test_lookup_table_op.py index 0c566c76c91dce8dcfc882eed998f492ae3cde76..03a5bd24a133e703855400532517c293196b64f0 100644 --- a/python/paddle/v2/fluid/tests/test_lookup_table_op.py +++ b/python/paddle/fluid/tests/unittests/test_lookup_table_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_lrn_op.py b/python/paddle/fluid/tests/unittests/test_lrn_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_lrn_op.py rename to python/paddle/fluid/tests/unittests/test_lrn_op.py index a841dcf79f9abbd9e4a995a395ae9211f62832f2..7f2352c5882ce36d8d681a737806f3ee0e3ace98 100644 --- a/python/paddle/v2/fluid/tests/test_lrn_op.py +++ b/python/paddle/fluid/tests/unittests/test_lrn_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_lstm_op.py b/python/paddle/fluid/tests/unittests/test_lstm_op.py similarity index 99% rename from python/paddle/v2/fluid/tests/test_lstm_op.py rename to python/paddle/fluid/tests/unittests/test_lstm_op.py index 3e79f9d8e157bc744f14ecfa7c9a6d7de4eae1f9..f8ff5a3361af66612f08b2aa4eaffa363f04c594 100644 --- a/python/paddle/v2/fluid/tests/test_lstm_op.py +++ b/python/paddle/fluid/tests/unittests/test_lstm_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_lstm_unit_op.py b/python/paddle/fluid/tests/unittests/test_lstm_unit_op.py similarity index 91% rename from python/paddle/v2/fluid/tests/test_lstm_unit_op.py rename to python/paddle/fluid/tests/unittests/test_lstm_unit_op.py index d6348ea0ec9ddf6adb8b48f0d4aeb03dd9b0e895..e343265874f99afcd8201fa997932e2613fffc4c 100644 --- a/python/paddle/v2/fluid/tests/test_lstm_unit_op.py +++ b/python/paddle/fluid/tests/unittests/test_lstm_unit_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,6 +49,4 @@ class LstmUnitTest(OpTest): if __name__ == "__main__": - # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/5185 - exit(0) unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_lstmp_op.py b/python/paddle/fluid/tests/unittests/test_lstmp_op.py similarity index 99% rename from python/paddle/v2/fluid/tests/test_lstmp_op.py rename to python/paddle/fluid/tests/unittests/test_lstmp_op.py index 92a954a9aa5574c3016cf9744e1765fff9e9c091..afff133f6c6cfe45d1aca4014dc8b92e6562e6b8 100644 --- a/python/paddle/v2/fluid/tests/test_lstmp_op.py +++ b/python/paddle/fluid/tests/unittests/test_lstmp_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_margin_rank_loss_op.py b/python/paddle/fluid/tests/unittests/test_margin_rank_loss_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_margin_rank_loss_op.py rename to python/paddle/fluid/tests/unittests/test_margin_rank_loss_op.py index 694ce20712864effbd2d1e1c66c388b5a3c8ec49..97c112487fd9193ab77d18945585a554e5fbcdf8 100644 --- a/python/paddle/v2/fluid/tests/test_margin_rank_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_margin_rank_loss_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_math_op_patch.py b/python/paddle/fluid/tests/unittests/test_math_op_patch.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_math_op_patch.py rename to python/paddle/fluid/tests/unittests/test_math_op_patch.py index 2e77639a4c886327cc8dc7053fc6c0f6c6e9dcc9..6864d271e795026d59525e9f1e4d86e32df980bf 100644 --- a/python/paddle/v2/fluid/tests/test_math_op_patch.py +++ b/python/paddle/fluid/tests/unittests/test_math_op_patch.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ import unittest import decorators -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import numpy diff --git a/python/paddle/v2/fluid/tests/test_matmul_op.py b/python/paddle/fluid/tests/unittests/test_matmul_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_matmul_op.py rename to python/paddle/fluid/tests/unittests/test_matmul_op.py index 5138af38f4dcc044d31622341b3d7fccc4f6bc90..44ac4683891ffd3141a126740f4fddb47550e183 100644 --- a/python/paddle/v2/fluid/tests/test_matmul_op.py +++ b/python/paddle/fluid/tests/unittests/test_matmul_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_maxout_op.py b/python/paddle/fluid/tests/unittests/test_maxout_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_maxout_op.py rename to python/paddle/fluid/tests/unittests/test_maxout_op.py index 5cd7fbde84a3414829aa51f39283fed0499d39f1..f5ddf72516bf8adb41698d9b2e22c7de74a3fad9 100644 --- a/python/paddle/v2/fluid/tests/test_maxout_op.py +++ b/python/paddle/fluid/tests/unittests/test_maxout_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_mean_op.py b/python/paddle/fluid/tests/unittests/test_mean_op.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_mean_op.py rename to python/paddle/fluid/tests/unittests/test_mean_op.py index 81e842163584456b33a0dbd95cfcb405ae857b75..15472a8fc4716f218b0eddf17589634c565130b1 100644 --- a/python/paddle/v2/fluid/tests/test_mean_op.py +++ b/python/paddle/fluid/tests/unittests/test_mean_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_memory_optimization_transpiler.py b/python/paddle/fluid/tests/unittests/test_memory_optimization_transpiler.py similarity index 83% rename from python/paddle/v2/fluid/tests/test_memory_optimization_transpiler.py rename to python/paddle/fluid/tests/unittests/test_memory_optimization_transpiler.py index 2e9ed78ffd8253d5f2286256097a2238a99d7ba5..e57804d0df840331c9f53e4ff1a03f062c3fe93e 100644 --- a/python/paddle/v2/fluid/tests/test_memory_optimization_transpiler.py +++ b/python/paddle/fluid/tests/unittests/test_memory_optimization_transpiler.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,10 @@ from __future__ import print_function import unittest -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.optimizer as optimizer -from paddle.v2.fluid.framework import Program, program_guard -from paddle.v2.fluid.memory_optimization_transpiler import memory_optimize +import paddle.fluid.layers as layers +import paddle.fluid.optimizer as optimizer +from paddle.fluid.framework import Program, program_guard +from paddle.fluid.memory_optimization_transpiler import memory_optimize class TestControlFlowGraph(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_mine_hard_examples_op.py b/python/paddle/fluid/tests/unittests/test_mine_hard_examples_op.py similarity index 100% rename from python/paddle/v2/fluid/tests/test_mine_hard_examples_op.py rename to python/paddle/fluid/tests/unittests/test_mine_hard_examples_op.py diff --git a/python/paddle/v2/fluid/tests/test_minus_op.py b/python/paddle/fluid/tests/unittests/test_minus_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_minus_op.py rename to python/paddle/fluid/tests/unittests/test_minus_op.py index aee909f56c4353dc8feb7bb82198d5944376f151..ee32bd49925e266cfd5beb51496355e111a3d0d2 100644 --- a/python/paddle/v2/fluid/tests/test_minus_op.py +++ b/python/paddle/fluid/tests/unittests/test_minus_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_modified_huber_loss_op.py b/python/paddle/fluid/tests/unittests/test_modified_huber_loss_op.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_modified_huber_loss_op.py rename to python/paddle/fluid/tests/unittests/test_modified_huber_loss_op.py index eb3873b9ea8b9cbf7b87c125559cc070c39946dc..62035efe8ec3809a7672e58697de4304426338d7 100644 --- a/python/paddle/v2/fluid/tests/test_modified_huber_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_modified_huber_loss_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,6 +59,4 @@ class TestModifiedHuberLossOp(OpTest): if __name__ == '__main__': - exit(0) - # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/5184 unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_momentum_op.py b/python/paddle/fluid/tests/unittests/test_momentum_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_momentum_op.py rename to python/paddle/fluid/tests/unittests/test_momentum_op.py index 048eaae06ba5323517d5a32174233faaa0fd8be9..aaea9c1809213c5707e8540eebbdd6f269836fdc 100644 --- a/python/paddle/v2/fluid/tests/test_momentum_op.py +++ b/python/paddle/fluid/tests/unittests/test_momentum_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_mul_op.py b/python/paddle/fluid/tests/unittests/test_mul_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_mul_op.py rename to python/paddle/fluid/tests/unittests/test_mul_op.py index 83715f0e27b4e4599360356c02831c6814ef520f..9d1da420c7f70bd2a89d183a5f0a2b145f0ff475 100644 --- a/python/paddle/v2/fluid/tests/test_mul_op.py +++ b/python/paddle/fluid/tests/unittests/test_mul_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_multiclass_nms_op.py b/python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py similarity index 99% rename from python/paddle/v2/fluid/tests/test_multiclass_nms_op.py rename to python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py index 529223cf40dac646d295941a53455d892274dca3..6459913c0162374e17d0249627e7107a195babf8 100644 --- a/python/paddle/v2/fluid/tests/test_multiclass_nms_op.py +++ b/python/paddle/fluid/tests/unittests/test_multiclass_nms_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_multihead_attention.py b/python/paddle/fluid/tests/unittests/test_multihead_attention.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_multihead_attention.py rename to python/paddle/fluid/tests/unittests/test_multihead_attention.py index a2b300a645fe21931cc12a4e7bb8ebe9b85707c9..80c3c67967e970a7182c008b6cfd138aff044167 100644 --- a/python/paddle/v2/fluid/tests/test_multihead_attention.py +++ b/python/paddle/fluid/tests/unittests/test_multihead_attention.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,8 +13,8 @@ # limitations under the License. import unittest -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core +import paddle.fluid as fluid +import paddle.fluid.core as core import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_multiplex_op.py b/python/paddle/fluid/tests/unittests/test_multiplex_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_multiplex_op.py rename to python/paddle/fluid/tests/unittests/test_multiplex_op.py index a06aef94a5d9dbee1bcad287c18540e308ce22fa..03cad8b43bac053f246156b8c57df9fceab20dcd 100644 --- a/python/paddle/v2/fluid/tests/test_multiplex_op.py +++ b/python/paddle/fluid/tests/unittests/test_multiplex_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_nce.py b/python/paddle/fluid/tests/unittests/test_nce.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_nce.py rename to python/paddle/fluid/tests/unittests/test_nce.py index 9a51c1f612a0d5363d36e6642ed3b409970025b1..76ecc8ba08ba31798040080a0ae99fe515c28cec 100644 --- a/python/paddle/v2/fluid/tests/test_nce.py +++ b/python/paddle/fluid/tests/unittests/test_nce.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -109,6 +109,4 @@ class TestNCECase1(TestNCE): if __name__ == '__main__': - # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/7778 - exit(0) unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_net.py b/python/paddle/fluid/tests/unittests/test_net.py similarity index 92% rename from python/paddle/v2/fluid/tests/test_net.py rename to python/paddle/fluid/tests/unittests/test_net.py index 69d95d4f707d6ff3a66079802a312d0c847f410c..ae1699d647d7c0adab36200fb07bde12085053c1 100644 --- a/python/paddle/v2/fluid/tests/test_net.py +++ b/python/paddle/fluid/tests/unittests/test_net.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.core as core -from paddle.v2.fluid.op import Operator +import paddle.fluid.core as core +from paddle.fluid.op import Operator import unittest diff --git a/python/paddle/v2/fluid/tests/test_norm_op.py b/python/paddle/fluid/tests/unittests/test_norm_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_norm_op.py rename to python/paddle/fluid/tests/unittests/test_norm_op.py index dd1cd5a31c55f898239297f2815370316a6a8ccf..6feda175fb537db894ac7f19e22297f6062a4d61 100644 --- a/python/paddle/v2/fluid/tests/test_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_norm_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_normalization_wrapper.py b/python/paddle/fluid/tests/unittests/test_normalization_wrapper.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_normalization_wrapper.py rename to python/paddle/fluid/tests/unittests/test_normalization_wrapper.py index 6b71f2a923f0cf0744d6b2190aa35830dcf15f24..ef34893943d8f6bf91b1eb14378e463c178de84d 100644 --- a/python/paddle/v2/fluid/tests/test_normalization_wrapper.py +++ b/python/paddle/fluid/tests/unittests/test_normalization_wrapper.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,8 +13,8 @@ # limitations under the License. import unittest -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core +import paddle.fluid as fluid +import paddle.fluid.core as core import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_one_hot_op.py b/python/paddle/fluid/tests/unittests/test_one_hot_op.py similarity index 91% rename from python/paddle/v2/fluid/tests/test_one_hot_op.py rename to python/paddle/fluid/tests/unittests/test_one_hot_op.py index e51ea27d14d0637021f8902fa935beb318658018..cd78cce8729ab2b5a0bb4817cf3022e53932283a 100644 --- a/python/paddle/v2/fluid/tests/test_one_hot_op.py +++ b/python/paddle/fluid/tests/unittests/test_one_hot_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ import unittest import numpy as np import math from op_test import OpTest -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core -import paddle.v2.fluid.framework as framework -from paddle.v2.fluid.framework import Program, program_guard +import paddle.fluid as fluid +import paddle.fluid.core as core +import paddle.fluid.framework as framework +from paddle.fluid.framework import Program, program_guard class TestOneHotOp(OpTest): @@ -38,7 +38,7 @@ class TestOneHotOp(OpTest): out[i, x[i]] = 1.0 self.inputs = {'X': (x, x_lod)} - self.attrs = {'depth': depth, 'dtype': int(core.DataType.FP32)} + self.attrs = {'depth': depth, 'dtype': int(core.VarDesc.VarType.FP32)} self.outputs = {'Out': (out, x_lod)} def test_check_output(self): diff --git a/python/paddle/v2/fluid/tests/test_op_support_gpu.py b/python/paddle/fluid/tests/unittests/test_op_support_gpu.py similarity index 88% rename from python/paddle/v2/fluid/tests/test_op_support_gpu.py rename to python/paddle/fluid/tests/unittests/test_op_support_gpu.py index 7de02a8fda22a3db82a2e0b5e6fa9c9f2718fa12..5fafb8280e19cca46e5bf687494c07200ca53153 100644 --- a/python/paddle/v2/fluid/tests/test_op_support_gpu.py +++ b/python/paddle/fluid/tests/unittests/test_op_support_gpu.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core class TestOpSupportGPU(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_operator.py b/python/paddle/fluid/tests/unittests/test_operator.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_operator.py rename to python/paddle/fluid/tests/unittests/test_operator.py index b82cf580e8567a7d519a75f971bfa0de3ce90684..5e418fe6ac2d62948762290a65686207d017275c 100644 --- a/python/paddle/v2/fluid/tests/test_operator.py +++ b/python/paddle/fluid/tests/unittests/test_operator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ import unittest -import paddle.v2.fluid.op as op -import paddle.v2.fluid.proto.framework_pb2 as framework_pb2 +import paddle.fluid.op as op +import paddle.fluid.proto.framework_pb2 as framework_pb2 class TestGetAllProtos(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_operator_desc.py b/python/paddle/fluid/tests/unittests/test_operator_desc.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_operator_desc.py rename to python/paddle/fluid/tests/unittests/test_operator_desc.py index 2c8665ffa25549c57eed2934440be676260c1f31..649fabe4a0cdef4c665f8a6d3ebee1bb8232185f 100644 --- a/python/paddle/v2/fluid/tests/test_operator_desc.py +++ b/python/paddle/fluid/tests/unittests/test_operator_desc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,9 +14,9 @@ import unittest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core -from paddle.v2.fluid.framework import Program, default_startup_program +from paddle.fluid.framework import Program, default_startup_program main_program = default_startup_program() diff --git a/python/paddle/v2/fluid/tests/test_optimizer.py b/python/paddle/fluid/tests/unittests/test_optimizer.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_optimizer.py rename to python/paddle/fluid/tests/unittests/test_optimizer.py index dc6b84dcdc04dd185d97c3cc4b9f00305a911efb..6ee7fc819a501eb7bf452b5d470a2e0df1b44600 100644 --- a/python/paddle/v2/fluid/tests/test_optimizer.py +++ b/python/paddle/fluid/tests/unittests/test_optimizer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,9 +14,9 @@ import unittest -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.optimizer as optimizer -from paddle.v2.fluid.backward import append_backward +import paddle.fluid.framework as framework +import paddle.fluid.optimizer as optimizer +from paddle.fluid.backward import append_backward class TestOptimizer(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_pad_op.py b/python/paddle/fluid/tests/unittests/test_pad_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_pad_op.py rename to python/paddle/fluid/tests/unittests/test_pad_op.py index 0bd48000555697be9822d4dfb1056cbc0414aa11..300f3ffcb8d1a6152b1e03f1356582c02bc4b2a3 100644 --- a/python/paddle/v2/fluid/tests/test_pad_op.py +++ b/python/paddle/fluid/tests/unittests/test_pad_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_parallel_op.py b/python/paddle/fluid/tests/unittests/test_parallel_op.py similarity index 84% rename from python/paddle/v2/fluid/tests/test_parallel_op.py rename to python/paddle/fluid/tests/unittests/test_parallel_op.py index f1fd09a7fdb3f879be3d735ad5c52cd4554f0da8..edaae977dfbe9a98ed7c78f8cf990082a043a8a9 100644 --- a/python/paddle/v2/fluid/tests/test_parallel_op.py +++ b/python/paddle/fluid/tests/unittests/test_parallel_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ import unittest -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import numpy @@ -67,12 +67,25 @@ class BaseParallelForTest(unittest.TestCase): fetch=fetch, place=gpu, use_parallel=True) + result_gpu_nccl = self._run_test_impl_( + callback=callback, + feed=feed, + fetch=fetch, + place=gpu, + use_parallel=True, + use_nccl=True) self._assert_same_(fetch, result_cpu, result_cpu_parallel, - result_gpu, result_gpu_parallel) + result_gpu, result_gpu_parallel, result_gpu_nccl) else: self._assert_same_(fetch, result_cpu, result_cpu_parallel) - def _run_test_impl_(self, callback, feed, fetch, place, use_parallel=False): + def _run_test_impl_(self, + callback, + feed, + fetch, + place, + use_parallel=False, + use_nccl=False): """ Run a single test, returns the fetch values Args: @@ -96,7 +109,7 @@ class BaseParallelForTest(unittest.TestCase): # Automatically insert parallel do if use_parallel = True if use_parallel: places = fluid.layers.get_places() - pd = fluid.layers.ParallelDo(places) + pd = fluid.layers.ParallelDo(places, use_nccl=use_nccl) data = next(generator) if isinstance(data, fluid.Variable): @@ -137,10 +150,13 @@ class BaseParallelForTest(unittest.TestCase): """ def _impl_(a, b, fetch_id, item_id): - item_str = ['CPU', 'ParallelCPU', 'GPU', 'ParallelGPU'] - flag = numpy.allclose(a, b, rtol=0.1) - self.assertTrue(flag, "The {0} are different in {1}".format( - fetch[fetch_id], item_str[item_id])) + item_str = [ + 'CPU', 'ParallelCPU', 'GPU', 'ParallelGPU', 'ParallelGPUNCCL' + ] + flag = numpy.allclose(a, b, rtol=0.1, atol=1e-3) + self.assertTrue(flag, + "The {0} are different in {1}, {2} vs {3}".format( + fetch[fetch_id], item_str[item_id], a, b)) for i, items in enumerate(zip(*args)): self.assertGreater(len(items), 0) @@ -197,5 +213,5 @@ class ParallelOpTestMultipleInput(BaseParallelForTest): fetch=['fc1.w@GRAD', 'fc2.w@GRAD', 'fc3.w@GRAD']) -#if __name__ == '__main__': -# unittest.main() +if __name__ == '__main__': + unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_parameter.py b/python/paddle/fluid/tests/unittests/test_parameter.py similarity index 80% rename from python/paddle/v2/fluid/tests/test_parameter.py rename to python/paddle/fluid/tests/unittests/test_parameter.py index dfecdf939bcdb7957b55daea627cdd178b1a3947..e09865074e8aa9345fd9cc84e1f19eaf0436142f 100644 --- a/python/paddle/v2/fluid/tests/test_parameter.py +++ b/python/paddle/fluid/tests/unittests/test_parameter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,11 +13,11 @@ # limitations under the License. import unittest -from paddle.v2.fluid.framework import default_main_program -import paddle.v2.fluid.core as core -from paddle.v2.fluid.executor import Executor -import paddle.v2.fluid.io as io -from paddle.v2.fluid.initializer import ConstantInitializer +from paddle.fluid.framework import default_main_program +import paddle.fluid.core as core +from paddle.fluid.executor import Executor +import paddle.fluid.io as io +from paddle.fluid.initializer import ConstantInitializer import numpy as np main_program = default_main_program() @@ -36,7 +36,7 @@ class TestParameter(unittest.TestCase): self.assertIsNotNone(param) self.assertEqual('fc.w', param.name) self.assertEqual((784, 100), param.shape) - self.assertEqual(core.DataType.FP32, param.dtype) + self.assertEqual(core.VarDesc.VarType.FP32, param.dtype) self.assertEqual(0, param.block.idx) exe = Executor(core.CPUPlace()) p = exe.run(main_program, fetch_list=[param])[0] diff --git a/python/paddle/v2/fluid/tests/test_pool2d_op.py b/python/paddle/fluid/tests/unittests/test_pool2d_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_pool2d_op.py rename to python/paddle/fluid/tests/unittests/test_pool2d_op.py index 2f43be8a0ff03731262039cd8eb060d89ae4be40..12899ecca36dd1a49f536e657c1840803c3405e2 100644 --- a/python/paddle/v2/fluid/tests/test_pool2d_op.py +++ b/python/paddle/fluid/tests/unittests/test_pool2d_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core from op_test import OpTest diff --git a/python/paddle/v2/fluid/tests/test_pool3d_op.py b/python/paddle/fluid/tests/unittests/test_pool3d_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_pool3d_op.py rename to python/paddle/fluid/tests/unittests/test_pool3d_op.py index c93711e051b9b12a2314f16fc822e1378bddce47..321b5f39ffff129384c2a809ba8f7d154dcf5036 100644 --- a/python/paddle/v2/fluid/tests/test_pool3d_op.py +++ b/python/paddle/fluid/tests/unittests/test_pool3d_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core from op_test import OpTest diff --git a/python/paddle/v2/fluid/tests/test_pool_max_op.py b/python/paddle/fluid/tests/unittests/test_pool_max_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_pool_max_op.py rename to python/paddle/fluid/tests/unittests/test_pool_max_op.py index 330ad24bd420401024571725a36191492bfae495..cf9b7639224ef3804b946f729bb6a9cead4aae23 100644 --- a/python/paddle/v2/fluid/tests/test_pool_max_op.py +++ b/python/paddle/fluid/tests/unittests/test_pool_max_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_positive_negative_pair_op.py b/python/paddle/fluid/tests/unittests/test_positive_negative_pair_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_positive_negative_pair_op.py rename to python/paddle/fluid/tests/unittests/test_positive_negative_pair_op.py index 9b5e54465559ece98387d1690ed29a582999715e..091cfc9c72769fefc9c792bfeaa872cb357736b7 100644 --- a/python/paddle/v2/fluid/tests/test_positive_negative_pair_op.py +++ b/python/paddle/fluid/tests/unittests/test_positive_negative_pair_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_precision_recall_op.py b/python/paddle/fluid/tests/unittests/test_precision_recall_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_precision_recall_op.py rename to python/paddle/fluid/tests/unittests/test_precision_recall_op.py index 188b7af559376f8535d109c245f08d8e050201d5..7830ba29583d369c4b9f6f3077dda1dda1fd1c46 100644 --- a/python/paddle/v2/fluid/tests/test_precision_recall_op.py +++ b/python/paddle/fluid/tests/unittests/test_precision_recall_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_prelu_op.py b/python/paddle/fluid/tests/unittests/test_prelu_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_prelu_op.py rename to python/paddle/fluid/tests/unittests/test_prelu_op.py index 848036234c8cddd0cb3819322bd338eaf59dd360..ae19a553bb826002c562c15ee07759391d51b4d8 100644 --- a/python/paddle/v2/fluid/tests/test_prelu_op.py +++ b/python/paddle/fluid/tests/unittests/test_prelu_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_print_op.py b/python/paddle/fluid/tests/unittests/test_print_op.py similarity index 86% rename from python/paddle/v2/fluid/tests/test_print_op.py rename to python/paddle/fluid/tests/unittests/test_print_op.py index 3177700dfad6567d667b890d2a58a61c8355c631..5c08bf4fc3f14599d71bd31767a34c0b5b7621f2 100644 --- a/python/paddle/v2/fluid/tests/test_print_op.py +++ b/python/paddle/fluid/tests/unittests/test_print_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,12 +13,12 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core -from paddle.v2.fluid.executor import Executor -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.backward import append_backward -from paddle.v2.fluid.framework import switch_main_program -from paddle.v2.fluid.framework import Program +import paddle.fluid.core as core +from paddle.fluid.executor import Executor +import paddle.fluid.layers as layers +from paddle.fluid.backward import append_backward +from paddle.fluid.framework import switch_main_program +from paddle.fluid.framework import Program import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_prior_box_op.py b/python/paddle/fluid/tests/unittests/test_prior_box_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_prior_box_op.py rename to python/paddle/fluid/tests/unittests/test_prior_box_op.py index a6c21af49f63269720156ec833c94688d0e3230e..c21138c13e6753f9dfcbd7d439269f7cf9a04f23 100644 --- a/python/paddle/v2/fluid/tests/test_prior_box_op.py +++ b/python/paddle/fluid/tests/unittests/test_prior_box_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_profiler.py b/python/paddle/fluid/tests/unittests/test_profiler.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_profiler.py rename to python/paddle/fluid/tests/unittests/test_profiler.py index 09b2d08401878448b4b3f3c6c03193e255e9ffeb..09f23894c4c928cb3e07f1c0a42a8917091950b6 100644 --- a/python/paddle/v2/fluid/tests/test_profiler.py +++ b/python/paddle/fluid/tests/unittests/test_profiler.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,10 @@ import unittest import os import numpy as np -import paddle.v2.fluid as fluid -import paddle.v2.fluid.profiler as profiler -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.core as core +import paddle.fluid as fluid +import paddle.fluid.profiler as profiler +import paddle.fluid.layers as layers +import paddle.fluid.core as core class TestProfiler(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_program.py b/python/paddle/fluid/tests/unittests/test_program.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_program.py rename to python/paddle/fluid/tests/unittests/test_program.py index 9967da15937a1d11adfbaa67b3aa163917a52843..87a2195f0d5c7fd355ea01a3c8f60908b33d4b9d 100644 --- a/python/paddle/v2/fluid/tests/test_program.py +++ b/python/paddle/fluid/tests/unittests/test_program.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ from __future__ import print_function import unittest -from paddle.v2.fluid.framework import Program, default_main_program, program_guard, grad_var_name -import paddle.v2.fluid.layers as layers +from paddle.fluid.framework import Program, default_main_program, program_guard, grad_var_name +import paddle.fluid.layers as layers main_program = default_main_program() diff --git a/python/paddle/v2/fluid/tests/test_protobuf.py b/python/paddle/fluid/tests/unittests/test_protobuf.py similarity index 91% rename from python/paddle/v2/fluid/tests/test_protobuf.py rename to python/paddle/fluid/tests/unittests/test_protobuf.py index 48e6dedc5862ccf10751d8dd66a8230bdf85eca2..c3f1fa80185bfc4afc3ed715d736bcba092629d8 100644 --- a/python/paddle/v2/fluid/tests/test_protobuf.py +++ b/python/paddle/fluid/tests/unittests/test_protobuf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.proto.framework_pb2 as framework_pb2 +import paddle.fluid.proto.framework_pb2 as framework_pb2 import unittest diff --git a/python/paddle/v2/fluid/tests/test_protobuf_descs.py b/python/paddle/fluid/tests/unittests/test_protobuf_descs.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_protobuf_descs.py rename to python/paddle/fluid/tests/unittests/test_protobuf_descs.py index c590bf1c6570a2320962f2d610619dbd88b473d1..309ea2b9b7ede442da3ac897ce8d1a4b9aa68233 100644 --- a/python/paddle/v2/fluid/tests/test_protobuf_descs.py +++ b/python/paddle/fluid/tests/unittests/test_protobuf_descs.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core class TestOpDesc(unittest.TestCase): @@ -131,8 +131,8 @@ class TestVarDesc(unittest.TestCase): block = program_desc.block(0) var = block.var('my_var') var.set_type(core.VarDesc.VarType.LOD_TENSOR) - var.set_dtype(core.DataType.INT32) - self.assertEqual(core.DataType.INT32, var.dtype()) + var.set_dtype(core.VarDesc.VarType.INT32) + self.assertEqual(core.VarDesc.VarType.INT32, var.dtype()) self.assertEqual(core.VarDesc.VarType.LOD_TENSOR, var.type()) def test_multiple_dtype(self): @@ -141,7 +141,8 @@ class TestVarDesc(unittest.TestCase): var = block.var('my_reader') var.set_type(core.VarDesc.VarType.READER) src_types = [ - core.DataType.INT32, core.DataType.FP64, core.DataType.FP32 + core.VarDesc.VarType.INT32, core.VarDesc.VarType.FP64, + core.VarDesc.VarType.FP32 ] var.set_dtypes(src_types) self.assertEqual(src_types, var.dtypes()) diff --git a/python/paddle/v2/fluid/tests/test_proximal_adagrad_op.py b/python/paddle/fluid/tests/unittests/test_proximal_adagrad_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_proximal_adagrad_op.py rename to python/paddle/fluid/tests/unittests/test_proximal_adagrad_op.py index 744d71bdcf438538e725e7d776b8423edd475639..3c2689585061af5a11a247a01b87b432dcd86e13 100644 --- a/python/paddle/v2/fluid/tests/test_proximal_adagrad_op.py +++ b/python/paddle/fluid/tests/unittests/test_proximal_adagrad_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_proximal_gd_op.py b/python/paddle/fluid/tests/unittests/test_proximal_gd_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_proximal_gd_op.py rename to python/paddle/fluid/tests/unittests/test_proximal_gd_op.py index 96540cf6cf4ed970c3e743df7621e443c49eef89..137594b9a08e13bf6c3f3779356c209596f9ba8e 100644 --- a/python/paddle/v2/fluid/tests/test_proximal_gd_op.py +++ b/python/paddle/fluid/tests/unittests/test_proximal_gd_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_rank_loss_op.py b/python/paddle/fluid/tests/unittests/test_rank_loss_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_rank_loss_op.py rename to python/paddle/fluid/tests/unittests/test_rank_loss_op.py index f31a2c2681871f63a272a1a658ed65cc8646b8a8..7eba1e2077e25325d537f01f043ed1afa372800c 100644 --- a/python/paddle/v2/fluid/tests/test_rank_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_rank_loss_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_recurrent_op.py b/python/paddle/fluid/tests/unittests/test_recurrent_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_recurrent_op.py rename to python/paddle/fluid/tests/unittests/test_recurrent_op.py index 6d59e199e24d460791ab6273b20d30bfa733d3c1..d2d13386ac1545605b807486d14c0925d890df5e 100644 --- a/python/paddle/v2/fluid/tests/test_recurrent_op.py +++ b/python/paddle/fluid/tests/unittests/test_recurrent_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,12 +14,12 @@ import unittest -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.framework import Program, grad_var_name -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.backward import append_backward +import paddle.fluid.layers as layers +from paddle.fluid.framework import Program, grad_var_name +from paddle.fluid.executor import Executor +from paddle.fluid.backward import append_backward import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core class PyRNNBase(object): @@ -468,6 +468,4 @@ class RecurrentOpNoMemBootTest(RecurrentOpTest1): if __name__ == '__main__': - # FIXME(qijun) https://github.com/PaddlePaddle/Paddle/issues/6152 - exit(0) unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_recv_op.py b/python/paddle/fluid/tests/unittests/test_recv_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_recv_op.py rename to python/paddle/fluid/tests/unittests/test_recv_op.py index 3a02b882410fe896cd2add03060127a01cbdaa38..985d892c568472614c5f3e6691f54807ddccc4bd 100644 --- a/python/paddle/v2/fluid/tests/test_recv_op.py +++ b/python/paddle/fluid/tests/unittests/test_recv_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ import unittest -import paddle.v2.fluid as fluid -import paddle.v2.fluid.layers as layers +import paddle.fluid as fluid +import paddle.fluid.layers as layers import numpy from multiprocessing import Process import os, sys diff --git a/python/paddle/v2/fluid/tests/test_reduce_op.py b/python/paddle/fluid/tests/unittests/test_reduce_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_reduce_op.py rename to python/paddle/fluid/tests/unittests/test_reduce_op.py index c669f73a7c6de0735b3c580ed4f0ed8ba359a040..5e656bddb7927b6e7935255c120e5e858505125a 100644 --- a/python/paddle/v2/fluid/tests/test_reduce_op.py +++ b/python/paddle/fluid/tests/unittests/test_reduce_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_registry.py b/python/paddle/fluid/tests/unittests/test_registry.py similarity index 86% rename from python/paddle/v2/fluid/tests/test_registry.py rename to python/paddle/fluid/tests/unittests/test_registry.py index 44e50ca55ac609ed2e0a145ff12248fa18479668..d04192cb3a380b2f71b8a920479545167251387f 100644 --- a/python/paddle/v2/fluid/tests/test_registry.py +++ b/python/paddle/fluid/tests/unittests/test_registry.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ # limitations under the License. import unittest -import paddle.v2.fluid as fluid +import paddle.fluid as fluid import numpy as np import decorators @@ -28,4 +28,4 @@ class TestRegistry(unittest.TestCase): exe = fluid.Executor(place) X = np.random.random((10, 10)).astype("float32") mean_out = exe.run(feed={"X": X}, fetch_list=[output]) - self.assertAlmostEqual(np.mean(X), mean_out[0]) + self.assertAlmostEqual(np.mean(X), mean_out[0], delta=1e-5) diff --git a/python/paddle/v2/fluid/tests/test_regularizer.py b/python/paddle/fluid/tests/unittests/test_regularizer.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_regularizer.py rename to python/paddle/fluid/tests/unittests/test_regularizer.py index b33817fa41636e7a62aa5907e63a9302b2149f66..9b1c4ceada52322b3f1fdc4ab2e90a2c089ee67e 100644 --- a/python/paddle/v2/fluid/tests/test_regularizer.py +++ b/python/paddle/fluid/tests/unittests/test_regularizer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ import unittest -import paddle.v2.fluid.framework as framework -import paddle.v2.fluid.optimizer as optimizer -import paddle.v2.fluid.regularizer as regularizer -from paddle.v2.fluid.backward import append_backward +import paddle.fluid.framework as framework +import paddle.fluid.optimizer as optimizer +import paddle.fluid.regularizer as regularizer +from paddle.fluid.backward import append_backward class TestL2DecayRegularizer(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_reorder_lod_tensor.py b/python/paddle/fluid/tests/unittests/test_reorder_lod_tensor.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_reorder_lod_tensor.py rename to python/paddle/fluid/tests/unittests/test_reorder_lod_tensor.py index 0a223bac0ce8fd626881cef983c7cd960f2c5ba8..76d0d2f2fe80e409dc1b7fa858d43fbc6ad960ef 100644 --- a/python/paddle/v2/fluid/tests/test_reorder_lod_tensor.py +++ b/python/paddle/fluid/tests/unittests/test_reorder_lod_tensor.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,8 +13,8 @@ # limitations under the License. import unittest -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core +import paddle.fluid as fluid +import paddle.fluid.core as core import numpy diff --git a/python/paddle/v2/fluid/tests/test_reshape_op.py b/python/paddle/fluid/tests/unittests/test_reshape_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_reshape_op.py rename to python/paddle/fluid/tests/unittests/test_reshape_op.py index 2cc0b36460994b021c6e6fd944c80dfec6c92f2f..6d1aa549d592997359342bab9233685f5d6108fb 100644 --- a/python/paddle/v2/fluid/tests/test_reshape_op.py +++ b/python/paddle/fluid/tests/unittests/test_reshape_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_rmsprop_op.py b/python/paddle/fluid/tests/unittests/test_rmsprop_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_rmsprop_op.py rename to python/paddle/fluid/tests/unittests/test_rmsprop_op.py index b6d7c698009d1fc35a5cdbcb72708ee74c181bf4..0d84a5853ead45b84de9383dd8749992d2f91440 100644 --- a/python/paddle/v2/fluid/tests/test_rmsprop_op.py +++ b/python/paddle/fluid/tests/unittests/test_rmsprop_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_rnn_memory_helper_op.py b/python/paddle/fluid/tests/unittests/test_rnn_memory_helper_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_rnn_memory_helper_op.py rename to python/paddle/fluid/tests/unittests/test_rnn_memory_helper_op.py index 82b54bbd1a46be763c436f075b28e466f7fbd3fa..178606f05961263df5ef0398064a1fd135fbe784 100644 --- a/python/paddle/v2/fluid/tests/test_rnn_memory_helper_op.py +++ b/python/paddle/fluid/tests/unittests/test_rnn_memory_helper_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ import unittest -from paddle.v2.fluid.framework import Program -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.backward import append_backward +from paddle.fluid.framework import Program +from paddle.fluid.executor import Executor +from paddle.fluid.backward import append_backward import numpy as np -import paddle.v2.fluid.core as core +import paddle.fluid.core as core class RNNMemoryHelperOpTest(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_roi_pool_op.py b/python/paddle/fluid/tests/unittests/test_roi_pool_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_roi_pool_op.py rename to python/paddle/fluid/tests/unittests/test_roi_pool_op.py index af48848dcd06d35aa404d4cb688d7fd55c6b048b..e556d51b021217063e23190e40bc0e8f9fdc816c 100644 --- a/python/paddle/v2/fluid/tests/test_roi_pool_op.py +++ b/python/paddle/fluid/tests/unittests/test_roi_pool_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_row_conv_op.py b/python/paddle/fluid/tests/unittests/test_row_conv_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_row_conv_op.py rename to python/paddle/fluid/tests/unittests/test_row_conv_op.py index 580b08f75ebbdf0f79cc45becf84520503e9877c..30f1efbcbcb11332c85c9d5489f22c17b06c2b36 100644 --- a/python/paddle/v2/fluid/tests/test_row_conv_op.py +++ b/python/paddle/fluid/tests/unittests/test_row_conv_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_scale_op.py b/python/paddle/fluid/tests/unittests/test_scale_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_scale_op.py rename to python/paddle/fluid/tests/unittests/test_scale_op.py index 95cd935dda32bd5e1e8afc1e09c83affe8004cf7..53f59c399054a96f5b5f07a390e6fa9eeae878ce 100644 --- a/python/paddle/v2/fluid/tests/test_scale_op.py +++ b/python/paddle/fluid/tests/unittests/test_scale_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_scatter_op.py b/python/paddle/fluid/tests/unittests/test_scatter_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_scatter_op.py rename to python/paddle/fluid/tests/unittests/test_scatter_op.py index f2936e19ae52b1b3c6d7daf02f68789af12d2b23..bb02a40d449860cf6c0576662e79a5e36e6e0635 100644 --- a/python/paddle/v2/fluid/tests/test_scatter_op.py +++ b/python/paddle/fluid/tests/unittests/test_scatter_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_scope.py b/python/paddle/fluid/tests/unittests/test_scope.py similarity index 85% rename from python/paddle/v2/fluid/tests/test_scope.py rename to python/paddle/fluid/tests/unittests/test_scope.py index 566a11abbe28c7fa79f07253609c1152879a0ad2..d249a989a9499d01f6ed10d6cdbc6c456a7262c5 100644 --- a/python/paddle/v2/fluid/tests/test_scope.py +++ b/python/paddle/fluid/tests/unittests/test_scope.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,25 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.core +import paddle.fluid.core import unittest class TestScope(unittest.TestCase): def test_create_destroy(self): - paddle_c = paddle.v2.fluid.core + paddle_c = paddle.fluid.core scope = paddle_c.Scope() self.assertIsNotNone(scope) scope_with_parent = scope.new_scope() self.assertIsNotNone(scope_with_parent) def test_none_variable(self): - paddle_c = paddle.v2.fluid.core + paddle_c = paddle.fluid.core scope = paddle_c.Scope() self.assertIsNone(scope.find_var("test")) def test_create_var_get_var(self): - paddle_c = paddle.v2.fluid.core + paddle_c = paddle.fluid.core scope = paddle_c.Scope() var_a = scope.var("var_a") self.assertIsNotNone(var_a) @@ -39,7 +39,7 @@ class TestScope(unittest.TestCase): self.assertIsNotNone(scope2.find_var('var_a')) def test_var_get_int(self): - paddle_c = paddle.v2.fluid.core + paddle_c = paddle.fluid.core scope = paddle_c.Scope() var = scope.var("test_int") var.set_int(10) diff --git a/python/paddle/v2/fluid/tests/test_selected_rows.py b/python/paddle/fluid/tests/unittests/test_selected_rows.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_selected_rows.py rename to python/paddle/fluid/tests/unittests/test_selected_rows.py index 65ddf1f8f5f565ab5f361b8ef00b0032d62a58f8..3d7b86787fbf0a855bcd86b8a873c9134cb1d5cc 100644 --- a/python/paddle/v2/fluid/tests/test_selected_rows.py +++ b/python/paddle/fluid/tests/unittests/test_selected_rows.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import unittest import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_seq_concat_op.py b/python/paddle/fluid/tests/unittests/test_seq_concat_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_seq_concat_op.py rename to python/paddle/fluid/tests/unittests/test_seq_concat_op.py index ba2bb075e6d76ec4e4d74291582512f1223b8813..10592d127fafdf202c65fcfa91b5c464cc60e96c 100644 --- a/python/paddle/v2/fluid/tests/test_seq_concat_op.py +++ b/python/paddle/fluid/tests/unittests/test_seq_concat_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ import unittest import numpy as np import sys from op_test import OpTest -exit(0) def to_abs_lod(lod): diff --git a/python/paddle/v2/fluid/tests/test_seq_conv.py b/python/paddle/fluid/tests/unittests/test_seq_conv.py similarity index 99% rename from python/paddle/v2/fluid/tests/test_seq_conv.py rename to python/paddle/fluid/tests/unittests/test_seq_conv.py index 674a2e16940d1c8d40fcd6abdb33c25f3c2fd845..51dbf1f61834ff0093d76ed546be27a585697d40 100644 --- a/python/paddle/v2/fluid/tests/test_seq_conv.py +++ b/python/paddle/fluid/tests/unittests/test_seq_conv.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_seq_pool.py b/python/paddle/fluid/tests/unittests/test_seq_pool.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_seq_pool.py rename to python/paddle/fluid/tests/unittests/test_seq_pool.py index 9dd6b2a0872f64a33df3aae1cd78bc021c1f44e7..04884757216bc29a96eb97a6db403c3925472294 100644 --- a/python/paddle/v2/fluid/tests/test_seq_pool.py +++ b/python/paddle/fluid/tests/unittests/test_seq_pool.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_sequence_erase_op.py b/python/paddle/fluid/tests/unittests/test_sequence_erase_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_sequence_erase_op.py rename to python/paddle/fluid/tests/unittests/test_sequence_erase_op.py index 4823836ba97d50dcc455ee0b558fdf602aa9c5e5..ebab77e8041d5ff1bd845fb121e5901116fd0254 100644 --- a/python/paddle/v2/fluid/tests/test_sequence_erase_op.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_erase_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_sequence_expand.py b/python/paddle/fluid/tests/unittests/test_sequence_expand.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_sequence_expand.py rename to python/paddle/fluid/tests/unittests/test_sequence_expand.py index 0d37751de48975211abd19e5cfa5ccfe6421d51a..957fa5d2c4a795cfd01047c1b7845674e4c1d549 100644 --- a/python/paddle/v2/fluid/tests/test_sequence_expand.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_expand.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_sequence_reshape.py b/python/paddle/fluid/tests/unittests/test_sequence_reshape.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_sequence_reshape.py rename to python/paddle/fluid/tests/unittests/test_sequence_reshape.py index 06d5af8f5e7f5383561245bbbd57ecf5f65ceec4..efeab560392d8c03b1bb5db83f59c12d4fef64b0 100644 --- a/python/paddle/v2/fluid/tests/test_sequence_reshape.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_reshape.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_sequence_slice_op.py b/python/paddle/fluid/tests/unittests/test_sequence_slice_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_sequence_slice_op.py rename to python/paddle/fluid/tests/unittests/test_sequence_slice_op.py index bf1f21bcde4e293c30c1863bb84725632a147101..660b4a171d09ddfc0e78b650a467db6b576c7ee3 100644 --- a/python/paddle/v2/fluid/tests/test_sequence_slice_op.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_slice_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_sequence_softmax_op.py b/python/paddle/fluid/tests/unittests/test_sequence_softmax_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_sequence_softmax_op.py rename to python/paddle/fluid/tests/unittests/test_sequence_softmax_op.py index 5bd780f6b5b5d0a9deda8701625d33fbe7e87abf..9e5c1e7a3d0bdf514de11e797d7139f577002c52 100644 --- a/python/paddle/v2/fluid/tests/test_sequence_softmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_softmax_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_sgd_op.py b/python/paddle/fluid/tests/unittests/test_sgd_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_sgd_op.py rename to python/paddle/fluid/tests/unittests/test_sgd_op.py index ba2ca1683f9f6d72bbd1550df89c7424d223a1d9..c498b23db12cd83304f4c3a3d1f15bd68ad4f0b6 100644 --- a/python/paddle/v2/fluid/tests/test_sgd_op.py +++ b/python/paddle/fluid/tests/unittests/test_sgd_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ import unittest import numpy as np -import paddle.v2.fluid.core as core -from paddle.v2.fluid.op import Operator +import paddle.fluid.core as core +from paddle.fluid.op import Operator from op_test import OpTest diff --git a/python/paddle/v2/fluid/tests/test_shrink_rnn_memory.py b/python/paddle/fluid/tests/unittests/test_shrink_rnn_memory.py similarity index 91% rename from python/paddle/v2/fluid/tests/test_shrink_rnn_memory.py rename to python/paddle/fluid/tests/unittests/test_shrink_rnn_memory.py index 4578211bac63fdf365f5e2d0de7181126c6fdaed..ba34e6a486e780a703b32b66c3b2caf7676cd27e 100644 --- a/python/paddle/v2/fluid/tests/test_shrink_rnn_memory.py +++ b/python/paddle/fluid/tests/unittests/test_shrink_rnn_memory.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,12 +13,12 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core -from paddle.v2.fluid.executor import Executor -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.backward import append_backward -from paddle.v2.fluid.framework import default_main_program, switch_main_program -from paddle.v2.fluid.framework import Program +import paddle.fluid.core as core +from paddle.fluid.executor import Executor +import paddle.fluid.layers as layers +from paddle.fluid.backward import append_backward +from paddle.fluid.framework import default_main_program, switch_main_program +from paddle.fluid.framework import Program import numpy as np diff --git a/python/paddle/v2/fluid/tests/test_sigmoid_cross_entropy_with_logits_op.py b/python/paddle/fluid/tests/unittests/test_sigmoid_cross_entropy_with_logits_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_sigmoid_cross_entropy_with_logits_op.py rename to python/paddle/fluid/tests/unittests/test_sigmoid_cross_entropy_with_logits_op.py index f88fa62119cfc60df832ec0e14ef11930b8bcf21..c435796569cd2479c19d70a849991f439bf5292a 100644 --- a/python/paddle/v2/fluid/tests/test_sigmoid_cross_entropy_with_logits_op.py +++ b/python/paddle/fluid/tests/unittests/test_sigmoid_cross_entropy_with_logits_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_sign_op.py b/python/paddle/fluid/tests/unittests/test_sign_op.py similarity index 93% rename from python/paddle/v2/fluid/tests/test_sign_op.py rename to python/paddle/fluid/tests/unittests/test_sign_op.py index c1dfa7f45d4d22795bef97f1f937bdbcdb5f5a30..087a0c575bfa6bc18cb229ad274b4e1e90210605 100644 --- a/python/paddle/v2/fluid/tests/test_sign_op.py +++ b/python/paddle/fluid/tests/unittests/test_sign_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_smooth_l1_loss_op.py b/python/paddle/fluid/tests/unittests/test_smooth_l1_loss_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_smooth_l1_loss_op.py rename to python/paddle/fluid/tests/unittests/test_smooth_l1_loss_op.py index 5a388bb7b37c2509f4af290479195dd20fdc63a0..e74664dac4d87c5a7e1e061294e93e8267e3cc17 100644 --- a/python/paddle/v2/fluid/tests/test_smooth_l1_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_smooth_l1_loss_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_softmax_op.py b/python/paddle/fluid/tests/unittests/test_softmax_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_softmax_op.py rename to python/paddle/fluid/tests/unittests/test_softmax_op.py index cf43e676c5421ce9fca07fe36fb6e347585d6e03..8f8312edca7e2d98eb4e881f671c6afdda01c57a 100644 --- a/python/paddle/v2/fluid/tests/test_softmax_op.py +++ b/python/paddle/fluid/tests/unittests/test_softmax_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_softmax_with_cross_entropy_op.py b/python/paddle/fluid/tests/unittests/test_softmax_with_cross_entropy_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_softmax_with_cross_entropy_op.py rename to python/paddle/fluid/tests/unittests/test_softmax_with_cross_entropy_op.py index 626f34f0e07c372d6262e030c9686a73b63cb97d..889fea2ce66e64d439b51498722e571f48cd1f96 100644 --- a/python/paddle/v2/fluid/tests/test_softmax_with_cross_entropy_op.py +++ b/python/paddle/fluid/tests/unittests/test_softmax_with_cross_entropy_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_split_and_merge_lod_tensor_op.py b/python/paddle/fluid/tests/unittests/test_split_and_merge_lod_tensor_op.py similarity index 95% rename from python/paddle/v2/fluid/tests/test_split_and_merge_lod_tensor_op.py rename to python/paddle/fluid/tests/unittests/test_split_and_merge_lod_tensor_op.py index bc541298ed80fd8ae9db86aec384a8522a994749..0b04ff302dc82a150a223b2f6632d77f95c61dc7 100644 --- a/python/paddle/v2/fluid/tests/test_split_and_merge_lod_tensor_op.py +++ b/python/paddle/fluid/tests/unittests/test_split_and_merge_lod_tensor_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,12 +13,12 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import numpy as np -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.framework import Program, program_guard -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.backward import append_backward +import paddle.fluid.layers as layers +from paddle.fluid.framework import Program, program_guard +from paddle.fluid.executor import Executor +from paddle.fluid.backward import append_backward class TestCPULoDTensorArrayOps(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_split_op.py b/python/paddle/fluid/tests/unittests/test_split_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_split_op.py rename to python/paddle/fluid/tests/unittests/test_split_op.py index 50347d2df48e3f163054d627fd4624c330690c67..887bdfe8b3608878bace5b857a71ada123b74b2f 100644 --- a/python/paddle/v2/fluid/tests/test_split_op.py +++ b/python/paddle/fluid/tests/unittests/test_split_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_split_selected_rows_op.py b/python/paddle/fluid/tests/unittests/test_split_selected_rows_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_split_selected_rows_op.py rename to python/paddle/fluid/tests/unittests/test_split_selected_rows_op.py index 343aa20066146ae08462a92f1efaa20c4d4b5ed8..286d305a777a4683d42a4d3d2d5d5f0c5b6ac12a 100644 --- a/python/paddle/v2/fluid/tests/test_split_selected_rows_op.py +++ b/python/paddle/fluid/tests/unittests/test_split_selected_rows_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,9 @@ # limitations under the License. import unittest -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import numpy as np -from paddle.v2.fluid.op import Operator +from paddle.fluid.op import Operator class TestSpliteSelectedRows(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/book_distribute/test_split_var.py b/python/paddle/fluid/tests/unittests/test_split_var.py similarity index 89% rename from python/paddle/v2/fluid/tests/book_distribute/test_split_var.py rename to python/paddle/fluid/tests/unittests/test_split_var.py index 4a50049bf2644f237de9feadc284ead05fa2f36c..104ceb4fe7beb70b9016f57cef0ef895a3eb8ba6 100644 --- a/python/paddle/v2/fluid/tests/book_distribute/test_split_var.py +++ b/python/paddle/fluid/tests/unittests/test_split_var.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,9 +14,9 @@ import math import unittest -from paddle.v2.fluid.distribute_transpiler import split_dense_variable -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core +from paddle.fluid.distribute_transpiler import split_dense_variable +import paddle.fluid as fluid +import paddle.fluid.core as core import random diff --git a/python/paddle/v2/fluid/tests/test_spp_op.py b/python/paddle/fluid/tests/unittests/test_spp_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_spp_op.py rename to python/paddle/fluid/tests/unittests/test_spp_op.py index e912b56de54c91a4c716e8056a6cf891de74bedf..f0ab5909df62835b252154709e5ff75ca38235c8 100644 --- a/python/paddle/v2/fluid/tests/test_spp_op.py +++ b/python/paddle/fluid/tests/unittests/test_spp_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_squared_l2_distance_op.py b/python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_squared_l2_distance_op.py rename to python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py index 8171207cd95f6b5104b6c0da3c7424016c9569b6..78bc300ebec1cd34e44343d47376fef05a6d0135 100644 --- a/python/paddle/v2/fluid/tests/test_squared_l2_distance_op.py +++ b/python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_squared_l2_norm_op.py b/python/paddle/fluid/tests/unittests/test_squared_l2_norm_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_squared_l2_norm_op.py rename to python/paddle/fluid/tests/unittests/test_squared_l2_norm_op.py index b7575cb4d2cea1801cc194dd4b4dcda1aea2f545..609445d52287f421e67a5796f9e50c1fb42c8e49 100644 --- a/python/paddle/v2/fluid/tests/test_squared_l2_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_squared_l2_norm_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_sum_op.py b/python/paddle/fluid/tests/unittests/test_sum_op.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_sum_op.py rename to python/paddle/fluid/tests/unittests/test_sum_op.py index 0a15a9485d72629de6e2e8c7d76c8a5b2cdf0a14..2faf5b10647a1fa1d44e4847f017db177ee8808a 100644 --- a/python/paddle/v2/fluid/tests/test_sum_op.py +++ b/python/paddle/fluid/tests/unittests/test_sum_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_switch.py b/python/paddle/fluid/tests/unittests/test_switch.py similarity index 88% rename from python/paddle/v2/fluid/tests/test_switch.py rename to python/paddle/fluid/tests/unittests/test_switch.py index 52ebf773ec72226aae5efb635e070baa8a123595..528c5cce4bc7262ade196f6a81a57a57089117ec 100644 --- a/python/paddle/v2/fluid/tests/test_switch.py +++ b/python/paddle/fluid/tests/unittests/test_switch.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ import unittest -import paddle.v2.fluid.core as core -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.framework as framework -from paddle.v2.fluid.executor import Executor -from paddle.v2.fluid.framework import default_startup_program +import paddle.fluid.core as core +import paddle.fluid.layers as layers +import paddle.fluid.framework as framework +from paddle.fluid.executor import Executor +from paddle.fluid.framework import default_startup_program class TestSwitch(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_target_assign_op.py b/python/paddle/fluid/tests/unittests/test_target_assign_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_target_assign_op.py rename to python/paddle/fluid/tests/unittests/test_target_assign_op.py index ceda61ff5523d508747663f89af9d3bc23000981..ccb41e56c5555b8c79674449c9139ada0bc47aac 100755 --- a/python/paddle/v2/fluid/tests/test_target_assign_op.py +++ b/python/paddle/fluid/tests/unittests/test_target_assign_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_tensor.py b/python/paddle/fluid/tests/unittests/test_tensor.py similarity index 97% rename from python/paddle/v2/fluid/tests/test_tensor.py rename to python/paddle/fluid/tests/unittests/test_tensor.py index 0219bef42b3ba133dda7412c1036cf989a170a36..a369783245ae2e35a9743ef1f4321ac919e58283 100644 --- a/python/paddle/v2/fluid/tests/test_tensor.py +++ b/python/paddle/fluid/tests/unittests/test_tensor.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import paddle.v2.fluid.core as core +import paddle.fluid.core as core import unittest import numpy diff --git a/python/paddle/v2/fluid/tests/test_top_k_op.py b/python/paddle/fluid/tests/unittests/test_top_k_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_top_k_op.py rename to python/paddle/fluid/tests/unittests/test_top_k_op.py index a50faf0fffdcffab8b67e968450573d676d2d40a..cc2fcc5ec0a076679c7dd85a7e8f8da6a170172b 100644 --- a/python/paddle/v2/fluid/tests/test_top_k_op.py +++ b/python/paddle/fluid/tests/unittests/test_top_k_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_transpose_op.py b/python/paddle/fluid/tests/unittests/test_transpose_op.py similarity index 96% rename from python/paddle/v2/fluid/tests/test_transpose_op.py rename to python/paddle/fluid/tests/unittests/test_transpose_op.py index a16de1416f4d8d1c6cf51c3c4b57dbe97e528b45..ebd63fbd495354eafe298ad5cc3456a196538a6a 100644 --- a/python/paddle/v2/fluid/tests/test_transpose_op.py +++ b/python/paddle/fluid/tests/unittests/test_transpose_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py b/python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py new file mode 100644 index 0000000000000000000000000000000000000000..e033e86114f17d37c01480fe8350648eb8aa27cb --- /dev/null +++ b/python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py @@ -0,0 +1,42 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest +import numpy as np +from op_test import OpTest + + +class TestUniformRandomBatchSizeLike(OpTest): + def setUp(self): + self.op_type = "uniform_random_batch_size_like" + self.inputs = {'Input': np.zeros((500, 2000), dtype="float32")} + self.attrs = {'min': 1., 'max': 2., 'shape': [-1, 2000]} + self.outputs = {'Out': np.zeros((500, 2000), dtype='float32')} + + def test_check_output(self): + self.check_output_customized(self.verify_output) + + def verify_output(self, outs): + self.assertEqual(outs[0].shape, (500, 2000)) + hist, _ = np.histogram(outs[0], range=(1, 2)) + hist = hist.astype("float32") + hist /= float(outs[0].size) + prob = 0.1 * np.ones((10)) + self.assertTrue( + np.allclose( + hist, prob, rtol=0, atol=0.01), "hist: " + str(hist)) + + +if __name__ == "__main__": + unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_uniform_random_op.py b/python/paddle/fluid/tests/unittests/test_uniform_random_op.py new file mode 100644 index 0000000000000000000000000000000000000000..75ff85a55fc4fd504ecd032e17f7e189c17192fb --- /dev/null +++ b/python/paddle/fluid/tests/unittests/test_uniform_random_op.py @@ -0,0 +1,47 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest +import numpy as np +from op_test import OpTest + + +class TestUniformRandomOp(OpTest): + def setUp(self): + self.op_type = "uniform_random" + self.inputs = {} + self.attrs = { + "shape": [1000, 784], + "min": -5.0, + "max": 10.0, + "seed": 10 + } + self.outputs = {"Out": np.zeros((1000, 784)).astype("float32")} + + def test_check_output(self): + self.check_output_customized(self.verify_output) + + def verify_output(self, outs): + tensor = outs[0] + hist, _ = np.histogram(outs[0], range=(-5, 10)) + hist = hist.astype("float32") + hist /= float(outs[0].size) + prob = 0.1 * np.ones((10)) + self.assertTrue( + np.allclose( + hist, prob, rtol=0, atol=0.01), "hist: " + str(hist)) + + +if __name__ == "__main__": + unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_unique_name.py b/python/paddle/fluid/tests/unittests/test_unique_name.py new file mode 100644 index 0000000000000000000000000000000000000000..49ef335618ca7ca1e8249a61a97ca552dabdb9e8 --- /dev/null +++ b/python/paddle/fluid/tests/unittests/test_unique_name.py @@ -0,0 +1,43 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest +import paddle.fluid as fluid + + +class TestUniqueName(unittest.TestCase): + def test_guard(self): + with fluid.unique_name.guard(): + name_1 = fluid.unique_name.generate('') + + with fluid.unique_name.guard(): + name_2 = fluid.unique_name.generate('') + + self.assertEqual(name_1, name_2) + + with fluid.unique_name.guard("A"): + name_1 = fluid.unique_name.generate('') + + with fluid.unique_name.guard('B'): + name_2 = fluid.unique_name.generate('') + + self.assertNotEqual(name_1, name_2) + + def test_generate(self): + with fluid.unique_name.guard(): + name1 = fluid.unique_name.generate('fc') + name2 = fluid.unique_name.generate('fc') + name3 = fluid.unique_name.generate('tmp') + self.assertNotEqual(name1, name2) + self.assertEqual(name1[-2:], name3[-2:]) diff --git a/python/paddle/v2/fluid/tests/test_unpool_op.py b/python/paddle/fluid/tests/unittests/test_unpool_op.py similarity index 98% rename from python/paddle/v2/fluid/tests/test_unpool_op.py rename to python/paddle/fluid/tests/unittests/test_unpool_op.py index 3dd43f9ba4b0efe852ba1a7d509c6f81576b2206..a97d6dfdda9b79eed3be6302fb2b1c3810f189dc 100644 --- a/python/paddle/v2/fluid/tests/test_unpool_op.py +++ b/python/paddle/fluid/tests/unittests/test_unpool_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_variable.py b/python/paddle/fluid/tests/unittests/test_variable.py similarity index 85% rename from python/paddle/v2/fluid/tests/test_variable.py rename to python/paddle/fluid/tests/unittests/test_variable.py index 9f9748ca4e4778bf963360fb13661d3469e344bf..49784e21c461bacadd404bf4a8640ebc4dcb26ca 100644 --- a/python/paddle/v2/fluid/tests/test_variable.py +++ b/python/paddle/fluid/tests/unittests/test_variable.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,14 +13,14 @@ # limitations under the License. import unittest -from paddle.v2.fluid.framework import default_main_program, Program, convert_np_dtype_to_dtype_ -import paddle.v2.fluid.core as core +from paddle.fluid.framework import default_main_program, Program, convert_np_dtype_to_dtype_ +import paddle.fluid.core as core import numpy as np class TestVariable(unittest.TestCase): def test_np_dtype_convert(self): - DT = core.DataType + DT = core.VarDesc.VarType convert = convert_np_dtype_to_dtype_ self.assertEqual(DT.FP32, convert(np.float32)) self.assertEqual(DT.FP16, convert("float16")) @@ -36,13 +36,13 @@ class TestVariable(unittest.TestCase): w = b.create_var( dtype="float64", shape=[784, 100], lod_level=0, name="fc.w") self.assertNotEqual(str(w), "") - self.assertEqual(core.DataType.FP64, w.dtype) + self.assertEqual(core.VarDesc.VarType.FP64, w.dtype) self.assertEqual((784, 100), w.shape) self.assertEqual("fc.w", w.name) self.assertEqual(0, w.lod_level) w = b.create_var(name='fc.w') - self.assertEqual(core.DataType.FP64, w.dtype) + self.assertEqual(core.VarDesc.VarType.FP64, w.dtype) self.assertEqual((784, 100), w.shape) self.assertEqual("fc.w", w.name) self.assertEqual(0, w.lod_level) diff --git a/python/paddle/v2/fluid/tests/test_warpctc_op.py b/python/paddle/fluid/tests/unittests/test_warpctc_op.py similarity index 99% rename from python/paddle/v2/fluid/tests/test_warpctc_op.py rename to python/paddle/fluid/tests/unittests/test_warpctc_op.py index 55d1c73262a4d846ae2280c1967eb00f4f6c4dd7..ac638f7836f8205f80e31cfd5eb8892b2c7aee08 100644 --- a/python/paddle/v2/fluid/tests/test_warpctc_op.py +++ b/python/paddle/fluid/tests/unittests/test_warpctc_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/tests/test_weight_normalization.py b/python/paddle/fluid/tests/unittests/test_weight_normalization.py similarity index 94% rename from python/paddle/v2/fluid/tests/test_weight_normalization.py rename to python/paddle/fluid/tests/unittests/test_weight_normalization.py index 80ad8285d8a3c2ced814cc3588a814c14ec60855..2adf917bc5d3bb35842a817c57a983627b759f22 100644 --- a/python/paddle/v2/fluid/tests/test_weight_normalization.py +++ b/python/paddle/fluid/tests/unittests/test_weight_normalization.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,10 @@ import unittest import numpy import collections -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core -from paddle.v2.fluid.initializer import ConstantInitializer -from paddle.v2.fluid.param_attr import WeightNormParamAttr +import paddle.fluid as fluid +import paddle.fluid.core as core +from paddle.fluid.initializer import ConstantInitializer +from paddle.fluid.param_attr import WeightNormParamAttr class TestWeightNormalization(unittest.TestCase): diff --git a/python/paddle/v2/fluid/tests/test_while_op.py b/python/paddle/fluid/tests/unittests/test_while_op.py similarity index 91% rename from python/paddle/v2/fluid/tests/test_while_op.py rename to python/paddle/fluid/tests/unittests/test_while_op.py index 9f5e1b668c0d01768138487d38f755d2832a8551..5afeb5ae8983df5c2c426db79a007173e8e470e8 100644 --- a/python/paddle/v2/fluid/tests/test_while_op.py +++ b/python/paddle/fluid/tests/unittests/test_while_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,10 +13,10 @@ # limitations under the License. import unittest -import paddle.v2.fluid.layers as layers -from paddle.v2.fluid.executor import Executor -import paddle.v2.fluid.core as core -from paddle.v2.fluid.backward import append_backward +import paddle.fluid.layers as layers +from paddle.fluid.executor import Executor +import paddle.fluid.core as core +from paddle.fluid.backward import append_backward import numpy diff --git a/python/paddle/fluid/unique_name.py b/python/paddle/fluid/unique_name.py new file mode 100644 index 0000000000000000000000000000000000000000..33c53113ae7e8ed9aeada31f2aed6990b6fea110 --- /dev/null +++ b/python/paddle/fluid/unique_name.py @@ -0,0 +1,74 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import collections +import contextlib +import sys + +__all__ = ['generate', 'switch', 'guard', 'UniqueNameGenerator'] + + +class UniqueNameGenerator(object): + """ + Generate unique name with prefix. + + Args: + prefix(str): The generated name prefix. All generated name will be + started with this prefix. + """ + + def __init__(self, prefix=None): + self.ids = collections.defaultdict(int) + if prefix is None: + prefix = "" + self.prefix = prefix + + def __call__(self, key): + """ + Generate unique names with prefix + + Args: + key(str): The key of return string. + + Returns(str): A unique string with the prefix + """ + tmp = self.ids[key] + self.ids[key] += 1 + return self.prefix + "_".join([key, str(tmp)]) + + +generator = UniqueNameGenerator() + + +def generate(key): + return generator(key) + + +def switch(new_generator=None): + global generator + old = generator + if new_generator is None: + generator = UniqueNameGenerator() + else: + generator = new_generator + return old + + +@contextlib.contextmanager +def guard(new_generator=None): + if isinstance(new_generator, basestring): + new_generator = UniqueNameGenerator(new_generator) + old = switch(new_generator) + yield + switch(old) diff --git a/python/paddle/trainer_config_helpers/layer_math.py b/python/paddle/trainer_config_helpers/layer_math.py index e1c8f0c3500413b364546bc3352cf3a64d3581de..ee84188baccc8c246b7a791c77556b403698f2d9 100644 --- a/python/paddle/trainer_config_helpers/layer_math.py +++ b/python/paddle/trainer_config_helpers/layer_math.py @@ -75,7 +75,7 @@ LayerOutput.__add__ = add def sub(layeroutput, other): if is_compatible_with(other, float): - return slope_intercept_layer(input=layeroutput, intercept=other) + return slope_intercept_layer(input=layeroutput, intercept=-other) if not isinstance(other, LayerOutput): logger.fatal("LayerOutput can only be subtracted with" " another Layeroutput or a number") diff --git a/python/paddle/trainer_config_helpers/tests/ProtobufEqualMain.cpp b/python/paddle/trainer_config_helpers/tests/ProtobufEqualMain.cpp index fc53422afd44a6cb1d81a8ec9d27d83523f30e6c..7b10e0b7a605f92b142aa11ac39911f0993b077f 100644 --- a/python/paddle/trainer_config_helpers/tests/ProtobufEqualMain.cpp +++ b/python/paddle/trainer_config_helpers/tests/ProtobufEqualMain.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/img_layers.py b/python/paddle/trainer_config_helpers/tests/configs/img_layers.py index 93b505a6023cb4e2fe14f1208ac12a841ec18f55..767b6454242e40bbd53fb6e1a7d4c8bb5281d327 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/img_layers.py +++ b/python/paddle/trainer_config_helpers/tests/configs/img_layers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/img_trans_layers.py b/python/paddle/trainer_config_helpers/tests/configs/img_trans_layers.py index 745f060fa5542293c646a83a81a263e92bda6a48..e17c8fa7c0ae9349db89448f405c71256d50e268 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/img_trans_layers.py +++ b/python/paddle/trainer_config_helpers/tests/configs/img_trans_layers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/last_first_seq.py b/python/paddle/trainer_config_helpers/tests/configs/last_first_seq.py index b6fc8f70f96487aabf249166b9b339d1b86f986e..5b6d2627e431ac9e2d988a43a7541e177fd8ac19 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/last_first_seq.py +++ b/python/paddle/trainer_config_helpers/tests/configs/last_first_seq.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/layer_activations.py b/python/paddle/trainer_config_helpers/tests/configs/layer_activations.py index 6edc03bba0b286fae5964bbc2bdffb99b175c718..ac1f7e02c098a26ea4acecb618db6d79d2ab7134 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/layer_activations.py +++ b/python/paddle/trainer_config_helpers/tests/configs/layer_activations.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/math_ops.py b/python/paddle/trainer_config_helpers/tests/configs/math_ops.py index 59a71e1cd1d46f6be132fa5758d54edb219e9dd8..29dc634fb3992ba51c06672a3e6047e44176c29b 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/math_ops.py +++ b/python/paddle/trainer_config_helpers/tests/configs/math_ops.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/projections.py b/python/paddle/trainer_config_helpers/tests/configs/projections.py index 96f06b40180d5e7707ea363e6311079d81302631..3b7a196d1c12aa5fe597dcbe3c4663525be2c85c 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/projections.py +++ b/python/paddle/trainer_config_helpers/tests/configs/projections.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/protostr/math_ops.protostr b/python/paddle/trainer_config_helpers/tests/configs/protostr/math_ops.protostr index eaaf7fd6f5b4cec1a2f95622831cf95436a1514a..582207741ab76370d9c5c09598c3f7a81f013b73 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/protostr/math_ops.protostr +++ b/python/paddle/trainer_config_helpers/tests/configs/protostr/math_ops.protostr @@ -230,7 +230,7 @@ layers { input_layer_name: "__mixed_1__" } slope: 1.0 - intercept: 2 + intercept: -2 } layers { name: "__slope_intercept_layer_4__" @@ -411,4 +411,3 @@ sub_models { output_layer_names: "__mixed_3__" is_recurrent_layer_group: false } - diff --git a/python/paddle/trainer_config_helpers/tests/configs/shared_fc.py b/python/paddle/trainer_config_helpers/tests/configs/shared_fc.py index 69a0a5b8ff53961f07ff3648c63e61d382965519..3229252a2f4f5083041fd04c5fb9e8400453e601 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/shared_fc.py +++ b/python/paddle/trainer_config_helpers/tests/configs/shared_fc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/shared_gru.py b/python/paddle/trainer_config_helpers/tests/configs/shared_gru.py index 97b41fb3725ae325d3e67769b2d6702fdbbdb238..dff561fdf7818b8bb0684dbf9260fbe8badf363d 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/shared_gru.py +++ b/python/paddle/trainer_config_helpers/tests/configs/shared_gru.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/shared_lstm.py b/python/paddle/trainer_config_helpers/tests/configs/shared_lstm.py index 4e653dedb9d374ed53148c47582c84c2b6fb532d..97ef2d07ae88fbb8a9cf9ec9f7997e05514bd46f 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/shared_lstm.py +++ b/python/paddle/trainer_config_helpers/tests/configs/shared_lstm.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/simple_rnn_layers.py b/python/paddle/trainer_config_helpers/tests/configs/simple_rnn_layers.py index dc418325f8857dd8f3ff60a05bb003a2b72e30b4..f882efcba21112231a4c09627fd58ad88833038c 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/simple_rnn_layers.py +++ b/python/paddle/trainer_config_helpers/tests/configs/simple_rnn_layers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_BatchNorm3D.py b/python/paddle/trainer_config_helpers/tests/configs/test_BatchNorm3D.py index 5b98e3fb348a620e0474322b885112a6ecff3495..169038deb1915a1899b46b48d6b661045d3c0a52 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_BatchNorm3D.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_BatchNorm3D.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_bi_grumemory.py b/python/paddle/trainer_config_helpers/tests/configs/test_bi_grumemory.py index f3abdfe1ae71bf728a521c0f46ec773b058acb46..d29e4e5c4d6356c9ac8726efb92adcf15b191f67 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_bi_grumemory.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_bi_grumemory.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_bilinear_interp.py b/python/paddle/trainer_config_helpers/tests/configs/test_bilinear_interp.py index 4eb9f207e0cc4d209bdd616e92a88678c148ebff..5e724ba7d1730efa2ee26910abd68b89a4f1c737 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_bilinear_interp.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_bilinear_interp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_clip_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_clip_layer.py index 24564c105f9e1321c1a08dea611a601bc94bddb0..95a1192bfae396fd96df9c8678020c089b4f7d41 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_clip_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_clip_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_conv3d_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_conv3d_layer.py index 35087c42289aa60f34b71b432fbf30df3a0c3167..f9966e399e73c112c02fa1cab02050aea362b36e 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_conv3d_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_conv3d_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_cost_layers.py b/python/paddle/trainer_config_helpers/tests/configs/test_cost_layers.py index b076b89106e0854046603f24164d391b0c668474..351694fd55caea9a402cdd5dcab94ebde147d814 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_cost_layers.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_cost_layers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_cost_layers_with_weight.py b/python/paddle/trainer_config_helpers/tests/configs/test_cost_layers_with_weight.py index fa7a1abe9a129ca24a6b2bb1c13dc30eddd48147..8cbcf5de0a3e3ae25a58bb60befff6072594f555 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_cost_layers_with_weight.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_cost_layers_with_weight.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_crop.py b/python/paddle/trainer_config_helpers/tests/configs/test_crop.py index 569d747857d8e756e70fea10b3e0b92801c1f4a1..b4ffff252bb50c518875c03d4e00af9aa9040fba 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_crop.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_crop.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_deconv3d_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_deconv3d_layer.py index 4f27d9987346198bab06ccc59b63b0b73906e800..08e701c7a8ddae48df2ac01565a5ce2120a7d592 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_deconv3d_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_deconv3d_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_detection_output_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_detection_output_layer.py index d37954222edb9202ec24bf5d6fed1da1028a276b..4ecd1c2b7e0e6c9fd894c6fa268b1496fbf4fd9e 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_detection_output_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_detection_output_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_dot_prod_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_dot_prod_layer.py index 63ba0a72b9e19a6a0da9961bd086810905f9129a..9b444bc2c02bdc80022a9229fbfd11c009bf740a 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_dot_prod_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_dot_prod_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_expand_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_expand_layer.py index 9892bca05d52f870df1c5b2e514240fa06d7a9a4..85101d2b927d5cee112e6ea14b54a9a8fae8ac79 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_expand_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_expand_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_factorization_machine.py b/python/paddle/trainer_config_helpers/tests/configs/test_factorization_machine.py index 6fb773d9f738aa3ffa91feb7bace22e2b8e4f312..48ac46c5bb654f18889297da3d249b2449e30078 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_factorization_machine.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_factorization_machine.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_fc.py b/python/paddle/trainer_config_helpers/tests/configs/test_fc.py index 4dd37d024259dfef3e70beb00d39e73287a24473..f1e454d21129c92312f6b2b065112cb1019d3fd1 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_fc.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_fc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_gated_unit_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_gated_unit_layer.py index 082646b9d3d60ffd03236df027fec8417e47bda6..afc3e9207c5427ea123cf67fd0a154e15949dcdf 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_gated_unit_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_gated_unit_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_grumemory_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_grumemory_layer.py index f5271b82804f96d97bca293581951c3d5d291f40..ac9902d08c60a0d9f0aa4af91d4b91e458944f21 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_grumemory_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_grumemory_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_hsigmoid.py b/python/paddle/trainer_config_helpers/tests/configs/test_hsigmoid.py index ad86d7d5bd598fc241cea50bf4689242467bbb82..da781c149b86563469ae308d748f1a5b63c2327f 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_hsigmoid.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_hsigmoid.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_l2_distance_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_l2_distance_layer.py index 1796e1c6b6d1d69db85c890a401cef630ed15f79..42c9b5deea78d218826aab7a0892e113fe1c1b23 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_l2_distance_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_l2_distance_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_lstmemory_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_lstmemory_layer.py index 7484818ab24d5ffe7e285c39e94e32cca96b2996..26eeea5461f6ab95707170bf9a2d593ce2031e7a 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_lstmemory_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_lstmemory_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_maxout.py b/python/paddle/trainer_config_helpers/tests/configs/test_maxout.py index 22788be2e90e65c686b2db046a2407e41dd65fbd..2cd41a306a74ce60f943d381eeba647a00b6780a 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_maxout.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_maxout.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_multibox_loss_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_multibox_loss_layer.py index 0dcccc49e43d9222f6a17fd8e25e38e3360d3dcc..b4fd9052c410a776d2192fe9bebf88bd82976565 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_multibox_loss_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_multibox_loss_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_multiplex_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_multiplex_layer.py index 046d38741e87dc60e04f88f8e8d599b4f75fa4c2..bfba07be869184cb497d422a48b450983f6e2945 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_multiplex_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_multiplex_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_ntm_layers.py b/python/paddle/trainer_config_helpers/tests/configs/test_ntm_layers.py index d81128c77c3bd4af9e8bbe78db61ea0232a4a837..891894172c5d87a29f6bf095f07a2a1ecf5e97bc 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_ntm_layers.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_ntm_layers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_pad.py b/python/paddle/trainer_config_helpers/tests/configs/test_pad.py index 44b0b34d5adb544d81c7ae6e12f3ca89652d7d8e..c5825c82e5bf4d00baf9342040da62a2aae17ac6 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_pad.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_pad.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_pooling3D_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_pooling3D_layer.py index e257e735ad25f154600172ca43d739deb2069f3a..5ff52c195a4798b2fcf730814217ae44e5c133a4 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_pooling3D_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_pooling3D_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_prelu_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_prelu_layer.py index 098e2397ececdd847ba76e7d4b65552c873bf2bb..d803a0d13d5000e457078d6763599ed66b8ac898 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_prelu_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_prelu_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_print_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_print_layer.py index 714d8893e951267c312ee7b924433892864e4535..ca1f5a45724bb56d86f0093eeb8821f2077b9963 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_print_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_print_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_recursive_topology.py b/python/paddle/trainer_config_helpers/tests/configs/test_recursive_topology.py index 188a3d2320f6715cac2cd6e0cb3e9935b844452e..d44870d804f906996dacc6cc7f09bd480b70c86b 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_recursive_topology.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_recursive_topology.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_repeat_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_repeat_layer.py index 93b673afeecbcd4995aaa9fec0380b88c2bdd946..ee90e830df11ad6f9017ee8c143c82882a713881 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_repeat_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_repeat_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_resize_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_resize_layer.py index 3a202974e3d64659ffa3291c764b55810cc3b555..4aa81919dfd2492053b0733eaa6e24b683ec8602 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_resize_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_resize_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_rnn_group.py b/python/paddle/trainer_config_helpers/tests/configs/test_rnn_group.py index 91074b8fdf3f0865516a301362ca9b5b8c469fbe..3824ef59953cf9209864590b7ba3f66959202c16 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_rnn_group.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_rnn_group.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_roi_pool_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_roi_pool_layer.py index f0a37f7e992e01588c39221efd28be15058ac0af..6929d106c643a5cc73fbb7a70973101940904fdd 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_roi_pool_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_roi_pool_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_row_conv.py b/python/paddle/trainer_config_helpers/tests/configs/test_row_conv.py index 68b1a991f35c9673d5f70f86d2bbedb92dfe7d4f..6381a26fe8417a276846d557ba17b6b0c8f02605 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_row_conv.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_row_conv.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_row_l2_norm_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_row_l2_norm_layer.py index c25393f580efc538dbf865b81715412041469adf..3c17d2ccfd602d34d4bc0daf37932270f872577b 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_row_l2_norm_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_row_l2_norm_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_scale_shift_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_scale_shift_layer.py index 3691e8daeaabf9f863d5813f89275dd7dda3039a..ae8a25ba94de3ac927a898b7587bd2299c6b6af0 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_scale_shift_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_scale_shift_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_scale_sub_region_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_scale_sub_region_layer.py index 426afcf3a000011a32a129b894f285de565cb9cf..e4f7120bcceb98ab6f9ec6dda682c8ce16a6e3c5 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_scale_sub_region_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_scale_sub_region_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_seq_concat_reshape.py b/python/paddle/trainer_config_helpers/tests/configs/test_seq_concat_reshape.py index 72960818573162a1033714cf3e36626b4b0814fa..a6be069e7e28c6fed6ddb4eef7e6f8254aaa8722 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_seq_concat_reshape.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_seq_concat_reshape.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_sequence_pooling.py b/python/paddle/trainer_config_helpers/tests/configs/test_sequence_pooling.py index d13a5a842990b49426120457ba0370e01815bd09..7b951a4cd79f7295dd9c259e0d0aa27edd9e1f15 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_sequence_pooling.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_sequence_pooling.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_smooth_l1.py b/python/paddle/trainer_config_helpers/tests/configs/test_smooth_l1.py index 42225b85058ee82c22ee829f8d3aafe6d7d3a329..32a4e6f6d08b2f9a33a29ef98a2a60cd967a62e3 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_smooth_l1.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_smooth_l1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_split_datasource.py b/python/paddle/trainer_config_helpers/tests/configs/test_split_datasource.py index 7ebdf7408db17e69be481f305657051d944f8c81..ea68b5493ee9a83baf729a5cc32bc1c7a53b1b23 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_split_datasource.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_split_datasource.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/test_spp_layer.py b/python/paddle/trainer_config_helpers/tests/configs/test_spp_layer.py index 1f19ea77adf3fe378e8274e9d1ee2a99552b94b1..0e692d4b62c8744397e182ed6ac86785f882bc51 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/test_spp_layer.py +++ b/python/paddle/trainer_config_helpers/tests/configs/test_spp_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/unused_layers.py b/python/paddle/trainer_config_helpers/tests/configs/unused_layers.py index 8581ba60ab9e382ee9bfdd2307921b4c94d132ed..8878e73fff6cdab9135bb34fe1e8d482944a28cd 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/unused_layers.py +++ b/python/paddle/trainer_config_helpers/tests/configs/unused_layers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/configs/util_layers.py b/python/paddle/trainer_config_helpers/tests/configs/util_layers.py index a66c9515c77bc04b3a72ceb31b7dbc43050d7627..da134f100b984711dfb186735764c5d96472b28d 100644 --- a/python/paddle/trainer_config_helpers/tests/configs/util_layers.py +++ b/python/paddle/trainer_config_helpers/tests/configs/util_layers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/trainer_config_helpers/tests/test_reset_hook.py b/python/paddle/trainer_config_helpers/tests/test_reset_hook.py index 81186dedd20824234040e57967ce4cb53b07a8f6..4d7542c35b2b6293ce9653154d670e9c79e0ce91 100644 --- a/python/paddle/trainer_config_helpers/tests/test_reset_hook.py +++ b/python/paddle/trainer_config_helpers/tests/test_reset_hook.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/utils/image_multiproc.py b/python/paddle/utils/image_multiproc.py index fdbefef9ff75669becadaa1291891c0d6b7fb268..3e3e519f76d388eeb477f0014bcbb3e7cd09352a 100644 --- a/python/paddle/utils/image_multiproc.py +++ b/python/paddle/utils/image_multiproc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/dataset/common.py b/python/paddle/v2/dataset/common.py index 9aba35a6481e3ad3ab37c8d4de0f998c9f0a1f07..c6ff09a1d1e3ca56877e986c3ed3ae9ecd0a7316 100644 --- a/python/paddle/v2/dataset/common.py +++ b/python/paddle/v2/dataset/common.py @@ -74,6 +74,8 @@ def download(url, module_name, md5sum, save_name=None): retry = 0 retry_limit = 3 while not (os.path.exists(filename) and md5file(filename) == md5sum): + if os.path.exists(filename): + print "file md5", md5file(filename), md5sum if retry < retry_limit: retry += 1 else: diff --git a/python/paddle/v2/dataset/tests/imikolov_test.py b/python/paddle/v2/dataset/tests/imikolov_test.py index eed1458244562634ef44e8c9653059aaddbae6b2..714a75d6f1ff31697eec2d893d350a726d6390fe 100644 --- a/python/paddle/v2/dataset/tests/imikolov_test.py +++ b/python/paddle/v2/dataset/tests/imikolov_test.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/event.py b/python/paddle/v2/event.py index 01067ef426d426e2921e51e8b6f620313609ab2c..c11aa121c196497494f88de78d75f0f9dc072ba0 100644 --- a/python/paddle/v2/event.py +++ b/python/paddle/v2/event.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/fluid/layers/detection.py b/python/paddle/v2/fluid/layers/detection.py deleted file mode 100644 index 0f3256d7652b25845fe577838030009a45ed16cd..0000000000000000000000000000000000000000 --- a/python/paddle/v2/fluid/layers/detection.py +++ /dev/null @@ -1,328 +0,0 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" -All layers just related to the detection neural network. -""" - -from ..layer_helper import LayerHelper -from ..framework import Variable -from tensor import concat -from ops import reshape -import math - -__all__ = [ - 'detection_output', - 'prior_box', -] - - -def detection_output(scores, - loc, - prior_box, - prior_box_var, - background_label=0, - nms_threshold=0.3, - nms_top_k=400, - keep_top_k=200, - score_threshold=0.01, - nms_eta=1.0): - """ - **Detection Output Layer** - - This layer applies the NMS to the output of network and computes the - predict bounding box location. The output's shape of this layer could - be zero if there is no valid bounding box. - - Args: - scores(Variable): A 3-D Tensor with shape [N, C, M] represents the - predicted confidence predictions. N is the batch size, C is the - class number, M is number of bounding boxes. For each category - there are total M scores which corresponding M bounding boxes. - loc(Variable): A 3-D Tensor with shape [N, M, 4] represents the - predicted locations of M bounding bboxes. N is the batch size, - and each bounding box has four coordinate values and the layout - is [xmin, ymin, xmax, ymax]. - prior_box(Variable): A 2-D Tensor with shape [M, 4] holds M boxes, - each box is represented as [xmin, ymin, xmax, ymax], - [xmin, ymin] is the left top coordinate of the anchor box, - if the input is image feature map, they are close to the origin - of the coordinate system. [xmax, ymax] is the right bottom - coordinate of the anchor box. - prior_box_var(Variable): A 2-D Tensor with shape [M, 4] holds M group - of variance. - background_label(float): The index of background label, - the background label will be ignored. If set to -1, then all - categories will be considered. - nms_threshold(float): The threshold to be used in NMS. - nms_top_k(int): Maximum number of detections to be kept according - to the confidences aftern the filtering detections based on - score_threshold. - keep_top_k(int): Number of total bboxes to be kept per image after - NMS step. -1 means keeping all bboxes after NMS step. - score_threshold(float): Threshold to filter out bounding boxes with - low confidence score. If not provided, consider all boxes. - nms_eta(float): The parameter for adaptive NMS. - - Returns: - The detected bounding boxes which are a Tensor. - - Examples: - .. code-block:: python - - pb = layers.data(name='prior_box', shape=[10, 4], - append_batch_size=False, dtype='float32') - pbv = layers.data(name='prior_box_var', shape=[10, 4], - append_batch_size=False, dtype='float32') - loc = layers.data(name='target_box', shape=[21, 4], - append_batch_size=False, dtype='float32') - scores = layers.data(name='scores', shape=[2, 21, 10], - append_batch_size=False, dtype='float32') - nmsed_outs = fluid.layers.detection_output(scores=scores, - loc=loc, - prior_box=pb, - prior_box_var=pbv) - """ - - helper = LayerHelper("detection_output", **locals()) - decoded_box = helper.create_tmp_variable(dtype=loc.dtype) - helper.append_op( - type="box_coder", - inputs={ - 'PriorBox': prior_box, - 'PriorBoxVar': prior_box_var, - 'TargetBox': loc - }, - outputs={'OutputBox': decoded_box}, - attrs={'code_type': 'decode_center_size'}) - nmsed_outs = helper.create_tmp_variable(dtype=decoded_box.dtype) - - helper.append_op( - type="multiclass_nms", - inputs={'Scores': scores, - 'BBoxes': decoded_box}, - outputs={'Out': nmsed_outs}, - attrs={ - 'background_label': 0, - 'nms_threshold': nms_threshold, - 'nms_top_k': nms_top_k, - 'keep_top_k': keep_top_k, - 'score_threshold': score_threshold, - 'nms_eta': 1.0 - }) - return nmsed_outs - - -def prior_box(inputs, - image, - min_ratio, - max_ratio, - aspect_ratios, - base_size, - steps=None, - step_w=None, - step_h=None, - offset=0.5, - variance=[0.1, 0.1, 0.1, 0.1], - flip=False, - clip=False, - min_sizes=None, - max_sizes=None, - name=None): - """ - **Prior_boxes** - - Generate prior boxes for SSD(Single Shot MultiBox Detector) - algorithm. The details of this algorithm, please refer the - section 2.2 of SSD paper (SSD: Single Shot MultiBox Detector) - `_ . - - Args: - inputs(list): The list of input Variables, the format - of all Variables is NCHW. - image(Variable): The input image data of PriorBoxOp, - the layout is NCHW. - min_ratio(int): the min ratio of generated prior boxes. - max_ratio(int): the max ratio of generated prior boxes. - aspect_ratios(list): the aspect ratios of generated prior - boxes. The length of input and aspect_ratios must be equal. - base_size(int): the base_size is used to get min_size - and max_size according to min_ratio and max_ratio. - step_w(list, optional, default=None): Prior boxes step - across width. If step_w[i] == 0.0, the prior boxes step - across width of the inputs[i] will be automatically calculated. - step_h(list, optional, default=None): Prior boxes step - across height, If step_h[i] == 0.0, the prior boxes - step across height of the inputs[i] will be automatically calculated. - offset(float, optional, default=0.5): Prior boxes center offset. - variance(list, optional, default=[0.1, 0.1, 0.1, 0.1]): the variances - to be encoded in prior boxes. - flip(bool, optional, default=False): Whether to flip - aspect ratios. - clip(bool, optional, default=False): Whether to clip - out-of-boundary boxes. - min_sizes(list, optional, default=None): If `len(inputs) <=2`, - min_sizes must be set up, and the length of min_sizes - should equal to the length of inputs. - max_sizes(list, optional, default=None): If `len(inputs) <=2`, - max_sizes must be set up, and the length of min_sizes - should equal to the length of inputs. - name(str, optional, None): Name of the prior box layer. - - Returns: - boxes(Variable): the output prior boxes of PriorBoxOp. - The layout is [num_priors, 4]. num_priors is the total - box count of each position of inputs. - Variances(Variable): the expanded variances of PriorBoxOp. - The layout is [num_priors, 4]. num_priors is the total - box count of each position of inputs - - Examples: - .. code-block:: python - - prior_box( - inputs = [conv1, conv2, conv3, conv4, conv5, conv6], - image = data, - min_ratio = 20, # 0.20 - max_ratio = 90, # 0.90 - offset = 0.5, - base_size = 300, - variance = [0.1,0.1,0.1,0.1], - aspect_ratios = [[2.], [2., 3.], [2., 3.], [2., 3.], [2.], [2.]], - flip=True, - clip=True) - """ - - def _prior_box_(input, - image, - min_sizes, - max_sizes, - aspect_ratios, - variance, - flip=False, - clip=False, - step_w=0.0, - step_h=0.0, - offset=0.5, - name=None): - helper = LayerHelper("prior_box", **locals()) - dtype = helper.input_dtype() - - box = helper.create_tmp_variable(dtype) - var = helper.create_tmp_variable(dtype) - helper.append_op( - type="prior_box", - inputs={"Input": input, - "Image": image}, - outputs={"Boxes": box, - "Variances": var}, - attrs={ - 'min_sizes': min_sizes, - 'max_sizes': max_sizes, - 'aspect_ratios': aspect_ratios, - 'variances': variance, - 'flip': flip, - 'clip': clip, - 'step_w': step_w, - 'step_h': step_h, - 'offset': offset - }) - return box, var - - def _reshape_with_axis_(input, axis=1): - if not (axis > 0 and axis < len(input.shape)): - raise ValueError("The axis should be smaller than " - "the arity of input and bigger than 0.") - new_shape = [ - -1, reduce(lambda x, y: x * y, input.shape[axis:len(input.shape)]) - ] - out = reshape(x=input, shape=new_shape) - return out - - assert isinstance(inputs, list), 'inputs should be a list.' - num_layer = len(inputs) - - if num_layer <= 2: - assert min_sizes is not None and max_sizes is not None - assert len(min_sizes) == num_layer and len(max_sizes) == num_layer - else: - min_sizes = [] - max_sizes = [] - step = int(math.floor(((max_ratio - min_ratio)) / (num_layer - 2))) - for ratio in xrange(min_ratio, max_ratio + 1, step): - min_sizes.append(base_size * ratio / 100.) - max_sizes.append(base_size * (ratio + step) / 100.) - min_sizes = [base_size * .10] + min_sizes - max_sizes = [base_size * .20] + max_sizes - - if aspect_ratios: - if not (isinstance(aspect_ratios, list) and - len(aspect_ratios) == num_layer): - raise ValueError( - 'aspect_ratios should be list and the length of inputs ' - 'and aspect_ratios should be the same.') - if step_h: - if not (isinstance(step_h, list) and len(step_h) == num_layer): - raise ValueError( - 'step_h should be list and the length of inputs and ' - 'step_h should be the same.') - if step_w: - if not (isinstance(step_w, list) and len(step_w) == num_layer): - raise ValueError( - 'step_w should be list and the length of inputs and ' - 'step_w should be the same.') - if steps: - if not (isinstance(steps, list) and len(steps) == num_layer): - raise ValueError( - 'steps should be list and the length of inputs and ' - 'step_w should be the same.') - step_w = steps - step_h = steps - - box_results = [] - var_results = [] - for i, input in enumerate(inputs): - min_size = min_sizes[i] - max_size = max_sizes[i] - aspect_ratio = [] - if not isinstance(min_size, list): - min_size = [min_size] - if not isinstance(max_size, list): - max_size = [max_size] - if aspect_ratios: - aspect_ratio = aspect_ratios[i] - if not isinstance(aspect_ratio, list): - aspect_ratio = [aspect_ratio] - - box, var = _prior_box_(input, image, min_size, max_size, aspect_ratio, - variance, flip, clip, step_w[i] - if step_w else 0.0, step_h[i] - if step_w else 0.0, offset) - - box_results.append(box) - var_results.append(var) - - if len(box_results) == 1: - box = box_results[0] - var = var_results[0] - else: - reshaped_boxes = [] - reshaped_vars = [] - for i in range(len(box_results)): - reshaped_boxes.append(_reshape_with_axis_(box_results[i], axis=3)) - reshaped_vars.append(_reshape_with_axis_(var_results[i], axis=3)) - - box = concat(reshaped_boxes) - var = concat(reshaped_vars) - - return box, var diff --git a/python/paddle/v2/fluid/tests/CMakeLists.txt b/python/paddle/v2/fluid/tests/CMakeLists.txt deleted file mode 100644 index 26a80abcb5839e80b5a22f9415315519ce3042e8..0000000000000000000000000000000000000000 --- a/python/paddle/v2/fluid/tests/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -file(GLOB TEST_OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "test_*.py") -string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") - -if(NOT WITH_DISTRIBUTE) - list(REMOVE_ITEM TEST_OPS test_recv_op) -endif(NOT WITH_DISTRIBUTE) - -list(REMOVE_ITEM TEST_OPS test_warpctc_op) -foreach(src ${TEST_OPS}) - py_test(${src} SRCS ${src}.py) -endforeach() -py_test(test_warpctc_op SRCS test_warpctc_op.py ENVS FLAGS_warpctc_dir=${WARPCTC_LIB_DIR}) - -add_subdirectory(book) -add_subdirectory(book_distribute) -add_subdirectory(book_memory_optimization) diff --git a/python/paddle/v2/fluid/tests/test_detection.py b/python/paddle/v2/fluid/tests/test_detection.py deleted file mode 100644 index fecc2a6226f5655adcb60ac3efef8fc26eec8ba2..0000000000000000000000000000000000000000 --- a/python/paddle/v2/fluid/tests/test_detection.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import print_function -import paddle.v2.fluid as fluid -import paddle.v2.fluid.core as core -import paddle.v2.fluid.layers as layers -import paddle.v2.fluid.layers.detection as detection -from paddle.v2.fluid.framework import Program, program_guard -import unittest -import numpy as np - - -class TestBook(unittest.TestCase): - def test_detection_output(self): - program = Program() - with program_guard(program): - pb = layers.data( - name='prior_box', - shape=[10, 4], - append_batch_size=False, - dtype='float32') - pbv = layers.data( - name='prior_box_var', - shape=[10, 4], - append_batch_size=False, - dtype='float32') - loc = layers.data( - name='target_box', - shape=[20, 4], - append_batch_size=False, - dtype='float32') - scores = layers.data( - name='scores', - shape=[2, 20, 10], - append_batch_size=False, - dtype='float32') - out = layers.detection_output( - scores=scores, loc=loc, prior_box=pb, prior_box_var=pbv) - self.assertIsNotNone(out) - print(str(program)) - - -class TestPriorBox(unittest.TestCase): - def test_prior_box(self): - data_shape = [3, 224, 224] - box, var = self.prior_box_output(data_shape) - - assert len(box.shape) == 2 - assert box.shape == var.shape - assert box.shape[1] == 4 - - def prior_box_output(self, data_shape): - images = fluid.layers.data( - name='pixel', shape=data_shape, dtype='float32') - conv1 = fluid.layers.conv2d( - input=images, - num_filters=3, - filter_size=3, - stride=2, - use_cudnn=False) - conv2 = fluid.layers.conv2d( - input=conv1, - num_filters=3, - filter_size=3, - stride=2, - use_cudnn=False) - conv3 = fluid.layers.conv2d( - input=conv2, - num_filters=3, - filter_size=3, - stride=2, - use_cudnn=False) - conv4 = fluid.layers.conv2d( - input=conv3, - num_filters=3, - filter_size=3, - stride=2, - use_cudnn=False) - conv5 = fluid.layers.conv2d( - input=conv4, - num_filters=3, - filter_size=3, - stride=2, - use_cudnn=False) - - box, var = detection.prior_box( - inputs=[conv1, conv2, conv3, conv4, conv5, conv5], - image=images, - min_ratio=20, - max_ratio=90, - # steps=[8, 16, 32, 64, 100, 300], - aspect_ratios=[[2.], [2., 3.], [2., 3.], [2., 3.], [2.], [2.]], - base_size=300, - offset=0.5, - flip=True, - clip=True) - return box, var - - -if __name__ == '__main__': - unittest.main() diff --git a/python/paddle/v2/fluid/tests/test_uniform_random_op.py b/python/paddle/v2/fluid/tests/test_uniform_random_op.py deleted file mode 100644 index 94cf416fad8f02cdea8017ae1350fa264ce644b1..0000000000000000000000000000000000000000 --- a/python/paddle/v2/fluid/tests/test_uniform_random_op.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -import numpy - -from paddle.v2.fluid.op import Operator -import paddle.v2.fluid.core as core -import paddle.v2.fluid as fluid - - -class TestUniformRandomOp(unittest.TestCase): - def setUp(self): - self.op_type = "uniform_random" - self.inputs = {} - self.attrs = { - "shape": [1000, 784], - "min": -5.0, - "max": 10.0, - "seed": 10 - } - self.outputs = ["Out"] - - def test_cpu(self): - self.uniform_random_test(place=core.CPUPlace()) - - def test_gpu(self): - if core.is_compiled_with_cuda(): - self.uniform_random_test(place=core.CUDAPlace(0)) - - def uniform_random_test(self, place): - program = fluid.Program() - block = program.global_block() - vout = block.create_var(name="Out") - op = block.append_op( - type=self.op_type, outputs={"Out": vout}, attrs=self.attrs) - - op.desc.infer_var_type(block.desc) - op.desc.infer_shape(block.desc) - - fetch_list = [] - for var_name in self.outputs: - fetch_list.append(block.var(var_name)) - - exe = fluid.Executor(place) - outs = exe.run(program, fetch_list=fetch_list) - - tensor = outs[0] - - self.assertAlmostEqual(tensor.mean(), 2.5, delta=0.1) - - -if __name__ == "__main__": - unittest.main() diff --git a/python/paddle/v2/image.py b/python/paddle/v2/image.py index e5000e440cc8d822dbd38dce3978d2722d32ebe4..9235c41e9eb95b25a0dc53a494a203e7a4525981 100644 --- a/python/paddle/v2/image.py +++ b/python/paddle/v2/image.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/inference.py b/python/paddle/v2/inference.py index 78bf9807da3586fd2899cd914cd64c824814e7f3..52f5b947fdec55eea45b9d34eddd576c981fa97c 100644 --- a/python/paddle/v2/inference.py +++ b/python/paddle/v2/inference.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/master/__init__.py b/python/paddle/v2/master/__init__.py index 494e4baf20e6d1c5171aa54c93a30c67c02bb02a..efaeeabfa2652a16c510453ba672e7d0fe9debc9 100644 --- a/python/paddle/v2/master/__init__.py +++ b/python/paddle/v2/master/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/master/client.py b/python/paddle/v2/master/client.py index b3c790e39d7fa9b6595a92b6df94474b9e111cb0..d62e7cc28ef0f15a594949afa038bc3e8f6deccc 100644 --- a/python/paddle/v2/master/client.py +++ b/python/paddle/v2/master/client.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/reader/tests/__init__.py b/python/paddle/v2/reader/tests/__init__.py index b94a21a7e406b833797f8f521c62a2351c2bc30a..eca2dce114b069bf9b455d77ce670d73b5047fd2 100644 --- a/python/paddle/v2/reader/tests/__init__.py +++ b/python/paddle/v2/reader/tests/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/reader/tests/creator_test.py b/python/paddle/v2/reader/tests/creator_test.py index ac6cd4e9b6e19efb8cddbede0ff91438e5dbf531..7fe374e663607607cd0839eb6ca9c70c4d15eef8 100644 --- a/python/paddle/v2/reader/tests/creator_test.py +++ b/python/paddle/v2/reader/tests/creator_test.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Copyright PaddlePaddle contributors. All Rights Reserved +# Copyright PaddlePaddle contributors. All Rights Reservedd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/reader/tests/decorator_test.py b/python/paddle/v2/reader/tests/decorator_test.py index e41e9c78a070feab85f3d221c3f1a96b83e6dccf..6b680e39f3fb299a14e7d8162470996d1d16b83d 100644 --- a/python/paddle/v2/reader/tests/decorator_test.py +++ b/python/paddle/v2/reader/tests/decorator_test.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/tests/test_image.py b/python/paddle/v2/tests/test_image.py index 2b0444bb03fcdc051d0d2324c728584f01ca7ba4..c78bbdc40a25878b21ba7e678afedf9d8f0a87cf 100644 --- a/python/paddle/v2/tests/test_image.py +++ b/python/paddle/v2/tests/test_image.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/tests/test_layer.py b/python/paddle/v2/tests/test_layer.py index 710e8135f2de2549e653e952533924e582d938d0..b169a0f38ee61cd8f69a51e836d5cc3d42a9f850 100644 --- a/python/paddle/v2/tests/test_layer.py +++ b/python/paddle/v2/tests/test_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/tests/test_op.py b/python/paddle/v2/tests/test_op.py index dd04cc4ab6698f7f99209a49a67733c75789f1d9..15d5aef5111c2c2d5970fc21c54be4ca66aaba90 100644 --- a/python/paddle/v2/tests/test_op.py +++ b/python/paddle/v2/tests/test_op.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/tests/test_paramconf_order.py b/python/paddle/v2/tests/test_paramconf_order.py index 33c240b8f5a54a679289c71167551f71288d2305..264442be182ea69c95b39b3bdb4c389d52eff66e 100644 --- a/python/paddle/v2/tests/test_paramconf_order.py +++ b/python/paddle/v2/tests/test_paramconf_order.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Copyright PaddlePaddle contributors. All Rights Reserved +# Copyright PaddlePaddle contributors. All Rights Reservedd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/tests/test_parameters.py b/python/paddle/v2/tests/test_parameters.py index 1fe1f09b9d38b35d0b36088f577d175342a9d9b1..3bfd9348a61033de910d7f6f0867660d1d36f7fb 100644 --- a/python/paddle/v2/tests/test_parameters.py +++ b/python/paddle/v2/tests/test_parameters.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/tests/test_rnn_layer.py b/python/paddle/v2/tests/test_rnn_layer.py index 7920e342e1406e6b7eba5037558a87050b4ee49d..6ad07167dce13089b2081ee12119d67453b23873 100644 --- a/python/paddle/v2/tests/test_rnn_layer.py +++ b/python/paddle/v2/tests/test_rnn_layer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/tests/test_topology.py b/python/paddle/v2/tests/test_topology.py index 11b4154eedc629d703a90ece3768f2e26e981665..bacd28ddb7b61fcc396d61292a7cfcc87487e2e4 100644 --- a/python/paddle/v2/tests/test_topology.py +++ b/python/paddle/v2/tests/test_topology.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/paddle/v2/trainer.py b/python/paddle/v2/trainer.py index a0060bf227f01389093a106acb5f087a39969e74..5d98d5b6db57006b1e78c95eb1d6c7de7346e0e4 100644 --- a/python/paddle/v2/trainer.py +++ b/python/paddle/v2/trainer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/setup.py.in b/python/setup.py.in index 5a0d99995439135ce814e58fcfbcdc337965b164..6fff1bb09e4923650356a50afba0e105b3d8c0c2 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -71,9 +71,9 @@ packages=['paddle', 'paddle.v2.reader', 'paddle.v2.master', 'paddle.v2.plot', - 'paddle.v2.fluid', - 'paddle.v2.fluid.proto', - 'paddle.v2.fluid.layers', + 'paddle.fluid', + 'paddle.fluid.proto', + 'paddle.fluid.layers', 'py_paddle'] with open('@PADDLE_SOURCE_DIR@/python/requirements.txt') as f: @@ -102,14 +102,14 @@ setup(name='${PACKAGE_NAME}', ext_modules=[Extension('_foo', ['stub.cc'])], package_data={ 'paddle.v2.master': ['libpaddle_master.so'], - 'paddle.v2.fluid': ['core.so'], + 'paddle.fluid': ['core.so'], 'py_paddle':['*.py','_swig_paddle.so'] }, package_dir={ '': '${CMAKE_CURRENT_SOURCE_DIR}', - # The paddle.v2.fluid.proto will be generated while compiling. + # The paddle.fluid.proto will be generated while compiling. # So that package points to other directory. - 'paddle.v2.fluid.proto': '${PADDLE_BINARY_DIR}/paddle/fluid/framework', + 'paddle.fluid.proto': '${PADDLE_BINARY_DIR}/paddle/fluid/framework', 'py_paddle': '${PADDLE_SOURCE_DIR}/paddle/py_paddle' }, scripts=paddle_bins, diff --git a/tools/continuous_integration/bisect.py b/tools/continuous_integration/bisect.py new file mode 100644 index 0000000000000000000000000000000000000000..21a46e5cef096a12b3beebff2c10dc8a072aed64 --- /dev/null +++ b/tools/continuous_integration/bisect.py @@ -0,0 +1,141 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A script to bisect the mainline commits and find the culprit commit. +# The default 'git bisect' checks feature branches, which is not desired +# because commits in feature branch might not pass tests or compile. +# +# Example: +# python ../bisect.py --git_dir=$PWD/../Paddle --build_dir=$PWD \ +# --good_commit=3647ed6 --bad_commit=279aa6 \ +# --test_target=test_rnn_encoder_decoder + +import argparse +import os +import subprocess +import sys + +parser = argparse.ArgumentParser(description=__doc__) +parser.add_argument( + '--git_dir', type=str, default='', help='git repo root directory.') +parser.add_argument( + '--build_dir', type=str, default='', help='build directory.') +parser.add_argument( + '--good_commit', + type=str, + default='', + help='The old commit known to be good.') +parser.add_argument( + '--bad_commit', + type=str, + default='', + help='The new commit known to be bad.') +parser.add_argument( + '--test_target', type=str, default='', help='The test target to evaluate.') +parser.add_argument( + '--bisect_branch', + type=str, + default='develop', + help='The mainline branch to bisect (feature branch ignored.') +parser.add_argument( + '--log_file', type=str, default='', help='The file use to log outputs.') +parser.add_argument( + '--test_times', + type=int, + default=10, + help="Number of times to run the test target.") +parser.add_argument( + '--build_parallel', type=int, default=32, help="make parallelism.") +args = parser.parse_args() + +if not args.log_file: + args.log_file = '/tmp/%s...%s.log' % (args.good_commit, args.bad_commit) + + +def print_arguments(): + print('----------- Configuration Arguments -----------') + for arg, value in sorted(vars(args).iteritems()): + print('%s: %s' % (arg, value)) + print('------------------------------------------------') + + +print_arguments() + +# List the commits in mainline branch. +os.chdir(args.git_dir) +ret = subprocess.check_output( + [ + 'git rev-list --first-parent %s...%s' % (args.good_commit, + args.bad_commit) + ], + shell=True) +sys.stdout.write('commits found:\n%s\n' % ret) +commits = ret.strip().split('\n') +os.chdir(args.build_dir) +# Clean up previous logs. +subprocess.check_output(['echo "" > %s' % args.log_file], shell=True) + +last_culprit = '' +while True: + # Get to the mainline branch and clean up + os.chdir(args.git_dir) + subprocess.check_output( + [ + 'git checkout %s && git clean -fd && git checkout .' % + args.bisect_branch + ], + shell=True) + + if not commits: + sys.stdout.write('no commits to bisect\n') + exit() + # checkout the picked branch. + pick_idx = len(commits) / 2 + pick = commits[pick_idx] + os.chdir(args.git_dir) + subprocess.check_output(['git checkout %s' % pick], shell=True) + + # Clean builds and compile. + # We assume mainline commits should always compile. + os.chdir(args.build_dir) + sys.stdout.write('eval commit %d/%d: %s\n' % (pick_idx, len(commits), pick)) + # Link error can happen without complete clean up. + cmd = ('rm -rf * && ' + 'cmake -DWITH_TESTING=ON %s >> %s && make -j%s >> %s' % + (args.git_dir, args.log_file, args.build_parallel, args.log_file)) + sys.stdout.write('cmd: %s\n' % cmd) + try: + subprocess.check_output([cmd], shell=True) + except subprocess.CalledProcessError as e: + sys.stderr.write('failed to build commit: %s\n%s\n' % (pick, e)) + exit() + # test the selected branch. + passed = True + try: + cmd = ('ctest --repeat-until-fail %s -R %s >> %s' % + (args.test_times, args.test_target, args.log_file)) + sys.stdout.write('cmd: %s\n' % cmd) + subprocess.check_output([cmd], shell=True) + except subprocess.CalledProcessError as e: + passed = False + last_culprit = pick + sys.stdout.write('eval %s passed: %s\n' % (pick, passed)) + if passed: + if pick_idx == 0: break + commits = commits[:pick_idx] + else: + if pick_idx + 1 >= len(commits): break + commits = commits[pick_idx + 1:] + +sys.stdout.write('Culprit commit: %s\n' % last_culprit) diff --git a/tools/manylinux1/README.md b/tools/manylinux1/README.md index cb0a9ac22cda6fb6f585ab8fd95179573c760f28..898e00bd37c7b7bcbcb4a56476ff10c87381e47a 100644 --- a/tools/manylinux1/README.md +++ b/tools/manylinux1/README.md @@ -12,7 +12,7 @@ with newer version compilers cannot work with those with older versions. The suggested building environment is as old as CentOS 5. However, PaddlePaddle relies on CUDA, and the earlies version of [CentOS works with CUDA is 6](https://hub.docker.com/r/nvidia/cuda/). -So, here we provide a Docker image basing on CentOS 6 and CUDA for +So, here we provide a Docker image based on CentOS 6 and CUDA for building PaddlePaddle and making the release supports "as-manylinux as possible." or "sufficiently many Linux" according to [this discussion](https://mail.python.org/pipermail/wheel-builders/2016-July/000175.html). diff --git a/tools/manylinux1/build_scripts/manylinux1-check.py b/tools/manylinux1/build_scripts/manylinux1-check.py index a27eab1c77c3b8e2be02d5bd492e5c2514b6d3b1..0d1a6df4eec98c72e493517d54fae7c416727d38 100644 --- a/tools/manylinux1/build_scripts/manylinux1-check.py +++ b/tools/manylinux1/build_scripts/manylinux1-check.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tools/manylinux1/build_scripts/python-tag-abi-tag.py b/tools/manylinux1/build_scripts/python-tag-abi-tag.py index cd2573314c5b250e00584152f693a70682c17f39..0364ab3659e49dd59ff57764251408ae4359a43f 100644 --- a/tools/manylinux1/build_scripts/python-tag-abi-tag.py +++ b/tools/manylinux1/build_scripts/python-tag-abi-tag.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tools/manylinux1/build_scripts/ssl-check.py b/tools/manylinux1/build_scripts/ssl-check.py index 34a3116207f9e69d436227fce9961e099e22d34c..afef2812f3fb4e9298ec8ab2d97e790ecc455d1c 100644 --- a/tools/manylinux1/build_scripts/ssl-check.py +++ b/tools/manylinux1/build_scripts/ssl-check.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.