diff --git a/mindspore/ccsrc/frontend/operator/ops_front_infer_function.cc b/mindspore/ccsrc/frontend/operator/ops_front_infer_function.cc index b6e679ee79..66812135ec 100644 --- a/mindspore/ccsrc/frontend/operator/ops_front_infer_function.cc +++ b/mindspore/ccsrc/frontend/operator/ops_front_infer_function.cc @@ -666,6 +666,5 @@ REGISTER_FRONTENT_PRIMITIVE_EVAL_IMPL(J, prim::kPrimJ, InferImplJ); REGISTER_FRONTENT_PRIMITIVE_EVAL_IMPL(BroadcastGradientArgs, prim::kPrimBroadcastGradientArgs, InferImplBroadcastGradientArgs); REGISTER_PRIMITIVE_EVAL_IMPL(Assign, prim::kPrimAssign, InferImplAssign); - } // namespace abstract } // namespace mindspore diff --git a/mindspore/ccsrc/frontend/optimizer/cse_pass.h b/mindspore/ccsrc/frontend/optimizer/cse_pass.h index 9c2d655205..86b80e04d3 100644 --- a/mindspore/ccsrc/frontend/optimizer/cse_pass.h +++ b/mindspore/ccsrc/frontend/optimizer/cse_pass.h @@ -30,7 +30,6 @@ namespace mindspore { /* namespace to support opt */ namespace opt { - // Common subexpression elimination. class CSEPass : public CSE { public: diff --git a/mindspore/ccsrc/frontend/optimizer/graph_transform.h b/mindspore/ccsrc/frontend/optimizer/graph_transform.h index 3199d277f5..dff7e70006 100644 --- a/mindspore/ccsrc/frontend/optimizer/graph_transform.h +++ b/mindspore/ccsrc/frontend/optimizer/graph_transform.h @@ -27,7 +27,6 @@ namespace mindspore { namespace opt { - bool CNodeHasTupleInput(const CNodePtr &cnode); bool FuncGraphHasTupleInput(const FuncGraphPtr &fg); std::vector TransformTupleArgument(const FuncGraphPtr &fg, const AnfNodePtr &node, @@ -102,7 +101,6 @@ class GraphTupleParamTransform { } std::unordered_map cache_; }; - } // namespace opt } // namespace mindspore #endif // MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_GRAPH_TRANSFORM_H diff --git a/mindspore/ccsrc/frontend/optimizer/pattern.cc b/mindspore/ccsrc/frontend/optimizer/pattern.cc index a4f002e6dc..5c291e811d 100644 --- a/mindspore/ccsrc/frontend/optimizer/pattern.cc +++ b/mindspore/ccsrc/frontend/optimizer/pattern.cc @@ -145,7 +145,7 @@ AnfNodePtr MatchResult::get_node(const PatternPtr &pattern) { } void MatchResult::merge(const MatchResultPtr &other_result) { - auto other_result_map = other_result->_result(); + auto other_result_map = other_result->result(); // add/update entries in other_result for (auto &iter : other_result_map) { match_result_[iter.first] = iter.second; diff --git a/mindspore/ccsrc/frontend/optimizer/pattern.h b/mindspore/ccsrc/frontend/optimizer/pattern.h index 3398ef2e3b..452258ff94 100644 --- a/mindspore/ccsrc/frontend/optimizer/pattern.h +++ b/mindspore/ccsrc/frontend/optimizer/pattern.h @@ -259,7 +259,7 @@ class MatchResult { MatchResult() {} ~MatchResult() = default; void add_entry(PatternPtr pattern, AnfNodePtr node) { match_result_[pattern] = node; } - PatternNodeMap &_result() { return match_result_; } + PatternNodeMap &result() { return match_result_; } AnfNodePtr get_node(const PatternPtr &pattern); void merge(const MatchResultPtr &other_result); void clear() { match_result_.clear(); } diff --git a/mindspore/ccsrc/frontend/optimizer/py_pass.cc b/mindspore/ccsrc/frontend/optimizer/py_pass.cc index a0477223e4..8fc14ca885 100644 --- a/mindspore/ccsrc/frontend/optimizer/py_pass.cc +++ b/mindspore/ccsrc/frontend/optimizer/py_pass.cc @@ -243,7 +243,6 @@ void Reset(PatternPtr pattern) { } return; } - } // namespace internal AnfNodePtr PythonPass::Run(const FuncGraphPtr &func_graph, const FuncGraphPtr &top_graph, const AnfNodePtr &node, diff --git a/mindspore/ccsrc/pipeline/jit/parse/parse_base.h b/mindspore/ccsrc/pipeline/jit/parse/parse_base.h index 8f73c8aca3..89e91240ab 100644 --- a/mindspore/ccsrc/pipeline/jit/parse/parse_base.h +++ b/mindspore/ccsrc/pipeline/jit/parse/parse_base.h @@ -150,7 +150,6 @@ FuncGraphPtr ParsePythonCode(const py::object &obj, const std::string &python_mod_get_parse_method = PYTHON_MOD_GET_PARSE_METHOD); // add wrap for cell top graph. FuncGraphPtr MakeTopGraph(const py::object &cell, const ValuePtr &cell_ptr); - } // namespace parse } // namespace mindspore diff --git a/mindspore/ccsrc/pipeline/jit/resource_base.h b/mindspore/ccsrc/pipeline/jit/resource_base.h index cba060675b..47abd0d555 100644 --- a/mindspore/ccsrc/pipeline/jit/resource_base.h +++ b/mindspore/ccsrc/pipeline/jit/resource_base.h @@ -28,7 +28,6 @@ namespace mindspore { namespace pipeline { - class ResourceBase { public: ResourceBase() { manager_ = MakeManager(); } @@ -59,7 +58,6 @@ class ResourceBase { }; using ResourceBasePtr = std::shared_ptr; - } // namespace pipeline } // namespace mindspore diff --git a/mindspore/ccsrc/pybind_api/ir/cell_py.h b/mindspore/ccsrc/pybind_api/ir/cell_py.h index 7011fdafb8..6ffdf5032d 100644 --- a/mindspore/ccsrc/pybind_api/ir/cell_py.h +++ b/mindspore/ccsrc/pybind_api/ir/cell_py.h @@ -32,13 +32,11 @@ namespace py = pybind11; // mindspore namespace is the top level namespace of Mindsporeession project. // Other namespace should be a sub namespace of mindspore namespace in the ME project. namespace mindspore { - // Cell python wrapper and adapter class. class CellPy { public: static void AddAttr(CellPtr cell, const std::string &name, const py::object &obj); }; - } // namespace mindspore #endif // MINDSPORE_CCSRC_UTILS_CELL_PY_H_ diff --git a/mindspore/ccsrc/pybind_api/ir/tensor_py.cc b/mindspore/ccsrc/pybind_api/ir/tensor_py.cc index 2e68f24fb9..2eeba606bf 100644 --- a/mindspore/ccsrc/pybind_api/ir/tensor_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/tensor_py.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include "pybind_api/api_register.h" #include "abstract/abstract_value.h" diff --git a/mindspore/ccsrc/utils/load_onnx/anf_converter.cc b/mindspore/ccsrc/utils/load_onnx/anf_converter.cc index c65eb1b6c1..b8fb0c8c61 100644 --- a/mindspore/ccsrc/utils/load_onnx/anf_converter.cc +++ b/mindspore/ccsrc/utils/load_onnx/anf_converter.cc @@ -30,7 +30,6 @@ namespace mindspore { namespace lite { - const char WHITESPACE[] = "\t\n\v\f\r "; const int FLAG_PREFIX_LEN = 2; diff --git a/mindspore/core/ir/cell.h b/mindspore/core/ir/cell.h index 1622c5a81d..87633b53de 100644 --- a/mindspore/core/ir/cell.h +++ b/mindspore/core/ir/cell.h @@ -64,6 +64,5 @@ class Cell : public Named { }; using CellPtr = std::shared_ptr; - } // namespace mindspore #endif // MINDSPORE_CCSRC_IR_CELL_H_ diff --git a/mindspore/core/ir/dtype.cc b/mindspore/core/ir/dtype.cc index 662f99e333..19561c7a08 100644 --- a/mindspore/core/ir/dtype.cc +++ b/mindspore/core/ir/dtype.cc @@ -206,5 +206,4 @@ std::ostream &operator<<(std::ostream &os, const std::shared_ptr proble const TypePtr kTensorTypeFP16 = std::make_shared(std::make_shared(16)); const TypePtr kTensorTypeFP32 = std::make_shared(std::make_shared(32)); - } // namespace mindspore diff --git a/mindspore/core/ir/dtype.h b/mindspore/core/ir/dtype.h index 92c36c463d..3ef58b4695 100644 --- a/mindspore/core/ir/dtype.h +++ b/mindspore/core/ir/dtype.h @@ -264,7 +264,6 @@ extern const TypePtr kKeyword; extern const TypePtr kTensorType; extern const TypePtr kTensorTypeFP16; extern const TypePtr kTensorTypeFP32; - } // namespace mindspore #endif // MINDSPORE_CORE_IR_DTYPE_H_ diff --git a/mindspore/core/ir/dtype/tensor_type.cc b/mindspore/core/ir/dtype/tensor_type.cc index 98bd4363c2..31df37ebc2 100644 --- a/mindspore/core/ir/dtype/tensor_type.cc +++ b/mindspore/core/ir/dtype/tensor_type.cc @@ -21,7 +21,6 @@ #include "utils/log_adapter.h" namespace mindspore { - TypePtr UndeterminedType::DeepCopy() const { MS_EXCEPTION_IF_NULL(element_type_); if (IsGeneric()) { @@ -190,5 +189,4 @@ bool SparseTensorType::operator==(const Type &other) const { } return *element_type_ == *other_elem_type; } - } // namespace mindspore diff --git a/mindspore/core/ir/dtype/tensor_type.h b/mindspore/core/ir/dtype/tensor_type.h index 6909adec5b..7fb2b911f7 100644 --- a/mindspore/core/ir/dtype/tensor_type.h +++ b/mindspore/core/ir/dtype/tensor_type.h @@ -34,7 +34,6 @@ #include "ir/dtype/type.h" namespace mindspore { - class UndeterminedType : public Object { public: UndeterminedType() : Object(kObjectTypeUndeterminedType) {} @@ -126,7 +125,6 @@ class SparseTensorType : public Object { TypePtr element_type_; }; using SparseTensorTypePtr = std::shared_ptr; - } // namespace mindspore #endif // MINDSPORE_CORE_IR_DTYPE_TENSORTYPE_H_ diff --git a/mindspore/core/ir/pattern_matcher.h b/mindspore/core/ir/pattern_matcher.h index 1077099496..61b963ccb7 100644 --- a/mindspore/core/ir/pattern_matcher.h +++ b/mindspore/core/ir/pattern_matcher.h @@ -641,6 +641,7 @@ class PConstant : public PBase > { } int ret = 0; char *source_data = reinterpret_cast(GetPointerToTensorData(x)); + MS_EXCEPTION_IF_NULL(source_data); if (x_tensor_ptr->DataSize() == 1) { for (int i = 0; i < new_tensor_ptr->ElementsNum(); i++) { ret = memcpy_s(data + i * GetTypeByte(tensor_type_ptr), GetTypeByte(tensor_type_ptr), source_data, diff --git a/mindspore/core/ir/primitive.h b/mindspore/core/ir/primitive.h index 9ad5c3adf7..b34d5823c6 100644 --- a/mindspore/core/ir/primitive.h +++ b/mindspore/core/ir/primitive.h @@ -115,7 +115,7 @@ class Primitive : public Named { void set_const_input_indexes(const std::vector &const_input_indexes) { const_input_indexes_ = const_input_indexes; } - std::vector &get_const_input_indexes() { return const_input_indexes_; } + const std::vector &get_const_input_indexes() { return const_input_indexes_; } std::string id() const { return id_; } protected: