Browse Source

fix static warnings for some graph_kernel files

pull/15924/head
zengzitao 4 years ago
parent
commit
4b6fc40c25
4 changed files with 8 additions and 7 deletions
  1. +5
    -4
      mindspore/ccsrc/backend/optimizer/graph_kernel/eliminate_redundant_output.cc
  2. +1
    -1
      mindspore/ccsrc/backend/optimizer/graph_kernel/eliminate_redundant_output.h
  3. +1
    -1
      mindspore/ccsrc/backend/optimizer/graph_kernel/update_state_formatter.cc
  4. +1
    -1
      mindspore/ccsrc/backend/optimizer/graph_kernel/value_graph_binder.h

+ 5
- 4
mindspore/ccsrc/backend/optimizer/graph_kernel/eliminate_redundant_output.cc View File

@@ -123,7 +123,7 @@ bool IsSideEffectNode(const AnfNodePtr &node) {
*/
class UnifyRepeatedOutput : public Pass {
public:
bool Run(const FuncGraphPtr &func_graph) {
bool Run(const FuncGraphPtr &func_graph) override {
auto mng = func_graph->manager();
MS_EXCEPTION_IF_NULL(mng);
auto todos = FindGraphKernelsWithMultiOutput(func_graph);
@@ -156,7 +156,8 @@ class UnifyRepeatedOutput : public Pass {
index_map_.resize(outputs.size());
bool found = false;
for (size_t i = 0; i < outputs.size(); ++i) {
index_map_[i] = std::find(outputs.begin(), outputs.begin() + i, outputs[i]) - outputs.begin();
index_map_[i] =
static_cast<size_t>(std::find(outputs.begin(), outputs.begin() + i, outputs[i]) - outputs.begin());
if (index_map_[i] != i) {
found = true;
}
@@ -184,7 +185,7 @@ class UnifyRepeatedOutput : public Pass {
*/
class UnifyRepeatedGetitem : public Pass {
public:
bool Run(const FuncGraphPtr &func_graph) {
bool Run(const FuncGraphPtr &func_graph) override {
auto mng = func_graph->manager();
MS_EXCEPTION_IF_NULL(mng);
auto todos = FindGraphKernelsWithMultiOutput(func_graph);
@@ -211,7 +212,7 @@ bool EliminateRedundantOutput::Run(const FuncGraphPtr &func_graph) {
return changed;
}

void EliminateHangingOutput::UpdateGetitemIndex(const AnfNodePtr &getitem, size_t offset) {
void EliminateHangingOutput::UpdateGetitemIndex(const AnfNodePtr &getitem, size_t offset) const {
if (offset == 0) return;
MS_EXCEPTION_IF_NULL(getitem);
auto index = GetIndex(getitem);


+ 1
- 1
mindspore/ccsrc/backend/optimizer/graph_kernel/eliminate_redundant_output.h View File

@@ -41,7 +41,7 @@ class EliminateHangingOutput : public Pass {

private:
// update the GetItem(node, i) to GetItem(node, i - offset)
void UpdateGetitemIndex(const AnfNodePtr &getitem, size_t offset);
void UpdateGetitemIndex(const AnfNodePtr &getitem, size_t offset) const;
AnfNodePtr ReplaceMakeTuple(const AnfNodePtr &node, const AnfNodePtrList &getitems);
};



+ 1
- 1
mindspore/ccsrc/backend/optimizer/graph_kernel/update_state_formatter.cc View File

@@ -220,7 +220,7 @@ bool ExtendOutputForUpdateState::ProcessIndex(const FuncGraphPtr &func_graph, co
MS_EXCEPTION_IF_NULL(mng);
for (auto user : mng->node_users()[getitems_[index]]) {
if (IsPrimitiveCNode(user.first, prim::kPrimUpdateState)) {
user.first->cast<CNodePtr>()->set_input(user.second, new_node);
user.first->cast<CNodePtr>()->set_input(static_cast<size_t>(user.second), new_node);
}
}
return true;


+ 1
- 1
mindspore/ccsrc/backend/optimizer/graph_kernel/value_graph_binder.h View File

@@ -25,7 +25,7 @@ class BindValueToGraph : public Pass {
public:
BindValueToGraph() : Pass("bind_value_to_graph") {}
~BindValueToGraph() override = default;
bool Run(const FuncGraphPtr &func_graph);
bool Run(const FuncGraphPtr &func_graph) override;
};
using BindValueToGraphPtr = std::shared_ptr<BindValueToGraph>;
} // namespace opt


Loading…
Cancel
Save