Skip to content

Commit c2165ff

Browse files
gongweibaoSuperjomn
authored andcommitted
Fix codesytle (#11836)
1 parent cde5693 commit c2165ff

10 files changed

+22
-13
lines changed

paddle/fluid/framework/lod_tensor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ std::ostream &operator<<(std::ostream &os, const LoDTensor &t) {
6868
// only print first ten elements
6969
int64_t size = t.numel() < 10 ? t.numel() : 10;
7070
for (int64_t i = 0; i < size; ++i) {
71-
if (t.type().hash_code() == typeid(float).hash_code()) {
71+
if (t.type().hash_code() == typeid(float).hash_code()) { // NOLINT
7272
os << t.data<float>()[i] << " ";
7373
} else if (t.type().hash_code() == typeid(int64_t).hash_code()) {
7474
os << t.data<int64_t>()[i] << " ";

paddle/fluid/inference/analysis/analyzer.cc

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

1515
#include "paddle/fluid/inference/analysis/analyzer.h"
16+
#include <string>
1617
#include "paddle/fluid/inference/analysis/data_flow_graph_to_fluid_pass.h"
1718
#include "paddle/fluid/inference/analysis/dfg_graphviz_draw_pass.h"
1819
#include "paddle/fluid/inference/analysis/fluid_to_data_flow_graph_pass.h"
@@ -79,4 +80,4 @@ void Analyzer::Run(Argument* argument) {
7980

8081
} // namespace analysis
8182
} // namespace inference
82-
} // namespace paddle
83+
} // namespace paddle

paddle/fluid/inference/analysis/analyzer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +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+
#pragma once
16+
1517
/*
1618
* This file contains Analyzer, an class that exposed as a library that analyze
1719
* and optimize

paddle/fluid/inference/analysis/data_flow_graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ struct GraphTraits<DataFlowGraph> {
138138
// sub-graph is the inputs nodes and output nodes that doesn't inside the
139139
// sub-graph.
140140
static std::pair<std::vector<Node *>, std::vector<Node *>>
141-
ExtractInputAndOutputOfSubGraph(std::vector<Node *> &graph) {
141+
ExtractInputAndOutputOfSubGraph(std::vector<Node *> &graph) { // NOLINT
142142
std::unordered_set<Node *> nodes(graph.begin(), graph.end());
143143
std::unordered_set<Node *> inputs;
144144
std::unordered_set<Node *> outputs;

paddle/fluid/inference/analysis/data_flow_graph_to_fluid_pass.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#include "paddle/fluid/inference/analysis/data_flow_graph_to_fluid_pass.h"
16+
#include <vector>
1617
#include "paddle/fluid/framework/block_desc.h"
1718
#include "paddle/fluid/framework/op_desc.h"
1819
#include "paddle/fluid/framework/proto_desc.h"
@@ -150,13 +151,14 @@ namespace {
150151
class DFG_DebuggerPass : public DFG_GraphvizDrawPass {
151152
public:
152153
using Config = DFG_GraphvizDrawPass::Config;
153-
DFG_DebuggerPass(const Config& config) : DFG_GraphvizDrawPass(config) {}
154+
explicit DFG_DebuggerPass(const Config& config)
155+
: DFG_GraphvizDrawPass(config) {}
154156

155157
std::string repr() const override { return "dfg-to-fluid-debuger-pass"; }
156158

157159
bool Finalize() override { return true; }
158160
};
159-
}
161+
} // namespace
160162

161163
Pass* DataFlowGraphToFluidPass::CreateGraphvizDebugerPass() const {
162164
return new DFG_DebuggerPass(DFG_GraphvizDrawPass::Config(

paddle/fluid/inference/analysis/data_flow_graph_to_fluid_pass.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#pragma once
2121

22+
#include <string>
2223
#include "paddle/fluid/framework/program_desc.h"
2324
#include "paddle/fluid/inference/analysis/data_flow_graph.h"
2425
#include "paddle/fluid/inference/analysis/pass.h"

paddle/fluid/inference/analysis/dfg_graphviz_draw_pass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DFG_GraphvizDrawPass : public DataFlowGraphPass {
4646
const bool display_deleted_node;
4747
};
4848

49-
DFG_GraphvizDrawPass(const Config &config) : config_(config) {}
49+
explicit DFG_GraphvizDrawPass(const Config &config) : config_(config) {}
5050

5151
bool Initialize(Argument *argument) override { return true; }
5252
void Run(DataFlowGraph *graph) override;

paddle/fluid/inference/analysis/fluid_to_data_flow_graph_pass.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License. */
1515
#include <string>
1616
#include <vector>
1717

18-
#include "analyzer.h"
18+
#include "paddle/fluid/inference/analysis/analyzer.h"
1919
#include "paddle/fluid/inference/analysis/dfg_graphviz_draw_pass.h"
2020
#include "paddle/fluid/inference/analysis/fluid_to_data_flow_graph_pass.h"
2121

@@ -88,7 +88,8 @@ namespace {
8888
class DFG_DebuggerPass : public DFG_GraphvizDrawPass {
8989
public:
9090
using Config = DFG_GraphvizDrawPass::Config;
91-
DFG_DebuggerPass(const Config &config) : DFG_GraphvizDrawPass(config) {}
91+
explicit DFG_DebuggerPass(const Config &config)
92+
: DFG_GraphvizDrawPass(config) {}
9293
std::string repr() const override { return "fluid-to-dfg-debuger-pass"; }
9394
bool Finalize() override { return true; }
9495
};

paddle/fluid/inference/analysis/pass_manager_tester.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ 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/inference/analysis/pass_manager.h"
15+
#include <gtest/gtest.h>
16+
1617
#include "paddle/fluid/inference/analysis/data_flow_graph_to_fluid_pass.h"
1718
#include "paddle/fluid/inference/analysis/dfg_graphviz_draw_pass.h"
1819
#include "paddle/fluid/inference/analysis/fluid_to_data_flow_graph_pass.h"
20+
#include "paddle/fluid/inference/analysis/pass_manager.h"
1921
#include "paddle/fluid/inference/analysis/ut_helper.h"
2022

21-
#include <gtest/gtest.h>
22-
2323
namespace paddle {
2424
namespace inference {
2525
namespace analysis {

paddle/fluid/inference/analysis/tensorrt_subgraph_node_mark_pass.cc

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

15-
#include "paddle/fluid/inference/analysis/tensorrt_subgraph_node_mark_pass.h"
15+
#include <string>
16+
1617
#include "paddle/fluid/inference/analysis/analyzer.h"
1718
#include "paddle/fluid/inference/analysis/dfg_graphviz_draw_pass.h"
1819
#include "paddle/fluid/inference/analysis/node_attr_flags.h"
20+
#include "paddle/fluid/inference/analysis/tensorrt_subgraph_node_mark_pass.h"
1921

2022
namespace paddle {
2123
namespace inference {
@@ -29,7 +31,7 @@ void TensorRTSubgraphNodeMarkPass::Run(DataFlowGraph *graph) {
2931

3032
class DfgDebuggerPass : public DFG_GraphvizDrawPass {
3133
public:
32-
DfgDebuggerPass(const DFG_GraphvizDrawPass::Config &config)
34+
explicit DfgDebuggerPass(const DFG_GraphvizDrawPass::Config &config)
3335
: DFG_GraphvizDrawPass(config) {}
3436

3537
std::string repr() const override {

0 commit comments

Comments
 (0)