From d1651800bfce301470c5bf4b4654ceaa79d97fa8 Mon Sep 17 00:00:00 2001 From: l00591931 Date: Thu, 20 May 2021 16:11:19 +0800 Subject: [PATCH] Fix codecheck for master --- mindspore/_extends/parse/standard_method.py | 3 ++- mindspore/ccsrc/debug/anf_ir_dump.cc | 2 +- mindspore/ccsrc/pipeline/jit/pipeline_ge.cc | 2 +- mindspore/common/_decorator.py | 1 + mindspore/core/abstract/prim_structures.cc | 2 +- mindspore/ops/operations/array_ops.py | 1 - 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mindspore/_extends/parse/standard_method.py b/mindspore/_extends/parse/standard_method.py index c56153bf093..13f07b9e83f 100644 --- a/mindspore/_extends/parse/standard_method.py +++ b/mindspore/_extends/parse/standard_method.py @@ -1454,7 +1454,8 @@ def enumerate_(x, start=0): x_type = F.typeof(x) ret = () op_name = "enumerate" - if check_is_tuple_or_list_or_tensor(x_type, op_name, "first input") and check_is_const_int(start, op_name, "start"): + if check_is_tuple_or_list_or_tensor(x_type, op_name, "first input") and \ + check_is_const_int(start, op_name, "start"): if check_is_tensor(x_type): for i in range(x.shape[0]): ret += ((start + i, x[i]),) diff --git a/mindspore/ccsrc/debug/anf_ir_dump.cc b/mindspore/ccsrc/debug/anf_ir_dump.cc index a9381a18032..eafea370173 100644 --- a/mindspore/ccsrc/debug/anf_ir_dump.cc +++ b/mindspore/ccsrc/debug/anf_ir_dump.cc @@ -67,7 +67,7 @@ void PrintNodeOutputType(std::ostringstream &buffer, const AnfNodePtr &nd) { abstract::ShapePtr shape = dyn_cast(nd->Shape()); TypePtr type = dyn_cast(nd->Type()); - if ((nullptr != shape) && (nullptr != type)) { + if ((shape != nullptr) && (type != nullptr)) { buffer << "<" << type << "x" << shape->shape() << ">"; } else if (nullptr != type) { buffer << "<" << type << ">"; diff --git a/mindspore/ccsrc/pipeline/jit/pipeline_ge.cc b/mindspore/ccsrc/pipeline/jit/pipeline_ge.cc index ce06a45197f..82e517d144a 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline_ge.cc +++ b/mindspore/ccsrc/pipeline/jit/pipeline_ge.cc @@ -524,7 +524,7 @@ void ExportDFGraph(const std::string &file_name, const std::string &phase) { } transform::DfGraphPtr ge_graph = wrap_ptr->graph_ptr_; - if (nullptr == ge_graph) { + if (ge_graph == nullptr) { MS_LOG(ERROR) << "Graph is null!"; return; } diff --git a/mindspore/common/_decorator.py b/mindspore/common/_decorator.py index f398b915d8b..547687d6980 100644 --- a/mindspore/common/_decorator.py +++ b/mindspore/common/_decorator.py @@ -16,6 +16,7 @@ from mindspore import log + def deprecated(version, substitute, use_substitute_name=False): """deprecated warning diff --git a/mindspore/core/abstract/prim_structures.cc b/mindspore/core/abstract/prim_structures.cc index c11ab65d600..7c5c73b3fa9 100644 --- a/mindspore/core/abstract/prim_structures.cc +++ b/mindspore/core/abstract/prim_structures.cc @@ -202,7 +202,7 @@ AbstractBasePtr InferTupleOrListSetItem(const std::string &op_name, const Abstra int64_t idx_t = idx_v >= 0 ? idx_v : idx_v + SizeToLong(nelems); if (idx_t < 0 || idx_t >= SizeToLong(nelems)) { MS_EXCEPTION(IndexError) << op_name << " evaluator the index: " << idx_v << " to set out of range: [-" << nelems - << "," << nelems - 1 << "]."; + << "," << (nelems - 1) << "]."; } size_t uidx_v = LongToSize(idx_t); elements[uidx_v] = args_spec_list[2]; diff --git a/mindspore/ops/operations/array_ops.py b/mindspore/ops/operations/array_ops.py index fe0742ebb14..6f112302e74 100644 --- a/mindspore/ops/operations/array_ops.py +++ b/mindspore/ops/operations/array_ops.py @@ -850,7 +850,6 @@ class GatherV2(PrimitiveWithCheck): Please use Gather instead. """ - # deprecate_new_name = "Gather" @deprecated("1.1", "Gather", True) @prim_attr_register