Skip to content

Commit 9ca578d

Browse files
abhinavaroraYang Yang(Tony)
authored andcommitted
Fix CPPLint issues in expand_op, gather_op and get_places_op (#10000)
1 parent 98c12b1 commit 9ca578d

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

paddle/fluid/operators/expand_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#include "paddle/fluid/operators/expand_op.h"
16+
#include <vector>
1617

1718
#include <vector>
1819

paddle/fluid/operators/expand_op.h

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

1515
#pragma once
1616

17+
#include <vector>
18+
1719
#include <boost/preprocessor/arithmetic/div.hpp>
1820
#include <boost/preprocessor/arithmetic/mod.hpp>
1921
#include <boost/preprocessor/comparison/greater.hpp>
2022
#include <boost/preprocessor/comparison/greater_equal.hpp>
2123
#include <boost/preprocessor/control/if.hpp>
2224
#include <boost/preprocessor/repetition/repeat.hpp>
23-
#include <iostream>
2425
#include "paddle/fluid/framework/eigen.h"
2526
#include "paddle/fluid/framework/op_registry.h"
2627
#include "paddle/fluid/framework/operator.h"

paddle/fluid/operators/gather_op.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ 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 "gather.cu.h"
1615
#include "paddle/fluid/framework/eigen.h"
16+
#include "paddle/fluid/operators/gather.cu.h"
1717
#include "paddle/fluid/operators/gather_op.h"
18-
#include "scatter.cu.h"
18+
#include "paddle/fluid/operators/scatter.cu.h"
1919

2020
namespace paddle {
2121
namespace operators {

paddle/fluid/operators/gather_op.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#pragma once
16-
#include "gather.h"
1716
#include "paddle/fluid/framework/eigen.h"
1817
#include "paddle/fluid/framework/op_registry.h"
19-
#include "scatter.h"
18+
#include "paddle/fluid/operators/gather.h"
19+
#include "paddle/fluid/operators/scatter.h"
2020

2121
namespace paddle {
2222
namespace operators {

paddle/fluid/operators/gather_test.cc

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,37 @@ 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 "paddle/fluid/operators/gather.h"
16-
#include "paddle/fluid/framework/ddim.h"
17-
#include "paddle/fluid/framework/tensor.h"
18-
#include "paddle/fluid/platform/place.h"
19-
2015
#include <gtest/gtest.h>
2116
#include <iostream>
2217
#include <string>
2318

24-
TEST(Gather, GatherData) {
25-
using namespace paddle::framework;
26-
using namespace paddle::platform;
27-
using namespace paddle::operators;
19+
#include "paddle/fluid/framework/ddim.h"
20+
#include "paddle/fluid/framework/tensor.h"
21+
#include "paddle/fluid/operators/gather.h"
22+
#include "paddle/fluid/platform/place.h"
2823

29-
Tensor* src = new Tensor();
30-
Tensor* index = new Tensor();
31-
Tensor* output = new Tensor();
24+
TEST(Gather, GatherData) {
25+
paddle::framework::Tensor* src = new paddle::framework::Tensor();
26+
paddle::framework::Tensor* index = new paddle::framework::Tensor();
27+
paddle::framework::Tensor* output = new paddle::framework::Tensor();
3228

3329
int* p_src = nullptr;
3430
int* p_index = nullptr;
35-
p_src = src->mutable_data<int>(make_ddim({3, 4}), CPUPlace());
36-
p_index = index->mutable_data<int>(make_ddim({2}), CPUPlace());
31+
p_src = src->mutable_data<int>(paddle::framework::make_ddim({3, 4}),
32+
paddle::platform::CPUPlace());
33+
p_index = index->mutable_data<int>(paddle::framework::make_ddim({2}),
34+
paddle::platform::CPUPlace());
3735

3836
for (int i = 0; i < 12; ++i) p_src[i] = i;
3937
p_index[0] = 1;
4038
p_index[1] = 0;
4139

42-
int* p_output = output->mutable_data<int>(make_ddim({2, 4}), CPUPlace());
40+
int* p_output = output->mutable_data<int>(
41+
paddle::framework::make_ddim({2, 4}), paddle::platform::CPUPlace());
4342

4443
auto* cpu_place = new paddle::platform::CPUPlace();
4544
paddle::platform::CPUDeviceContext ctx(*cpu_place);
46-
CPUGather<int>(ctx, *src, *index, output);
45+
paddle::operators::CPUGather<int>(ctx, *src, *index, output);
4746

4847
for (int i = 0; i < 4; ++i) EXPECT_EQ(p_output[i], i + 4);
4948
for (int i = 4; i < 8; ++i) EXPECT_EQ(p_output[i], i - 4);

paddle/fluid/operators/get_places_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ 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 <thread>
15+
#include <thread> // NOLINT
1616
#include "paddle/fluid/framework/op_registry.h"
1717
#include "paddle/fluid/operators/detail/safe_ref.h"
1818
#include "paddle/fluid/platform/place.h"

0 commit comments

Comments
 (0)