!39633 fix code check

Merge pull request !39633 from lianliguang/master
This commit is contained in:
i-robot 2022-08-08 07:19:17 +00:00 committed by Gitee
commit 8092d3713d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 15 additions and 15 deletions

View File

@ -784,8 +784,8 @@ void GetControlOpInput(const std::shared_ptr<GraphCompiler> &graph_compiler, con
++back_index;
}
}
if (args_tuple_num) {
args_tuple.emplace_back(value);
if (args_tuple_num != 0) {
(void)args_tuple.emplace_back(value);
if (args_tuple.size() == args_tuple_num) {
value = std::make_shared<ValueTuple>(args_tuple);
args_tuple_num = 0;

View File

@ -198,12 +198,12 @@ static AnfNodePtr SkipHookNodeInBackProp(const AnfNodePtr &node) {
// Replace hook node with make tuple node.
abstract::AbstractBasePtrList multi_output_abs;
std::vector<AnfNodePtr> multi_output_nodes{NewValueNode(prim::kPrimMakeTuple)};
std::for_each(output_cnode->inputs().cbegin() + 1, output_cnode->inputs().cend(),
[&multi_output_nodes, &multi_output_abs](const AnfNodePtr &inp) {
MS_EXCEPTION_IF_NULL(inp);
(void)multi_output_nodes.emplace_back(inp);
(void)multi_output_abs.emplace_back(inp->abstract());
});
(void)std::for_each(output_cnode->inputs().cbegin() + 1, output_cnode->inputs().cend(),
[&multi_output_nodes, &multi_output_abs](const AnfNodePtr &inp) {
MS_EXCEPTION_IF_NULL(inp);
(void)multi_output_nodes.emplace_back(inp);
(void)multi_output_abs.emplace_back(inp->abstract());
});
auto primal_graph = node->func_graph();
MS_EXCEPTION_IF_NULL(primal_graph);
auto make_tuple = primal_graph->NewCNode(std::move(multi_output_nodes));

View File

@ -355,7 +355,7 @@ bool AutoMonadEliminator::ReplaceAutoMonadNode(const FuncGraphManagerPtr &manage
auto &group = load_group.second;
const auto &param_user_indexes = param_users[ref_key];
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) {
bool replaced = ReplaceSameGroupLoad(manager, fg, toposet, group);

View File

@ -345,7 +345,7 @@ class SimplifyDataStructuresRewriter : public BaseRewriter {
}
// dict(k0:v0, k1:v1, ...) --> tuple(v0, v1, ...)
ValueTuplePtr DictToTuple(const ValueDictionaryPtr &dict) {
ValueTuplePtr DictToTuple(const ValueDictionaryPtr &dict) const {
const auto &elements = dict->value();
std::vector<ValuePtr> values;
values.reserve(elements.size());

View File

@ -56,7 +56,7 @@ std::vector<AnfNodePtr> TransformTupleArgument(const FuncGraphPtr &fg, const Anf
elem_node->set_abstract(elements[i]);
if (elements[i]->isa<abstract::AbstractTuple>()) {
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 {
tuple_node_expanded.push_back(elem_node);
}

View File

@ -340,7 +340,7 @@ class IncorporateEnvironGet : public AnfVisitor {
~IncorporateEnvironGet() override = default;
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) {
return nullptr;
}

View File

@ -556,7 +556,7 @@ void SparseSoftmaxCrossEntropyWithLogitsSplit::Visit(const AnfNodePtr &node) {
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.";
auto IsSparseSoftmaxNode = [](const AnfNodePtr &node) -> bool {
return IsPrimitiveCNode(node, prim::kPrimSparseSoftmaxCrossEntropyWithLogits) &&

View File

@ -196,7 +196,7 @@ int GetAxisSizeByAbs(const AbstractBasePtr &abs, ValuePtr *const in_axes) {
}
axis = axis < 0 ? shape_len + axis : 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;

View File

@ -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; }
struct {
int64_t counter;
int64_t counter = 0;
std::string name;
} CurPass_;