Skip to content

Commit 0a80f06

Browse files
authored
Merge pull request #14086 from panyx0718/fix6
delete unused codes.
2 parents aa6b2bd + bba0c4a commit 0a80f06

File tree

3 files changed

+2
-66
lines changed

3 files changed

+2
-66
lines changed

paddle/fluid/framework/ir/graph.cc

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -24,68 +24,6 @@ namespace paddle {
2424
namespace framework {
2525
namespace ir {
2626

27-
std::vector<std::string> FindDistTrainSendVars(
28-
const std::vector<ir::Node *> &nodes) {
29-
std::vector<std::string> send_vars;
30-
// since parameters are all in block 0,
31-
// it's enough to only scan send ops in block 0
32-
for (auto &node : nodes) {
33-
auto op_vars = node->Op()->InputArgumentNames();
34-
send_vars.reserve(send_vars.size() +
35-
std::distance(op_vars.begin(), op_vars.end()));
36-
send_vars.insert(send_vars.end(), op_vars.begin(), op_vars.end());
37-
}
38-
return send_vars;
39-
}
40-
41-
std::vector<std::string> FindDistTrainRecvVars(
42-
const std::vector<ir::Node *> &nodes) {
43-
std::vector<std::string> recv_vars;
44-
for (auto &node : nodes) {
45-
auto op_vars = node->Op()->OutputArgumentNames();
46-
recv_vars.reserve(recv_vars.size() +
47-
std::distance(op_vars.begin(), op_vars.end()));
48-
recv_vars.insert(recv_vars.end(), op_vars.begin(), op_vars.end());
49-
}
50-
return recv_vars;
51-
}
52-
53-
bool IsDistTrainOp(ir::Node *node, const std::vector<std::string> &send_vars,
54-
const std::vector<std::string> &recv_vars) {
55-
if (send_vars.size() == 0 || recv_vars.size() == 0) {
56-
return false;
57-
}
58-
59-
/**
60-
* Check any of opvars contains `.block` and in sendvars
61-
*/
62-
auto checker = [](const std::vector<std::string> &opvars,
63-
const std::vector<std::string> &rpc_vars) -> bool {
64-
for (auto &var : opvars) {
65-
// a variable name with the suffix `.block` means it's a splited
66-
// variable by (DistributeTranspiler)
67-
// [python/paddle/fluid/transpiler/distribute_transpiler.py]
68-
if (var.find(".block") != std::string::npos &&
69-
std::find(rpc_vars.begin(), rpc_vars.end(), var) != rpc_vars.end()) {
70-
return true;
71-
}
72-
}
73-
return false;
74-
};
75-
76-
std::vector<std::string> input_var_names;
77-
std::vector<std::string> output_var_names;
78-
for (ir::Node *input : node->inputs) {
79-
input_var_names.push_back(input->Name());
80-
}
81-
for (ir::Node *output : node->outputs) {
82-
output_var_names.push_back(output->Name());
83-
}
84-
85-
return checker(output_var_names, send_vars) ||
86-
checker(input_var_names, recv_vars);
87-
}
88-
8927
Graph::Graph(const ProgramDesc &program) : program_(program) {
9028
// Make the nodes id start from 0.
9129
Node::ResetId();

paddle/fluid/framework/ir/node.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Node {
4444
return op_desc_.get();
4545
}
4646

47+
// Please don't use this API!
4748
int id() const { return id_; }
4849

4950
bool IsOp() const { return type_ == Type::kOperation; }
@@ -92,6 +93,7 @@ class Node {
9293
Node() = delete;
9394

9495
static int count_;
96+
// Please don't use this API or make this public.
9597
static void ResetId() { count_ = 0; }
9698
DISABLE_COPY_AND_ASSIGN(Node);
9799
};

paddle/fluid/framework/op_desc.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ class OpDesc {
121121

122122
BlockDesc *Block() { return this->block_; }
123123

124-
const BlockDesc &BlockRef() const { return *this->block_; }
125-
126-
void SetBlock(BlockDesc *block) { this->block_ = block; }
127-
128124
private:
129125
template <typename MapType>
130126
static std::vector<typename MapType::key_type> MapKeys(const MapType &map) {

0 commit comments

Comments
 (0)