Skip to content

Commit f27fd9d

Browse files
committed
follow comments
1 parent 8cde2d1 commit f27fd9d

Some content is hidden

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

46 files changed

+222
-251
lines changed

cmake/cblas.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ if(MKL_INC_DIR AND MKL_CORE_LIB AND MKL_SEQUENTIAL_LIB AND MKL_INTEL_LP64)
4444
message(STATUS "Found MKL (include: ${CBLAS_INC_DIR}, library: ${CBLAS_LIBRARIES})")
4545
set(CBLAS_FOUND ON)
4646
if(${MKL_LAPACK_INC_DIR})
47-
add_definitions(-DPADDLE_USE_LAPACK)
4847
message(STATUS "Found lapack in MKL (include: ${MKL_LAPACK_INC_DIR})")
4948
endif()
5049
return() # return file.
@@ -80,7 +79,6 @@ if(ATLAS_INC_DIR AND ATLAS_CBLAS_LIB AND ATLAS_LIB AND NOT CBLAS_FOUND)
8079
message(STATUS "Found ATLAS (include: ${CBLAS_INC_DIR}, library: ${CBLAS_LIBRARIES})")
8180
set(CBLAS_FOUND ON)
8281
if(ATLAS_CLAPACK_INC_DIR)
83-
add_definitions(-DPADDLE_USE_LAPACK)
8482
message(STATUS "Found lapack in ATLAS (include: ${ATLAS_CLAPACK_INC_DIR})")
8583
endif()
8684
return()
@@ -114,7 +112,6 @@ if(OPENBLAS_INC_DIR AND OPENBLAS_LIB)
114112
message(STATUS "Found OpenBLAS (include: ${CBLAS_INC_DIR}, library: ${CBLAS_LIBRARIES})")
115113
set(CBLAS_FOUND ON)
116114
if(OPENBLAS_LAPACKE_INC_DIR)
117-
add_definitions(-DPADDLE_USE_LAPACK)
118115
message(STATUS "Found lapack in OpenBLAS (include: ${OPENBLAS_LAPACKE_INC_DIR})")
119116
endif()
120117
return()

cmake/external/openblas.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ IF(NOT ${CBLAS_FOUND})
2727
SET(CBLAS_LIBRARIES "${CBLAS_INSTALL_DIR}/lib/libopenblas.a" CACHE FILEPATH "openblas library" FORCE)
2828
ENDIF(WIN32)
2929

30-
ADD_DEFINITIONS(-DPADDLE_USE_LAPACK)
31-
3230
ExternalProject_Add(
3331
openblas
3432
${EXTERNAL_PROJECT_LOG_ARGS}

paddle/cuda/include/hl_activation_functions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ class Active {
4040
namespace gpu {
4141
static __device__ Active<real>::forward forward[] = HPPL_ACTIVE_FUNCTION;
4242
static __device__ Active<real>::backward backward[] = HPPL_ACTIVE_FUNCTION;
43-
}
43+
} // namespace gpu
4444
#else
4545
namespace cpu {
4646
static Active<real>::forward forward[] = HPPL_ACTIVE_FUNCTION;
4747
static Active<real>::backward backward[] = HPPL_ACTIVE_FUNCTION;
48-
}
48+
} // namespace cpu
4949

5050
#ifdef __AVX__
5151
namespace avx {
5252
static Active<__m256>::forward forward[] = HPPL_ACTIVE_FUNCTION;
5353
static Active<__m256>::backward backward[] = HPPL_ACTIVE_FUNCTION;
54-
}
54+
} // namespace avx
5555
#endif
5656
#endif
5757

paddle/cuda/include/hl_cnn.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -273,23 +273,23 @@ extern void hl_bilinear_forward(const real* inData,
273273
const real ratioW);
274274

