From 89758adb83cea198ee6d2d31bc8e1d9bad5e827e Mon Sep 17 00:00:00 2001 From: qijun Date: Sat, 14 Oct 2017 16:21:26 -0700 Subject: [PATCH] fix code style --- paddle/framework/lod_tensor.h | 3 +++ paddle/framework/selected_rows_test.cc | 2 +- paddle/framework/type_defs.h | 3 +++ paddle/operators/math/math_function.cu | 16 +++++++--------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/paddle/framework/lod_tensor.h b/paddle/framework/lod_tensor.h index ee040a9144e..4db36ee7660 100644 --- a/paddle/framework/lod_tensor.h +++ b/paddle/framework/lod_tensor.h @@ -1,8 +1,11 @@ /* 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. diff --git a/paddle/framework/selected_rows_test.cc b/paddle/framework/selected_rows_test.cc index 055b8676006..4ee13a65d72 100644 --- a/paddle/framework/selected_rows_test.cc +++ b/paddle/framework/selected_rows_test.cc @@ -18,7 +18,7 @@ namespace framework { class SelectedRowsTester : public ::testing::Test { public: virtual void SetUp() override { - Vector rows{0, 4, 7}; + std::vector rows{0, 4, 7}; int64_t height = 10; int64_t row_numel = 100; selected_rows_.reset(new SelectedRows(rows, height)); diff --git a/paddle/framework/type_defs.h b/paddle/framework/type_defs.h index 0c0a72de31a..0d1564a7510 100644 --- a/paddle/framework/type_defs.h +++ b/paddle/framework/type_defs.h @@ -1,8 +1,11 @@ /* 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. diff --git a/paddle/operators/math/math_function.cu b/paddle/operators/math/math_function.cu index d31b223b2c8..fc16d1b0a7a 100644 --- a/paddle/operators/math/math_function.cu +++ b/paddle/operators/math/math_function.cu @@ -214,10 +214,8 @@ template struct SelectedRowsAdd; namespace { template __global__ void SelectedRowsAddTensorKernel(const T* selected_rows, - const int64_t* rows, - T* tensor_out, - int64_t row_numel, - int block_size) { + const int64_t* rows, T* tensor_out, + int64_t row_numel, int block_size) { const int ty = blockIdx.y; int tid = threadIdx.x; @@ -261,11 +259,11 @@ struct SelectedRowsAddTensor { int block_size = 256; dim3 threads(block_size, 1); dim3 grid(1, in1_height); - SelectedRowsAddTensorKernel<<< - grid, threads, 0, - reinterpret_cast(context).stream() - >>>(in1_data, in1_rows.data(), - out_data, in1_row_numel, block_size); + SelectedRowsAddTensorKernel< + T><<(context) + .stream()>>>(in1_data, in1_rows.data(), out_data, + in1_row_numel, block_size); auto out_eigen = framework::EigenVector::Flatten(*output); auto in2_eigen = framework::EigenVector::Flatten(input2); -- GitLab