From c1c30a44f1cdb9bb5e324192834b3b22a1abd7a7 Mon Sep 17 00:00:00 2001 From: Wei Luning Date: Tue, 18 Aug 2020 11:16:28 +0800 Subject: [PATCH] rename param_value -> param_info --- .../session/ascend_inference_session.cc | 2 +- .../ccsrc/backend/session/kernel_graph.cc | 2 +- .../ccsrc/backend/session/session_basic.cc | 2 +- mindspore/ccsrc/debug/anf_ir_utils.cc | 2 +- mindspore/ccsrc/debug/draw.cc | 2 +- .../frontend/parallel/graph_util/node_info.cc | 2 +- .../frontend/parallel/step_auto_parallel.cc | 2 +- .../ccsrc/frontend/parallel/step_parallel.cc | 2 +- mindspore/ccsrc/pipeline/jit/action.cc | 2 +- mindspore/ccsrc/pipeline/jit/parse/resolve.cc | 2 +- mindspore/ccsrc/pipeline/jit/pipeline.cc | 2 +- .../pipeline/pynative/pynative_execute.cc | 2 +- .../{param_value_py.cc => param_info_py.cc} | 22 +++++++++---------- mindspore/ccsrc/transform/onnx/ir_exporter.cc | 2 +- .../ccsrc/transform/onnx/onnx_exporter.cc | 2 +- mindspore/ccsrc/utils/callbacks_ge.cc | 2 +- mindspore/ccsrc/utils/convert_utils.cc | 10 ++++----- .../ccsrc/utils/load_onnx/anf_model_parser.cc | 2 +- mindspore/common/parameter.py | 4 ++-- mindspore/core/ir/anf.h | 4 ++-- mindspore/core/ir/func_graph_cloner.cc | 2 +- .../core/ir/{param_value.h => param_info.h} | 16 +++++++------- mindspore/lite/src/param_value_lite.h | 1 - .../insert_memcpy_async_for_hccl_op_test.cc | 2 +- .../cpp/session/anf_runtime_algorithm_test.cc | 2 +- tests/ut/cpp/session/kernel_graph_test.cc | 2 +- 26 files changed, 48 insertions(+), 49 deletions(-) rename mindspore/ccsrc/pybind_api/ir/{param_value_py.cc => param_info_py.cc} (73%) rename mindspore/core/ir/{param_value.h => param_info.h} (88%) diff --git a/mindspore/ccsrc/backend/session/ascend_inference_session.cc b/mindspore/ccsrc/backend/session/ascend_inference_session.cc index fd0bec6d5e0..2168b9f15fd 100644 --- a/mindspore/ccsrc/backend/session/ascend_inference_session.cc +++ b/mindspore/ccsrc/backend/session/ascend_inference_session.cc @@ -19,7 +19,7 @@ #include "frontend/operator/ops.h" #include "ir/tensor.h" #include "ir/anf.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "runtime/device/kernel_runtime.h" #include "backend/session/anf_runtime_algorithm.h" #include "utils/ms_utils.h" diff --git a/mindspore/ccsrc/backend/session/kernel_graph.cc b/mindspore/ccsrc/backend/session/kernel_graph.cc index 6a9ac497ecc..4f2484ba2cf 100644 --- a/mindspore/ccsrc/backend/session/kernel_graph.cc +++ b/mindspore/ccsrc/backend/session/kernel_graph.cc @@ -19,7 +19,7 @@ #include #include #include "frontend/operator/ops.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "backend/session/anf_runtime_algorithm.h" #include "runtime/device/kernel_info.h" #include "backend/kernel_compiler/kernel_build_info.h" diff --git a/mindspore/ccsrc/backend/session/session_basic.cc b/mindspore/ccsrc/backend/session/session_basic.cc index 00b024fb4f6..7028cb79a31 100644 --- a/mindspore/ccsrc/backend/session/session_basic.cc +++ b/mindspore/ccsrc/backend/session/session_basic.cc @@ -20,7 +20,7 @@ #include #include "pipeline/jit/parse/data_converter.h" #include "ir/manager.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "backend/kernel_compiler/common_utils.h" #include "frontend/operator/ops.h" #include "common/trans.h" diff --git a/mindspore/ccsrc/debug/anf_ir_utils.cc b/mindspore/ccsrc/debug/anf_ir_utils.cc index 46e956421a7..34b2875257a 100644 --- a/mindspore/ccsrc/debug/anf_ir_utils.cc +++ b/mindspore/ccsrc/debug/anf_ir_utils.cc @@ -26,7 +26,7 @@ #include "ir/graph_utils.h" #include "utils/symbolic.h" #include "ir/meta_func_graph.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "pybind_api/ir/tensor_py.h" #include "pipeline/jit/parse/python_adapter.h" #include "pipeline/jit/parse/resolve.h" diff --git a/mindspore/ccsrc/debug/draw.cc b/mindspore/ccsrc/debug/draw.cc index bf16fbf5373..eac616510ad 100644 --- a/mindspore/ccsrc/debug/draw.cc +++ b/mindspore/ccsrc/debug/draw.cc @@ -24,7 +24,7 @@ #include #include "ir/meta_func_graph.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "ir/primitive.h" #include "ir/graph_utils.h" #include "utils/utils.h" diff --git a/mindspore/ccsrc/frontend/parallel/graph_util/node_info.cc b/mindspore/ccsrc/frontend/parallel/graph_util/node_info.cc index 5d9c999b8b4..cf8b2f10169 100644 --- a/mindspore/ccsrc/frontend/parallel/graph_util/node_info.cc +++ b/mindspore/ccsrc/frontend/parallel/graph_util/node_info.cc @@ -19,7 +19,7 @@ #include #include "ir/anf.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "pipeline/jit/parse/python_adapter.h" namespace mindspore { diff --git a/mindspore/ccsrc/frontend/parallel/step_auto_parallel.cc b/mindspore/ccsrc/frontend/parallel/step_auto_parallel.cc index 08ef6fad832..168c84c7503 100644 --- a/mindspore/ccsrc/frontend/parallel/step_auto_parallel.cc +++ b/mindspore/ccsrc/frontend/parallel/step_auto_parallel.cc @@ -28,7 +28,7 @@ #include #include "ir/anf.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "ir/tensor.h" #include "frontend/optimizer/opt.h" #include "frontend/optimizer/optimizer.h" diff --git a/mindspore/ccsrc/frontend/parallel/step_parallel.cc b/mindspore/ccsrc/frontend/parallel/step_parallel.cc index 97aa8e931c9..bad1dcb9c13 100644 --- a/mindspore/ccsrc/frontend/parallel/step_parallel.cc +++ b/mindspore/ccsrc/frontend/parallel/step_parallel.cc @@ -28,7 +28,7 @@ #include #include "ir/tensor.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "frontend/operator/ops.h" #include "frontend/optimizer/optimizer.h" #include "frontend/parallel/auto_parallel/graph_costmodel.h" diff --git a/mindspore/ccsrc/pipeline/jit/action.cc b/mindspore/ccsrc/pipeline/jit/action.cc index c556b3399f9..1c43170f0fa 100644 --- a/mindspore/ccsrc/pipeline/jit/action.cc +++ b/mindspore/ccsrc/pipeline/jit/action.cc @@ -24,7 +24,7 @@ #include #include "ir/func_graph_cloner.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "frontend/parallel/costmodel_context.h" #include "frontend/parallel/context.h" #include "pipeline/jit/pass.h" diff --git a/mindspore/ccsrc/pipeline/jit/parse/resolve.cc b/mindspore/ccsrc/pipeline/jit/parse/resolve.cc index 9f0a4b495c9..aa0e542829a 100644 --- a/mindspore/ccsrc/pipeline/jit/parse/resolve.cc +++ b/mindspore/ccsrc/pipeline/jit/parse/resolve.cc @@ -21,7 +21,7 @@ #include #include -#include "ir/param_value.h" +#include "ir/param_info.h" #include "pipeline/jit/parse/data_converter.h" #include "pipeline/jit/parse/parse.h" #include "pipeline/jit/parse/python_adapter.h" diff --git a/mindspore/ccsrc/pipeline/jit/pipeline.cc b/mindspore/ccsrc/pipeline/jit/pipeline.cc index 7bebf0aeb44..3cd1445539b 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline.cc +++ b/mindspore/ccsrc/pipeline/jit/pipeline.cc @@ -24,7 +24,7 @@ #include #include -#include "ir/param_value.h" +#include "ir/param_info.h" #include "pipeline/jit/pass.h" #include "pipeline/jit/parse/data_converter.h" #include "frontend/optimizer/ad/dfunctor.h" diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index 4c86d33fe43..e982e22a8d5 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -24,7 +24,7 @@ #include "debug/trace.h" #include "pybind_api/ir/tensor_py.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "utils/any.h" #include "utils/utils.h" #include "utils/ms_context.h" diff --git a/mindspore/ccsrc/pybind_api/ir/param_value_py.cc b/mindspore/ccsrc/pybind_api/ir/param_info_py.cc similarity index 73% rename from mindspore/ccsrc/pybind_api/ir/param_value_py.cc rename to mindspore/ccsrc/pybind_api/ir/param_info_py.cc index edf2061dc0c..9ace33643e6 100644 --- a/mindspore/ccsrc/pybind_api/ir/param_value_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/param_info_py.cc @@ -13,30 +13,30 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "ir/param_value.h" +#include "ir/param_info.h" #include "pybind11/pybind11.h" #include "pybind_api/api_register.h" namespace mindspore { namespace py = pybind11; -REGISTER_PYBIND_DEFINE(ParamValue, ([](const py::module *m) { - (void)py::class_(*m, "ParamValue") +REGISTER_PYBIND_DEFINE(ParamInfo, ([](const py::module *m) { + (void)py::class_(*m, "ParamInfo") .def(py::init()) - .def("clone", &ParamValue::Clone) - .def_property("name", &ParamValue::name, &ParamValue::set_name) - .def_property("requires_grad", &ParamValue::requires_grad, &ParamValue::set_requires_grad) - .def_property("layerwise_parallel", &ParamValue::layerwise_parallel, - &ParamValue::set_layerwise_parallel) + .def("clone", &ParamInfo::Clone) + .def_property("name", &ParamInfo::name, &ParamInfo::set_name) + .def_property("requires_grad", &ParamInfo::requires_grad, &ParamInfo::set_requires_grad) + .def_property("layerwise_parallel", &ParamInfo::layerwise_parallel, + &ParamInfo::set_layerwise_parallel) .def(py::pickle( - [](const ParamValue &p) { // __getstate__ + [](const ParamInfo &p) { // __getstate__ return py::make_tuple(p.name(), p.requires_grad(), p.layerwise_parallel()); }, [](const py::tuple &t) { // __setstate__ if (t.size() != 6) { - std::runtime_error("Invalid state for ParamValue!"); + std::runtime_error("Invalid state for ParamInfo!"); } - ParamValuePtr p = std::make_shared(); + ParamValuePtr p = std::make_shared(); p->set_name(t[1].cast()); p->set_requires_grad(t[2].cast()); p->set_layerwise_parallel(t[3].cast()); diff --git a/mindspore/ccsrc/transform/onnx/ir_exporter.cc b/mindspore/ccsrc/transform/onnx/ir_exporter.cc index 60a1cdab280..f1967a7abf5 100644 --- a/mindspore/ccsrc/transform/onnx/ir_exporter.cc +++ b/mindspore/ccsrc/transform/onnx/ir_exporter.cc @@ -24,7 +24,7 @@ #include #include "ir/tensor.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "debug/anf_ir_utils.h" #include "frontend/operator/ops.h" #include "proto/onnx.pb.h" diff --git a/mindspore/ccsrc/transform/onnx/onnx_exporter.cc b/mindspore/ccsrc/transform/onnx/onnx_exporter.cc index 8f0b72f78e2..041c2e69e8c 100644 --- a/mindspore/ccsrc/transform/onnx/onnx_exporter.cc +++ b/mindspore/ccsrc/transform/onnx/onnx_exporter.cc @@ -27,7 +27,7 @@ #include "proto/onnx.pb.h" #include "frontend/operator/ops.h" #include "ir/tensor.h" -#include "ir/param_value.h" +#include "ir/param_info.h" namespace mindspore { enum OpMergeMode { diff --git a/mindspore/ccsrc/utils/callbacks_ge.cc b/mindspore/ccsrc/utils/callbacks_ge.cc index a73df1e2578..8f5718b0a2e 100644 --- a/mindspore/ccsrc/utils/callbacks_ge.cc +++ b/mindspore/ccsrc/utils/callbacks_ge.cc @@ -16,7 +16,7 @@ #include "utils/callbacks_ge.h" #include "pybind11/pybind11.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "transform/graph_ir/df_graph_manager.h" #include "transform/graph_ir/util.h" #include "pipeline/jit/parse/data_converter.h" diff --git a/mindspore/ccsrc/utils/convert_utils.cc b/mindspore/ccsrc/utils/convert_utils.cc index 0d3ab3b6519..48aaccb5d75 100644 --- a/mindspore/ccsrc/utils/convert_utils.cc +++ b/mindspore/ccsrc/utils/convert_utils.cc @@ -30,7 +30,7 @@ #include "pipeline/jit/parse/parse_base.h" #include "ir/value.h" #include "ir/tensor.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "utils/base_ref_extends.h" #include "utils/ms_context.h" @@ -483,8 +483,8 @@ bool IsGraphOutputValueNodeOrParameter(const AnfNodePtr &output, const py::tuple // Isomorphism static bool SameNode(const AnfNodePtr &node1, const AnfNodePtr &node2, FuncGraphPairMapEquiv *equiv_func_graph, NodeMapEquiv *const equiv_node); -bool SameNodeShallow(const AnfNodePtr &node1, const AnfNodePtr &node2, FuncGraphPairMapEquiv *equiv_func_graph, - NodeMapEquiv *const equiv_node) { +static bool SameNodeShallow(const AnfNodePtr &node1, const AnfNodePtr &node2, FuncGraphPairMapEquiv *equiv_func_graph, + NodeMapEquiv *const equiv_node) { if (equiv_node == nullptr) { MS_LOG(ERROR) << "Invalid equiv_node"; return false; @@ -523,8 +523,8 @@ bool SameNodeShallow(const AnfNodePtr &node1, const AnfNodePtr &node2, FuncGraph return false; } -static bool SameNode(const AnfNodePtr &node1, const AnfNodePtr &node2, FuncGraphPairMapEquiv *equiv_func_graph, - NodeMapEquiv *const equiv_node) { +bool SameNode(const AnfNodePtr &node1, const AnfNodePtr &node2, FuncGraphPairMapEquiv *equiv_func_graph, + NodeMapEquiv *const equiv_node) { MS_EXCEPTION_IF_NULL(node1); MS_EXCEPTION_IF_NULL(node2); if (node1->isa() && node2->isa()) { diff --git a/mindspore/ccsrc/utils/load_onnx/anf_model_parser.cc b/mindspore/ccsrc/utils/load_onnx/anf_model_parser.cc index b592164df98..83525cbe270 100644 --- a/mindspore/ccsrc/utils/load_onnx/anf_model_parser.cc +++ b/mindspore/ccsrc/utils/load_onnx/anf_model_parser.cc @@ -22,7 +22,7 @@ #include #include "google/protobuf/io/zero_copy_stream_impl.h" #include "ir/tensor.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "frontend/operator/ops.h" #include "abstract/abstract_value.h" #include "proto/onnx.pb.h" diff --git a/mindspore/common/parameter.py b/mindspore/common/parameter.py index cf0e9e1dc9a..3c4f8830b46 100644 --- a/mindspore/common/parameter.py +++ b/mindspore/common/parameter.py @@ -15,7 +15,7 @@ """Parameter for cell.""" from copy import copy -from .._c_expression import ParamValue +from .._c_expression import ParamInfo from . import dtype as mstype from .initializer import initializer, Initializer from .tensor import Tensor, MetaTensor @@ -79,7 +79,7 @@ class Parameter(MetaTensor): Parameter, (data, self.name, self.requires_grad, self.layerwise_parallel)) def __init__(self, default_input, name, requires_grad=True, layerwise_parallel=False): - self._value = ParamValue() + self._value = ParamInfo() self.name = name self.requires_grad = requires_grad self.layerwise_parallel = layerwise_parallel diff --git a/mindspore/core/ir/anf.h b/mindspore/core/ir/anf.h index 1595bed6f2e..abda9d3885c 100644 --- a/mindspore/core/ir/anf.h +++ b/mindspore/core/ir/anf.h @@ -74,8 +74,8 @@ using VarPtr = std::shared_ptr; class AnfIrVisitor; -class ParamValue; -using ParamValuePtr = std::shared_ptr; +class ParamInfo; +using ParamValuePtr = std::shared_ptr; // AnfNode is the basic class of the IR definition derived from Base. // Only two types of nodes are derived: CNode and ANode. diff --git a/mindspore/core/ir/func_graph_cloner.cc b/mindspore/core/ir/func_graph_cloner.cc index 51d7b34e281..7b828cb1d46 100644 --- a/mindspore/core/ir/func_graph_cloner.cc +++ b/mindspore/core/ir/func_graph_cloner.cc @@ -19,7 +19,7 @@ #include #include "ir/manager.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "base/core_ops.h" #include "utils/convert_utils_base.h" #include "utils/log_adapter.h" diff --git a/mindspore/core/ir/param_value.h b/mindspore/core/ir/param_info.h similarity index 88% rename from mindspore/core/ir/param_value.h rename to mindspore/core/ir/param_info.h index b1ec94248b8..c4a1ab5ee57 100644 --- a/mindspore/core/ir/param_value.h +++ b/mindspore/core/ir/param_info.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef MINDSPORE_CORE_IR_PARAM_VALUE_H_ -#define MINDSPORE_CORE_IR_PARAM_VALUE_H_ +#ifndef MINDSPORE_CORE_IR_PARAM_INFO_H_ +#define MINDSPORE_CORE_IR_PARAM_INFO_H_ #include #include @@ -25,13 +25,13 @@ #include "ir/tensor.h" namespace mindspore { -class ParamValue { +class ParamInfo { public: - ParamValue() {} + ParamInfo() {} - ParamValue(const ParamValue &other) = default; + ParamInfo(const ParamInfo &other) = default; - virtual ~ParamValue() = default; + virtual ~ParamInfo() = default; const std::string &name() const { return name_; } void set_name(const std::string &name) { name_ = name; } @@ -58,7 +58,7 @@ class ParamValue { ParamValuePtr Clone() { static std::atomic parameter_cloned_index{1}; int32_t index = parameter_cloned_index.fetch_add(1, std::memory_order_relaxed); - auto clone = std::make_shared(*this); + auto clone = std::make_shared(*this); clone->be_cloned_ = false; clone->cloned_ = true; clone->be_cloned_index_ = {}; @@ -78,4 +78,4 @@ class ParamValue { int32_t cloned_index_{0}; }; } // namespace mindspore -#endif // MINDSPORE_CORE_IR_PARAM_VALUE_H_ +#endif // MINDSPORE_CORE_IR_PARAM_INFO_H_ diff --git a/mindspore/lite/src/param_value_lite.h b/mindspore/lite/src/param_value_lite.h index 8f806a4f9cd..e1908e4d8da 100644 --- a/mindspore/lite/src/param_value_lite.h +++ b/mindspore/lite/src/param_value_lite.h @@ -22,7 +22,6 @@ #include #include -#include "ir/param_value.h" #include "ir/dtype/type_id.h" namespace mindspore { diff --git a/tests/ut/cpp/pre_activate/ascend/enhancer/insert_memcpy_async_for_hccl_op_test.cc b/tests/ut/cpp/pre_activate/ascend/enhancer/insert_memcpy_async_for_hccl_op_test.cc index f5c39029837..bbf2efc0552 100644 --- a/tests/ut/cpp/pre_activate/ascend/enhancer/insert_memcpy_async_for_hccl_op_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/enhancer/insert_memcpy_async_for_hccl_op_test.cc @@ -22,7 +22,7 @@ #include "utils/utils.h" #include "backend/kernel_compiler/kernel_build_info.h" #include "backend/optimizer/common/optimizer.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #define private public #define protected public #include "backend/optimizer/ascend/enhancer/insert_memcpy_async_for_hccl_op.h" diff --git a/tests/ut/cpp/session/anf_runtime_algorithm_test.cc b/tests/ut/cpp/session/anf_runtime_algorithm_test.cc index 1ddc5d7b14a..8f7ecd38363 100644 --- a/tests/ut/cpp/session/anf_runtime_algorithm_test.cc +++ b/tests/ut/cpp/session/anf_runtime_algorithm_test.cc @@ -15,7 +15,7 @@ */ #include "common/common_test.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "frontend/operator/ops.h" #include "backend/session/kernel_graph.h" #include "backend/session/anf_runtime_algorithm.h" diff --git a/tests/ut/cpp/session/kernel_graph_test.cc b/tests/ut/cpp/session/kernel_graph_test.cc index 3cf7189a08e..3b171f47229 100644 --- a/tests/ut/cpp/session/kernel_graph_test.cc +++ b/tests/ut/cpp/session/kernel_graph_test.cc @@ -15,7 +15,7 @@ */ #include "common/common_test.h" -#include "ir/param_value.h" +#include "ir/param_info.h" #include "frontend/operator/ops.h" #include "backend/session/kernel_graph.h" #include "backend/session/anf_runtime_algorithm.h"