275275
/**
276-
* @brief Bilinear interpolation backward.
277-
*
278-
* @param[out] inGrad input gradient.
279-
* @param[in] inImgH input image height.
280-
* @param[in] inImgW input image width.
281-
* @param[in] inputH input batchSize.
282-
* @param[in] inputW input image data dim.
283-
* @param[in] outGrad output gradient.
284-
* @param[in] outImgH output image height.
285-
* @param[in] outImgW output image width.
286-
* @param[in] outputH output batchSize.
287-
* @param[in] outputW output image data dim.
288-
* @param[in] numChannels number of channels.
289-
* @param[in] ratioH inImgH / outImgH.
290-
* @param[in] ratioW inImgW / outImgW.
291-
*
292-
*/
276+
* @brief Bilinear interpolation backward.
277+
*
278+
* @param[out] inGrad input gradient.
279+
* @param[in] inImgH input image height.
280+
* @param[in] inImgW input image width.
281+
* @param[in] inputH input batchSize.
282+
* @param[in] inputW input image data dim.
283+
* @param[in] outGrad output gradient.
284+
* @param[in] outImgH output image height.
285+
* @param[in] outImgW output image width.
286+
* @param[in] outputH output batchSize.
287+
* @param[in] outputW output image data dim.
288+
* @param[in] numChannels number of channels.
289+
* @param[in] ratioH inImgH / outImgH.
290+
* @param[in] ratioW inImgW / outImgW.
291+
*
292+
*/
293293
extern void hl_bilinear_backward(real* inGrad,
294294
const size_t inImgH,
295295
const size_t inImgW,

paddle/cuda/src/hl_cuda_cublas.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License. */
1616
#include <sys/time.h>
1717
#include "hl_cuda.h"
1818
#include "hl_thread.ph"
19-
#include "paddle/utils/DynamicLoad.h"
19+
#include "paddle/utils/DynamicLoader.h"
2020
#include "paddle/utils/Logging.h"
2121

2222
namespace dynload {

paddle/cuda/src/hl_cuda_cudnn.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License. */
1717
#include <gflags/gflags.h>
1818
#include "hl_cuda_cudnn.ph"
1919
#include "hl_thread.ph"
20-
#include "paddle/utils/DynamicLoad.h"
20+
#include "paddle/utils/DynamicLoader.h"
2121
#include "paddle/utils/Logging.h"
2222

2323
DEFINE_int32(cudnn_conv_workspace_limit_in_mb,

paddle/cuda/src/hl_cuda_device.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ limitations under the License. */
2424
#include "hl_cuda.ph"
2525
#include "hl_thread.ph"
2626
#include "paddle/utils/Logging.h"
27-
#include "paddle/utils/DynamicLoad.h"
27+
#include "paddle/utils/DynamicLoader.h"
2828
// clang-format on
2929

3030
namespace dynload {

paddle/cuda/src/hl_warpctc_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ limitations under the License. */
1414

1515
#include "hl_warpctc_wrap.h"
1616
#include <mutex>
17-
#include "paddle/utils/DynamicLoad.h"
17+
#include "paddle/utils/DynamicLoader.h"
1818
#include "paddle/utils/Logging.h"
1919

2020
namespace dynload {

paddle/function/BufferArgTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

15-
#include "BufferArg.h"
1615
#include <gtest/gtest.h>
16+
#include "BufferArg.h"
1717
#include "paddle/math/MemoryHandle.h"
1818

1919
namespace paddle {

paddle/function/CosSimOp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ void CosSimBackward<DEVICE_TYPE_CPU>(const CpuMatrix& out_grad,
165165
real reciprocal_square_sum_x = 1.0f / square_sum_x;
166166
real reciprocal_square_sum_y = 1.0f / square_sum_y;
167167
for (size_t j = 0; j < dim; ++j) {
168-
prev_grad_x[j] +=
169-
out[i] * grad[i] * (prev_out_y[j] * reciprocal_xy -
170-
prev_out_x[j] * reciprocal_square_sum_x);
171-
prev_grad_y[j] +=
172-
out[i] * grad[i] * (prev_out_x[j] * reciprocal_xy -
173-
prev_out_y[j] * reciprocal_square_sum_y);
168+
prev_grad_x[j] += out[i] * grad[i] *
169+
(prev_out_y[j] * reciprocal_xy -
170+
prev_out_x[j] * reciprocal_square_sum_x);
171+
prev_grad_y[j] += out[i] * grad[i] *
172+
(prev_out_x[j] * reciprocal_xy -
173+
prev_out_y[j] * reciprocal_square_sum_y);
174174
}
175175
}
176176
}

0 commit comments

Comments
 (0)