diff --git a/mindspore/ccsrc/pipeline/static_analysis/prim.cc b/mindspore/ccsrc/pipeline/static_analysis/prim.cc index 04771dde79c40883f2ad86b6a2f6680ba46b03e2..4cd52f7f478d96b5ffb97911ef3fbb6f6efc41fb 100644 --- a/mindspore/ccsrc/pipeline/static_analysis/prim.cc +++ b/mindspore/ccsrc/pipeline/static_analysis/prim.cc @@ -275,14 +275,15 @@ AnfNodePtr MixedPrecisionCastHelper(AnfNodePtr source_node, AbstractBasePtr node } else if (node_type->isa()) { auto x = node_type->cast(); auto &items = x->elements(); - std::size_t size = items.size(); std::vector nodes; nodes.emplace_back(NewValueNode(prim::kPrimMakeTuple)); - for (int i = 0; i < SizeToInt(size); i++) { + int idx = 0; + for (const auto &item : items) { AnfNodePtr tuple_node = - func_graph->NewCNode({NewValueNode(prim::kPrimTupleGetItem), source_node, NewValueNode(i)}); - AnfNodePtr node = MixedPrecisionCastHelper(tuple_node, items[i], target_type, func_graph); + func_graph->NewCNode({NewValueNode(prim::kPrimTupleGetItem), source_node, NewValueNode(idx)}); + AnfNodePtr node = MixedPrecisionCastHelper(tuple_node, item, target_type, func_graph); nodes.emplace_back(node); + ++idx; } target_node = func_graph->NewCNode(nodes); } diff --git a/mindspore/ccsrc/utils/union_find_set.h b/mindspore/ccsrc/utils/union_find_set.h index 1c98c73b9c539af7a18038c62b43982e46125d60..81529c8bcf185e55d323366a49958c878d2acbf4 100644 --- a/mindspore/ccsrc/utils/union_find_set.h +++ b/mindspore/ccsrc/utils/union_find_set.h @@ -27,6 +27,7 @@ template class UnionFindSet { public: UnionFindSet() : union_find_set_() {} + ~UnionFindSet() = default; void Add(const T &elem) { if (union_find_set_.find(elem) != union_find_set_.end()) { return;