forked from mindspore-Ecosystem/mindspore
!39633 fix code check
Merge pull request !39633 from lianliguang/master
This commit is contained in:
commit
8092d3713d
|
@ -784,8 +784,8 @@ void GetControlOpInput(const std::shared_ptr<GraphCompiler> &graph_compiler, con
|
||||||
++back_index;
|
++back_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (args_tuple_num) {
|
if (args_tuple_num != 0) {
|
||||||
args_tuple.emplace_back(value);
|
(void)args_tuple.emplace_back(value);
|
||||||
if (args_tuple.size() == args_tuple_num) {
|
if (args_tuple.size() == args_tuple_num) {
|
||||||
value = std::make_shared<ValueTuple>(args_tuple);
|
value = std::make_shared<ValueTuple>(args_tuple);
|
||||||
args_tuple_num = 0;
|
args_tuple_num = 0;
|
||||||
|
|
|
@ -198,12 +198,12 @@ static AnfNodePtr SkipHookNodeInBackProp(const AnfNodePtr &node) {
|
||||||
// Replace hook node with make tuple node.
|
// Replace hook node with make tuple node.
|
||||||
abstract::AbstractBasePtrList multi_output_abs;
|
abstract::AbstractBasePtrList multi_output_abs;
|
||||||
std::vector<AnfNodePtr> multi_output_nodes{NewValueNode(prim::kPrimMakeTuple)};
|
std::vector<AnfNodePtr> multi_output_nodes{NewValueNode(prim::kPrimMakeTuple)};
|
||||||
std::for_each(output_cnode->inputs().cbegin() + 1, output_cnode->inputs().cend(),
|
(void)std::for_each(output_cnode->inputs().cbegin() + 1, output_cnode->inputs().cend(),
|
||||||
[&multi_output_nodes, &multi_output_abs](const AnfNodePtr &inp) {
|
[&multi_output_nodes, &multi_output_abs](const AnfNodePtr &inp) {
|
||||||
MS_EXCEPTION_IF_NULL(inp);
|
MS_EXCEPTION_IF_NULL(inp);
|
||||||
(void)multi_output_nodes.emplace_back(inp);
|
(void)multi_output_nodes.emplace_back(inp);
|
||||||
(void)multi_output_abs.emplace_back(inp->abstract());
|
(void)multi_output_abs.emplace_back(inp->abstract());
|
||||||
});
|
});
|
||||||
auto primal_graph = node->func_graph();
|
auto primal_graph = node->func_graph();
|
||||||
MS_EXCEPTION_IF_NULL(primal_graph);
|
MS_EXCEPTION_IF_NULL(primal_graph);
|
||||||
auto make_tuple = primal_graph->NewCNode(std::move(multi_output_nodes));
|
auto make_tuple = primal_graph->NewCNode(std::move(multi_output_nodes));
|
||||||
|
|
|
@ -355,7 +355,7 @@ bool AutoMonadEliminator::ReplaceAutoMonadNode(const FuncGraphManagerPtr &manage
|
||||||
auto &group = load_group.second;
|
auto &group = load_group.second;
|
||||||
const auto ¶m_user_indexes = param_users[ref_key];
|
const auto ¶m_user_indexes = param_users[ref_key];
|
||||||
auto groups = SplitGroup(group, param_user_indexes, special_op_indexes);
|
auto groups = SplitGroup(group, param_user_indexes, special_op_indexes);
|
||||||
need_merge_loads.insert(need_merge_loads.cend(), groups.cbegin(), groups.cend());
|
(void)need_merge_loads.insert(need_merge_loads.cend(), groups.cbegin(), groups.cend());
|
||||||
}
|
}
|
||||||
for (auto &group : need_merge_loads) {
|
for (auto &group : need_merge_loads) {
|
||||||
bool replaced = ReplaceSameGroupLoad(manager, fg, toposet, group);
|
bool replaced = ReplaceSameGroupLoad(manager, fg, toposet, group);
|
||||||
|
|
|
@ -345,7 +345,7 @@ class SimplifyDataStructuresRewriter : public BaseRewriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// dict(k0:v0, k1:v1, ...) --> tuple(v0, v1, ...)
|
// dict(k0:v0, k1:v1, ...) --> tuple(v0, v1, ...)
|
||||||
ValueTuplePtr DictToTuple(const ValueDictionaryPtr &dict) {
|
ValueTuplePtr DictToTuple(const ValueDictionaryPtr &dict) const {
|
||||||
const auto &elements = dict->value();
|
const auto &elements = dict->value();
|
||||||
std::vector<ValuePtr> values;
|
std::vector<ValuePtr> values;
|
||||||
values.reserve(elements.size());
|
values.reserve(elements.size());
|
||||||
|
|
|
@ -56,7 +56,7 @@ std::vector<AnfNodePtr> TransformTupleArgument(const FuncGraphPtr &fg, const Anf
|
||||||
elem_node->set_abstract(elements[i]);
|
elem_node->set_abstract(elements[i]);
|
||||||
if (elements[i]->isa<abstract::AbstractTuple>()) {
|
if (elements[i]->isa<abstract::AbstractTuple>()) {
|
||||||
auto nodes = TransformTupleArgument(fg, elem_node, elements[i]->cast<abstract::AbstractTuplePtr>());
|
auto nodes = TransformTupleArgument(fg, elem_node, elements[i]->cast<abstract::AbstractTuplePtr>());
|
||||||
tuple_node_expanded.insert(tuple_node_expanded.cend(), nodes.cbegin(), nodes.cend());
|
(void)tuple_node_expanded.insert(tuple_node_expanded.cend(), nodes.cbegin(), nodes.cend());
|
||||||
} else {
|
} else {
|
||||||
tuple_node_expanded.push_back(elem_node);
|
tuple_node_expanded.push_back(elem_node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,7 +340,7 @@ class IncorporateEnvironGet : public AnfVisitor {
|
||||||
~IncorporateEnvironGet() override = default;
|
~IncorporateEnvironGet() override = default;
|
||||||
|
|
||||||
AnfNodePtr operator()(const OptimizerPtr &, const AnfNodePtr &node) override {
|
AnfNodePtr operator()(const OptimizerPtr &, const AnfNodePtr &node) override {
|
||||||
static bool enable_closure = common::GetEnv("MS_DEV_ENABLE_CLOSURE") != "0";
|
static const bool enable_closure = common::GetEnv("MS_DEV_ENABLE_CLOSURE") != "0";
|
||||||
if (enable_closure) {
|
if (enable_closure) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -556,7 +556,7 @@ void SparseSoftmaxCrossEntropyWithLogitsSplit::Visit(const AnfNodePtr &node) {
|
||||||
is_match_ = true;
|
is_match_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnfNodePtr SparseSoftmaxCrossEntropyWithLogitsSplit::operator()(const OptimizerPtr &opt, const AnfNodePtr &node) {
|
AnfNodePtr SparseSoftmaxCrossEntropyWithLogitsSplit::operator()(const OptimizerPtr &, const AnfNodePtr &node) {
|
||||||
MS_LOG(INFO) << "SparseSoftmaxCrossEntropyWithLogits split start.";
|
MS_LOG(INFO) << "SparseSoftmaxCrossEntropyWithLogits split start.";
|
||||||
auto IsSparseSoftmaxNode = [](const AnfNodePtr &node) -> bool {
|
auto IsSparseSoftmaxNode = [](const AnfNodePtr &node) -> bool {
|
||||||
return IsPrimitiveCNode(node, prim::kPrimSparseSoftmaxCrossEntropyWithLogits) &&
|
return IsPrimitiveCNode(node, prim::kPrimSparseSoftmaxCrossEntropyWithLogits) &&
|
||||||
|
|
|
@ -196,7 +196,7 @@ int GetAxisSizeByAbs(const AbstractBasePtr &abs, ValuePtr *const in_axes) {
|
||||||
}
|
}
|
||||||
axis = axis < 0 ? shape_len + axis : axis;
|
axis = axis < 0 ? shape_len + axis : axis;
|
||||||
*in_axes = std::make_shared<Int64Imm>(axis);
|
*in_axes = std::make_shared<Int64Imm>(axis);
|
||||||
axis_size = orig_shape[LongToSize(axis)];
|
axis_size = LongToInt(orig_shape[LongToSize(axis)]);
|
||||||
return axis_size;
|
return axis_size;
|
||||||
}
|
}
|
||||||
return axis_size;
|
return axis_size;
|
||||||
|
|
|
@ -251,7 +251,7 @@ class Optimizer : public std::enable_shared_from_this<Optimizer> {
|
||||||
void set_is_first_order_j(bool is_first_order_j) { is_first_order_j_ = is_first_order_j; }
|
void set_is_first_order_j(bool is_first_order_j) { is_first_order_j_ = is_first_order_j; }
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int64_t counter;
|
int64_t counter = 0;
|
||||||
std::string name;
|
std::string name;
|
||||||
} CurPass_;
|
} CurPass_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue