!23744 Fix codedex warning

Merge pull request !23744 from LiangZhibo/codedex
This commit is contained in:
i-robot 2021-09-22 12:40:51 +00:00 committed by Gitee
commit 54b7175ea0
5 changed files with 15 additions and 15 deletions

View File

@ -197,6 +197,7 @@ class PynativeAdjoint {
FuncGraphType fg_type = kBackwardPropagate)
: tape_(tape), op_args_(op_args), out_(out), fg_(fg), fg_type_(fg_type) {}
~PynativeAdjoint() = default;
AnfNodePtrList &users() { return users_; }
const ValuePtrList &op_args() const { return op_args_; }
const ValuePtr &out() const { return out_; }

View File

@ -23,7 +23,6 @@
namespace mindspore {
namespace opt {
namespace irpass {
// {prim::kPrimGetAttr, {prim::kPrimResolve, namespace, symbol}, attr}
// {prim::kPrimGetAttr, namespace, attr}
// {prim::kPrimGetAttr, bool, attr}

View File

@ -51,7 +51,7 @@ class OrderEnforcer {
AnfNodePtrList MakeTopoSortMap() {
auto nodes = TopoSort(func_graph_->get_return());
for (size_t i = 0; i < nodes.size(); ++i) {
topo_sort_map_.emplace(nodes[i], i);
(void)topo_sort_map_.emplace(nodes[i], i);
}
return nodes;
}
@ -106,12 +106,12 @@ class OrderEnforcer {
for (auto &user : users) {
auto &user_node = user.first;
if (IsPrimitiveCNode(user_node, prim::kPrimUpdateState)) {
update_states.emplace_back(user_node);
(void)update_states.emplace_back(user_node);
continue;
}
if (IsPrimitiveCNode(user_node, prim::kPrimMakeTuple)) {
auto make_tuple_users = FindUpdateStateUsers(user_node);
update_states.insert(update_states.end(), make_tuple_users.begin(), make_tuple_users.end());
(void)update_states.insert(update_states.end(), make_tuple_users.begin(), make_tuple_users.end());
}
}
return update_states;
@ -125,7 +125,7 @@ class OrderEnforcer {
auto &input = inputs[index];
if (IsPrimitiveCNode(input, prim::kPrimLoad)) {
std::vector<AnfNodePtr> update_states = FindUpdateStateUsers(input);
all_update_states.insert(all_update_states.end(), update_states.begin(), update_states.end());
(void)all_update_states.insert(all_update_states.end(), update_states.begin(), update_states.end());
}
}
// Find the last update_state by topo sort order.
@ -210,7 +210,7 @@ class OrderEnforcer {
auto special_real_users = FindNodeUsers(load_user);
real_users.insert(special_real_users.begin(), special_real_users.end());
} else {
real_users.insert(load_user);
(void)real_users.insert(load_user);
}
}
AddInputEdges(update_state, real_users);
@ -247,7 +247,7 @@ class OrderEnforcer {
continue;
}
if (!IsDependOn(load_user, update_state)) {
processed_nodes_.insert(load_user);
(void)processed_nodes_.insert(load_user);
if (!IsInUpdateState(load_user, update_state)) {
manager_->AddEdge(update_state, load_user);
}
@ -319,7 +319,7 @@ class OrderEnforcer {
for (auto &user : iter->second) {
auto &user_node = user.first;
if (pred == nullptr || pred(user_node)) {
users.emplace(user_node);
(void)users.emplace(user_node);
}
}
return users;

View File

@ -225,7 +225,7 @@ void AnalysisContext::ClearContext() {
AnalysisContextPtr AnalysisContext::CreateContext(const AnalysisContextPtr &parent, const FuncGraphPtr &fg,
const AbstractBasePtrList &args_spec_list) {
auto context = std::make_shared<AnalysisContext>(parent, fg, args_spec_list);
all_context_.emplace_back(context);
(void)all_context_.emplace_back(context);
return context;
}
} // namespace abstract

View File

@ -237,7 +237,7 @@ const AnfNodeCounterMap &FuncGraph::value_nodes() const { return value_nodes_; }
void FuncGraph::CopyValueNodes(const FuncGraphPtr &source) {
auto &others = source->value_nodes();
for (auto it = others.begin(); it != others.end(); it++) {
for (auto it = others.begin(); it != others.end(); ++it) {
AddValueNode(it->first, it->second);
}
}
@ -270,7 +270,7 @@ const AnfNodeCounterMap &FuncGraph::free_variables() const { return free_variabl
void FuncGraph::CopyFreeVariables(const FuncGraphPtr &source) {
auto &others = source->free_variables();
for (auto it = others.begin(); it != others.end(); it++) {
for (auto it = others.begin(); it != others.end(); ++it) {
const auto &free_var = it->first;
MS_EXCEPTION_IF_NULL(free_var);
if (free_var->func_graph().get() != this) {
@ -343,7 +343,7 @@ const FuncGraphCounterMap &FuncGraph::func_graphs_used() const { return func_gra
void FuncGraph::CopyFuncGraphsUsed(const FuncGraphPtr &source) {
auto &others = source->func_graphs_used();
for (auto it = others.begin(); it != others.end(); it++) {
for (auto it = others.begin(); it != others.end(); ++it) {
(void)AddFuncGraphUsed(it->first, it->second);
}
func_graphs_used_.erase(source);
@ -388,7 +388,7 @@ const CNodeIndexCounterMap &FuncGraph::func_graph_cnodes_index() const { return
void FuncGraph::CopyFuncGraphCNodesIndex(const FuncGraphPtr &source) {
auto &others = source->func_graph_cnodes_index();
for (auto it = others.begin(); it != others.end(); it++) {
for (auto it = others.begin(); it != others.end(); ++it) {
// Ignore the user graph who may own itself.
auto fg = it->first->first->func_graph();
MS_EXCEPTION_IF_NULL(fg);
@ -743,9 +743,9 @@ bool FuncGraph::ContainMultiTarget() const {
}
void FuncGraph::set_used_forward_nodes(const std::vector<AnfNodePtr> &used_forward_nodes) {
std::for_each(used_forward_nodes.begin(), used_forward_nodes.end(), [this](const AnfNodePtr &node) {
(void)std::for_each(used_forward_nodes.begin(), used_forward_nodes.end(), [this](const AnfNodePtr &node) {
MS_EXCEPTION_IF_NULL(node);
used_forward_nodes_.emplace(node);
(void)used_forward_nodes_.emplace(node);
});
}