diff --git a/mindspore-lite/examples/cloud_infer/runtime_cpp/flags.h b/mindspore-lite/examples/cloud_infer/runtime_cpp/flags.h index 2f4ce7be2f31a7a590909844388bbbfa359630fe..297caf6e4339e7fc84440091066a07b9dc69fd50 100644 --- a/mindspore-lite/examples/cloud_infer/runtime_cpp/flags.h +++ b/mindspore-lite/examples/cloud_infer/runtime_cpp/flags.h @@ -25,7 +25,7 @@ #include #include -namespace mindspore::example { +namespace mindspore::lite::example { // declare #define DEFINE_string(name, default_val, desc) \ static std::string FLAGS_##name = default_val; \ @@ -220,5 +220,5 @@ bool ParseCommandLineFlags(int argc, const char **argv) { } return true; } -} // namespace mindspore::example +} // namespace mindspore::lite::example #endif // MINDSPORE_LITE_EXAMPLE_RUNTIME_CPP_FLAGS_H_ diff --git a/mindspore-lite/examples/converter_acl_custom_pass/pass/pass_registry_tutorial.h b/mindspore-lite/examples/converter_acl_custom_pass/pass/pass_registry_tutorial.h index 3ca8361ebce2599ce98369c878393d71f359cacb..ac59f96778b66661803397a1d61dc1d0446ae180 100644 --- a/mindspore-lite/examples/converter_acl_custom_pass/pass/pass_registry_tutorial.h +++ b/mindspore-lite/examples/converter_acl_custom_pass/pass/pass_registry_tutorial.h @@ -19,7 +19,7 @@ #include "include/registry/pass_base.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class PassTutorial : public registry::PassBase { public: @@ -33,5 +33,5 @@ class PassTutorial : public registry::PassBase { bool CreateCustomOp(const api::FuncGraphPtr func_graph, const api::AnfNodePtr &node); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXAMPLES_CONVERTER_EXTEND_PASS_PASS_REGISTRY_TUTORIAL_H diff --git a/mindspore-lite/examples/converter_extend/infer/custom_add_infer.cc b/mindspore-lite/examples/converter_extend/infer/custom_add_infer.cc index c530c1824d435a0cc442bf7b08fea0800da16090..1fbe486d5129570020ffea438463c449ef61ecaa 100644 --- a/mindspore-lite/examples/converter_extend/infer/custom_add_infer.cc +++ b/mindspore-lite/examples/converter_extend/infer/custom_add_infer.cc @@ -17,7 +17,7 @@ #include "infer/custom_common.h" #include "include/registry/register_kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { /** * CustomAddInfer is a child class to infer current node output's information, including format, data_type and shape. * if inputs' shape exist -1, don't worry, which shows that shape will be inferred when running. @@ -44,4 +44,4 @@ class CustomAddInfer : public kernel::KernelInterface { }; std::shared_ptr CustomAddInferCreator() { return std::make_shared(); } REGISTER_CUSTOM_KERNEL_INTERFACE(CustomOpTutorial, Custom_Add, CustomAddInferCreator) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/converter_extend/infer/custom_common.cc b/mindspore-lite/examples/converter_extend/infer/custom_common.cc index 32dee3d2c5c33669effc4d9a3dbe06cd9093b12a..f34206f54371810051fcb146b442cb283c925a86 100644 --- a/mindspore-lite/examples/converter_extend/infer/custom_common.cc +++ b/mindspore-lite/examples/converter_extend/infer/custom_common.cc @@ -17,7 +17,7 @@ #include "infer/custom_common.h" #include -namespace mindspore { +namespace mindspore::lite { namespace common { Status CheckInputs(const std::vector &inputs) { for (auto &input : inputs) { @@ -29,4 +29,4 @@ Status CheckInputs(const std::vector &inputs) { return kSuccess; } } // namespace common -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/converter_extend/infer/custom_common.h b/mindspore-lite/examples/converter_extend/infer/custom_common.h index 5f78622b0c87f70f330787ff24baa348db81ee01..c3435a81be94a92ed70cf46907617a5892be3d47 100644 --- a/mindspore-lite/examples/converter_extend/infer/custom_common.h +++ b/mindspore-lite/examples/converter_extend/infer/custom_common.h @@ -21,10 +21,10 @@ #include "include/api/types.h" #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { namespace common { // verify that the inputs' shape is inferred successfully when inferring current node. Status CheckInputs(const std::vector &inputs); } // namespace common -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXAMPLES_CONVERTER_EXTEND_INFER_CUSTOM_COMMON_H diff --git a/mindspore-lite/examples/converter_extend/node_parser/add_parser_tutorial.cc b/mindspore-lite/examples/converter_extend/node_parser/add_parser_tutorial.cc index bae1816a6d21e8257372e30b8dd0aafc5a38c568..2673075f2385358392bbe081b5c1b8a842ae58e9 100644 --- a/mindspore-lite/examples/converter_extend/node_parser/add_parser_tutorial.cc +++ b/mindspore-lite/examples/converter_extend/node_parser/add_parser_tutorial.cc @@ -19,7 +19,7 @@ #include "include/registry/node_parser_registry.h" #include "infer/cxx_api/add_fusion.h" -namespace mindspore { +namespace mindspore::lite { namespace converter { ops::BaseOperatorPtr AddParserTutorial::Parse(const std::unique_ptr &tflite_op, const std::unique_ptr &tflite_subgraph, @@ -34,4 +34,4 @@ ops::BaseOperatorPtr AddParserTutorial::Parse(const std::unique_ptr()); } // namespace converter -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/converter_extend/node_parser/add_parser_tutorial.h b/mindspore-lite/examples/converter_extend/node_parser/add_parser_tutorial.h index 28306d537eb5ce272ceeae88794048d49198f348..e26b3bf13489e125f761eb039d9a1c785a879400 100644 --- a/mindspore-lite/examples/converter_extend/node_parser/add_parser_tutorial.h +++ b/mindspore-lite/examples/converter_extend/node_parser/add_parser_tutorial.h @@ -20,7 +20,7 @@ #include #include "include/registry/node_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace converter { class AddParserTutorial : public NodeParser { public: @@ -31,6 +31,6 @@ class AddParserTutorial : public NodeParser { const std::unique_ptr &tflite_model) override; }; } // namespace converter -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXAMPLES_CONVERTER_EXTEND_NODE_PARSER_ADD_PARSER_TUTORIAL_H diff --git a/mindspore-lite/examples/converter_extend/pass/pass_registry_tutorial.h b/mindspore-lite/examples/converter_extend/pass/pass_registry_tutorial.h index 1272fa627ace23ed2a71d0809a953761dec6e66d..43889d763dc1df79da75ce298bbe6db952135206 100644 --- a/mindspore-lite/examples/converter_extend/pass/pass_registry_tutorial.h +++ b/mindspore-lite/examples/converter_extend/pass/pass_registry_tutorial.h @@ -19,7 +19,7 @@ #include "include/registry/pass_base.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class PassTutorial : public registry::PassBase { public: @@ -33,5 +33,5 @@ class PassTutorial : public registry::PassBase { api::AnfNodePtr CreateCustomOp(const api::FuncGraphPtr func_graph, const api::CNodePtr &cnode); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXAMPLES_CONVERTER_EXTEND_PASS_PASS_REGISTRY_TUTORIAL_H diff --git a/mindspore-lite/examples/runtime_extend/src/custom_add_infer.cc b/mindspore-lite/examples/runtime_extend/src/custom_add_infer.cc index d61489a374c59056548f98bb716947b3df378668..39625db851f23e929a4247458f93ad35d9dcdc68 100644 --- a/mindspore-lite/examples/runtime_extend/src/custom_add_infer.cc +++ b/mindspore-lite/examples/runtime_extend/src/custom_add_infer.cc @@ -18,7 +18,7 @@ #include "include/api/status.h" #include "include/registry/register_kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { /** * CustomAddInfer is a child class to infer current node output's information, including format, data_type and shape. * if inputs' shape exist -1, don't worry, which shows that shape will be inferred when running. @@ -45,4 +45,4 @@ class CustomAddInfer : public kernel::KernelInterface { }; std::shared_ptr CustomAddInferCreator() { return std::make_shared(); } REGISTER_CUSTOM_KERNEL_INTERFACE(Tutorial, Custom_Add, CustomAddInferCreator) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/runtime_extend/src/custom_add_kernel.cc b/mindspore-lite/examples/runtime_extend/src/custom_add_kernel.cc index 6b8bf216041842a6a07043a972f2f4af0df8c1c0..7866cfdd17dbfbc35b450d47734c4381ada8a338 100644 --- a/mindspore-lite/examples/runtime_extend/src/custom_add_kernel.cc +++ b/mindspore-lite/examples/runtime_extend/src/custom_add_kernel.cc @@ -22,7 +22,7 @@ #include "include/registry/register_kernel_interface.h" #include "include/registry/register_kernel.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { const auto kFloat32 = DataType::kNumberTypeFloat32; @@ -112,4 +112,4 @@ std::shared_ptr CustomAddCreator(const std::vector &inputs, co } REGISTER_CUSTOM_KERNEL(CPU, Tutorial, kFloat32, Custom_Add, CustomAddCreator) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/runtime_extend/src/custom_common.cc b/mindspore-lite/examples/runtime_extend/src/custom_common.cc index 4a4a04425469e8e6f55c1d4c8e7f3687b7653fd3..c26bce2d4e0b0021d69994cd795ebcfed6522269 100644 --- a/mindspore-lite/examples/runtime_extend/src/custom_common.cc +++ b/mindspore-lite/examples/runtime_extend/src/custom_common.cc @@ -17,7 +17,7 @@ #include "src/custom_common.h" #include -namespace mindspore { +namespace mindspore::lite { namespace common { Status CheckInputs(const std::vector &inputs) { for (auto &input : inputs) { @@ -39,4 +39,4 @@ Status CheckOutputs(const std::vector &outputs) { return kSuccess; } } // namespace common -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/runtime_extend/src/custom_common.h b/mindspore-lite/examples/runtime_extend/src/custom_common.h index 77c408cbf610bc8780d49fb86025d593b526024c..39d009ff8c31c14bcee2519fb8a348d2731c7caf 100644 --- a/mindspore-lite/examples/runtime_extend/src/custom_common.h +++ b/mindspore-lite/examples/runtime_extend/src/custom_common.h @@ -21,7 +21,7 @@ #include "include/api/types.h" #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { namespace common { // verify that the inputs' shape is inferred successfully when inferring current node. Status CheckInputs(const std::vector &inputs); @@ -29,5 +29,5 @@ Status CheckInputs(const std::vector &inputs); // versify that the outputs' shape is inferred successfully when running current node. Status CheckOutputs(const std::vector &inputs); } // namespace common -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXAMPLES_RUNTIME_REGISTRY_SRC_CUSTOM_COMMON_H diff --git a/mindspore-lite/examples/runtime_gpu_extend/src/custom_add_infer.cc b/mindspore-lite/examples/runtime_gpu_extend/src/custom_add_infer.cc index 43a435f1993c4a456de9c753a76312ebe75917e0..7f6439d8308afed271da568f9a2022af26b5006f 100644 --- a/mindspore-lite/examples/runtime_gpu_extend/src/custom_add_infer.cc +++ b/mindspore-lite/examples/runtime_gpu_extend/src/custom_add_infer.cc @@ -18,7 +18,7 @@ #include "include/errorcode.h" #include "include/registry/register_kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { /** * CustomAddInfer is a child class to infer current node output's information, including format, data_type and shape. * if inputs' shape exist -1, don't worry, which shows that shape will be inferred when running. @@ -47,4 +47,4 @@ class CustomAddInfer : public kernel::KernelInterface { }; std::shared_ptr CustomAddInferCreator() { return std::make_shared(); } REGISTER_CUSTOM_KERNEL_INTERFACE(Tutorial, Custom_Add, CustomAddInferCreator) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/runtime_gpu_extend/src/custom_add_kernel_gpu.cc b/mindspore-lite/examples/runtime_gpu_extend/src/custom_add_kernel_gpu.cc index 904a11f5be84bc194ebe78398cabefc653546cea..9172a772c688c6fbcc4e57af906952bfc04cf50a 100644 --- a/mindspore-lite/examples/runtime_gpu_extend/src/custom_add_kernel_gpu.cc +++ b/mindspore-lite/examples/runtime_gpu_extend/src/custom_add_kernel_gpu.cc @@ -30,7 +30,7 @@ #define UP_ROUND(x, y) (((x) + (y) - (1)) / (y) * (y)) -namespace mindspore { +namespace mindspore::lite { namespace custom_gpu_demo { class CustomAddKernelGpu : public kernel::Kernel { public: @@ -260,4 +260,4 @@ using schema::PrimitiveType_AddFusion; // Register the add operator to replace the internal add operator of MindSpore Lite REGISTER_KERNEL(GPU, Tutorial, kFloat32, PrimitiveType_AddFusion, custom_gpu_demo::CustomAddCreator) REGISTER_KERNEL(GPU, Tutorial, kFloat16, PrimitiveType_AddFusion, custom_gpu_demo::CustomAddFP16Creator) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/runtime_gpu_extend/src/custom_common.cc b/mindspore-lite/examples/runtime_gpu_extend/src/custom_common.cc index 946efeaf626089c580baa9d95881498b3d1f1fdb..f8013505dbe6e6bb965a0381a8d0077f2ba9bb6a 100644 --- a/mindspore-lite/examples/runtime_gpu_extend/src/custom_common.cc +++ b/mindspore-lite/examples/runtime_gpu_extend/src/custom_common.cc @@ -16,7 +16,7 @@ #include "src/custom_common.h" -namespace mindspore { +namespace mindspore::lite { namespace custom_common { int CheckInputs(const std::vector &inputs) { for (auto &input : inputs) { @@ -72,4 +72,4 @@ void PackNHWCToNHWC4(void *src, void *dst, bool src_is_fp16, bool dst_is_fp16, c } } } // namespace custom_common -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/examples/runtime_gpu_extend/src/custom_common.h b/mindspore-lite/examples/runtime_gpu_extend/src/custom_common.h index 00c1d2fa37f3a63222318d7ea156b34102bbffd1..51d91c5e476378ef7064dc4591d480635c10a10d 100644 --- a/mindspore-lite/examples/runtime_gpu_extend/src/custom_common.h +++ b/mindspore-lite/examples/runtime_gpu_extend/src/custom_common.h @@ -27,7 +27,7 @@ #define UP_DIV(x, y) (((x) + (y) - (1)) / (y)) #define C4NUM 4 -namespace mindspore { +namespace mindspore::lite { namespace custom_common { template void Broadcast2GpuShape(DstT *dst, const SrcT *src, int src_num) { @@ -124,5 +124,5 @@ int CheckOutputs(const std::vector &inputs); void PackNHWCToNHWC4(void *src, void *dst, bool src_is_fp16, bool dst_is_fp16, const GpuTensorInfo &tensor, mindspore::DataType data_type = mindspore::DataType::kNumberTypeFloat32); } // namespace custom_common -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXAMPLES_RUNTIME_GPU_EXTEND_SRC_CUSTOM_COMMON_H diff --git a/mindspore-lite/include/api/multi_model_runner.h b/mindspore-lite/include/api/multi_model_runner.h index d95ae976f81600f5c62875aac76285b4892693d5..0293776943cc5dd5dd9859e03c032b13cba0a0d4 100644 --- a/mindspore-lite/include/api/multi_model_runner.h +++ b/mindspore-lite/include/api/multi_model_runner.h @@ -25,7 +25,7 @@ #include "include/api/context.h" #include "include/api/dual_abi_helper.h" -namespace mindspore { +namespace mindspore::lite { using ConfigInfos = std::map>; class ModelImpl; class MS_API ModelExecutor { @@ -141,6 +141,6 @@ Status MultiModelRunner::Build(const std::string &model_path, const ModelType &m return Build(StringToChar(model_path), model_type, model_context); } -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_MULTI_MODEL_RUNNER_H_ diff --git a/mindspore-lite/include/converter.h b/mindspore-lite/include/converter.h index 39f80fa100318cb1517b66cdeb77a03b4cb4dff5..12c550619f2c2e76c46955a3c5bf9a634eeb7316 100644 --- a/mindspore-lite/include/converter.h +++ b/mindspore-lite/include/converter.h @@ -25,7 +25,7 @@ #include "include/registry/converter_context.h" #include "include/api/dual_abi_helper.h" -namespace mindspore { +namespace mindspore::lite { struct ConverterPara; /// \brief Converter provides C++ API for user to integrate model conversion into user application. /// @@ -186,5 +186,5 @@ Status Converter::Convert(converter::FmkType fmk_type, const std::string &model_ const std::string &weight_file) { return Convert(fmk_type, StringToChar(model_file), StringToChar(output_file), StringToChar(weight_file)); } -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_CONVERTER_H_ diff --git a/mindspore-lite/include/kernel_interface.h b/mindspore-lite/include/kernel_interface.h index 127e2a2a0b0f3ae082f50334fe5576d4a8e5c813..ca2d139c35e36033f1ba96c0160287deca757fa4 100644 --- a/mindspore-lite/include/kernel_interface.h +++ b/mindspore-lite/include/kernel_interface.h @@ -22,7 +22,7 @@ #include "include/api/status.h" #include "schema/model_generated.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class Kernel; /// \brief KernelInterface defined customized op's interface, such as infershape, and so on. @@ -57,6 +57,6 @@ class MS_API KernelInterface { } }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_KERNEL_INTERFACE_H_ diff --git a/mindspore-lite/include/registry/converter_context.h b/mindspore-lite/include/registry/converter_context.h index 3ed2674152e11d33ba7747d816dab964a73304d0..05c7b1ce1844d0fba892794a98c00698b7afa9ba 100644 --- a/mindspore-lite/include/registry/converter_context.h +++ b/mindspore-lite/include/registry/converter_context.h @@ -23,7 +23,7 @@ #include "include/api/types.h" #include "include/api/dual_abi_helper.h" -namespace mindspore { +namespace mindspore::lite { namespace converter { constexpr auto KConverterParam = "converter_parameters"; constexpr auto KCommonQuantParam = "common_quant_param"; @@ -90,6 +90,6 @@ class MS_API ConverterContext { static std::map, std::vector> GetConfigInfo(const std::vector &§ion); }; } // namespace converter -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_CONVERTER_CONTEXT_H_ diff --git a/mindspore-lite/include/registry/model_parser.h b/mindspore-lite/include/registry/model_parser.h index df56ecfe34b5dbd55654c017a87dbc35d97aee42..b584cbb6a7bd4e4347c21969776ec52b06ee3b3c 100644 --- a/mindspore-lite/include/registry/model_parser.h +++ b/mindspore-lite/include/registry/model_parser.h @@ -20,7 +20,7 @@ #include "mindapi/ir/func_graph.h" #include "include/registry/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace converter { /// \brief ModelParser defined a base class to parse model. class MS_API ModelParser { @@ -42,6 +42,6 @@ class MS_API ModelParser { api::FuncGraphPtr res_graph_ = nullptr; }; } // namespace converter -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_MODEL_PARSER_H_ diff --git a/mindspore-lite/include/registry/model_parser_registry.h b/mindspore-lite/include/registry/model_parser_registry.h index 7c2529a16e603974501ca0d28866e1e7a3712ffe..f3f0e7abcf5b49a529defaf47f3a2054b4d10d4c 100644 --- a/mindspore-lite/include/registry/model_parser_registry.h +++ b/mindspore-lite/include/registry/model_parser_registry.h @@ -21,7 +21,7 @@ #include "include/registry/converter_context.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace converter { class ModelParser; } // namespace converter @@ -56,6 +56,6 @@ class MS_API ModelParserRegistry { #define REG_MODEL_PARSER(fmk, parserCreator) \ static mindspore::registry::ModelParserRegistry g_##type##fmk##ModelParserReg(fmk, parserCreator); } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_MODEL_PARSER_REGISTRY_H_ diff --git a/mindspore-lite/include/registry/node_parser.h b/mindspore-lite/include/registry/node_parser.h index 2d987effe60f853282822ccf03bc2c29d8ef0470..f888f252873777a371ae940e6ad220cec754a29c 100644 --- a/mindspore-lite/include/registry/node_parser.h +++ b/mindspore-lite/include/registry/node_parser.h @@ -43,7 +43,7 @@ struct SubGraphT; struct ModelT; } // namespace tflite -namespace mindspore { +namespace mindspore::lite { namespace ops { /// \brief PrimitiveC defined a base class for storing properties using BaseOperatorPtr = api::SharedPtr; @@ -109,6 +109,6 @@ class MS_API NodeParser { /// \brief NodeParserPtr defined a shared_ptr type. using NodeParserPtr = std::shared_ptr; } // namespace converter -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_NODE_PARSER_H_ diff --git a/mindspore-lite/include/registry/node_parser_registry.h b/mindspore-lite/include/registry/node_parser_registry.h index 2ae17d77cd7da8066e20bf4112fcaabf9cdbc964..d90d7d1602feed5d62a6d307dac6c3aea090c3c7 100644 --- a/mindspore-lite/include/registry/node_parser_registry.h +++ b/mindspore-lite/include/registry/node_parser_registry.h @@ -22,7 +22,7 @@ #include "include/registry/node_parser.h" #include "include/api/dual_abi_helper.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { /// \brief NodeParserRegistry defined registration of NodeParser. class MS_API NodeParserRegistry { @@ -68,6 +68,6 @@ converter::NodeParserPtr NodeParserRegistry::GetNodeParser(converter::FmkType fm #define REG_NODE_PARSER(fmk_type, node_type, node_parser) \ static mindspore::registry::NodeParserRegistry g_##fmk_type##node_type##ParserReg(fmk_type, #node_type, node_parser); } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_NODE_PARSER_REGISTRY_H_ diff --git a/mindspore-lite/include/registry/pass_base.h b/mindspore-lite/include/registry/pass_base.h index ec4e88beec3234cba09574367563ec4c9d4f40d9..83f10057a96e0f9b44514c6adc027c475ec0676f 100644 --- a/mindspore-lite/include/registry/pass_base.h +++ b/mindspore-lite/include/registry/pass_base.h @@ -22,7 +22,7 @@ #include "include/api/types.h" #include "mindapi/ir/func_graph.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { /// \brief PassBase defined a base class, which provides an interface for user to operate FuncGraph. class MS_API PassBase { @@ -49,5 +49,5 @@ class MS_API PassBase { /// \brief PassBasePtr defined a shared_ptr type. using PassBasePtr = std::shared_ptr; } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_PASS_BASE_H_ diff --git a/mindspore-lite/include/registry/pass_registry.h b/mindspore-lite/include/registry/pass_registry.h index 38049513f67d02a66b7b9f26d8d82d92c685bb10..a9adf2a2d0919e114ec3be6df13d96b3f141d26c 100644 --- a/mindspore-lite/include/registry/pass_registry.h +++ b/mindspore-lite/include/registry/pass_registry.h @@ -23,7 +23,7 @@ #include "include/api/types.h" #include "include/api/dual_abi_helper.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { class PassBase; using PassBasePtr = std::shared_ptr; @@ -95,6 +95,6 @@ PassBasePtr PassRegistry::GetPassFromStoreRoom(const std::string &pass_name) { /// \param[in] names Define the names of the passes. #define REG_SCHEDULED_PASS(position, names) static mindspore::registry::PassRegistry g_##position(position, names); } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_PASS_REGISTRY_H_ diff --git a/mindspore-lite/include/registry/register_kernel.h b/mindspore-lite/include/registry/register_kernel.h index 764675b8bfc913b50a5cf3c0a11f0fcf433338a5..17cd381d2ad54c7f42ee9b49003b644c74fabc3b 100644 --- a/mindspore-lite/include/registry/register_kernel.h +++ b/mindspore-lite/include/registry/register_kernel.h @@ -28,7 +28,7 @@ #include "include/api/data_type.h" #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { /// \brief KernelDesc defined kernel's basic attribute. struct KernelDesc { @@ -178,6 +178,6 @@ CreateKernel RegisterKernel::GetCreator(const schema::Primitive *primitive, Kern #op_type, creator); \ } // namespace } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_REGISTER_KERNEL_H_ diff --git a/mindspore-lite/include/registry/register_kernel_interface.h b/mindspore-lite/include/registry/register_kernel_interface.h index 93869ec43ac2288b48a171fbf248e51bef2a5237..e71cf2cfc387dcdfff67e681ca55224e6f013867 100644 --- a/mindspore-lite/include/registry/register_kernel_interface.h +++ b/mindspore-lite/include/registry/register_kernel_interface.h @@ -24,7 +24,7 @@ #include "include/kernel_interface.h" #include "schema/model_generated.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class Kernel; } @@ -134,6 +134,6 @@ std::shared_ptr RegisterKernelInterface::GetKernelInter creator); \ } // namespace } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_REGISTRY_REGISTER_KERNEL_INTERFACE_H_ diff --git a/mindspore-lite/include/train/metrics.h b/mindspore-lite/include/train/metrics.h index 47e9e62e9715eeaad5344459c79203d0fda4e6ae..3166f3f822e48c7f40294fc8f3e41646d31eeff2 100644 --- a/mindspore-lite/include/train/metrics.h +++ b/mindspore-lite/include/train/metrics.h @@ -21,7 +21,7 @@ #include #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { namespace session { class Metrics { @@ -33,5 +33,5 @@ class Metrics { }; } // namespace session -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_TRAIN_METRICS_H_ diff --git a/mindspore-lite/include/train/train_loop.h b/mindspore-lite/include/train/train_loop.h index 7f08107ba380037cf3313b8538765c073622d531..a187419979c5205bb21c57a3b6062bb74ee2ba5f 100644 --- a/mindspore-lite/include/train/train_loop.h +++ b/mindspore-lite/include/train/train_loop.h @@ -23,7 +23,7 @@ #include "include/train/metrics.h" #include "src/litert/lite_session.h" -namespace mindspore { +namespace mindspore::lite { class MSTensor; namespace dataset { @@ -100,5 +100,5 @@ class TrainLoop { LoadDataFunc load_func, int max_steps) = 0; }; } // namespace session -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INCLUDE_TRAIN_TRAIN_LOOP_H_ diff --git a/mindspore-lite/minddata/dataset/api/data_helper.cc b/mindspore-lite/minddata/dataset/api/data_helper.cc index fbe7bd12d5414925f0632236900f50c29d860ed4..75f00fb70c74fe184533c75ff747843f64de4510 100644 --- a/mindspore-lite/minddata/dataset/api/data_helper.cc +++ b/mindspore-lite/minddata/dataset/api/data_helper.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/util/json_helper.h" #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Create a numbered json file from image folder Status DataHelper::CreateAlbumIF(const std::vector &in_dir, const std::vector &out_dir) { @@ -188,4 +188,4 @@ size_t DataHelper::DumpData(const unsigned char *tensor_addr, const size_t &tens return jh.DumpData(tensor_addr, tensor_size, addr, buffer_size); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/api/datasets.cc b/mindspore-lite/minddata/dataset/api/datasets.cc index 8bd4fc5de2f123dd245dc1cad629397713d74ed9..e9e9a9d14922edf10e58d6fbed93f9259f2e3675 100644 --- a/mindspore-lite/minddata/dataset/api/datasets.cc +++ b/mindspore-lite/minddata/dataset/api/datasets.cc @@ -138,7 +138,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // convert MSTensorVec to DE TensorRow, return empty if fails TensorRow VecToRow(const MSTensorVec &v) { @@ -2183,4 +2183,4 @@ YesNoDataset::YesNoDataset(const std::vector &dataset_dir, const std::refe } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/api/execute.cc b/mindspore-lite/minddata/dataset/api/execute.cc index c8cd9f76f6c78ee6bbaf301cdb043a1614e499fe..63ee0c6c66d99d4c8e7180c9c6965f19c0e103e5 100644 --- a/mindspore-lite/minddata/dataset/api/execute.cc +++ b/mindspore-lite/minddata/dataset/api/execute.cc @@ -36,7 +36,7 @@ namespace platform = mindspore::lite; -namespace mindspore { +namespace mindspore::lite { namespace dataset { using json = nlohmann::json; @@ -744,4 +744,4 @@ void ExecuteRun_C(const std::vector> &data_gra } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/api/iterator.cc b/mindspore-lite/minddata/dataset/api/iterator.cc index ed099ea2fd483a02d1ab61aafa0640e56bbe2fd3..645f09e57eb2bbe1302770d8f0e17ae68c7642c2 100644 --- a/mindspore-lite/minddata/dataset/api/iterator.cc +++ b/mindspore-lite/minddata/dataset/api/iterator.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/runtime_context.h" #include "mindspore-lite/minddata/dataset/include/dataset/datasets.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Iterator::Iterator() : consumer_(nullptr) {} @@ -180,4 +180,4 @@ Iterator::_Iterator &Iterator::_Iterator::operator++() { return *this; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/api/python/python_mp.h b/mindspore-lite/minddata/dataset/api/python/python_mp.h index fe60695facd6b98f21d3dbb1f77a41b99ff700e1..6e1d52633e63a18f9b8d634e6e383ef502505c71 100644 --- a/mindspore-lite/minddata/dataset/api/python/python_mp.h +++ b/mindspore-lite/minddata/dataset/api/python/python_mp.h @@ -30,7 +30,7 @@ namespace py = pybind11; #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class PythonMultiprocessingRuntime { public: @@ -92,5 +92,5 @@ class PyPythonMultiprocessingRuntime : public PythonMultiprocessingRuntime { }; #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_API_PYTHON_MP_H_ diff --git a/mindspore-lite/minddata/dataset/api/samplers.cc b/mindspore-lite/minddata/dataset/api/samplers.cc index 2a0f567607e5ec8270954a81181bc9a9512a28c5..480dfe98e822d33bd9fd65c58935714f4eb72151 100644 --- a/mindspore-lite/minddata/dataset/api/samplers.cc +++ b/mindspore-lite/minddata/dataset/api/samplers.cc @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status Sampler::BuildChildren(std::shared_ptr *const sampler) const { RETURN_UNEXPECTED_IF_NULL(sampler); @@ -138,4 +138,4 @@ std::shared_ptr WeightedRandomSampler::Parse() const { return output; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/api/transforms.cc b/mindspore-lite/minddata/dataset/api/transforms.cc index d3bee47a2cb706b34667cc2ad07b873d4fd839dc..616ea1f10fac84a619a688bbc795d52e8e24b8eb 100644 --- a/mindspore-lite/minddata/dataset/api/transforms.cc +++ b/mindspore-lite/minddata/dataset/api/transforms.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/data/transforms_ir.h" #include "ir/dtype/type_id.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Transform operations for data. namespace transforms { @@ -292,4 +292,4 @@ std::shared_ptr Unique::Parse() { #endif } // namespace transforms } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/api/vision.cc b/mindspore-lite/minddata/dataset/api/vision.cc index 7bd5df1cab03bed6d91e8e7f421af382f789bdf7..bb74089aa9f575fc0b5e825fde875f617f6d2cec 100644 --- a/mindspore-lite/minddata/dataset/api/vision.cc +++ b/mindspore-lite/minddata/dataset/api/vision.cc @@ -111,7 +111,7 @@ #include "mindspore-lite/minddata/dataset/core/type_id.h" #include "ir/dtype/type_id.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Transform operations for computer vision. namespace vision { @@ -1550,4 +1550,4 @@ Status WritePng(const std::string &filename, const mindspore::MSTensor &image, i #endif // not ENABLE_ANDROID } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/callback/callback_manager.cc b/mindspore-lite/minddata/dataset/callback/callback_manager.cc index 36af5c1192f6794d095a389aac08e666b37f25f9..adb967344153972266536b63a4243d589dd9d33b 100644 --- a/mindspore-lite/minddata/dataset/callback/callback_manager.cc +++ b/mindspore-lite/minddata/dataset/callback/callback_manager.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { void CallbackManager::AddCallbacks(std::vector> callbacks) { @@ -143,4 +143,4 @@ Status CallbackManager::StepEnd(const CallbackParam &cb_param) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/callback/callback_manager.h b/mindspore-lite/minddata/dataset/callback/callback_manager.h index d37ce532051826a8d9455ba2f7d385b3271e8fac..933e34361c4e39a268f7e5fedfcc54ddb1d9ddd6 100644 --- a/mindspore-lite/minddata/dataset/callback/callback_manager.h +++ b/mindspore-lite/minddata/dataset/callback/callback_manager.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/callback/ds_callback.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // forward declare to avoid cyclic include of dataset_op.h @@ -85,6 +85,6 @@ class CallbackManager { std::vector step_end_indices_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CALLBACK_MANAGER_H diff --git a/mindspore-lite/minddata/dataset/callback/callback_param.h b/mindspore-lite/minddata/dataset/callback/callback_param.h index 70f4656909bb6a77ccb7f6b5eb39d0483ae82b18..fcf4980c830d0cc76b688f189918607a0e16a4f2 100644 --- a/mindspore-lite/minddata/dataset/callback/callback_param.h +++ b/mindspore-lite/minddata/dataset/callback/callback_param.h @@ -19,7 +19,7 @@ #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// Callback Param is the object a DatasetOp uses to pass run-time information to user defined function. @@ -38,5 +38,5 @@ class CallbackParam { const int64_t cur_step_num_; // step number since the first row }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CALLBACK_PARAM_H diff --git a/mindspore-lite/minddata/dataset/callback/ds_callback.h b/mindspore-lite/minddata/dataset/callback/ds_callback.h index d2beca10014454c3566ec15ae74d8fe01b4e2e60..50c16d08e0fa508bda27bc77f8a9aa0ded6f5190 100644 --- a/mindspore-lite/minddata/dataset/callback/ds_callback.h +++ b/mindspore-lite/minddata/dataset/callback/ds_callback.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/callback/callback_param.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DSCallback { @@ -98,6 +98,6 @@ class DSCallback { int32_t step_size_; // step begin/end will be called every step_size_ }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_DS_CALLBACK_H diff --git a/mindspore-lite/minddata/dataset/callback/py_ds_callback.cc b/mindspore-lite/minddata/dataset/callback/py_ds_callback.cc index cf3fe82150835909b69077af646a710e321f0316..46af478f24100df7d90bdcadae0306cc07898771 100644 --- a/mindspore-lite/minddata/dataset/callback/py_ds_callback.cc +++ b/mindspore-lite/minddata/dataset/callback/py_ds_callback.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/callback/callback_manager.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status PyDSCallback::DSBegin(const CallbackParam &cb_param) { @@ -87,4 +87,4 @@ void PyDSCallback::SetStepEnd(const py::function &f) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/callback/py_ds_callback.h b/mindspore-lite/minddata/dataset/callback/py_ds_callback.h index c65a23f5e32ff55c847e5bc331435f61f96e1e14..a78e8e8bf9f2304a0cd248c4ea1c638a490ef864 100644 --- a/mindspore-lite/minddata/dataset/callback/py_ds_callback.h +++ b/mindspore-lite/minddata/dataset/callback/py_ds_callback.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "pybind11/pybind11.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace py = pybind11; @@ -127,5 +127,5 @@ class PyDSCallback : public DSCallback { bool step_end_needed_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_PY_DS_CALLBACK_H diff --git a/mindspore-lite/minddata/dataset/core/ascend_resource.cc b/mindspore-lite/minddata/dataset/core/ascend_resource.cc index 37bc1973808d05fcc2124fcbe6d889aa295afa4d..5b03c106d4abc63b3629e44faf46076fef79639f 100644 --- a/mindspore-lite/minddata/dataset/core/ascend_resource.cc +++ b/mindspore-lite/minddata/dataset/core/ascend_resource.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/ErrorCode.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status AscendResource::InitResource(uint32_t device_id) { ResourceInfo resource; @@ -105,4 +105,4 @@ void *AscendResource::GetContext() { return AclAdapter::GetInstance().GetContext void *AscendResource::GetStream() { return AclAdapter::GetInstance().GetStreamFromAclProcess(processor_.get()); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/ascend_resource.h b/mindspore-lite/minddata/dataset/core/ascend_resource.h index e705ad5dcea662d551aa76cd4cf826378426af86..bdf7870d8a96b22af84bd96f91b91140cfef5532 100644 --- a/mindspore-lite/minddata/dataset/core/ascend_resource.h +++ b/mindspore-lite/minddata/dataset/core/ascend_resource.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/core/device_tensor.h" #include "mindspore-lite/minddata/dataset/core/tensor.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class AscendResource : public DeviceResource { @@ -52,6 +52,6 @@ class AscendResource : public DeviceResource { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_ASCEND_RESOURCE_H_ diff --git a/mindspore-lite/minddata/dataset/core/client.cc b/mindspore-lite/minddata/dataset/core/client.cc index 2485ae03662faf95f6ad3464bedf2e0cc150588e..9cb4ddf22dddac28c37d32b070f3735bf45456e6 100644 --- a/mindspore-lite/minddata/dataset/core/client.cc +++ b/mindspore-lite/minddata/dataset/core/client.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/core/client.h" #include "mindspore-lite/minddata/dataset/util/services.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // This is a one-time global initializer which includes the call to instantiate singletons. // It is external api call and not a member of the GlobalContext directly. @@ -25,4 +25,4 @@ Status GlobalInit() { return (Services::CreateInstance()); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/client.h b/mindspore-lite/minddata/dataset/core/client.h index 1ba0ea703e2fcb5a8fe1daf409917e4201668429..3e0be48f2531e015b7e410a7e3a8a7e5f32980b1 100644 --- a/mindspore-lite/minddata/dataset/core/client.h +++ b/mindspore-lite/minddata/dataset/core/client.h @@ -54,12 +54,12 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // This is a one-time global initializer that needs to be called at the // start of any minddata applications. extern Status GlobalInit(); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_CLIENT_H_ diff --git a/mindspore-lite/minddata/dataset/core/config_manager.cc b/mindspore-lite/minddata/dataset/core/config_manager.cc index 831405f29f079bb30d0f857cf47538d4638d003a..573d30b3aaaaf6f4801259df68a470687fc99488 100644 --- a/mindspore-lite/minddata/dataset/core/config_manager.cc +++ b/mindspore-lite/minddata/dataset/core/config_manager.cc @@ -26,7 +26,7 @@ #include "util/path.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { ConfigManager::ConfigManager() : num_parallel_workers_(kCfgParallelWorkers), @@ -224,4 +224,4 @@ Status ConfigManager::set_enable_autotune(bool enable, bool save_autoconfig, con } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/config_manager.h b/mindspore-lite/minddata/dataset/core/config_manager.h index 7a1776867ecc08814277c2cc8873010ad3f4dd92..2d400ee401c6c75e08c59b9c3199dab7cddc593b 100644 --- a/mindspore-lite/minddata/dataset/core/config_manager.h +++ b/mindspore-lite/minddata/dataset/core/config_manager.h @@ -34,7 +34,7 @@ // } // -namespace mindspore { +namespace mindspore::lite { namespace dataset { const char kEmptyString[] = ""; const char kJsonExtension[] = ".json"; @@ -380,5 +380,5 @@ class ConfigManager { std::string start_method_; // fork or spawn }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_CONFIG_MANAGER_H_ diff --git a/mindspore-lite/minddata/dataset/core/cv_tensor.cc b/mindspore-lite/minddata/dataset/core/cv_tensor.cc index 7bf829ce401db397c17edab4f53a3f51667ea778..4eb619e8a8f3a1423ffbc79974492c7cc6dfb354 100644 --- a/mindspore-lite/minddata/dataset/core/cv_tensor.cc +++ b/mindspore-lite/minddata/dataset/core/cv_tensor.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { CVTensor::CVTensor(std::shared_ptr tensor) : Tensor(std::move(*tensor)) { (void)this->MatInit(GetMutableBuffer(), shape_, type_, &mat_); @@ -159,4 +159,4 @@ Status CVTensor::MatAtIndex(const std::vector &index, cv::Mat *mat) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/cv_tensor.h b/mindspore-lite/minddata/dataset/core/cv_tensor.h index 1a84f4d67f9e8e705ab59783cf3e0faa6a832df6..1c65c479093f624ce3a142736c7522bf6fff9d6e 100644 --- a/mindspore-lite/minddata/dataset/core/cv_tensor.h +++ b/mindspore-lite/minddata/dataset/core/cv_tensor.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/core/data_type.h" #include "mindspore-lite/minddata/dataset/core/tensor.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using CVTensorPtr = std::shared_ptr; class CVTensor : public Tensor { @@ -108,5 +108,5 @@ class CVTensor : public Tensor { Status MatInit(uchar *data, const TensorShape &shape, const DataType &type, cv::Mat *mat); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_CV_TENSOR_H_ diff --git a/mindspore-lite/minddata/dataset/core/data_type.cc b/mindspore-lite/minddata/dataset/core/data_type.cc index 48bf54e20b71eb7658ce0607cb99f88631a607bb..47afccf133a0b43ec413aa0ad42e4c3b81afb65c 100644 --- a/mindspore-lite/minddata/dataset/core/data_type.cc +++ b/mindspore-lite/minddata/dataset/core/data_type.cc @@ -19,7 +19,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { uint8_t DataType::SizeInBytes() const { if (type_ < DataType::NUM_OF_TYPES) { @@ -189,4 +189,4 @@ std::string DataType::GetPybindFormat() const { } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/data_type.h b/mindspore-lite/minddata/dataset/core/data_type.h index 06621384a589de47c4cf76ac6c1d43d106725163..2dcb2897b3905497c04011890950e4dfde957115 100644 --- a/mindspore-lite/minddata/dataset/core/data_type.h +++ b/mindspore-lite/minddata/dataset/core/data_type.h @@ -34,7 +34,7 @@ namespace py = pybind11; #endif #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Class that represents basic data types in DataEngine. class DataType { @@ -394,5 +394,5 @@ inline bool DataType::IsLooselyCompatible() const { return type_ == DataType::DE_STRING || type_ == DataType::DE_BYTES; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_DATA_TYPE_H_ diff --git a/mindspore-lite/minddata/dataset/core/de_tensor.cc b/mindspore-lite/minddata/dataset/core/de_tensor.cc index cd22f2a3e63db70ceb3edd8342f6ebcf2647ceb3..96ccbacdbc12155ac51e7a89e1f88b4c3183834e 100644 --- a/mindspore-lite/minddata/dataset/core/de_tensor.cc +++ b/mindspore-lite/minddata/dataset/core/de_tensor.cc @@ -25,7 +25,7 @@ #define EXCEPTION_IF_NULL(ptr) MS_ASSERT((ptr) != nullptr) #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { DETensor::DETensor(std::shared_ptr tensor_impl) @@ -123,4 +123,4 @@ std::shared_ptr DETensor::Clone() const { return std::make_shared(tensor_impl_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/de_tensor.h b/mindspore-lite/minddata/dataset/core/de_tensor.h index b90c30c3d87c680cab5e26abd6eb74c3485c4517..95aaca1494ba3649ecabc1cdd8028c5e63b4ccdc 100644 --- a/mindspore-lite/minddata/dataset/core/de_tensor.h +++ b/mindspore-lite/minddata/dataset/core/de_tensor.h @@ -24,7 +24,7 @@ #include "include/api/visible.h" #include "ir/api_tensor_impl.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Tensor; class DeviceTensor; @@ -67,5 +67,5 @@ class DETensor : public mindspore::MSTensor::Impl { std::vector shape_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_DETENSOR_H_ diff --git a/mindspore-lite/minddata/dataset/core/device_resource.cc b/mindspore-lite/minddata/dataset/core/device_resource.cc index e77f847a84604ee6b6d5b74dfdaa5e796184e199..ab2f54a326d645fad6702e6d244ee914342109b1 100644 --- a/mindspore-lite/minddata/dataset/core/device_resource.cc +++ b/mindspore-lite/minddata/dataset/core/device_resource.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/core/device_resource.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DeviceResource::InitResource(uint32_t) { @@ -67,4 +67,4 @@ void *DeviceResource::GetStream() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/device_resource.h b/mindspore-lite/minddata/dataset/core/device_resource.h index 013bdc50818296a90b98cc3c782bbd7ef97de2e4..218d6a809a8f7eefbd198590965fe02596c1d97b 100644 --- a/mindspore-lite/minddata/dataset/core/device_resource.h +++ b/mindspore-lite/minddata/dataset/core/device_resource.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/core/device_tensor.h" #include "mindspore-lite/minddata/dataset/core/tensor.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DeviceResource { @@ -51,5 +51,5 @@ class DeviceResource { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_DEVICE_RESOURCE_H diff --git a/mindspore-lite/minddata/dataset/core/device_tensor.cc b/mindspore-lite/minddata/dataset/core/device_tensor.cc index 11bf0c663cdce44f835d7db2f1146ff51e969769..98567e54115eb9611fd0d830f2ccb3a35dd38e14 100644 --- a/mindspore-lite/minddata/dataset/core/device_tensor.cc +++ b/mindspore-lite/minddata/dataset/core/device_tensor.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int kYuvDefaultChannels = 4; @@ -176,4 +176,4 @@ Status DeviceTensor::DataPop_(std::shared_ptr *host_tensor) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/device_tensor.h b/mindspore-lite/minddata/dataset/core/device_tensor.h index cbe9e01cf6ca5ac17165a6b230596ea67a812518..612fcc0c5afe96af8c17e99420a6ed7a49e40a1b 100644 --- a/mindspore-lite/minddata/dataset/core/device_tensor.h +++ b/mindspore-lite/minddata/dataset/core/device_tensor.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Tensor; class DATASET_API DeviceTensor : public Tensor { @@ -78,5 +78,5 @@ class DATASET_API DeviceTensor : public Tensor { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_DEVICE_TENSOR_H_ diff --git a/mindspore-lite/minddata/dataset/core/global_context.cc b/mindspore-lite/minddata/dataset/core/global_context.cc index 1e8abb6d7bcc46bcf2900ef425dd82eb23a4156b..24e1a8c163c39712d0a66bb80d5341322f2808f3 100644 --- a/mindspore-lite/minddata/dataset/core/global_context.cc +++ b/mindspore-lite/minddata/dataset/core/global_context.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/util/allocator.h" #include "mindspore-lite/minddata/dataset/util/system_pool.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Global static pointer for the singleton GlobalContext std::unique_ptr GlobalContext::global_context_ = nullptr; @@ -73,4 +73,4 @@ void GlobalContext::Print(std::ostream &out) const { out << "GlobalContext contains the following default config: " << *config_manager_ << "\n"; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/global_context.h b/mindspore-lite/minddata/dataset/core/global_context.h index 0fb9f93135f7f9cf32dd51cd80ab1cfffc3f123e..592d7fab7ca5e7f0c84dca4c2ec5f5a733894864 100644 --- a/mindspore-lite/minddata/dataset/core/global_context.h +++ b/mindspore-lite/minddata/dataset/core/global_context.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" #include "mindspore-lite/minddata/dataset/util/allocator.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // forward declare class MemoryPool; @@ -116,6 +116,6 @@ class GlobalContext { std::shared_ptr profiler_manager_; // ProfilerManager instance for all trees }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_GLOBAL_CONTEXT_H_ diff --git a/mindspore-lite/minddata/dataset/core/tensor.cc b/mindspore-lite/minddata/dataset/core/tensor.cc index 919edd387dae60c15683e5a6061207906c0807a9..6486d9e16c517685a02f119b9edf3d9b321befb1 100644 --- a/mindspore-lite/minddata/dataset/core/tensor.cc +++ b/mindspore-lite/minddata/dataset/core/tensor.cc @@ -41,7 +41,7 @@ namespace py = pybind11; #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Helper macros for printing tensor elements #define CASE_PRINT(de_type, native_type) \ @@ -1315,4 +1315,4 @@ Status Tensor::CreateFromMSTensor(const MSTensor &in, TensorPtr *out) { (const uchar *)(in.Data().get()), in.DataSize(), out); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/tensor.h b/mindspore-lite/minddata/dataset/core/tensor.h index b4059de7ede679efb1fc6b424b9bc2b012371d7b..f849efa0ea22e19b559f7aef575acc2ac053a96a 100644 --- a/mindspore-lite/minddata/dataset/core/tensor.h +++ b/mindspore-lite/minddata/dataset/core/tensor.h @@ -49,7 +49,7 @@ namespace py = pybind11; #endif -namespace mindspore::dataset { +namespace mindspore::lite::dataset { class Tensor; template class Allocator; @@ -909,5 +909,5 @@ inline Status Tensor::CreateScalar(const std::string &item, TensorP RETURN_UNEXPECTED_IF_NULL(out); return CreateFromVector({item}, TensorShape::CreateScalar(), DataType(DataType::DE_STRING), out); } -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_TENSOR_H_ diff --git a/mindspore-lite/minddata/dataset/core/tensor_helpers.cc b/mindspore-lite/minddata/dataset/core/tensor_helpers.cc index da327c72df9cc0cc53414c9a04dd8d2441117b0a..02418048a6b1f7f25896f8856efdf9c8b823c5b7 100644 --- a/mindspore-lite/minddata/dataset/core/tensor_helpers.cc +++ b/mindspore-lite/minddata/dataset/core/tensor_helpers.cc @@ -19,7 +19,7 @@ #include "include/dataset/constants.h" #include "include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { void IndexGeneratorHelper(int8_t depth, std::vector *numbers, @@ -78,4 +78,4 @@ std::vector> IndexGenerator(const std::vector *numbers, const std /// \return std::vector> 2D vector of generated indices, M x (slice_list).size() std::vector> IndexGenerator(const std::vector &slice_list); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_TENSOR_HELPERS_H_ diff --git a/mindspore-lite/minddata/dataset/core/tensor_row.cc b/mindspore-lite/minddata/dataset/core/tensor_row.cc index 19bce776d60d35edc9cb82058627a083a2c7f4ce..d3af2e0959a0ae887eb48bea8d4bb10601f2df41 100644 --- a/mindspore-lite/minddata/dataset/core/tensor_row.cc +++ b/mindspore-lite/minddata/dataset/core/tensor_row.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/core/config_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { TensorRow::TensorRow() noexcept @@ -242,4 +242,4 @@ std::string RowTimer::Summary(const std::vector &specified_op) { return ss.str(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/tensor_row.h b/mindspore-lite/minddata/dataset/core/tensor_row.h index 5c87cdd55ab502525a7fb546ead9e2b70adf0ce4..8db0ce1075456ea4feae9a08927e30054ad43496 100644 --- a/mindspore-lite/minddata/dataset/core/tensor_row.h +++ b/mindspore-lite/minddata/dataset/core/tensor_row.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TensorRow; // A set of Tensor pointers with an id @@ -341,5 +341,5 @@ class TensorRow { static Status ValidateTensorRow(const TensorRow &input, const DataType &data_type); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_TENSOR_ROW_H_ diff --git a/mindspore-lite/minddata/dataset/core/tensor_shape.cc b/mindspore-lite/minddata/dataset/core/tensor_shape.cc index f52d184fa803555166a4265b2b22c13135495320..40866340953132d2d59d6e81090f26198db4ff8b 100644 --- a/mindspore-lite/minddata/dataset/core/tensor_shape.cc +++ b/mindspore-lite/minddata/dataset/core/tensor_shape.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr dsize_t TensorShape::kDimUnknown; @@ -247,4 +247,4 @@ Status TensorShape::ToFlatIndex(const std::vector &index, dsize_t *flat return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/core/tensor_shape.h b/mindspore-lite/minddata/dataset/core/tensor_shape.h index 8f85d7d81a4e8d338e5089ece9749ef7f85626f6..c5b377c58602b24577ee1cc6a0fb116959e51c73 100644 --- a/mindspore-lite/minddata/dataset/core/tensor_shape.h +++ b/mindspore-lite/minddata/dataset/core/tensor_shape.h @@ -37,7 +37,7 @@ namespace py = pybind11; #include "mindspore-lite/minddata/dataset/core/global_context.h" #include "mindspore-lite/minddata/dataset/util/allocator.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Class that represents a shape of a Tensor. A shape can be: // -# Known shape (mKnown = true) @@ -214,5 +214,5 @@ class DATASET_API TensorShape { void AddListToShape(const T &list); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_TENSOR_SHAPE_H_ diff --git a/mindspore-lite/minddata/dataset/core/type_id.h b/mindspore-lite/minddata/dataset/core/type_id.h index a3f3c4ed14420b6133c9e3642672c7a33baf23a4..a8a912a5b5bf1988589089ab86678fc439522350 100644 --- a/mindspore-lite/minddata/dataset/core/type_id.h +++ b/mindspore-lite/minddata/dataset/core/type_id.h @@ -19,7 +19,7 @@ #include "ir/dtype/type_id.h" #include "mindspore-lite/minddata/dataset/core/data_type.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { inline dataset::DataType MSTypeToDEType(const TypeId data_type) { switch (data_type) { @@ -87,6 +87,6 @@ inline TypeId DETypeToMSType(dataset::DataType data_type) { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_TYPEID_H_ diff --git a/mindspore-lite/minddata/dataset/core/types.cc b/mindspore-lite/minddata/dataset/core/types.cc index ffcc564d8f138cc2228cf23c205825ce2e50fbc9..57db8c47ad6723c685196755f672983cc22dfc2d 100644 --- a/mindspore-lite/minddata/dataset/core/types.cc +++ b/mindspore-lite/minddata/dataset/core/types.cc @@ -26,7 +26,7 @@ #include "utils/convert_utils_base.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { class Buffer::Impl { public: Impl() : data_() {} @@ -523,4 +523,4 @@ bool Buffer::SetData(const void *data, size_t data_len) { } std::vector CharVersion() { return {}; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/connector.h b/mindspore-lite/minddata/dataset/engine/connector.h index 1f45c4c143225de1bea0948dd8afe3e59bb2564e..3238080b15870f044abf81b7b1b876ade9bcb5a0 100644 --- a/mindspore-lite/minddata/dataset/engine/connector.h +++ b/mindspore-lite/minddata/dataset/engine/connector.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/services.h" #include "mindspore-lite/minddata/dataset/util/cond_var.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Connector is a communication data structure between two group of threads that // preserve the order. @@ -206,6 +206,6 @@ class Connector { std::atomic out_buffers_count_ = 0; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_CONNECTOR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc b/mindspore-lite/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc index 384cd459edd2e5a309e6d7b616259233dde84f18..0d1f9fb099ee98770849ed9abd0407bc1425694e 100644 --- a/mindspore-lite/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc +++ b/mindspore-lite/minddata/dataset/engine/consumers/pull_based_tree_consumer.cc @@ -18,7 +18,7 @@ #include -namespace mindspore::dataset { +namespace mindspore::lite::dataset { Status PullBasedIteratorConsumer::Init(const std::shared_ptr &root) { return tree_adapter_lite_->Compile(root, num_epochs_); } @@ -258,4 +258,4 @@ Status TreeGetters::GetFirstRowShapeAndType() { first_row_obtained_ = true; return Status::OK(); } -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset diff --git a/mindspore-lite/minddata/dataset/engine/consumers/pull_based_tree_consumer.h b/mindspore-lite/minddata/dataset/engine/consumers/pull_based_tree_consumer.h index c5304766bf4349c22eaae8fec5541999308fc151..ec99efaaa7eeebd1237db96758bf75224db39f08 100644 --- a/mindspore-lite/minddata/dataset/engine/consumers/pull_based_tree_consumer.h +++ b/mindspore-lite/minddata/dataset/engine/consumers/pull_based_tree_consumer.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.h" #include "mindspore-lite/minddata/dataset/engine/tree_adapter_lite.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { class TreeAdapterLite; class TensorRow; @@ -122,5 +122,5 @@ class TreeGetters : public PullBasedIteratorConsumer { Status InternalInit(); }; -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_CONSUMERS_PULL_BASED_TREE_CONSUMER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.cc b/mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.cc index 66d7d532de1015117e4342b3279925513938b793..8fb20cdf1085cc1ddc39268dbb7113e236c7ca77 100644 --- a/mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.cc +++ b/mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.cc @@ -38,7 +38,7 @@ #include "utils/ms_context.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { using ProfilingRegistrationState = ProfilingManager::ProfilingRegistrationState; // TreeConsumer @@ -948,4 +948,4 @@ Status DatasetSizeGetter::Terminate() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.h b/mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.h index 502eb6b4f22d9f26d981fcf044658d59dcada6d1..ea8d6a236c9390cbd1e000cc44111155869d52d1 100644 --- a/mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.h +++ b/mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/tree_adapter.h" #include "mindspore-lite/minddata/dataset/include/dataset/text.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { // Forward declare class TreeAdapter; class DatasetNode; @@ -310,5 +310,5 @@ class BuildVocabConsumer : public TreeConsumer { /// \return string std::string Name() override { return "BuildVocab"; } }; -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_CONSUMERS_TREE_CONSUMER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/data_schema.cc b/mindspore-lite/minddata/dataset/engine/data_schema.cc index 59438ba0e71677e923fe80d98d9b890e608392ac..42730ae91ab3f4cb4ccbba4ca440d9ff95d0d237 100644 --- a/mindspore-lite/minddata/dataset/engine/data_schema.cc +++ b/mindspore-lite/minddata/dataset/engine/data_schema.cc @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor_shape.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // A macro for converting an input string representing the column type to it's actual // numeric column type. @@ -488,4 +488,4 @@ Status DataSchema::GetColumnName(std::vector *column_names) const { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/data_schema.h b/mindspore-lite/minddata/dataset/engine/data_schema.h index 59e5dcfd1efa097c63cdbefb2591f2cee9e20e62..cffd265a3a0571fa0631ae669b98568562210a5f 100644 --- a/mindspore-lite/minddata/dataset/engine/data_schema.h +++ b/mindspore-lite/minddata/dataset/engine/data_schema.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor_shape.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class ColDescriptor data_schema.h /// \brief A simple class to provide meta info about a column. @@ -212,6 +212,6 @@ class DataSchema { int64_t num_rows_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATA_SCHEMA_H_ diff --git a/mindspore-lite/minddata/dataset/engine/dataset_iterator.cc b/mindspore-lite/minddata/dataset/engine/dataset_iterator.cc index 08e191652112f0a964bc4e88748e8784b227b8d8..1b54c3bd3c87720813fd1c3d50b9a90773d2187a 100644 --- a/mindspore-lite/minddata/dataset/engine/dataset_iterator.cc +++ b/mindspore-lite/minddata/dataset/engine/dataset_iterator.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h" #include "mindspore-lite/minddata/dataset/engine/perf/profiling.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Fetches one row of data from the iterator as a column map. Status DatasetIterator::GetNextAsMap(TensorMap *out_map) { @@ -223,4 +223,4 @@ std::unordered_map ChildIterator::GetColumnNameMap() const return current_op_->child(child_idx_)->column_name_id_map(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/dataset_iterator.h b/mindspore-lite/minddata/dataset/engine/dataset_iterator.h index 40fee7e94ee5925bacbe67aabea0a065b4003a63..1e116e256504483f4f821a1f26fcb417cf1a92ce 100644 --- a/mindspore-lite/minddata/dataset/engine/dataset_iterator.h +++ b/mindspore-lite/minddata/dataset/engine/dataset_iterator.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using TensorMap = std::unordered_map>; @@ -122,6 +122,6 @@ class ChildIterator { bool eof_handled_; // T/F if this op got an eof }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASET_ITERATOR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.cc index a6e72611230dfe9ecc9eca82a2451c484b97dbf2..281148855ef33c06b1ebeb0b79e8f0d8418c16b4 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" #include "mindspore-lite/minddata/dataset/core/config_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Construct BarrierOp here, local variables initialized in operator due to tree construction restrictions BarrierOp::BarrierOp(int32_t op_connector_size, const std::string &condition_name, py::function condition_func) @@ -157,4 +157,4 @@ Status BarrierOp::EoeReceived(int32_t) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.h index 6f18b68505d788bb4ae6ecb911a5f817f0a6285c..296836d06f798619d4179289d167cffe88c9ff2f 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declare class ExecutionTree; @@ -94,6 +94,6 @@ class BarrierOp : public PipelineOp { py::function condition_function_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_BARRIER_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/batch_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/batch_op.cc index 10210c3b8160994640dd072462888fd5ba18b372..b3f905c05ba209376447ac7f564dabec1e209d97 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/batch_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/batch_op.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef ENABLE_PYTHON BatchOp::BatchOp(int32_t batch_size, bool drop, bool pad, int32_t op_queue_size, int32_t num_workers, @@ -1018,4 +1018,4 @@ std::vector BatchOp::GetMPWorkerPIDs() const { return DatasetOp::GetMPWorkerPIDs(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/batch_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/batch_op.h index fb44999eb08cae50d6309a612174e7e814751552..0c0a654fa99049f9c2b4e7cf05f5c34ba024fbef 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/batch_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/batch_op.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using PadInfo = std::map>>; @@ -257,6 +257,6 @@ class BatchOp : public ParallelOp, CBatc bool eoe_received_ = false; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_BATCH_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc index 0ca2d159f847ad2f94c0be62c4a274eac2f6dca6..f6abe21e49fdf3ba9bed6fdaffd85303cbf511c7 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" namespace py = pybind11; -namespace mindspore { +namespace mindspore::lite { namespace dataset { BucketBatchByLengthOp::BucketBatchByLengthOp(const std::vector &length_dependent_columns, const std::vector &bucket_boundaries, @@ -238,4 +238,4 @@ Status BucketBatchByLengthOp::GetNextRowPullMode(TensorRow *const row) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h index b1b3d56d651e7c7b30c8dd76e51166d20bfea458..6ec8acf7e913d38b40e16b237d3e38068e54f249 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class BucketBatchByLengthOp : public PipelineOp { @@ -95,6 +95,6 @@ class BucketBatchByLengthOp : public PipelineOp { std::vector> buckets_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_BUCKET_BATCH_BY_LENGTH_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.cc index 41d0df7e389f1362b950196e733ee122541787b5..04a54302aa4fadcf01824d15bcdb3f874166a1eb 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/core/config_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { BuildSentencePieceVocabOp::BuildSentencePieceVocabOp(std::shared_ptr vocab, const std::vector col_names, int32_t vocab_size, @@ -185,4 +185,4 @@ void BuildSentencePieceVocabOp::DatasetSentenceIterator::Next() { s_p_vocab_ptr_->Next(&value_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h index 951dfa4a8ec9a8ae047052f94eebdb591bf6e2d8..0afce7e8ba54f3bb21542e77617b3b97a81f3241 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/util/queue.h" #include "pybind11/pybind11.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace py = pybind11; @@ -96,5 +96,5 @@ class BuildSentencePieceVocabOp : public PipelineOp { std::unique_ptr> sentence_queue_; // master thread assigns each worker TensorRow via this }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_DATASETOPS_BUILD_SENTENCE_VOCAB_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/build_vocab_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/build_vocab_op.cc index 2fd8a44e8d6884c5c9ae9153ffbd3e50279eabcb..e2d450d3553a6086a71bba0a20734a245d79ef6c 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/build_vocab_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/build_vocab_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/core/config_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { BuildVocabOp::BuildVocabOp(std::shared_ptr vocab, std::vector col_names, std::pair freq_r, int64_t top_k, const std::vector &tokens, @@ -213,4 +213,4 @@ void BuildVocabOp::Print(std::ostream &out, bool show_all) const { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/build_vocab_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/build_vocab_op.h index fd8e1cacc883e7f3241c7ad4fc2e8bd86fe97069..9c47cd378e6712582c5a1512718b6c297df914b5 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/build_vocab_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/build_vocab_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/util/queue.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class BuildVocabOp : public ParallelOp { public: @@ -86,5 +86,5 @@ class BuildVocabOp : public ParallelOp { std::unordered_map word_cnt_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_BUILD_VOCAB_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.cc index d78b6d76472939d555a52667392aa675a6b60baf..fa7564c0ae400c7438569f9a0edbb84e3d441632 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.cc @@ -17,7 +17,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // A print method typically used for debugging void CacheBase::Print(std::ostream &out, bool show_all) const { @@ -321,4 +321,4 @@ Status CacheBase::Prefetcher(int32_t worker_id) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.h index 5f7fb8f4c1324d9c71e3e3861525005cde73914e..9b5adf409f31223d520c06b2ede025449021d43b 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.h @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/util/queue_map.h" #include "mindspore-lite/minddata/dataset/util/semaphore.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief This is the base class for CacheOp and CacheLookupOp which share many similarities. /// \see CacheOp @@ -117,6 +117,6 @@ class CacheBase : public ParallelOp, TensorRow> { Status GetPrefetchRow(row_id_type row_id, TensorRow *out); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_CACHE_BASE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.cc index ba9370a47475ad15349905a7b619d739c803b7fe..c7a7d0dc00bda199280a84b86d0437201d5af1c7 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status CacheLookupOp::operator()() { if (!sampler_) { @@ -95,4 +95,4 @@ Status CacheLookupOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.h index a636d9b17633747b8a7445df90b9f577f4520f24..5c3fb58c798ad25dbd58d712f8126b97d884c9f8 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.h @@ -23,7 +23,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief provides a memory/disk cache that acts as a save-point within a mappable dataset. /// \note For non-mappable dataset, please see CacheOp @@ -59,6 +59,6 @@ class CacheLookupOp : public CacheBase, public SamplerRT { Status RegisterResources() override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_CACHE_LOOKUP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.cc index 640050c56a4c6f57de4a5e6f7d870e7ddd235256..eac77cc3f0ac93259622560108546728b4befae9 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/system_pool.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { CacheMergeOp::~CacheMergeOp() = default; void CacheMergeOp::Print(std::ostream &out, bool show_all) const { @@ -319,4 +319,4 @@ Status CacheMergeOp::TensorRowCacheRequest::CheckCacheResult() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.h index 3ba8b0042c87d12cbbe7d61e360280f2cf1202ad..c111b35a9f912f3246b4fe7f96a0240fcebacd72 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.h @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/util/queue_map.h" #include "mindspore-lite/minddata/dataset/util/semaphore.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Provides method to merge two streams (one from CacheLookup and one from cache miss stream) into one single /// stream @@ -146,5 +146,5 @@ class CacheMergeOp : public ParallelOp { Status Cleaner(); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_CACHE_MERGE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/cache_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/cache_op.cc index 8c433f968003938231b4dfcf8ff1a7cab4ec704e..13829a275006404180bdbe1c99c56d720882adce 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/cache_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/cache_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor of CacheOp CacheOp::CacheOp(int32_t num_workers, int32_t op_connector_size, std::shared_ptr cache_client, @@ -217,4 +217,4 @@ Status CacheOp::PrepareOperator() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/cache_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/cache_op.h index 169d0419f67e2a1444be56af928f3b69b621c9a1..aa07d9428cb88155600a9e2d439a8186f07950ca 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/cache_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/cache_op.h @@ -22,7 +22,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/datasetops/cache_base_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief CacheOp provides a memory/disk cache that acts as a save-point within a non-mappable dataset. /// \note For mappable dataset, please see CacheLookupOp. @@ -94,6 +94,6 @@ class CacheOp : public CacheBase, public RandomAccessOp { Status RegisterResources() override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_CACHE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/concat_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/concat_op.cc index c10d889fc44838999c0ac2b7c0fc529a49bf9917..7b0dee624d55e5427f708c1be5b81292144290c4 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/concat_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/concat_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor of the ConcatOp. ConcatOp::ConcatOp(const std::shared_ptr &sampler, @@ -321,4 +321,4 @@ Status ConcatOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/concat_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/concat_op.h index c1a82ce33cbf8737ab29dd5127eca40f32e8913d..9ddb0a0ab748626854716051328378df6cb16059 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/concat_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/concat_op.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ConcatOp : public PipelineOp { public: @@ -117,6 +117,6 @@ class ConcatOp : public PipelineOp { std::mt19937 rnd_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_CONCAT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/data_queue_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/data_queue_op.cc index aed4248e95b4e182bd678268f20fa6d0db9c7088..ae025c02e592853829fca9b5e7ec5affb94034e9 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/data_queue_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/data_queue_op.cc @@ -32,7 +32,7 @@ #include "include/backend/distributed/embedding_cache/data_queue_manager.h" #include "utils/ms_context.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef WITH_BACKEND using distributed::DataQueueManager; @@ -1311,4 +1311,4 @@ Status DataQueueOp::SendDataToAscendDynamic() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/data_queue_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/data_queue_op.h index 21719c0df0ba1f8a1f007c218007a8a83e6fc0e2..e09bf0ff3b3d9d7f9c1c9b85c6dd734982ed27c0 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/data_queue_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/data_queue_op.h @@ -35,7 +35,7 @@ #include "mindspore-lite/minddata/dataset/util/circular_pool.h" #include "mindspore/ccsrc/include/runtime/hardware_abstract/data_queue/data_queue.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class GpuConnector; using DATA_INFO = std::vector>; @@ -226,5 +226,5 @@ class DataQueueOp : public PipelineOp { bool enable_prefetch_cache_pipeline_{false}; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_DATA_QUEUE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.cc index 78f395b74f187fe7f4f3732b7a69030c8e2f683b..15047c453807bc1a38d4b4a0ec5953b760fe2208 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.cc @@ -33,7 +33,7 @@ #include "utils/system/crc32c.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor DatasetOp::DatasetOp(int32_t op_connector_size, std::shared_ptr sampler) @@ -510,4 +510,4 @@ Status DatasetOp::Launch() { Status DatasetOp::Terminate() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h index 8d69a0f1d14de29e3dd2bef6b2dc30bf239ee99d..5521a66a113f27e937f3af7880f83d8e9d1fde87 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/engine/perf/info_collector.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr char kBarrierOp[] = "BarrierOp"; @@ -429,6 +429,6 @@ class DatasetOp : public std::enable_shared_from_this { void set_tree(ExecutionTree *tree) { tree_ = tree; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_DATASET_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc index ea6c212aac1dc4f14faaa4c6b60a51a345ea86f4..519f8c98adfce5d1c6667d25b09443e61695c9b2 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc @@ -18,7 +18,7 @@ #include #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor EpochCtrlOp::EpochCtrlOp(int32_t num_epoch) : RepeatOp(num_epoch) { MS_LOG(INFO) << "Welcome to Epoch Ctrl Op."; } @@ -111,4 +111,4 @@ Status EpochCtrlOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/epoch_ctrl_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/epoch_ctrl_op.h index f57174d0b9f2325a6a3f7c52f3722d921fbc2c55..501ee1112386a7d0d76399efcb923957843763b7 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/epoch_ctrl_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/epoch_ctrl_op.h @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class EpochCtrlOp : public RepeatOp { public: @@ -63,6 +63,6 @@ class EpochCtrlOp : public RepeatOp { ImplementedPullMode PullModeImplementationStatus() const override { return ImplementedPullMode::Implemented; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_DATASETOPS_EPOCH_CTRL_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/filter_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/filter_op.cc index 2fb0329cfbf187b3ac94585828b080bcc44ffca9..528f0dcca5c9893c3b57aad509c3aed78c3beb1c 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/filter_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/filter_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { FilterOp::FilterOp(const std::vector &in_col_names, int32_t num_workers, int32_t op_queue_size, std::shared_ptr predicate_func) @@ -198,4 +198,4 @@ Status FilterOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/filter_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/filter_op.h index 15f554e6fa2ab091184aa11eaf1b57e5973e0595..3f6715f0addb5573ff08bc78b05cea8f1018e0e5 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/filter_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/filter_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/queue.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { enum filterCtrl : int8_t { kFilterEmpty = 0, kFilterPartial = 1, kFilterFull = 2, kFilterEoe = 3, kFilterEof = 4 }; @@ -119,5 +119,5 @@ class FilterOp : public ParallelOp { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.cc b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.cc index 8715e013993c759e2d0da4fcffa59ebe428271cb..2c10c5d0538e6cb116bd70095ba6d145883b2773 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.cc @@ -19,7 +19,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor @@ -56,4 +56,4 @@ Status CpuMapJob::Run(std::vector in, std::vector *out) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.h b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.h index 3814a9e978164e3dc825a659335455efa42414e5..960296993da6afca88bd5672c4c3e98330537dac 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/cpu_map_job.h @@ -20,7 +20,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_job.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CpuMapJob : public MapJob { public: @@ -48,6 +48,6 @@ class CpuMapJob : public MapJob { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_DATASETOPS_MAP_OP_CPU_MAP_JOB_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.cc b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.cc index 2bcd3e72cab00fdc732a28d8eac2073f3cc11fa4..5c6851644f3723c9037994eea9ded14dc2123a48 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor @@ -25,4 +25,4 @@ GpuMapJob::GpuMapJob(std::vector> operations) : MapJob // Destructor GpuMapJob::~GpuMapJob() = default; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.h b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.h index 93262fb826f6e74b4feed7b67aacb624fcc920c6..da835d61d45cb6ad1e2397fcdff12e2c539d32dd 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/gpu_map_job.h @@ -20,7 +20,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_job.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class GpuMapJob : public MapJob { public: @@ -45,6 +45,6 @@ class GpuMapJob : public MapJob { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_DATASETOPS_MAP_OP_GPU_MAP_JOB_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_job.h b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_job.h index 92d98962481657e5c0ba17e5fbbb46cf1d6c6037..b47fdbeaedb9011c811ab63af7183d027c857ff5 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_job.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_job.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace util { static inline Status RebuildMapErrorMsg(const TensorRow &input_row, const std::string &op_name, Status *rc) { @@ -92,6 +92,6 @@ class MapJob { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_DATASETOPS_MAP_OP_MAP_JOB_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_op.cc index 3cddbb89546fd29128c6c03a94bc3ba46bba4c03..48b3cb769a0303b6dde49b6931e6801c0d99c166 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_op.cc @@ -41,7 +41,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/ErrorCode.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { using TensorOpVector = std::vector>; @@ -920,4 +920,4 @@ Status MapOp::ReleaseResource(int32_t worker_id) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_op.h index 131d2ee6ac529e55845654d15ac5803664b20359..82a711377ad67ad882f72d127d02b512b012ddd0 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_op.h @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/util/queue.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declare class ExecutionTree; @@ -251,6 +251,6 @@ class MapOp : public ParallelOp, TensorRow> { Status ReleaseResource(int32_t worker_id); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_MAP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/npu_map_job.cc b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/npu_map_job.cc index 0859fde824d5779717d8099fa0a166ffb3a05fb5..0b90b35256c4e56545beaaa46540c4570499935b 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/npu_map_job.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/npu_map_job.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/core/device_tensor_ascend910b.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor @@ -149,4 +149,4 @@ Status NpuMapJob::Run(std::vector in, std::vector *out, return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/npu_map_job.h b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/npu_map_job.h index 5ecc5d0204f6f89784eaa13a8f1e8fd69cc94675..a2cb3e9faf2b860b73cf6121b6b8dde86d27e7a8 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/map_op/npu_map_job.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/map_op/npu_map_job.h @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/map_op/map_job.h" #include "runtime/hardware_abstract/device_context/device_context.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class NpuMapJob : public MapJob { public: @@ -47,6 +47,6 @@ class NpuMapJob : public MapJob { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_DATASETOPS_MAP_OP_NPU_MAP_JOB_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h index 3b1dee09b7a1cc744d1ff027536e0f8196a6fa10..64b72f5587a94f18f99ea7a5d7da8ca562bc20d9 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr int64_t kCachedRowsSize = 16; @@ -463,6 +463,6 @@ class ParallelOp : public DatasetOp { int32_t current_repeats_{0}; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_PARALLEL_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.cc index 002bcb0157040ccd4aefc7d8d9268a1618b6b0e8..270849831201612dee5d430c2a366b514048c038 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor PipelineOp::PipelineOp(int32_t op_connector_size, std::shared_ptr sampler) @@ -46,4 +46,4 @@ void PipelineOp::Print(std::ostream &out, bool show_all) const { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h index 391c1cb3bb840793294ddbd18e855cf4ee64d5c5..a2c26bd1a683acef77ef6bba479b5d2a97a413f4 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h @@ -21,7 +21,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // forward declare class ExecutionTree; @@ -67,6 +67,6 @@ class PipelineOp : public DatasetOp { // trash. }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_PIPELINE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/project_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/project_op.cc index 9345959cfc4ab0c5a1f93c54fbc4cf7660f8d5db..58b208ef1a9a9ce107082b39d0c0524910efeaf9 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/project_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/project_op.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { ProjectOp::ProjectOp(const std::vector &columns_to_project) : PipelineOp(0), columns_to_project_(columns_to_project) {} @@ -127,4 +127,4 @@ Status ProjectOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/project_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/project_op.h index bf93784a6114a27b6ddb9ba6c359edcd73eccdda..3c4d7d98c0b19496ad7d918e9fb899bd41ea59d3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/project_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/project_op.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ProjectOp : public PipelineOp { public: @@ -96,6 +96,6 @@ class ProjectOp : public PipelineOp { Status ComputeColMap() override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_PROJECT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/receive_bridge_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/receive_bridge_op.cc index bdc2f6ab90333dfc95f9e4a2cb2bf7c3a8c01307..b96d5cb378e94af1b90328a5df2dd5a22ff9a273 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/receive_bridge_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/receive_bridge_op.cc @@ -31,7 +31,7 @@ #include "mindspore-lite/minddata/dataset/util/task_manager.h" #include "mindspore-lite/minddata/dataset/util/monitor.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor of ReceiveBridgeOp ReceiveBridgeOp::ReceiveBridgeOp(int32_t op_connector_size, SharedMemoryQueue receive_queue, MessageQueue msg_queue) @@ -317,4 +317,4 @@ Status ReceiveBridgeOp::GetNextRowPullMode(TensorRow *const row) { MessageQueue ReceiveBridgeOp::GetMessageQueue() { return msg_queue_; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/receive_bridge_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/receive_bridge_op.h index 91d71b5b7b92a70840613591c09a8ab569dee7e6..ce3c55e675b7014f6c9cb060bc3612634eeedcb3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/receive_bridge_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/receive_bridge_op.h @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/core/shared_memory_queue.h" #include "mindspore-lite/minddata/dataset/core/message_queue.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int kMonitorInterval = 1; const int kSleepDelays = 2; @@ -125,6 +125,6 @@ class ReceiveBridgeOp : public ParallelOp { ImplementedPullMode PullModeImplementationStatus() const override { return ImplementedPullMode::Implemented; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_RECEIVE_BRIDGE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/rename_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/rename_op.cc index 30187e8b73e4629c4ac63f8c7c326c42afa7265e..a8d90a46f1c4b47b7bad34f08fd1fc1275f8d0fa 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/rename_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/rename_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/core/config_manager.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // constructor RenameOp::RenameOp(const std::vector &in_col_names, const std::vector &out_col_names) @@ -143,4 +143,4 @@ void RenameOp::Print(std::ostream &out, // In: The output stream to print t } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/rename_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/rename_op.h index 2683ddd033f8607d0804670ec54fc3dceb3db415..5f6bff90af2f7d1b965401d753c358807886c4d0 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/rename_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/rename_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RenameOp : public PipelineOp { public: @@ -89,6 +89,6 @@ class RenameOp : public PipelineOp { std::unique_ptr child_iterator_; // An iterator for fetching. }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_RENAME_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.cc index eabf12d656853c1dcdbb872b5d2e17cbc34d0820..a8d49f4491fb55ad88cb4ed67745f5e184e54b02 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor of the RepeatOp. RepeatOp::RepeatOp(int32_t count) : PipelineOp(0), num_repeats_(count), repeat_count_(0) {} @@ -161,4 +161,4 @@ Status RepeatOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.h index 26a3e9d83cded1787c3c6b5cd0500badb0cd7f9a..f2cab1e3a46fc1f3f02033d6f89235b939abe3cc 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/repeat_op.h @@ -22,7 +22,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RepeatOp : public PipelineOp { public: @@ -114,6 +114,6 @@ class RepeatOp : public PipelineOp { ImplementedPullMode PullModeImplementationStatus() const override { return ImplementedPullMode::Implemented; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_REPEAT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/send_bridge_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/send_bridge_op.cc index 74fbc1eca9bb90a3a2d6701a47bb43702e979fc1..d478d67e42a766074cc6114fabacebb5e914b318 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/send_bridge_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/send_bridge_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor of SendBridgeOp SendBridgeOp::SendBridgeOp(int32_t op_connector_size, SharedMemoryQueue send_queue, MessageQueue msg_queue) @@ -224,4 +224,4 @@ MessageQueue SendBridgeOp::GetMessageQueue() { return msg_queue_; } SharedMemoryQueue SendBridgeOp::GetSharedMemoryQueue() { return send_queue_; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/send_bridge_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/send_bridge_op.h index 7876713384098fde34153624ec48de848adfcf63..28fe1172446aff046d3059bfa6727c9d15ac7c85 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/send_bridge_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/send_bridge_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/core/shared_memory_queue.h" #include "mindspore-lite/minddata/dataset/core/message_queue.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SendBridgeOp : public ParallelOp { public: @@ -114,6 +114,6 @@ class SendBridgeOp : public ParallelOp { ImplementedPullMode PullModeImplementationStatus() const override { return ImplementedPullMode::Implemented; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SEND_BRIDGE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/shuffle_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/shuffle_op.cc index aab017ba6413778b1bbd254b522e11741085c38d..7372740e5dbf975fb3130d3eb9e94d3c76d0b0cf 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/shuffle_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/shuffle_op.cc @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr int32_t ShuffleOp::kShuffleStateInit; constexpr int32_t ShuffleOp::kShuffleStateActive; @@ -298,4 +298,4 @@ Status ShuffleOp::GetNextRowPullMode(TensorRow *const row) { void ShuffleOp::Skip(int64_t skip_steps) { rng_.discard(skip_steps); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/shuffle_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/shuffle_op.h index 63850e0892fff5a59f1f3d1f09afd8177d977147..79a383b39bc371223387e7c925cfb4bcbab8116f 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/shuffle_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/shuffle_op.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ShuffleOp : public PipelineOp { @@ -144,6 +144,6 @@ class ShuffleOp : public PipelineOp { bool eof_received_{false}; // flag to indicate if eof is reached in pull mode. }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SHUFFLE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/skip_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/skip_op.cc index 695c12f7db9281df8f8cf72c27a7a40fe21c4ee7..860efefa2dc5dd7e434f452b25b6fa6b342422a8 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/skip_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/skip_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/core/config_manager.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor of the SkipOp. SkipOp::SkipOp(int32_t count) : PipelineOp(0), max_skips_(count), skip_count_(0) {} @@ -122,4 +122,4 @@ Status SkipOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/skip_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/skip_op.h index 2c5ad67fd59bc55ea87dce4cf2a9a4a3bb30c8b4..0911d8fdcc9e78c1f2c480806f302caefbd03f57 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/skip_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/skip_op.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" #include "mindspore-lite/minddata/dataset/engine/dataset_iterator.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SkipOp : public PipelineOp { public: @@ -72,6 +72,6 @@ class SkipOp : public PipelineOp { std::unique_ptr child_iterator_; // An iterator for fetching. }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SKIP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.cc index ccde88e865ff020328d5ff0a0ee99801bdd7c3a9..7bced60711ac8252ea3b15672d9f6ac54db15e72 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.cc @@ -1,55 +1,55 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.h" - -#include - -#include "mindspore-lite/minddata/dataset/core/config_manager.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -#include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" - -namespace mindspore { -namespace dataset { -AGNewsOp::AGNewsOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, - bool shuffle_files, int32_t num_devices, int32_t device_id, char field_delim, - const std::vector> &column_default, - const std::vector &column_name, const std::vector &ag_news_list) - : CsvOp(ag_news_list, field_delim, column_default, column_name, num_workers, num_samples, worker_connector_size, - op_connector_size, shuffle_files, num_devices, device_id) {} - -// A print method typically used for debugging. -void AGNewsOp::Print(std::ostream &out, bool show_all) const { - if (!show_all) { - // Call the super class for displaying any common 1-liner info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal 1-liner info for this op. - out << "\n"; - } else { - // Call the super class for displaying any common detailed info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal stuff - out << "\nSample count: " << total_rows_ << "\nDevice id: " << device_id_ << "\nNumber of devices: " << num_devices_ - << "\nShuffle files: " << ((shuffle_files_) ? "yes" : "no") << "\nAGNews files list:\n"; - for (int i = 0; i < csv_files_list_.size(); ++i) { - out << " " << csv_files_list_[i]; - } - out << "\n\n"; - } -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.h" + +#include + +#include "mindspore-lite/minddata/dataset/core/config_manager.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" +#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" +#include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" + +namespace mindspore::lite { +namespace dataset { +AGNewsOp::AGNewsOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, + bool shuffle_files, int32_t num_devices, int32_t device_id, char field_delim, + const std::vector> &column_default, + const std::vector &column_name, const std::vector &ag_news_list) + : CsvOp(ag_news_list, field_delim, column_default, column_name, num_workers, num_samples, worker_connector_size, + op_connector_size, shuffle_files, num_devices, device_id) {} + +// A print method typically used for debugging. +void AGNewsOp::Print(std::ostream &out, bool show_all) const { + if (!show_all) { + // Call the super class for displaying any common 1-liner info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal 1-liner info for this op. + out << "\n"; + } else { + // Call the super class for displaying any common detailed info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal stuff + out << "\nSample count: " << total_rows_ << "\nDevice id: " << device_id_ << "\nNumber of devices: " << num_devices_ + << "\nShuffle files: " << ((shuffle_files_) ? "yes" : "no") << "\nAGNews files list:\n"; + for (int i = 0; i < csv_files_list_.size(); ++i) { + out << " " << csv_files_list_[i]; + } + out << "\n\n"; + } +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.h index 662d0e1fdd01b2b175d363bfebf5661d7061fe69..4118f7ad512838f503ed47ccde5ca3f1158157cc 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.h @@ -1,77 +1,77 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AG_NEWS_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AG_NEWS_OP_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -#include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.h" -#include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" -#include "mindspore-lite/minddata/dataset/util/auto_index.h" - -namespace mindspore { -namespace dataset { -class JaggedConnector; - -class AGNewsOp : public CsvOp { - public: - /// \brief Constructor. - /// \param[in] num_workers Number of workers reading images in parallel - /// \param[in] num_samples The number of samples to be included in the dataset. - /// (Default = 0 means all samples). - /// \param[in] worker_connector_size Size of each internal queue. - /// \param[in] op_connector_size Size of each queue in the connector that the child operator pulls from. - /// \param[in] shuffle_files Whether or not to shuffle the files before reading data. - /// \param[in] num_devices Number of devices that the dataset should be divided into. (Default = 1) - /// \param[in] device_id The device ID within num_devices. This argument should be - /// specified only when num_devices is also specified (Default = 0). - /// \param[in] field_delim A char that indicates the delimiter to separate fields (default=','). - /// \param[in] column_default List of default values for the CSV field (default={}). Each item in the list is - /// either a valid type (float, int, or string). If this is not provided, treats all columns as string type. - /// \param[in] column_name List of column names of the dataset (default={}). If this is not provided, infers the - /// column_names from the first row of CSV file. - /// \param[in] ag_news_list List of files to be read to search for a pattern of files. The list - /// will be sorted in a lexicographical order. - AGNewsOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, - bool shuffle_files, int32_t num_devices, int32_t device_id, char field_delim, - const std::vector> &column_default, const std::vector &column_name, - const std::vector &ag_news_list); - - /// \brief Default destructor. - ~AGNewsOp() = default; - - /// \brief A print method typically used for debugging. - /// \param[in] out he output stream to write output to. - /// \param[in] show_all A bool to control if you want to show all info or just a - /// summary. - void Print(std::ostream &out, bool show_all) const override; - - /// \brief Op name getter. - /// \return Name of the current Op. - std::string Name() const override { return "AGNewsOp"; } - - // DatasetName name getter - // \return DatasetName of the current Op - std::string DatasetName(bool upper = false) const { return upper ? "AGNews" : "ag news"; } -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AG_NEWS_OP_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AG_NEWS_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AG_NEWS_OP_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" +#include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.h" +#include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" +#include "mindspore-lite/minddata/dataset/util/auto_index.h" + +namespace mindspore::lite { +namespace dataset { +class JaggedConnector; + +class AGNewsOp : public CsvOp { + public: + /// \brief Constructor. + /// \param[in] num_workers Number of workers reading images in parallel + /// \param[in] num_samples The number of samples to be included in the dataset. + /// (Default = 0 means all samples). + /// \param[in] worker_connector_size Size of each internal queue. + /// \param[in] op_connector_size Size of each queue in the connector that the child operator pulls from. + /// \param[in] shuffle_files Whether or not to shuffle the files before reading data. + /// \param[in] num_devices Number of devices that the dataset should be divided into. (Default = 1) + /// \param[in] device_id The device ID within num_devices. This argument should be + /// specified only when num_devices is also specified (Default = 0). + /// \param[in] field_delim A char that indicates the delimiter to separate fields (default=','). + /// \param[in] column_default List of default values for the CSV field (default={}). Each item in the list is + /// either a valid type (float, int, or string). If this is not provided, treats all columns as string type. + /// \param[in] column_name List of column names of the dataset (default={}). If this is not provided, infers the + /// column_names from the first row of CSV file. + /// \param[in] ag_news_list List of files to be read to search for a pattern of files. The list + /// will be sorted in a lexicographical order. + AGNewsOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, + bool shuffle_files, int32_t num_devices, int32_t device_id, char field_delim, + const std::vector> &column_default, const std::vector &column_name, + const std::vector &ag_news_list); + + /// \brief Default destructor. + ~AGNewsOp() = default; + + /// \brief A print method typically used for debugging. + /// \param[in] out he output stream to write output to. + /// \param[in] show_all A bool to control if you want to show all info or just a + /// summary. + void Print(std::ostream &out, bool show_all) const override; + + /// \brief Op name getter. + /// \return Name of the current Op. + std::string Name() const override { return "AGNewsOp"; } + + // DatasetName name getter + // \return DatasetName of the current Op + std::string DatasetName(bool upper = false) const { return upper ? "AGNews" : "ag news"; } +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AG_NEWS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/album_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/album_op.cc index ca7854e3f6209a1c6617d2c51f8ce0c9da4ce01f..7d46a093f886c30b0597085efd2048e24a181e1f 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/album_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/album_op.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { AlbumOp::AlbumOp(int32_t num_wkrs, std::string file_dir, int32_t queue_size, bool do_decode, const std::set &exts, std::unique_ptr data_schema, @@ -437,4 +437,4 @@ Status AlbumOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/album_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/album_op.h index aff110819f6cd9623afded2c409b336b863cf96f..0e93eade9cb6d6af9222154d9937dbb3c5efe908 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/album_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/album_op.h @@ -38,7 +38,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -174,5 +174,5 @@ class AlbumOp : public MappableLeafOp { std::vector image_rows_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_ALBUM_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.cc old mode 100755 new mode 100644 index b18b325f418a30678f95a254a86423447132f235..7ca58a60defcb65a13a6f1e3a95339b21ab903c7 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.cc @@ -1,50 +1,50 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.h" - -#include - -namespace mindspore { -namespace dataset { -AmazonReviewOp::AmazonReviewOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, - int32_t op_connector_size, bool shuffle_files, int32_t num_devices, int32_t device_id, - char field_delim, const std::vector> &column_default, - const std::vector &column_name, - const std::vector &amazon_review_files_list) - : CsvOp(amazon_review_files_list, field_delim, column_default, column_name, num_workers, num_samples, - worker_connector_size, op_connector_size, shuffle_files, num_devices, device_id) {} - -void AmazonReviewOp::Print(std::ostream &out, bool show_all) const { - if (!show_all) { - // Call the super class for displaying any common 1-liner info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal 1-liner info for this op. - out << "\n"; - } else { - // Call the super class for displaying any common detailed info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal stuff. - out << "\nSample count: " << total_rows_ << "\nDevice id: " << device_id_ << "\nNumber of devices: " << num_devices_ - << "\nShuffle files: " << ((shuffle_files_) ? "yes" : "no") << "\nAmazonReview files list:\n"; - for (int i = 0; i < csv_files_list_.size(); ++i) { - out << " " << csv_files_list_[i]; - } - out << "\n\n"; - } -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.h" + +#include + +namespace mindspore::lite { +namespace dataset { +AmazonReviewOp::AmazonReviewOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, + int32_t op_connector_size, bool shuffle_files, int32_t num_devices, int32_t device_id, + char field_delim, const std::vector> &column_default, + const std::vector &column_name, + const std::vector &amazon_review_files_list) + : CsvOp(amazon_review_files_list, field_delim, column_default, column_name, num_workers, num_samples, + worker_connector_size, op_connector_size, shuffle_files, num_devices, device_id) {} + +void AmazonReviewOp::Print(std::ostream &out, bool show_all) const { + if (!show_all) { + // Call the super class for displaying any common 1-liner info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal 1-liner info for this op. + out << "\n"; + } else { + // Call the super class for displaying any common detailed info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal stuff. + out << "\nSample count: " << total_rows_ << "\nDevice id: " << device_id_ << "\nNumber of devices: " << num_devices_ + << "\nShuffle files: " << ((shuffle_files_) ? "yes" : "no") << "\nAmazonReview files list:\n"; + for (int i = 0; i < csv_files_list_.size(); ++i) { + out << " " << csv_files_list_[i]; + } + out << "\n\n"; + } +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.h old mode 100755 new mode 100644 index 10f3a68495d4c6598f1a87a4103f0825fdaa4c0a..9f5da3bdfec28de12e8e6a2da36b8eab2a54b1d5 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.h @@ -1,71 +1,71 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AMAZON_REVIEW_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AMAZON_REVIEW_OP_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" - -namespace mindspore { -namespace dataset { -class JaggedConnector; - -/// \class AmazonReviewOp -/// \brief A Op derived class to represent AmazonReview Op. -class AmazonReviewOp : public CsvOp { - public: - /// \brief Constructor of AmazonReviewOp. - /// \param[in] num_workers Number of worker threads reading data from amazon_review files. - /// \param[in] num_samples The number of samples to be included in the dataset. - /// \param[in] worker_connector_size Size of each internal queue. - /// \param[in] op_connector_size Size of each queue in the connector that the child operator pulls from. - /// \param[in] shuffle_files Whether or not to shuffle the files before reading data. - /// \param[in] num_devices Number of devices that the dataset should be divided into. - /// \param[in] device_id The device ID within num_devices. - /// \param[in] field_delim A char that indicates the delimiter to separate fields. - /// \param[in] column_default List of default values for the CSV field. Each item in the list is - /// either a valid type (float, int, or string). - /// \param[in] column_name List of column names of the dataset. - /// \param[in] amazon_review_files_list List of file paths for the dataset files. - AmazonReviewOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, - bool shuffle_files, int32_t num_devices, int32_t device_id, char field_delim, - const std::vector> &column_default, - const std::vector &column_name, const std::vector &amazon_review_files_list); - - /// \brief Destructor. - ~AmazonReviewOp() = default; - - /// \brief A print method typically used for debugging. - /// \param[out] out The output stream to write output to. - /// \param[in] show_all A bool to control if you want to show all info or just a summary. - void Print(std::ostream &out, bool show_all) const override; - - /// \brief DatasetName name getter. - /// \param[in] upper A bool to control if you want to return uppercase or lowercase Op name. - /// \return DatasetName of the current Op. - std::string DatasetName(bool upper = false) const { return upper ? "AmazonReview" : "amazon review"; } - - /// \brief Op name getter. - /// \return Name of the current Op. - std::string Name() const override { return "AmazonReviewOp"; } -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AMAZON_REVIEW_OP_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AMAZON_REVIEW_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AMAZON_REVIEW_OP_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" + +namespace mindspore::lite { +namespace dataset { +class JaggedConnector; + +/// \class AmazonReviewOp +/// \brief A Op derived class to represent AmazonReview Op. +class AmazonReviewOp : public CsvOp { + public: + /// \brief Constructor of AmazonReviewOp. + /// \param[in] num_workers Number of worker threads reading data from amazon_review files. + /// \param[in] num_samples The number of samples to be included in the dataset. + /// \param[in] worker_connector_size Size of each internal queue. + /// \param[in] op_connector_size Size of each queue in the connector that the child operator pulls from. + /// \param[in] shuffle_files Whether or not to shuffle the files before reading data. + /// \param[in] num_devices Number of devices that the dataset should be divided into. + /// \param[in] device_id The device ID within num_devices. + /// \param[in] field_delim A char that indicates the delimiter to separate fields. + /// \param[in] column_default List of default values for the CSV field. Each item in the list is + /// either a valid type (float, int, or string). + /// \param[in] column_name List of column names of the dataset. + /// \param[in] amazon_review_files_list List of file paths for the dataset files. + AmazonReviewOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, + bool shuffle_files, int32_t num_devices, int32_t device_id, char field_delim, + const std::vector> &column_default, + const std::vector &column_name, const std::vector &amazon_review_files_list); + + /// \brief Destructor. + ~AmazonReviewOp() = default; + + /// \brief A print method typically used for debugging. + /// \param[out] out The output stream to write output to. + /// \param[in] show_all A bool to control if you want to show all info or just a summary. + void Print(std::ostream &out, bool show_all) const override; + + /// \brief DatasetName name getter. + /// \param[in] upper A bool to control if you want to return uppercase or lowercase Op name. + /// \return DatasetName of the current Op. + std::string DatasetName(bool upper = false) const { return upper ? "AmazonReview" : "amazon review"; } + + /// \brief Op name getter. + /// \return Name of the current Op. + std::string Name() const override { return "AmazonReviewOp"; } +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_AMAZON_REVIEW_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.cc old mode 100755 new mode 100644 index 92223d4cd1927add0e099e25ccef1f7d7ae3c719..f98322032e479d34a2621c6f48df8572cb4fe1ff --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.cc @@ -1,32 +1,32 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.h" - -#include -#include -#include -#include - -namespace mindspore { -namespace dataset { -const std::set kExts = {".jpg", ".JPEG"}; -const std::map kClassIndex = {}; -CaltechOp::CaltechOp(int32_t num_workers, const std::string &file_dir, int32_t queue_size, bool do_decode, - std::unique_ptr data_schema, std::shared_ptr sampler) - : ImageFolderOp(num_workers, file_dir, queue_size, false, do_decode, kExts, kClassIndex, std::move(data_schema), - std::move(sampler)) {} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + + * http://www.apache.org/licenses/LICENSE-2.0 + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.h" + +#include +#include +#include +#include + +namespace mindspore::lite { +namespace dataset { +const std::set kExts = {".jpg", ".JPEG"}; +const std::map kClassIndex = {}; +CaltechOp::CaltechOp(int32_t num_workers, const std::string &file_dir, int32_t queue_size, bool do_decode, + std::unique_ptr data_schema, std::shared_ptr sampler) + : ImageFolderOp(num_workers, file_dir, queue_size, false, do_decode, kExts, kClassIndex, std::move(data_schema), + std::move(sampler)) {} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.h old mode 100755 new mode 100644 index 6970b761d1dd7116e9994bc20532aa790c60042a..685409df72f42480a70e51c395d5b2ea6974f580 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/caltech_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Read Caltech256 Dataset. class CaltechOp : public ImageFolderOp { @@ -53,5 +53,5 @@ class CaltechOp : public ImageFolderOp { std::string DatasetName(bool upper = false) const { return upper ? "Caltech" : "caltech"; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CALTECH_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/celeba_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/celeba_op.cc index c7161d3f9ed3e7ad97d267de9697f920d8b730a8..2833858b750201f95716e63a2b045b8773e49e9d 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/celeba_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/celeba_op.cc @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef ENABLE_PYTHON CelebAOp::CelebAOp(int32_t num_workers, const std::string &dir, int32_t queue_size, bool decode, @@ -334,4 +334,4 @@ Status CelebAOp::InitPullMode() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/celeba_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/celeba_op.h index 829568c2905950315994e34f9c5e2682a12033c5..ba671d1f5f3dfa1acb9e20e166c0b569479456ae 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/celeba_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/celeba_op.h @@ -40,7 +40,7 @@ } \ } while (false) -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CelebAOp : public MappableLeafOp { public: @@ -139,5 +139,5 @@ class CelebAOp : public MappableLeafOp { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CELEBA_OP_H diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/cifar_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/cifar_op.cc index 02e4617e3bedcb934a58eb1bbdc1e30289253c32..b0fd19e07e5c896c17f810615df687dddd88bac4 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/cifar_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/cifar_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr uint32_t kCifarImageHeight = 32; @@ -402,4 +402,4 @@ Status CifarOp::InitPullMode() { return PrepareData(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/cifar_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/cifar_op.h index 13b1bcf58d25c7a8c372041b718381f501fa31b6..1a1b8183c96e59c9b22edd0b559bfbdcfa5fe39e 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/cifar_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/cifar_op.h @@ -34,7 +34,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CifarOp : public MappableLeafOp { public: @@ -124,5 +124,5 @@ class CifarOp : public MappableLeafOp { std::vector, std::vector>> cifar_image_label_pairs_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif /// MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CIFAR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.cc index 37c083fe181389baf66c54fa074a980a4e6a9c15..3098e8c27c316eb5471de56d37235ad9ca72f314 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr char taskSuffix[] = "polygon"; @@ -272,4 +272,4 @@ Status CityscapesOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.h index 5af37d71e635e90d1a6ded17b19e6b28053855d4..f7988379a6382c0c98040919232d8fcdc16bc6a1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.h @@ -34,7 +34,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CityscapesOp : public MappableLeafOp { public: @@ -124,5 +124,5 @@ class CityscapesOp : public MappableLeafOp { std::vector> image_task_pairs_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CITYSCAPES_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.cc index 0d78fef5607a0c688653ece08ada428948a2cbcc..f43ea5422d2fd716919a6f74114fa303935ac451 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { ClueOp::ClueOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, ColKeyMap cols_to_keyword, std::vector clue_files_list, int32_t op_connector_size, bool shuffle_files, @@ -290,4 +290,4 @@ Status ClueOp::ComputeColMap() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.h index 4bedf3f4be2b63360c1782986c644317f13f9e1b..ad4a18b99406ddcbbff5c26a64d9e6eabe540048 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h" #include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using StringIndex = AutoIndexObj; using ColKeyMap = std::map>; @@ -103,5 +103,5 @@ class ClueOp : public NonMappableLeafOp { ColKeyMap cols_to_keyword_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CLUE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.cc index 71ab0e23befa75c1414a57d69e577046124c7902..afa860f90761582206fc94fe9e54b176c209d097 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.cc @@ -1,171 +1,171 @@ -/** - * Copyright 2022-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.h" - -#include - -#include "mindspore-lite/minddata/dataset/audio/kernels/audio_utils.h" -#include "mindspore-lite/minddata/dataset/core/config_manager.h" -#include "mindspore-lite/minddata/dataset/core/tensor_shape.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" -#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -#include "utils/file_utils.h" - -namespace mindspore { -namespace dataset { -const char kDataDirectory[] = "wav"; -const char kLabelDirectory[] = "etc"; -const char kLabelFileName[] = "txt.done.data"; -const char kDataFilePrefix[] = "cmu_us_"; -const char kDataFileSuffix[] = "_arctic"; - -CMUArcticOp::CMUArcticOp(const std::string &dataset_dir, const std::string &name, int32_t num_workers, - int32_t queue_size, std::unique_ptr data_schema, - std::shared_ptr sampler) - : MappableLeafOp(num_workers, queue_size, std::move(sampler)), - folder_path_(dataset_dir), - name_(name), - data_schema_(std::move(data_schema)) {} - -Status CMUArcticOp::LoadTensorRow(row_id_type row_id, TensorRow *trow) { - RETURN_UNEXPECTED_IF_NULL(trow); - const uint32_t sample_rate = 16000; - const std::string wav_suffix = ".wav"; - size_t pos = label_pairs_[row_id].first.find_last_of('_'); - CHECK_FAIL_RETURN_UNEXPECTED( - pos != std::string::npos && pos + 1 < label_pairs_[row_id].first.size(), - "Invalid utterance id, please check if it is in valid format: " + label_pairs_[row_id].first); - std::string utterance_id_t = label_pairs_[row_id].first.substr(pos + 1); - std::string full_name_path = kDataFilePrefix + name_ + kDataFileSuffix; - std::string file_name = label_pairs_[row_id].first + wav_suffix; - Path root_folder(real_path_); - Path wav_file_path = root_folder / full_name_path / kDataDirectory / file_name; - std::shared_ptr waveform, rate, transcript, utterance_id; - RETURN_IF_NOT_OK(ReadAudio(wav_file_path.ToString(), &waveform)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(sample_rate, &rate)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(label_pairs_[row_id].second, &transcript)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(utterance_id_t, &utterance_id)); - (*trow) = TensorRow(row_id, {std::move(waveform), std::move(rate), std::move(transcript), std::move(utterance_id)}); - Path label_dir = root_folder / full_name_path / kLabelDirectory / kLabelFileName; - trow->setPath({wav_file_path.ToString(), wav_file_path.ToString(), label_dir.ToString(), label_dir.ToString()}); - return Status::OK(); -} - -void CMUArcticOp::Print(std::ostream &out, bool show_all) const { - if (!show_all) { - ParallelOp::Print(out, show_all); - out << "\n"; - } else { - ParallelOp::Print(out, show_all); - out << "\nNumber of rows: " << num_rows_ << "\nCMUArctic directory: " << folder_path_ << "\n\n"; - } -} - -Status CMUArcticOp::CountTotalRows(const std::string &dir, const std::string &name, int64_t *count) { - RETURN_UNEXPECTED_IF_NULL(count); - *count = 0; - const int64_t num_samples = 0; - const int64_t start_index = 0; - auto sampler = std::make_shared(start_index, num_samples); - auto schema = std::make_unique(); - - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); - TensorShape scalar_rate = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); - TensorShape scalar_utterance = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("transcript", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance))); - TensorShape scalar_utterance_id = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("utterance_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance_id))); - std::shared_ptr cfg = GlobalContext::config_manager(); - - int32_t num_workers = cfg->num_parallel_workers(); - int32_t op_connect_size = cfg->op_connector_size(); - auto op = - std::make_shared(dir, name, num_workers, op_connect_size, std::move(schema), std::move(sampler)); - RETURN_IF_NOT_OK(op->PrepareData()); - *count = op->label_pairs_.size(); - return Status::OK(); -} - -Status CMUArcticOp::ComputeColMap() { - if (column_name_id_map_.empty()) { - for (int32_t i = 0; i < data_schema_->NumColumns(); ++i) { - column_name_id_map_[data_schema_->Column(i).Name()] = i; - } - } else { - MS_LOG(WARNING) << "Column name map is already set!"; - } - return Status::OK(); -} - -Status CMUArcticOp::ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform) { - RETURN_UNEXPECTED_IF_NULL(waveform); - const int32_t kWavFileSampleRate = 16000; - int32_t sample_rate = 0; - std::vector waveform_vec; - RETURN_IF_NOT_OK(ReadWaveFile(audio_dir, &waveform_vec, &sample_rate)); - CHECK_FAIL_RETURN_UNEXPECTED( - sample_rate == kWavFileSampleRate, - "Invalid file, sampling rate of CMUArctic wav file must be 16000, file path: " + audio_dir); - RETURN_IF_NOT_OK(Tensor::CreateFromVector(waveform_vec, waveform)); - RETURN_IF_NOT_OK((*waveform)->ExpandDim(0)); - return Status::OK(); -} - -Status CMUArcticOp::PrepareData() { - auto realpath = FileUtils::GetRealPath(folder_path_.c_str()); - if (!realpath.has_value()) { - MS_LOG(ERROR) << "Invalid file path, CMUArctic Dataset dir: " << folder_path_ << " does not exist."; - RETURN_STATUS_UNEXPECTED("Invalid file path, CMUArctic Dataset dir: " + folder_path_ + " does not exist."); - } - real_path_ = realpath.value(); - Path dir(real_path_); - std::string full_name_path = kDataFilePrefix + name_ + kDataFileSuffix; - Path label_dir = dir / full_name_path / kLabelDirectory / kLabelFileName; - CHECK_FAIL_RETURN_UNEXPECTED(label_dir.Exists() && !label_dir.IsDirectory(), - "Invalid file, failed to find label file: " + label_dir.ToString()); - std::ifstream label_reader(label_dir.ToString(), std::ifstream::in); - CHECK_FAIL_RETURN_UNEXPECTED(label_reader.is_open(), - "Invalid file, failed to open label file: " + label_dir.ToString() + - ", make sure file not damaged or permission denied."); - std::string line = ""; - while (getline(label_reader, line)) { - size_t quot_inx[2] = {0}; - size_t quot_num = 0; - size_t quot_exact = 2; - for (size_t i = 0; quot_num < quot_exact && i < line.size(); i++) { - if (line[i] == '"') { - quot_inx[quot_num++] = i; - } - } - if (quot_num != quot_exact) { - label_reader.close(); - RETURN_STATUS_UNEXPECTED("Invalid file, the file may not be a CMUArctic dataset file: " + label_dir.ToString()); - } - label_pairs_.push_back( - {line.substr(2, quot_inx[0] - 3), line.substr(quot_inx[0] + 1, quot_inx[1] - quot_inx[0] - 1)}); - } - label_reader.close(); - num_rows_ = label_pairs_.size(); - CHECK_FAIL_RETURN_UNEXPECTED(num_rows_ > 0, "Invalid data, no valid data found in path: " + folder_path_); - return Status::OK(); -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2022-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.h" + +#include + +#include "mindspore-lite/minddata/dataset/audio/kernels/audio_utils.h" +#include "mindspore-lite/minddata/dataset/core/config_manager.h" +#include "mindspore-lite/minddata/dataset/core/tensor_shape.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" +#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" +#include "utils/file_utils.h" + +namespace mindspore::lite { +namespace dataset { +const char kDataDirectory[] = "wav"; +const char kLabelDirectory[] = "etc"; +const char kLabelFileName[] = "txt.done.data"; +const char kDataFilePrefix[] = "cmu_us_"; +const char kDataFileSuffix[] = "_arctic"; + +CMUArcticOp::CMUArcticOp(const std::string &dataset_dir, const std::string &name, int32_t num_workers, + int32_t queue_size, std::unique_ptr data_schema, + std::shared_ptr sampler) + : MappableLeafOp(num_workers, queue_size, std::move(sampler)), + folder_path_(dataset_dir), + name_(name), + data_schema_(std::move(data_schema)) {} + +Status CMUArcticOp::LoadTensorRow(row_id_type row_id, TensorRow *trow) { + RETURN_UNEXPECTED_IF_NULL(trow); + const uint32_t sample_rate = 16000; + const std::string wav_suffix = ".wav"; + size_t pos = label_pairs_[row_id].first.find_last_of('_'); + CHECK_FAIL_RETURN_UNEXPECTED( + pos != std::string::npos && pos + 1 < label_pairs_[row_id].first.size(), + "Invalid utterance id, please check if it is in valid format: " + label_pairs_[row_id].first); + std::string utterance_id_t = label_pairs_[row_id].first.substr(pos + 1); + std::string full_name_path = kDataFilePrefix + name_ + kDataFileSuffix; + std::string file_name = label_pairs_[row_id].first + wav_suffix; + Path root_folder(real_path_); + Path wav_file_path = root_folder / full_name_path / kDataDirectory / file_name; + std::shared_ptr waveform, rate, transcript, utterance_id; + RETURN_IF_NOT_OK(ReadAudio(wav_file_path.ToString(), &waveform)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(sample_rate, &rate)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(label_pairs_[row_id].second, &transcript)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(utterance_id_t, &utterance_id)); + (*trow) = TensorRow(row_id, {std::move(waveform), std::move(rate), std::move(transcript), std::move(utterance_id)}); + Path label_dir = root_folder / full_name_path / kLabelDirectory / kLabelFileName; + trow->setPath({wav_file_path.ToString(), wav_file_path.ToString(), label_dir.ToString(), label_dir.ToString()}); + return Status::OK(); +} + +void CMUArcticOp::Print(std::ostream &out, bool show_all) const { + if (!show_all) { + ParallelOp::Print(out, show_all); + out << "\n"; + } else { + ParallelOp::Print(out, show_all); + out << "\nNumber of rows: " << num_rows_ << "\nCMUArctic directory: " << folder_path_ << "\n\n"; + } +} + +Status CMUArcticOp::CountTotalRows(const std::string &dir, const std::string &name, int64_t *count) { + RETURN_UNEXPECTED_IF_NULL(count); + *count = 0; + const int64_t num_samples = 0; + const int64_t start_index = 0; + auto sampler = std::make_shared(start_index, num_samples); + auto schema = std::make_unique(); + + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); + TensorShape scalar_rate = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); + TensorShape scalar_utterance = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("transcript", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance))); + TensorShape scalar_utterance_id = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("utterance_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance_id))); + std::shared_ptr cfg = GlobalContext::config_manager(); + + int32_t num_workers = cfg->num_parallel_workers(); + int32_t op_connect_size = cfg->op_connector_size(); + auto op = + std::make_shared(dir, name, num_workers, op_connect_size, std::move(schema), std::move(sampler)); + RETURN_IF_NOT_OK(op->PrepareData()); + *count = op->label_pairs_.size(); + return Status::OK(); +} + +Status CMUArcticOp::ComputeColMap() { + if (column_name_id_map_.empty()) { + for (int32_t i = 0; i < data_schema_->NumColumns(); ++i) { + column_name_id_map_[data_schema_->Column(i).Name()] = i; + } + } else { + MS_LOG(WARNING) << "Column name map is already set!"; + } + return Status::OK(); +} + +Status CMUArcticOp::ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform) { + RETURN_UNEXPECTED_IF_NULL(waveform); + const int32_t kWavFileSampleRate = 16000; + int32_t sample_rate = 0; + std::vector waveform_vec; + RETURN_IF_NOT_OK(ReadWaveFile(audio_dir, &waveform_vec, &sample_rate)); + CHECK_FAIL_RETURN_UNEXPECTED( + sample_rate == kWavFileSampleRate, + "Invalid file, sampling rate of CMUArctic wav file must be 16000, file path: " + audio_dir); + RETURN_IF_NOT_OK(Tensor::CreateFromVector(waveform_vec, waveform)); + RETURN_IF_NOT_OK((*waveform)->ExpandDim(0)); + return Status::OK(); +} + +Status CMUArcticOp::PrepareData() { + auto realpath = FileUtils::GetRealPath(folder_path_.c_str()); + if (!realpath.has_value()) { + MS_LOG(ERROR) << "Invalid file path, CMUArctic Dataset dir: " << folder_path_ << " does not exist."; + RETURN_STATUS_UNEXPECTED("Invalid file path, CMUArctic Dataset dir: " + folder_path_ + " does not exist."); + } + real_path_ = realpath.value(); + Path dir(real_path_); + std::string full_name_path = kDataFilePrefix + name_ + kDataFileSuffix; + Path label_dir = dir / full_name_path / kLabelDirectory / kLabelFileName; + CHECK_FAIL_RETURN_UNEXPECTED(label_dir.Exists() && !label_dir.IsDirectory(), + "Invalid file, failed to find label file: " + label_dir.ToString()); + std::ifstream label_reader(label_dir.ToString(), std::ifstream::in); + CHECK_FAIL_RETURN_UNEXPECTED(label_reader.is_open(), + "Invalid file, failed to open label file: " + label_dir.ToString() + + ", make sure file not damaged or permission denied."); + std::string line = ""; + while (getline(label_reader, line)) { + size_t quot_inx[2] = {0}; + size_t quot_num = 0; + size_t quot_exact = 2; + for (size_t i = 0; quot_num < quot_exact && i < line.size(); i++) { + if (line[i] == '"') { + quot_inx[quot_num++] = i; + } + } + if (quot_num != quot_exact) { + label_reader.close(); + RETURN_STATUS_UNEXPECTED("Invalid file, the file may not be a CMUArctic dataset file: " + label_dir.ToString()); + } + label_pairs_.push_back( + {line.substr(2, quot_inx[0] - 3), line.substr(quot_inx[0] + 1, quot_inx[1] - quot_inx[0] - 1)}); + } + label_reader.close(); + num_rows_ = label_pairs_.size(); + CHECK_FAIL_RETURN_UNEXPECTED(num_rows_ > 0, "Invalid data, no valid data found in path: " + folder_path_); + return Status::OK(); +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.h index 7def4366a703326e2caf8589ddae42e551a855d5..6126ff22abc8c182c6ed3349759ca333fc913032 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.h @@ -1,99 +1,99 @@ -/** - * Copyright 2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CMU_ARCTIC_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CMU_ARCTIC_OP_H_ - -#include -#include -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/core/tensor.h" -#include "mindspore-lite/minddata/dataset/engine/data_schema.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -#include "mindspore-lite/minddata/dataset/util/path.h" -#include "mindspore-lite/minddata/dataset/util/queue.h" -#include "mindspore-lite/minddata/dataset/util/status.h" -#include "mindspore-lite/minddata/dataset/util/wait_post.h" - -namespace mindspore { -namespace dataset { -class CMUArcticOp : public MappableLeafOp { - public: - /// \brief Constructor. - /// \param[in] dataset_dir Directory of CMUArctic. - /// \param[in] name Part of this dataset, can be "aew", "ahw", "aup", "awb", "axb", "bdl", - /// "clb", "eey", "fem", "gka", "jmk", "ksp", "ljm", "lnh", "rms", "rxr", "slp" or "slt" - /// \param[in] num_workers Number of workers reading audios in parallel. - /// \param[in] queue_size Connector queue size. - /// \param[in] data_schema The schema of the CMUArctic dataset. - /// \param[in] sampler Sampler tells CMUArcticOp what to read. - CMUArcticOp(const std::string &dataset_dir, const std::string &name, int32_t num_workers, int32_t queue_size, - std::unique_ptr data_schema, std::shared_ptr sampler); - - /// \brief Destructor. - ~CMUArcticOp() = default; - - /// \brief A print method typically used for debugging. - /// \param[out] out The output stream to write output to. - /// \param[in] show_all A bool to control if you want to show all info or just a summary. - void Print(std::ostream &out, bool show_all) const override; - - /// \brief Function to count the number of samples in the CMUArctic dataset. - /// \param[in] dir Path to the CMUArctic directory. - /// \param[in] name Choose the subset of CMUArctic dataset. - /// \param[out] count Output arg that will hold the minimum of the actual dataset size and numSamples. - /// \return Status The status code returned. - static Status CountTotalRows(const std::string &dir, const std::string &name, int64_t *count); - - /// \brief Op name getter. - /// \return Name of the current Op. - std::string Name() const override { return "CMUArcticOp"; } - - private: - /// \brief Load a tensor row according to a pair. - /// \param[in] row_id Id for this tensor row. - /// \param[out] row Audio & label read into this tensor row. - /// \return Status The status code returned. - Status LoadTensorRow(row_id_type row_id, TensorRow *row) override; - - /// \brief Parse a single wav file. - /// \param[in] audio_dir Audio file path. - /// \param[out] waveform The output waveform tensor. - /// \return Status The status code returned. - Status ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform); - - /// \brief Prepare all data in the directory. - /// \return Status The status code returned. - Status PrepareData(); - - /// \brief Private function for computing the assignment of the column name map. - /// \return Status. - Status ComputeColMap() override; - - const std::string name_; - std::string folder_path_; - std::string real_path_; - std::unique_ptr data_schema_; - std::vector> label_pairs_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CMU_ARCTIC_OP_H_ +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CMU_ARCTIC_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CMU_ARCTIC_OP_H_ + +#include +#include +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/core/tensor.h" +#include "mindspore-lite/minddata/dataset/engine/data_schema.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" +#include "mindspore-lite/minddata/dataset/util/path.h" +#include "mindspore-lite/minddata/dataset/util/queue.h" +#include "mindspore-lite/minddata/dataset/util/status.h" +#include "mindspore-lite/minddata/dataset/util/wait_post.h" + +namespace mindspore::lite { +namespace dataset { +class CMUArcticOp : public MappableLeafOp { + public: + /// \brief Constructor. + /// \param[in] dataset_dir Directory of CMUArctic. + /// \param[in] name Part of this dataset, can be "aew", "ahw", "aup", "awb", "axb", "bdl", + /// "clb", "eey", "fem", "gka", "jmk", "ksp", "ljm", "lnh", "rms", "rxr", "slp" or "slt" + /// \param[in] num_workers Number of workers reading audios in parallel. + /// \param[in] queue_size Connector queue size. + /// \param[in] data_schema The schema of the CMUArctic dataset. + /// \param[in] sampler Sampler tells CMUArcticOp what to read. + CMUArcticOp(const std::string &dataset_dir, const std::string &name, int32_t num_workers, int32_t queue_size, + std::unique_ptr data_schema, std::shared_ptr sampler); + + /// \brief Destructor. + ~CMUArcticOp() = default; + + /// \brief A print method typically used for debugging. + /// \param[out] out The output stream to write output to. + /// \param[in] show_all A bool to control if you want to show all info or just a summary. + void Print(std::ostream &out, bool show_all) const override; + + /// \brief Function to count the number of samples in the CMUArctic dataset. + /// \param[in] dir Path to the CMUArctic directory. + /// \param[in] name Choose the subset of CMUArctic dataset. + /// \param[out] count Output arg that will hold the minimum of the actual dataset size and numSamples. + /// \return Status The status code returned. + static Status CountTotalRows(const std::string &dir, const std::string &name, int64_t *count); + + /// \brief Op name getter. + /// \return Name of the current Op. + std::string Name() const override { return "CMUArcticOp"; } + + private: + /// \brief Load a tensor row according to a pair. + /// \param[in] row_id Id for this tensor row. + /// \param[out] row Audio & label read into this tensor row. + /// \return Status The status code returned. + Status LoadTensorRow(row_id_type row_id, TensorRow *row) override; + + /// \brief Parse a single wav file. + /// \param[in] audio_dir Audio file path. + /// \param[out] waveform The output waveform tensor. + /// \return Status The status code returned. + Status ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform); + + /// \brief Prepare all data in the directory. + /// \return Status The status code returned. + Status PrepareData(); + + /// \brief Private function for computing the assignment of the column name map. + /// \return Status. + Status ComputeColMap() override; + + const std::string name_; + std::string folder_path_; + std::string real_path_; + std::unique_ptr data_schema_; + std::vector> label_pairs_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CMU_ARCTIC_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/coco_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/coco_op.cc index 2ab13b0e38edb359ad824c1a57f8ff2d6dc7c649..a16d1faa49a5ef414e8254b398027aa8b4574f1b 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/coco_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/coco_op.cc @@ -23,7 +23,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const char kJsonImages[] = "images"; const char kJsonImagesFileName[] = "file_name"; @@ -633,4 +633,4 @@ Status CocoOp::GetClassIndexing(std::vector @@ -320,5 +320,5 @@ class CocoOp : public MappableLeafOp { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_COCO_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.cc index 46db1639dc405539d382d852d1b29253cf266bfc..e20996c525a62a7a1578054a62a3dae07d83855e 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/wait_post.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { CoNLL2000Op::CoNLL2000Op(int32_t num_workers, int64_t total_rows, int32_t worker_connector_size, std::unique_ptr schema, const std::vector &conll2000_file_list, @@ -174,4 +174,4 @@ Status CoNLL2000Op::LoadFile(const std::string &file, int64_t start_offset, int6 return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.h index 42b72c1fa8650a240e7083af13a5e727e388634c..cfad6efe52c5857e597c3cb1404f71fef55703f8 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h" #include "mindspore-lite/minddata/dataset/util/queue.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class JaggedConnector; @@ -92,5 +92,5 @@ class CoNLL2000Op : public TextFileOp { Status LoadFile(const std::string &file, int64_t start_offset, int64_t end_offset, int32_t worker_id) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_CONLL2000_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.cc index aa53aa8c69a5706fbd26a6e6a52bb2c26bdb49df..8838feef062e76be1e4d2c639a46fe18ef4ebf16 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { CsvOp::CsvOp(const std::vector &csv_files_list, char field_delim, @@ -818,4 +818,4 @@ bool CsvOp::ColumnNameValidate() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h index 783968b9335ff6190b4773a25c821eedc425b728..1b299c59635ee3ff0dadd993331143db420e00ac 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h" #include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const size_t CSV_BUFFER_SIZE = 4096; @@ -242,5 +242,5 @@ class CsvOp : public NonMappableLeafOp { bool check_flag_ = false; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_DATASETOPS_SOURCE_CSV_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.cc index 73e83d44779f1f414a3142fef42639288f5e44fc..9cf42f9394c278116c4ab4d8b70d9ee387c2f68a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { DBpediaOp::DBpediaOp(const std::vector &dataset_files_list, char field_delim, const std::vector> &column_default, @@ -50,4 +50,4 @@ void DBpediaOp::Print(std::ostream &out, bool show_all) const { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.h index 4b6a15907d8a444d509f393e41ffb3ee77a5a055..9379bf99f5081125b127537eb41f707f7f7d07be 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DBpediaOp : public CsvOp { public: @@ -66,5 +66,5 @@ class DBpediaOp : public CsvOp { std::string Name() const override { return "DBpediaOp"; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_DBPEDIA_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.cc index 6c1f47e437c90806219504c147439b76a3c05806..19aabf9e0730f19282f20aac5876ecd55c5ed24e 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.cc @@ -27,7 +27,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const std::map DatasetPramMap = {{"train_hr", "DIV2K_train_HR"}, {"valid_hr", "DIV2K_valid_HR"}, @@ -268,4 +268,4 @@ Status DIV2KOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.h index d4850ac92989c68fd477e21114e5001e377b4f0a..dc3a8d8172a044733e53658a1fa29b6a240d339c 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.h @@ -34,7 +34,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DIV2KOp : public MappableLeafOp { public: @@ -118,5 +118,5 @@ class DIV2KOp : public MappableLeafOp { std::string lr_dir_real_name_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_DIV2K_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.cc index 49f2b9d3bfee95dc7565d93e1174f5fbae2b7f1f..a0b2a013dbfe6c7b68f415affb54eed0f92177d1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.cc @@ -25,7 +25,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { EMnistOp::EMnistOp(const std::string &name, const std::string &usage, int32_t num_workers, const std::string &folder_path, int32_t queue_size, std::unique_ptr data_schema, @@ -143,4 +143,4 @@ Status EMnistOp::CountTotalRows(const std::string &dir, const std::string &name, return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.h index 559791b54b894622012acc9d390c89215eee2e59..554ea17fe58eb891032da185899abced564dca20 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -80,5 +80,5 @@ class EMnistOp : public MnistOp { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_EMNIST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.cc index bdf6b04c96da58281cb72122ed97c567ec28fe1f..717bd6c485beaa3513f7e769f09e160f05641b1a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.cc @@ -21,7 +21,7 @@ #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { EnWik9Op::EnWik9Op(int32_t num_workers, int64_t total_rows, int32_t worker_connector_size, std::unique_ptr data_schema, const std::vector &file_list, @@ -125,4 +125,4 @@ int64_t EnWik9Op::CountTotalRows(const std::string &file) { return count; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.h index 13893c89c038f6d467841e36b246f4bd2dd09b1a..9f206bff1e6dc737ac7074d0a508227ae46a2171 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class EnWik9Op : public TextFileOp { public: @@ -73,5 +73,5 @@ class EnWik9Op : public TextFileOp { int64_t CountTotalRows(const std::string &file) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_EN_WIK9_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.cc index 8c5231f1ced4f15c67695da8587e8751599e5d23..207c577da7dd0579b05f4225e0a32e61569dfaa4 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { FakeImageOp::FakeImageOp(int32_t num_images, const std::vector &image_size, int32_t num_classes, int32_t base_seed, int32_t num_workers, int32_t op_connector_size, @@ -141,4 +141,4 @@ Status FakeImageOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.h index 3f266bdedbf0bfaf4ca74e054018d5d2ec2e32d5..44ea00b45139983e8b7bcaab7c0dbfedbc50fab8 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.h @@ -34,7 +34,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class FakeImageOp : public MappableLeafOp { @@ -107,5 +107,5 @@ class FakeImageOp : public MappableLeafOp { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_FAKE_IMAGE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.cc index 3372b9685a79b8e52e2879343171fc054bcaa8e9..d57a14f8f94529cd283a483a0ab103a74f24114a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { FashionMnistOp::FashionMnistOp(const std::string &usage, int32_t num_workers, const std::string &folder_path, int32_t queue_size, std::unique_ptr data_schema, @@ -88,4 +88,4 @@ Status FashionMnistOp::CountTotalRows(const std::string &dir, const std::string return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.h index f6c54c4066dfe52d52fb5013c20ea3039fd616a9..81eaa55fc4f73fb8bf19a33b6e207bd4654793a6 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Forward declares. template @@ -63,5 +63,5 @@ class FashionMnistOp : public MnistOp { std::string DatasetName(bool upper = false) const override { return upper ? "FashionMnist" : "fashion mnist"; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_FASHION_MNIST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/flickr_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/flickr_op.cc index 1fb71933055d8ca28ed1bf5a7a200aa152001719..88b5ac8cecb4fa000a6088a524f3ea6056c490c4 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/flickr_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/flickr_op.cc @@ -27,7 +27,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { FlickrOp::FlickrOp(int32_t num_workers, const std::string &dataset_dir, const std::string &file_path, bool decode, int32_t queue_size, std::unique_ptr data_schema, std::shared_ptr sampler) @@ -236,4 +236,4 @@ Status FlickrOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/flickr_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/flickr_op.h index 52cf903fd1be2a9be5280e6ffd733565f5f8b418..152432e4125a22f71c2014923f24c3a68f5158f3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/flickr_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/flickr_op.h @@ -34,7 +34,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class FlickrOp : public MappableLeafOp { public: @@ -100,5 +100,5 @@ class FlickrOp : public MappableLeafOp { std::vector>> image_annotation_pairs_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_FLICKR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/food101_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/food101_op.cc index 07eaac11d5e5458611ed62398a8113a62f5007ec..e6e310933c71c7bb7d05e9698a2b1d74641d41b7 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/food101_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/food101_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Food101Op::Food101Op(const std::string &folder_path, const std::string &usage, int32_t num_workers, int32_t queue_size, bool decode, std::unique_ptr data_schema, std::shared_ptr sampler) @@ -161,4 +161,4 @@ Status Food101Op::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/food101_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/food101_op.h index c7d9581d3c4e241dff0c2e7e503befb38e10c97b..128b20f747656686cba07a62380905d3a9a0b4de 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/food101_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/food101_op.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/util/queue.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Food101Op : public MappableLeafOp { public: @@ -97,5 +97,5 @@ class Food101Op : public MappableLeafOp { std::map> annotation_map_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_FOOD101_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/generator_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/generator_op.cc index 8eada8750fe7367669838a465722b30758eb9544..eb581b63c819527d40a0e4a59d47fae27384f59a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/generator_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/generator_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { GeneratorOp::GeneratorOp(const py::function &generator_function, std::vector column_names, std::vector column_types, int32_t prefetch_size, int32_t connector_size, @@ -549,4 +549,4 @@ Status GeneratorOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/generator_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/generator_op.h index eeb90163c4789195e07779a64f6bb9edde7fefc6..31da965affb82d00e9c5503d7ef9760b12c65512 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/generator_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/generator_op.h @@ -35,7 +35,7 @@ namespace py = pybind11; -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifndef _MSC_VER #pragma GCC visibility push(hidden) @@ -180,6 +180,6 @@ class GeneratorOp : public PipelineOp, public RandomAccessOp { #pragma GCC visibility pop #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_GENERATOR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.cc index 4d107f98de5a23814255a48931418d43f1b847e1..16095a6324bc5a2d0c2bca326f12fd202fc558b3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.cc @@ -1,335 +1,335 @@ -/** - * Copyright 2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.h" - -#include -#include - -#include "mindspore-lite/minddata/dataset/audio/kernels/audio_utils.h" -#include "mindspore-lite/minddata/dataset/core/config_manager.h" -#include "mindspore-lite/minddata/dataset/core/tensor_shape.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" -#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -#include "utils/file_utils.h" - -namespace mindspore { -namespace dataset { -const std::vector genres = { - "blues", "classical", "country", "disco", "hiphop", "jazz", "metal", "pop", "reggae", "rock", -}; - -const std::vector filtered_test = { - "blues.00012", "blues.00013", "blues.00014", "blues.00015", "blues.00016", "blues.00017", - "blues.00018", "blues.00019", "blues.00020", "blues.00021", "blues.00022", "blues.00023", - "blues.00024", "blues.00025", "blues.00026", "blues.00027", "blues.00028", "blues.00061", - "blues.00062", "blues.00063", "blues.00064", "blues.00065", "blues.00066", "blues.00067", - "blues.00068", "blues.00069", "blues.00070", "blues.00071", "blues.00072", "blues.00098", - "blues.00099", "classical.00011", "classical.00012", "classical.00013", "classical.00014", "classical.00015", - "classical.00016", "classical.00017", "classical.00018", "classical.00019", "classical.00020", "classical.00021", - "classical.00022", "classical.00023", "classical.00024", "classical.00025", "classical.00026", "classical.00027", - "classical.00028", "classical.00029", "classical.00034", "classical.00035", "classical.00036", "classical.00037", - "classical.00038", "classical.00039", "classical.00040", "classical.00041", "classical.00049", "classical.00077", - "classical.00078", "classical.00079", "country.00030", "country.00031", "country.00032", "country.00033", - "country.00034", "country.00035", "country.00036", "country.00037", "country.00038", "country.00039", - "country.00040", "country.00043", "country.00044", "country.00046", "country.00047", "country.00048", - "country.00050", "country.00051", "country.00053", "country.00054", "country.00055", "country.00056", - "country.00057", "country.00058", "country.00059", "country.00060", "country.00061", "country.00062", - "country.00063", "country.00064", "disco.00001", "disco.00021", "disco.00058", "disco.00062", - "disco.00063", "disco.00064", "disco.00065", "disco.00066", "disco.00069", "disco.00076", - "disco.00077", "disco.00078", "disco.00079", "disco.00080", "disco.00081", "disco.00082", - "disco.00083", "disco.00084", "disco.00085", "disco.00086", "disco.00087", "disco.00088", - "disco.00091", "disco.00092", "disco.00093", "disco.00094", "disco.00096", "disco.00097", - "disco.00099", "hiphop.00000", "hiphop.00026", "hiphop.00027", "hiphop.00030", "hiphop.00040", - "hiphop.00043", "hiphop.00044", "hiphop.00045", "hiphop.00051", "hiphop.00052", "hiphop.00053", - "hiphop.00054", "hiphop.00062", "hiphop.00063", "hiphop.00064", "hiphop.00065", "hiphop.00066", - "hiphop.00067", "hiphop.00068", "hiphop.00069", "hiphop.00070", "hiphop.00071", "hiphop.00072", - "hiphop.00073", "hiphop.00074", "hiphop.00075", "hiphop.00099", "jazz.00073", "jazz.00074", - "jazz.00075", "jazz.00076", "jazz.00077", "jazz.00078", "jazz.00079", "jazz.00080", - "jazz.00081", "jazz.00082", "jazz.00083", "jazz.00084", "jazz.00085", "jazz.00086", - "jazz.00087", "jazz.00088", "jazz.00089", "jazz.00090", "jazz.00091", "jazz.00092", - "jazz.00093", "jazz.00094", "jazz.00095", "jazz.00096", "jazz.00097", "jazz.00098", - "jazz.00099", "metal.00012", "metal.00013", "metal.00014", "metal.00015", "metal.00022", - "metal.00023", "metal.00025", "metal.00026", "metal.00027", "metal.00028", "metal.00029", - "metal.00030", "metal.00031", "metal.00032", "metal.00033", "metal.00038", "metal.00039", - "metal.00067", "metal.00070", "metal.00073", "metal.00074", "metal.00075", "metal.00078", - "metal.00083", "metal.00085", "metal.00087", "metal.00088", "pop.00000", "pop.00001", - "pop.00013", "pop.00014", "pop.00043", "pop.00063", "pop.00064", "pop.00065", - "pop.00066", "pop.00069", "pop.00070", "pop.00071", "pop.00072", "pop.00073", - "pop.00074", "pop.00075", "pop.00076", "pop.00077", "pop.00078", "pop.00079", - "pop.00082", "pop.00088", "pop.00089", "pop.00090", "pop.00091", "pop.00092", - "pop.00093", "pop.00094", "pop.00095", "pop.00096", "reggae.00034", "reggae.00035", - "reggae.00036", "reggae.00037", "reggae.00038", "reggae.00039", "reggae.00040", "reggae.00046", - "reggae.00047", "reggae.00048", "reggae.00052", "reggae.00053", "reggae.00064", "reggae.00065", - "reggae.00066", "reggae.00067", "reggae.00068", "reggae.00071", "reggae.00079", "reggae.00082", - "reggae.00083", "reggae.00084", "reggae.00087", "reggae.00088", "reggae.00089", "reggae.00090", - "rock.00010", "rock.00011", "rock.00012", "rock.00013", "rock.00014", "rock.00015", - "rock.00027", "rock.00028", "rock.00029", "rock.00030", "rock.00031", "rock.00032", - "rock.00033", "rock.00034", "rock.00035", "rock.00036", "rock.00037", "rock.00039", - "rock.00040", "rock.00041", "rock.00042", "rock.00043", "rock.00044", "rock.00045", - "rock.00046", "rock.00047", "rock.00048", "rock.00086", "rock.00087", "rock.00088", - "rock.00089", "rock.00090", -}; - -const std::vector filtered_train = { - "blues.00029", "blues.00030", "blues.00031", "blues.00032", "blues.00033", "blues.00034", - "blues.00035", "blues.00036", "blues.00037", "blues.00038", "blues.00039", "blues.00040", - "blues.00041", "blues.00042", "blues.00043", "blues.00044", "blues.00045", "blues.00046", - "blues.00047", "blues.00048", "blues.00049", "blues.00073", "blues.00074", "blues.00075", - "blues.00076", "blues.00077", "blues.00078", "blues.00079", "blues.00080", "blues.00081", - "blues.00082", "blues.00083", "blues.00084", "blues.00085", "blues.00086", "blues.00087", - "blues.00088", "blues.00089", "blues.00090", "blues.00091", "blues.00092", "blues.00093", - "blues.00094", "blues.00095", "blues.00096", "blues.00097", "classical.00030", "classical.00031", - "classical.00032", "classical.00033", "classical.00043", "classical.00044", "classical.00045", "classical.00046", - "classical.00047", "classical.00048", "classical.00050", "classical.00051", "classical.00052", "classical.00053", - "classical.00054", "classical.00055", "classical.00056", "classical.00057", "classical.00058", "classical.00059", - "classical.00060", "classical.00061", "classical.00062", "classical.00063", "classical.00064", "classical.00065", - "classical.00066", "classical.00067", "classical.00080", "classical.00081", "classical.00082", "classical.00083", - "classical.00084", "classical.00085", "classical.00086", "classical.00087", "classical.00088", "classical.00089", - "classical.00090", "classical.00091", "classical.00092", "classical.00093", "classical.00094", "classical.00095", - "classical.00096", "classical.00097", "classical.00098", "classical.00099", "country.00019", "country.00020", - "country.00021", "country.00022", "country.00023", "country.00024", "country.00025", "country.00026", - "country.00028", "country.00029", "country.00065", "country.00066", "country.00067", "country.00068", - "country.00069", "country.00070", "country.00071", "country.00072", "country.00073", "country.00074", - "country.00075", "country.00076", "country.00077", "country.00078", "country.00079", "country.00080", - "country.00081", "country.00082", "country.00083", "country.00084", "country.00085", "country.00086", - "country.00087", "country.00088", "country.00089", "country.00090", "country.00091", "country.00092", - "country.00093", "country.00094", "country.00095", "country.00096", "country.00097", "country.00098", - "country.00099", "disco.00005", "disco.00015", "disco.00016", "disco.00017", "disco.00018", - "disco.00019", "disco.00020", "disco.00022", "disco.00023", "disco.00024", "disco.00025", - "disco.00026", "disco.00027", "disco.00028", "disco.00029", "disco.00030", "disco.00031", - "disco.00032", "disco.00033", "disco.00034", "disco.00035", "disco.00036", "disco.00037", - "disco.00039", "disco.00040", "disco.00041", "disco.00042", "disco.00043", "disco.00044", - "disco.00045", "disco.00047", "disco.00049", "disco.00053", "disco.00054", "disco.00056", - "disco.00057", "disco.00059", "disco.00061", "disco.00070", "disco.00073", "disco.00074", - "disco.00089", "hiphop.00002", "hiphop.00003", "hiphop.00004", "hiphop.00005", "hiphop.00006", - "hiphop.00007", "hiphop.00008", "hiphop.00009", "hiphop.00010", "hiphop.00011", "hiphop.00012", - "hiphop.00013", "hiphop.00014", "hiphop.00015", "hiphop.00016", "hiphop.00017", "hiphop.00018", - "hiphop.00019", "hiphop.00020", "hiphop.00021", "hiphop.00022", "hiphop.00023", "hiphop.00024", - "hiphop.00025", "hiphop.00028", "hiphop.00029", "hiphop.00031", "hiphop.00032", "hiphop.00033", - "hiphop.00034", "hiphop.00035", "hiphop.00036", "hiphop.00037", "hiphop.00038", "hiphop.00041", - "hiphop.00042", "hiphop.00055", "hiphop.00056", "hiphop.00057", "hiphop.00058", "hiphop.00059", - "hiphop.00060", "hiphop.00061", "hiphop.00077", "hiphop.00078", "hiphop.00079", "hiphop.00080", - "jazz.00000", "jazz.00001", "jazz.00011", "jazz.00012", "jazz.00013", "jazz.00014", - "jazz.00015", "jazz.00016", "jazz.00017", "jazz.00018", "jazz.00019", "jazz.00020", - "jazz.00021", "jazz.00022", "jazz.00023", "jazz.00024", "jazz.00041", "jazz.00047", - "jazz.00048", "jazz.00049", "jazz.00050", "jazz.00051", "jazz.00052", "jazz.00053", - "jazz.00054", "jazz.00055", "jazz.00056", "jazz.00057", "jazz.00058", "jazz.00059", - "jazz.00060", "jazz.00061", "jazz.00062", "jazz.00063", "jazz.00064", "jazz.00065", - "jazz.00066", "jazz.00067", "jazz.00068", "jazz.00069", "jazz.00070", "jazz.00071", - "jazz.00072", "metal.00002", "metal.00003", "metal.00005", "metal.00021", "metal.00024", - "metal.00035", "metal.00046", "metal.00047", "metal.00048", "metal.00049", "metal.00050", - "metal.00051", "metal.00052", "metal.00053", "metal.00054", "metal.00055", "metal.00056", - "metal.00057", "metal.00059", "metal.00060", "metal.00061", "metal.00062", "metal.00063", - "metal.00064", "metal.00065", "metal.00066", "metal.00069", "metal.00071", "metal.00072", - "metal.00079", "metal.00080", "metal.00084", "metal.00086", "metal.00089", "metal.00090", - "metal.00091", "metal.00092", "metal.00093", "metal.00094", "metal.00095", "metal.00096", - "metal.00097", "metal.00098", "metal.00099", "pop.00002", "pop.00003", "pop.00004", - "pop.00005", "pop.00006", "pop.00007", "pop.00008", "pop.00009", "pop.00011", - "pop.00012", "pop.00016", "pop.00017", "pop.00018", "pop.00019", "pop.00020", - "pop.00023", "pop.00024", "pop.00025", "pop.00026", "pop.00027", "pop.00028", - "pop.00029", "pop.00031", "pop.00032", "pop.00033", "pop.00034", "pop.00035", - "pop.00036", "pop.00038", "pop.00039", "pop.00040", "pop.00041", "pop.00042", - "pop.00044", "pop.00046", "pop.00049", "pop.00050", "pop.00080", "pop.00097", - "pop.00098", "pop.00099", "reggae.00000", "reggae.00001", "reggae.00002", "reggae.00004", - "reggae.00006", "reggae.00009", "reggae.00011", "reggae.00012", "reggae.00014", "reggae.00015", - "reggae.00016", "reggae.00017", "reggae.00018", "reggae.00019", "reggae.00020", "reggae.00021", - "reggae.00022", "reggae.00023", "reggae.00024", "reggae.00025", "reggae.00026", "reggae.00027", - "reggae.00028", "reggae.00029", "reggae.00030", "reggae.00031", "reggae.00032", "reggae.00042", - "reggae.00043", "reggae.00044", "reggae.00045", "reggae.00049", "reggae.00050", "reggae.00051", - "reggae.00054", "reggae.00055", "reggae.00056", "reggae.00057", "reggae.00058", "reggae.00059", - "reggae.00060", "reggae.00063", "reggae.00069", "rock.00000", "rock.00001", "rock.00002", - "rock.00003", "rock.00004", "rock.00005", "rock.00006", "rock.00007", "rock.00008", - "rock.00009", "rock.00016", "rock.00017", "rock.00018", "rock.00019", "rock.00020", - "rock.00021", "rock.00022", "rock.00023", "rock.00024", "rock.00025", "rock.00026", - "rock.00057", "rock.00058", "rock.00059", "rock.00060", "rock.00061", "rock.00062", - "rock.00063", "rock.00064", "rock.00065", "rock.00066", "rock.00067", "rock.00068", - "rock.00069", "rock.00070", "rock.00091", "rock.00092", "rock.00093", "rock.00094", - "rock.00095", "rock.00096", "rock.00097", "rock.00098", "rock.00099", -}; - -const std::vector filtered_valid = { - "blues.00000", "blues.00001", "blues.00002", "blues.00003", "blues.00004", "blues.00005", - "blues.00006", "blues.00007", "blues.00008", "blues.00009", "blues.00010", "blues.00011", - "blues.00050", "blues.00051", "blues.00052", "blues.00053", "blues.00054", "blues.00055", - "blues.00056", "blues.00057", "blues.00058", "blues.00059", "blues.00060", "classical.00000", - "classical.00001", "classical.00002", "classical.00003", "classical.00004", "classical.00005", "classical.00006", - "classical.00007", "classical.00008", "classical.00009", "classical.00010", "classical.00068", "classical.00069", - "classical.00070", "classical.00071", "classical.00072", "classical.00073", "classical.00074", "classical.00075", - "classical.00076", "country.00000", "country.00001", "country.00002", "country.00003", "country.00004", - "country.00005", "country.00006", "country.00007", "country.00009", "country.00010", "country.00011", - "country.00012", "country.00013", "country.00014", "country.00015", "country.00016", "country.00017", - "country.00018", "country.00027", "country.00041", "country.00042", "country.00045", "country.00049", - "disco.00000", "disco.00002", "disco.00003", "disco.00004", "disco.00006", "disco.00007", - "disco.00008", "disco.00009", "disco.00010", "disco.00011", "disco.00012", "disco.00013", - "disco.00014", "disco.00046", "disco.00048", "disco.00052", "disco.00067", "disco.00068", - "disco.00072", "disco.00075", "disco.00090", "disco.00095", "hiphop.00081", "hiphop.00082", - "hiphop.00083", "hiphop.00084", "hiphop.00085", "hiphop.00086", "hiphop.00087", "hiphop.00088", - "hiphop.00089", "hiphop.00090", "hiphop.00091", "hiphop.00092", "hiphop.00093", "hiphop.00094", - "hiphop.00095", "hiphop.00096", "hiphop.00097", "hiphop.00098", "jazz.00002", "jazz.00003", - "jazz.00004", "jazz.00005", "jazz.00006", "jazz.00007", "jazz.00008", "jazz.00009", - "jazz.00010", "jazz.00025", "jazz.00026", "jazz.00027", "jazz.00028", "jazz.00029", - "jazz.00030", "jazz.00031", "jazz.00032", "metal.00000", "metal.00001", "metal.00006", - "metal.00007", "metal.00008", "metal.00009", "metal.00010", "metal.00011", "metal.00016", - "metal.00017", "metal.00018", "metal.00019", "metal.00020", "metal.00036", "metal.00037", - "metal.00068", "metal.00076", "metal.00077", "metal.00081", "metal.00082", "pop.00010", - "pop.00053", "pop.00055", "pop.00058", "pop.00059", "pop.00060", "pop.00061", - "pop.00062", "pop.00081", "pop.00083", "pop.00084", "pop.00085", "pop.00086", - "reggae.00061", "reggae.00062", "reggae.00070", "reggae.00072", "reggae.00074", "reggae.00076", - "reggae.00077", "reggae.00078", "reggae.00085", "reggae.00092", "reggae.00093", "reggae.00094", - "reggae.00095", "reggae.00096", "reggae.00097", "reggae.00098", "reggae.00099", "rock.00038", - "rock.00049", "rock.00050", "rock.00051", "rock.00052", "rock.00053", "rock.00054", - "rock.00055", "rock.00056", "rock.00071", "rock.00072", "rock.00073", "rock.00074", - "rock.00075", "rock.00076", "rock.00077", "rock.00078", "rock.00079", "rock.00080", - "rock.00081", "rock.00082", "rock.00083", "rock.00084", "rock.00085", -}; - -GTZANOp::GTZANOp(const std::string &usage, int32_t num_workers, const std::string &folder_path, int32_t queue_size, - std::unique_ptr data_schema, std::shared_ptr sampler) - : MappableLeafOp(num_workers, queue_size, std::move(sampler)), - usage_(usage), - folder_path_(folder_path), - data_schema_(std::move(data_schema)) {} - -Status GTZANOp::LoadTensorRow(row_id_type row_id, TensorRow *trow) { - RETURN_UNEXPECTED_IF_NULL(trow); - const uint32_t sample_rate = 22050; - std::shared_ptr waveform, rate, label; - RETURN_IF_NOT_OK(ReadAudio(audio_names_[row_id].first, &waveform)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(sample_rate, &rate)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_names_[row_id].second, &label)); - (*trow) = TensorRow(row_id, {std::move(waveform), std::move(rate), std::move(label)}); - trow->setPath({audio_names_[row_id].first, audio_names_[row_id].first, audio_names_[row_id].first}); - return Status::OK(); -} - -void GTZANOp::Print(std::ostream &out, bool show_all) const { - if (!show_all) { - ParallelOp::Print(out, show_all); - out << "\n"; - return; - } - ParallelOp::Print(out, show_all); - out << "\nNumber of rows: " << num_rows_ << "\nGTZAN directory: " << folder_path_ << "\n\n"; -} - -Status GTZANOp::CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count) { - RETURN_UNEXPECTED_IF_NULL(count); - *count = 0; - const int64_t num_samples = 0; - const int64_t start_index = 0; - auto sampler = std::make_shared(start_index, num_samples); - auto schema = std::make_unique(); - - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); - TensorShape scalar_rate = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); - TensorShape scalar_label = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK( - schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_label))); - - std::shared_ptr cfg = GlobalContext::config_manager(); - int32_t num_workers = cfg->num_parallel_workers(); - int32_t op_connect_size = cfg->op_connector_size(); - auto op = std::make_shared(usage, num_workers, dir, op_connect_size, std::move(schema), std::move(sampler)); - RETURN_IF_NOT_OK(op->PrepareData()); - *count = op->audio_names_.size(); - return Status::OK(); -} - -Status GTZANOp::ComputeColMap() { - if (column_name_id_map_.empty()) { - for (int32_t i = 0; i < data_schema_->NumColumns(); ++i) { - column_name_id_map_[data_schema_->Column(i).Name()] = i; - } - } else { - MS_LOG(WARNING) << "Column name map is already set!"; - } - return Status::OK(); -} - -Status GTZANOp::ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform) { - RETURN_UNEXPECTED_IF_NULL(waveform); - const int32_t kWavFileSampleRate = 22050; - int32_t sample_rate = 0; - std::vector waveform_vec; - RETURN_IF_NOT_OK(ReadWaveFile(audio_dir, &waveform_vec, &sample_rate)); - CHECK_FAIL_RETURN_UNEXPECTED(sample_rate == kWavFileSampleRate, - "Invalid file, sampling rate of GTZAN wav file must be 22050, file path: " + audio_dir); - RETURN_IF_NOT_OK(Tensor::CreateFromVector(waveform_vec, waveform)); - RETURN_IF_NOT_OK((*waveform)->ExpandDim(0)); - return Status::OK(); -} - -Status GTZANOp::PrepareData() { - auto realpath = FileUtils::GetRealPath(folder_path_.c_str()); - if (!realpath.has_value()) { - MS_LOG(ERROR) << "Invalid file path, GTZAN Dataset dir: " << folder_path_ << " does not exist."; - RETURN_STATUS_UNEXPECTED("Invalid file path, GTZAN Dataset dir: " + folder_path_ + " does not exist."); - } - Path dir(folder_path_); - - if (usage_ == "all") { - for (std::string sub_directory : genres) { - Path full_dir = dir / sub_directory; - if (!full_dir.Exists() || !full_dir.IsDirectory()) { - continue; - } - auto dir_it = Path::DirIterator::OpenDirectory(&full_dir); - if (dir_it != nullptr) { - while (dir_it->HasNext()) { - Path file = dir_it->Next(); - std::string file_name = file.ToString(); - auto pos = file_name.find_last_of('.'); - std::string name = file_name.substr(0, pos), temp_ext = file_name.substr(pos); - if (temp_ext == ".wav" && name.find('.') != std::string::npos) { - audio_names_.push_back({file.ToString(), sub_directory}); - } else { - MS_LOG(WARNING) << "Invalid file, invalid file name or file type: " << file.ToString() << "."; - } - } - } else { - MS_LOG(WARNING) << "Invalid file path, unable to open directory: " << full_dir.ToString() << "."; - } - } - } else { - const std::vector *files_point = nullptr; - if (usage_ == "test") { - files_point = &filtered_test; - } else if (usage_ == "train") { - files_point = &filtered_train; - } else { - files_point = &filtered_valid; - } - std::string ext = ".wav"; - for (auto sub_file_name : *files_point) { - auto pos = sub_file_name.find_first_of('.'); - std::string cls = sub_file_name.substr(0, pos); - Path full_dir = dir / cls / (sub_file_name + ext); - if (full_dir.Exists()) { - audio_names_.push_back({full_dir.ToString(), cls}); - } else { - MS_LOG(WARNING) << "The audio file is lost, file name= " << (sub_file_name + ext); - } - } - } - num_rows_ = audio_names_.size(); - CHECK_FAIL_RETURN_UNEXPECTED(num_rows_ > 0, "Invalid data, no valid data found in path:" + folder_path_); - return Status::OK(); -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.h" + +#include +#include + +#include "mindspore-lite/minddata/dataset/audio/kernels/audio_utils.h" +#include "mindspore-lite/minddata/dataset/core/config_manager.h" +#include "mindspore-lite/minddata/dataset/core/tensor_shape.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" +#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" +#include "utils/file_utils.h" + +namespace mindspore::lite { +namespace dataset { +const std::vector genres = { + "blues", "classical", "country", "disco", "hiphop", "jazz", "metal", "pop", "reggae", "rock", +}; + +const std::vector filtered_test = { + "blues.00012", "blues.00013", "blues.00014", "blues.00015", "blues.00016", "blues.00017", + "blues.00018", "blues.00019", "blues.00020", "blues.00021", "blues.00022", "blues.00023", + "blues.00024", "blues.00025", "blues.00026", "blues.00027", "blues.00028", "blues.00061", + "blues.00062", "blues.00063", "blues.00064", "blues.00065", "blues.00066", "blues.00067", + "blues.00068", "blues.00069", "blues.00070", "blues.00071", "blues.00072", "blues.00098", + "blues.00099", "classical.00011", "classical.00012", "classical.00013", "classical.00014", "classical.00015", + "classical.00016", "classical.00017", "classical.00018", "classical.00019", "classical.00020", "classical.00021", + "classical.00022", "classical.00023", "classical.00024", "classical.00025", "classical.00026", "classical.00027", + "classical.00028", "classical.00029", "classical.00034", "classical.00035", "classical.00036", "classical.00037", + "classical.00038", "classical.00039", "classical.00040", "classical.00041", "classical.00049", "classical.00077", + "classical.00078", "classical.00079", "country.00030", "country.00031", "country.00032", "country.00033", + "country.00034", "country.00035", "country.00036", "country.00037", "country.00038", "country.00039", + "country.00040", "country.00043", "country.00044", "country.00046", "country.00047", "country.00048", + "country.00050", "country.00051", "country.00053", "country.00054", "country.00055", "country.00056", + "country.00057", "country.00058", "country.00059", "country.00060", "country.00061", "country.00062", + "country.00063", "country.00064", "disco.00001", "disco.00021", "disco.00058", "disco.00062", + "disco.00063", "disco.00064", "disco.00065", "disco.00066", "disco.00069", "disco.00076", + "disco.00077", "disco.00078", "disco.00079", "disco.00080", "disco.00081", "disco.00082", + "disco.00083", "disco.00084", "disco.00085", "disco.00086", "disco.00087", "disco.00088", + "disco.00091", "disco.00092", "disco.00093", "disco.00094", "disco.00096", "disco.00097", + "disco.00099", "hiphop.00000", "hiphop.00026", "hiphop.00027", "hiphop.00030", "hiphop.00040", + "hiphop.00043", "hiphop.00044", "hiphop.00045", "hiphop.00051", "hiphop.00052", "hiphop.00053", + "hiphop.00054", "hiphop.00062", "hiphop.00063", "hiphop.00064", "hiphop.00065", "hiphop.00066", + "hiphop.00067", "hiphop.00068", "hiphop.00069", "hiphop.00070", "hiphop.00071", "hiphop.00072", + "hiphop.00073", "hiphop.00074", "hiphop.00075", "hiphop.00099", "jazz.00073", "jazz.00074", + "jazz.00075", "jazz.00076", "jazz.00077", "jazz.00078", "jazz.00079", "jazz.00080", + "jazz.00081", "jazz.00082", "jazz.00083", "jazz.00084", "jazz.00085", "jazz.00086", + "jazz.00087", "jazz.00088", "jazz.00089", "jazz.00090", "jazz.00091", "jazz.00092", + "jazz.00093", "jazz.00094", "jazz.00095", "jazz.00096", "jazz.00097", "jazz.00098", + "jazz.00099", "metal.00012", "metal.00013", "metal.00014", "metal.00015", "metal.00022", + "metal.00023", "metal.00025", "metal.00026", "metal.00027", "metal.00028", "metal.00029", + "metal.00030", "metal.00031", "metal.00032", "metal.00033", "metal.00038", "metal.00039", + "metal.00067", "metal.00070", "metal.00073", "metal.00074", "metal.00075", "metal.00078", + "metal.00083", "metal.00085", "metal.00087", "metal.00088", "pop.00000", "pop.00001", + "pop.00013", "pop.00014", "pop.00043", "pop.00063", "pop.00064", "pop.00065", + "pop.00066", "pop.00069", "pop.00070", "pop.00071", "pop.00072", "pop.00073", + "pop.00074", "pop.00075", "pop.00076", "pop.00077", "pop.00078", "pop.00079", + "pop.00082", "pop.00088", "pop.00089", "pop.00090", "pop.00091", "pop.00092", + "pop.00093", "pop.00094", "pop.00095", "pop.00096", "reggae.00034", "reggae.00035", + "reggae.00036", "reggae.00037", "reggae.00038", "reggae.00039", "reggae.00040", "reggae.00046", + "reggae.00047", "reggae.00048", "reggae.00052", "reggae.00053", "reggae.00064", "reggae.00065", + "reggae.00066", "reggae.00067", "reggae.00068", "reggae.00071", "reggae.00079", "reggae.00082", + "reggae.00083", "reggae.00084", "reggae.00087", "reggae.00088", "reggae.00089", "reggae.00090", + "rock.00010", "rock.00011", "rock.00012", "rock.00013", "rock.00014", "rock.00015", + "rock.00027", "rock.00028", "rock.00029", "rock.00030", "rock.00031", "rock.00032", + "rock.00033", "rock.00034", "rock.00035", "rock.00036", "rock.00037", "rock.00039", + "rock.00040", "rock.00041", "rock.00042", "rock.00043", "rock.00044", "rock.00045", + "rock.00046", "rock.00047", "rock.00048", "rock.00086", "rock.00087", "rock.00088", + "rock.00089", "rock.00090", +}; + +const std::vector filtered_train = { + "blues.00029", "blues.00030", "blues.00031", "blues.00032", "blues.00033", "blues.00034", + "blues.00035", "blues.00036", "blues.00037", "blues.00038", "blues.00039", "blues.00040", + "blues.00041", "blues.00042", "blues.00043", "blues.00044", "blues.00045", "blues.00046", + "blues.00047", "blues.00048", "blues.00049", "blues.00073", "blues.00074", "blues.00075", + "blues.00076", "blues.00077", "blues.00078", "blues.00079", "blues.00080", "blues.00081", + "blues.00082", "blues.00083", "blues.00084", "blues.00085", "blues.00086", "blues.00087", + "blues.00088", "blues.00089", "blues.00090", "blues.00091", "blues.00092", "blues.00093", + "blues.00094", "blues.00095", "blues.00096", "blues.00097", "classical.00030", "classical.00031", + "classical.00032", "classical.00033", "classical.00043", "classical.00044", "classical.00045", "classical.00046", + "classical.00047", "classical.00048", "classical.00050", "classical.00051", "classical.00052", "classical.00053", + "classical.00054", "classical.00055", "classical.00056", "classical.00057", "classical.00058", "classical.00059", + "classical.00060", "classical.00061", "classical.00062", "classical.00063", "classical.00064", "classical.00065", + "classical.00066", "classical.00067", "classical.00080", "classical.00081", "classical.00082", "classical.00083", + "classical.00084", "classical.00085", "classical.00086", "classical.00087", "classical.00088", "classical.00089", + "classical.00090", "classical.00091", "classical.00092", "classical.00093", "classical.00094", "classical.00095", + "classical.00096", "classical.00097", "classical.00098", "classical.00099", "country.00019", "country.00020", + "country.00021", "country.00022", "country.00023", "country.00024", "country.00025", "country.00026", + "country.00028", "country.00029", "country.00065", "country.00066", "country.00067", "country.00068", + "country.00069", "country.00070", "country.00071", "country.00072", "country.00073", "country.00074", + "country.00075", "country.00076", "country.00077", "country.00078", "country.00079", "country.00080", + "country.00081", "country.00082", "country.00083", "country.00084", "country.00085", "country.00086", + "country.00087", "country.00088", "country.00089", "country.00090", "country.00091", "country.00092", + "country.00093", "country.00094", "country.00095", "country.00096", "country.00097", "country.00098", + "country.00099", "disco.00005", "disco.00015", "disco.00016", "disco.00017", "disco.00018", + "disco.00019", "disco.00020", "disco.00022", "disco.00023", "disco.00024", "disco.00025", + "disco.00026", "disco.00027", "disco.00028", "disco.00029", "disco.00030", "disco.00031", + "disco.00032", "disco.00033", "disco.00034", "disco.00035", "disco.00036", "disco.00037", + "disco.00039", "disco.00040", "disco.00041", "disco.00042", "disco.00043", "disco.00044", + "disco.00045", "disco.00047", "disco.00049", "disco.00053", "disco.00054", "disco.00056", + "disco.00057", "disco.00059", "disco.00061", "disco.00070", "disco.00073", "disco.00074", + "disco.00089", "hiphop.00002", "hiphop.00003", "hiphop.00004", "hiphop.00005", "hiphop.00006", + "hiphop.00007", "hiphop.00008", "hiphop.00009", "hiphop.00010", "hiphop.00011", "hiphop.00012", + "hiphop.00013", "hiphop.00014", "hiphop.00015", "hiphop.00016", "hiphop.00017", "hiphop.00018", + "hiphop.00019", "hiphop.00020", "hiphop.00021", "hiphop.00022", "hiphop.00023", "hiphop.00024", + "hiphop.00025", "hiphop.00028", "hiphop.00029", "hiphop.00031", "hiphop.00032", "hiphop.00033", + "hiphop.00034", "hiphop.00035", "hiphop.00036", "hiphop.00037", "hiphop.00038", "hiphop.00041", + "hiphop.00042", "hiphop.00055", "hiphop.00056", "hiphop.00057", "hiphop.00058", "hiphop.00059", + "hiphop.00060", "hiphop.00061", "hiphop.00077", "hiphop.00078", "hiphop.00079", "hiphop.00080", + "jazz.00000", "jazz.00001", "jazz.00011", "jazz.00012", "jazz.00013", "jazz.00014", + "jazz.00015", "jazz.00016", "jazz.00017", "jazz.00018", "jazz.00019", "jazz.00020", + "jazz.00021", "jazz.00022", "jazz.00023", "jazz.00024", "jazz.00041", "jazz.00047", + "jazz.00048", "jazz.00049", "jazz.00050", "jazz.00051", "jazz.00052", "jazz.00053", + "jazz.00054", "jazz.00055", "jazz.00056", "jazz.00057", "jazz.00058", "jazz.00059", + "jazz.00060", "jazz.00061", "jazz.00062", "jazz.00063", "jazz.00064", "jazz.00065", + "jazz.00066", "jazz.00067", "jazz.00068", "jazz.00069", "jazz.00070", "jazz.00071", + "jazz.00072", "metal.00002", "metal.00003", "metal.00005", "metal.00021", "metal.00024", + "metal.00035", "metal.00046", "metal.00047", "metal.00048", "metal.00049", "metal.00050", + "metal.00051", "metal.00052", "metal.00053", "metal.00054", "metal.00055", "metal.00056", + "metal.00057", "metal.00059", "metal.00060", "metal.00061", "metal.00062", "metal.00063", + "metal.00064", "metal.00065", "metal.00066", "metal.00069", "metal.00071", "metal.00072", + "metal.00079", "metal.00080", "metal.00084", "metal.00086", "metal.00089", "metal.00090", + "metal.00091", "metal.00092", "metal.00093", "metal.00094", "metal.00095", "metal.00096", + "metal.00097", "metal.00098", "metal.00099", "pop.00002", "pop.00003", "pop.00004", + "pop.00005", "pop.00006", "pop.00007", "pop.00008", "pop.00009", "pop.00011", + "pop.00012", "pop.00016", "pop.00017", "pop.00018", "pop.00019", "pop.00020", + "pop.00023", "pop.00024", "pop.00025", "pop.00026", "pop.00027", "pop.00028", + "pop.00029", "pop.00031", "pop.00032", "pop.00033", "pop.00034", "pop.00035", + "pop.00036", "pop.00038", "pop.00039", "pop.00040", "pop.00041", "pop.00042", + "pop.00044", "pop.00046", "pop.00049", "pop.00050", "pop.00080", "pop.00097", + "pop.00098", "pop.00099", "reggae.00000", "reggae.00001", "reggae.00002", "reggae.00004", + "reggae.00006", "reggae.00009", "reggae.00011", "reggae.00012", "reggae.00014", "reggae.00015", + "reggae.00016", "reggae.00017", "reggae.00018", "reggae.00019", "reggae.00020", "reggae.00021", + "reggae.00022", "reggae.00023", "reggae.00024", "reggae.00025", "reggae.00026", "reggae.00027", + "reggae.00028", "reggae.00029", "reggae.00030", "reggae.00031", "reggae.00032", "reggae.00042", + "reggae.00043", "reggae.00044", "reggae.00045", "reggae.00049", "reggae.00050", "reggae.00051", + "reggae.00054", "reggae.00055", "reggae.00056", "reggae.00057", "reggae.00058", "reggae.00059", + "reggae.00060", "reggae.00063", "reggae.00069", "rock.00000", "rock.00001", "rock.00002", + "rock.00003", "rock.00004", "rock.00005", "rock.00006", "rock.00007", "rock.00008", + "rock.00009", "rock.00016", "rock.00017", "rock.00018", "rock.00019", "rock.00020", + "rock.00021", "rock.00022", "rock.00023", "rock.00024", "rock.00025", "rock.00026", + "rock.00057", "rock.00058", "rock.00059", "rock.00060", "rock.00061", "rock.00062", + "rock.00063", "rock.00064", "rock.00065", "rock.00066", "rock.00067", "rock.00068", + "rock.00069", "rock.00070", "rock.00091", "rock.00092", "rock.00093", "rock.00094", + "rock.00095", "rock.00096", "rock.00097", "rock.00098", "rock.00099", +}; + +const std::vector filtered_valid = { + "blues.00000", "blues.00001", "blues.00002", "blues.00003", "blues.00004", "blues.00005", + "blues.00006", "blues.00007", "blues.00008", "blues.00009", "blues.00010", "blues.00011", + "blues.00050", "blues.00051", "blues.00052", "blues.00053", "blues.00054", "blues.00055", + "blues.00056", "blues.00057", "blues.00058", "blues.00059", "blues.00060", "classical.00000", + "classical.00001", "classical.00002", "classical.00003", "classical.00004", "classical.00005", "classical.00006", + "classical.00007", "classical.00008", "classical.00009", "classical.00010", "classical.00068", "classical.00069", + "classical.00070", "classical.00071", "classical.00072", "classical.00073", "classical.00074", "classical.00075", + "classical.00076", "country.00000", "country.00001", "country.00002", "country.00003", "country.00004", + "country.00005", "country.00006", "country.00007", "country.00009", "country.00010", "country.00011", + "country.00012", "country.00013", "country.00014", "country.00015", "country.00016", "country.00017", + "country.00018", "country.00027", "country.00041", "country.00042", "country.00045", "country.00049", + "disco.00000", "disco.00002", "disco.00003", "disco.00004", "disco.00006", "disco.00007", + "disco.00008", "disco.00009", "disco.00010", "disco.00011", "disco.00012", "disco.00013", + "disco.00014", "disco.00046", "disco.00048", "disco.00052", "disco.00067", "disco.00068", + "disco.00072", "disco.00075", "disco.00090", "disco.00095", "hiphop.00081", "hiphop.00082", + "hiphop.00083", "hiphop.00084", "hiphop.00085", "hiphop.00086", "hiphop.00087", "hiphop.00088", + "hiphop.00089", "hiphop.00090", "hiphop.00091", "hiphop.00092", "hiphop.00093", "hiphop.00094", + "hiphop.00095", "hiphop.00096", "hiphop.00097", "hiphop.00098", "jazz.00002", "jazz.00003", + "jazz.00004", "jazz.00005", "jazz.00006", "jazz.00007", "jazz.00008", "jazz.00009", + "jazz.00010", "jazz.00025", "jazz.00026", "jazz.00027", "jazz.00028", "jazz.00029", + "jazz.00030", "jazz.00031", "jazz.00032", "metal.00000", "metal.00001", "metal.00006", + "metal.00007", "metal.00008", "metal.00009", "metal.00010", "metal.00011", "metal.00016", + "metal.00017", "metal.00018", "metal.00019", "metal.00020", "metal.00036", "metal.00037", + "metal.00068", "metal.00076", "metal.00077", "metal.00081", "metal.00082", "pop.00010", + "pop.00053", "pop.00055", "pop.00058", "pop.00059", "pop.00060", "pop.00061", + "pop.00062", "pop.00081", "pop.00083", "pop.00084", "pop.00085", "pop.00086", + "reggae.00061", "reggae.00062", "reggae.00070", "reggae.00072", "reggae.00074", "reggae.00076", + "reggae.00077", "reggae.00078", "reggae.00085", "reggae.00092", "reggae.00093", "reggae.00094", + "reggae.00095", "reggae.00096", "reggae.00097", "reggae.00098", "reggae.00099", "rock.00038", + "rock.00049", "rock.00050", "rock.00051", "rock.00052", "rock.00053", "rock.00054", + "rock.00055", "rock.00056", "rock.00071", "rock.00072", "rock.00073", "rock.00074", + "rock.00075", "rock.00076", "rock.00077", "rock.00078", "rock.00079", "rock.00080", + "rock.00081", "rock.00082", "rock.00083", "rock.00084", "rock.00085", +}; + +GTZANOp::GTZANOp(const std::string &usage, int32_t num_workers, const std::string &folder_path, int32_t queue_size, + std::unique_ptr data_schema, std::shared_ptr sampler) + : MappableLeafOp(num_workers, queue_size, std::move(sampler)), + usage_(usage), + folder_path_(folder_path), + data_schema_(std::move(data_schema)) {} + +Status GTZANOp::LoadTensorRow(row_id_type row_id, TensorRow *trow) { + RETURN_UNEXPECTED_IF_NULL(trow); + const uint32_t sample_rate = 22050; + std::shared_ptr waveform, rate, label; + RETURN_IF_NOT_OK(ReadAudio(audio_names_[row_id].first, &waveform)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(sample_rate, &rate)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_names_[row_id].second, &label)); + (*trow) = TensorRow(row_id, {std::move(waveform), std::move(rate), std::move(label)}); + trow->setPath({audio_names_[row_id].first, audio_names_[row_id].first, audio_names_[row_id].first}); + return Status::OK(); +} + +void GTZANOp::Print(std::ostream &out, bool show_all) const { + if (!show_all) { + ParallelOp::Print(out, show_all); + out << "\n"; + return; + } + ParallelOp::Print(out, show_all); + out << "\nNumber of rows: " << num_rows_ << "\nGTZAN directory: " << folder_path_ << "\n\n"; +} + +Status GTZANOp::CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count) { + RETURN_UNEXPECTED_IF_NULL(count); + *count = 0; + const int64_t num_samples = 0; + const int64_t start_index = 0; + auto sampler = std::make_shared(start_index, num_samples); + auto schema = std::make_unique(); + + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); + TensorShape scalar_rate = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); + TensorShape scalar_label = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK( + schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_label))); + + std::shared_ptr cfg = GlobalContext::config_manager(); + int32_t num_workers = cfg->num_parallel_workers(); + int32_t op_connect_size = cfg->op_connector_size(); + auto op = std::make_shared(usage, num_workers, dir, op_connect_size, std::move(schema), std::move(sampler)); + RETURN_IF_NOT_OK(op->PrepareData()); + *count = op->audio_names_.size(); + return Status::OK(); +} + +Status GTZANOp::ComputeColMap() { + if (column_name_id_map_.empty()) { + for (int32_t i = 0; i < data_schema_->NumColumns(); ++i) { + column_name_id_map_[data_schema_->Column(i).Name()] = i; + } + } else { + MS_LOG(WARNING) << "Column name map is already set!"; + } + return Status::OK(); +} + +Status GTZANOp::ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform) { + RETURN_UNEXPECTED_IF_NULL(waveform); + const int32_t kWavFileSampleRate = 22050; + int32_t sample_rate = 0; + std::vector waveform_vec; + RETURN_IF_NOT_OK(ReadWaveFile(audio_dir, &waveform_vec, &sample_rate)); + CHECK_FAIL_RETURN_UNEXPECTED(sample_rate == kWavFileSampleRate, + "Invalid file, sampling rate of GTZAN wav file must be 22050, file path: " + audio_dir); + RETURN_IF_NOT_OK(Tensor::CreateFromVector(waveform_vec, waveform)); + RETURN_IF_NOT_OK((*waveform)->ExpandDim(0)); + return Status::OK(); +} + +Status GTZANOp::PrepareData() { + auto realpath = FileUtils::GetRealPath(folder_path_.c_str()); + if (!realpath.has_value()) { + MS_LOG(ERROR) << "Invalid file path, GTZAN Dataset dir: " << folder_path_ << " does not exist."; + RETURN_STATUS_UNEXPECTED("Invalid file path, GTZAN Dataset dir: " + folder_path_ + " does not exist."); + } + Path dir(folder_path_); + + if (usage_ == "all") { + for (std::string sub_directory : genres) { + Path full_dir = dir / sub_directory; + if (!full_dir.Exists() || !full_dir.IsDirectory()) { + continue; + } + auto dir_it = Path::DirIterator::OpenDirectory(&full_dir); + if (dir_it != nullptr) { + while (dir_it->HasNext()) { + Path file = dir_it->Next(); + std::string file_name = file.ToString(); + auto pos = file_name.find_last_of('.'); + std::string name = file_name.substr(0, pos), temp_ext = file_name.substr(pos); + if (temp_ext == ".wav" && name.find('.') != std::string::npos) { + audio_names_.push_back({file.ToString(), sub_directory}); + } else { + MS_LOG(WARNING) << "Invalid file, invalid file name or file type: " << file.ToString() << "."; + } + } + } else { + MS_LOG(WARNING) << "Invalid file path, unable to open directory: " << full_dir.ToString() << "."; + } + } + } else { + const std::vector *files_point = nullptr; + if (usage_ == "test") { + files_point = &filtered_test; + } else if (usage_ == "train") { + files_point = &filtered_train; + } else { + files_point = &filtered_valid; + } + std::string ext = ".wav"; + for (auto sub_file_name : *files_point) { + auto pos = sub_file_name.find_first_of('.'); + std::string cls = sub_file_name.substr(0, pos); + Path full_dir = dir / cls / (sub_file_name + ext); + if (full_dir.Exists()) { + audio_names_.push_back({full_dir.ToString(), cls}); + } else { + MS_LOG(WARNING) << "The audio file is lost, file name= " << (sub_file_name + ext); + } + } + } + num_rows_ = audio_names_.size(); + CHECK_FAIL_RETURN_UNEXPECTED(num_rows_ > 0, "Invalid data, no valid data found in path:" + folder_path_); + return Status::OK(); +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.h index 3aae85c440f35c84d99245ab717ce0f6718f9039..8df3b057a88b9877f0c5d440e11c5ace10393e61 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.h @@ -1,97 +1,97 @@ -/** - * Copyright 2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_GTZAN_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_GTZAN_OP_H_ - -#include -#include -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/core/tensor.h" -#include "mindspore-lite/minddata/dataset/engine/data_schema.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -#include "mindspore-lite/minddata/dataset/util/path.h" -#include "mindspore-lite/minddata/dataset/util/queue.h" -#include "mindspore-lite/minddata/dataset/util/status.h" -#include "mindspore-lite/minddata/dataset/util/wait_post.h" - -namespace mindspore { -namespace dataset { -class GTZANOp : public MappableLeafOp { - public: - /// \brief Constructor - /// \param[in] usage Usage of this dataset, can be 'train', 'valid', 'test', or 'all'. - /// \param[in] num_workers Number of workers reading audios in parallel. - /// \param[in] folder_path Dir directory of GTZAN. - /// \param[in] queue_size Connector queue size. - /// \param[in] data_schema The schema of the GTZAN dataset. - /// \param[in] sampler Sampler tells GTZANOp what to read. - GTZANOp(const std::string &usage, int32_t num_workers, const std::string &folder_path, int32_t queue_size, - std::unique_ptr data_schema, std::shared_ptr sampler); - - /// \Destructor. - ~GTZANOp() = default; - - /// \A print method typically used for debugging. - /// \param[out] out Output stream. - /// \param[in] show_all Whether to show all information. - void Print(std::ostream &out, bool show_all) const override; - - /// \Function to count the number of samples in the GTZAN dataset. - /// \param[in] dir Path to the GTZAN directory. - /// \param[in] usage Choose the subset of GTZAN dataset. - /// \param[out] count Output arg that will hold the actual dataset size. - /// \return Status The status code returned. - static Status CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count); - - /// \Op name getter. - /// \return Name of the current Op. - std::string Name() const override { return "GTZANOp"; } - - private: - /// \Load a tensor row according to a pair. - /// \param[in] row_id Id for this tensor row. - /// \param[out] row Audio & label read into this tensor row. - /// \return Status The status code returned. - Status LoadTensorRow(row_id_type row_id, TensorRow *row) override; - - /// \Parse a audio file. - /// \param[in] audio_dir Audio file path. - /// \param[out] waveform The output waveform tensor. - /// \return Status The status code returned. - Status ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform); - - /// \Prepare data. - /// \return Status The status code returned. - Status PrepareData(); - - /// \Private function for computing the assignment of the column name map. - /// \return Status The status code returned. - Status ComputeColMap() override; - - const std::string usage_; - std::string folder_path_; - std::unique_ptr data_schema_; - std::vector> audio_names_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_GTZAN_OP_H_ +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_GTZAN_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_GTZAN_OP_H_ + +#include +#include +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/core/tensor.h" +#include "mindspore-lite/minddata/dataset/engine/data_schema.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" +#include "mindspore-lite/minddata/dataset/util/path.h" +#include "mindspore-lite/minddata/dataset/util/queue.h" +#include "mindspore-lite/minddata/dataset/util/status.h" +#include "mindspore-lite/minddata/dataset/util/wait_post.h" + +namespace mindspore::lite { +namespace dataset { +class GTZANOp : public MappableLeafOp { + public: + /// \brief Constructor + /// \param[in] usage Usage of this dataset, can be 'train', 'valid', 'test', or 'all'. + /// \param[in] num_workers Number of workers reading audios in parallel. + /// \param[in] folder_path Dir directory of GTZAN. + /// \param[in] queue_size Connector queue size. + /// \param[in] data_schema The schema of the GTZAN dataset. + /// \param[in] sampler Sampler tells GTZANOp what to read. + GTZANOp(const std::string &usage, int32_t num_workers, const std::string &folder_path, int32_t queue_size, + std::unique_ptr data_schema, std::shared_ptr sampler); + + /// \Destructor. + ~GTZANOp() = default; + + /// \A print method typically used for debugging. + /// \param[out] out Output stream. + /// \param[in] show_all Whether to show all information. + void Print(std::ostream &out, bool show_all) const override; + + /// \Function to count the number of samples in the GTZAN dataset. + /// \param[in] dir Path to the GTZAN directory. + /// \param[in] usage Choose the subset of GTZAN dataset. + /// \param[out] count Output arg that will hold the actual dataset size. + /// \return Status The status code returned. + static Status CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count); + + /// \Op name getter. + /// \return Name of the current Op. + std::string Name() const override { return "GTZANOp"; } + + private: + /// \Load a tensor row according to a pair. + /// \param[in] row_id Id for this tensor row. + /// \param[out] row Audio & label read into this tensor row. + /// \return Status The status code returned. + Status LoadTensorRow(row_id_type row_id, TensorRow *row) override; + + /// \Parse a audio file. + /// \param[in] audio_dir Audio file path. + /// \param[out] waveform The output waveform tensor. + /// \return Status The status code returned. + Status ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform); + + /// \Prepare data. + /// \return Status The status code returned. + Status PrepareData(); + + /// \Private function for computing the assignment of the column name map. + /// \return Status The status code returned. + Status ComputeColMap() override; + + const std::string usage_; + std::string folder_path_; + std::unique_ptr data_schema_; + std::vector> audio_names_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_GTZAN_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.cc index 833a47b5dff046dd49846e6c24f0e80b1a3f4a66..fc07b767001b4b4be17bd1b61c17690de83e1e78 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef ENABLE_PYTHON ImageFolderOp::ImageFolderOp(int32_t num_wkrs, std::string file_dir, int32_t queue_size, bool recursive, bool do_decode, @@ -401,4 +401,4 @@ Status ImageFolderOp::GetClassIndexing( return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.h index ac09d6edc1f2b7327bd8f8a417163d61890d3398..c5497db5432e7a6407d0d23227823d5e1facd530 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.h @@ -42,7 +42,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// Forward declares template @@ -176,5 +176,5 @@ class ImageFolderOp : public MappableLeafOp { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_IMAGE_FOLDER_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/imdb_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/imdb_op.cc index a235886db03b2e78f390f827ddbf9e351574338f..599151f965b5108f2aadb62f3cf1237b2b8e1b35 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/imdb_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/imdb_op.cc @@ -26,7 +26,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr int32_t kNumClasses = 2; @@ -229,4 +229,4 @@ Status IMDBOp::LoadTensor(const std::string &line, std::shared_ptr *out_ return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/imdb_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/imdb_op.h index 919615eb631f6b47f678b314bb1e70450e8fc72f..511360a6bffe3df4812177d684a6dc960ffd52ec 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/imdb_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/imdb_op.h @@ -38,7 +38,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// Forward declares template @@ -130,5 +130,5 @@ class IMDBOp : public MappableLeafOp { std::vector> text_label_pairs_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_IMDB_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.cc index 08c819f3887c8b4953231855b641990d73abc5c1..8aa2a21ff8b695d8236a5cca36a9fde781bfee4e 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.cc @@ -18,7 +18,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { // IOBlock Class // @@ -83,4 +83,4 @@ Status FilenameBlock::GetFilename(std::string *out_filename, const AutoIndexObj< return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h index 290b481f1b0cd94c4c60a738ef96f5dffba05358..6a37576cdb1951854f0f676670d838ed68006fbe 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/util/auto_index.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // The IOBlock class is used to describe a "unit of work" that a storage leaf operator worker thread // is responsible for acting on. @@ -143,5 +143,5 @@ class FilenameBlock : public IOBlock { int64_t end_offset_; }; // class TFBlock } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_IO_BLOCK_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.cc index e545b0c79d3f2be2c9ee88e000606259fec1ec64..f8bd5182b90abe1afb33bc31ea2cb8d9b77348d5 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { IWSLTOp::IWSLTOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, bool shuffle_files, int32_t num_devices, int32_t device_id, std::unique_ptr data_schema, @@ -540,4 +540,4 @@ Status IWSLTOp::GetFiles() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.h index ad514a3dde5b70678e275c63089a752318f00485..db0d7ba72afde04d6bbaeb5fd8d193c87f3678c7 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.h @@ -34,7 +34,7 @@ using tinyxml2::XMLDocument; using tinyxml2::XMLElement; using tinyxml2::XMLError; -namespace mindspore { +namespace mindspore::lite { namespace dataset { class JaggedConnector; @@ -232,5 +232,5 @@ class IWSLTOp : public NonMappableLeafOp { std::string test_set_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_IWSLT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.cc index 758e048aa77446685655e5a56a68d858d90e7548..34456eb0e2256255d9512120b5b1896b09ea86a2 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.cc @@ -28,7 +28,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr int kLabelNameIndex = 0; constexpr int kTruncatedIndex = 1; @@ -320,4 +320,4 @@ Status KITTIOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.h index 65d98a61d04d0f4a81e0b74409def72ba406634a..4255379e26fd6378ba07892033aa76831cf74ea3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -122,5 +122,5 @@ class KITTIOp : public MappableLeafOp { std::map annotation_map_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_KITTI_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.cc index 2c63cd8f660677384a32fd7b3b3952efbda89436..21788aa0c20b2bb35c69f91454e55daa1e352e1f 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { KMnistOp::KMnistOp(const std::string &usage, int32_t num_workers, const std::string &folder_path, int32_t queue_size, std::unique_ptr data_schema, std::shared_ptr sampler) @@ -84,4 +84,4 @@ Status KMnistOp::CountTotalRows(const std::string &dir, const std::string &usage return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.h index 14ab6cc96d5945bd54baa48169ecc23ccd53f50e..37041a82e7b294156169c8d607a1f99526d2d37a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Forward declares. template @@ -61,5 +61,5 @@ class KMnistOp : public MnistOp { std::string DatasetName(bool upper = false) const override { return upper ? "KMnist" : "kmnist"; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_KMNIST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/lfw_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/lfw_op.cc index 09a6b0e01ca5e9f25696dd5b6679dc456cb4047a..019e83ce658f61e97ce44a36377f25ce77d2c8a4 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/lfw_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/lfw_op.cc @@ -25,7 +25,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const char kImageFolder[] = "lfw"; const char kImageFolderFunneled[] = "lfw_funneled"; @@ -328,4 +328,4 @@ Status LFWOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/lfw_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/lfw_op.h index 7e1d10a5930d3238d72f36ec25c5f3d6d5ee5dec..f6a57bfab3983901f656c9eb95ce39067f7e758f 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/lfw_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/lfw_op.h @@ -34,7 +34,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class LFWOp /// \brief A source dataset for reading and parsing LFW dataset. @@ -131,5 +131,5 @@ class LFWOp : public MappableLeafOp { std::string real_folder_path_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LFW_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.cc index b2a6f54e266e55ace9f17e33fe4589ddd5440dfe..ac0d7b31083840d74edc3f1ea41f44c9a371dca1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.cc @@ -1,234 +1,234 @@ -/** - * Copyright 2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.h" - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/audio/kernels/audio_utils.h" -#include "mindspore-lite/minddata/dataset/core/config_manager.h" -#include "mindspore-lite/minddata/dataset/core/tensor_shape.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" -#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -#include "utils/file_utils.h" - -namespace mindspore { -namespace dataset { -const int32_t label_file_suffix_len = 10; -const char label_file_suffix[] = ".trans.tsv"; -const char audio_file_suffix[] = ".wav"; -const std::vector usage_list = {"dev-clean", "dev-other", "test-clean", "test-other", - "train-clean-100", "train-clean-360", "train-other-500"}; - -LibriTTSOp::LibriTTSOp(const std::string &dataset_dir, const std::string &usage, int32_t num_workers, - int32_t queue_size, std::unique_ptr data_schema, std::shared_ptr sampler) - : MappableLeafOp(num_workers, queue_size, std::move(sampler)), - dataset_dir_(dataset_dir), - usage_(usage), - data_schema_(std::move(data_schema)) {} - -Status LibriTTSOp::LoadTensorRow(row_id_type row_id, TensorRow *trow) { - RETURN_UNEXPECTED_IF_NULL(trow); - LibriTTSLabelTuple audio_tuple = audio_label_tuples_[row_id]; - const uint32_t rate = 24000; - std::shared_ptr waveform, sample_rate, original_text, normalized_text, speaker_id, chapter_id, utterance_id; - Path dir(real_path_); - std::string file_name = audio_tuple.utterance_id + audio_file_suffix; - Path full_dir = dir / audio_tuple.usage / std::to_string(audio_tuple.speaker_id) / - std::to_string(audio_tuple.chapter_id) / file_name; - RETURN_IF_NOT_OK(ReadAudio(full_dir.ToString(), &waveform)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(rate, &sample_rate)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.original_text, &original_text)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.normalized_text, &normalized_text)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.speaker_id, &speaker_id)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.chapter_id, &chapter_id)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.utterance_id, &utterance_id)); - (*trow) = TensorRow( - row_id, {std::move(waveform), std::move(sample_rate), std::move(original_text), std::move(normalized_text), - std::move(speaker_id), std::move(chapter_id), std::move(utterance_id)}); - std::string label_path = audio_tuple.label_path; - trow->setPath({full_dir.ToString(), full_dir.ToString(), label_path, label_path, label_path, label_path, label_path}); - return Status::OK(); -} - -void LibriTTSOp::Print(std::ostream &out, bool show_all) const { - if (!show_all) { - ParallelOp::Print(out, show_all); - out << "\n"; - } else { - ParallelOp::Print(out, show_all); - out << "\nNumber of rows: " << num_rows_ << "\nLibriTTS directory: " << dataset_dir_ << "\n\n"; - } -} - -Status LibriTTSOp::CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count) { - RETURN_UNEXPECTED_IF_NULL(count); - *count = 0; - const int64_t num_samples = 0; - const int64_t start_index = 0; - auto sampler = std::make_shared(start_index, num_samples); - auto schema = std::make_unique(); - - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); - TensorShape scalar_rate = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); - TensorShape scalar_original_text = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("original_text", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_original_text))); - TensorShape scalar_normalized_text = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("normalized_text", DataType(DataType::DE_STRING), - TensorImpl::kFlexible, 0, &scalar_normalized_text))); - TensorShape scalar_speaker_id = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("speaker_id", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_speaker_id))); - TensorShape scalar_chapter_id = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("chapter_id", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_chapter_id))); - TensorShape scalar_utterance_id = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("utterance_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance_id))); - std::shared_ptr cfg = GlobalContext::config_manager(); - int32_t num_workers = cfg->num_parallel_workers(); - int32_t op_connect_size = cfg->op_connector_size(); - auto op = - std::make_shared(dir, usage, num_workers, op_connect_size, std::move(schema), std::move(sampler)); - RETURN_IF_NOT_OK(op->PrepareData()); - *count = op->audio_label_tuples_.size(); - return Status::OK(); -} - -Status LibriTTSOp::ComputeColMap() { - if (column_name_id_map_.empty()) { - for (int32_t i = 0; i < data_schema_->NumColumns(); ++i) { - column_name_id_map_[data_schema_->Column(i).Name()] = i; - } - } else { - MS_LOG(WARNING) << "Column name map is already set!"; - } - return Status::OK(); -} - -Status LibriTTSOp::ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform) { - RETURN_UNEXPECTED_IF_NULL(waveform); - const int32_t kWavFileSampleRate = 24000; - int32_t sample_rate = 0; - std::vector waveform_vec; - RETURN_IF_NOT_OK(ReadWaveFile(audio_dir, &waveform_vec, &sample_rate)); - CHECK_FAIL_RETURN_UNEXPECTED( - sample_rate == kWavFileSampleRate, - "Invalid file, sampling rate of LibriTTS wav file must be 24000, file path: " + audio_dir); - RETURN_IF_NOT_OK(Tensor::CreateFromVector(waveform_vec, waveform)); - RETURN_IF_NOT_OK((*waveform)->ExpandDim(0)); - return Status::OK(); -} - -Status LibriTTSOp::PrepareData() { - auto realpath = FileUtils::GetRealPath(dataset_dir_.c_str()); - if (!realpath.has_value()) { - MS_LOG(ERROR) << "Invalid file path, LibriTTS dataset dir: " << dataset_dir_ << " does not exist."; - RETURN_STATUS_UNEXPECTED("Invalid file path, LibriTTS dataset dir: " + dataset_dir_ + " does not exist."); - } - real_path_ = realpath.value(); - Path dir(real_path_); - if (usage_ != "all") { - Path full_dir = dir / usage_; - cur_usage_ = usage_; - RETURN_IF_NOT_OK(GetPaths(&full_dir)); - RETURN_IF_NOT_OK(GetLabels()); - } else { - for (std::string usage_iter : usage_list) { - cur_usage_ = usage_iter; - Path full_dir = dir / cur_usage_; - RETURN_IF_NOT_OK(GetPaths(&full_dir)); - RETURN_IF_NOT_OK(GetLabels()); - } - } - num_rows_ = audio_label_tuples_.size(); - CHECK_FAIL_RETURN_UNEXPECTED(num_rows_ > 0, - "Invalid data, no valid data matching the dataset API LibriTTSDataset. " - "Please check dataset API or file path: " + - dataset_dir_ + "."); - return Status::OK(); -} - -Status LibriTTSOp::GetPaths(Path *dir) { - RETURN_UNEXPECTED_IF_NULL(dir); - auto iter = Path::DirIterator::OpenDirectory(dir); - if (iter == nullptr) { - MS_LOG(WARNING) << "Invalid file path, unable to open directory: " << dir->ToString() << "."; - } else { - while (iter->HasNext()) { - Path sub_dir = iter->Next(); - if (sub_dir.IsDirectory()) { - RETURN_IF_NOT_OK(GetPaths(&sub_dir)); - } else { - Path file_path = sub_dir; - std::string file_name = file_path.Basename(); - int32_t length = file_name.size(); - if (length > label_file_suffix_len && file_name.substr(length - label_file_suffix_len) == label_file_suffix) { - label_files_.push_back(sub_dir.ToString()); - return Status::OK(); - } - } - } - } - return Status::OK(); -} - -Status LibriTTSOp::GetLabels() { - std::string utterance_id_body = ""; - std::string original_text_body = ""; - std::string normalized_text_body = ""; - const uint32_t base = 10; - const uint32_t ascii_zero = 48; - const size_t underline_exact = 3; - for (std::string label_file : label_files_) { - std::ifstream label_reader(label_file, std::ios::in); - while (getline(label_reader, utterance_id_body, '\t')) { - getline(label_reader, original_text_body, '\t'); - getline(label_reader, normalized_text_body, '\n'); - uint32_t speaker_id = 0; - uint32_t chapter_id = 0; - size_t underline_num = 0; - size_t underline_inx[4] = {0}; - for (size_t i = 0; i < utterance_id_body.size() && underline_num <= underline_exact; i++) { - if (utterance_id_body[i] == '_') { - underline_inx[underline_num++] = i; - } - } - if (underline_num != underline_exact) { - label_reader.close(); - RETURN_STATUS_UNEXPECTED("Invalid file, the file may not be a LibriTTS dataset file: " + label_file); - } - for (size_t i = 0; i < underline_inx[0]; i++) { - speaker_id = speaker_id * base + utterance_id_body[i] - ascii_zero; - } - for (size_t i = underline_inx[0] + 1; i < underline_inx[1]; i++) { - chapter_id = chapter_id * base + utterance_id_body[i] - ascii_zero; - } - audio_label_tuples_.push_back( - {cur_usage_, utterance_id_body, original_text_body, normalized_text_body, speaker_id, chapter_id, label_file}); - } - label_reader.close(); - } - label_files_.clear(); - return Status::OK(); -} -} // namespace dataset. -} // namespace mindspore. +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.h" + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/audio/kernels/audio_utils.h" +#include "mindspore-lite/minddata/dataset/core/config_manager.h" +#include "mindspore-lite/minddata/dataset/core/tensor_shape.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" +#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" +#include "utils/file_utils.h" + +namespace mindspore::lite { +namespace dataset { +const int32_t label_file_suffix_len = 10; +const char label_file_suffix[] = ".trans.tsv"; +const char audio_file_suffix[] = ".wav"; +const std::vector usage_list = {"dev-clean", "dev-other", "test-clean", "test-other", + "train-clean-100", "train-clean-360", "train-other-500"}; + +LibriTTSOp::LibriTTSOp(const std::string &dataset_dir, const std::string &usage, int32_t num_workers, + int32_t queue_size, std::unique_ptr data_schema, std::shared_ptr sampler) + : MappableLeafOp(num_workers, queue_size, std::move(sampler)), + dataset_dir_(dataset_dir), + usage_(usage), + data_schema_(std::move(data_schema)) {} + +Status LibriTTSOp::LoadTensorRow(row_id_type row_id, TensorRow *trow) { + RETURN_UNEXPECTED_IF_NULL(trow); + LibriTTSLabelTuple audio_tuple = audio_label_tuples_[row_id]; + const uint32_t rate = 24000; + std::shared_ptr waveform, sample_rate, original_text, normalized_text, speaker_id, chapter_id, utterance_id; + Path dir(real_path_); + std::string file_name = audio_tuple.utterance_id + audio_file_suffix; + Path full_dir = dir / audio_tuple.usage / std::to_string(audio_tuple.speaker_id) / + std::to_string(audio_tuple.chapter_id) / file_name; + RETURN_IF_NOT_OK(ReadAudio(full_dir.ToString(), &waveform)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(rate, &sample_rate)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.original_text, &original_text)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.normalized_text, &normalized_text)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.speaker_id, &speaker_id)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.chapter_id, &chapter_id)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(audio_tuple.utterance_id, &utterance_id)); + (*trow) = TensorRow( + row_id, {std::move(waveform), std::move(sample_rate), std::move(original_text), std::move(normalized_text), + std::move(speaker_id), std::move(chapter_id), std::move(utterance_id)}); + std::string label_path = audio_tuple.label_path; + trow->setPath({full_dir.ToString(), full_dir.ToString(), label_path, label_path, label_path, label_path, label_path}); + return Status::OK(); +} + +void LibriTTSOp::Print(std::ostream &out, bool show_all) const { + if (!show_all) { + ParallelOp::Print(out, show_all); + out << "\n"; + } else { + ParallelOp::Print(out, show_all); + out << "\nNumber of rows: " << num_rows_ << "\nLibriTTS directory: " << dataset_dir_ << "\n\n"; + } +} + +Status LibriTTSOp::CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count) { + RETURN_UNEXPECTED_IF_NULL(count); + *count = 0; + const int64_t num_samples = 0; + const int64_t start_index = 0; + auto sampler = std::make_shared(start_index, num_samples); + auto schema = std::make_unique(); + + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); + TensorShape scalar_rate = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); + TensorShape scalar_original_text = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("original_text", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_original_text))); + TensorShape scalar_normalized_text = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("normalized_text", DataType(DataType::DE_STRING), + TensorImpl::kFlexible, 0, &scalar_normalized_text))); + TensorShape scalar_speaker_id = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("speaker_id", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_speaker_id))); + TensorShape scalar_chapter_id = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("chapter_id", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_chapter_id))); + TensorShape scalar_utterance_id = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("utterance_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance_id))); + std::shared_ptr cfg = GlobalContext::config_manager(); + int32_t num_workers = cfg->num_parallel_workers(); + int32_t op_connect_size = cfg->op_connector_size(); + auto op = + std::make_shared(dir, usage, num_workers, op_connect_size, std::move(schema), std::move(sampler)); + RETURN_IF_NOT_OK(op->PrepareData()); + *count = op->audio_label_tuples_.size(); + return Status::OK(); +} + +Status LibriTTSOp::ComputeColMap() { + if (column_name_id_map_.empty()) { + for (int32_t i = 0; i < data_schema_->NumColumns(); ++i) { + column_name_id_map_[data_schema_->Column(i).Name()] = i; + } + } else { + MS_LOG(WARNING) << "Column name map is already set!"; + } + return Status::OK(); +} + +Status LibriTTSOp::ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform) { + RETURN_UNEXPECTED_IF_NULL(waveform); + const int32_t kWavFileSampleRate = 24000; + int32_t sample_rate = 0; + std::vector waveform_vec; + RETURN_IF_NOT_OK(ReadWaveFile(audio_dir, &waveform_vec, &sample_rate)); + CHECK_FAIL_RETURN_UNEXPECTED( + sample_rate == kWavFileSampleRate, + "Invalid file, sampling rate of LibriTTS wav file must be 24000, file path: " + audio_dir); + RETURN_IF_NOT_OK(Tensor::CreateFromVector(waveform_vec, waveform)); + RETURN_IF_NOT_OK((*waveform)->ExpandDim(0)); + return Status::OK(); +} + +Status LibriTTSOp::PrepareData() { + auto realpath = FileUtils::GetRealPath(dataset_dir_.c_str()); + if (!realpath.has_value()) { + MS_LOG(ERROR) << "Invalid file path, LibriTTS dataset dir: " << dataset_dir_ << " does not exist."; + RETURN_STATUS_UNEXPECTED("Invalid file path, LibriTTS dataset dir: " + dataset_dir_ + " does not exist."); + } + real_path_ = realpath.value(); + Path dir(real_path_); + if (usage_ != "all") { + Path full_dir = dir / usage_; + cur_usage_ = usage_; + RETURN_IF_NOT_OK(GetPaths(&full_dir)); + RETURN_IF_NOT_OK(GetLabels()); + } else { + for (std::string usage_iter : usage_list) { + cur_usage_ = usage_iter; + Path full_dir = dir / cur_usage_; + RETURN_IF_NOT_OK(GetPaths(&full_dir)); + RETURN_IF_NOT_OK(GetLabels()); + } + } + num_rows_ = audio_label_tuples_.size(); + CHECK_FAIL_RETURN_UNEXPECTED(num_rows_ > 0, + "Invalid data, no valid data matching the dataset API LibriTTSDataset. " + "Please check dataset API or file path: " + + dataset_dir_ + "."); + return Status::OK(); +} + +Status LibriTTSOp::GetPaths(Path *dir) { + RETURN_UNEXPECTED_IF_NULL(dir); + auto iter = Path::DirIterator::OpenDirectory(dir); + if (iter == nullptr) { + MS_LOG(WARNING) << "Invalid file path, unable to open directory: " << dir->ToString() << "."; + } else { + while (iter->HasNext()) { + Path sub_dir = iter->Next(); + if (sub_dir.IsDirectory()) { + RETURN_IF_NOT_OK(GetPaths(&sub_dir)); + } else { + Path file_path = sub_dir; + std::string file_name = file_path.Basename(); + int32_t length = file_name.size(); + if (length > label_file_suffix_len && file_name.substr(length - label_file_suffix_len) == label_file_suffix) { + label_files_.push_back(sub_dir.ToString()); + return Status::OK(); + } + } + } + } + return Status::OK(); +} + +Status LibriTTSOp::GetLabels() { + std::string utterance_id_body = ""; + std::string original_text_body = ""; + std::string normalized_text_body = ""; + const uint32_t base = 10; + const uint32_t ascii_zero = 48; + const size_t underline_exact = 3; + for (std::string label_file : label_files_) { + std::ifstream label_reader(label_file, std::ios::in); + while (getline(label_reader, utterance_id_body, '\t')) { + getline(label_reader, original_text_body, '\t'); + getline(label_reader, normalized_text_body, '\n'); + uint32_t speaker_id = 0; + uint32_t chapter_id = 0; + size_t underline_num = 0; + size_t underline_inx[4] = {0}; + for (size_t i = 0; i < utterance_id_body.size() && underline_num <= underline_exact; i++) { + if (utterance_id_body[i] == '_') { + underline_inx[underline_num++] = i; + } + } + if (underline_num != underline_exact) { + label_reader.close(); + RETURN_STATUS_UNEXPECTED("Invalid file, the file may not be a LibriTTS dataset file: " + label_file); + } + for (size_t i = 0; i < underline_inx[0]; i++) { + speaker_id = speaker_id * base + utterance_id_body[i] - ascii_zero; + } + for (size_t i = underline_inx[0] + 1; i < underline_inx[1]; i++) { + chapter_id = chapter_id * base + utterance_id_body[i] - ascii_zero; + } + audio_label_tuples_.push_back( + {cur_usage_, utterance_id_body, original_text_body, normalized_text_body, speaker_id, chapter_id, label_file}); + } + label_reader.close(); + } + label_files_.clear(); + return Status::OK(); +} +} // namespace dataset. +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.h index 5fb7d720401bfebcb9995eded2ec3d589e4d19fd..1e606f6e8d31c85f28815ecd009fe44762246e1a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.h @@ -1,120 +1,120 @@ -/** - * Copyright 2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LIBRI_TTS_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LIBRI_TTS_OP_H_ - -#include -#include -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/core/tensor.h" -#include "mindspore-lite/minddata/dataset/engine/data_schema.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -#include "mindspore-lite/minddata/dataset/util/path.h" -#include "mindspore-lite/minddata/dataset/util/queue.h" -#include "mindspore-lite/minddata/dataset/util/status.h" -#include "mindspore-lite/minddata/dataset/util/wait_post.h" - -namespace mindspore { -namespace dataset { -struct LibriTTSLabelTuple { - std::string usage; - std::string utterance_id; - std::string original_text; - std::string normalized_text; - uint32_t speaker_id; - uint32_t chapter_id; - std::string label_path; -}; - -class LibriTTSOp : public MappableLeafOp { - public: - /// \brief Constructor. - /// \param[in] dataset_dir Dir directory of LibriTTS. - /// \param[in] usage usage of this dataset, can be "dev-clean", "dev-other", "test-clean", "test-other", - /// "train-clean-100", "train-clean-360", "train-other-500", or "all". - /// \param[in] num_workers Number of workers reading audios in parallel. - /// \param[in] queue_size Connector queue size. - /// \param[in] data_schema The schema of the LibriTTS dataset. - /// \param[in] sampler Sampler tells LibriSpeechOp what to read. - LibriTTSOp(const std::string &dataset_dir, const std::string &usage, int32_t num_workers, int32_t queue_size, - std::unique_ptr data_schema, std::shared_ptr sampler); - - /// \brief Destructor. - ~LibriTTSOp() = default; - - /// \brief A print method typically used for debugging. - /// \param[out] out Output stream. - /// \param[in] show_all Whether to show all information. - void Print(std::ostream &out, bool show_all) const override; - - /// \brief Function to count the number of samples in the LibriTTS dataset. - /// \param[in] dir Path to the LibriTTS directory. - /// \param[in] usage Select the data set section. - /// \param[out] count Output arg that will hold the minimum of the actual dataset size and numSamples. - /// \return Status The status code returned. - static Status CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count); - - /// \brief Op name getter. - /// \return Name of the current Op. - std::string Name() const override { return "LibriTTSOp"; } - - private: - /// \brief Load a tensor row according to a pair. - /// \param[in] row_id Id for this tensor row. - /// \param[out] row Audio & label read into this tensor row. - /// \return Status The status code returned. - Status LoadTensorRow(row_id_type row_id, TensorRow *row) override; - - /// \brief Read all paths in the directory. - /// \param[in] dir File path to be traversed. - /// \return Status The status code returned. - Status GetPaths(Path *dir); - - /// \brief Read all label files. - /// \return Status The status code returned. - Status GetLabels(); - - /// \brief Parse a single wav file. - /// \param[in] audio_dir Audio file path. - /// \param[out] waveform The output waveform tensor. - /// \return Status The status code returned. - Status ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform); - - /// \brief Prepare all data in the directory. - /// \return Status The status code returned. - Status PrepareData(); - - /// \brief Private function for computing the assignment of the column name map. - /// \return Status The status code returned. - Status ComputeColMap() override; - - const std::string usage_; - std::string cur_usage_; - std::string real_path_; - std::string dataset_dir_; - std::unique_ptr data_schema_; - std::vector audio_label_tuples_; - std::vector label_files_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LIBRI_TTS_OP_H_ +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LIBRI_TTS_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LIBRI_TTS_OP_H_ + +#include +#include +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/core/tensor.h" +#include "mindspore-lite/minddata/dataset/engine/data_schema.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" +#include "mindspore-lite/minddata/dataset/util/path.h" +#include "mindspore-lite/minddata/dataset/util/queue.h" +#include "mindspore-lite/minddata/dataset/util/status.h" +#include "mindspore-lite/minddata/dataset/util/wait_post.h" + +namespace mindspore::lite { +namespace dataset { +struct LibriTTSLabelTuple { + std::string usage; + std::string utterance_id; + std::string original_text; + std::string normalized_text; + uint32_t speaker_id; + uint32_t chapter_id; + std::string label_path; +}; + +class LibriTTSOp : public MappableLeafOp { + public: + /// \brief Constructor. + /// \param[in] dataset_dir Dir directory of LibriTTS. + /// \param[in] usage usage of this dataset, can be "dev-clean", "dev-other", "test-clean", "test-other", + /// "train-clean-100", "train-clean-360", "train-other-500", or "all". + /// \param[in] num_workers Number of workers reading audios in parallel. + /// \param[in] queue_size Connector queue size. + /// \param[in] data_schema The schema of the LibriTTS dataset. + /// \param[in] sampler Sampler tells LibriSpeechOp what to read. + LibriTTSOp(const std::string &dataset_dir, const std::string &usage, int32_t num_workers, int32_t queue_size, + std::unique_ptr data_schema, std::shared_ptr sampler); + + /// \brief Destructor. + ~LibriTTSOp() = default; + + /// \brief A print method typically used for debugging. + /// \param[out] out Output stream. + /// \param[in] show_all Whether to show all information. + void Print(std::ostream &out, bool show_all) const override; + + /// \brief Function to count the number of samples in the LibriTTS dataset. + /// \param[in] dir Path to the LibriTTS directory. + /// \param[in] usage Select the data set section. + /// \param[out] count Output arg that will hold the minimum of the actual dataset size and numSamples. + /// \return Status The status code returned. + static Status CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count); + + /// \brief Op name getter. + /// \return Name of the current Op. + std::string Name() const override { return "LibriTTSOp"; } + + private: + /// \brief Load a tensor row according to a pair. + /// \param[in] row_id Id for this tensor row. + /// \param[out] row Audio & label read into this tensor row. + /// \return Status The status code returned. + Status LoadTensorRow(row_id_type row_id, TensorRow *row) override; + + /// \brief Read all paths in the directory. + /// \param[in] dir File path to be traversed. + /// \return Status The status code returned. + Status GetPaths(Path *dir); + + /// \brief Read all label files. + /// \return Status The status code returned. + Status GetLabels(); + + /// \brief Parse a single wav file. + /// \param[in] audio_dir Audio file path. + /// \param[out] waveform The output waveform tensor. + /// \return Status The status code returned. + Status ReadAudio(const std::string &audio_dir, std::shared_ptr *waveform); + + /// \brief Prepare all data in the directory. + /// \return Status The status code returned. + Status PrepareData(); + + /// \brief Private function for computing the assignment of the column name map. + /// \return Status The status code returned. + Status ComputeColMap() override; + + const std::string usage_; + std::string cur_usage_; + std::string real_path_; + std::string dataset_dir_; + std::unique_ptr data_schema_; + std::vector audio_label_tuples_; + std::vector label_files_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LIBRI_TTS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.cc index a6457fb4c09f837d79ce0bee9b5d3ec8d4d1b857..b9f8fec98110912454fccc6af88b6f654019ac07 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.cc @@ -26,7 +26,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { LJSpeechOp::LJSpeechOp(const std::string &file_dir, int32_t num_workers, int32_t queue_size, std::unique_ptr data_schema, std::shared_ptr sampler) @@ -151,4 +151,4 @@ Status LJSpeechOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.h index 292e545f374181d5f6cc0a0f13890318717a1807..30be2b482fa6fce89e90490965110679d85d2cb7 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Read LJSpeech dataset. class LJSpeechOp : public MappableLeafOp { @@ -82,5 +82,5 @@ class LJSpeechOp : public MappableLeafOp { std::vector> meta_info_list_; // the shape is (N, 3) }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LJ_SPEECH_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.cc index 00c6e7746938810fa4af23f7b7d3cc4330846204..1e867afe384af1f2dcc0887e4000971731f41dd2 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { LSUNOp::LSUNOp(int32_t num_wkrs, const std::string &file_dir, int32_t queue_size, const std::string &usage, const std::vector &classes, bool do_decode, std::unique_ptr data_schema, @@ -166,4 +166,4 @@ Status LSUNOp::GetNumClasses(int64_t *num_classes) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.h index 7f9cbac0aae04968eaadfc61e577a2aba92769ac..abff12a288a2cb7e5878ee8466b9450cd119abda 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Forward declares. template @@ -110,5 +110,5 @@ class LSUNOp : public ImageFolderOp { std::vector classes_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_LSUN_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/manifest_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/manifest_op.cc index 704dfecf1566bd93f7fd981dbc8d9a4e82c501ac..287820e79aef4be8089e06b99883423aaf586393 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/manifest_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/manifest_op.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { ManifestOp::ManifestOp(int32_t num_works, std::string file, int32_t queue_size, bool decode, const std::map &class_index, std::unique_ptr data_schema, @@ -312,4 +312,4 @@ Status ManifestOp::GetClassIndexing(std::vector>> image_labelname_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_MANIFEST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.cc index 5865fce7620e4f8b6306f63dc348a9fe391deeeb..970dd34f80a34732c6195eb2fac9c4aa0b0b63c1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { MappableLeafOp::MappableLeafOp(int32_t num_wkrs, int32_t queue_size, std::shared_ptr sampler) : ParallelOp(num_wkrs, queue_size, std::move(sampler)), @@ -249,4 +249,4 @@ Status MappableLeafOp::ResetAndUpdateRepeat() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h index 85dfd11e0bc3778bd08ce036a6ac31339a9ec7db..6f2954857b2e0fb0e0022da5339d903bcf89b7bd 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h @@ -39,7 +39,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -136,5 +136,5 @@ class MappableLeafOp : public ParallelOp, TensorRow>, p ImplementedPullMode PullModeImplementationStatus() const override { return ImplementedPullMode::Implemented; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_MAPPABLE_LEAF_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.cc index 78070df706b4938f3f966cf4772940ef0099cd24..687b946c50aca04da506b98d6ffeb852ee47b4d7 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using mindrecord::kInt64Len; @@ -470,4 +470,4 @@ TensorRow MindRecordOp::operator[](size_t index) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.h index 498e4b76fdddd095d1f088d449bea40494cf8914..55cda305eb3cacd5d1f28d7e28d83997663b4f11 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.h @@ -37,7 +37,7 @@ #include "minddata/mindrecord/include/common/shard_utils.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -193,5 +193,5 @@ class MindRecordOp : public MappableLeafOp { ShuffleMode shuffle_mode_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_MINDRECORD_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.cc index 8a1c116519978a57863ae4a893467ef211e18b13..cbdba387d9af8fa050dd66486b9a1ac629df684e 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int32_t kMnistImageFileMagicNumber = 2051; const int32_t kMnistLabelFileMagicNumber = 2049; @@ -340,4 +340,4 @@ Status MnistOp::ComputeColMap() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h index 25c77e26a99e4ab1d597fc6fff1004ac7a4d4660..cc933673cb6ac129088b4c7365ecfe299173b1b2 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h @@ -34,7 +34,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -142,5 +142,5 @@ class MnistOp : public MappableLeafOp { std::vector label_path_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_MNIST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.cc index 91d3b8763e8147a4653a9e63aef1ee6210a69e59..ed04b0a9db11a1b4f5e89db1164efaea7b8b1f67 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // constructor of Multi30k. Multi30kOp::Multi30kOp(int32_t num_workers, int64_t num_samples, const std::vector &language_pair, @@ -147,4 +147,4 @@ Status Multi30kOp::LoadFile(const std::string &file_en, int64_t start_offset, in return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.h index a3026dea6fea562e9b91b7962370843aa7df31ac..fb6bd15dbb6ca00ab32b51fcff246625646ecba6 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class JaggedConnector; using StringIndex = AutoIndexObj; @@ -81,5 +81,5 @@ class Multi30kOp : public TextFileOp { std::vector language_pair_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_MULTI30K_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.cc index a58e4ca0cd2f1cdbbacd8069237d01f77d1aba8c..10bb1e67b2d417de652442ff671ce3a49ec39fce 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/task_manager.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { NonMappableLeafOp::NonMappableLeafOp(int32_t num_workers, int32_t worker_connector_size, int64_t total_num_rows, int32_t op_connector_size, bool shuffle_files, int32_t num_devices, @@ -417,4 +417,4 @@ Status NonMappableLeafOp::ResetAndUpdateRepeat() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h index 5044b4cdd9c461b0cb5cc7cf779a0c29e8c2e546..3c18c7843e0bb34c21368dccf0f806f1c56cd82c 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { template class Queue; @@ -233,5 +233,5 @@ class NonMappableLeafOp : public ParallelOp { uint32_t seed_; // used to shuffle filename indices }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_NONMAPPABLE_LEAF_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.cc index 0862faac20a1a68683f1f30bab0c106e9552a4d8..0cf80d074146eee9f4d89e6f8e57096c21782a01 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { OmniglotOp::OmniglotOp(int32_t num_wkrs, const std::string &file_dir, int32_t queue_size, bool background, bool do_decode, std::unique_ptr data_schema, @@ -127,4 +127,4 @@ Status OmniglotOp::GetNumClasses(int64_t *num_classes) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.h index 8d48efe66e49ccfdbe1e05d7c32e79fb9c6a9729..170714d4de607bb289fe5e9d84929e09a2457c5b 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/image_folder_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares. template @@ -94,5 +94,5 @@ class OmniglotOp : public ImageFolderOp { Status RecursiveWalkFolder(Path *dir) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_OMNIGLOT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.cc index d0608689f9833ebdbafe7fd957175d3a27563403..c8923adc9a11cd28ca2111aa31c9271eddcb9a44 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.cc @@ -1,55 +1,55 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.h" - -#include "include/common/debug/common.h" -#include "mindspore-lite/minddata/dataset/core/config_manager.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h" -#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -#include "mindspore-lite/minddata/dataset/util/random.h" -#include "mindspore-lite/minddata/dataset/util/wait_post.h" - -namespace mindspore { -namespace dataset { -PennTreebankOp::PennTreebankOp(int32_t num_workers, int64_t total_rows, int32_t worker_connector_size, - std::unique_ptr schema, const std::vector &file_list, - int32_t op_connector_size, bool shuffle_files, int32_t num_devices, int32_t device_id) - : TextFileOp(num_workers, total_rows, worker_connector_size, std::move(schema), file_list, op_connector_size, - shuffle_files, num_devices, device_id) {} - -// A print method typically used for debugging. -void PennTreebankOp::Print(std::ostream &out, bool show_all) const { - if (!show_all) { - // Call the super class for displaying any common 1-liner info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal 1-liner info for this op. - out << "\n"; - } else { - // Call the super class for displaying any common detailed info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal stuff. - out << "\nRow count: " << total_rows_ << "\nDevice id: " << device_id_ << "\nNumber of devices: " << num_devices_ - << "\nShuffle files: " << ((shuffle_files_) ? "yes" : "no") << "\nPennTreebank files list:\n"; - for (size_t i = 0; i < text_files_list_.size(); ++i) { - out << " " << text_files_list_[i]; - } - out << "\nData Schema:\n"; - out << *data_schema_ << "\n\n"; - } -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.h" + +#include "include/common/debug/common.h" +#include "mindspore-lite/minddata/dataset/core/config_manager.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h" +#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" +#include "mindspore-lite/minddata/dataset/util/random.h" +#include "mindspore-lite/minddata/dataset/util/wait_post.h" + +namespace mindspore::lite { +namespace dataset { +PennTreebankOp::PennTreebankOp(int32_t num_workers, int64_t total_rows, int32_t worker_connector_size, + std::unique_ptr schema, const std::vector &file_list, + int32_t op_connector_size, bool shuffle_files, int32_t num_devices, int32_t device_id) + : TextFileOp(num_workers, total_rows, worker_connector_size, std::move(schema), file_list, op_connector_size, + shuffle_files, num_devices, device_id) {} + +// A print method typically used for debugging. +void PennTreebankOp::Print(std::ostream &out, bool show_all) const { + if (!show_all) { + // Call the super class for displaying any common 1-liner info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal 1-liner info for this op. + out << "\n"; + } else { + // Call the super class for displaying any common detailed info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal stuff. + out << "\nRow count: " << total_rows_ << "\nDevice id: " << device_id_ << "\nNumber of devices: " << num_devices_ + << "\nShuffle files: " << ((shuffle_files_) ? "yes" : "no") << "\nPennTreebank files list:\n"; + for (size_t i = 0; i < text_files_list_.size(); ++i) { + out << " " << text_files_list_[i]; + } + out << "\nData Schema:\n"; + out << *data_schema_ << "\n\n"; + } +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.h index eb46377dd9eb60b91e4459ad7248dd37b8946bbf..a46d40ccb11fd8e4e19b95215c60518db29682f0 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.h @@ -1,69 +1,69 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_PENN_TREEBANK_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_PENN_TREEBANK_OP_H_ - -#include -#include -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h" -#include "mindspore-lite/minddata/dataset/util/queue.h" - -namespace mindspore { -namespace dataset { -class JaggedConnector; - -class PennTreebankOp : public TextFileOp { - public: - /// \brief Constructor. - /// \param[in] num_workers Number of workers reading images in parallel - /// \param[in] num_samples The number of samples to be included in the dataset. - /// \param[in] worker_connector_size Size of each internal queue. - /// \param[in] data_schema Path to dataset schema file. - /// \param[in] file_list List of files to be read to search for a pattern of files. The list - /// will be sorted in a lexicographical order. - /// \param[in] op_connector_size Size of each queue in the connector that the child operator pulls from. - /// \param[in] shuffle_files Whether or not to shuffle the files before reading data. - /// \param[in] num_devices Number of devices that the dataset should be divided into. - /// \param[in] device_id The device ID within num_devices. This argument should be - /// specified only when num_devices is also specified. - PennTreebankOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, std::unique_ptr, - const std::vector &file_list, int32_t op_connector_size, bool shuffle_files, - int32_t num_devices, int32_t device_id); - - /// \brief Default destructor. - ~PennTreebankOp() = default; - - /// \brief A print method typically used for debugging. - /// \param[in] out he output stream to write output to. - /// \param[in] show_all A bool to control if you want to show all info or just a summary. - void Print(std::ostream &out, bool show_all) const override; - - /// \brief Op name getter. - /// \return Name of the current Op. - std::string Name() const override { return "PennTreebankOp"; } - - /// \brief DatasetName name getter. - /// \return DatasetName of the current Op. - std::string DatasetName(bool upper = false) const { return upper ? "PennTreebank" : "penn treebank"; } -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_PENN_TREEBANK_OP_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_PENN_TREEBANK_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_PENN_TREEBANK_OP_H_ + +#include +#include +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h" +#include "mindspore-lite/minddata/dataset/util/queue.h" + +namespace mindspore::lite { +namespace dataset { +class JaggedConnector; + +class PennTreebankOp : public TextFileOp { + public: + /// \brief Constructor. + /// \param[in] num_workers Number of workers reading images in parallel + /// \param[in] num_samples The number of samples to be included in the dataset. + /// \param[in] worker_connector_size Size of each internal queue. + /// \param[in] data_schema Path to dataset schema file. + /// \param[in] file_list List of files to be read to search for a pattern of files. The list + /// will be sorted in a lexicographical order. + /// \param[in] op_connector_size Size of each queue in the connector that the child operator pulls from. + /// \param[in] shuffle_files Whether or not to shuffle the files before reading data. + /// \param[in] num_devices Number of devices that the dataset should be divided into. + /// \param[in] device_id The device ID within num_devices. This argument should be + /// specified only when num_devices is also specified. + PennTreebankOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, std::unique_ptr, + const std::vector &file_list, int32_t op_connector_size, bool shuffle_files, + int32_t num_devices, int32_t device_id); + + /// \brief Default destructor. + ~PennTreebankOp() = default; + + /// \brief A print method typically used for debugging. + /// \param[in] out he output stream to write output to. + /// \param[in] show_all A bool to control if you want to show all info or just a summary. + void Print(std::ostream &out, bool show_all) const override; + + /// \brief Op name getter. + /// \return Name of the current Op. + std::string Name() const override { return "PennTreebankOp"; } + + /// \brief DatasetName name getter. + /// \return DatasetName of the current Op. + std::string DatasetName(bool upper = false) const { return upper ? "PennTreebank" : "penn treebank"; } +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_PENN_TREEBANK_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.cc index f0de4d882480c4351eb6c58ea60fbe1b85f844c2..bc2a51b85849e221bff69022dbdbd44c9d577eeb 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.cc @@ -28,7 +28,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr uint32_t kPatchNumPerRow = 16; constexpr uint32_t kPatchNumPerCol = 16; @@ -418,4 +418,4 @@ Status PhotoTourOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.h index f043a6c4ad600ed410fb7500f1055adc6f5b5567..b834226d8ae1be869cc9887dd1771933b628706c 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.h @@ -37,7 +37,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -152,5 +152,5 @@ class PhotoTourOp : public MappableLeafOp { std::mutex access_mutex_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_PHOTO_TOUR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.cc index 332ad2eb6e92d65f28da09ad4335be768a763502..451cc085bfc20affa3f3c7f71dc92d1c909b5c15 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.cc @@ -29,7 +29,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr char kCategoriesMeta[] = "categories_places365.txt"; const std::map kFileListMeta = {{"train-standard", "places365_train_standard.txt"}, @@ -309,4 +309,4 @@ Status Places365Op::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.h index 7dcc0b0676b22e91f39b68dbb17b6a526c532cad..71c83d17f135fcc89ccaa0d2e214e83181b3184a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -133,5 +133,5 @@ class Places365Op : public MappableLeafOp { std::vector> image_path_label_pairs_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_PLACES365_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.cc index 69206ab2be1dcb478dc0219684b7c3e97dacb982..d6f913909a4e3b61128ed81b7c69d56ffeb2c32f 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.cc @@ -29,7 +29,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int32_t kQMnistLabelFileMagicNumber = 3074; const size_t kQMnistImageRows = 28; @@ -329,4 +329,4 @@ Status QMnistOp::CheckLabel(const std::string &file_name, std::ifstream *label_r return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.h index 57a97dc28ba2a36ac99f29c7bfb7c24454d02dac..75975a174f98875b1896989b1e5d058b81f5fa44 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.h @@ -1,113 +1,113 @@ -/** - * Copyright 2021-2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_QMNIST_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_QMNIST_OP_H_ - -#include -#include -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/core/tensor.h" -#include "mindspore-lite/minddata/dataset/engine/data_schema.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -#include "mindspore-lite/minddata/dataset/util/path.h" -#include "mindspore-lite/minddata/dataset/util/queue.h" -#include "mindspore-lite/minddata/dataset/util/status.h" -#include "mindspore-lite/minddata/dataset/util/wait_post.h" - -namespace mindspore { -namespace dataset { - -using QMnistImageInfoPair = std::pair, std::shared_ptr>; - -class QMnistOp : public MnistOp { - public: - // Constructor. - // @param const std::string &folder_path - dir directory of QMNIST data file. - // @param const std::string &usage - Usage of this dataset, can be 'train', 'test', 'test10k', 'test50k', 'nist' or - // 'all'. - // @param bool compat - Compatibility with Mnist. - // @param std::unique_ptr data_schema - the schema of the QMNIST dataset. - // @param td::unique_ptr sampler - sampler tells QMnistOp what to read. - // @param int32_t num_workers - number of workers reading images in parallel. - // @param int32_t queue_size - connector queue size. - QMnistOp(const std::string &folder_path, const std::string &usage, bool compat, - std::unique_ptr data_schema, std::shared_ptr sampler, int32_t num_workers, - int32_t queue_size); - - // Destructor. - ~QMnistOp() = default; - - // Op name getter. - // @return std::string - Name of the current Op. - std::string Name() const override { return "QMnistOp"; } - - // DatasetName name getter - // \return std::string - DatasetName of the current Op - std::string DatasetName(bool upper = false) const { return upper ? "QMnist" : "qmnist"; } - - // A print method typically used for debugging. - // @param std::ostream &out - out stream. - // @param bool show_all - whether to show all information. - void Print(std::ostream &out, bool show_all) const override; - - // Function to count the number of samples in the QMNIST dataset. - // @param const std::string &dir - path to the QMNIST directory. - // @param const std::string &usage - Usage of this dataset, can be 'train', 'test', 'test10k', 'test50k', 'nist' or - // 'all'. - // @param int64_t *count - output arg that will hold the actual dataset size. - // @return Status -The status code returned. - static Status CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count); - - private: - // Load a tensor row according to a pair. - // @param row_id_type row_id - id for this tensor row. - // @param TensorRow row - image & label read into this tensor row. - // @return Status - The status code returned. - Status LoadTensorRow(row_id_type row_id, TensorRow *trow) override; - - // Get needed files in the folder_path_. - // @return Status - The status code returned. - Status WalkAllFiles() override; - - // Read images and labels from the file stream. - // @param std::ifstream *image_reader - image file stream. - // @param std::ifstream *label_reader - label file stream. - // @param size_t index - the index of file that is reading. - // @return Status The status code returned. - Status ReadImageAndLabel(std::ifstream *image_reader, std::ifstream *label_reader, size_t index) override; - - // Check label stream. - // @param const std::string &file_name - label file name. - // @param std::ifstream *label_reader - label file stream. - // @param uint32_t num_labels - returns the number of labels. - // @return Status The status code returned. - Status CheckLabel(const std::string &file_name, std::ifstream *label_reader, uint32_t *num_labels) override; - - const bool compat_; // compatible with mnist - - std::vector image_info_pairs_; -}; -} // namespace dataset -} // namespace mindspore - -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_QMNIST_OP_H_ +/** + * Copyright 2021-2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_QMNIST_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_QMNIST_OP_H_ + +#include +#include +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/core/tensor.h" +#include "mindspore-lite/minddata/dataset/engine/data_schema.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mnist_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" +#include "mindspore-lite/minddata/dataset/util/path.h" +#include "mindspore-lite/minddata/dataset/util/queue.h" +#include "mindspore-lite/minddata/dataset/util/status.h" +#include "mindspore-lite/minddata/dataset/util/wait_post.h" + +namespace mindspore::lite { +namespace dataset { + +using QMnistImageInfoPair = std::pair, std::shared_ptr>; + +class QMnistOp : public MnistOp { + public: + // Constructor. + // @param const std::string &folder_path - dir directory of QMNIST data file. + // @param const std::string &usage - Usage of this dataset, can be 'train', 'test', 'test10k', 'test50k', 'nist' or + // 'all'. + // @param bool compat - Compatibility with Mnist. + // @param std::unique_ptr data_schema - the schema of the QMNIST dataset. + // @param td::unique_ptr sampler - sampler tells QMnistOp what to read. + // @param int32_t num_workers - number of workers reading images in parallel. + // @param int32_t queue_size - connector queue size. + QMnistOp(const std::string &folder_path, const std::string &usage, bool compat, + std::unique_ptr data_schema, std::shared_ptr sampler, int32_t num_workers, + int32_t queue_size); + + // Destructor. + ~QMnistOp() = default; + + // Op name getter. + // @return std::string - Name of the current Op. + std::string Name() const override { return "QMnistOp"; } + + // DatasetName name getter + // \return std::string - DatasetName of the current Op + std::string DatasetName(bool upper = false) const { return upper ? "QMnist" : "qmnist"; } + + // A print method typically used for debugging. + // @param std::ostream &out - out stream. + // @param bool show_all - whether to show all information. + void Print(std::ostream &out, bool show_all) const override; + + // Function to count the number of samples in the QMNIST dataset. + // @param const std::string &dir - path to the QMNIST directory. + // @param const std::string &usage - Usage of this dataset, can be 'train', 'test', 'test10k', 'test50k', 'nist' or + // 'all'. + // @param int64_t *count - output arg that will hold the actual dataset size. + // @return Status -The status code returned. + static Status CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count); + + private: + // Load a tensor row according to a pair. + // @param row_id_type row_id - id for this tensor row. + // @param TensorRow row - image & label read into this tensor row. + // @return Status - The status code returned. + Status LoadTensorRow(row_id_type row_id, TensorRow *trow) override; + + // Get needed files in the folder_path_. + // @return Status - The status code returned. + Status WalkAllFiles() override; + + // Read images and labels from the file stream. + // @param std::ifstream *image_reader - image file stream. + // @param std::ifstream *label_reader - label file stream. + // @param size_t index - the index of file that is reading. + // @return Status The status code returned. + Status ReadImageAndLabel(std::ifstream *image_reader, std::ifstream *label_reader, size_t index) override; + + // Check label stream. + // @param const std::string &file_name - label file name. + // @param std::ifstream *label_reader - label file stream. + // @param uint32_t num_labels - returns the number of labels. + // @return Status The status code returned. + Status CheckLabel(const std::string &file_name, std::ifstream *label_reader, uint32_t *num_labels) override; + + const bool compat_; // compatible with mnist + + std::vector image_info_pairs_; +}; +} // namespace dataset +} // namespace mindspore::lite + +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_QMNIST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/random_data_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/random_data_op.cc index 98f608eac4c7c49f94c208c08ce8ef5d5029903e..6e73750a07ac0e018f3babc766fe58fc96dbd4b3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/random_data_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/random_data_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/wait_post.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for RandomDataOp RandomDataOp::RandomDataOp(int32_t num_workers, int32_t op_connector_size, int64_t total_rows, @@ -185,4 +185,4 @@ Status RandomDataOp::PrepareData() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/random_data_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/random_data_op.h index f7a075ee4007b5a9f19f075fd6018fc25d3c13f5..557f3ac8e131861380fec1ad042fa3370a3b4392 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/random_data_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/random_data_op.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // The RandomDataOp is a leaf node storage operator that generates random data based // on the schema specifications. Typically, it's used for testing and demonstrating @@ -125,6 +125,6 @@ class RandomDataOp : public MappableLeafOp { std::vector rows_; }; // class RandomDataOp } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_RANDOM_DATA_OP_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/rendered_sst2_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/rendered_sst2_op.cc index 359a3e9268a799bd543dfe717c3dfa50af872140..3a0cfd0073afb0bc60ca91dee34906f6a4ccd3c1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/rendered_sst2_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/rendered_sst2_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RenderedSST2Op::RenderedSST2Op(int32_t num_wkrs, const std::string &file_dir, const std::string &usage, int32_t queue_size, bool do_decode, const std::set &exts, @@ -389,4 +389,4 @@ Status RenderedSST2Op::InitPullMode() { return PrepareData(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/rendered_sst2_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/rendered_sst2_op.h index b9b3d1a02d60e2603d5ddebedf4ba43daae75725..87bb1cc76ac6c9a5d3f9517e4228494980f8e7d3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/rendered_sst2_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/rendered_sst2_op.h @@ -42,7 +42,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// Forward declares template @@ -172,5 +172,5 @@ class RenderedSST2Op : public MappableLeafOp { std::mutex access_mutex_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_RENDERED_SST2_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.cc index f9d72ba853398045792139c78a198ca56ba882d3..d0f58659848224e45a80309b41f0eac589d20d58 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { DistributedSamplerRT::DistributedSamplerRT(int64_t num_shards, int64_t shard_id, bool shuffle, int64_t num_samples, uint32_t seed, int64_t offset, bool even_dist) @@ -228,4 +228,4 @@ Status DistributedSamplerRT::to_json(nlohmann::json *out_json) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h index ca7982af1a51c28c600c37b3d4ea0295ebd84ac6..c60eeb4d61b5a03805a4b41d5460ceb32c7a59f1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DistributedSamplerRT : public SamplerRT { public: @@ -91,6 +91,6 @@ class DistributedSamplerRT : public SamplerRT { bool non_empty_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_DISTRIBUTED_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.cc index 9caae5bb09284f1218e6bb680db501a30fd2855a..021fd485c1761403003defcabb3e8aef9418a52c 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.cc @@ -18,7 +18,7 @@ #include #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { PKSamplerRT::PKSamplerRT(int64_t num_val, bool shuffle, int64_t num_samples, int64_t samples_per_tensor) : SamplerRT(num_samples, samples_per_tensor), @@ -151,4 +151,4 @@ Status PKSamplerRT::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.h index d9e412815a0250463d26f47338025315f69eead0..1cdb8c6fb713f46000487d9355934dcc7e738fd1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class PKSamplerRT : public SamplerRT { // NOT YET FINISHED public: @@ -83,6 +83,6 @@ class PKSamplerRT : public SamplerRT { // NOT YET FINISHED std::map> label_to_ids_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_PK_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.cc index 543f823d91856069fd75b55b393bbc9c26fce07c..2892812d220c3dc92d6d31d2f9b8410af918b1df 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomSamplerRT::RandomSamplerRT(bool replacement, int64_t num_samples, bool reshuffle_each_epoch, int64_t samples_per_tensor) @@ -144,4 +144,4 @@ Status RandomSamplerRT::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h index 0d05def323c7c91587adc8aa9c12e0db6332dceb..edf155c235c0edcc6353c3d54996aaf896551465 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomSamplerRT : public SamplerRT { public: @@ -68,5 +68,5 @@ class RandomSamplerRT : public SamplerRT { bool reshuffle_each_epoch_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_RANDOM_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.cc index d814e873a5037cc1ec5287e9c9f4339dc56c86ea..8a2161fa7df015331a8f4615c257ecba01ff536a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.cc @@ -18,7 +18,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomAccessOp::GetNumRowsInDataset(int64_t *num) const { RETURN_UNEXPECTED_IF_NULL(num); @@ -218,4 +218,4 @@ Status SamplerRT::to_json(nlohmann::json *out_json) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h index 1e8a0c4f36802ffc120d8fcb35eb3ec86ee16398..01a99e87e5eb86449a2c16f2ffa36b1c07811df1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/engine/data_schema.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // RandomAccessOp is a base class that all data-producing leaf operators // must inherit from if those leaf operator wish to support sampling. @@ -190,5 +190,5 @@ class SamplerRT { TensorRow child_ids_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.cc index 7195d557b3b735280c130fde8043f44a716d8dbf..2411d2269f051eb382417fa12b359ac7750af730 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.cc @@ -20,7 +20,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { SequentialSamplerRT::SequentialSamplerRT(int64_t start_index, int64_t num_samples, int64_t samples_per_tensor) : SamplerRT(num_samples, samples_per_tensor), @@ -152,4 +152,4 @@ Status SequentialSamplerRT::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h index 147e971633f3b6c38bd6a708053a43c4d31489d1..a0697a13ddc44ee024138c1bbcbe215c5d73173e 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SequentialSamplerRT : public SamplerRT { public: @@ -73,6 +73,6 @@ class SequentialSamplerRT : public SamplerRT { int64_t index_produced_; // An internal counter that tracks how many ids have been produced }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SEQUENTIAL_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.cc index e54fc11df7d6f045c8143b18cc8200d8fa5be231..9173a475d93d0aab212fad6dad277ec65d57237a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { SkipFirstEpochSamplerRT::SkipFirstEpochSamplerRT(int64_t start_index, int64_t num_samples, int64_t samples_per_tensor) : SequentialSamplerRT(start_index, num_samples, samples_per_tensor), sample_need_to_skip_(start_index) {} @@ -191,4 +191,4 @@ Status SkipFirstEpochSamplerRT::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.h index a6384832d655845fe0271c503e58ed17ea263b28..dd65d40b612313c41f44fbace35368f7baee86a6 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SkipFirstEpochSamplerRT : public SequentialSamplerRT { public: @@ -64,6 +64,6 @@ class SkipFirstEpochSamplerRT : public SequentialSamplerRT { bool first_epoch_done_ = false; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SKIP_FIRST_EPOCH_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.cc index fb69cd44a75ee1866881589a388280813454a6df..d156e3fcbf24ca154b5c5fe4f4502e11d4b672d7 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/core/global_context.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor. SubsetRandomSamplerRT::SubsetRandomSamplerRT(const std::vector &indices, int64_t num_samples, @@ -71,4 +71,4 @@ Status SubsetRandomSamplerRT::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.h index 5b295afc17aac871d05f4936838c46f7396dd52c..24800fd42bf18fe96a6449700dccd694c7d569f3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// Randomly samples elements from a given list of indices, without replacement. class SubsetRandomSamplerRT : public SubsetSamplerRT { @@ -63,6 +63,6 @@ class SubsetRandomSamplerRT : public SubsetSamplerRT { std::mt19937 rand_gen_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SUBSET_RANDOM_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.cc index 3b6968524d2546c28aac99d5d1e89acdec2f3699..51b80dd9e2dd00adcbcad6b9f50bcb3c72a516ec 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.cc @@ -19,7 +19,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor. SubsetSamplerRT::SubsetSamplerRT(const std::vector &indices, int64_t num_samples, int64_t samples_per_tensor) @@ -140,4 +140,4 @@ int64_t SubsetSamplerRT::CalculateNumSamples(int64_t num_rows) { return res; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.h index 1e73e34b945a8d365afe12f2003f7079f393e53d..a276f890ed204189a8f0813a240a3ab673faf1fa 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/subset_sampler.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// Samples elements from a given list of indices. class SubsetSamplerRT : public SamplerRT { @@ -77,6 +77,6 @@ class SubsetSamplerRT : public SamplerRT { int64_t sample_id_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SUBSET_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc index 455929c2d7719acd6d8249c1b2563639ee8b1f48..328711cb9d03426f9355c9723c7080e6a6113535 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/core/global_context.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor. WeightedRandomSamplerRT::WeightedRandomSamplerRT(const std::vector &weights, int64_t num_samples, @@ -195,4 +195,4 @@ Status WeightedRandomSamplerRT::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.h index 406e1ca5ca3bedc632ad869d426faab41ccb6de5..f46ffe10e4d5ba8a8c890ecaba3157c2d3e94edd 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Samples elements from id `0, 1, ..., weights.size()-1` with given probabilities (weights). class WeightedRandomSamplerRT : public SamplerRT { @@ -93,6 +93,6 @@ class WeightedRandomSamplerRT : public SamplerRT { std::deque onepass_ids_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.cc index eec71b2bf1a47fa0d1ba326862461ec50d495c79..e164b8c7f3f4daee4e5cc99b4e0fd81b754d5437 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.cc @@ -28,7 +28,7 @@ #include "utils/ms_utils.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { SBUOp::SBUOp(const std::string &folder_path, bool decode, std::unique_ptr data_schema, std::shared_ptr sampler, int32_t num_workers, int32_t queue_size) @@ -220,4 +220,4 @@ Status SBUOp::ReplaceAll(std::string *str, const std::string &from, const std::s return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.h index 6447f2de3505cd3bceaac135305df29efbe1984f..88c3924b6659419beff4a0b1f01e73bfc1b81abb 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using SBUImageCaptionPair = std::pair; @@ -118,5 +118,5 @@ class SBUOp : public MappableLeafOp { std::vector image_caption_pairs_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SBU_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.cc index dc3dfff20c78a0729162f605a9c402e4901d9b41..197637783479fed0190503879de008f111ca02e6 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr uint32_t kSemeionImageSize = 256; constexpr uint32_t kSemeionLabelSize = 10; @@ -175,4 +175,4 @@ Status SemeionOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.h index 1d44fd0f4c5fb6e4b7ca04981897a35efb3f93a8..4b541df7464f74f3af23c362ccac22cc6a1668b9 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SemeionOp : public MappableLeafOp { public: @@ -88,5 +88,5 @@ class SemeionOp : public MappableLeafOp { std::vector semeionline_rows_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SEMEION_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.cc index 36975bd794d9b126e290370066d337e96fb6cd72..b3d7388cfccc7f6843e6acc3a3d686726895abbc 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.cc @@ -1,52 +1,52 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.h" - -#include - -#include "include/common/debug/common.h" - -namespace mindspore { -namespace dataset { -SogouNewsOp::SogouNewsOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, - int32_t op_connector_size, bool shuffle_files, int32_t num_devices, int32_t device_id, - char field_delim, const std::vector> &column_default, - const std::vector &column_name, - const std::vector &sogou_news_files_list) - : CsvOp(sogou_news_files_list, field_delim, column_default, column_name, num_workers, num_samples, - worker_connector_size, op_connector_size, shuffle_files, num_devices, device_id) {} - -void SogouNewsOp::Print(std::ostream &out, bool show_all) const { - if (!show_all) { - // Call the super class for displaying any common 1-liner info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal 1-liner info for this op. - out << "\n"; - } else { - // Call the super class for displaying any common detailed info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal stuff. - out << "\nSample count: " << total_rows_ << "\nDevice id: " << device_id_ << "\nNumber of devices: " << num_devices_ - << "\nShuffle files: " << ((shuffle_files_) ? "yes" : "no") << "\nSogouNews files list:\n"; - for (int i = 0; i < csv_files_list_.size(); ++i) { - out << " " << csv_files_list_[i]; - } - out << "\n\n"; - } -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.h" + +#include + +#include "include/common/debug/common.h" + +namespace mindspore::lite { +namespace dataset { +SogouNewsOp::SogouNewsOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, + int32_t op_connector_size, bool shuffle_files, int32_t num_devices, int32_t device_id, + char field_delim, const std::vector> &column_default, + const std::vector &column_name, + const std::vector &sogou_news_files_list) + : CsvOp(sogou_news_files_list, field_delim, column_default, column_name, num_workers, num_samples, + worker_connector_size, op_connector_size, shuffle_files, num_devices, device_id) {} + +void SogouNewsOp::Print(std::ostream &out, bool show_all) const { + if (!show_all) { + // Call the super class for displaying any common 1-liner info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal 1-liner info for this op. + out << "\n"; + } else { + // Call the super class for displaying any common detailed info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal stuff. + out << "\nSample count: " << total_rows_ << "\nDevice id: " << device_id_ << "\nNumber of devices: " << num_devices_ + << "\nShuffle files: " << ((shuffle_files_) ? "yes" : "no") << "\nSogouNews files list:\n"; + for (int i = 0; i < csv_files_list_.size(); ++i) { + out << " " << csv_files_list_[i]; + } + out << "\n\n"; + } +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.h index 928faad1bad91d28ccca5f6d489d3ac4b6db1ed6..66fdae94ef9d555f3ab6ccc7d671989551da23b1 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.h @@ -1,71 +1,71 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SOGOU_NEWS_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SOGOU_NEWS_OP_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" - -namespace mindspore { -namespace dataset { -class JaggedConnector; - -/// \class SogouNewsOp -/// \brief A Op derived class to represent SogouNews Op. -class SogouNewsOp : public CsvOp { - public: - /// \brief Constructor of SogouNewsOp. - /// \param[in] num_workers Number of worker threads reading data from sogou_news files. - /// \param[in] num_samples The number of samples to be included in the dataset. - /// \param[in] worker_connector_size Size of each internal queue. - /// \param[in] op_connector_size Size of each queue in the connector that the child operator pulls from. - /// \param[in] shuffle_files Whether or not to shuffle the files before reading data. - /// \param[in] num_devices Number of devices that the dataset should be divided into. - /// \param[in] device_id The device ID within num_devices. - /// \param[in] field_delim A char that indicates the delimiter to separate fields. - /// \param[in] column_default List of default values for the CSV field (default={}). Each item in the list is - /// either a valid type (float, int, or string). - /// \param[in] column_name List of column names of the dataset. - /// \param[in] sogounews_files_list List of file paths for the dataset files. - SogouNewsOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, - bool shuffle_files, int32_t num_devices, int32_t device_id, char field_delim, - const std::vector> &column_default, - const std::vector &column_name, const std::vector &sogou_news_files_list); - - /// \brief Destructor. - ~SogouNewsOp() = default; - - /// \brief A print method typically used for debugging. - /// \param[out] out The output stream to write output to. - /// \param[in] show_all A bool to control if you want to show all info or just a summary. - void Print(std::ostream &out, bool show_all) const override; - - /// \brief DatasetName name getter. - /// \param[in] upper A bool to control if you want to return uppercase or lowercase Op name. - /// \return DatasetName of the current Op. - std::string DatasetName(bool upper = false) const { return upper ? "SogouNews" : "sogou news"; } - - /// \brief Op name getter. - /// \return Name of the current Op. - std::string Name() const override { return "SogouNewsOp"; } -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SOGOU_NEWS_OP_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SOGOU_NEWS_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SOGOU_NEWS_OP_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" + +namespace mindspore::lite { +namespace dataset { +class JaggedConnector; + +/// \class SogouNewsOp +/// \brief A Op derived class to represent SogouNews Op. +class SogouNewsOp : public CsvOp { + public: + /// \brief Constructor of SogouNewsOp. + /// \param[in] num_workers Number of worker threads reading data from sogou_news files. + /// \param[in] num_samples The number of samples to be included in the dataset. + /// \param[in] worker_connector_size Size of each internal queue. + /// \param[in] op_connector_size Size of each queue in the connector that the child operator pulls from. + /// \param[in] shuffle_files Whether or not to shuffle the files before reading data. + /// \param[in] num_devices Number of devices that the dataset should be divided into. + /// \param[in] device_id The device ID within num_devices. + /// \param[in] field_delim A char that indicates the delimiter to separate fields. + /// \param[in] column_default List of default values for the CSV field (default={}). Each item in the list is + /// either a valid type (float, int, or string). + /// \param[in] column_name List of column names of the dataset. + /// \param[in] sogounews_files_list List of file paths for the dataset files. + SogouNewsOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, + bool shuffle_files, int32_t num_devices, int32_t device_id, char field_delim, + const std::vector> &column_default, + const std::vector &column_name, const std::vector &sogou_news_files_list); + + /// \brief Destructor. + ~SogouNewsOp() = default; + + /// \brief A print method typically used for debugging. + /// \param[out] out The output stream to write output to. + /// \param[in] show_all A bool to control if you want to show all info or just a summary. + void Print(std::ostream &out, bool show_all) const override; + + /// \brief DatasetName name getter. + /// \param[in] upper A bool to control if you want to return uppercase or lowercase Op name. + /// \return DatasetName of the current Op. + std::string DatasetName(bool upper = false) const { return upper ? "SogouNews" : "sogou news"; } + + /// \brief Op name getter. + /// \return Name of the current Op. + std::string Name() const override { return "SogouNewsOp"; } +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SOGOU_NEWS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.cc index 29e564edcafd9ec6b9e5ec850f389731573937ca..128ea5feb2af99a121f12b1db1103016b1d8ca36 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.cc @@ -27,7 +27,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr char kTestFiles[] = "testing_list.txt"; constexpr char kValFiles[] = "validation_list.txt"; @@ -206,4 +206,4 @@ Status SpeechCommandsOp::CountTotalRows(int64_t *num_rows) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.h index 8b8f5ca34971957ad6d325da0ea47f4a96d3f079..ae83d363f7dac8dc47c2e4abca9b155550a88c04 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.h @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SpeechCommandsOp : public MappableLeafOp { public: @@ -109,5 +109,5 @@ class SpeechCommandsOp : public MappableLeafOp { std::mutex mux_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SPEECH_COMMANDS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.cc index cc3ebc4f7f846567bb3484e6cda09857cf8e605d..26f64ff8800cfb25e128bd076b2e382cdeb2d5e4 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { SQuADOp::SQuADOp(const std::string &dataset_dir, const std::string &usage, int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, std::unique_ptr schema, int32_t op_connector_size, @@ -366,4 +366,4 @@ Status SQuADOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.h index e586b564a687805fbde74f5f09a6083041dbfce7..466a11891fe6ffee5d7b6ca60f885ecee37f80cc 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.h @@ -31,7 +31,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h" #include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class SQuADOp /// \brief Loading Operator of SQuAD Dataset. @@ -152,5 +152,5 @@ class SQuADOp : public NonMappableLeafOp { std::unique_ptr data_schema_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SQUAD_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.cc index e7e47dbb8a41e515b2a2405ea9156569bc4435f2..5f25c581ebbc9e112c4020ebfd7382c9ed4e8aa2 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { SST2Op::SST2Op(const std::vector &dataset_files_list, const std::string &usage, char field_delim, const std::vector> &column_default, @@ -134,4 +134,4 @@ Status SST2Op::LoadFile(const std::string &file, int64_t start_offset, int64_t e return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.h index d73c55c92217110dbaa347acb2671c3d070e9600..2f2cff2d0149958e01203f5003e59cf6c55ff7de 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SST2Op : public CsvOp { public: @@ -81,5 +81,5 @@ class SST2Op : public CsvOp { std::string usage_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SST2_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.cc index 03abc9ac88362e7b956d32fb3174a1fde1ee7870..30b866130ae93bf918693e55dde745ea0fa571c2 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.cc @@ -29,7 +29,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr uint32_t kSTLImageRows = 96; constexpr uint32_t kSTLImageCols = 96; @@ -414,4 +414,4 @@ Status STL10Op::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.h index 8a8561368f5733f9d4e53042932629fb01cd46a1..352615222e56a6dd15e593a528f82879b7ee5fbe 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class STL10Op : public MappableLeafOp { public: @@ -114,5 +114,5 @@ class STL10Op : public MappableLeafOp { std::vector label_path_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_STL10_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.cc index 6779a5f180710f30af78094cb8e24c8f56d8e94d..5107b8ed18c952d52817d8509888de027ac9ad7f 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.cc @@ -28,7 +28,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr char kCategoriesMeta[] = "ClassName.txt"; @@ -233,4 +233,4 @@ Status SUN397Op::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.h index ea73ec57d78316adda1795cb7b2aa418ab701aff..3b7f2c3c404a2592aae654f0b347277840db6466 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Forward declares. template @@ -112,5 +112,5 @@ class SUN397Op : public MappableLeafOp { std::vector> image_path_label_pairs_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_SUN397_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.cc index ff614a26915b7e988177cc9af8d93209c7cfdef6..cea967d49253a994308f8d7bc67584f5460f5e92 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.cc @@ -1,313 +1,313 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.h" - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/core/config_manager.h" -#include "mindspore-lite/minddata/dataset/core/tensor_shape.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" -#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -#include "utils/file_utils.h" - -namespace mindspore { -namespace dataset { -TedliumOp::TedliumOp(const std::string &dataset_dir, const std::string &release, const std::string &usage, - const std::string &extensions, int32_t num_parallel_workers, - std::unique_ptr data_schema, std::shared_ptr sampler, int32_t queue_size) - : MappableLeafOp(num_parallel_workers, queue_size, std::move(sampler)), - dataset_dir_(dataset_dir), - release_(release), - usage_(usage), - extensions_(extensions), - data_schema_(std::move(data_schema)), - audio_files_({}), - usage_list_({}) {} - -void TedliumOp::Print(std::ostream &out, bool show_all) const { - if (!show_all) { - // Call the super class for displaying any common 1-liner info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal 1-liner info for this op. - out << "\n"; - } else { - // Call the super class for displaying any common detailed info. - ParallelOp::Print(out, show_all); - // Then show any custom derived-internal stuff. - out << "\nNumber of rows: " << num_rows_ << "\nTedliumOp directory: " << dataset_dir_; - } -} - -Status TedliumOp::PrepareData() { - auto real_path = FileUtils::GetRealPath(dataset_dir_.c_str()); - if (!real_path.has_value()) { - RETURN_STATUS_UNEXPECTED("Invalid file, get real path failed, path=" + dataset_dir_); - } - Path root_folder(real_path.value()); - - if (release_ == "release1" || release_ == "release2") { - if (usage_ == "train" || usage_ == "test" || usage_ == "dev") { - usage_list_.push_back(usage_); - } else if (usage_ == "all") { - usage_list_ = {"train", "test", "dev"}; - } else { - RETURN_STATUS_UNEXPECTED( - "Invalid parameter, usage should be \"train\", \"test\", \"dev\" or \"all\" when " - "specify \"release1\" or \"release2\" , got " + - usage_); - } - for (int32_t i = 0; i < usage_list_.size(); ++i) { - Path stm_folder = root_folder / usage_list_[i] / "stm"; - RETURN_IF_NOT_OK(ReadStmFolderRows(stm_folder, usage_list_[i])); - } - } else if (release_ == "release3") { - if (usage_ == "all") { - Path stm_folder = root_folder / "data" / "stm"; - RETURN_IF_NOT_OK(ReadStmFolderRows(stm_folder, "data")); - } else { - RETURN_STATUS_UNEXPECTED("Invalid parameter, usage should be \"all\" when specify \"release3\" , got " + usage_); - } - } - std::sort(audio_files_.begin(), audio_files_.end()); - num_rows_ = audio_files_.size(); - if (num_rows_ == 0) { - RETURN_STATUS_UNEXPECTED( - "Invalid data, no valid data matching the dataset API TedliumDataset. Please check file path or dataset API."); - } - return Status::OK(); -} - -Status TedliumOp::ReadStmFolderRows(const Path &stm_folder, const std::string &release_usage) { - Path dir(stm_folder); - std::shared_ptr dirItr = Path::DirIterator::OpenDirectory(&dir); - if (!dir.Exists() || dirItr == nullptr) { - RETURN_STATUS_UNEXPECTED("Invalid file, failed to open folder: " + dir.ToString()); - } - MS_LOG(DEBUG) << "Tedlium " + release_ + " stm folder Path found: " << dir << "."; - while (dirItr->HasNext()) { - Path file = dirItr->Next(); - if (file.Extension() == ".stm") { - std::ifstream handle(file.ToString(), std::ios::in); - if (!handle.is_open()) { - RETURN_STATUS_UNEXPECTED("Invalid file, failed to open file: " + file.ToString()); - } - std::string line; - int32_t numline = 0; - while (getline(handle, line)) { - std::string filename = line.substr(0, line.find(" ")); - std::stringstream ss; - ss << numline; - audio_files_.push_back({ss.str(), filename, release_usage}); - ++numline; - } - handle.close(); - } - } - return Status::OK(); -} - -Status TedliumOp::ReadStm(const Path &file_stm_path, int32_t row_line, std::string *talk_id, std::string *speaker_id, - std::string *start_time, std::string *end_time, std::string *identifier, - std::string *transcript) { - std::ifstream handle(file_stm_path.ToString().c_str(), std::ios::in); - if (!handle.is_open()) { - RETURN_STATUS_UNEXPECTED("Invalid file, get real path failed, path=" + file_stm_path.ToString()); - } - std::string line; - int32_t i = 0; - while (i <= row_line && getline(handle, line)) { - ++i; - } - handle.close(); - std::vector temp; - i = 0; - const int32_t data_stm_number = 7; - // There are seven pieces of data in each row, which need to be read out and stored - // with a space as a separator. - // Talk_id, _, speaker_id, start_time, end_time, identifier, transcript. - // "_" is the data we don't need. - while (i < data_stm_number - 1) { - std::string s = line.substr(0, line.find(" ")); - temp.push_back(s); - line.erase(0, line.find(" ") + 1); // to delete space, so use s.find(" ") + 1. - ++i; - } - temp.push_back(line); - if (temp.size() != data_stm_number) { - RETURN_STATUS_UNEXPECTED("Invalid data, stm data was broken."); - } - - const int32_t talk_id_num = 0, speaker_id_num = 2, start_time_num = 3, end_time_num = 4, identifier_num = 5, - transcript_num = 6; - *talk_id = temp[talk_id_num]; - // temp[1] is "_", which is the data we don't need. - *speaker_id = temp[speaker_id_num]; - *start_time = temp[start_time_num]; - *end_time = temp[end_time_num]; - *identifier = temp[identifier_num]; - *transcript = temp[transcript_num]; - - return Status::OK(); -} - -Status TedliumOp::ReadSph(const Path &file_sph_path, double start_time, double end_time, int32_t *sample_rate, - std::vector *result) { - std::ifstream handle(file_sph_path.ToString().c_str(), std::ios::in | std::ios::binary); - if (!handle.is_open()) { - RETURN_STATUS_UNEXPECTED("Invalid file, failed to open file: " + file_sph_path.ToString()); - } - - char head[1024]; - handle.read(head, sizeof(head)); - CHECK_FAIL_RETURN_UNEXPECTED(!handle.fail(), - "Invalid data, failed to read head part from sph file: " + file_sph_path.ToString() + - ", re-download dataset(make sure the data is true)."); - std::vector vec; - for (int32_t i = 0, j = 0; i < strlen(head); ++i) { - if (head[i] == '\n' || head[i] == ' ') { - while (head[i + 1] == ' ') { - i++; - } - std::string strTemp(head + j, i - j); - vec.push_back(strTemp); - j = i + 1; - } - } - const int32_t dataToBytes = 2; - for (int32_t i = 0; i < vec.size(); ++i) { - if (vec[i] == "sample_rate") { - *sample_rate = atoi(vec[i + dataToBytes].c_str()); - } - } - - int32_t start = static_cast(start_time * (*sample_rate)); - int32_t end = static_cast(end_time * (*sample_rate)); - const int32_t size = (end - start); - std::vector temp(size * dataToBytes); - handle.seekg(start, std::ios::beg); - int32_t j = 0; - char c; - while (j < size * dataToBytes) { - handle.read(&c, 1); - CHECK_FAIL_RETURN_UNEXPECTED(!handle.fail(), - "Invalid data, failed to read data part from sph file: " + file_sph_path.ToString() + - ", re-download dataset(make sure the data is true)."); - temp.push_back(c); - ++j; - } - - const float kMaxVal = 32767.0; - for (int32_t i = 0; i < size; ++i) { - char bh = temp[2 * i]; - char bl = temp[2 * i + 1]; - // SPH audio files is big-endian, so we should convert the two bytes of data into int16_t based - // on the high 8 bits and the low 8 bits. - int16_t s = static_cast(((bh & 0x00FF) << 8) | (bl & 0x00FF)); - // Data normalization: Convert the data from the interval [-32768,32767] to the interval [-1,1]. - double t = s / kMaxVal; - (*result).push_back(t); - } - handle.close(); - - return Status::OK(); -} - -Status TedliumOp::LoadTensorRow(row_id_type row_id, TensorRow *row) { - int32_t row_line = atoi(audio_files_[row_id][0].c_str()); - std::string file_name = audio_files_[row_id][1]; - std::string file_usage_or3_none_ = audio_files_[row_id][2]; - Path dir_path(dataset_dir_); - Path file_stm_path = dir_path / file_usage_or3_none_ / "stm" / (file_name + ".stm"); - Path file_sph_path = dir_path / file_usage_or3_none_ / "sph" / (file_name + extensions_); - std::string talk_id, speaker_id, start_time, end_time, identifier, transcript; - std::vector result; - int32_t sample_rate; - RETURN_IF_NOT_OK( - ReadStm(file_stm_path, row_line, &talk_id, &speaker_id, &start_time, &end_time, &identifier, &transcript)); - RETURN_IF_NOT_OK(ReadSph(file_sph_path, atof(start_time.c_str()), atof(end_time.c_str()), &sample_rate, &result)); - - std::shared_ptr sample_rate_tensor, talk_id_tensor, speaker_id_tensor, identifier_tensor, transcript_tensor; - RETURN_IF_NOT_OK(Tensor::CreateScalar(sample_rate, &sample_rate_tensor)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(talk_id, &talk_id_tensor)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(speaker_id, &speaker_id_tensor)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(identifier, &identifier_tensor)); - RETURN_IF_NOT_OK(Tensor::CreateScalar(transcript, &transcript_tensor)); - - std::shared_ptr audio_tensor; - RETURN_IF_NOT_OK(Tensor::CreateFromVector(result, &audio_tensor)); - RETURN_IF_NOT_OK(audio_tensor->ExpandDim(0)); - (*row) = TensorRow(row_id, {audio_tensor, sample_rate_tensor, transcript_tensor, talk_id_tensor, speaker_id_tensor, - identifier_tensor}); - row->setPath({file_sph_path.ToString(), file_sph_path.ToString(), file_stm_path.ToString(), file_stm_path.ToString(), - file_stm_path.ToString(), file_stm_path.ToString()}); - - return Status::OK(); -} - -Status TedliumOp::CountTotalRows(const std::string &dataset_dir, const std::string &release, const std::string &usage, - const std::string &extensions, int64_t *count) { - // the logic of counting the number of samples is copied from PrepareData() - RETURN_UNEXPECTED_IF_NULL(count); - *count = 0; - const int64_t num_samples = 0; - const int64_t start_index = 0; - auto new_sampler = std::make_shared(start_index, num_samples); - - // build a new unique schema object - auto new_schema = std::make_unique(); - RETURN_IF_NOT_OK( - new_schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kFlexible, 1))); - TensorShape sample_rate_scalar = TensorShape::CreateScalar(); - TensorShape trans_scalar = TensorShape::CreateScalar(); - TensorShape talk_id_scalar = TensorShape::CreateScalar(); - TensorShape speaker_id_scalar = TensorShape::CreateScalar(); - TensorShape identi_scalar = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(new_schema->AddColumn( - ColDescriptor("sample_rate", DataType(DataType::DE_INT32), TensorImpl::kFlexible, 0, &sample_rate_scalar))); - RETURN_IF_NOT_OK(new_schema->AddColumn( - ColDescriptor("transcript", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &trans_scalar))); - RETURN_IF_NOT_OK(new_schema->AddColumn( - ColDescriptor("talk_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &talk_id_scalar))); - RETURN_IF_NOT_OK(new_schema->AddColumn( - ColDescriptor("speaker_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &speaker_id_scalar))); - RETURN_IF_NOT_OK(new_schema->AddColumn( - ColDescriptor("identifier", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &identi_scalar))); - - std::shared_ptr cfg = GlobalContext::config_manager(); - int32_t num_workers = cfg->num_parallel_workers(); - int32_t op_connect_size = cfg->op_connector_size(); - std::shared_ptr op = - std::make_shared(dataset_dir, release, usage, extensions, num_workers, std::move(new_schema), - std::move(new_sampler), op_connect_size); - RETURN_IF_NOT_OK(op->PrepareData()); - *count = static_cast(op->audio_files_.size()); - return Status::OK(); -} - -Status TedliumOp::ComputeColMap() { - if (column_name_id_map_.empty()) { - for (int32_t i = 0; i < data_schema_->NumColumns(); ++i) { - column_name_id_map_[data_schema_->Column(i).Name()] = i; - } - } else { - MS_LOG(WARNING) << "Column name map is already set!"; - } - return Status::OK(); -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.h" + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/core/config_manager.h" +#include "mindspore-lite/minddata/dataset/core/tensor_shape.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" +#include "mindspore-lite/minddata/dataset/engine/execution_tree.h" +#include "utils/file_utils.h" + +namespace mindspore::lite { +namespace dataset { +TedliumOp::TedliumOp(const std::string &dataset_dir, const std::string &release, const std::string &usage, + const std::string &extensions, int32_t num_parallel_workers, + std::unique_ptr data_schema, std::shared_ptr sampler, int32_t queue_size) + : MappableLeafOp(num_parallel_workers, queue_size, std::move(sampler)), + dataset_dir_(dataset_dir), + release_(release), + usage_(usage), + extensions_(extensions), + data_schema_(std::move(data_schema)), + audio_files_({}), + usage_list_({}) {} + +void TedliumOp::Print(std::ostream &out, bool show_all) const { + if (!show_all) { + // Call the super class for displaying any common 1-liner info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal 1-liner info for this op. + out << "\n"; + } else { + // Call the super class for displaying any common detailed info. + ParallelOp::Print(out, show_all); + // Then show any custom derived-internal stuff. + out << "\nNumber of rows: " << num_rows_ << "\nTedliumOp directory: " << dataset_dir_; + } +} + +Status TedliumOp::PrepareData() { + auto real_path = FileUtils::GetRealPath(dataset_dir_.c_str()); + if (!real_path.has_value()) { + RETURN_STATUS_UNEXPECTED("Invalid file, get real path failed, path=" + dataset_dir_); + } + Path root_folder(real_path.value()); + + if (release_ == "release1" || release_ == "release2") { + if (usage_ == "train" || usage_ == "test" || usage_ == "dev") { + usage_list_.push_back(usage_); + } else if (usage_ == "all") { + usage_list_ = {"train", "test", "dev"}; + } else { + RETURN_STATUS_UNEXPECTED( + "Invalid parameter, usage should be \"train\", \"test\", \"dev\" or \"all\" when " + "specify \"release1\" or \"release2\" , got " + + usage_); + } + for (int32_t i = 0; i < usage_list_.size(); ++i) { + Path stm_folder = root_folder / usage_list_[i] / "stm"; + RETURN_IF_NOT_OK(ReadStmFolderRows(stm_folder, usage_list_[i])); + } + } else if (release_ == "release3") { + if (usage_ == "all") { + Path stm_folder = root_folder / "data" / "stm"; + RETURN_IF_NOT_OK(ReadStmFolderRows(stm_folder, "data")); + } else { + RETURN_STATUS_UNEXPECTED("Invalid parameter, usage should be \"all\" when specify \"release3\" , got " + usage_); + } + } + std::sort(audio_files_.begin(), audio_files_.end()); + num_rows_ = audio_files_.size(); + if (num_rows_ == 0) { + RETURN_STATUS_UNEXPECTED( + "Invalid data, no valid data matching the dataset API TedliumDataset. Please check file path or dataset API."); + } + return Status::OK(); +} + +Status TedliumOp::ReadStmFolderRows(const Path &stm_folder, const std::string &release_usage) { + Path dir(stm_folder); + std::shared_ptr dirItr = Path::DirIterator::OpenDirectory(&dir); + if (!dir.Exists() || dirItr == nullptr) { + RETURN_STATUS_UNEXPECTED("Invalid file, failed to open folder: " + dir.ToString()); + } + MS_LOG(DEBUG) << "Tedlium " + release_ + " stm folder Path found: " << dir << "."; + while (dirItr->HasNext()) { + Path file = dirItr->Next(); + if (file.Extension() == ".stm") { + std::ifstream handle(file.ToString(), std::ios::in); + if (!handle.is_open()) { + RETURN_STATUS_UNEXPECTED("Invalid file, failed to open file: " + file.ToString()); + } + std::string line; + int32_t numline = 0; + while (getline(handle, line)) { + std::string filename = line.substr(0, line.find(" ")); + std::stringstream ss; + ss << numline; + audio_files_.push_back({ss.str(), filename, release_usage}); + ++numline; + } + handle.close(); + } + } + return Status::OK(); +} + +Status TedliumOp::ReadStm(const Path &file_stm_path, int32_t row_line, std::string *talk_id, std::string *speaker_id, + std::string *start_time, std::string *end_time, std::string *identifier, + std::string *transcript) { + std::ifstream handle(file_stm_path.ToString().c_str(), std::ios::in); + if (!handle.is_open()) { + RETURN_STATUS_UNEXPECTED("Invalid file, get real path failed, path=" + file_stm_path.ToString()); + } + std::string line; + int32_t i = 0; + while (i <= row_line && getline(handle, line)) { + ++i; + } + handle.close(); + std::vector temp; + i = 0; + const int32_t data_stm_number = 7; + // There are seven pieces of data in each row, which need to be read out and stored + // with a space as a separator. + // Talk_id, _, speaker_id, start_time, end_time, identifier, transcript. + // "_" is the data we don't need. + while (i < data_stm_number - 1) { + std::string s = line.substr(0, line.find(" ")); + temp.push_back(s); + line.erase(0, line.find(" ") + 1); // to delete space, so use s.find(" ") + 1. + ++i; + } + temp.push_back(line); + if (temp.size() != data_stm_number) { + RETURN_STATUS_UNEXPECTED("Invalid data, stm data was broken."); + } + + const int32_t talk_id_num = 0, speaker_id_num = 2, start_time_num = 3, end_time_num = 4, identifier_num = 5, + transcript_num = 6; + *talk_id = temp[talk_id_num]; + // temp[1] is "_", which is the data we don't need. + *speaker_id = temp[speaker_id_num]; + *start_time = temp[start_time_num]; + *end_time = temp[end_time_num]; + *identifier = temp[identifier_num]; + *transcript = temp[transcript_num]; + + return Status::OK(); +} + +Status TedliumOp::ReadSph(const Path &file_sph_path, double start_time, double end_time, int32_t *sample_rate, + std::vector *result) { + std::ifstream handle(file_sph_path.ToString().c_str(), std::ios::in | std::ios::binary); + if (!handle.is_open()) { + RETURN_STATUS_UNEXPECTED("Invalid file, failed to open file: " + file_sph_path.ToString()); + } + + char head[1024]; + handle.read(head, sizeof(head)); + CHECK_FAIL_RETURN_UNEXPECTED(!handle.fail(), + "Invalid data, failed to read head part from sph file: " + file_sph_path.ToString() + + ", re-download dataset(make sure the data is true)."); + std::vector vec; + for (int32_t i = 0, j = 0; i < strlen(head); ++i) { + if (head[i] == '\n' || head[i] == ' ') { + while (head[i + 1] == ' ') { + i++; + } + std::string strTemp(head + j, i - j); + vec.push_back(strTemp); + j = i + 1; + } + } + const int32_t dataToBytes = 2; + for (int32_t i = 0; i < vec.size(); ++i) { + if (vec[i] == "sample_rate") { + *sample_rate = atoi(vec[i + dataToBytes].c_str()); + } + } + + int32_t start = static_cast(start_time * (*sample_rate)); + int32_t end = static_cast(end_time * (*sample_rate)); + const int32_t size = (end - start); + std::vector temp(size * dataToBytes); + handle.seekg(start, std::ios::beg); + int32_t j = 0; + char c; + while (j < size * dataToBytes) { + handle.read(&c, 1); + CHECK_FAIL_RETURN_UNEXPECTED(!handle.fail(), + "Invalid data, failed to read data part from sph file: " + file_sph_path.ToString() + + ", re-download dataset(make sure the data is true)."); + temp.push_back(c); + ++j; + } + + const float kMaxVal = 32767.0; + for (int32_t i = 0; i < size; ++i) { + char bh = temp[2 * i]; + char bl = temp[2 * i + 1]; + // SPH audio files is big-endian, so we should convert the two bytes of data into int16_t based + // on the high 8 bits and the low 8 bits. + int16_t s = static_cast(((bh & 0x00FF) << 8) | (bl & 0x00FF)); + // Data normalization: Convert the data from the interval [-32768,32767] to the interval [-1,1]. + double t = s / kMaxVal; + (*result).push_back(t); + } + handle.close(); + + return Status::OK(); +} + +Status TedliumOp::LoadTensorRow(row_id_type row_id, TensorRow *row) { + int32_t row_line = atoi(audio_files_[row_id][0].c_str()); + std::string file_name = audio_files_[row_id][1]; + std::string file_usage_or3_none_ = audio_files_[row_id][2]; + Path dir_path(dataset_dir_); + Path file_stm_path = dir_path / file_usage_or3_none_ / "stm" / (file_name + ".stm"); + Path file_sph_path = dir_path / file_usage_or3_none_ / "sph" / (file_name + extensions_); + std::string talk_id, speaker_id, start_time, end_time, identifier, transcript; + std::vector result; + int32_t sample_rate; + RETURN_IF_NOT_OK( + ReadStm(file_stm_path, row_line, &talk_id, &speaker_id, &start_time, &end_time, &identifier, &transcript)); + RETURN_IF_NOT_OK(ReadSph(file_sph_path, atof(start_time.c_str()), atof(end_time.c_str()), &sample_rate, &result)); + + std::shared_ptr sample_rate_tensor, talk_id_tensor, speaker_id_tensor, identifier_tensor, transcript_tensor; + RETURN_IF_NOT_OK(Tensor::CreateScalar(sample_rate, &sample_rate_tensor)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(talk_id, &talk_id_tensor)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(speaker_id, &speaker_id_tensor)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(identifier, &identifier_tensor)); + RETURN_IF_NOT_OK(Tensor::CreateScalar(transcript, &transcript_tensor)); + + std::shared_ptr audio_tensor; + RETURN_IF_NOT_OK(Tensor::CreateFromVector(result, &audio_tensor)); + RETURN_IF_NOT_OK(audio_tensor->ExpandDim(0)); + (*row) = TensorRow(row_id, {audio_tensor, sample_rate_tensor, transcript_tensor, talk_id_tensor, speaker_id_tensor, + identifier_tensor}); + row->setPath({file_sph_path.ToString(), file_sph_path.ToString(), file_stm_path.ToString(), file_stm_path.ToString(), + file_stm_path.ToString(), file_stm_path.ToString()}); + + return Status::OK(); +} + +Status TedliumOp::CountTotalRows(const std::string &dataset_dir, const std::string &release, const std::string &usage, + const std::string &extensions, int64_t *count) { + // the logic of counting the number of samples is copied from PrepareData() + RETURN_UNEXPECTED_IF_NULL(count); + *count = 0; + const int64_t num_samples = 0; + const int64_t start_index = 0; + auto new_sampler = std::make_shared(start_index, num_samples); + + // build a new unique schema object + auto new_schema = std::make_unique(); + RETURN_IF_NOT_OK( + new_schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kFlexible, 1))); + TensorShape sample_rate_scalar = TensorShape::CreateScalar(); + TensorShape trans_scalar = TensorShape::CreateScalar(); + TensorShape talk_id_scalar = TensorShape::CreateScalar(); + TensorShape speaker_id_scalar = TensorShape::CreateScalar(); + TensorShape identi_scalar = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(new_schema->AddColumn( + ColDescriptor("sample_rate", DataType(DataType::DE_INT32), TensorImpl::kFlexible, 0, &sample_rate_scalar))); + RETURN_IF_NOT_OK(new_schema->AddColumn( + ColDescriptor("transcript", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &trans_scalar))); + RETURN_IF_NOT_OK(new_schema->AddColumn( + ColDescriptor("talk_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &talk_id_scalar))); + RETURN_IF_NOT_OK(new_schema->AddColumn( + ColDescriptor("speaker_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &speaker_id_scalar))); + RETURN_IF_NOT_OK(new_schema->AddColumn( + ColDescriptor("identifier", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &identi_scalar))); + + std::shared_ptr cfg = GlobalContext::config_manager(); + int32_t num_workers = cfg->num_parallel_workers(); + int32_t op_connect_size = cfg->op_connector_size(); + std::shared_ptr op = + std::make_shared(dataset_dir, release, usage, extensions, num_workers, std::move(new_schema), + std::move(new_sampler), op_connect_size); + RETURN_IF_NOT_OK(op->PrepareData()); + *count = static_cast(op->audio_files_.size()); + return Status::OK(); +} + +Status TedliumOp::ComputeColMap() { + if (column_name_id_map_.empty()) { + for (int32_t i = 0; i < data_schema_->NumColumns(); ++i) { + column_name_id_map_[data_schema_->Column(i).Name()] = i; + } + } else { + MS_LOG(WARNING) << "Column name map is already set!"; + } + return Status::OK(); +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.h index 86c0137420ba9a2d07766c9e5b0be2a4d23d04a7..bc33d9400ad674fd9a2cee075d1e105830576cea 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.h @@ -1,126 +1,126 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_TEDLIUM_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_TEDLIUM_OP_H_ - -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/core/tensor.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -#include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.h" - -#include "mindspore-lite/minddata/dataset/util/status.h" -#include "mindspore-lite/minddata/dataset/util/path.h" - -namespace mindspore { -namespace dataset { -class TedliumOp : public MappableLeafOp { - public: - /// \brief Constructor. - /// \param[in] dataset_dir Directory of tedlium dataset. - /// \param[in] release Release of tedlium dataset, can be 'release1', 'release2' or 'release3'. - /// \param[in] usage Usage of this dataset, if release is release3, can be '', else 'train', 'dev', 'test' or 'all'. - /// \param[in] extensions Extensions of the sph file, only '.sph' is valid. - /// \param[in] num_parallel_workers Number of workers in parallel. - /// \param[in] data_schema Schema of dataset. - /// \param[in] sampler Sampler tells TedliumOp what to read. - /// \param[in] queue_size Connector queue size. - TedliumOp(const std::string &dataset_dir, const std::string &release, const std::string &usage, - const std::string &extensions, int32_t num_parallel_workers, std::unique_ptr data_schema, - std::shared_ptr sampler, int32_t queue_size); - - /// \brief Destructor. - ~TedliumOp() = default; - - /// \brief A print method typically used for debugging. - /// \param[in] out Out stream. - /// \param[in] show_all Whether to show all information. - void Print(std::ostream &out, bool show_all) const override; - - /// \brief Op name getter. - std::string Name() const override { return "TedliumOp"; } - - /// \brief Initialize TedliumOp related var, calls the function to walk all files. - /// \return Status The status code returned. - Status PrepareData() override; - - /// \brief Function to count the number of samples in the TEDLIUM dataset. - /// \param[in] dataset_dir Directory of tedlium dataset. - /// \param[in] release Release of tedlium dataset. - /// \param[in] usage Usage of this dataset, if release is release3, can be '', else 'train', 'dev', 'test' or 'all'. - /// \param[in] extensions Extensions of the sph file, only '.sph' is valid. - /// \param[in] count Output arg that will hold the actual dataset size. - /// \return Status The status code returned. - static Status CountTotalRows(const std::string &dataset_dir, const std::string &release, const std::string &usage, - const std::string &extensions, int64_t *count); - - private: - /// \brief Read stm file. - /// \param[in] file_stm_path The path of stm file. - /// \param[in] row_line Which line of the file we need to read. - /// \param[out] talk_id Talk identifier of the row_line in the file. - /// \param[out] speaker_id Speaker identifier of the row_line in the file. - /// \param[out] start_time Start time of the row_line in the file. - /// \param[out] end_time End time of the row_line in the file. - /// \param[out] identifier Identifier of the row_line in the file. - /// \param[out] transcript Transcript of the row_line in the file. - /// \return Status The status code returned. - Status ReadStm(const Path &file_stm_path, int32_t row_line, std::string *talk_id, std::string *speaker_id, - std::string *start_time, std::string *end_time, std::string *identifier, std::string *transcript); - - /// \brief Read sph file. - /// \param[in] file_sph_path The path of sph file. - /// \param[in] start_time The start_time of row we need to use. - /// \param[in] end_time The end_time of row we need to use. - /// \param[out] sample_rate Sample rate of the row. - /// \param[out] result Waveform result vector of the row. - /// \return Status The status code returned. - Status ReadSph(const Path &file_sph_path, double start_time, double end_time, int32_t *sample_rate, - std::vector *result); - - /// \brief Read stm files according current release`s usage. - /// \param[in] stm_folder The folder of stm files. - /// \param[in] release_usage For release1 or release2, use usage_, for release3, "data". - /// \return Status The status code returned. - Status ReadStmFolderRows(const Path &stm_folder, const std::string &release_usage); - - /// \brief Load a tensor row according to a pair. - /// \param[in] row_id Id of row need to load. - /// \param[in] row Audio & label read into this tensor row. - /// \return Status The status code returned. - Status LoadTensorRow(row_id_type row_id, TensorRow *row) override; - - /// \brief Private function for computing the assignment of the column name map. - /// \return Status The status code returned. - Status ComputeColMap() override; - - const std::string release_; - const std::string dataset_dir_; - const std::string usage_; - const std::string extensions_; - std::unique_ptr data_schema_; - - std::vector > audio_files_; - std::vector usage_list_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_TEDLIUM_OP_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_TEDLIUM_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_TEDLIUM_OP_H_ + +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/core/tensor.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/mappable_leaf_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" +#include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.h" + +#include "mindspore-lite/minddata/dataset/util/status.h" +#include "mindspore-lite/minddata/dataset/util/path.h" + +namespace mindspore::lite { +namespace dataset { +class TedliumOp : public MappableLeafOp { + public: + /// \brief Constructor. + /// \param[in] dataset_dir Directory of tedlium dataset. + /// \param[in] release Release of tedlium dataset, can be 'release1', 'release2' or 'release3'. + /// \param[in] usage Usage of this dataset, if release is release3, can be '', else 'train', 'dev', 'test' or 'all'. + /// \param[in] extensions Extensions of the sph file, only '.sph' is valid. + /// \param[in] num_parallel_workers Number of workers in parallel. + /// \param[in] data_schema Schema of dataset. + /// \param[in] sampler Sampler tells TedliumOp what to read. + /// \param[in] queue_size Connector queue size. + TedliumOp(const std::string &dataset_dir, const std::string &release, const std::string &usage, + const std::string &extensions, int32_t num_parallel_workers, std::unique_ptr data_schema, + std::shared_ptr sampler, int32_t queue_size); + + /// \brief Destructor. + ~TedliumOp() = default; + + /// \brief A print method typically used for debugging. + /// \param[in] out Out stream. + /// \param[in] show_all Whether to show all information. + void Print(std::ostream &out, bool show_all) const override; + + /// \brief Op name getter. + std::string Name() const override { return "TedliumOp"; } + + /// \brief Initialize TedliumOp related var, calls the function to walk all files. + /// \return Status The status code returned. + Status PrepareData() override; + + /// \brief Function to count the number of samples in the TEDLIUM dataset. + /// \param[in] dataset_dir Directory of tedlium dataset. + /// \param[in] release Release of tedlium dataset. + /// \param[in] usage Usage of this dataset, if release is release3, can be '', else 'train', 'dev', 'test' or 'all'. + /// \param[in] extensions Extensions of the sph file, only '.sph' is valid. + /// \param[in] count Output arg that will hold the actual dataset size. + /// \return Status The status code returned. + static Status CountTotalRows(const std::string &dataset_dir, const std::string &release, const std::string &usage, + const std::string &extensions, int64_t *count); + + private: + /// \brief Read stm file. + /// \param[in] file_stm_path The path of stm file. + /// \param[in] row_line Which line of the file we need to read. + /// \param[out] talk_id Talk identifier of the row_line in the file. + /// \param[out] speaker_id Speaker identifier of the row_line in the file. + /// \param[out] start_time Start time of the row_line in the file. + /// \param[out] end_time End time of the row_line in the file. + /// \param[out] identifier Identifier of the row_line in the file. + /// \param[out] transcript Transcript of the row_line in the file. + /// \return Status The status code returned. + Status ReadStm(const Path &file_stm_path, int32_t row_line, std::string *talk_id, std::string *speaker_id, + std::string *start_time, std::string *end_time, std::string *identifier, std::string *transcript); + + /// \brief Read sph file. + /// \param[in] file_sph_path The path of sph file. + /// \param[in] start_time The start_time of row we need to use. + /// \param[in] end_time The end_time of row we need to use. + /// \param[out] sample_rate Sample rate of the row. + /// \param[out] result Waveform result vector of the row. + /// \return Status The status code returned. + Status ReadSph(const Path &file_sph_path, double start_time, double end_time, int32_t *sample_rate, + std::vector *result); + + /// \brief Read stm files according current release`s usage. + /// \param[in] stm_folder The folder of stm files. + /// \param[in] release_usage For release1 or release2, use usage_, for release3, "data". + /// \return Status The status code returned. + Status ReadStmFolderRows(const Path &stm_folder, const std::string &release_usage); + + /// \brief Load a tensor row according to a pair. + /// \param[in] row_id Id of row need to load. + /// \param[in] row Audio & label read into this tensor row. + /// \return Status The status code returned. + Status LoadTensorRow(row_id_type row_id, TensorRow *row) override; + + /// \brief Private function for computing the assignment of the column name map. + /// \return Status The status code returned. + Status ComputeColMap() override; + + const std::string release_; + const std::string dataset_dir_; + const std::string usage_; + const std::string extensions_; + std::unique_ptr data_schema_; + + std::vector > audio_files_; + std::vector usage_list_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_TEDLIUM_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.cc index 0a7c92d8cc0cf1ca6a08156b229351f8cbb21cfc..7f3928ac25e50ad9954b0fee48fca49bc3ab2b59 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/wait_post.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { TextFileOp::TextFileOp(int32_t num_workers, int64_t total_rows, int32_t worker_connector_size, std::unique_ptr schema, std::vector text_files_list, @@ -255,4 +255,4 @@ Status TextFileOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h index b6b20cef6e88b68633a7e9e9013246110fb21330..880b2d428faa3f96c9ba220a274afff83058582d 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/util/wait_post.h" #include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using StringIndex = AutoIndexObj; @@ -120,5 +120,5 @@ class TextFileOp : public NonMappableLeafOp { std::unique_ptr data_schema_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_TEXT_FILE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.cc index 40833eb2f2651896e860dfcd759a5084d738b555..e116e17aaab3d954b375b6c04e45bd2d5b7c902d 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.cc @@ -36,7 +36,7 @@ #include "utils/file_utils.h" #include "utils/system/crc32c.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { TFReaderOp::TFReaderOp(int32_t num_workers, int32_t worker_connector_size, int64_t total_num_rows, std::vector dataset_files_list, std::unique_ptr data_schema, @@ -1345,4 +1345,4 @@ Status TFReaderOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.h index 2575613382b32d81d7b631dab33967ea86a7931c..8dca595f212711e9cc72d7ebc43de9ac2ae73eee 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.h @@ -45,7 +45,7 @@ class Feature; class BytesList; } // namespace dataengine -namespace mindspore { +namespace mindspore::lite { namespace dataset { const std::streamsize kTFRecordRecLenSize = sizeof(int64_t); const std::streamsize kTFRecordHeadFootSize = sizeof(int32_t); // header has same size with footer @@ -368,5 +368,5 @@ class TFReaderOp : public NonMappableLeafOp { bool decode_; // whether to parse the proto }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_TF_READER_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.cc index 1cc9dfb18f8e425a57225a06ee416f760b31abe8..84dd2867d792493aff1b8a68dae796bcc5f6024a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/wait_post.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { UDPOSOp::UDPOSOp(int32_t num_workers, int64_t total_rows, int32_t worker_connector_size, std::unique_ptr schema, const std::vector &udpos_files_list, @@ -183,4 +183,4 @@ Status UDPOSOp::LoadFile(const std::string &file, int64_t start_offset, int64_t return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.h index 4dbdc35065d8b0099bb5abc8ea3f3a183ce68bf9..9773e52ddbd5cc9cf88bcc63350e2333ee90e0f0 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h" #include "mindspore-lite/minddata/dataset/util/queue.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class JaggedConnector; @@ -92,5 +92,5 @@ class UDPOSOp : public TextFileOp { Status LoadFile(const std::string &file, int64_t start_offset, int64_t end_offset, int32_t worker_id) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_UDPOS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.cc index a5362c4a2e2f41c980567233c69b878acacfe686..05b322c8ce3b3b0a1683ab98c0f95a1246d85930 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.cc @@ -28,7 +28,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr int64_t kUSPSImageHeight = 16; constexpr int64_t kUSPSImageWidth = 16; @@ -359,4 +359,4 @@ Status USPSOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.h index b3d5b34a589ee4dfc8e85c6efe4a0bcef94785a3..59b30c12e24ceaa3b14851d587ee7454f628edfe 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.h @@ -1,137 +1,137 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_USPS_OP_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_USPS_OP_H_ - -#include -#include -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/core/tensor.h" -#include "mindspore-lite/minddata/dataset/engine/data_schema.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" -#include "mindspore-lite/minddata/dataset/util/path.h" -#include "mindspore-lite/minddata/dataset/util/queue.h" -#include "mindspore-lite/minddata/dataset/util/status.h" -#include "mindspore-lite/minddata/dataset/util/wait_post.h" -#include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" - -namespace mindspore { -namespace dataset { -class USPSOp : public NonMappableLeafOp { - public: - // Constructor. - // @param const std::string &dataset_dir - dir directory of USPS data file. - // @param const std::string &usage - Usage of this dataset, can be 'train', 'test' or 'all'. - // @param std::unique_ptr data_schema - the schema of the USPS dataset. - // @param num_workers - number of worker threads reading data from tf_file files. - // @param worker_connector_size - size of each internal queue. - // @param num_samples - number of samples to read. - // @param op_connector_size - size of each queue in the connector that the child operator pulls from. - // @param shuffle_files - whether to shuffle the files before reading data. - // @param num_devices - number of devices. - // @param device_id - device id. - USPSOp(const std::string &dataset_dir, const std::string &usage, std::unique_ptr data_schema, - int32_t num_workers, int32_t worker_connector_size, int64_t num_samples, int32_t op_connector_size, - bool shuffle_files, int32_t num_devices, int32_t device_id); - - // Destructor. - ~USPSOp() = default; - - // Op name getter. - // @return std::string - Name of the current Op. - std::string Name() const override { return "USPSOp"; } - - // A print method typically used for debugging. - // @param std::ostream &out - out stream. - // @param bool show_all - whether to show all information. - void Print(std::ostream &out, bool show_all) const override; - - // Instantiates the internal queues and connectors - // @return Status - the error code returned. - Status Init() override; - - // Function to count the number of samples in the USPS dataset. - // @param const std::string &dir - path to the USPS directory. - // @param const std::string &usage - Usage of this dataset, can be 'train', 'test' or 'all'. - // @param int64_t *count - output arg that will hold the minimum of the actual dataset size and numSamples. - // @return Status - the error coed returned. - static Status CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count); - - // File names getter. - // @return Vector of the input file names. - std::vector FileNames() { return data_files_list_; } - - private: - // Function to count the number of samples in one data file. - // @param const std::string &data_file - path to the data file. - // @return int64_t - the count result. - int64_t CountRows(const std::string &data_file) const; - - // Reads a data file and loads the data into multiple TensorRows. - // @param data_file - the data file to read. - // @param start_offset - the start offset of file. - // @param end_offset - the end offset of file. - // @param worker_id - the id of the worker that is executing this function. - // @return Status - the error code returned. - Status LoadFile(const std::string &data_file, int64_t start_offset, int64_t end_offset, int32_t worker_id) override; - - // Parses a single row and puts the data into a tensor table. - // @param line - the content of the row. - // @param trow - image & label read into this tensor row. - // @return Status - the error code returned. - Status LoadTensor(std::string *line, TensorRow *trow); - - // Calculate number of rows in each shard. - // @return Status - the error code returned. - Status CalculateNumRowsPerShard() override; - - // Fill the IOBlockQueue. - // @param i_keys - keys of file to fill to the IOBlockQueue. - // @return Status - the error code returned. - Status FillIOBlockQueue(const std::vector &i_keys) override; - - // Get all files in the dataset_dir_. - // @return Status - The status code returned. - Status GetFiles(); - - // Parse a line to image and label. - // @param line - the content of the row. - // @param images_buffer - image destination. - // @param labels_buffer - label destination. - // @return Status - the status code returned. - Status ParseLine(std::string *line, const std::unique_ptr &images_buffer, - const std::unique_ptr &labels_buffer) const; - - // Private function for computing the assignment of the column name map. - // @return Status - the error code returned. - Status ComputeColMap() override; - - const std::string usage_; // can be "all", "train" or "test". - std::string dataset_dir_; // directory of data files. - std::unique_ptr data_schema_; - - std::vector data_files_list_; -}; -} // namespace dataset -} // namespace mindspore - -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_USPS_OP_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_USPS_OP_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_USPS_OP_H_ + +#include +#include +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/core/tensor.h" +#include "mindspore-lite/minddata/dataset/engine/data_schema.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/parallel_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/nonmappable_leaf_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/sampler.h" +#include "mindspore-lite/minddata/dataset/util/path.h" +#include "mindspore-lite/minddata/dataset/util/queue.h" +#include "mindspore-lite/minddata/dataset/util/status.h" +#include "mindspore-lite/minddata/dataset/util/wait_post.h" +#include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" + +namespace mindspore::lite { +namespace dataset { +class USPSOp : public NonMappableLeafOp { + public: + // Constructor. + // @param const std::string &dataset_dir - dir directory of USPS data file. + // @param const std::string &usage - Usage of this dataset, can be 'train', 'test' or 'all'. + // @param std::unique_ptr data_schema - the schema of the USPS dataset. + // @param num_workers - number of worker threads reading data from tf_file files. + // @param worker_connector_size - size of each internal queue. + // @param num_samples - number of samples to read. + // @param op_connector_size - size of each queue in the connector that the child operator pulls from. + // @param shuffle_files - whether to shuffle the files before reading data. + // @param num_devices - number of devices. + // @param device_id - device id. + USPSOp(const std::string &dataset_dir, const std::string &usage, std::unique_ptr data_schema, + int32_t num_workers, int32_t worker_connector_size, int64_t num_samples, int32_t op_connector_size, + bool shuffle_files, int32_t num_devices, int32_t device_id); + + // Destructor. + ~USPSOp() = default; + + // Op name getter. + // @return std::string - Name of the current Op. + std::string Name() const override { return "USPSOp"; } + + // A print method typically used for debugging. + // @param std::ostream &out - out stream. + // @param bool show_all - whether to show all information. + void Print(std::ostream &out, bool show_all) const override; + + // Instantiates the internal queues and connectors + // @return Status - the error code returned. + Status Init() override; + + // Function to count the number of samples in the USPS dataset. + // @param const std::string &dir - path to the USPS directory. + // @param const std::string &usage - Usage of this dataset, can be 'train', 'test' or 'all'. + // @param int64_t *count - output arg that will hold the minimum of the actual dataset size and numSamples. + // @return Status - the error coed returned. + static Status CountTotalRows(const std::string &dir, const std::string &usage, int64_t *count); + + // File names getter. + // @return Vector of the input file names. + std::vector FileNames() { return data_files_list_; } + + private: + // Function to count the number of samples in one data file. + // @param const std::string &data_file - path to the data file. + // @return int64_t - the count result. + int64_t CountRows(const std::string &data_file) const; + + // Reads a data file and loads the data into multiple TensorRows. + // @param data_file - the data file to read. + // @param start_offset - the start offset of file. + // @param end_offset - the end offset of file. + // @param worker_id - the id of the worker that is executing this function. + // @return Status - the error code returned. + Status LoadFile(const std::string &data_file, int64_t start_offset, int64_t end_offset, int32_t worker_id) override; + + // Parses a single row and puts the data into a tensor table. + // @param line - the content of the row. + // @param trow - image & label read into this tensor row. + // @return Status - the error code returned. + Status LoadTensor(std::string *line, TensorRow *trow); + + // Calculate number of rows in each shard. + // @return Status - the error code returned. + Status CalculateNumRowsPerShard() override; + + // Fill the IOBlockQueue. + // @param i_keys - keys of file to fill to the IOBlockQueue. + // @return Status - the error code returned. + Status FillIOBlockQueue(const std::vector &i_keys) override; + + // Get all files in the dataset_dir_. + // @return Status - The status code returned. + Status GetFiles(); + + // Parse a line to image and label. + // @param line - the content of the row. + // @param images_buffer - image destination. + // @param labels_buffer - label destination. + // @return Status - the status code returned. + Status ParseLine(std::string *line, const std::unique_ptr &images_buffer, + const std::unique_ptr &labels_buffer) const; + + // Private function for computing the assignment of the column name map. + // @return Status - the error code returned. + Status ComputeColMap() override; + + const std::string usage_; // can be "all", "train" or "test". + std::string dataset_dir_; // directory of data files. + std::unique_ptr data_schema_; + + std::vector data_files_list_; +}; +} // namespace dataset +} // namespace mindspore::lite + +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_USPS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/voc_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/voc_op.cc index b2586acb9e08d61ef7293c87447aa69defe3e1e5..c2f1786fc064deb5e557e93e69da9e66c8dd50e3 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/voc_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/voc_op.cc @@ -25,7 +25,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const char kColumnImage[] = "image"; const char kColumnTarget[] = "target"; @@ -377,4 +377,4 @@ Status VOCOp::GetClassIndexing(std::vector @@ -175,5 +175,5 @@ class VOCOp : public MappableLeafOp { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_VOC_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.cc index 872ac044b83c40957600e515f414fd3e2f8b1243..de9fd6c1ed2daad0517ced1b74459550f99e456a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr char kSplitPath[] = "wider_face_split"; constexpr char kTrainAnno[] = "wider_face_train_bbx_gt.txt"; @@ -301,4 +301,4 @@ Status WIDERFaceOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.h index 38b251ba4576289020c30dc333ab016f08144f5e..ee4720e751c597279eada2e69b56d1d3ec152e3a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.h @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/util/queue.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class WIDERFaceOp : public MappableLeafOp { public: @@ -116,5 +116,5 @@ class WIDERFaceOp : public MappableLeafOp { std::map> annotation_map_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_WIDER_FACE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.cc index b940ed8f4f751bba08b8f277f0c767c6f4b962d1..f62303c64f6ebf7c6f6a61f0a1ce84be8d344d28 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/io_block.h" #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { WikiTextOp::WikiTextOp(int32_t num_workers, int64_t total_rows, int32_t worker_connector_size, std::unique_ptr schema, const std::vector &file_list, @@ -50,4 +50,4 @@ void WikiTextOp::Print(std::ostream &out, bool show_all) const { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.h index 2bac031af2794e919b6501236bd86c4580402544..20cc2265d2d1fe826ccdde81c0e3dec6247baa96 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h" #include "mindspore-lite/minddata/dataset/util/queue.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class JaggedConnector; @@ -66,5 +66,5 @@ class WikiTextOp : public TextFileOp { std::string DatasetName(bool upper = false) const { return upper ? "WikiText" : "wiki text"; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_WIKI_TEXT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.cc index f7204d4989d8f4e253e265020f2f15a336d81a9c..94bdac34ef00a1c5c99df54b40ae0f640f623182 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/jagged_connector.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { YahooAnswersOp::YahooAnswersOp(const std::vector &dataset_files_list, char field_delim, const std::vector> &column_default, @@ -50,4 +50,4 @@ void YahooAnswersOp::Print(std::ostream &out, bool show_all) const { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.h index 26270301a0caf85efbc5453ed1ad286671cc5d2b..29e5a9b36e48bd3ff9f3edaef0784571b3e26178 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class YahooAnswersOp : public CsvOp { public: @@ -67,5 +67,5 @@ class YahooAnswersOp : public CsvOp { std::string Name() const override { return "YahooAnswersOp"; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_YAHOO_ANSWERS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.cc index 6c870e148f127b7e0362e9f37e227fb39aded484..fb125ed91ec302e6d0df50aae8536affb0fb9447 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.cc @@ -20,7 +20,7 @@ #include "include/common/debug/common.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { YelpReviewOp::YelpReviewOp(int32_t num_workers, int64_t num_samples, int32_t worker_connector_size, int32_t op_connector_size, bool shuffle_files, int32_t num_devices, int32_t device_id, @@ -49,4 +49,4 @@ void YelpReviewOp::Print(std::ostream &out, bool show_all) const { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.h index 42f6e976c3007b1d02de4195c30d2523bfdac621..f3f8f0c957885688d291260b34c9d77cf4174c06 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class JaggedConnector; @@ -67,5 +67,5 @@ class YelpReviewOp : public CsvOp { std::string Name() const override { return "YelpReviewOp"; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_YELP_REVIEW_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.cc index ef76f26a26f85600558ddfc04bda0db7a33e2fc8..6ae54406be19eac86407ed866c8f236fc62ce96e 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.cc @@ -28,7 +28,7 @@ #include "utils/file_utils.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr float kMaxShortVal = 32767.0; constexpr char kExtension[] = ".wav"; @@ -145,4 +145,4 @@ Status YesNoOp::ComputeColMap() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.h index 5ded1ee14438f3ae89e4b402bd2b88c6e7bb6ee9..47730984098cd394d20d6a1d19655d9212a833f2 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class YesNoOp : public MappableLeafOp { public: @@ -88,5 +88,5 @@ class YesNoOp : public MappableLeafOp { std::unique_ptr data_schema_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_SOURCE_YES_NO_OP_H diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/take_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/take_op.cc index 633f3bb88bc062d08ab2ad1de0d764d0905c1b3e..6a423075d651bb6a2ab8d2525a847613369b104a 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/take_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/take_op.cc @@ -18,7 +18,7 @@ #include "utils/ms_utils.h" #include "mindspore-lite/minddata/dataset/core/config_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor of the TakeOp. TakeOp::TakeOp(int32_t count) : PipelineOp(0), max_takes_(count), take_count_(0) {} @@ -89,4 +89,4 @@ Status TakeOp::GetNextRowPullMode(TensorRow *const row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/take_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/take_op.h index a5ee522b2882dc286f100767ee1dc1c59651555c..6e06d42e071ed75004d279655469844f41092845 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/take_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/take_op.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" #include "mindspore-lite/minddata/dataset/engine/dataset_iterator.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TakeOp : public PipelineOp { public: @@ -86,6 +86,6 @@ class TakeOp : public PipelineOp { Status CommonGetNextRow(TensorRow *row, bool is_pull_mode); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_TAKE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/zip_op.cc b/mindspore-lite/minddata/dataset/engine/datasetops/zip_op.cc index 45b308faff3045283e1014cdb98da6c5c3d8c082..62d0587aa85fd2d65a1b1e847e4c8453a8c49bbd 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/zip_op.cc +++ b/mindspore-lite/minddata/dataset/engine/datasetops/zip_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Construct ZipOp here, local variables initialized in operator due to tree construction restrictions ZipOp::ZipOp() : PipelineOp(0) {} @@ -154,4 +154,4 @@ Status ZipOp::GetNextRowPullMode(TensorRow *row) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/datasetops/zip_op.h b/mindspore-lite/minddata/dataset/engine/datasetops/zip_op.h index 01fe47f7e788428143e22982ea5966752f758562..8f7cec64bc0955a91fd0529d70f444f8e80cc803 100644 --- a/mindspore-lite/minddata/dataset/engine/datasetops/zip_op.h +++ b/mindspore-lite/minddata/dataset/engine/datasetops/zip_op.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/pipeline_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ZipOp : public PipelineOp { @@ -107,6 +107,6 @@ class ZipOp : public PipelineOp { Status ComputeColMap() override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_ZIP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/engine/execution_tree.cc b/mindspore-lite/minddata/dataset/engine/execution_tree.cc index 33b2df4a4c0d5e9daab21805decc9b4c33012429..34bbb377cf03bed59255393727c4ca6593aaba17 100644 --- a/mindspore-lite/minddata/dataset/engine/execution_tree.cc +++ b/mindspore-lite/minddata/dataset/engine/execution_tree.cc @@ -28,7 +28,7 @@ #include "utils/ms_context.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor #ifdef WITH_BACKEND @@ -306,4 +306,4 @@ Status ExecutionTree::Prepare(bool is_pull_mode) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/execution_tree.h b/mindspore-lite/minddata/dataset/engine/execution_tree.h index 2d745d5183ed87d5b5fe3c3ae056f3fd36834a4c..f25f9af142ef59d194f6a47c3cc90e1b7d05a2fc 100644 --- a/mindspore-lite/minddata/dataset/engine/execution_tree.h +++ b/mindspore-lite/minddata/dataset/engine/execution_tree.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/engine/perf/profiling.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares class TaskGroup; @@ -246,5 +246,5 @@ class ExecutionTree { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_EXECUTION_TREE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/gpu_item_connector.h b/mindspore-lite/minddata/dataset/engine/gpu_item_connector.h index 6b1099523af5ec633d9f7319922c8ca479a8e60f..8fbd71c9f83a79412a329e770284a1e9acf3e5bd 100644 --- a/mindspore-lite/minddata/dataset/engine/gpu_item_connector.h +++ b/mindspore-lite/minddata/dataset/engine/gpu_item_connector.h @@ -27,7 +27,7 @@ using mindspore::device::DataQueueItem; -namespace mindspore { +namespace mindspore::lite { namespace dataset { struct GpuConnectorItem { @@ -86,5 +86,5 @@ class GpuConnector : public Connector { std::vector is_queue_finished_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_GPU_ITEM_CONNECTOR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.cc b/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.cc index 9f62e239ba83ffbd7dde40499b26102aa42aae5f..009a5573f902957cea2a82de5e40a505833bf906 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.h" #endif -namespace mindspore::dataset { +namespace mindspore::lite::dataset { #ifndef ENABLE_ANDROID Status DatasetCache::from_json(nlohmann::json json_obj, std::shared_ptr *cache) { if (json_obj.find("cache") != json_obj.end()) { @@ -59,4 +59,4 @@ Status DatasetCache::from_json(nlohmann::json json_obj, std::shared_ptr *cache); #endif }; -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_CACHE_DATASET_CACHE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.cc b/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.cc index ab6c37a51a45509db70845d71ba1532c45de31b8..49518a50f7f437ed661ac2b317e5b2c9f64e99b7 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/cache_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// Method to initialize the DatasetCache by creating an instance of a CacheClient /// \return Status Error code @@ -102,4 +102,4 @@ Status DatasetCacheImpl::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.h b/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.h index e337fe6a6e54449e4df2821882cfcb9479fffd39..d83ef9c0c9077299c286c5566cfe236c8ee1645b 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.h +++ b/mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// DatasetCache is the IR of CacheClient class DatasetCacheImpl : public DatasetCache { @@ -88,5 +88,5 @@ class DatasetCacheImpl : public DatasetCache { std::optional prefetch_sz_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_CACHE_DATASET_CACHE_IMPL_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.cc b/mindspore-lite/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.cc index b13ce0575fe95b1659dc69821ce0b97ecefd0eec..3c8d153a228828609e33412f4951f1576e005010 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/cache_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// Method to initialize the DatasetCache by creating an instance of a CacheClient /// \return Status Error code @@ -28,4 +28,4 @@ Status PreBuiltDatasetCache::Build() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.h b/mindspore-lite/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.h index ccfe00a5e4cbaced5e6b25efd4f7283067b272ed..ba168fbd805a4ce161581e8c9a64e88a96da307e 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.h +++ b/mindspore-lite/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache_impl.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// DatasetCache is the IR of CacheClient class PreBuiltDatasetCache : public DatasetCacheImpl { @@ -44,5 +44,5 @@ class PreBuiltDatasetCache : public DatasetCacheImpl { Status Build() override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_CACHE_PRE_BUILT_DATASET_CACHE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/batch_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/batch_node.cc index 71ba01cb9d10b7b6bfca7ce58bd88254b47192ea..9a033bc3a58242d87f9ec78d7242a655bb6d1cc3 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/batch_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/batch_node.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/batch_op.h" #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef ENABLE_PYTHON @@ -182,4 +182,4 @@ Status BatchNode::from_json(nlohmann::json json_obj, std::shared_ptr python_multiprocessing_runtime_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_BATCH_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.cc index e1816e283d2b10db5ec278daa11e89f5d25d4184..5893cbd866200b942ad3390445f7c28665fe0b27 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { BucketBatchByLengthNode::BucketBatchByLengthNode( std::shared_ptr child, const std::vector &column_names, @@ -144,4 +144,4 @@ Status BucketBatchByLengthNode::ValidateParams() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.h index 2de9b70a77ac93855578f912a2b6a4999049b805..1b399f443b792dc60df0bf41ea2c6d85eebe32a3 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class BucketBatchByLengthNode : public DatasetNode { public: @@ -81,5 +81,5 @@ class BucketBatchByLengthNode : public DatasetNode { bool drop_remainder_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_BUCKET_BATCH_BY_LENGTH_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.cc index f2a677176cb42151aae1e96e9bd35734d63f03e7..93bf57322a92a689f2ee6d3038dd820c8fac43bc 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { BuildSentenceVocabNode::BuildSentenceVocabNode(std::shared_ptr child, std::shared_ptr vocab, @@ -101,4 +101,4 @@ Status BuildSentenceVocabNode::AcceptAfter(IRNodePass *const p, bool *const modi return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.h index dcabf6fea0a3420a6950932345bd8a7fba42f4a6..017bdfa5717ccecf47ebe155ceca38be2bf080bb 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" #include "mindspore-lite/minddata/dataset/include/dataset/datasets.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class BuildSentenceVocabNode : public DatasetNode { public: @@ -88,5 +88,5 @@ class BuildSentenceVocabNode : public DatasetNode { std::unordered_map params_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_BUILD_SENTENCE_PIECE_VOCAB_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_vocab_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_vocab_node.cc index 8dd0c68d6c61adf8638d5ef2e7efe54976ea7569..b5f3ededd96c1980b67b24d93b01767b3dcdbc83 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_vocab_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_vocab_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { BuildVocabNode::BuildVocabNode(std::shared_ptr child, std::shared_ptr vocab, const std::vector &columns, const std::pair &freq_range, @@ -92,4 +92,4 @@ Status BuildVocabNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_vocab_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_vocab_node.h index d0a5b7c706e141992a50a1db1c223fac28167e3b..9526737b219b6aacf82fa933bf4a9d64a4e4689c 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_vocab_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/build_vocab_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class BuildVocabNode : public DatasetNode { public: @@ -86,5 +86,5 @@ class BuildVocabNode : public DatasetNode { bool special_first_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_BUILD_VOCAB_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_lookup_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_lookup_node.cc index 8b95fc7ac4a1aa1652e4b1e215cba6b57ffc216b..ce02491595916450b6c182565102127b253ad749 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_lookup_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_lookup_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { CacheLookupNode::CacheLookupNode(std::shared_ptr child, std::shared_ptr sampler, std::shared_ptr cache) @@ -78,4 +78,4 @@ Status CacheLookupNode::SamplerBuild(std::shared_ptr *const out) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_lookup_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_lookup_node.h index 400bcfa39f86b789d7a14dff886d7d4754a77c2a..95bbc950ef06e3433fddd02a4e92fa41bad39a70 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_lookup_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_lookup_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/cache_lookup_op.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CacheLookupNode : public DatasetNode, public SamplerObj { public: @@ -86,5 +86,5 @@ class CacheLookupNode : public DatasetNode, public SamplerObj { std::shared_ptr lookup_node_copy_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_LOOKUP_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_merge_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_merge_node.cc index 614a479156595ba24282c56d0168c10d11e50845..39930df04b76f64ca3bef8ac239a5bc8da5cd1b5 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_merge_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_merge_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/cache_merge_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { CacheMergeNode::CacheMergeNode(std::shared_ptr child, std::shared_ptr cache) : DatasetNode(std::move(cache)) { @@ -63,4 +63,4 @@ Status CacheMergeNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_merge_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_merge_node.h index e1b5baa0c1164b1429a7d5af234bce5b97905d47..3bf4b6b53f6f49678eb8aa457ca23ed97d242067 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_merge_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_merge_node.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CacheMergeNode : public DatasetNode { public: @@ -66,5 +66,5 @@ class CacheMergeNode : public DatasetNode { Status AcceptAfter(IRNodePass *const p, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_MERGE_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_node.cc index 0d743b32b6e5b3dfc5552ca36fba221a35400382..84e50992ada4fc87d198c2a25158322849d2bd50 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { CacheNode::CacheNode(std::shared_ptr child, std::shared_ptr sampler, std::shared_ptr cache) @@ -67,4 +67,4 @@ Status CacheNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_node.h index 929087040e39afdd3b16879641f71ea5a35e715d..1ee618641dc9a60023b0850bf9d530dc7bb97480 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/cache_node.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CacheNode : public DatasetNode { public: @@ -70,5 +70,5 @@ class CacheNode : public DatasetNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/concat_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/concat_node.cc index 5a55c7a50aa99cd9f781b9b3158a0c7508c2ffae..30cbeb2f1ef3cc27a415713af87daf556660ed14 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/concat_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/concat_node.cc @@ -27,7 +27,7 @@ #endif #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Function to build ConcatOp @@ -184,4 +184,4 @@ Status ConcatNode::from_json(nlohmann::json json_obj, std::vector children_sizes_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CONCAT_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/data_queue_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/data_queue_node.cc index 27d9d14fb484eb75736eb118ce0ededeee745f95..a57f713d9f2e0faca47f5caa196f00985b2195a7 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/data_queue_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/data_queue_node.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "utils/ms_context.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for DataQueueNode DataQueueNode::DataQueueNode(std::shared_ptr child, std::string queue_name, std::string device_type, @@ -138,4 +138,4 @@ Status DataQueueNode::from_json(nlohmann::json json_obj, std::shared_ptr child, int32_t num_epochs) : RepeatNode() { @@ -75,4 +75,4 @@ Status EpochCtrlNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/epoch_ctrl_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/epoch_ctrl_node.h index e28b5ab02efafcc6632bd3330a30fc57a581ab38..8d50980dc36f6f6b578a6e31b167d1d4bb2b9e56 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/epoch_ctrl_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/epoch_ctrl_node.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/repeat_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class EpochCtrlNode : public RepeatNode { // Allow GeneratorNode to access internal members @@ -75,5 +75,5 @@ class EpochCtrlNode : public RepeatNode { Status AcceptAfter(IRNodePass *const p, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_EPOCH_CTRL_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/filter_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/filter_node.cc index 2e7a6e61e933c17571f9854e78c78d41d8833273..090c55b407a6b909fd7609f092e4a030c7849fe4 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/filter_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/filter_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for FilterNode FilterNode::FilterNode(std::shared_ptr child, std::shared_ptr predicate, @@ -79,4 +79,4 @@ Status FilterNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/filter_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/filter_node.h index ae2b3e427b852957befcce571a3bc132f5077f9d..5050c12deb77e057050a6fa3395e7688f6a1c11e 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/filter_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/filter_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class FilterNode : public DatasetNode { public: @@ -83,5 +83,5 @@ class FilterNode : public DatasetNode { std::vector input_columns_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_FILTER_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.cc index 5767f92412aab942497fbee1e86e37b9299a0cf4..aaa9382397086b54e89105a461cc6f3526721274 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.cc @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { MapNode::MapNode(std::shared_ptr child, std::vector> operations, @@ -258,4 +258,4 @@ Status MapNode::GetDatasetSize(const std::shared_ptr &size_ge } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.h index e798694ed8ed04da69c6074a78c01d1457f4b69d..0ade04ee371714bbbd75914d76ae048a1d5e36fd 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.h @@ -26,7 +26,7 @@ #endif #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class MapNode : public DatasetNode { public: @@ -134,5 +134,5 @@ class MapNode : public DatasetNode { std::shared_ptr python_multiprocessing_runtime_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_MAP_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/project_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/project_node.cc index dd68ff869add09bff7c3551ea5768f6f5126ab58..1d0105c70344a8f0e38732528020102ea11e31a5 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/project_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/project_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Function to build ProjectOp ProjectNode::ProjectNode(std::shared_ptr child, const std::vector &columns) @@ -83,4 +83,4 @@ Status ProjectNode::AcceptAfter(IRNodePass *const p, bool *const modified) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/project_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/project_node.h index 837da38a8b068de6bbadd797de90e0c27c8ede3f..06d6c625aae1feb780bbb7ff1032e22accc3267b 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/project_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/project_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ProjectNode : public DatasetNode { public: @@ -86,5 +86,5 @@ class ProjectNode : public DatasetNode { std::vector columns_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_PROJECT_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/rename_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/rename_node.cc index a9a78e3f0b317c97007be0f6a36dc35978a2972b..40c646c234542227c52597b71290ba935baad14a 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/rename_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/rename_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Function to build RenameOp @@ -92,4 +92,4 @@ Status RenameNode::AcceptAfter(IRNodePass *const p, bool *const modified) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/rename_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/rename_node.h index 423fd95610a34c824d80b6dd1336c4458096ba90..120c322b2a7b5c58229588fadd99d227017593ef 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/rename_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/rename_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RenameNode : public DatasetNode { public: @@ -89,5 +89,5 @@ class RenameNode : public DatasetNode { std::vector output_columns_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_RENAME_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/repeat_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/repeat_node.cc index af0e81523fca36250a1c4f8ffbf3998e059319b0..290cc0852b215400185f185f3ffa34f288f8472f 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/repeat_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/repeat_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RepeatNode::RepeatNode(std::shared_ptr child, int32_t count) : op_(nullptr), repeat_count_(count) { this->AddChild(child); @@ -109,4 +109,4 @@ Status RepeatNode::from_json(nlohmann::json json_obj, std::shared_ptr child) : DatasetNode() { @@ -77,4 +77,4 @@ Status RootNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/root_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/root_node.h index 7d960d05445c5a8c86b809772ec0442adbed9d65..a91ba965586d5ed648d68bb1c0053b3bed945977 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/root_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/root_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RootNode : public DatasetNode { @@ -94,5 +94,5 @@ class RootNode : public DatasetNode { int64_t dataset_size_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_ROOT_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.cc index c095777e21234d431ed2694cf7f25dee2134e16f..9d05b367217d363a1092c5bd099b134f91e09009 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for ShuffleNode @@ -89,4 +89,4 @@ Status ShuffleNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.h index 9ffefbf6e550b55de1bd2524585a51b796f1ccd9..bafdb9b7e624c7f6c72323a20d9085858c93f46d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ShuffleNode : public DatasetNode { public: @@ -92,5 +92,5 @@ class ShuffleNode : public DatasetNode { bool reset_every_epoch_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SHUFFLE_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.cc index 397d93ce9803a9e0bea1a04398f3cf2516ad9bc3..7aaa48e19c3b67ec4f941f48f4f102e211731b99 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for SkipNode SkipNode::SkipNode(int32_t count) : skip_count_(count) {} @@ -103,4 +103,4 @@ Status SkipNode::from_json(nlohmann::json json_obj, std::shared_ptr return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.h index d2447abcc1b43ff889f5f16832ecc752435db354..7af0fb6611fb971a550d6e78acd28bbbd7b8998c 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SkipNode : public DatasetNode { public: @@ -107,5 +107,5 @@ class SkipNode : public DatasetNode { bool once_only_ = false; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SKIP_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.cc index 65e15172ccfd20251ef9b7020e436a323b974efd..ba3469095894b56caa10145903ce0531d6ad681b 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.cc @@ -1,199 +1,199 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h" - -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.h" -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -// Constructor for AGNewsNode. -AGNewsNode::AGNewsNode(const std::string &dataset_dir, int64_t num_samples, ShuffleMode shuffle, - const std::string &usage, int32_t num_shards, int32_t shard_id, - const std::shared_ptr &cache) - : NonMappableSourceNode(std::move(cache)), - dataset_dir_(dataset_dir), - num_samples_(num_samples), - shuffle_(shuffle), - num_shards_(num_shards), - shard_id_(shard_id), - usage_(usage), - ag_news_files_list_(WalkAllFiles(usage, dataset_dir)) { - GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); -} - -std::shared_ptr AGNewsNode::Copy() { - auto node = - std::make_shared(dataset_dir_, num_samples_, shuffle_, usage_, num_shards_, shard_id_, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -void AGNewsNode::Print(std::ostream &out) const { - out << (Name() + "(cache: " + ((cache_ != nullptr) ? "true" : "false") + - ", num_shards: " + std::to_string(num_shards_) + ", shard_id: " + std::to_string(shard_id_) + ")"); -} - -Status AGNewsNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("AGNewsDataset", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateStringValue("AGNewsDataset", usage_, {"train", "test", "all"})); - RETURN_IF_NOT_OK(ValidateScalar("AGNewsDataset", "num_samples", num_samples_, {0}, false)); - RETURN_IF_NOT_OK(ValidateDatasetShardParams("AGNewsDataset", num_shards_, shard_id_)); - RETURN_IF_NOT_OK(ValidateEnum("AGNewsDataset", "ShuffleMode", shuffle_, - {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); - - if (!column_names_.empty()) { - RETURN_IF_NOT_OK(ValidateDatasetColumnParam("AGNewsDataset", "column_names", column_names_)); - } - return Status::OK(); -} - -// Function to build AGNewsNode. -Status AGNewsNode::Build(std::vector> *const node_ops) { - bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); - // Sort the dataset files in a lexicographical order. - std::vector sorted_dataset_files = ag_news_files_list_; - std::sort(sorted_dataset_files.begin(), sorted_dataset_files.end()); - // Because AGNews does not have external column_defaults nor column_names parameters, - // they need to be set before AGNewsOp is initialized. - // AGNews data set is formatted as three columns of data, so three columns are added. - std::vector> column_default; - column_default.push_back(std::make_shared>(AGNewsOp::STRING, "")); - column_default.push_back(std::make_shared>(AGNewsOp::STRING, "")); - column_default.push_back(std::make_shared>(AGNewsOp::STRING, "")); - std::vector column_name = {"index", "title", "description"}; - // AGNews data values are always delimited by a comma. - char field_delim_ = ','; - std::shared_ptr ag_news_op = - std::make_shared(num_workers_, num_samples_, worker_connector_size_, connector_que_size_, shuffle_files, - num_shards_, shard_id_, field_delim_, column_default, column_name, sorted_dataset_files); - RETURN_IF_NOT_OK(ag_news_op->Init()); - if (shuffle_ == ShuffleMode::kGlobal) { - // Inject ShuffleOp. - std::shared_ptr shuffle_op = nullptr; - int64_t num_rows = 0; - // First, get the number of rows in the dataset. - RETURN_IF_NOT_OK(AGNewsOp::CountAllFileRows(ag_news_files_list_, false, &num_rows)); - // Add the shuffle op after this op. - RETURN_IF_NOT_OK( - AddShuffleOp(sorted_dataset_files.size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); - shuffle_op->SetTotalRepeats(GetTotalRepeats()); - shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - shuffle_op->Skip(skip_steps_); - node_ops->push_back(shuffle_op); - } - ag_news_op->SetTotalRepeats(GetTotalRepeats()); - ag_news_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(ag_news_op); - return Status::OK(); -} - -// Get the shard id of node. -Status AGNewsNode::GetShardId(int32_t *shard_id) { - *shard_id = shard_id_; - return Status::OK(); -} - -// Get Dataset size. -Status AGNewsNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - - int64_t num_rows, sample_size; - RETURN_IF_NOT_OK(AGNewsOp::CountAllFileRows(ag_news_files_list_, false, &num_rows)); - sample_size = num_samples_; - num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); - *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status AGNewsNode::to_json(nlohmann::json *out_json) { - nlohmann::json args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["usage"] = usage_; - args["num_samples"] = num_samples_; - args["shuffle"] = shuffle_; - args["num_shards"] = num_shards_; - args["shard_id"] = shard_id_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} - -// Note: The following two functions are common among NonMappableSourceNode and -// should be promoted to its parent class. AGNews (for which internally is based off CSV) -// by itself is a non-mappable dataset that does not support sampling. -// However, if a cache operator is injected at some other place higher in the tree, -// that cache can inherit this sampler from the leaf, providing sampling support from -// the caching layer. -// Should be promoted to its parent class. -// That is why we setup the sampler for a leaf node that does not use sampling. -Status AGNewsNode::SetupSamplerForCache(std::shared_ptr *sampler) { - *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); - return Status::OK(); -} - -// If a cache has been added into the ascendant tree over this AGNews node, then -// the cache will be executing a sampler for fetching the data. As such, any -// options in the AGNews node need to be reset to its defaults so that this -// AGNews node will produce the full set of data into the cache. -Status AGNewsNode::MakeSimpleProducer() { - shard_id_ = 0; - num_shards_ = 1; - shuffle_ = ShuffleMode::kFalse; - num_samples_ = 0; - return Status::OK(); -} - -std::vector AGNewsNode::WalkAllFiles(const std::string &usage, const std::string &dataset_dir) { - std::vector ag_news_files_list; - Path train_prefix("train.csv"); - Path test_prefix("test.csv"); - Path dir(dataset_dir); - - if (usage == "train") { - Path temp_path = dir / train_prefix; - ag_news_files_list.push_back(temp_path.ToString()); - } else if (usage == "test") { - Path temp_path = dir / test_prefix; - ag_news_files_list.push_back(temp_path.ToString()); - } else { - Path temp_path = dir / train_prefix; - ag_news_files_list.push_back(temp_path.ToString()); - Path temp_path1 = dir / test_prefix; - ag_news_files_list.push_back(temp_path1.ToString()); - } - return ag_news_files_list; -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h" + +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/ag_news_op.h" +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +// Constructor for AGNewsNode. +AGNewsNode::AGNewsNode(const std::string &dataset_dir, int64_t num_samples, ShuffleMode shuffle, + const std::string &usage, int32_t num_shards, int32_t shard_id, + const std::shared_ptr &cache) + : NonMappableSourceNode(std::move(cache)), + dataset_dir_(dataset_dir), + num_samples_(num_samples), + shuffle_(shuffle), + num_shards_(num_shards), + shard_id_(shard_id), + usage_(usage), + ag_news_files_list_(WalkAllFiles(usage, dataset_dir)) { + GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); +} + +std::shared_ptr AGNewsNode::Copy() { + auto node = + std::make_shared(dataset_dir_, num_samples_, shuffle_, usage_, num_shards_, shard_id_, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +void AGNewsNode::Print(std::ostream &out) const { + out << (Name() + "(cache: " + ((cache_ != nullptr) ? "true" : "false") + + ", num_shards: " + std::to_string(num_shards_) + ", shard_id: " + std::to_string(shard_id_) + ")"); +} + +Status AGNewsNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("AGNewsDataset", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateStringValue("AGNewsDataset", usage_, {"train", "test", "all"})); + RETURN_IF_NOT_OK(ValidateScalar("AGNewsDataset", "num_samples", num_samples_, {0}, false)); + RETURN_IF_NOT_OK(ValidateDatasetShardParams("AGNewsDataset", num_shards_, shard_id_)); + RETURN_IF_NOT_OK(ValidateEnum("AGNewsDataset", "ShuffleMode", shuffle_, + {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); + + if (!column_names_.empty()) { + RETURN_IF_NOT_OK(ValidateDatasetColumnParam("AGNewsDataset", "column_names", column_names_)); + } + return Status::OK(); +} + +// Function to build AGNewsNode. +Status AGNewsNode::Build(std::vector> *const node_ops) { + bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); + // Sort the dataset files in a lexicographical order. + std::vector sorted_dataset_files = ag_news_files_list_; + std::sort(sorted_dataset_files.begin(), sorted_dataset_files.end()); + // Because AGNews does not have external column_defaults nor column_names parameters, + // they need to be set before AGNewsOp is initialized. + // AGNews data set is formatted as three columns of data, so three columns are added. + std::vector> column_default; + column_default.push_back(std::make_shared>(AGNewsOp::STRING, "")); + column_default.push_back(std::make_shared>(AGNewsOp::STRING, "")); + column_default.push_back(std::make_shared>(AGNewsOp::STRING, "")); + std::vector column_name = {"index", "title", "description"}; + // AGNews data values are always delimited by a comma. + char field_delim_ = ','; + std::shared_ptr ag_news_op = + std::make_shared(num_workers_, num_samples_, worker_connector_size_, connector_que_size_, shuffle_files, + num_shards_, shard_id_, field_delim_, column_default, column_name, sorted_dataset_files); + RETURN_IF_NOT_OK(ag_news_op->Init()); + if (shuffle_ == ShuffleMode::kGlobal) { + // Inject ShuffleOp. + std::shared_ptr shuffle_op = nullptr; + int64_t num_rows = 0; + // First, get the number of rows in the dataset. + RETURN_IF_NOT_OK(AGNewsOp::CountAllFileRows(ag_news_files_list_, false, &num_rows)); + // Add the shuffle op after this op. + RETURN_IF_NOT_OK( + AddShuffleOp(sorted_dataset_files.size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); + shuffle_op->SetTotalRepeats(GetTotalRepeats()); + shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + shuffle_op->Skip(skip_steps_); + node_ops->push_back(shuffle_op); + } + ag_news_op->SetTotalRepeats(GetTotalRepeats()); + ag_news_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(ag_news_op); + return Status::OK(); +} + +// Get the shard id of node. +Status AGNewsNode::GetShardId(int32_t *shard_id) { + *shard_id = shard_id_; + return Status::OK(); +} + +// Get Dataset size. +Status AGNewsNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + + int64_t num_rows, sample_size; + RETURN_IF_NOT_OK(AGNewsOp::CountAllFileRows(ag_news_files_list_, false, &num_rows)); + sample_size = num_samples_; + num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); + *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status AGNewsNode::to_json(nlohmann::json *out_json) { + nlohmann::json args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["usage"] = usage_; + args["num_samples"] = num_samples_; + args["shuffle"] = shuffle_; + args["num_shards"] = num_shards_; + args["shard_id"] = shard_id_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} + +// Note: The following two functions are common among NonMappableSourceNode and +// should be promoted to its parent class. AGNews (for which internally is based off CSV) +// by itself is a non-mappable dataset that does not support sampling. +// However, if a cache operator is injected at some other place higher in the tree, +// that cache can inherit this sampler from the leaf, providing sampling support from +// the caching layer. +// Should be promoted to its parent class. +// That is why we setup the sampler for a leaf node that does not use sampling. +Status AGNewsNode::SetupSamplerForCache(std::shared_ptr *sampler) { + *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); + return Status::OK(); +} + +// If a cache has been added into the ascendant tree over this AGNews node, then +// the cache will be executing a sampler for fetching the data. As such, any +// options in the AGNews node need to be reset to its defaults so that this +// AGNews node will produce the full set of data into the cache. +Status AGNewsNode::MakeSimpleProducer() { + shard_id_ = 0; + num_shards_ = 1; + shuffle_ = ShuffleMode::kFalse; + num_samples_ = 0; + return Status::OK(); +} + +std::vector AGNewsNode::WalkAllFiles(const std::string &usage, const std::string &dataset_dir) { + std::vector ag_news_files_list; + Path train_prefix("train.csv"); + Path test_prefix("test.csv"); + Path dir(dataset_dir); + + if (usage == "train") { + Path temp_path = dir / train_prefix; + ag_news_files_list.push_back(temp_path.ToString()); + } else if (usage == "test") { + Path temp_path = dir / test_prefix; + ag_news_files_list.push_back(temp_path.ToString()); + } else { + Path temp_path = dir / train_prefix; + ag_news_files_list.push_back(temp_path.ToString()); + Path temp_path1 = dir / test_prefix; + ag_news_files_list.push_back(temp_path1.ToString()); + } + return ag_news_files_list; +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h index 41dcdc8ec3eef4a106bb1e317b94c90a48e9692d..84683c25b6bf5bc75f0ebf13ec890044f68e483b 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h @@ -1,126 +1,126 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AG_NEWS_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AG_NEWS_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -/// \brief class AGNewsNode. -/// \brief Dataset derived class to represent AGNews dataset. -class AGNewsNode : public NonMappableSourceNode { - public: - /// \brief Constructor. - AGNewsNode(const std::string &dataset_dir, int64_t num_samples, ShuffleMode shuffle, const std::string &usage, - int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); - - /// \brief Destructor. - ~AGNewsNode() override = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kAGNewsNode; } - - /// \brief Print the description. - /// \param[in] out The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief A base class override function to create the required runtime dataset op objects for this class. - /// \param[in] node_ops A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard id. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - const std::string &Usage() const { return usage_; } - int64_t NumSamples() const { return num_samples_; } - ShuffleMode Shuffle() const { return shuffle_; } - int32_t NumShards() const { return num_shards_; } - int32_t ShardId() const { return shard_id_; } - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size the size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Get the arguments of node - /// \param[out] out_json JSON string of all attributes - /// \return Status of the function - Status to_json(nlohmann::json *out_json) override; - - /// \brief AGNews by itself is a non-mappable dataset that does not support sampling. - /// However, if a cache operator is injected at some other place higher in - /// the tree, that cache can inherit this sampler from the leaf, providing - /// sampling support from the caching layer. That is why we setup the - /// sampler for a leaf node that does not use sampling. Note: This - /// function is common among NonMappableSourceNode and should be promoted - /// to its parent class. - /// \param[in] sampler The sampler to setup. - /// \return Status of the function. - Status SetupSamplerForCache(std::shared_ptr *sampler) override; - - /// \brief If a cache has been added into the ascendant tree over this ag_news node, - /// then the cache will be executing a sampler for fetching the data. - /// As such, any options in the AGNews node need to be reset to its defaults - /// so that this AGNews node will produce the full set of data into the cache. - /// Note: This function is common among NonMappableSourceNode and should be promoted to its - /// parent class. - /// \return Status of the function. - Status MakeSimpleProducer() override; - - /// \brief Generate a list of read file names according to usage. - /// \param[in] usage Part of dataset of AGNews. - /// \param[in] dataset_dir Path to the root directory that contains the dataset. - /// \return std::vector A list of read file names. - std::vector WalkAllFiles(const std::string &usage, const std::string &dataset_dir); - - private: - std::string dataset_dir_; - std::string usage_; - std::vector> column_defaults_; - std::vector column_names_; - int64_t num_samples_; - ShuffleMode shuffle_; - int32_t num_shards_; - int32_t shard_id_; - std::vector ag_news_files_list_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AG_NEWS_NODE_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AG_NEWS_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AG_NEWS_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +/// \brief class AGNewsNode. +/// \brief Dataset derived class to represent AGNews dataset. +class AGNewsNode : public NonMappableSourceNode { + public: + /// \brief Constructor. + AGNewsNode(const std::string &dataset_dir, int64_t num_samples, ShuffleMode shuffle, const std::string &usage, + int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); + + /// \brief Destructor. + ~AGNewsNode() override = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kAGNewsNode; } + + /// \brief Print the description. + /// \param[in] out The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief A base class override function to create the required runtime dataset op objects for this class. + /// \param[in] node_ops A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard id. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + const std::string &Usage() const { return usage_; } + int64_t NumSamples() const { return num_samples_; } + ShuffleMode Shuffle() const { return shuffle_; } + int32_t NumShards() const { return num_shards_; } + int32_t ShardId() const { return shard_id_; } + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size the size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Get the arguments of node + /// \param[out] out_json JSON string of all attributes + /// \return Status of the function + Status to_json(nlohmann::json *out_json) override; + + /// \brief AGNews by itself is a non-mappable dataset that does not support sampling. + /// However, if a cache operator is injected at some other place higher in + /// the tree, that cache can inherit this sampler from the leaf, providing + /// sampling support from the caching layer. That is why we setup the + /// sampler for a leaf node that does not use sampling. Note: This + /// function is common among NonMappableSourceNode and should be promoted + /// to its parent class. + /// \param[in] sampler The sampler to setup. + /// \return Status of the function. + Status SetupSamplerForCache(std::shared_ptr *sampler) override; + + /// \brief If a cache has been added into the ascendant tree over this ag_news node, + /// then the cache will be executing a sampler for fetching the data. + /// As such, any options in the AGNews node need to be reset to its defaults + /// so that this AGNews node will produce the full set of data into the cache. + /// Note: This function is common among NonMappableSourceNode and should be promoted to its + /// parent class. + /// \return Status of the function. + Status MakeSimpleProducer() override; + + /// \brief Generate a list of read file names according to usage. + /// \param[in] usage Part of dataset of AGNews. + /// \param[in] dataset_dir Path to the root directory that contains the dataset. + /// \return std::vector A list of read file names. + std::vector WalkAllFiles(const std::string &usage, const std::string &dataset_dir); + + private: + std::string dataset_dir_; + std::string usage_; + std::vector> column_defaults_; + std::vector column_names_; + int64_t num_samples_; + ShuffleMode shuffle_; + int32_t num_shards_; + int32_t shard_id_; + std::vector ag_news_files_list_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AG_NEWS_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/album_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/album_node.cc index 694964e640f4eee22346c165f695b64eba95a0cb..d8b01c31fa4eb522bb022d798817ac9e435401c9 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/album_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/album_node.cc @@ -28,7 +28,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for AlbumNode @@ -172,4 +172,4 @@ Status AlbumNode::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_ALBUM_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.cc old mode 100755 new mode 100644 index 951ba96c480ed78b212fd065ffe8ebf1152b1971..47794266caf8bed5154e894e497f4d523ccb79fc --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.cc @@ -1,195 +1,195 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h" - -#include -#include - -namespace mindspore { -namespace dataset { -// Constructor for AmazonReviewNode -AmazonReviewNode::AmazonReviewNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, - ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, - const std::shared_ptr &cache) - : NonMappableSourceNode(std::move(cache)), - dataset_dir_(dataset_dir), - num_samples_(num_samples), - shuffle_(shuffle), - num_shards_(num_shards), - shard_id_(shard_id), - usage_(usage), - amazon_review_files_list_(WalkAllFiles(usage, dataset_dir)) { - // Update the num_shards_ in global context. this number is only used for now by auto_num_worker_pass. - // User discretion is advised. Auto_num_worker_pass is currently an experimental feature which can still work - // if the num_shards_ isn't 100% correct. The reason behind is for now, PreBuildSampler doesn't offer a way to - // return num_shards. Once PreBuildSampler is phased out, this can be cleaned up. - GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); -} - -std::shared_ptr AmazonReviewNode::Copy() { - auto node = - std::make_shared(dataset_dir_, usage_, num_samples_, shuffle_, num_shards_, shard_id_, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -void AmazonReviewNode::Print(std::ostream &out) const { - out << (Name() + "(cache: " + ((cache_ != nullptr) ? "true" : "false") + - ", num_shards: " + std::to_string(num_shards_) + ", shard_id: " + std::to_string(shard_id_) + ")"); -} - -Status AmazonReviewNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("AmazonReviewDataset", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateStringValue("AmazonReviewDataset", usage_, {"train", "test", "all"})); - RETURN_IF_NOT_OK(ValidateDatasetFilesParam("AmazonReviewDataset", amazon_review_files_list_)); - RETURN_IF_NOT_OK(ValidateScalar("AmazonReviewDataset", "num_samples", num_samples_, {0}, false)); - RETURN_IF_NOT_OK(ValidateEnum("AmazonReviewDataset", "ShuffleMode", shuffle_, - {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); - - RETURN_IF_NOT_OK(ValidateDatasetShardParams("AmazonReviewDataset", num_shards_, shard_id_)); - return Status::OK(); -} - -Status AmazonReviewNode::Build(std::vector> *const node_ops) { - bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); - - // Sort the dataset files in a lexicographical order. - std::vector sorted_dataset_files = amazon_review_files_list_; - std::sort(sorted_dataset_files.begin(), sorted_dataset_files.end()); - - std::vector> column_default; - column_default.push_back(std::make_shared>(AmazonReviewOp::STRING, "")); - column_default.push_back(std::make_shared>(AmazonReviewOp::STRING, "")); - column_default.push_back(std::make_shared>(AmazonReviewOp::STRING, "")); - - std::vector column_name = {"label", "title", "content"}; - char field_delim = ','; - std::shared_ptr amazon_review_op = std::make_shared( - num_workers_, num_samples_, worker_connector_size_, connector_que_size_, shuffle_files, num_shards_, shard_id_, - field_delim, column_default, column_name, sorted_dataset_files); - RETURN_IF_NOT_OK(amazon_review_op->Init()); - - // If a global shuffle is used for AmazonReview, it will inject a shuffle op over the AmazonReview. - // But, if there is a cache in the tree, we do not need the global shuffle and the shuffle op should not be - // built.This is achieved in the cache transform pass where we call MakeSimpleProducer to reset AmazonReview's - // shuffle option to false. - if (shuffle_ == ShuffleMode::kGlobal) { - // Inject ShuffleOp. - std::shared_ptr shuffle_op = nullptr; - int64_t num_rows = 0; - - // First, get the number of rows in the dataset. - RETURN_IF_NOT_OK(AmazonReviewOp::CountAllFileRows(sorted_dataset_files, false, &num_rows)); - // Add the shuffle op after this op. - RETURN_IF_NOT_OK( - AddShuffleOp(sorted_dataset_files.size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); - shuffle_op->SetTotalRepeats(GetTotalRepeats()); - shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - shuffle_op->Skip(skip_steps_); - node_ops->push_back(shuffle_op); - } - amazon_review_op->SetTotalRepeats(GetTotalRepeats()); - amazon_review_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(amazon_review_op); - return Status::OK(); -} - -Status AmazonReviewNode::GetShardId(int32_t *shard_id) { - *shard_id = shard_id_; - return Status::OK(); -} - -// Get Dataset size -Status AmazonReviewNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - - int64_t num_rows, sample_size; - RETURN_IF_NOT_OK(AmazonReviewOp::CountAllFileRows(amazon_review_files_list_, false, &num_rows)); - sample_size = num_samples_; - num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); - *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status AmazonReviewNode::to_json(nlohmann::json *out_json) { - nlohmann::json args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["usage"] = usage_; - args["num_samples"] = num_samples_; - args["shuffle"] = shuffle_; - args["num_shards"] = num_shards_; - args["shard_id"] = shard_id_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} - -// Note: The following two functions are common among NonMappableSourceNode and should be promoted to its parent -// class. AmazonReview by itself is a non-mappable dataset that does not support sampling. However, if a cache -// operator is injected at some other place higher in the tree, that cache can inherit this sampler from the leaf, -// providing sampling support from the caching layer. That is why we setup the sampler for a leaf node that does not -// use sampling. -Status AmazonReviewNode::SetupSamplerForCache(std::shared_ptr *sampler) { - *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); - return Status::OK(); -} - -// If a cache has been added into the ascendant tree over this AmazonReview node, then the cache will be executing -// a sampler for fetching the data. As such, any options in the AmazonReview node need to be reset to its defaults so -// If a cache has been added into the ascendant tree over this AmazonReview node, then the cache will be executing -Status AmazonReviewNode::MakeSimpleProducer() { - shard_id_ = 0; - num_shards_ = 1; - shuffle_ = ShuffleMode::kFalse; - num_samples_ = 0; - return Status::OK(); -} - -std::vector AmazonReviewNode::WalkAllFiles(const std::string &usage, const std::string &dataset_dir) { - std::vector amazon_review_files_list; - Path train_prefix("train.csv"); - Path test_prefix("test.csv"); - Path dir(dataset_dir); - - if (usage == "train") { - Path temp_path = dir / train_prefix; - amazon_review_files_list.push_back(temp_path.ToString()); - } else if (usage == "test") { - Path temp_path = dir / test_prefix; - amazon_review_files_list.push_back(temp_path.ToString()); - } else { - Path temp_path = dir / train_prefix; - amazon_review_files_list.push_back(temp_path.ToString()); - Path temp_path1 = dir / test_prefix; - amazon_review_files_list.push_back(temp_path1.ToString()); - } - return amazon_review_files_list; -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h" + +#include +#include + +namespace mindspore::lite { +namespace dataset { +// Constructor for AmazonReviewNode +AmazonReviewNode::AmazonReviewNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, + ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, + const std::shared_ptr &cache) + : NonMappableSourceNode(std::move(cache)), + dataset_dir_(dataset_dir), + num_samples_(num_samples), + shuffle_(shuffle), + num_shards_(num_shards), + shard_id_(shard_id), + usage_(usage), + amazon_review_files_list_(WalkAllFiles(usage, dataset_dir)) { + // Update the num_shards_ in global context. this number is only used for now by auto_num_worker_pass. + // User discretion is advised. Auto_num_worker_pass is currently an experimental feature which can still work + // if the num_shards_ isn't 100% correct. The reason behind is for now, PreBuildSampler doesn't offer a way to + // return num_shards. Once PreBuildSampler is phased out, this can be cleaned up. + GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); +} + +std::shared_ptr AmazonReviewNode::Copy() { + auto node = + std::make_shared(dataset_dir_, usage_, num_samples_, shuffle_, num_shards_, shard_id_, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +void AmazonReviewNode::Print(std::ostream &out) const { + out << (Name() + "(cache: " + ((cache_ != nullptr) ? "true" : "false") + + ", num_shards: " + std::to_string(num_shards_) + ", shard_id: " + std::to_string(shard_id_) + ")"); +} + +Status AmazonReviewNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("AmazonReviewDataset", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateStringValue("AmazonReviewDataset", usage_, {"train", "test", "all"})); + RETURN_IF_NOT_OK(ValidateDatasetFilesParam("AmazonReviewDataset", amazon_review_files_list_)); + RETURN_IF_NOT_OK(ValidateScalar("AmazonReviewDataset", "num_samples", num_samples_, {0}, false)); + RETURN_IF_NOT_OK(ValidateEnum("AmazonReviewDataset", "ShuffleMode", shuffle_, + {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); + + RETURN_IF_NOT_OK(ValidateDatasetShardParams("AmazonReviewDataset", num_shards_, shard_id_)); + return Status::OK(); +} + +Status AmazonReviewNode::Build(std::vector> *const node_ops) { + bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); + + // Sort the dataset files in a lexicographical order. + std::vector sorted_dataset_files = amazon_review_files_list_; + std::sort(sorted_dataset_files.begin(), sorted_dataset_files.end()); + + std::vector> column_default; + column_default.push_back(std::make_shared>(AmazonReviewOp::STRING, "")); + column_default.push_back(std::make_shared>(AmazonReviewOp::STRING, "")); + column_default.push_back(std::make_shared>(AmazonReviewOp::STRING, "")); + + std::vector column_name = {"label", "title", "content"}; + char field_delim = ','; + std::shared_ptr amazon_review_op = std::make_shared( + num_workers_, num_samples_, worker_connector_size_, connector_que_size_, shuffle_files, num_shards_, shard_id_, + field_delim, column_default, column_name, sorted_dataset_files); + RETURN_IF_NOT_OK(amazon_review_op->Init()); + + // If a global shuffle is used for AmazonReview, it will inject a shuffle op over the AmazonReview. + // But, if there is a cache in the tree, we do not need the global shuffle and the shuffle op should not be + // built.This is achieved in the cache transform pass where we call MakeSimpleProducer to reset AmazonReview's + // shuffle option to false. + if (shuffle_ == ShuffleMode::kGlobal) { + // Inject ShuffleOp. + std::shared_ptr shuffle_op = nullptr; + int64_t num_rows = 0; + + // First, get the number of rows in the dataset. + RETURN_IF_NOT_OK(AmazonReviewOp::CountAllFileRows(sorted_dataset_files, false, &num_rows)); + // Add the shuffle op after this op. + RETURN_IF_NOT_OK( + AddShuffleOp(sorted_dataset_files.size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); + shuffle_op->SetTotalRepeats(GetTotalRepeats()); + shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + shuffle_op->Skip(skip_steps_); + node_ops->push_back(shuffle_op); + } + amazon_review_op->SetTotalRepeats(GetTotalRepeats()); + amazon_review_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(amazon_review_op); + return Status::OK(); +} + +Status AmazonReviewNode::GetShardId(int32_t *shard_id) { + *shard_id = shard_id_; + return Status::OK(); +} + +// Get Dataset size +Status AmazonReviewNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + + int64_t num_rows, sample_size; + RETURN_IF_NOT_OK(AmazonReviewOp::CountAllFileRows(amazon_review_files_list_, false, &num_rows)); + sample_size = num_samples_; + num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); + *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status AmazonReviewNode::to_json(nlohmann::json *out_json) { + nlohmann::json args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["usage"] = usage_; + args["num_samples"] = num_samples_; + args["shuffle"] = shuffle_; + args["num_shards"] = num_shards_; + args["shard_id"] = shard_id_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} + +// Note: The following two functions are common among NonMappableSourceNode and should be promoted to its parent +// class. AmazonReview by itself is a non-mappable dataset that does not support sampling. However, if a cache +// operator is injected at some other place higher in the tree, that cache can inherit this sampler from the leaf, +// providing sampling support from the caching layer. That is why we setup the sampler for a leaf node that does not +// use sampling. +Status AmazonReviewNode::SetupSamplerForCache(std::shared_ptr *sampler) { + *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); + return Status::OK(); +} + +// If a cache has been added into the ascendant tree over this AmazonReview node, then the cache will be executing +// a sampler for fetching the data. As such, any options in the AmazonReview node need to be reset to its defaults so +// If a cache has been added into the ascendant tree over this AmazonReview node, then the cache will be executing +Status AmazonReviewNode::MakeSimpleProducer() { + shard_id_ = 0; + num_shards_ = 1; + shuffle_ = ShuffleMode::kFalse; + num_samples_ = 0; + return Status::OK(); +} + +std::vector AmazonReviewNode::WalkAllFiles(const std::string &usage, const std::string &dataset_dir) { + std::vector amazon_review_files_list; + Path train_prefix("train.csv"); + Path test_prefix("test.csv"); + Path dir(dataset_dir); + + if (usage == "train") { + Path temp_path = dir / train_prefix; + amazon_review_files_list.push_back(temp_path.ToString()); + } else if (usage == "test") { + Path temp_path = dir / test_prefix; + amazon_review_files_list.push_back(temp_path.ToString()); + } else { + Path temp_path = dir / train_prefix; + amazon_review_files_list.push_back(temp_path.ToString()); + Path temp_path1 = dir / test_prefix; + amazon_review_files_list.push_back(temp_path1.ToString()); + } + return amazon_review_files_list; +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h old mode 100755 new mode 100644 index ca55a17a866c8b187d26ff2b0d6d8f590d1257f0..868c745c17e6287bd8d20ef58a7902b2c82db129 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h @@ -1,120 +1,120 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AMAZON_REVIEW_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AMAZON_REVIEW_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.h" -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -class AmazonReviewNode : public NonMappableSourceNode { - public: - /// \brief Constructor. - AmazonReviewNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, - int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); - - /// \brief Destructor. - ~AmazonReviewNode() override = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kAmazonReviewNode; } - - /// \brief Print the description. - /// \param[out] out The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief A base class override function to create the required runtime dataset op objects for this class. - /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard id. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size The size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions - const std::string &DatasetDir() const { return dataset_dir_; } - const std::string &Usage() const { return usage_; } - int64_t NumSamples() const { return num_samples_; } - ShuffleMode Shuffle() const { return shuffle_; } - int32_t NumShards() const { return num_shards_; } - int32_t ShardId() const { return shard_id_; } - - /// \brief Get the arguments of node. - /// \param[out] out_json JSON string of all attributes. - /// \return Status of the function. - Status to_json(nlohmann::json *out_json) override; - - /// \brief AmazonReview by itself is a non-mappable dataset that does not support sampling. - /// However, if a cache operator is injected at some other place higher in the tree, that cache can - /// inherit this sampler from the leaf, providing sampling support from the caching layer. - /// That is why we setup the sampler for a leaf node that does not use sampling. - /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. - /// \param[in] sampler The sampler to setup. - /// \return Status of the function. - Status SetupSamplerForCache(std::shared_ptr *sampler) override; - - /// \brief If a cache has been added into the ascendant tree over this AmazonReview node, then the cache will be - /// executing a sampler for fetching the data. As such, any options in the AmazonReview node need to be reset - /// to its defaults so that this AmazonReview node will produce the full set of data into the cache. - /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. - /// \return Status of the function. - Status MakeSimpleProducer() override; - - /// \brief Generate a list of read file names according to usage. - /// \param[in] usage Part of dataset of AmazonReview. - /// \param[in] dataset_dir Path to the root directory that contains the dataset. - /// \return std::vector A list of read file names. - std::vector WalkAllFiles(const std::string &usage, const std::string &dataset_dir); - - private: - std::string dataset_dir_; - std::string usage_; - std::vector> column_defaults_; - std::vector column_names_; - int64_t num_samples_; - ShuffleMode shuffle_; - int32_t num_shards_; - int32_t shard_id_; - std::vector amazon_review_files_list_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AMAZON_REVIEW_NODE_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AMAZON_REVIEW_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AMAZON_REVIEW_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/amazon_review_op.h" +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +class AmazonReviewNode : public NonMappableSourceNode { + public: + /// \brief Constructor. + AmazonReviewNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, + int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); + + /// \brief Destructor. + ~AmazonReviewNode() override = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kAmazonReviewNode; } + + /// \brief Print the description. + /// \param[out] out The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief A base class override function to create the required runtime dataset op objects for this class. + /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard id. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size The size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions + const std::string &DatasetDir() const { return dataset_dir_; } + const std::string &Usage() const { return usage_; } + int64_t NumSamples() const { return num_samples_; } + ShuffleMode Shuffle() const { return shuffle_; } + int32_t NumShards() const { return num_shards_; } + int32_t ShardId() const { return shard_id_; } + + /// \brief Get the arguments of node. + /// \param[out] out_json JSON string of all attributes. + /// \return Status of the function. + Status to_json(nlohmann::json *out_json) override; + + /// \brief AmazonReview by itself is a non-mappable dataset that does not support sampling. + /// However, if a cache operator is injected at some other place higher in the tree, that cache can + /// inherit this sampler from the leaf, providing sampling support from the caching layer. + /// That is why we setup the sampler for a leaf node that does not use sampling. + /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. + /// \param[in] sampler The sampler to setup. + /// \return Status of the function. + Status SetupSamplerForCache(std::shared_ptr *sampler) override; + + /// \brief If a cache has been added into the ascendant tree over this AmazonReview node, then the cache will be + /// executing a sampler for fetching the data. As such, any options in the AmazonReview node need to be reset + /// to its defaults so that this AmazonReview node will produce the full set of data into the cache. + /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. + /// \return Status of the function. + Status MakeSimpleProducer() override; + + /// \brief Generate a list of read file names according to usage. + /// \param[in] usage Part of dataset of AmazonReview. + /// \param[in] dataset_dir Path to the root directory that contains the dataset. + /// \return std::vector A list of read file names. + std::vector WalkAllFiles(const std::string &usage, const std::string &dataset_dir); + + private: + std::string dataset_dir_; + std::string usage_; + std::vector> column_defaults_; + std::vector column_names_; + int64_t num_samples_; + ShuffleMode shuffle_; + int32_t num_shards_; + int32_t shard_id_; + std::vector amazon_review_files_list_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_AMAZON_REVIEW_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/caltech256_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/caltech256_node.cc old mode 100755 new mode 100644 index 2334d56bec4b249abe9bcbc3e17d47dcd544dd01..693c7987db260730696ba801da7b852bdb0e903f --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/caltech256_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/caltech256_node.cc @@ -28,7 +28,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const std::set kExts = {".jpg", ".JPEG"}; @@ -135,4 +135,4 @@ Status Caltech256Node::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CALTECH256_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/celeba_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/celeba_node.cc index 0ab569b1e811cc53b0ba8614fd86c926e4713104..81d5108dab6742f371954daa5f85ac62d9ce77fa 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/celeba_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/celeba_node.cc @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/engine/serdes.h" #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef ENABLE_PYTHON @@ -261,4 +261,4 @@ Status CelebANode::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CIFAR100_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cifar10_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cifar10_node.cc index 7817625c49713be1fb514d340fcbe17d74bc28f5..4a3b33cf77a8213cf31170d9325efdbb7deefba0 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cifar10_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cifar10_node.cc @@ -27,7 +27,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for Cifar10Node @@ -145,4 +145,4 @@ Status Cifar10Node::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CIFAR10_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.cc index 9fcd394094d71d7413022abea10364e73e044ef4..f5e8cbb6a168bbabf318bd09684e06aedf6f366d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/cityscapes_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for CityscapesNode CityscapesNode::CityscapesNode(const std::string &dataset_dir, const std::string &usage, @@ -144,4 +144,4 @@ Status CityscapesNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.h index 290c2246b0e613efbcda922c71dbaf41ed37368d..be8d0b629e596b17e5dd14d1c7f8f5b3b6480ce3 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CityscapesNode : public MappableSourceNode { public: @@ -105,5 +105,5 @@ class CityscapesNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CITYSCAPES_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/clue_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/clue_node.cc index 3f29e6bf627af06cb028094158165591e9b8a0cb..6ad2692e4cc6e0542f7067cb653428fcc3ac43f3 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/clue_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/clue_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/clue_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for CLUENode @@ -288,4 +288,4 @@ Status CLUENode::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/clue_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/clue_node.h index 78a20da941bac90237db4dc9bbc50664282add34..7914c75f57cb548f71f839d015e10b0b915e50c2 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/clue_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/clue_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class CLUENode /// \brief A Dataset derived class to represent CLUE dataset @@ -145,5 +145,5 @@ class CLUENode : public NonMappableSourceNode { int32_t shard_id_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CLUE_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.cc index be43a0ac201c9a0a7701fd7f012cc20f6c348997..c34e4779b7c889e95a6826ee75619578b4e8813e 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.cc @@ -1,116 +1,116 @@ -/** - * Copyright 2022-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.h" - -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.h" -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -CMUArcticNode::CMUArcticNode(const std::string &dataset_dir, const std::string &name, - std::shared_ptr sampler, std::shared_ptr cache) - : MappableSourceNode(std::move(cache)), dataset_dir_(dataset_dir), name_(name), sampler_(sampler) {} - -void CMUArcticNode::Print(std::ostream &out) const { out << Name(); } - -std::shared_ptr CMUArcticNode::Copy() { - std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); - auto node = std::make_shared(dataset_dir_, name_, sampler, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -Status CMUArcticNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("CMUArcticDataset", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateDatasetSampler("CMUArcticDataset", sampler_)); - RETURN_IF_NOT_OK(ValidateStringValue("CMUArcticDataset", name_, - {"aew", "ahw", "aup", "awb", "axb", "bdl", "clb", "eey", "fem", "gka", "jmk", - "ksp", "ljm", "lnh", "rms", "rxr", "slp", "slt"})); - return Status::OK(); -} - -Status CMUArcticNode::Build(std::vector> *const node_ops) { - auto schema = std::make_unique(); - - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); - TensorShape scalar_rate = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); - TensorShape scalar_utterance = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("transcript", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance))); - TensorShape scalar_utterance_id = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("utterance_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance_id))); - - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - - auto op = std::make_shared(dataset_dir_, name_, num_workers_, connector_que_size_, std::move(schema), - std::move(sampler_rt)); - op->SetTotalRepeats(GetTotalRepeats()); - op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(op); - - return Status::OK(); -} - -Status CMUArcticNode::GetShardId(int32_t *shard_id) { - *shard_id = sampler_->ShardId(); - return Status::OK(); -} - -Status CMUArcticNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - int64_t num_rows, sample_size; - RETURN_IF_NOT_OK(CMUArcticOp::CountTotalRows(dataset_dir_, name_, &num_rows)); - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - sample_size = sampler_rt->CalculateNumSamples(num_rows); - if (sample_size == -1) { - RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); - } - *dataset_size = sample_size; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status CMUArcticNode::to_json(nlohmann::json *out_json) { - nlohmann::json args, sampler_args; - RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); - args["sampler"] = sampler_args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["name"] = name_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2022-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.h" + +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/cmu_arctic_op.h" +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +CMUArcticNode::CMUArcticNode(const std::string &dataset_dir, const std::string &name, + std::shared_ptr sampler, std::shared_ptr cache) + : MappableSourceNode(std::move(cache)), dataset_dir_(dataset_dir), name_(name), sampler_(sampler) {} + +void CMUArcticNode::Print(std::ostream &out) const { out << Name(); } + +std::shared_ptr CMUArcticNode::Copy() { + std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); + auto node = std::make_shared(dataset_dir_, name_, sampler, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +Status CMUArcticNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("CMUArcticDataset", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateDatasetSampler("CMUArcticDataset", sampler_)); + RETURN_IF_NOT_OK(ValidateStringValue("CMUArcticDataset", name_, + {"aew", "ahw", "aup", "awb", "axb", "bdl", "clb", "eey", "fem", "gka", "jmk", + "ksp", "ljm", "lnh", "rms", "rxr", "slp", "slt"})); + return Status::OK(); +} + +Status CMUArcticNode::Build(std::vector> *const node_ops) { + auto schema = std::make_unique(); + + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); + TensorShape scalar_rate = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); + TensorShape scalar_utterance = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("transcript", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance))); + TensorShape scalar_utterance_id = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("utterance_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance_id))); + + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + + auto op = std::make_shared(dataset_dir_, name_, num_workers_, connector_que_size_, std::move(schema), + std::move(sampler_rt)); + op->SetTotalRepeats(GetTotalRepeats()); + op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(op); + + return Status::OK(); +} + +Status CMUArcticNode::GetShardId(int32_t *shard_id) { + *shard_id = sampler_->ShardId(); + return Status::OK(); +} + +Status CMUArcticNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + int64_t num_rows, sample_size; + RETURN_IF_NOT_OK(CMUArcticOp::CountTotalRows(dataset_dir_, name_, &num_rows)); + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + sample_size = sampler_rt->CalculateNumSamples(num_rows); + if (sample_size == -1) { + RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); + } + *dataset_size = sample_size; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status CMUArcticNode::to_json(nlohmann::json *out_json) { + nlohmann::json args, sampler_args; + RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); + args["sampler"] = sampler_args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["name"] = name_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.h index 5179bcb0957bce58bd3e1a56601d1aaa23a58451..c1039e14556824d5d05a728499cb229d6dea7902 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/cmu_arctic_node.h @@ -1,95 +1,95 @@ -/** - * Copyright 2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CMU_ARCTIC_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CMU_ARCTIC_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -class CMUArcticNode : public MappableSourceNode { - public: - /// \brief Constructor. - CMUArcticNode(const std::string &dataset_dir, const std::string &name, std::shared_ptr sampler, - std::shared_ptr cache); - - /// \brief Destructor. - ~CMUArcticNode() = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kCMUArcticNode; } - - /// \brief Print the description. - /// \param out The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief a base class override function to create the required runtime dataset op objects for this class. - /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard ID within num_shards. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size the size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - const std::string &GetName() const { return name_; } - - /// \brief Get the arguments of node. - /// \param[out] out_json JSON string of all attributes. - /// \return Status of the function. - Status to_json(nlohmann::json *out_json) override; - - /// \brief Sampler getter. - /// \return SamplerObj of the current node. - std::shared_ptr Sampler() override { return sampler_; } - - /// \brief Sampler setter. - /// \param[in] sampler Tells CMUArcticOp what to read. - void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } - - private: - std::string dataset_dir_; - std::string name_; - std::shared_ptr sampler_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CMU_ARCTIC_NODE_H_ +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CMU_ARCTIC_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CMU_ARCTIC_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +class CMUArcticNode : public MappableSourceNode { + public: + /// \brief Constructor. + CMUArcticNode(const std::string &dataset_dir, const std::string &name, std::shared_ptr sampler, + std::shared_ptr cache); + + /// \brief Destructor. + ~CMUArcticNode() = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kCMUArcticNode; } + + /// \brief Print the description. + /// \param out The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief a base class override function to create the required runtime dataset op objects for this class. + /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard ID within num_shards. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size the size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + const std::string &GetName() const { return name_; } + + /// \brief Get the arguments of node. + /// \param[out] out_json JSON string of all attributes. + /// \return Status of the function. + Status to_json(nlohmann::json *out_json) override; + + /// \brief Sampler getter. + /// \return SamplerObj of the current node. + std::shared_ptr Sampler() override { return sampler_; } + + /// \brief Sampler setter. + /// \param[in] sampler Tells CMUArcticOp what to read. + void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } + + private: + std::string dataset_dir_; + std::string name_; + std::shared_ptr sampler_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CMU_ARCTIC_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/coco_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/coco_node.cc index 83bd6a09bb5062bb99625727fcba3824d2d6617f..1b53ef0f8cbbcd4bf2bf828416038fc8677977fb 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/coco_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/coco_node.cc @@ -27,7 +27,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef ENABLE_PYTHON @@ -248,4 +248,4 @@ Status CocoNode::from_json(nlohmann::json json_obj, std::shared_ptr } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/coco_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/coco_node.h index fa1933a5ab1a30f5d2cb83fab636ec277c98a19d..259dc62ee4104c82d51a6161b50805be1d100ae3 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/coco_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/coco_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CocoNode : public MappableSourceNode { public: @@ -115,5 +115,5 @@ class CocoNode : public MappableSourceNode { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_COCO_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/conll2000_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/conll2000_node.cc index bfb2bde4dec1bbd0262e78cc173bdda0ff083b70..67183072834159863cb483b869d0cb32223828b9 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/conll2000_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/conll2000_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/conll2000_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for CoNLL2000Node. CoNLL2000Node::CoNLL2000Node(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, @@ -203,4 +203,4 @@ std::vector CoNLL2000Node::WalkAllFiles(const std::string &usage, c return conll2000_file_list; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/conll2000_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/conll2000_node.h index ba1f8ef32b70de15d640168be627a1e5c67fc245..be1c44d652b091513cd08709ff3df49028539536 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/conll2000_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/conll2000_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class CoNLL2000Node. /// \brief A Dataset derived class to represent CoNLL2000 dataset. @@ -126,5 +126,5 @@ class CoNLL2000Node : public NonMappableSourceNode { std::vector conll2000_file_list_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CONLL2000_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/csv_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/csv_node.cc index 000b3045a8f0cd189bb42cf522d180afb5d3c76b..32a259f79f2a636b38de6e12df91e376ccc658d2 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/csv_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/csv_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/csv_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for CSVNode @@ -231,4 +231,4 @@ Status CSVNode::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/csv_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/csv_node.h index c2a13df673da4d646123bd63b21ebdd5ec6857e5..f4a564e432c9707721e65d245a5537131dbcca26 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/csv_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/csv_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Record type for CSV enum CsvType : uint8_t { INT = 0, FLOAT, STRING }; @@ -146,5 +146,5 @@ class CSVNode : public NonMappableSourceNode { int32_t shard_id_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CSV_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.cc index c00b10112cf3b7bd911d36fb116107f0e274f4e4..81877723f317db8e72241f1d4a561ab33bfa3938 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { DBpediaNode::DBpediaNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, std::shared_ptr cache) @@ -206,4 +206,4 @@ Status DBpediaNode::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.h index 599ee55446b6bd3acc0da3168a4764071851d7f3..de9d6032db1864a25c7b752c5afa1370786a8104 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/dbpedia_op.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DBpediaNode : public NonMappableSourceNode { public: @@ -116,5 +116,5 @@ class DBpediaNode : public NonMappableSourceNode { int32_t shard_id_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_DBPEDIA_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/div2k_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/div2k_node.cc index 333e1c624a58e27c15aabe0874e11584d95da0aa..3707332993f1e1ccaf72cbd96653ee3812e6cfa4 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/div2k_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/div2k_node.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/div2k_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for DIV2KNode DIV2KNode::DIV2KNode(const std::string &dataset_dir, const std::string &usage, const std::string &downgrade, @@ -153,4 +153,4 @@ Status DIV2KNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/div2k_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/div2k_node.h index c588e2fa58ad5ef1ace65f610d0a62835dda4e02..72ca3d6b676ca72918576fc6026c94bd9da32cda 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/div2k_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/div2k_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DIV2KNode : public MappableSourceNode { public: @@ -104,5 +104,5 @@ class DIV2KNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_DIV2K_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/emnist_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/emnist_node.cc index 731ec0b4614aff734f6e5526b340f4ecf79f01e2..d5bf40adfff625b8cd453a2342dc3105cf9f16a6 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/emnist_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/emnist_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/emnist_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { EMnistNode::EMnistNode(const std::string &dataset_dir, const std::string &name, const std::string &usage, std::shared_ptr sampler, std::shared_ptr cache) @@ -117,4 +117,4 @@ Status EMnistNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/emnist_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/emnist_node.h index 7680ccb370289881aa7094483dbc25feab65e2fa..c3622ec7dccfa0cd928748ddd5f61eeaa2af3391 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/emnist_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/emnist_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class EMnistNode : public MappableSourceNode { public: @@ -106,5 +106,5 @@ class EMnistNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_EMNIST_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.cc index b546476a38d88ff10036584b00a0fcb444c731f2..336d7a980fd41b8c85fe05137345efca23bb20d8 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/en_wik9_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for EnWik9Node EnWik9Node::EnWik9Node(const std::string &dataset_dir, int32_t num_samples, ShuffleMode shuffle, int32_t num_shards, @@ -171,4 +171,4 @@ Status EnWik9Node::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.h index 0e399748204fc49c376fd05477e239195b3e3bf3..40bd9dc056efba8416ad2038b91d60eb3912fdac 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class EnWik9Node. /// \brief A Dataset derived class to represent EnWik9 dataset. @@ -132,5 +132,5 @@ class EnWik9Node : public NonMappableSourceNode { std::vector src_target_file_list_; // file list; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_EN_WIK9_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fake_image_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fake_image_node.cc index aa99fb037aa344496110a5859aa6d6103a6e93ac..09ec2c5ae75bc29f38362535ccaa02ea46f20ec1 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fake_image_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fake_image_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/fake_image_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { FakeImageNode::FakeImageNode(int32_t num_images, const std::vector &image_size, int32_t num_classes, int32_t base_seed, std::shared_ptr sampler, @@ -132,4 +132,4 @@ Status FakeImageNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fake_image_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fake_image_node.h index 1814c9b375f970f7736a5d9893caf29f322fe444..74820762ad9dc5648589f2bfbac343ccf42ab789 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fake_image_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fake_image_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class FakeImageNode : public MappableSourceNode { public: @@ -95,5 +95,5 @@ class FakeImageNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_FAKE_IMAGE_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.cc index e1f0f00d93c9ebdfa2ea6b801990d75795c18b37..377a772d3b66b2a52b266e81256a51d6e8003b58 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/fashion_mnist_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { FashionMnistNode::FashionMnistNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, std::shared_ptr cache) @@ -111,4 +111,4 @@ Status FashionMnistNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.h index 1861cb49eb1548c25d6d2c5e5907c45c6dcf631e..79965f914caf19a662acb13b0a22605d26d94796 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class FashionMnistNode : public MappableSourceNode { public: @@ -90,5 +90,5 @@ class FashionMnistNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_FASHION_MNIST_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/flickr_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/flickr_node.cc index d52223fc809abfb1e6a594d36c79a059bf713acf..c37e196c7d32e761cf38286cedf5afad3331532d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/flickr_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/flickr_node.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for FlickrNode FlickrNode::FlickrNode(const std::string &dataset_dir, const std::string &annotation_file, bool decode, @@ -167,4 +167,4 @@ Status FlickrNode::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_FLICKR_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/food101_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/food101_node.cc index 98e1bc12167cf306e1ed388ce4601fe481096b17..67e46ef23bf1ba3ddc115829f3a3c102ddc8cd90 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/food101_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/food101_node.cc @@ -27,7 +27,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Food101Node::Food101Node(const std::string &dataset_dir, const std::string &usage, bool decode, const std::shared_ptr &sampler, std::shared_ptr cache) @@ -149,4 +149,4 @@ Status Food101Node::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_FOOD101_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/generator_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/generator_node.cc index d33a1999ff24ca113f0a0cbc3bb0a220aa8f57e2..764d320b1dd8eabc2ba1acc4b68f6a0bceebf48c 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/generator_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/generator_node.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { GeneratorNode::GeneratorNode(const py::function &generator_function, const std::vector &column_names, const std::vector &column_types, int64_t source_len, @@ -179,4 +179,4 @@ Status GeneratorNode::GetDatasetSize(const std::shared_ptr &s } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/generator_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/generator_node.h index 9731b3f17f0908544275cd5db8f53efa55157c82..7dd538d9056a50093ddfb6f643559146d46e86f7 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/generator_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/generator_node.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/repeat_node.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class GeneratorNode /// \brief A Dataset derived class to represent GeneratorNode dataset @@ -140,5 +140,5 @@ class GeneratorNode : public MappableSourceNode { Status AcceptAfter(IRNodePass *p, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_GENERATOR_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.cc index 2d9c24759d5c53e9dee51c45cbbfb142e575ddb5..cb7d547086241cacb504bdc088c4a15fb726716a 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.cc @@ -1,110 +1,110 @@ -/** - * Copyright 2022-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.h" - -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.h" -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -GTZANNode::GTZANNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, - std::shared_ptr cache) - : MappableSourceNode(std::move(cache)), dataset_dir_(dataset_dir), usage_(usage), sampler_(sampler) {} - -void GTZANNode::Print(std::ostream &out) const { out << Name(); } - -std::shared_ptr GTZANNode::Copy() { - std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); - auto node = std::make_shared(dataset_dir_, usage_, sampler, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -Status GTZANNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("GTZANDataset", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateDatasetSampler("GTZANDataset", sampler_)); - RETURN_IF_NOT_OK(ValidateStringValue("GTZANDataset", usage_, {"train", "valid", "test", "all"})); - return Status::OK(); -} - -Status GTZANNode::Build(std::vector> *const node_ops) { - // Do internal Schema generation. - auto schema = std::make_unique(); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT64), TensorImpl::kCv, 1))); - TensorShape scalar_rate = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); - TensorShape scalar_label = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK( - schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_label))); - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - auto op = std::make_shared(usage_, num_workers_, dataset_dir_, connector_que_size_, std::move(schema), - std::move(sampler_rt)); - op->SetTotalRepeats(GetTotalRepeats()); - op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(op); - return Status::OK(); -} - -// Get the shard id of node. -Status GTZANNode::GetShardId(int32_t *shard_id) { - *shard_id = sampler_->ShardId(); - return Status::OK(); -} - -// Get Dataset size. -Status GTZANNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - int64_t num_rows, sample_size; - RETURN_IF_NOT_OK(GTZANOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - sample_size = sampler_rt->CalculateNumSamples(num_rows); - if (sample_size == -1) { - RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); - } - *dataset_size = sample_size; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status GTZANNode::to_json(nlohmann::json *out_json) { - nlohmann::json args, sampler_args; - RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); - args["sampler"] = sampler_args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["usage"] = usage_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2022-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.h" + +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/gtzan_op.h" +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +GTZANNode::GTZANNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, + std::shared_ptr cache) + : MappableSourceNode(std::move(cache)), dataset_dir_(dataset_dir), usage_(usage), sampler_(sampler) {} + +void GTZANNode::Print(std::ostream &out) const { out << Name(); } + +std::shared_ptr GTZANNode::Copy() { + std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); + auto node = std::make_shared(dataset_dir_, usage_, sampler, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +Status GTZANNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("GTZANDataset", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateDatasetSampler("GTZANDataset", sampler_)); + RETURN_IF_NOT_OK(ValidateStringValue("GTZANDataset", usage_, {"train", "valid", "test", "all"})); + return Status::OK(); +} + +Status GTZANNode::Build(std::vector> *const node_ops) { + // Do internal Schema generation. + auto schema = std::make_unique(); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT64), TensorImpl::kCv, 1))); + TensorShape scalar_rate = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); + TensorShape scalar_label = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK( + schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_label))); + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + auto op = std::make_shared(usage_, num_workers_, dataset_dir_, connector_que_size_, std::move(schema), + std::move(sampler_rt)); + op->SetTotalRepeats(GetTotalRepeats()); + op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(op); + return Status::OK(); +} + +// Get the shard id of node. +Status GTZANNode::GetShardId(int32_t *shard_id) { + *shard_id = sampler_->ShardId(); + return Status::OK(); +} + +// Get Dataset size. +Status GTZANNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + int64_t num_rows, sample_size; + RETURN_IF_NOT_OK(GTZANOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + sample_size = sampler_rt->CalculateNumSamples(num_rows); + if (sample_size == -1) { + RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); + } + *dataset_size = sample_size; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status GTZANNode::to_json(nlohmann::json *out_json) { + nlohmann::json args, sampler_args; + RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); + args["sampler"] = sampler_args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["usage"] = usage_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.h index 1f239b73863f49a218cc86b8e552992a5b6f2971..e065694c017f29493b11a0b71a41a442d1912239 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/gtzan_node.h @@ -1,95 +1,95 @@ -/** - * Copyright 2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_GTZAN_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_GTZAN_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -class GTZANNode : public MappableSourceNode { - public: - /// \brief Constructor - GTZANNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, - std::shared_ptr cache); - - /// \brief Destructor - ~GTZANNode() = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return "kGTZANNode"; } - - /// \brief Print the description. - /// \param out The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief a base class override function to create the required runtime dataset op objects for this class. - /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard ID within num_shards. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size the size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - const std::string &Usage() const { return usage_; } - - /// \brief Get the arguments of node. - /// \param[out] out_json JSON string of all attributes. - /// \return Status of the function. - Status to_json(nlohmann::json *out_json) override; - - /// \brief Sampler getter. - /// \return SamplerObj of the current node. - std::shared_ptr Sampler() override { return sampler_; } - - /// \brief Sampler setter. - /// \param[in] sampler Tells GTZANOp what to read. - void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } - - private: - std::string dataset_dir_; - std::string usage_; - std::shared_ptr sampler_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_GTZAN_NODE_H_ +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_GTZAN_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_GTZAN_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +class GTZANNode : public MappableSourceNode { + public: + /// \brief Constructor + GTZANNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, + std::shared_ptr cache); + + /// \brief Destructor + ~GTZANNode() = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return "kGTZANNode"; } + + /// \brief Print the description. + /// \param out The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief a base class override function to create the required runtime dataset op objects for this class. + /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard ID within num_shards. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size the size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + const std::string &Usage() const { return usage_; } + + /// \brief Get the arguments of node. + /// \param[out] out_json JSON string of all attributes. + /// \return Status of the function. + Status to_json(nlohmann::json *out_json) override; + + /// \brief Sampler getter. + /// \return SamplerObj of the current node. + std::shared_ptr Sampler() override { return sampler_; } + + /// \brief Sampler setter. + /// \param[in] sampler Tells GTZANOp what to read. + void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } + + private: + std::string dataset_dir_; + std::string usage_; + std::shared_ptr sampler_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_GTZAN_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/image_folder_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/image_folder_node.cc index 3758f31a4d329811f4441f597544707e4b2cff2f..ee6ba080cb52876e81a8cebac188982ec12149a8 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/image_folder_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/image_folder_node.cc @@ -29,7 +29,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef ENABLE_PYTHON @@ -190,4 +190,4 @@ Status ImageFolderNode::from_json(nlohmann::json json_obj, std::shared_ptr sampler, std::shared_ptr cache = nullptr) @@ -140,4 +140,4 @@ Status IMDBNode::from_json(nlohmann::json json_obj, std::shared_ptr } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/imdb_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/imdb_node.h index 6676a8c1e81d02184cd6e6c3a3de5d4ab56fea75..221f5fe48309d217ad6feeacc4560809b16f97a7 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/imdb_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/imdb_node.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class IMDBNode /// \brief A Dataset derived class to represent IMDB dataset @@ -109,5 +109,5 @@ class IMDBNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_IMDB_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.cc index 2e4ff050f8c9ee06e9f22d22471b46f529b5a4f9..d9b5dae95a039448952d6732ad26fcaa3f5c252f 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for IWSLT2016Node. IWSLT2016Node::IWSLT2016Node(const std::string &dataset_dir, const std::string &usage, @@ -190,4 +190,4 @@ Status IWSLT2016Node::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.h index 9d6ec94aece72ef077b9225905e116beeae25eb9..ebd936604fb028160fe738c47f71eaa0404bb090 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class IWSLT2016Node. /// \brief A Node derived class to represent IWSLT2016Node. @@ -133,5 +133,5 @@ class IWSLT2016Node : public NonMappableSourceNode { std::map> support_language_pair_map_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_IWSLT2016_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.cc index 790a7c5cfdc3a7b933df54bd0aa33b93844903e4..bd1c6632b929e80fce44ac8a7267cc24c5b2cab6 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.cc @@ -22,7 +22,7 @@ #include "include/common/debug/common.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/source/iwslt_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for IWSLT2017Node. IWSLT2017Node::IWSLT2017Node(const std::string &dataset_dir, const std::string &usage, @@ -181,4 +181,4 @@ Status IWSLT2017Node::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.h index a9000bdb1ff5fae5d19034b056ae1365c6976bac..fa25b5ec17730de10352762f170e6e38cac5f476 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class IWSLT2017Node. /// \brief A Node derived class to represent IWSLT2017Node. @@ -129,5 +129,5 @@ class IWSLT2017Node : public NonMappableSourceNode { std::map> support_language_pair_map_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_IWSLT2017_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kitti_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kitti_node.cc index d7f60f50947ea98265e70c1494f2883574d6ab02..8f7f5c6eb9d7f3905349f9ede0874f000a124593 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kitti_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kitti_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/kitti_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for KITTINode KITTINode::KITTINode(const std::string &dataset_dir, const std::string &usage, bool decode, @@ -139,4 +139,4 @@ Status KITTINode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kitti_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kitti_node.h index cef9dfeb456f8f81ff7ba593226ba57b34efeac9..5a6475bcde06c36fbe2c23c8de224df5fbe4d534 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kitti_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kitti_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class KITTINode : public MappableSourceNode { public: @@ -100,5 +100,5 @@ class KITTINode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_KITTI_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kmnist_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kmnist_node.cc index d0bb88acb5b0a0066e69225a96a446cd0eefe20a..2b711696480cfd7981ba31ba4248c68213715a3d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kmnist_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kmnist_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/kmnist_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { KMnistNode::KMnistNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, std::shared_ptr cache) @@ -111,4 +111,4 @@ Status KMnistNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kmnist_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kmnist_node.h index aa5ff56505aa2a5af09b73befda1ca4d77ffe133..3a54cb9c4bac4ab65907342e52996362856bfafd 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kmnist_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/kmnist_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class KMnistNode : public MappableSourceNode { public: @@ -97,5 +97,5 @@ class KMnistNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_KMNIST_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lfw_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lfw_node.cc index 2c012bb543dcd7f4dd60a1101001c828b6247a81..49755517f465db93c167782ef43437ccc2f83eba 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lfw_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lfw_node.cc @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/engine/serdes.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { LFWNode::LFWNode(const std::string &dataset_dir, const std::string &task, const std::string &usage, const std::string &image_set, bool decode, const std::shared_ptr &sampler, @@ -162,4 +162,4 @@ Status LFWNode::from_json(nlohmann::json json_obj, std::shared_ptr } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lfw_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lfw_node.h index 1de38a68cbe53bba29a39a23868babab49a89bd1..55b255e358bc0fd64fb8a34d6316b87ad3b500f4 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lfw_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lfw_node.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class LFWNode /// \brief A Dataset derived class to represent LFW dataset. @@ -119,5 +119,5 @@ class LFWNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LFW_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.cc index 2b97bfb8db62557db8ff391e8af7d228ac1fd347..83778d53d42fda62d80cfdd6de95d765fbba9e13 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.cc @@ -1,121 +1,121 @@ -/** - * Copyright 2022-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.h" - -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.h" -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -LibriTTSNode::LibriTTSNode(const std::string &dataset_dir, const std::string &usage, - std::shared_ptr sampler, std::shared_ptr cache) - : MappableSourceNode(std::move(cache)), dataset_dir_(dataset_dir), usage_(usage), sampler_(sampler) {} - -void LibriTTSNode::Print(std::ostream &out) const { out << Name(); } - -std::shared_ptr LibriTTSNode::Copy() { - std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); - auto node = std::make_shared(dataset_dir_, usage_, sampler, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -Status LibriTTSNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("LibriTTSDataset", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateDatasetSampler("LibriTTSDataset", sampler_)); - RETURN_IF_NOT_OK(ValidateStringValue("LibriTTSDataset", usage_, - {"dev-clean", "dev-other", "test-clean", "test-other", "train-clean-100", - "train-clean-360", "train-other-500", "all"})); - return Status::OK(); -} - -Status LibriTTSNode::GetShardId(int32_t *shard_id) { - *shard_id = sampler_->ShardId(); - return Status::OK(); -} - -Status LibriTTSNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - int64_t num_rows, sample_size; - RETURN_IF_NOT_OK(LibriTTSOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - sample_size = sampler_rt->CalculateNumSamples(num_rows); - if (sample_size == -1) { - RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); - } - *dataset_size = sample_size; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status LibriTTSNode::Build(std::vector> *const node_ops) { - auto schema = std::make_unique(); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); - TensorShape scalar_rate = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); - TensorShape scalar_original_text = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("original_text", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_original_text))); - TensorShape scalar_normalized_text = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("normalized_text", DataType(DataType::DE_STRING), - TensorImpl::kFlexible, 0, &scalar_normalized_text))); - TensorShape scalar_speaker_id = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("speaker_id", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_speaker_id))); - TensorShape scalar_chapter_id = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("chapter_id", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_chapter_id))); - TensorShape scalar_utterance_id = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK(schema->AddColumn( - ColDescriptor("utterance_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance_id))); - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - auto op = std::make_shared(dataset_dir_, usage_, num_workers_, connector_que_size_, std::move(schema), - std::move(sampler_rt)); - op->SetTotalRepeats(GetTotalRepeats()); - op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(op); - return Status::OK(); -} - -Status LibriTTSNode::to_json(nlohmann::json *out_json) { - nlohmann::json args, sampler_args; - RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); - args["sampler"] = sampler_args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["usage"] = usage_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2022-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.h" + +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/libri_tts_op.h" +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +LibriTTSNode::LibriTTSNode(const std::string &dataset_dir, const std::string &usage, + std::shared_ptr sampler, std::shared_ptr cache) + : MappableSourceNode(std::move(cache)), dataset_dir_(dataset_dir), usage_(usage), sampler_(sampler) {} + +void LibriTTSNode::Print(std::ostream &out) const { out << Name(); } + +std::shared_ptr LibriTTSNode::Copy() { + std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); + auto node = std::make_shared(dataset_dir_, usage_, sampler, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +Status LibriTTSNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("LibriTTSDataset", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateDatasetSampler("LibriTTSDataset", sampler_)); + RETURN_IF_NOT_OK(ValidateStringValue("LibriTTSDataset", usage_, + {"dev-clean", "dev-other", "test-clean", "test-other", "train-clean-100", + "train-clean-360", "train-other-500", "all"})); + return Status::OK(); +} + +Status LibriTTSNode::GetShardId(int32_t *shard_id) { + *shard_id = sampler_->ShardId(); + return Status::OK(); +} + +Status LibriTTSNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + int64_t num_rows, sample_size; + RETURN_IF_NOT_OK(LibriTTSOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + sample_size = sampler_rt->CalculateNumSamples(num_rows); + if (sample_size == -1) { + RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); + } + *dataset_size = sample_size; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status LibriTTSNode::Build(std::vector> *const node_ops) { + auto schema = std::make_unique(); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("waveform", DataType(DataType::DE_FLOAT32), TensorImpl::kCv, 1))); + TensorShape scalar_rate = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("sample_rate", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_rate))); + TensorShape scalar_original_text = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("original_text", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_original_text))); + TensorShape scalar_normalized_text = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("normalized_text", DataType(DataType::DE_STRING), + TensorImpl::kFlexible, 0, &scalar_normalized_text))); + TensorShape scalar_speaker_id = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("speaker_id", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_speaker_id))); + TensorShape scalar_chapter_id = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("chapter_id", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar_chapter_id))); + TensorShape scalar_utterance_id = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK(schema->AddColumn( + ColDescriptor("utterance_id", DataType(DataType::DE_STRING), TensorImpl::kFlexible, 0, &scalar_utterance_id))); + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + auto op = std::make_shared(dataset_dir_, usage_, num_workers_, connector_que_size_, std::move(schema), + std::move(sampler_rt)); + op->SetTotalRepeats(GetTotalRepeats()); + op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(op); + return Status::OK(); +} + +Status LibriTTSNode::to_json(nlohmann::json *out_json) { + nlohmann::json args, sampler_args; + RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); + args["sampler"] = sampler_args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["usage"] = usage_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.h index 28f8fcb2d4dc2cbd7ab59bf5faebb933136cc3ff..db498586abcc8c82ad7f9c2e06fb23ce29f8566e 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/libri_tts_node.h @@ -1,95 +1,95 @@ -/** - * Copyright 2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LIBRI_TTS_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LIBRI_TTS_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -class LibriTTSNode : public MappableSourceNode { - public: - /// \brief Constructor. - LibriTTSNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, - std::shared_ptr cache); - - /// \brief Destructor. - ~LibriTTSNode() = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kLibriTTSNode; } - - /// \brief Print the description. - /// \param out The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief a base class override function to create the required runtime dataset op objects for this class. - /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard ID within num_shards. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size the size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - const std::string &usage() const { return usage_; } - - /// \brief Get the arguments of node. - /// \param[out] out_json JSON string of all attributes. - /// \return Status of the function. - Status to_json(nlohmann::json *out_json) override; - - /// \brief Sampler getter. - /// \return SamplerObj of the current node. - std::shared_ptr Sampler() override { return sampler_; } - - /// \brief Sampler setter. - /// \param[in] sampler Tells LibriTTSOp what to read. - void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } - - private: - std::string dataset_dir_; - std::string usage_; - std::shared_ptr sampler_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LIBRI_TTS_NODE_H_ +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LIBRI_TTS_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LIBRI_TTS_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +class LibriTTSNode : public MappableSourceNode { + public: + /// \brief Constructor. + LibriTTSNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, + std::shared_ptr cache); + + /// \brief Destructor. + ~LibriTTSNode() = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kLibriTTSNode; } + + /// \brief Print the description. + /// \param out The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief a base class override function to create the required runtime dataset op objects for this class. + /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard ID within num_shards. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size the size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + const std::string &usage() const { return usage_; } + + /// \brief Get the arguments of node. + /// \param[out] out_json JSON string of all attributes. + /// \return Status of the function. + Status to_json(nlohmann::json *out_json) override; + + /// \brief Sampler getter. + /// \return SamplerObj of the current node. + std::shared_ptr Sampler() override { return sampler_; } + + /// \brief Sampler setter. + /// \param[in] sampler Tells LibriTTSOp what to read. + void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } + + private: + std::string dataset_dir_; + std::string usage_; + std::shared_ptr sampler_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LIBRI_TTS_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.cc index 63d17ad337b94fa5fa6d91dedee3b3b990df86ff..4f37fa517733cbb7adb11aab810edddf4530b4d4 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/lj_speech_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for LJSpeechNode. LJSpeechNode::LJSpeechNode(const std::string &dataset_dir, std::shared_ptr sampler, @@ -117,4 +117,4 @@ Status LJSpeechNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.h index ab5504f95732b1adbd7b6eb308f481e273643c75..062c5366352f7057b77bb32dedbce54dfc7c9686 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Read LJSpeech dataset. class LJSpeechNode : public MappableSourceNode { @@ -91,5 +91,5 @@ class LJSpeechNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LJ_SPEECH_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lsun_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lsun_node.cc index ae296bfc0086f8c3e4773b2738db89eba4b96c39..ff60bb406961c7750e49459274044784a7091bfa 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lsun_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lsun_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/lsun_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { LSUNNode::LSUNNode(const std::string &dataset_dir, const std::string &usage, const std::vector &classes, bool decode, std::shared_ptr sampler, std::shared_ptr cache = nullptr) @@ -122,4 +122,4 @@ Status LSUNNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lsun_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lsun_node.h index f6424d4ae91c7487dbce26e4ff3bbe2b80a9fd35..e5537fd6819cd6ddc87fecd466b0255d5b857fba 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lsun_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/lsun_node.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class LSUNNode /// \brief A Dataset derived class to represent LSUN dataset @@ -107,5 +107,5 @@ class LSUNNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_LSUN_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/manifest_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/manifest_node.cc index 360ae9b58f671438eb1842ba3dfdf94ce26de56d..4023e3ac1a2fecc5f82a2a15c64ce4c5d4e90ca0 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/manifest_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/manifest_node.cc @@ -28,7 +28,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { ManifestNode::ManifestNode(const std::string &dataset_file, const std::string &usage, @@ -186,4 +186,4 @@ Status ManifestNode::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_MANIFEST_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/minddata_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/minddata_node.cc index b754f4302e4b265dfaf9759a5979571a4f8d3d37..02eb8e484e1c252da894b26f5e707733db5bb0dc 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/minddata_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/minddata_node.cc @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { MindDataNode::MindDataNode(const std::vector &dataset_files, const std::vector &columns_list, @@ -260,4 +260,4 @@ Status MindDataNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/minddata_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/minddata_node.h index 5b99471f79f1c8952c73e03bb64280e1c05de1f4..0446df471b19396799ad89dc4fcdd1d34803aa83 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/minddata_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/minddata_node.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/mindrecord_op.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class MindDataNode : public MappableSourceNode { public: @@ -120,5 +120,5 @@ class MindDataNode : public MappableSourceNode { ShuffleMode shuffle_mode_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_MINDDATA_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/mnist_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/mnist_node.cc index cc7e9f6eb9d782ee5c8df81461fd978ef24cb0b0..1aa4912abb6acb9ad7e1ebfd45480346402dad8d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/mnist_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/mnist_node.cc @@ -27,7 +27,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { MnistNode::MnistNode(std::string dataset_dir, std::string usage, std::shared_ptr sampler, @@ -137,4 +137,4 @@ Status MnistNode::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_MNIST_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/multi30k_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/multi30k_node.cc index ed0e11db7c78fa6e5b064f6a92ac0783eb8b6804..eca87543d8831379faa4b3ec7a145146a715601b 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/multi30k_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/multi30k_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/multi30k_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Multi30kNode::Multi30kNode(const std::string &dataset_dir, const std::string &usage, const std::vector &language_pair, int32_t num_samples, ShuffleMode shuffle, @@ -196,4 +196,4 @@ std::vector Multi30kNode::WalkAllFiles(const std::string &usage, co return multi30k_files_list; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/multi30k_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/multi30k_node.h index 42217dfc5bf22d79cf6d45468df97614b8486209..7c2aad1fe7ce589688edb5963fc4c8864e2b9b73 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/multi30k_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/multi30k_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Multi30kNode : public NonMappableSourceNode { public: @@ -130,5 +130,5 @@ class Multi30kNode : public NonMappableSourceNode { std::vector multi30k_files_list_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_MULTI30K_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/omniglot_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/omniglot_node.cc index 7af9e38f3b7c6b875979bac873de0877e8ac9dd9..5ec0456ae8b21eceb4af5b43f678be6998c0848a 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/omniglot_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/omniglot_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/omniglot_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { OmniglotNode::OmniglotNode(const std::string &dataset_dir, bool background, bool decode, const std::shared_ptr &sampler, const std::shared_ptr &cache) @@ -122,4 +122,4 @@ Status OmniglotNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/omniglot_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/omniglot_node.h index ab87cee8f2f70b34e756770741e9addc5b3cc29b..8e980c935abd93b3a53a6dab8dc02637b4218433 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/omniglot_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/omniglot_node.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/cache/dataset_cache.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class OmniglotNode /// \brief A Dataset derived class to represent Omniglot dataset. @@ -99,5 +99,5 @@ class OmniglotNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_OMNIGLOT_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.cc index 7901809207a98a4e129a6111f7976682d467e5b7..6cf2e873bfc7ac7607801e0842dcf9674c408c6e 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.cc @@ -1,200 +1,200 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h" - -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.h" -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -// Constructor for PennTreebankNode. -PennTreebankNode::PennTreebankNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, - ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, - const std::shared_ptr &cache) - : NonMappableSourceNode(std::move(cache)), - dataset_dir_(dataset_dir), - usage_(usage), - num_samples_(num_samples), - shuffle_(shuffle), - num_shards_(num_shards), - shard_id_(shard_id), - penn_treebank_files_list_(WalkAllFiles(usage, dataset_dir)) { - // Update the num_shards_ in global context. this number is only used for now by auto_num_worker_pass. User discretion - // is advised. Auto_num_worker_pass is currently an experimental feature which can still work if the num_shards_ isn't - // 100% correct. The reason behind is for now, PreBuildSampler doesn't offer a way to return num_shards. Once - // PreBuildSampler is phased out, this can be cleaned up. - GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); -} - -std::shared_ptr PennTreebankNode::Copy() { - auto node = - std::make_shared(dataset_dir_, usage_, num_samples_, shuffle_, num_shards_, shard_id_, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -void PennTreebankNode::Print(std::ostream &out) const { - out << (Name() + "(cache: " + ((cache_ != nullptr) ? "true" : "false") + - ", num_shards: " + std::to_string(num_shards_) + ", shard_id: " + std::to_string(shard_id_) + ")"); -} - -Status PennTreebankNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("PennTreebankNode", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateStringValue("PennTreebankNode", usage_, {"train", "test", "valid", "all"})); - RETURN_IF_NOT_OK(ValidateEnum("PennTreebankNode", "ShuffleMode", shuffle_, - {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); - if (num_samples_ < 0) { - std::string err_msg = "PennTreebankNode: Invalid number of samples: " + std::to_string(num_samples_); - LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); - } - RETURN_IF_NOT_OK(ValidateDatasetShardParams("PennTreebankNode", num_shards_, shard_id_)); - return Status::OK(); -} - -// Function to build PennTreebankNode. -Status PennTreebankNode::Build(std::vector> *const node_ops) { - bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); - // Sort the dataset files in a lexicographical order. - std::vector sorted_dataset_files = penn_treebank_files_list_; - std::sort(sorted_dataset_files.begin(), sorted_dataset_files.end()); - // Do internal Schema generation. - auto schema = std::make_unique(); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("text", DataType(DataType::DE_UINT8), TensorImpl::kFlexible, 1))); - // Create and initialize PennTreebankNode. - std::shared_ptr penn_treebank_op = - std::make_shared(num_workers_, num_samples_, worker_connector_size_, std::move(schema), - sorted_dataset_files, connector_que_size_, shuffle_files, num_shards_, shard_id_); - RETURN_IF_NOT_OK(penn_treebank_op->Init()); - // If a global shuffle is used for PennTreebank, it will inject a shuffle op over the PennTreebank. - // But, if there is a cache in the tree, we do not need the global shuffle and the shuffle op should not be built. - // This is achieved in the cache transform pass where we call MakeSimpleProducer to reset PennTreebank's shuffle - // option to false. - if (shuffle_ == ShuffleMode::kGlobal) { - // Inject ShuffleOp. - std::shared_ptr shuffle_op = nullptr; - int64_t num_rows = 0; - // First, get the number of rows in the dataset. - RETURN_IF_NOT_OK(PennTreebankOp::CountAllFileRows(penn_treebank_files_list_, &num_rows)); - // Add the shuffle op after this op. - RETURN_IF_NOT_OK( - AddShuffleOp(sorted_dataset_files.size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); - shuffle_op->SetTotalRepeats(GetTotalRepeats()); - shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - shuffle_op->Skip(skip_steps_); - node_ops->push_back(shuffle_op); - } - penn_treebank_op->SetTotalRepeats(GetTotalRepeats()); - penn_treebank_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - // Add PennTreebankNode. - node_ops->push_back(penn_treebank_op); - return Status::OK(); -} - -// Get the shard id of node. -Status PennTreebankNode::GetShardId(int32_t *shard_id) { - *shard_id = shard_id_; - return Status::OK(); -} - -// Get Dataset size. -Status PennTreebankNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - int64_t num_rows, sample_size = num_samples_; - RETURN_IF_NOT_OK(PennTreebankOp::CountAllFileRows(penn_treebank_files_list_, &num_rows)); - num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); - *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status PennTreebankNode::to_json(nlohmann::json *out_json) { - nlohmann::json args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["usage"] = usage_; - args["num_samples"] = num_samples_; - args["shuffle"] = shuffle_; - args["num_shards"] = num_shards_; - args["shard_id"] = shard_id_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} - -// Note: The following two functions are common among NonMappableSourceNode and should be promoted to its parent class. -// PennTreebank by itself is a non-mappable dataset that does not support sampling. -// However, if a cache operator is injected at some other place higher in the tree, that cache can -// inherit this sampler from the leaf, providing sampling support from the caching layer. -// That is why we setup the sampler for a leaf node that does not use sampling. -Status PennTreebankNode::SetupSamplerForCache(std::shared_ptr *sampler) { - *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); - return Status::OK(); -} - -// If a cache has been added into the ascendant tree over this PennTreebank node, then the cache will be executing -// a sampler for fetching the data. As such, any options in the PennTreebank node need to be reset to its defaults so -// that this PennTreebank node will produce the full set of data into the cache. -Status PennTreebankNode::MakeSimpleProducer() { - shard_id_ = 0; - num_shards_ = 1; - shuffle_ = ShuffleMode::kFalse; - num_samples_ = 0; - return Status::OK(); -} - -std::vector PennTreebankNode::WalkAllFiles(const std::string &usage, const std::string &dataset_dir) { - std::vector penn_treebank_files_list; - Path train_prefix("ptb.train.txt"); - Path test_prefix("ptb.test.txt"); - Path valid_prefix("ptb.valid.txt"); - Path dir(dataset_dir); - - if (usage == "train") { - Path temp_path = dir / train_prefix; - penn_treebank_files_list.push_back(temp_path.ToString()); - } else if (usage == "test") { - Path temp_path = dir / test_prefix; - penn_treebank_files_list.push_back(temp_path.ToString()); - } else if (usage == "valid") { - Path temp_path = dir / valid_prefix; - penn_treebank_files_list.push_back(temp_path.ToString()); - } else { - Path temp_path = dir / train_prefix; - penn_treebank_files_list.push_back(temp_path.ToString()); - Path temp_path1 = dir / test_prefix; - penn_treebank_files_list.push_back(temp_path1.ToString()); - Path temp_path2 = dir / valid_prefix; - penn_treebank_files_list.push_back(temp_path2.ToString()); - } - return penn_treebank_files_list; -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h" + +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/penn_treebank_op.h" +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +// Constructor for PennTreebankNode. +PennTreebankNode::PennTreebankNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, + ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, + const std::shared_ptr &cache) + : NonMappableSourceNode(std::move(cache)), + dataset_dir_(dataset_dir), + usage_(usage), + num_samples_(num_samples), + shuffle_(shuffle), + num_shards_(num_shards), + shard_id_(shard_id), + penn_treebank_files_list_(WalkAllFiles(usage, dataset_dir)) { + // Update the num_shards_ in global context. this number is only used for now by auto_num_worker_pass. User discretion + // is advised. Auto_num_worker_pass is currently an experimental feature which can still work if the num_shards_ isn't + // 100% correct. The reason behind is for now, PreBuildSampler doesn't offer a way to return num_shards. Once + // PreBuildSampler is phased out, this can be cleaned up. + GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); +} + +std::shared_ptr PennTreebankNode::Copy() { + auto node = + std::make_shared(dataset_dir_, usage_, num_samples_, shuffle_, num_shards_, shard_id_, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +void PennTreebankNode::Print(std::ostream &out) const { + out << (Name() + "(cache: " + ((cache_ != nullptr) ? "true" : "false") + + ", num_shards: " + std::to_string(num_shards_) + ", shard_id: " + std::to_string(shard_id_) + ")"); +} + +Status PennTreebankNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("PennTreebankNode", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateStringValue("PennTreebankNode", usage_, {"train", "test", "valid", "all"})); + RETURN_IF_NOT_OK(ValidateEnum("PennTreebankNode", "ShuffleMode", shuffle_, + {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); + if (num_samples_ < 0) { + std::string err_msg = "PennTreebankNode: Invalid number of samples: " + std::to_string(num_samples_); + LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); + } + RETURN_IF_NOT_OK(ValidateDatasetShardParams("PennTreebankNode", num_shards_, shard_id_)); + return Status::OK(); +} + +// Function to build PennTreebankNode. +Status PennTreebankNode::Build(std::vector> *const node_ops) { + bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); + // Sort the dataset files in a lexicographical order. + std::vector sorted_dataset_files = penn_treebank_files_list_; + std::sort(sorted_dataset_files.begin(), sorted_dataset_files.end()); + // Do internal Schema generation. + auto schema = std::make_unique(); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("text", DataType(DataType::DE_UINT8), TensorImpl::kFlexible, 1))); + // Create and initialize PennTreebankNode. + std::shared_ptr penn_treebank_op = + std::make_shared(num_workers_, num_samples_, worker_connector_size_, std::move(schema), + sorted_dataset_files, connector_que_size_, shuffle_files, num_shards_, shard_id_); + RETURN_IF_NOT_OK(penn_treebank_op->Init()); + // If a global shuffle is used for PennTreebank, it will inject a shuffle op over the PennTreebank. + // But, if there is a cache in the tree, we do not need the global shuffle and the shuffle op should not be built. + // This is achieved in the cache transform pass where we call MakeSimpleProducer to reset PennTreebank's shuffle + // option to false. + if (shuffle_ == ShuffleMode::kGlobal) { + // Inject ShuffleOp. + std::shared_ptr shuffle_op = nullptr; + int64_t num_rows = 0; + // First, get the number of rows in the dataset. + RETURN_IF_NOT_OK(PennTreebankOp::CountAllFileRows(penn_treebank_files_list_, &num_rows)); + // Add the shuffle op after this op. + RETURN_IF_NOT_OK( + AddShuffleOp(sorted_dataset_files.size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); + shuffle_op->SetTotalRepeats(GetTotalRepeats()); + shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + shuffle_op->Skip(skip_steps_); + node_ops->push_back(shuffle_op); + } + penn_treebank_op->SetTotalRepeats(GetTotalRepeats()); + penn_treebank_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + // Add PennTreebankNode. + node_ops->push_back(penn_treebank_op); + return Status::OK(); +} + +// Get the shard id of node. +Status PennTreebankNode::GetShardId(int32_t *shard_id) { + *shard_id = shard_id_; + return Status::OK(); +} + +// Get Dataset size. +Status PennTreebankNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + int64_t num_rows, sample_size = num_samples_; + RETURN_IF_NOT_OK(PennTreebankOp::CountAllFileRows(penn_treebank_files_list_, &num_rows)); + num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); + *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status PennTreebankNode::to_json(nlohmann::json *out_json) { + nlohmann::json args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["usage"] = usage_; + args["num_samples"] = num_samples_; + args["shuffle"] = shuffle_; + args["num_shards"] = num_shards_; + args["shard_id"] = shard_id_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} + +// Note: The following two functions are common among NonMappableSourceNode and should be promoted to its parent class. +// PennTreebank by itself is a non-mappable dataset that does not support sampling. +// However, if a cache operator is injected at some other place higher in the tree, that cache can +// inherit this sampler from the leaf, providing sampling support from the caching layer. +// That is why we setup the sampler for a leaf node that does not use sampling. +Status PennTreebankNode::SetupSamplerForCache(std::shared_ptr *sampler) { + *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); + return Status::OK(); +} + +// If a cache has been added into the ascendant tree over this PennTreebank node, then the cache will be executing +// a sampler for fetching the data. As such, any options in the PennTreebank node need to be reset to its defaults so +// that this PennTreebank node will produce the full set of data into the cache. +Status PennTreebankNode::MakeSimpleProducer() { + shard_id_ = 0; + num_shards_ = 1; + shuffle_ = ShuffleMode::kFalse; + num_samples_ = 0; + return Status::OK(); +} + +std::vector PennTreebankNode::WalkAllFiles(const std::string &usage, const std::string &dataset_dir) { + std::vector penn_treebank_files_list; + Path train_prefix("ptb.train.txt"); + Path test_prefix("ptb.test.txt"); + Path valid_prefix("ptb.valid.txt"); + Path dir(dataset_dir); + + if (usage == "train") { + Path temp_path = dir / train_prefix; + penn_treebank_files_list.push_back(temp_path.ToString()); + } else if (usage == "test") { + Path temp_path = dir / test_prefix; + penn_treebank_files_list.push_back(temp_path.ToString()); + } else if (usage == "valid") { + Path temp_path = dir / valid_prefix; + penn_treebank_files_list.push_back(temp_path.ToString()); + } else { + Path temp_path = dir / train_prefix; + penn_treebank_files_list.push_back(temp_path.ToString()); + Path temp_path1 = dir / test_prefix; + penn_treebank_files_list.push_back(temp_path1.ToString()); + Path temp_path2 = dir / valid_prefix; + penn_treebank_files_list.push_back(temp_path2.ToString()); + } + return penn_treebank_files_list; +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h index c37df7690c7250e490841d4a6c04bf21860a2dba..140da173fa46d54a23e013d4663fc96a9603a6a5 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h @@ -1,124 +1,124 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PENN_TREEBANK_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PENN_TREEBANK_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -/// \brief class PennTreebankNode. -/// \brief Dataset derived class to represent PennTreebank dataset. -class PennTreebankNode : public NonMappableSourceNode { - public: - /// \brief Constructor. - PennTreebankNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, - int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); - - /// \brief Destructor. - ~PennTreebankNode() override = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kPennTreebankNode; } - - /// \brief Print the description. - /// \param[in] out The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief A base class override function to create the required runtime dataset op objects for this class. - /// \param[in] node_ops A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard id. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size the size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - int32_t NumSamples() const { return num_samples_; } - int32_t NumShards() const { return num_shards_; } - int32_t ShardId() const { return shard_id_; } - ShuffleMode Shuffle() const { return shuffle_; } - const std::string &Usage() const { return usage_; } - - /// \brief Get the arguments of node - /// \param[out] out_json JSON string of all attributes - /// \return Status of the function - Status to_json(nlohmann::json *out_json) override; - - /// \brief PennTreebank by itself is a non-mappable dataset that does not support sampling. - /// However, if a cache operator is injected at some other place higher in - /// the tree, that cache can inherit this sampler from the leaf, providing - /// sampling support from the caching layer. That is why we setup the - /// sampler for a leaf node that does not use sampling. Note: This - /// function is common among NonMappableSourceNode and should be promoted - /// to its parent class. - /// \param[in] sampler The sampler to setup. - /// \return Status of the function. - Status SetupSamplerForCache(std::shared_ptr *sampler) override; - - /// \brief If a cache has been added into the ascendant tree over this PennTreebank node, - /// then the cache will be executing a sampler for fetching the data. - /// As such, any options in the PennTreebank node need to be reset to its defaults - /// so that this PennTreebank node will produce the full set of data into the cache. - /// Note: This function is common among NonMappableSourceNode and should be promoted to its - /// parent class. - /// \return Status of the function. - Status MakeSimpleProducer() override; - - /// \brief Generate a list of read file names according to usage. - /// \param[in] usage Part of dataset of PennTreebank. - /// \param[in] dataset_dir Path to the root directory that contains the dataset. - /// \return std::vector A list of read file names. - std::vector WalkAllFiles(const std::string &usage, const std::string &dataset_dir); - - private: - std::string dataset_dir_; - std::string usage_; - int64_t num_samples_; - int32_t num_shards_; - int32_t shard_id_; - ShuffleMode shuffle_; - std::vector penn_treebank_files_list_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PENN_TREEBANK_NODE_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PENN_TREEBANK_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PENN_TREEBANK_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +/// \brief class PennTreebankNode. +/// \brief Dataset derived class to represent PennTreebank dataset. +class PennTreebankNode : public NonMappableSourceNode { + public: + /// \brief Constructor. + PennTreebankNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, + int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); + + /// \brief Destructor. + ~PennTreebankNode() override = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kPennTreebankNode; } + + /// \brief Print the description. + /// \param[in] out The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief A base class override function to create the required runtime dataset op objects for this class. + /// \param[in] node_ops A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard id. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size the size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + int32_t NumSamples() const { return num_samples_; } + int32_t NumShards() const { return num_shards_; } + int32_t ShardId() const { return shard_id_; } + ShuffleMode Shuffle() const { return shuffle_; } + const std::string &Usage() const { return usage_; } + + /// \brief Get the arguments of node + /// \param[out] out_json JSON string of all attributes + /// \return Status of the function + Status to_json(nlohmann::json *out_json) override; + + /// \brief PennTreebank by itself is a non-mappable dataset that does not support sampling. + /// However, if a cache operator is injected at some other place higher in + /// the tree, that cache can inherit this sampler from the leaf, providing + /// sampling support from the caching layer. That is why we setup the + /// sampler for a leaf node that does not use sampling. Note: This + /// function is common among NonMappableSourceNode and should be promoted + /// to its parent class. + /// \param[in] sampler The sampler to setup. + /// \return Status of the function. + Status SetupSamplerForCache(std::shared_ptr *sampler) override; + + /// \brief If a cache has been added into the ascendant tree over this PennTreebank node, + /// then the cache will be executing a sampler for fetching the data. + /// As such, any options in the PennTreebank node need to be reset to its defaults + /// so that this PennTreebank node will produce the full set of data into the cache. + /// Note: This function is common among NonMappableSourceNode and should be promoted to its + /// parent class. + /// \return Status of the function. + Status MakeSimpleProducer() override; + + /// \brief Generate a list of read file names according to usage. + /// \param[in] usage Part of dataset of PennTreebank. + /// \param[in] dataset_dir Path to the root directory that contains the dataset. + /// \return std::vector A list of read file names. + std::vector WalkAllFiles(const std::string &usage, const std::string &dataset_dir); + + private: + std::string dataset_dir_; + std::string usage_; + int64_t num_samples_; + int32_t num_shards_; + int32_t shard_id_; + ShuffleMode shuffle_; + std::vector penn_treebank_files_list_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PENN_TREEBANK_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.cc index 809fc96b084e3becb307ad9ce3e723f6789e347d..65562829302de803bc4a6aee5062740bb11b73af 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/photo_tour_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { PhotoTourNode::PhotoTourNode(const std::string &dataset_dir, const std::string &name, const std::string &usage, std::shared_ptr sampler, std::shared_ptr cache) @@ -128,4 +128,4 @@ Status PhotoTourNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.h index b69c9efb85308ba59681db404bd7d92d1ac47467..685f259263e9f1c068255e454f4cae39cd3d7ecf 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class PhotoTourNode : public MappableSourceNode { public: @@ -94,5 +94,5 @@ class PhotoTourNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PHOTO_TOUR_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/places365_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/places365_node.cc index 9700e8c42755651c064fc4a3a214d8716a7d0ecb..a1fa3ba32a1da67dd0e49b4a1a606c48402b53b0 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/places365_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/places365_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/places365_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Places365Node::Places365Node(const std::string &dataset_dir, const std::string &usage, bool small, bool decode, std::shared_ptr sampler, std::shared_ptr cache) @@ -116,4 +116,4 @@ Status Places365Node::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/places365_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/places365_node.h index d34fc7656b620ac97e80dc8e8a2c7695cb6df553..c8d964b832c64d43521137d3071dd140fffb7af7 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/places365_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/places365_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Places365Node : public MappableSourceNode { public: @@ -96,5 +96,5 @@ class Places365Node : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PLACES365_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.cc index fb37756137cd4b6e854f65e83fa5d64dd92ea16a..b2f7eef185507da102d08dadf905f58e11d8b51c 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.cc @@ -1,154 +1,154 @@ -/** - * Copyright 2021-2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h" - -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.h" -#ifndef ENABLE_ANDROID -#include "mindspore-lite/minddata/dataset/engine/serdes.h" -#endif -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -QMnistNode::QMnistNode(const std::string &dataset_dir, const std::string &usage, bool compat, - std::shared_ptr sampler, std::shared_ptr cache) - : MappableSourceNode(std::move(cache)), - dataset_dir_(dataset_dir), - usage_(usage), - compat_(compat), - sampler_(sampler) {} - -std::shared_ptr QMnistNode::Copy() { - std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); - auto node = std::make_shared(dataset_dir_, usage_, compat_, sampler, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -void QMnistNode::Print(std::ostream &out) const { - out << (Name() + "(dataset dir: " + dataset_dir_ + ", usage: " + usage_ + - ", compat: " + (compat_ ? "true" : "false") + ", cache: " + ((cache_ != nullptr) ? "true" : "false") + ")"); -} - -Status QMnistNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("QMnistDataset", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateDatasetSampler("QMnistDataset", sampler_)); - RETURN_IF_NOT_OK( - ValidateStringValue("QMnistDataset", usage_, {"train", "test", "test10k", "test50k", "nist", "all"})); - return Status::OK(); -} - -Status QMnistNode::Build(std::vector> *const node_ops) { - // Do internal Schema generation. - auto schema = std::make_unique(); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("image", DataType(DataType::DE_UINT8), TensorImpl::kCv, 1))); - if (compat_) { - TensorShape scalar = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK( - schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar))); - } else { - RETURN_IF_NOT_OK( - schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 1))); - } - - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - - auto op = std::make_shared(dataset_dir_, usage_, compat_, std::move(schema), std::move(sampler_rt), - num_workers_, connector_que_size_); - op->SetTotalRepeats(GetTotalRepeats()); - op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(op); - - return Status::OK(); -} - -// Get the shard id of node -Status QMnistNode::GetShardId(int32_t *shard_id) { - *shard_id = sampler_->ShardId(); - - return Status::OK(); -} - -// Get Dataset size -Status QMnistNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - int64_t num_rows, sample_size; - RETURN_IF_NOT_OK(QMnistOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - sample_size = sampler_rt->CalculateNumSamples(num_rows); - if (sample_size == -1) { - RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); - } - *dataset_size = sample_size; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status QMnistNode::to_json(nlohmann::json *out_json) { - nlohmann::json args, sampler_args; - RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); - args["sampler"] = sampler_args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["usage"] = usage_; - args["compat"] = compat_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} - -#ifndef ENABLE_ANDROID -Status QMnistNode::from_json(nlohmann::json json_obj, std::shared_ptr *ds) { - RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "num_parallel_workers", kQMnistNode)); - RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "connector_queue_size", kQMnistNode)); - RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "dataset_dir", kQMnistNode)); - RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "usage", kQMnistNode)); - RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "compat", kQMnistNode)); - RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "sampler", kQMnistNode)); - std::string dataset_dir = json_obj["dataset_dir"]; - std::string usage = json_obj["usage"]; - bool compat = json_obj["compat"]; - std::shared_ptr sampler; - RETURN_IF_NOT_OK(Serdes::ConstructSampler(json_obj["sampler"], &sampler)); - std::shared_ptr cache = nullptr; - RETURN_IF_NOT_OK(DatasetCache::from_json(json_obj, &cache)); - *ds = std::make_shared(dataset_dir, usage, compat, sampler, cache); - (void)(*ds)->SetNumWorkers(json_obj["num_parallel_workers"]); - (void)(*ds)->SetConnectorQueueSize(json_obj["connector_queue_size"]); - return Status::OK(); -} -#endif -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h" + +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/qmnist_op.h" +#ifndef ENABLE_ANDROID +#include "mindspore-lite/minddata/dataset/engine/serdes.h" +#endif +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +QMnistNode::QMnistNode(const std::string &dataset_dir, const std::string &usage, bool compat, + std::shared_ptr sampler, std::shared_ptr cache) + : MappableSourceNode(std::move(cache)), + dataset_dir_(dataset_dir), + usage_(usage), + compat_(compat), + sampler_(sampler) {} + +std::shared_ptr QMnistNode::Copy() { + std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); + auto node = std::make_shared(dataset_dir_, usage_, compat_, sampler, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +void QMnistNode::Print(std::ostream &out) const { + out << (Name() + "(dataset dir: " + dataset_dir_ + ", usage: " + usage_ + + ", compat: " + (compat_ ? "true" : "false") + ", cache: " + ((cache_ != nullptr) ? "true" : "false") + ")"); +} + +Status QMnistNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("QMnistDataset", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateDatasetSampler("QMnistDataset", sampler_)); + RETURN_IF_NOT_OK( + ValidateStringValue("QMnistDataset", usage_, {"train", "test", "test10k", "test50k", "nist", "all"})); + return Status::OK(); +} + +Status QMnistNode::Build(std::vector> *const node_ops) { + // Do internal Schema generation. + auto schema = std::make_unique(); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("image", DataType(DataType::DE_UINT8), TensorImpl::kCv, 1))); + if (compat_) { + TensorShape scalar = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK( + schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar))); + } else { + RETURN_IF_NOT_OK( + schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 1))); + } + + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + + auto op = std::make_shared(dataset_dir_, usage_, compat_, std::move(schema), std::move(sampler_rt), + num_workers_, connector_que_size_); + op->SetTotalRepeats(GetTotalRepeats()); + op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(op); + + return Status::OK(); +} + +// Get the shard id of node +Status QMnistNode::GetShardId(int32_t *shard_id) { + *shard_id = sampler_->ShardId(); + + return Status::OK(); +} + +// Get Dataset size +Status QMnistNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + int64_t num_rows, sample_size; + RETURN_IF_NOT_OK(QMnistOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + sample_size = sampler_rt->CalculateNumSamples(num_rows); + if (sample_size == -1) { + RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); + } + *dataset_size = sample_size; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status QMnistNode::to_json(nlohmann::json *out_json) { + nlohmann::json args, sampler_args; + RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); + args["sampler"] = sampler_args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["usage"] = usage_; + args["compat"] = compat_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} + +#ifndef ENABLE_ANDROID +Status QMnistNode::from_json(nlohmann::json json_obj, std::shared_ptr *ds) { + RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "num_parallel_workers", kQMnistNode)); + RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "connector_queue_size", kQMnistNode)); + RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "dataset_dir", kQMnistNode)); + RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "usage", kQMnistNode)); + RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "compat", kQMnistNode)); + RETURN_IF_NOT_OK(ValidateParamInJson(json_obj, "sampler", kQMnistNode)); + std::string dataset_dir = json_obj["dataset_dir"]; + std::string usage = json_obj["usage"]; + bool compat = json_obj["compat"]; + std::shared_ptr sampler; + RETURN_IF_NOT_OK(Serdes::ConstructSampler(json_obj["sampler"], &sampler)); + std::shared_ptr cache = nullptr; + RETURN_IF_NOT_OK(DatasetCache::from_json(json_obj, &cache)); + *ds = std::make_shared(dataset_dir, usage, compat, sampler, cache); + (void)(*ds)->SetNumWorkers(json_obj["num_parallel_workers"]); + (void)(*ds)->SetConnectorQueueSize(json_obj["connector_queue_size"]); + return Status::OK(); +} +#endif +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h index f291b17eec6d3c45cfe664880d3458884a44a86f..ad56640e8cd25a80633f85eb9cc6c1173b692505 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h @@ -1,109 +1,109 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_QMNIST_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_QMNIST_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -class QMnistNode : public MappableSourceNode { - public: - /// \brief Constructor. - QMnistNode(const std::string &dataset_dir, const std::string &usage, bool compat, std::shared_ptr sampler, - std::shared_ptr cache); - - /// \brief Destructor. - ~QMnistNode() override = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kQMnistNode; } - - /// \brief Print the description. - /// \param out - The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief a base class override function to create the required runtime dataset op objects for this class. - /// \param node_ops - A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard id. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size the size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - - /// \brief Getter functions. - const std::string &Usage() const { return usage_; } - - /// \brief Getter functions. - const bool Compat() const { return compat_; } - - /// \brief Get the arguments of node. - /// \param[out] out_json JSON string of all attributes. - /// \return Status of the function. - Status to_json(nlohmann::json *out_json) override; - -#ifndef ENABLE_ANDROID - /// \brief Function to read dataset in json - /// \param[in] json_obj The JSON object to be deserialized - /// \param[out] ds Deserialized dataset - /// \return Status The status code returned - static Status from_json(nlohmann::json json_obj, std::shared_ptr *ds); -#endif - - /// \brief Sampler getter. - /// \return SamplerObj of the current node. - std::shared_ptr Sampler() override { return sampler_; } - - /// \brief Sampler setter. - void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } - - private: - std::string dataset_dir_; - std::string usage_; - bool compat_; - std::shared_ptr sampler_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_QMNIST_NODE_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_QMNIST_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_QMNIST_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +class QMnistNode : public MappableSourceNode { + public: + /// \brief Constructor. + QMnistNode(const std::string &dataset_dir, const std::string &usage, bool compat, std::shared_ptr sampler, + std::shared_ptr cache); + + /// \brief Destructor. + ~QMnistNode() override = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kQMnistNode; } + + /// \brief Print the description. + /// \param out - The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief a base class override function to create the required runtime dataset op objects for this class. + /// \param node_ops - A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard id. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size the size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + + /// \brief Getter functions. + const std::string &Usage() const { return usage_; } + + /// \brief Getter functions. + const bool Compat() const { return compat_; } + + /// \brief Get the arguments of node. + /// \param[out] out_json JSON string of all attributes. + /// \return Status of the function. + Status to_json(nlohmann::json *out_json) override; + +#ifndef ENABLE_ANDROID + /// \brief Function to read dataset in json + /// \param[in] json_obj The JSON object to be deserialized + /// \param[out] ds Deserialized dataset + /// \return Status The status code returned + static Status from_json(nlohmann::json json_obj, std::shared_ptr *ds); +#endif + + /// \brief Sampler getter. + /// \return SamplerObj of the current node. + std::shared_ptr Sampler() override { return sampler_; } + + /// \brief Sampler setter. + void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } + + private: + std::string dataset_dir_; + std::string usage_; + bool compat_; + std::shared_ptr sampler_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_QMNIST_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/random_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/random_node.cc index 94120588d652aeb7007aead81132637aa716e5a0..e9d117a9af7b6449823e0035a776daed653ccff1 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/random_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/random_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { std::shared_ptr RandomNode::Copy() { std::shared_ptr node; @@ -148,4 +148,4 @@ Status RandomNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/random_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/random_node.h index 7ccdec94ee8f9056a7718534e060482506edb2b5..c2e348e9a5e3c7564f62ec23d2b5b75518f1d67d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/random_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/random_node.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" #include "mindspore-lite/minddata/dataset/include/dataset/samplers.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomNode : public NonMappableSourceNode { public: @@ -137,5 +137,5 @@ class RandomNode : public NonMappableSourceNode { std::unique_ptr data_schema_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_RANDOM_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/rendered_sst2_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/rendered_sst2_node.cc index 8fb04d3e5ea00c35923b9f0466d17e6f3fe9ac0c..801efc61bec77c68d9b1b67e114013dd0726036a 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/rendered_sst2_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/rendered_sst2_node.cc @@ -28,7 +28,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const std::set kExts = {".png"}; @@ -146,4 +146,4 @@ Status RenderedSST2Node::from_json(nlohmann::json json_obj, std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_RENDERED_SST2_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.cc index 9db6e5a5edafc6381d450b482bd65ed9cd3fe1d8..a7fed0fecbcf6c1cf9c157a5533d3407d0f417d2 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.cc @@ -28,7 +28,7 @@ #include "minddata/mindrecord/include/shard_shuffle.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor DistributedSamplerObj::DistributedSamplerObj(int64_t num_shards, int64_t shard_id, dataset::ShuffleMode shuffle_mode, @@ -154,4 +154,4 @@ std::shared_ptr DistributedSamplerObj::SamplerCopy() { int64_t DistributedSamplerObj::ShardId() { return shard_id_; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.h index 4242acc85c0dcae1a6cf2ea20876a39606310cca..0e8589998753bc5448690531294d4e2098269fd9 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.h @@ -27,7 +27,7 @@ #include "minddata/mindrecord/include/shard_operator.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -77,5 +77,5 @@ class DistributedSamplerObj : public SamplerObj { bool even_dist_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_DISTRIBUTED_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.cc index 35b4f518a6a82c318a1f4ff00018a7fcdca0b192..e18351201f2098b0985139b2e73809f3b5c39089 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.cc @@ -30,7 +30,7 @@ #include "minddata/mindrecord/include/shard_shuffle.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor PKSamplerObj::PKSamplerObj(int64_t num_val, bool shuffle, int64_t num_samples) @@ -109,4 +109,4 @@ std::shared_ptr PKSamplerObj::SamplerCopy() { return sampler; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.h index 9f2ac5f7a7704e9e22adbc9c523a5aa052ab9bd2..8a73f90126fc41a0944dcc28b180f36440bf4745 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.h @@ -27,7 +27,7 @@ #include "minddata/mindrecord/include/shard_operator.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -68,5 +68,5 @@ class PKSamplerObj : public SamplerObj { int64_t num_samples_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_PK_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.cc index cfe8b66b0ebe35780f3abb94a0e7400c66051589..51f1c0d988c1483c9670d4622051826f05bd60d4 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.cc @@ -30,7 +30,7 @@ #include "minddata/mindrecord/include/shard_shuffle.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor PreBuiltSamplerObj::PreBuiltSamplerObj(std::shared_ptr sampler) : sp_(std::move(sampler)) {} @@ -87,4 +87,4 @@ Status PreBuiltSamplerObj::to_json(nlohmann::json *const out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.h index 6d1ddce7e57d8c914e44d8225446d64af600af39..4ede3d87fdf6a73747a0f52ac43294a626967c15 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.h @@ -26,7 +26,7 @@ #include "minddata/mindrecord/include/shard_operator.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -60,5 +60,5 @@ class PreBuiltSamplerObj : public SamplerObj { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_PREBUILT_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.cc index 84905d190ea0dab2b9a537928ed9d3b382b3257a..fb09dd3dcba09701da9707f74691219f1c849590 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.cc @@ -28,7 +28,7 @@ #include "minddata/mindrecord/include/shard_shuffle.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor RandomSamplerObj::RandomSamplerObj(bool replacement, int64_t num_samples, bool reshuffle_each_epoch, @@ -103,4 +103,4 @@ std::shared_ptr RandomSamplerObj::SamplerCopy() { return sampler; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.h index b7b9b65f003ca4788449465f19123ee0fdb061dd..e8a0aeac67daba58c57df4fd858f7c2c24602dce 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.h @@ -27,7 +27,7 @@ #include "minddata/mindrecord/include/shard_operator.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -70,5 +70,5 @@ class RandomSamplerObj : public SamplerObj { dataset::ShuffleMode shuffle_mode_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_RANDOM_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.cc index 18b34e03e883f5e6ddf6a855ce77d9b2de7dcf1a..3ecac7d9fb36ea7e65681bc3cb3500f7b37ac64c 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/core/config_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor @@ -87,4 +87,4 @@ Status SamplerObj::from_json(nlohmann::json json_obj, std::shared_ptr> children_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SAMPLERS_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.cc index fd5a0311742ef3861df8636dc24fbec968ba1753..620e0a786ab2967e3fa9a8a19e5dda74e3c38afd 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.cc @@ -28,7 +28,7 @@ #include "minddata/mindrecord/include/shard_shuffle.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor SequentialSamplerObj::SequentialSamplerObj(int64_t start_index, int64_t num_samples) @@ -101,4 +101,4 @@ std::shared_ptr SequentialSamplerObj::SamplerCopy() { return sampler; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h index 00928f04bf69293f9f77331641c5f34b34530c23..68b9f476f091857e7b3fc6edd67a7f4ea50d8662 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h @@ -27,7 +27,7 @@ #include "minddata/mindrecord/include/shard_operator.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -67,5 +67,5 @@ class SequentialSamplerObj : public SamplerObj { int64_t num_samples_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SEQUENTIAL_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.cc index af3535f7ca689cc84d3de00d0d641c790c901a42..3dcbb956fb3fdccc34e9ec6ed462724226a93bba 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sampler/skip_first_epoch_sampler.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor SkipFirstEpochSamplerObj::SkipFirstEpochSamplerObj(int64_t start_index) : SequentialSamplerObj(start_index, 0) {} @@ -65,4 +65,4 @@ std::shared_ptr SkipFirstEpochSamplerObj::SamplerCopy() { return sampler; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.h index ddc4949ea45390f97f760ca35b3e8d1869392383..19d484037de5ba2608752a2abfc6659bc1bfd57a 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h" #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -52,5 +52,5 @@ class SkipFirstEpochSamplerObj : public SequentialSamplerObj { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SKIP_FIRST_EPOCH_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.cc index 88b4e1c1cf18a862674cc8885e429c6fb647fb13..062caa9c8ad1e698d944e345aa555e95db7700f2 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.cc @@ -30,7 +30,7 @@ #include "minddata/mindrecord/include/shard_shuffle.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor SubsetRandomSamplerObj::SubsetRandomSamplerObj(std::vector indices, int64_t num_samples) @@ -89,4 +89,4 @@ std::shared_ptr SubsetRandomSamplerObj::SamplerCopy() { return sampler; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.h index 87605dc9d2407f71aa155fd611ccf9fd0a238fec..f3fe345628c3fb850ab947e78f9135b0f3074571 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.h @@ -29,7 +29,7 @@ #include "minddata/mindrecord/include/shard_operator.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -57,5 +57,5 @@ class SubsetRandomSamplerObj : public SubsetSamplerObj { private: }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SUBSET_RANDOM_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.cc index c35a938368eb70d71f2c1e7253ebd3352a1d80ba..ae5d40779d260ca0e74db3ab298140c87d4d3121 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.cc @@ -30,7 +30,7 @@ #include "minddata/mindrecord/include/shard_shuffle.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor SubsetSamplerObj::SubsetSamplerObj(std::vector indices, int64_t num_samples) @@ -96,4 +96,4 @@ std::shared_ptr SubsetSamplerObj::SamplerCopy() { return sampler; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h index b3dfd18ec4700a9fe8fc97f6e65b6d53f71abd22..e91ecc87759a418b1f4db756d862c0fd3153289d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h @@ -28,7 +28,7 @@ #include "minddata/mindrecord/include/shard_operator.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -68,5 +68,5 @@ class SubsetSamplerObj : public SamplerObj { int64_t num_samples_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SUBSET_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.cc index 8e9fe9b4ff42b288ae3c30424f2c68ef776ae54d..2d18589a9983fa663228ed66b6a77d3721a0902d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/core/config_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor WeightedRandomSamplerObj::WeightedRandomSamplerObj(std::vector weights, int64_t num_samples, bool replacement) @@ -99,4 +99,4 @@ std::shared_ptr WeightedRandomSamplerObj::SamplerCopy() { return sampler; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h index 837e069a3976c0537dd66baabf27d3655b6c2d78..270ef5969373f8d736d18a9749dc72f54887a6f4 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h @@ -28,7 +28,7 @@ #include "minddata/mindrecord/include/shard_operator.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Internal Sampler class forward declaration class SamplerRT; @@ -65,5 +65,5 @@ class WeightedRandomSamplerObj : public SamplerObj { bool replacement_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_WEIGHTED_RANDOM_SAMPLER_IR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.cc index 48e53c882e758c7d6eaa0a663ea835a9619c3bf6..f1634d87d623a3647b2b1ff9bfd4a4a3a218bbb5 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.cc @@ -1,125 +1,125 @@ -/** - * Copyright 2021-2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.h" - -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.h" -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -SBUNode::SBUNode(const std::string &dataset_dir, bool decode, const std::shared_ptr &sampler, - const std::shared_ptr &cache) - : MappableSourceNode(std::move(cache)), dataset_dir_(dataset_dir), decode_(decode), sampler_(sampler) {} - -std::shared_ptr SBUNode::Copy() { - std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); - auto node = std::make_shared(dataset_dir_, decode_, sampler, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -void SBUNode::Print(std::ostream &out) const { - out << (Name() + "(dataset dir: " + dataset_dir_ + ", decode: " + (decode_ ? "true" : "false") + - ", cache: " + ((cache_ != nullptr) ? "true" : "false") + ")"); -} - -Status SBUNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("SBUDataset", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateDatasetSampler("SBUDataset", sampler_)); - - Path root_dir(dataset_dir_); - - Path url_path = root_dir / Path("SBU_captioned_photo_dataset_urls.txt"); - Path caption_path = root_dir / Path("SBU_captioned_photo_dataset_captions.txt"); - Path image_path = root_dir / Path("sbu_images"); - - RETURN_IF_NOT_OK(ValidateDatasetFilesParam("SBUDataset", {url_path.ToString()}, "url file")); - RETURN_IF_NOT_OK(ValidateDatasetFilesParam("SBUDataset", {caption_path.ToString()}, "caption file")); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("SBUDataset", {image_path.ToString()})); - - return Status::OK(); -} - -Status SBUNode::Build(std::vector> *const node_ops) { - // Do internal Schema generation. - auto schema = std::make_unique(); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("image", DataType(DataType::DE_UINT8), TensorImpl::kFlexible, 1))); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("caption", DataType(DataType::DE_UINT8), TensorImpl::kFlexible, 1))); - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - - auto op = std::make_shared(dataset_dir_, decode_, std::move(schema), std::move(sampler_rt), num_workers_, - connector_que_size_); - op->SetTotalRepeats(GetTotalRepeats()); - op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(op); - - return Status::OK(); -} - -// Get the shard id of node -Status SBUNode::GetShardId(int32_t *shard_id) { - *shard_id = sampler_->ShardId(); - - return Status::OK(); -} - -// Get Dataset size -Status SBUNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - int64_t num_rows, sample_size; - RETURN_IF_NOT_OK(SBUOp::CountTotalRows(dataset_dir_, &num_rows)); - std::shared_ptr sampler_rt = nullptr; - RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - sample_size = sampler_rt->CalculateNumSamples(num_rows); - if (sample_size == -1) { - RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); - } - *dataset_size = sample_size; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status SBUNode::to_json(nlohmann::json *out_json) { - nlohmann::json args, sampler_args; - RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); - args["sampler"] = sampler_args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["decode"] = decode_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.h" + +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sbu_op.h" +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +SBUNode::SBUNode(const std::string &dataset_dir, bool decode, const std::shared_ptr &sampler, + const std::shared_ptr &cache) + : MappableSourceNode(std::move(cache)), dataset_dir_(dataset_dir), decode_(decode), sampler_(sampler) {} + +std::shared_ptr SBUNode::Copy() { + std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); + auto node = std::make_shared(dataset_dir_, decode_, sampler, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +void SBUNode::Print(std::ostream &out) const { + out << (Name() + "(dataset dir: " + dataset_dir_ + ", decode: " + (decode_ ? "true" : "false") + + ", cache: " + ((cache_ != nullptr) ? "true" : "false") + ")"); +} + +Status SBUNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("SBUDataset", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateDatasetSampler("SBUDataset", sampler_)); + + Path root_dir(dataset_dir_); + + Path url_path = root_dir / Path("SBU_captioned_photo_dataset_urls.txt"); + Path caption_path = root_dir / Path("SBU_captioned_photo_dataset_captions.txt"); + Path image_path = root_dir / Path("sbu_images"); + + RETURN_IF_NOT_OK(ValidateDatasetFilesParam("SBUDataset", {url_path.ToString()}, "url file")); + RETURN_IF_NOT_OK(ValidateDatasetFilesParam("SBUDataset", {caption_path.ToString()}, "caption file")); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("SBUDataset", {image_path.ToString()})); + + return Status::OK(); +} + +Status SBUNode::Build(std::vector> *const node_ops) { + // Do internal Schema generation. + auto schema = std::make_unique(); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("image", DataType(DataType::DE_UINT8), TensorImpl::kFlexible, 1))); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("caption", DataType(DataType::DE_UINT8), TensorImpl::kFlexible, 1))); + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + + auto op = std::make_shared(dataset_dir_, decode_, std::move(schema), std::move(sampler_rt), num_workers_, + connector_que_size_); + op->SetTotalRepeats(GetTotalRepeats()); + op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(op); + + return Status::OK(); +} + +// Get the shard id of node +Status SBUNode::GetShardId(int32_t *shard_id) { + *shard_id = sampler_->ShardId(); + + return Status::OK(); +} + +// Get Dataset size +Status SBUNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + int64_t num_rows, sample_size; + RETURN_IF_NOT_OK(SBUOp::CountTotalRows(dataset_dir_, &num_rows)); + std::shared_ptr sampler_rt = nullptr; + RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); + sample_size = sampler_rt->CalculateNumSamples(num_rows); + if (sample_size == -1) { + RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); + } + *dataset_size = sample_size; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status SBUNode::to_json(nlohmann::json *out_json) { + nlohmann::json args, sampler_args; + RETURN_IF_NOT_OK(sampler_->to_json(&sampler_args)); + args["sampler"] = sampler_args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["decode"] = decode_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.h index 68e9fcdd6972355cec55e0f1076ce0019f76e8da..0d4d5e1d7838cbc0366b2d4cbb090f25bae7b99e 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sbu_node.h @@ -1,95 +1,95 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SBU_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SBU_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -class SBUNode : public MappableSourceNode { - public: - /// \brief Constructor. - SBUNode(const std::string &dataset_dir, bool decode, const std::shared_ptr &sampler, - const std::shared_ptr &cache); - - /// \brief Destructor. - ~SBUNode() override = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kSBUNode; } - - /// \brief Print the description. - /// \param out - The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief a base class override function to create the required runtime dataset op objects for this class. - /// \param node_ops - A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard id. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size the size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - bool Decode() const { return decode_; } - - /// \brief Get the arguments of node. - /// \param[out] out_json JSON string of all attributes. - /// \return Status of the function. - Status to_json(nlohmann::json *out_json) override; - - /// \brief Sampler getter. - /// \return SamplerObj of the current node. - std::shared_ptr Sampler() override { return sampler_; } - - /// \brief Sampler setter. - void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } - - private: - std::string dataset_dir_; - bool decode_; - std::shared_ptr sampler_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SBU_NODE_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SBU_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SBU_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +class SBUNode : public MappableSourceNode { + public: + /// \brief Constructor. + SBUNode(const std::string &dataset_dir, bool decode, const std::shared_ptr &sampler, + const std::shared_ptr &cache); + + /// \brief Destructor. + ~SBUNode() override = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kSBUNode; } + + /// \brief Print the description. + /// \param out - The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief a base class override function to create the required runtime dataset op objects for this class. + /// \param node_ops - A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard id. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size the size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + bool Decode() const { return decode_; } + + /// \brief Get the arguments of node. + /// \param[out] out_json JSON string of all attributes. + /// \return Status of the function. + Status to_json(nlohmann::json *out_json) override; + + /// \brief Sampler getter. + /// \return SamplerObj of the current node. + std::shared_ptr Sampler() override { return sampler_; } + + /// \brief Sampler setter. + void SetSampler(std::shared_ptr sampler) override { sampler_ = sampler; } + + private: + std::string dataset_dir_; + bool decode_; + std::shared_ptr sampler_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SBU_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/semeion_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/semeion_node.cc index d5c1ffd537379a8e36c02db44928737414d46744..cb623e8204e4ea320527db4a459a36f1d1802f14 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/semeion_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/semeion_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/semeion_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for SemeionNode. SemeionNode::SemeionNode(const std::string &dataset_dir, const std::shared_ptr &sampler, @@ -110,4 +110,4 @@ Status SemeionNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/semeion_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/semeion_node.h index 1a7de56f0decf29d45e44e8d3a9c988286d6eb18..5a4598aea4f5c46ea4d4ef0aec78659456dabd07 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/semeion_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/semeion_node.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SemeionNode : public MappableSourceNode { public: @@ -90,5 +90,5 @@ class SemeionNode : public MappableSourceNode { std::shared_ptr sampler_; }; // class SemeionNode } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SEMEION_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.cc index 5f7eb7ba02b595098ff5a9d0e84468757ec53da9..7b2b160cfe0fba1bb3214edc740bd24ee31f9fa4 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.cc @@ -1,196 +1,196 @@ -/** - * Copyright 2021-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h" - -#include -#include - -#include "mindspore-lite/minddata/dataset/util/path.h" -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -SogouNewsNode::SogouNewsNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, - ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, - const std::shared_ptr &cache) - : NonMappableSourceNode(std::move(cache)), - dataset_dir_(dataset_dir), - num_samples_(num_samples), - shuffle_(shuffle), - num_shards_(num_shards), - shard_id_(shard_id), - usage_(usage), - sogou_news_files_list_(WalkAllFiles(usage, dataset_dir)) { - // Update the num_shards_ in global context. this number is only used for now by auto_num_worker_pass. - // User discretion is advised. Auto_num_worker_pass is currently an experimental feature which can still work - // if the num_shards_ isn't 100% correct. The reason behind is for now, PreBuildSampler doesn't offer a way to - // return num_shards. Once PreBuildSampler is phased out, this can be cleaned up. - GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); -} - -std::shared_ptr SogouNewsNode::Copy() { - auto node = - std::make_shared(dataset_dir_, usage_, num_samples_, shuffle_, num_shards_, shard_id_, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -void SogouNewsNode::Print(std::ostream &out) const { - out << (Name() + "(cache: " + ((cache_ != nullptr) ? "true" : "false") + - ", num_shards: " + std::to_string(num_shards_) + ", shard_id: " + std::to_string(shard_id_) + ")"); -} - -Status SogouNewsNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("SogouNewsNode", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateStringValue("SogouNewsNode", usage_, {"train", "test", "all"})); - RETURN_IF_NOT_OK(ValidateEnum("SogouNewsNode", "ShuffleMode", shuffle_, - {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); - if (num_samples_ < 0) { - std::string err_msg = "SogouNewsNode: Invalid number of samples: " + std::to_string(num_samples_); - MS_LOG(ERROR) << err_msg; - LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); - } - - RETURN_IF_NOT_OK(ValidateDatasetShardParams("SogouNewsNode", num_shards_, shard_id_)); - return Status::OK(); -} - -Status SogouNewsNode::Build(std::vector> *const node_ops) { - bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); - - // Sort the dataset files in a lexicographical order. - std::vector sorted_dataset_files = sogou_news_files_list_; - std::sort(sorted_dataset_files.begin(), sorted_dataset_files.end()); - - std::vector> column_default; - column_default.push_back(std::make_shared>(SogouNewsOp::STRING, "")); - column_default.push_back(std::make_shared>(SogouNewsOp::STRING, "")); - column_default.push_back(std::make_shared>(SogouNewsOp::STRING, "")); - - std::vector column_name = {"index", "title", "content"}; - char field_delim = ','; - auto sogou_news_op = std::make_shared(num_workers_, num_samples_, worker_connector_size_, - connector_que_size_, shuffle_files, num_shards_, shard_id_, - field_delim, column_default, column_name, sogou_news_files_list_); - - RETURN_IF_NOT_OK(sogou_news_op->Init()); - - // If a global shuffle is used for SogouNews, it will inject a shuffle op over the SogouNews. - // But, if there is a cache in the tree, we do not need the global shuffle and the shuffle op should not be - // built.This is achieved in the cache transform pass where we call MakeSimpleProducer to reset SogouNews - // shuffle option to false. - if (shuffle_ == ShuffleMode::kGlobal) { - // Inject ShuffleOp. - std::shared_ptr shuffle_op = nullptr; - int64_t num_rows = 0; - - // First, get the number of rows in the dataset. - RETURN_IF_NOT_OK(SogouNewsOp::CountAllFileRows(sogou_news_files_list_, false, &num_rows)); - // Add the shuffle op after this op. - RETURN_IF_NOT_OK( - AddShuffleOp(sorted_dataset_files.size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); - shuffle_op->SetTotalRepeats(GetTotalRepeats()); - shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - shuffle_op->Skip(skip_steps_); - node_ops->push_back(shuffle_op); - } - sogou_news_op->SetTotalRepeats(GetTotalRepeats()); - sogou_news_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(sogou_news_op); - return Status::OK(); -} - -Status SogouNewsNode::GetShardId(int32_t *shard_id) { - *shard_id = shard_id_; - return Status::OK(); -} - -Status SogouNewsNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - - int64_t num_rows, sample_size; - RETURN_IF_NOT_OK(SogouNewsOp::CountAllFileRows(sogou_news_files_list_, false, &num_rows)); - sample_size = num_samples_; - num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); - *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status SogouNewsNode::to_json(nlohmann::json *out_json) { - nlohmann::json args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["usage"] = usage_; - args["num_samples"] = num_samples_; - args["shuffle"] = shuffle_; - args["num_shards"] = num_shards_; - args["shard_id"] = shard_id_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} - -Status SogouNewsNode::SetupSamplerForCache(std::shared_ptr *sampler) { - *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); - return Status::OK(); -} - -Status SogouNewsNode::MakeSimpleProducer() { - shard_id_ = 0; - num_shards_ = 1; - shuffle_ = ShuffleMode::kFalse; - num_samples_ = 0; - return Status::OK(); -} - -std::vector SogouNewsNode::WalkAllFiles(const std::string &usage, const std::string &dataset_dir) { - std::vector sogou_news_files_list; - Path train_prefix("train.csv"); - Path test_prefix("test.csv"); - Path dir(dataset_dir); - - if (usage == "train") { - Path temp_path = dir / train_prefix; - sogou_news_files_list.push_back(temp_path.ToString()); - } else if (usage == "test") { - Path temp_path = dir / test_prefix; - sogou_news_files_list.push_back(temp_path.ToString()); - } else { - Path temp_path = dir / train_prefix; - if (temp_path.Exists()) { - sogou_news_files_list.push_back(temp_path.ToString()); - } - Path temp_path1 = dir / test_prefix; - if (temp_path1.Exists()) { - sogou_news_files_list.push_back(temp_path1.ToString()); - } - } - return sogou_news_files_list; -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h" + +#include +#include + +#include "mindspore-lite/minddata/dataset/util/path.h" +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +SogouNewsNode::SogouNewsNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, + ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, + const std::shared_ptr &cache) + : NonMappableSourceNode(std::move(cache)), + dataset_dir_(dataset_dir), + num_samples_(num_samples), + shuffle_(shuffle), + num_shards_(num_shards), + shard_id_(shard_id), + usage_(usage), + sogou_news_files_list_(WalkAllFiles(usage, dataset_dir)) { + // Update the num_shards_ in global context. this number is only used for now by auto_num_worker_pass. + // User discretion is advised. Auto_num_worker_pass is currently an experimental feature which can still work + // if the num_shards_ isn't 100% correct. The reason behind is for now, PreBuildSampler doesn't offer a way to + // return num_shards. Once PreBuildSampler is phased out, this can be cleaned up. + GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); +} + +std::shared_ptr SogouNewsNode::Copy() { + auto node = + std::make_shared(dataset_dir_, usage_, num_samples_, shuffle_, num_shards_, shard_id_, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +void SogouNewsNode::Print(std::ostream &out) const { + out << (Name() + "(cache: " + ((cache_ != nullptr) ? "true" : "false") + + ", num_shards: " + std::to_string(num_shards_) + ", shard_id: " + std::to_string(shard_id_) + ")"); +} + +Status SogouNewsNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("SogouNewsNode", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateStringValue("SogouNewsNode", usage_, {"train", "test", "all"})); + RETURN_IF_NOT_OK(ValidateEnum("SogouNewsNode", "ShuffleMode", shuffle_, + {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); + if (num_samples_ < 0) { + std::string err_msg = "SogouNewsNode: Invalid number of samples: " + std::to_string(num_samples_); + MS_LOG(ERROR) << err_msg; + LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); + } + + RETURN_IF_NOT_OK(ValidateDatasetShardParams("SogouNewsNode", num_shards_, shard_id_)); + return Status::OK(); +} + +Status SogouNewsNode::Build(std::vector> *const node_ops) { + bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); + + // Sort the dataset files in a lexicographical order. + std::vector sorted_dataset_files = sogou_news_files_list_; + std::sort(sorted_dataset_files.begin(), sorted_dataset_files.end()); + + std::vector> column_default; + column_default.push_back(std::make_shared>(SogouNewsOp::STRING, "")); + column_default.push_back(std::make_shared>(SogouNewsOp::STRING, "")); + column_default.push_back(std::make_shared>(SogouNewsOp::STRING, "")); + + std::vector column_name = {"index", "title", "content"}; + char field_delim = ','; + auto sogou_news_op = std::make_shared(num_workers_, num_samples_, worker_connector_size_, + connector_que_size_, shuffle_files, num_shards_, shard_id_, + field_delim, column_default, column_name, sogou_news_files_list_); + + RETURN_IF_NOT_OK(sogou_news_op->Init()); + + // If a global shuffle is used for SogouNews, it will inject a shuffle op over the SogouNews. + // But, if there is a cache in the tree, we do not need the global shuffle and the shuffle op should not be + // built.This is achieved in the cache transform pass where we call MakeSimpleProducer to reset SogouNews + // shuffle option to false. + if (shuffle_ == ShuffleMode::kGlobal) { + // Inject ShuffleOp. + std::shared_ptr shuffle_op = nullptr; + int64_t num_rows = 0; + + // First, get the number of rows in the dataset. + RETURN_IF_NOT_OK(SogouNewsOp::CountAllFileRows(sogou_news_files_list_, false, &num_rows)); + // Add the shuffle op after this op. + RETURN_IF_NOT_OK( + AddShuffleOp(sorted_dataset_files.size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); + shuffle_op->SetTotalRepeats(GetTotalRepeats()); + shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + shuffle_op->Skip(skip_steps_); + node_ops->push_back(shuffle_op); + } + sogou_news_op->SetTotalRepeats(GetTotalRepeats()); + sogou_news_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(sogou_news_op); + return Status::OK(); +} + +Status SogouNewsNode::GetShardId(int32_t *shard_id) { + *shard_id = shard_id_; + return Status::OK(); +} + +Status SogouNewsNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + + int64_t num_rows, sample_size; + RETURN_IF_NOT_OK(SogouNewsOp::CountAllFileRows(sogou_news_files_list_, false, &num_rows)); + sample_size = num_samples_; + num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); + *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status SogouNewsNode::to_json(nlohmann::json *out_json) { + nlohmann::json args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["usage"] = usage_; + args["num_samples"] = num_samples_; + args["shuffle"] = shuffle_; + args["num_shards"] = num_shards_; + args["shard_id"] = shard_id_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} + +Status SogouNewsNode::SetupSamplerForCache(std::shared_ptr *sampler) { + *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); + return Status::OK(); +} + +Status SogouNewsNode::MakeSimpleProducer() { + shard_id_ = 0; + num_shards_ = 1; + shuffle_ = ShuffleMode::kFalse; + num_samples_ = 0; + return Status::OK(); +} + +std::vector SogouNewsNode::WalkAllFiles(const std::string &usage, const std::string &dataset_dir) { + std::vector sogou_news_files_list; + Path train_prefix("train.csv"); + Path test_prefix("test.csv"); + Path dir(dataset_dir); + + if (usage == "train") { + Path temp_path = dir / train_prefix; + sogou_news_files_list.push_back(temp_path.ToString()); + } else if (usage == "test") { + Path temp_path = dir / test_prefix; + sogou_news_files_list.push_back(temp_path.ToString()); + } else { + Path temp_path = dir / train_prefix; + if (temp_path.Exists()) { + sogou_news_files_list.push_back(temp_path.ToString()); + } + Path temp_path1 = dir / test_prefix; + if (temp_path1.Exists()) { + sogou_news_files_list.push_back(temp_path1.ToString()); + } + } + return sogou_news_files_list; +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h index 99abfcd6f481699e42c228cdc49d8e5e606d18d1..7dcdc53ccf805bc237fd61f4db2179f801db5078 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h @@ -1,135 +1,135 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SOGOU_NEWS_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SOGOU_NEWS_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.h" -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -/// \class SogouNewsNode -/// \brief A Node derived class to represent SogouNews Node. -class SogouNewsNode : public NonMappableSourceNode { - public: - /// \brief Constructor of SogouNewsNode. - /// \param[in] dataset_dir Path to the root directory that contains the dataset. - /// \param[in] usage Part of dataset of SogouNews, can be "train", "test" or "all" data. - /// \param[in] num_samples The number of samples to be included in the dataset. - /// \param[in] shuffle The mode for shuffling data every epoch. - /// Can be any of: - /// ShuffleMode::kFalse - No shuffling is performed. - /// ShuffleMode::kFiles - Shuffle files only. - /// ShuffleMode::kGlobal - Shuffle both the files and samples. - /// \param[in] num_shards Number of shards that the dataset should be divided into. - /// \param[in] shard_id The shard ID within num_shards. This argument should be - /// specified only when num_shards is also specified. - /// \param[in] cache Tensor cache to use. - SogouNewsNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, - int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); - - /// \brief Destructor. - ~SogouNewsNode() override = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kSogouNewsNode; } - - /// \brief Print the description. - /// \param[out] out The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief A base class override function to create the required runtime dataset op objects for this class. - /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \param[in] shard_id The shard id. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting. - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size The size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - const std::string &Usage() const { return usage_; } - int64_t NumSamples() const { return num_samples_; } - ShuffleMode Shuffle() const { return shuffle_; } - int32_t NumShards() const { return num_shards_; } - int32_t ShardId() const { return shard_id_; } - - /// \brief Get the arguments of node. - /// \param[out] out_json JSON string of all attributes. - /// \return Status of the function. - Status to_json(nlohmann::json *out_json) override; - - /// \brief SogouNews by itself is a non-mappable dataset that does not support sampling. - /// However, if a cache operator is injected at some other place higher in the tree, that cache can - /// inherit this sampler from the leaf, providing sampling support from the caching layer. - /// That is why we setup the sampler for a leaf node that does not use sampling. - /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. - /// \param[in] sampler The sampler to setup. - /// \return Status of the function. - Status SetupSamplerForCache(std::shared_ptr *sampler) override; - - /// \brief If a cache has been added into the ascendant tree over this clue node, then the cache will be executing - /// a sampler for fetching the data. As such, any options in the clue node need to be reset to its defaults so. - /// that this clue node will produce the full set of data into the cache. - /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. - /// \return Status of the function. - Status MakeSimpleProducer() override; - - /// \brief Generate a list of read file names according to usage. - /// \param[in] usage Part of dataset of SogouNews. - /// \param[in] dataset_dir Path to the root directory that contains the dataset. - /// \return std::vector A list of read file names. - std::vector WalkAllFiles(const std::string &usage, const std::string &dataset_dir); - - private: - std::string dataset_dir_; - std::string usage_; - std::vector> column_defaults_; - std::vector column_names_; - int64_t num_samples_; - ShuffleMode shuffle_; - int32_t num_shards_; - int32_t shard_id_; - std::vector sogou_news_files_list_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SOGOU_NEWS_NODE_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SOGOU_NEWS_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SOGOU_NEWS_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/sogou_news_op.h" +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +/// \class SogouNewsNode +/// \brief A Node derived class to represent SogouNews Node. +class SogouNewsNode : public NonMappableSourceNode { + public: + /// \brief Constructor of SogouNewsNode. + /// \param[in] dataset_dir Path to the root directory that contains the dataset. + /// \param[in] usage Part of dataset of SogouNews, can be "train", "test" or "all" data. + /// \param[in] num_samples The number of samples to be included in the dataset. + /// \param[in] shuffle The mode for shuffling data every epoch. + /// Can be any of: + /// ShuffleMode::kFalse - No shuffling is performed. + /// ShuffleMode::kFiles - Shuffle files only. + /// ShuffleMode::kGlobal - Shuffle both the files and samples. + /// \param[in] num_shards Number of shards that the dataset should be divided into. + /// \param[in] shard_id The shard ID within num_shards. This argument should be + /// specified only when num_shards is also specified. + /// \param[in] cache Tensor cache to use. + SogouNewsNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, + int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); + + /// \brief Destructor. + ~SogouNewsNode() override = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kSogouNewsNode; } + + /// \brief Print the description. + /// \param[out] out The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief A base class override function to create the required runtime dataset op objects for this class. + /// \param node_ops A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \param[in] shard_id The shard id. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting. + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size The size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + const std::string &Usage() const { return usage_; } + int64_t NumSamples() const { return num_samples_; } + ShuffleMode Shuffle() const { return shuffle_; } + int32_t NumShards() const { return num_shards_; } + int32_t ShardId() const { return shard_id_; } + + /// \brief Get the arguments of node. + /// \param[out] out_json JSON string of all attributes. + /// \return Status of the function. + Status to_json(nlohmann::json *out_json) override; + + /// \brief SogouNews by itself is a non-mappable dataset that does not support sampling. + /// However, if a cache operator is injected at some other place higher in the tree, that cache can + /// inherit this sampler from the leaf, providing sampling support from the caching layer. + /// That is why we setup the sampler for a leaf node that does not use sampling. + /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. + /// \param[in] sampler The sampler to setup. + /// \return Status of the function. + Status SetupSamplerForCache(std::shared_ptr *sampler) override; + + /// \brief If a cache has been added into the ascendant tree over this clue node, then the cache will be executing + /// a sampler for fetching the data. As such, any options in the clue node need to be reset to its defaults so. + /// that this clue node will produce the full set of data into the cache. + /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. + /// \return Status of the function. + Status MakeSimpleProducer() override; + + /// \brief Generate a list of read file names according to usage. + /// \param[in] usage Part of dataset of SogouNews. + /// \param[in] dataset_dir Path to the root directory that contains the dataset. + /// \return std::vector A list of read file names. + std::vector WalkAllFiles(const std::string &usage, const std::string &dataset_dir); + + private: + std::string dataset_dir_; + std::string usage_; + std::vector> column_defaults_; + std::vector column_names_; + int64_t num_samples_; + ShuffleMode shuffle_; + int32_t num_shards_; + int32_t shard_id_; + std::vector sogou_news_files_list_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SOGOU_NEWS_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.cc index bec0ea59155c003be0db33e181fa2426e086d6d2..9890a8072655e5d0f6efedfe9ddb42c2ed3cffa7 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/speech_commands_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { SpeechCommandsNode::SpeechCommandsNode(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, std::shared_ptr cache) @@ -117,4 +117,4 @@ Status SpeechCommandsNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.h index ac40447a44de1fc37fad3aaeafc27906734fdca6..b3004f3ba6fc152f8dd2a9fc678eb6ec1ed1331e 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SpeechCommandsNode : public MappableSourceNode { public: @@ -93,5 +93,5 @@ class SpeechCommandsNode : public MappableSourceNode { std::shared_ptr sampler_; }; // class SpeechCommandsNode } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SPEECH_COMMANDS_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/squad_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/squad_node.cc index 12ea58bd8766a1241f57bb716d9659bc9b901477..02f5509e903285d16e469167da42de327d1122d5 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/squad_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/squad_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/squad_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for SQuADNode. SQuADNode::SQuADNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, @@ -173,4 +173,4 @@ Status SQuADNode::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/squad_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/squad_node.h index 0c4f5cc605d2411cc8ab66c6381ca386c8a814e7..819cd1034141ba17e752a2abd874e5f657335cbb 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/squad_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/squad_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class SQuADNode. /// \brief A Dataset derived class to represent SQuAD dataset. @@ -110,5 +110,5 @@ class SQuADNode : public NonMappableSourceNode { int32_t shard_id_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SQUAD_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sst2_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sst2_node.cc index 55ac8ae3dfb89d03db320d62f1cd891c30169057..a1b9a3778e160c01bf924c2fa5c32916566e9de4 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sst2_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sst2_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { SST2Node::SST2Node(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, std::shared_ptr cache) @@ -199,4 +199,4 @@ Status SST2Node::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sst2_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sst2_node.h index ea24d9f312cbfa46793677e6e535e3ec94ed0711..d84f2efec758b9c91505985730f402972beb3684 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sst2_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sst2_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sst2_op.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SST2Node : public NonMappableSourceNode { public: @@ -116,5 +116,5 @@ class SST2Node : public NonMappableSourceNode { int32_t shard_id_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SST2_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/stl10_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/stl10_node.cc index 8ad8bd7bc4927ac58b06e58f87cfde9398125bf3..05987b96f1d5fc60bc2fe4bcb2f113ac532d455e 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/stl10_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/stl10_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/stl10_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { STL10Node::STL10Node(const std::string &dataset_dir, const std::string &usage, std::shared_ptr sampler, std::shared_ptr cache) @@ -118,4 +118,4 @@ Status STL10Node::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/stl10_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/stl10_node.h index b0aaf8c9f6d85c280c1e24079417a3c215993a41..6040e2e00eea76731f61824a971501a0e970ce68 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/stl10_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/stl10_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class STL10Node : public MappableSourceNode { public: @@ -92,5 +92,5 @@ class STL10Node : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_STL10_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sun397_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sun397_node.cc index fc3e2a81371733349c7498792487080b32370fcd..2a40569acf93fcf9a5545304343f34f3663af394 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sun397_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sun397_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { SUN397Node::SUN397Node(const std::string &dataset_dir, bool decode, const std::shared_ptr &sampler, std::shared_ptr cache) @@ -111,4 +111,4 @@ Status SUN397Node::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sun397_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sun397_node.h index 76d80660ac7e0920ee02a1b9f5d3b915f24d60a2..97fac980c84954441d156ac408fea28e5d8e04c9 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sun397_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/sun397_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/sun397_op.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class SUN397Node. /// \brief A Dataset derived class to represent SUN397 dataset. @@ -99,5 +99,5 @@ class SUN397Node : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SUN397_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tedlium_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tedlium_node.cc index 94775a7ca57aa07aebc54b80e6cd39975f62184e..4e7395846fce19bdc0310c23988b21d0b315a9bb 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tedlium_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tedlium_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/tedlium_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for TedliumNode. TedliumNode::TedliumNode(const std::string &dataset_dir, const std::string &release, const std::string &usage, @@ -151,4 +151,4 @@ Status TedliumNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tedlium_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tedlium_node.h index 2d4622655cf83ebb59095e38efc31a21b973f6b7..83ec0ff408d7f9c68a2d17af206c4127c3474cfe 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tedlium_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tedlium_node.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TedliumNode : public MappableSourceNode { public: @@ -106,5 +106,5 @@ class TedliumNode : public MappableSourceNode { std::shared_ptr sampler_; }; // class TedliumNode } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_TEDLIUM_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/text_file_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/text_file_node.cc index 6dc87a797c50305677b05112bf71fd05864e802e..848ba05be029d92d596cb9ac204331372581f086 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/text_file_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/text_file_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/text_file_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for TextFileNode @@ -191,4 +191,4 @@ Status TextFileNode::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/text_file_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/text_file_node.h index 09ce9de18af56f781617f2b4bb4b079b933fb8ae..1648035ff8b3a037ebe75e5c75146cf745de2fb8 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/text_file_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/text_file_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class TextFileNode /// \brief A Dataset derived class to represent TextFile dataset @@ -112,5 +112,5 @@ class TextFileNode : public NonMappableSourceNode { ShuffleMode shuffle_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_TEXT_FILE_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tf_record_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tf_record_node.cc index f1d1c028e4f29a4a8652ba72e48fcbb015bf62c8..4c218a875319e4581713e491da20d383052e243d 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tf_record_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tf_record_node.cc @@ -25,7 +25,7 @@ #include "utils/file_utils.h" #include "utils/system/crc32c.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { std::unordered_set TFRecordNode::large_files_ = {}; const int64_t kTFRecordFileLimit = 0x140000000; @@ -420,4 +420,4 @@ Status TFRecordNode::AcceptAfter(IRNodePass *const p, bool *const modified) { return p->VisitAfter(shared_from_base(), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tf_record_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tf_record_node.h index 68008d8dbb418c265ca67cfa74c936640d7018bf..456282743cde1fc6104e04fffefc6dfda3f90f6a 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tf_record_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/tf_record_node.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/tf_reader_op.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class TFRecordNode /// \brief A Dataset derived class to represent TFRecord dataset @@ -204,5 +204,5 @@ class TFRecordNode : public NonMappableSourceNode { static std::unordered_set large_files_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_TF_RECORD_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/udpos_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/udpos_node.cc index 6fe42a84f139945ab3c72ed82e90813e08564907..1e0c042d73f5dc33978c4145314c46f7f411c072 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/udpos_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/udpos_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/udpos_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for UDPOSNode. UDPOSNode::UDPOSNode(const std::string &dataset_dir, const std::string &usage, int32_t num_samples, ShuffleMode shuffle, @@ -205,4 +205,4 @@ std::vector UDPOSNode::WalkAllFiles(const std::string &usage, const return udpos_files_list; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/udpos_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/udpos_node.h index 217790dad53892e04457a015efe2ef3a525a3e52..f5c8ef1e20e92f04ce9acdb16c91fedd8e80e4ff 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/udpos_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/udpos_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class UDPOSNode. /// \brief A Dataset derived class to represent UDPOS dataset. @@ -116,5 +116,5 @@ class UDPOSNode : public NonMappableSourceNode { std::vector udpos_files_list_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_UDPOS_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.cc index 5691fca5262e98141fda3cd3f41f93654fa6fdc0..60c06bd781ac37d8d48a982aa75a0226993165a0 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.cc @@ -1,170 +1,170 @@ -/** - * Copyright 2021-2022 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.h" - -#include -#include -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.h" -#include "mindspore-lite/minddata/dataset/util/status.h" - -namespace mindspore { -namespace dataset { -USPSNode::USPSNode(const std::string &dataset_dir, const std::string &usage, int32_t num_samples, ShuffleMode shuffle, - int32_t num_shards, int32_t shard_id, std::shared_ptr cache) - : NonMappableSourceNode(std::move(cache)), - dataset_dir_(dataset_dir), - usage_(usage), - num_samples_(num_samples), - shuffle_(shuffle), - num_shards_(num_shards), - shard_id_(shard_id) { - // Update the num_shards_ in global context. this number is only used for now by auto_num_worker_pass. User discretion - // is advised. Auto_num_worker_pass is currently an experimental feature which can still work if the num_shards_ isn't - // 100% correct. The reason behind is for now, PreBuildSampler doesn't offer a way to return num_shards. Once - // PreBuildSampler is phased out, this can be cleaned up. - GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); -} - -std::shared_ptr USPSNode::Copy() { - auto node = std::make_shared(dataset_dir_, usage_, num_samples_, shuffle_, num_shards_, shard_id_, cache_); - (void)node->SetNumWorkers(num_workers_); - (void)node->SetConnectorQueueSize(connector_que_size_); - return node; -} - -void USPSNode::Print(std::ostream &out) const { - out << (Name() + "(dataset dir:" + dataset_dir_ + ", usage:" + usage_ + - ", num_shards:" + std::to_string(num_shards_) + ", shard_id:" + std::to_string(shard_id_) + - ", num_samples:" + std::to_string(num_samples_) + ")"); -} - -Status USPSNode::ValidateParams() { - RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); - RETURN_IF_NOT_OK(ValidateDatasetDirParam("USPSDataset", dataset_dir_)); - RETURN_IF_NOT_OK(ValidateStringValue("USPSDataset", usage_, {"train", "test", "all"})); - RETURN_IF_NOT_OK(ValidateScalar("USPSDataset", "num_samples", num_samples_, {0}, false)); - RETURN_IF_NOT_OK(ValidateDatasetShardParams("USPSDataset", num_shards_, shard_id_)); - RETURN_IF_NOT_OK(ValidateEnum("USPSDataset", "ShuffleMode", shuffle_, - {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); - return Status::OK(); -} - -Status USPSNode::Build(std::vector> *const node_ops) { - bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); - - // Do internal Schema generation. - auto schema = std::make_unique(); - RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("image", DataType(DataType::DE_UINT8), TensorImpl::kCv, 1))); - TensorShape scalar = TensorShape::CreateScalar(); - RETURN_IF_NOT_OK( - schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar))); - - auto op = std::make_shared(dataset_dir_, usage_, std::move(schema), num_workers_, worker_connector_size_, - num_samples_, connector_que_size_, shuffle_files, num_shards_, shard_id_); - RETURN_IF_NOT_OK(op->Init()); - - // If a global shuffle is used for USPS, it will inject a shuffle op over the USPS. - // But, if there is a cache in the tree, we do not need the global shuffle and the shuffle op should not be built. - // This is achieved in the cache transform pass where we call MakeSimpleProducer to reset USPS's shuffle - // option to false. - if (shuffle_ == ShuffleMode::kGlobal) { - // Inject ShuffleOp - std::shared_ptr shuffle_op = nullptr; - int64_t num_rows = 0; - - // First, get the number of rows in the dataset - RETURN_IF_NOT_OK(USPSOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); - - // Add the shuffle op after this op - RETURN_IF_NOT_OK(AddShuffleOp(op->FileNames().size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); - shuffle_op->SetTotalRepeats(GetTotalRepeats()); - shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - shuffle_op->Skip(skip_steps_); - node_ops->push_back(shuffle_op); - } - op->SetTotalRepeats(GetTotalRepeats()); - op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); - node_ops->push_back(op); - return Status::OK(); -} - -// Get the shard id of node -Status USPSNode::GetShardId(int32_t *shard_id) { - *shard_id = shard_id_; - return Status::OK(); -} - -// Get Dataset size -Status USPSNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) { - if (dataset_size_ > 0) { - *dataset_size = dataset_size_; - return Status::OK(); - } - int64_t num_rows, sample_size = num_samples_; - RETURN_IF_NOT_OK(USPSOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); - num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); - *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; - dataset_size_ = *dataset_size; - return Status::OK(); -} - -Status USPSNode::to_json(nlohmann::json *out_json) { - nlohmann::json args; - args["num_parallel_workers"] = num_workers_; - args["connector_queue_size"] = connector_que_size_; - args["dataset_dir"] = dataset_dir_; - args["usage"] = usage_; - args["num_samples"] = num_samples_; - args["shuffle"] = shuffle_; - args["num_shards"] = num_shards_; - args["shard_id"] = shard_id_; - if (cache_ != nullptr) { - nlohmann::json cache_args; - RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); - args["cache"] = cache_args; - } - *out_json = args; - return Status::OK(); -} - -// Note: The following two functions are common among NonMappableSourceNode and should be promoted to its parent class. -// USPS by itself is a non-mappable dataset that does not support sampling. -// However, if a cache operator is injected at some other place higher in the tree, that cache can -// inherit this sampler from the leaf, providing sampling support from the caching layer. -// That is why we setup the sampler for a leaf node that does not use sampling. -Status USPSNode::SetupSamplerForCache(std::shared_ptr *sampler) { - *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); - return Status::OK(); -} - -// If a cache has been added into the ascendant tree over this USPS node, then the cache will be executing -// a sampler for fetching the data. As such, any options in the USPS node need to be reset to its defaults so -// that this USPS node will produce the full set of data into the cache. -Status USPSNode::MakeSimpleProducer() { - shard_id_ = 0; - num_shards_ = 1; - shuffle_ = ShuffleMode::kFalse; - num_samples_ = 0; - return Status::OK(); -} -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2021-2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.h" + +#include +#include +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/datasetops/source/usps_op.h" +#include "mindspore-lite/minddata/dataset/util/status.h" + +namespace mindspore::lite { +namespace dataset { +USPSNode::USPSNode(const std::string &dataset_dir, const std::string &usage, int32_t num_samples, ShuffleMode shuffle, + int32_t num_shards, int32_t shard_id, std::shared_ptr cache) + : NonMappableSourceNode(std::move(cache)), + dataset_dir_(dataset_dir), + usage_(usage), + num_samples_(num_samples), + shuffle_(shuffle), + num_shards_(num_shards), + shard_id_(shard_id) { + // Update the num_shards_ in global context. this number is only used for now by auto_num_worker_pass. User discretion + // is advised. Auto_num_worker_pass is currently an experimental feature which can still work if the num_shards_ isn't + // 100% correct. The reason behind is for now, PreBuildSampler doesn't offer a way to return num_shards. Once + // PreBuildSampler is phased out, this can be cleaned up. + GlobalContext::config_manager()->set_num_shards_for_auto_num_workers(num_shards_); +} + +std::shared_ptr USPSNode::Copy() { + auto node = std::make_shared(dataset_dir_, usage_, num_samples_, shuffle_, num_shards_, shard_id_, cache_); + (void)node->SetNumWorkers(num_workers_); + (void)node->SetConnectorQueueSize(connector_que_size_); + return node; +} + +void USPSNode::Print(std::ostream &out) const { + out << (Name() + "(dataset dir:" + dataset_dir_ + ", usage:" + usage_ + + ", num_shards:" + std::to_string(num_shards_) + ", shard_id:" + std::to_string(shard_id_) + + ", num_samples:" + std::to_string(num_samples_) + ")"); +} + +Status USPSNode::ValidateParams() { + RETURN_IF_NOT_OK(DatasetNode::ValidateParams()); + RETURN_IF_NOT_OK(ValidateDatasetDirParam("USPSDataset", dataset_dir_)); + RETURN_IF_NOT_OK(ValidateStringValue("USPSDataset", usage_, {"train", "test", "all"})); + RETURN_IF_NOT_OK(ValidateScalar("USPSDataset", "num_samples", num_samples_, {0}, false)); + RETURN_IF_NOT_OK(ValidateDatasetShardParams("USPSDataset", num_shards_, shard_id_)); + RETURN_IF_NOT_OK(ValidateEnum("USPSDataset", "ShuffleMode", shuffle_, + {ShuffleMode::kFalse, ShuffleMode::kFiles, ShuffleMode::kGlobal})); + return Status::OK(); +} + +Status USPSNode::Build(std::vector> *const node_ops) { + bool shuffle_files = (shuffle_ == ShuffleMode::kGlobal || shuffle_ == ShuffleMode::kFiles); + + // Do internal Schema generation. + auto schema = std::make_unique(); + RETURN_IF_NOT_OK(schema->AddColumn(ColDescriptor("image", DataType(DataType::DE_UINT8), TensorImpl::kCv, 1))); + TensorShape scalar = TensorShape::CreateScalar(); + RETURN_IF_NOT_OK( + schema->AddColumn(ColDescriptor("label", DataType(DataType::DE_UINT32), TensorImpl::kFlexible, 0, &scalar))); + + auto op = std::make_shared(dataset_dir_, usage_, std::move(schema), num_workers_, worker_connector_size_, + num_samples_, connector_que_size_, shuffle_files, num_shards_, shard_id_); + RETURN_IF_NOT_OK(op->Init()); + + // If a global shuffle is used for USPS, it will inject a shuffle op over the USPS. + // But, if there is a cache in the tree, we do not need the global shuffle and the shuffle op should not be built. + // This is achieved in the cache transform pass where we call MakeSimpleProducer to reset USPS's shuffle + // option to false. + if (shuffle_ == ShuffleMode::kGlobal) { + // Inject ShuffleOp + std::shared_ptr shuffle_op = nullptr; + int64_t num_rows = 0; + + // First, get the number of rows in the dataset + RETURN_IF_NOT_OK(USPSOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); + + // Add the shuffle op after this op + RETURN_IF_NOT_OK(AddShuffleOp(op->FileNames().size(), num_shards_, num_rows, 0, connector_que_size_, &shuffle_op)); + shuffle_op->SetTotalRepeats(GetTotalRepeats()); + shuffle_op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + shuffle_op->Skip(skip_steps_); + node_ops->push_back(shuffle_op); + } + op->SetTotalRepeats(GetTotalRepeats()); + op->SetNumRepeatsPerEpoch(GetNumRepeatsPerEpoch()); + node_ops->push_back(op); + return Status::OK(); +} + +// Get the shard id of node +Status USPSNode::GetShardId(int32_t *shard_id) { + *shard_id = shard_id_; + return Status::OK(); +} + +// Get Dataset size +Status USPSNode::GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) { + if (dataset_size_ > 0) { + *dataset_size = dataset_size_; + return Status::OK(); + } + int64_t num_rows, sample_size = num_samples_; + RETURN_IF_NOT_OK(USPSOp::CountTotalRows(dataset_dir_, usage_, &num_rows)); + num_rows = static_cast(ceil(num_rows / (1.0 * num_shards_))); + *dataset_size = sample_size > 0 ? std::min(num_rows, sample_size) : num_rows; + dataset_size_ = *dataset_size; + return Status::OK(); +} + +Status USPSNode::to_json(nlohmann::json *out_json) { + nlohmann::json args; + args["num_parallel_workers"] = num_workers_; + args["connector_queue_size"] = connector_que_size_; + args["dataset_dir"] = dataset_dir_; + args["usage"] = usage_; + args["num_samples"] = num_samples_; + args["shuffle"] = shuffle_; + args["num_shards"] = num_shards_; + args["shard_id"] = shard_id_; + if (cache_ != nullptr) { + nlohmann::json cache_args; + RETURN_IF_NOT_OK(cache_->to_json(&cache_args)); + args["cache"] = cache_args; + } + *out_json = args; + return Status::OK(); +} + +// Note: The following two functions are common among NonMappableSourceNode and should be promoted to its parent class. +// USPS by itself is a non-mappable dataset that does not support sampling. +// However, if a cache operator is injected at some other place higher in the tree, that cache can +// inherit this sampler from the leaf, providing sampling support from the caching layer. +// That is why we setup the sampler for a leaf node that does not use sampling. +Status USPSNode::SetupSamplerForCache(std::shared_ptr *sampler) { + *sampler = SelectSampler(num_samples_, shuffle_, num_shards_, shard_id_); + return Status::OK(); +} + +// If a cache has been added into the ascendant tree over this USPS node, then the cache will be executing +// a sampler for fetching the data. As such, any options in the USPS node need to be reset to its defaults so +// that this USPS node will produce the full set of data into the cache. +Status USPSNode::MakeSimpleProducer() { + shard_id_ = 0; + num_shards_ = 1; + shuffle_ = ShuffleMode::kFalse; + num_samples_ = 0; + return Status::OK(); +} +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.h index 56e1152c90f19205da7a7733468fb038ab4ea01c..45019eaa560da5d4880f92c58393978d5eea5bfb 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/usps_node.h @@ -1,120 +1,120 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_USPS_NODE_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_USPS_NODE_H_ - -#include -#include -#include - -#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" - -namespace mindspore { -namespace dataset { -class USPSNode : public NonMappableSourceNode { - public: - /// \brief Constructor. - USPSNode(const std::string &dataset_dir, const std::string &usage, int32_t num_samples, ShuffleMode shuffle, - int32_t num_shards, int32_t shard_id, std::shared_ptr cache); - - /// \brief Destructor. - ~USPSNode() override = default; - - /// \brief Node name getter. - /// \return Name of the current node. - std::string Name() const override { return kUSPSNode; } - - /// \brief Print the description. - /// \param out - The output stream to write output to. - void Print(std::ostream &out) const override; - - /// \brief Copy the node to a new object. - /// \return A shared pointer to the new copy. - std::shared_ptr Copy() override; - - /// \brief a base class override function to create the required runtime dataset op objects for this class. - /// \param node_ops - A vector containing shared pointer to the Dataset Ops that this object will create. - /// \return Status Status::OK() if build successfully. - Status Build(std::vector> *const node_ops) override; - - /// \brief Parameters validation. - /// \return Status Status::OK() if all the parameters are valid. - Status ValidateParams() override; - - /// \brief Get the shard id of node. - /// \return Status Status::OK() if get shard id successfully. - Status GetShardId(int32_t *shard_id) override; - - /// \brief Base-class override for GetDatasetSize. - /// \param[in] size_getter Shared pointer to DatasetSizeGetter. - /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting - /// dataset size at the expense of accuracy. - /// \param[out] dataset_size the size of the dataset. - /// \return Status of the function. - Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, - int64_t *dataset_size) override; - - /// \brief Getter functions. - const std::string &DatasetDir() const { return dataset_dir_; } - - /// \brief Getter functions. - const std::string &Usage() const { return usage_; } - - /// \brief Getter functions. - int32_t NumSamples() const { return num_samples_; } - - /// \brief Getter functions. - int32_t NumShards() const { return num_shards_; } - - /// \brief Getter functions. - int32_t ShardId() const { return shard_id_; } - - /// \brief Getter functions. - ShuffleMode Shuffle() const { return shuffle_; } - - /// \brief Get the arguments of node. - /// \param[out] out_json JSON string of all attributes. - /// \return Status of the function. - Status to_json(nlohmann::json *out_json) override; - - /// \brief USPS by itself is a non-mappable dataset that does not support sampling. - /// However, if a cache operator is injected at some other place higher in the tree, that cache can - /// inherit this sampler from the leaf, providing sampling support from the caching layer. - /// That is why we setup the sampler for a leaf node that does not use sampling. - /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. - /// \param[in] sampler The sampler to setup. - /// \return Status of the function. - Status SetupSamplerForCache(std::shared_ptr *sampler) override; - - /// \brief If a cache has been added into the ascendant tree over this USPS node, then the cache will be executing - /// a sampler for fetching the data. As such, any options in the USPS node need to be reset to its defaults - /// so that this USPS node will produce the full set of data into the cache. - /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. - /// \return Status of the function. - Status MakeSimpleProducer() override; - - private: - std::string dataset_dir_; - std::string usage_; - int32_t num_samples_; - ShuffleMode shuffle_; - int32_t num_shards_; - int32_t shard_id_; -}; -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_USPS_NODE_H_ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_USPS_NODE_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_USPS_NODE_H_ + +#include +#include +#include + +#include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" + +namespace mindspore::lite { +namespace dataset { +class USPSNode : public NonMappableSourceNode { + public: + /// \brief Constructor. + USPSNode(const std::string &dataset_dir, const std::string &usage, int32_t num_samples, ShuffleMode shuffle, + int32_t num_shards, int32_t shard_id, std::shared_ptr cache); + + /// \brief Destructor. + ~USPSNode() override = default; + + /// \brief Node name getter. + /// \return Name of the current node. + std::string Name() const override { return kUSPSNode; } + + /// \brief Print the description. + /// \param out - The output stream to write output to. + void Print(std::ostream &out) const override; + + /// \brief Copy the node to a new object. + /// \return A shared pointer to the new copy. + std::shared_ptr Copy() override; + + /// \brief a base class override function to create the required runtime dataset op objects for this class. + /// \param node_ops - A vector containing shared pointer to the Dataset Ops that this object will create. + /// \return Status Status::OK() if build successfully. + Status Build(std::vector> *const node_ops) override; + + /// \brief Parameters validation. + /// \return Status Status::OK() if all the parameters are valid. + Status ValidateParams() override; + + /// \brief Get the shard id of node. + /// \return Status Status::OK() if get shard id successfully. + Status GetShardId(int32_t *shard_id) override; + + /// \brief Base-class override for GetDatasetSize. + /// \param[in] size_getter Shared pointer to DatasetSizeGetter. + /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting + /// dataset size at the expense of accuracy. + /// \param[out] dataset_size the size of the dataset. + /// \return Status of the function. + Status GetDatasetSize(const std::shared_ptr &size_getter, bool estimate, + int64_t *dataset_size) override; + + /// \brief Getter functions. + const std::string &DatasetDir() const { return dataset_dir_; } + + /// \brief Getter functions. + const std::string &Usage() const { return usage_; } + + /// \brief Getter functions. + int32_t NumSamples() const { return num_samples_; } + + /// \brief Getter functions. + int32_t NumShards() const { return num_shards_; } + + /// \brief Getter functions. + int32_t ShardId() const { return shard_id_; } + + /// \brief Getter functions. + ShuffleMode Shuffle() const { return shuffle_; } + + /// \brief Get the arguments of node. + /// \param[out] out_json JSON string of all attributes. + /// \return Status of the function. + Status to_json(nlohmann::json *out_json) override; + + /// \brief USPS by itself is a non-mappable dataset that does not support sampling. + /// However, if a cache operator is injected at some other place higher in the tree, that cache can + /// inherit this sampler from the leaf, providing sampling support from the caching layer. + /// That is why we setup the sampler for a leaf node that does not use sampling. + /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. + /// \param[in] sampler The sampler to setup. + /// \return Status of the function. + Status SetupSamplerForCache(std::shared_ptr *sampler) override; + + /// \brief If a cache has been added into the ascendant tree over this USPS node, then the cache will be executing + /// a sampler for fetching the data. As such, any options in the USPS node need to be reset to its defaults + /// so that this USPS node will produce the full set of data into the cache. + /// Note: This function is common among NonMappableSourceNode and should be promoted to its parent class. + /// \return Status of the function. + Status MakeSimpleProducer() override; + + private: + std::string dataset_dir_; + std::string usage_; + int32_t num_samples_; + ShuffleMode shuffle_; + int32_t num_shards_; + int32_t shard_id_; +}; +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_USPS_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/voc_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/voc_node.cc index 241cdccb8d1b2281e08eaa2a1dfd2f2af8267a4d..ee0809c6c27380f49cbb0f7c07c7262b025c6e8f 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/voc_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/voc_node.cc @@ -28,7 +28,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #ifdef ENABLE_PYTHON @@ -246,4 +246,4 @@ Status VOCNode::from_json(nlohmann::json json_obj, std::shared_ptr } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/voc_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/voc_node.h index b911700e2e9b61fabe01b232d0426c3491d0b112..0a4cf6995fcd5bcf45e153d45e86d3bc6d64e942 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/voc_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/voc_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class VOCNode : public MappableSourceNode { public: @@ -124,5 +124,5 @@ class VOCNode : public MappableSourceNode { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_VOC_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wider_face_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wider_face_node.cc index 4ec0d221cc70afc94e284bb0fee447b23afb183b..d7f8b173788ccebfc46f7143c20c3f196794cbec 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wider_face_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wider_face_node.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/wider_face_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for WIDERFaceNode. WIDERFaceNode::WIDERFaceNode(const std::string &dataset_dir, const std::string &usage, const bool &decode, @@ -130,4 +130,4 @@ Status WIDERFaceNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wider_face_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wider_face_node.h index 97e1d5271661556864d0a5ef225219e419e5374a..385c7caefb64d95872115e801146a9ec486f3073 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wider_face_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wider_face_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class WIDERFaceNode : public MappableSourceNode { public: @@ -99,5 +99,5 @@ class WIDERFaceNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_WIDER_FACE_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.cc index fc352855f33673e19c95367b7222064eccc828e8..912ac3150a02c9fcf54745a59e5ba3fe5c2d3e50 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/wiki_text_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for WikiTextNode. WikiTextNode::WikiTextNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, @@ -194,4 +194,4 @@ std::vector WikiTextNode::WalkAllFiles(const std::string &usage, co return wikitext_files_list; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.h index 4688ab52b228f4936ad0bf62b2e15caccb4ce838..3865060a9a1df70cdb40d50863341617815c585c 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief class WikiTextNode. /// \brief Dataset derived class to represent WikiText dataset. @@ -135,5 +135,5 @@ class WikiTextNode : public NonMappableSourceNode { std::vector wikitext_files_list_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_WIKI_TEXT_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.cc index 2aa70e6eceae62830df254a7a2d5a04a353f5ec2..93a8c3311a99a92074b176e7541192c37461e1e6 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { YahooAnswersNode::YahooAnswersNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, @@ -213,4 +213,4 @@ Status YahooAnswersNode::MakeSimpleProducer() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.h index e25f59fcbede0e9eaddbfad48264fdc13b74c8a6..be37fee7e4572ca1e5e0705119a855e0067e63ba 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/yahoo_answers_op.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class YahooAnswersNode : public NonMappableSourceNode { public: @@ -116,5 +116,5 @@ class YahooAnswersNode : public NonMappableSourceNode { int32_t shard_id_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_YAHOO_ANSWERS_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.cc index 7414e805c71fb9bc8d43ea09fcc6fde1eff686b4..62a93aa3292a97ddbf1ea1acf1d47a8cee0c2be5 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { YelpReviewNode::YelpReviewNode(const std::string &dataset_dir, const std::string &usage, int64_t num_samples, ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, @@ -187,4 +187,4 @@ std::vector YelpReviewNode::WalkAllFiles(const std::string &usage, return yelp_review_files_list; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.h index cff0e89883301579883b9a286f142955f9845941..0030a5119e34d57a4e9ccbf6805ba8f05929b83a 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/source/yelp_review_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class YelpReviewNode /// \brief A Node derived class to represent YelpReview Node. @@ -131,5 +131,5 @@ class YelpReviewNode : public NonMappableSourceNode { std::vector yelp_review_files_list_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_YELP_REVIEW_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.cc index 697792bdeda7ac82040b35d9053dc4f3d5499c9d..61dbe7dcb1419b39c9c8765467ab7b7c22a0ef67 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/source/yes_no_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for YesNoNode. YesNoNode::YesNoNode(const std::string &dataset_dir, std::shared_ptr sampler, @@ -113,4 +113,4 @@ Status YesNoNode::to_json(nlohmann::json *out_json) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h index 970b623430ab7dacfacfca1ea50dd6da45685095..6a46c28e1a78cd29115ecc55b090f6a3e8bd1cd2 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class YesNoNode : public MappableSourceNode { public: @@ -88,5 +88,5 @@ class YesNoNode : public MappableSourceNode { std::shared_ptr sampler_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_YES_NO_NODE_H diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/sync_wait_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/sync_wait_node.cc index 71240808af2b1fb696167df761a9fef94f6139b6..ef64687016bfc2455bce4d8d7521b230d074572f 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/sync_wait_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/sync_wait_node.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/engine/datasetops/barrier_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for SyncWaitNode SyncWaitNode::SyncWaitNode(std::shared_ptr child, const std::string &condition_name, py::function callback) @@ -54,4 +54,4 @@ Status SyncWaitNode::ValidateParams() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/sync_wait_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/sync_wait_node.h index fa2be5d6d95bd670f80a40e1a94d752b160698a5..a1301c05ef571a6cfc6ed3efe8f8012ca4bc823f 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/sync_wait_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/sync_wait_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class SyncWaitNode /// \brief A Dataset derived class to represent SyncWaitNode dataset @@ -65,5 +65,5 @@ class SyncWaitNode : public DatasetNode { py::function callback_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SYNC_WAIT_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.cc index 9bda5b9bd26b76c904d97ae830af4631e1793024..ccde3ef85c277ab531f273cd03778a70d0bd3ea2 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor for TakeNode TakeNode::TakeNode(std::shared_ptr child, int32_t count) : take_count_(count) { this->AddChild(child); } @@ -95,4 +95,4 @@ Status TakeNode::from_json(nlohmann::json json_obj, std::shared_ptr return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.h index e7686fd49160c208db638380ad98c1b3474b12f5..7f2ee77f50e2153e8e98c569b0db91bf4095c0d0 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TakeNode : public DatasetNode { public: @@ -99,5 +99,5 @@ class TakeNode : public DatasetNode { int32_t take_count_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_TAKE_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.cc b/mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.cc index 80b19d9fa184b7ef00c4d6dec0c560368235c335..50f5920952efb9a53c29e013c8b69193b3a84f13 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.cc +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { ZipNode::ZipNode(const std::vector> &datasets) { @@ -100,4 +100,4 @@ Status ZipNode::from_json(std::vector> datasets, st return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.h b/mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.h index d7b03f0cb258a62ec6b2d3c3af2f1345b7b8944d..c885331c15dd07c4c823c25c3931e12a3a3a43fe 100644 --- a/mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.h +++ b/mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ZipNode : public DatasetNode { public: @@ -85,5 +85,5 @@ class ZipNode : public DatasetNode { std::vector> datasets_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_ZIP_NODE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/jagged_connector.h b/mindspore-lite/minddata/dataset/engine/jagged_connector.h index a6af336ad7897ceae7b035f7a4f74d862c61d6eb..53bf54f73f9944a9456e31a1b4165387f84d28d2 100644 --- a/mindspore-lite/minddata/dataset/engine/jagged_connector.h +++ b/mindspore-lite/minddata/dataset/engine/jagged_connector.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class JaggedConnector : public Connector { public: @@ -85,5 +85,5 @@ class JaggedConnector : public Connector { std::vector is_queue_finished_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_JAGGED_CONNECTOR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/operator_connector.h b/mindspore-lite/minddata/dataset/engine/operator_connector.h index 70400c07251430888a0836ff3db0927de2a9546d..292d966a3cf7369f5345bf99a341a57be58b5b14 100644 --- a/mindspore-lite/minddata/dataset/engine/operator_connector.h +++ b/mindspore-lite/minddata/dataset/engine/operator_connector.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class OperatorConnector : public Queue { @@ -62,6 +62,6 @@ class OperatorConnector : public Queue { int64_t out_rows_count_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_OPERATOR_CONNECTOR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pass.cc index 06a16d68ea1e32bc6159889c779c6487522368ff..9088cd1b406797e8203c4370fab4f6c27295c3ac 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pass.cc @@ -51,7 +51,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/data_queue_node.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Driver method for TreePass @@ -293,4 +293,4 @@ Status IRNodePass::Visit(std::shared_ptr node, bool *cons return Visit(std::static_pointer_cast(node), modified); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pass.h b/mindspore-lite/minddata/dataset/engine/opt/pass.h index 587a50bfc1aec75ffca2cfbca8389a1eb7f24946..e1215cb70edc51b23348df48c9572ca9e171380d 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pass.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Non-leaf IR node class BatchNode; @@ -232,6 +232,6 @@ class IRNodePass : public IRPass { Order traversalOrder_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_OPT_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/post/auto_worker_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/post/auto_worker_pass.cc index a3417111b6793ca2c44d92be9877453954e25de8..c3ee1f3de4394dc220089391ff561e09d874143b 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/post/auto_worker_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/post/auto_worker_pass.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // this will become the RootNode:DatasetNode when it is turned on @@ -136,4 +136,4 @@ float AutoWorkerPass::OpWeightPass::GetNodeWeightFromProfile(std::shared_ptr &node) @@ -153,4 +153,4 @@ Status AddSkipPass::RunOnTree(std::shared_ptr root_ir, bool *const return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/add_skip_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/add_skip_pass.h index 4b00b8872c1c82c61485be6ca1385f280a2b9592..3bcd7671d449680e48cb019cb76e467653329b1b 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/add_skip_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/add_skip_pass.h @@ -20,7 +20,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DatasetOp; @@ -116,6 +116,6 @@ class AddSkipPass : public IRTreePass { Status RunOnTree(std::shared_ptr root_ir, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_OPT_PRE_ADD_SKIP_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/cache_validation_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/cache_validation_pass.cc index c85a3fc84832f8b1a442562a9e8a1fba13652a0d..a9ca4076a837d9d6d6a2b23909924463273cc253 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/cache_validation_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/cache_validation_pass.cc @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/zip_node.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Constructor @@ -186,4 +186,4 @@ Status CacheValidationPass::VisitAfter(std::shared_ptr node, bool * return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/cache_validation_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/cache_validation_pass.h index 7964c7fa19444b6a9bb7b5ff007232a7245f17e8..33656cee8ab2ad7be1dea93187bd9f6c522802b1 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/cache_validation_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/cache_validation_pass.h @@ -22,7 +22,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class CacheValidationPass cache_validation_pass.h @@ -106,6 +106,6 @@ class CacheValidationPass : public IRNodePass { bool is_mappable_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_OPT_PRE_CACHE_VALIDATION_PASS_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/debug_mode_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/debug_mode_pass.cc index c258527398bc9d47830f42b6d59e67101e2ef84c..7a972ab1b3a98b626ce5f80eda52695dc80af10f 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/debug_mode_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/debug_mode_pass.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/shuffle_node.h" #include "mindspore-lite/minddata/dataset/include/dataset/datasets.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr uint32_t kSeedValue = 1; bool DebugModePass::DebugPass::RemoveCache(std::shared_ptr node) const { @@ -97,4 +97,4 @@ Status DebugModePass::RunOnTree(std::shared_ptr root_ir, bool *cons return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/debug_mode_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/debug_mode_pass.h index 67f4e063ea7b6dfaf420daf2374434023c7a59f1..63181a2f3cb618dbdbdebbc993e7d5fb9d5c3419 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/debug_mode_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/debug_mode_pass.h @@ -20,7 +20,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class DebugModePass /// \brief This is a pre parse pass that disable some nodes and prepares for the debug mode. @@ -72,6 +72,6 @@ class DebugModePass : public IRTreePass { }; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_OPT_PRE_DEBUG_MODE_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/deep_copy_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/deep_copy_pass.cc index 9fc4da9f537dd0009d65de624a690a3a51a0a29b..bfdfa6c8def485e74a90fea0b08f8234dea708ce 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/deep_copy_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/deep_copy_pass.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/root_node.h" #include "mindspore-lite/minddata/dataset/include/dataset/datasets.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { DeepCopyPass::DeepCopyPass() { @@ -69,4 +69,4 @@ Status DeepCopyPass::VisitAfter(std::shared_ptr node, bool *const m return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/deep_copy_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/deep_copy_pass.h index 1a027fa6237d4bc2f778b0e2d21f80c81ef2771a..4a4d3d43ddaf84a27b504661644379d92279cf1b 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/deep_copy_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/deep_copy_pass.h @@ -21,7 +21,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class DeepCopyPass @@ -56,6 +56,6 @@ class DeepCopyPass : public IRNodePass { DatasetNode *parent_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_OPT_PRE_DEEP_COPY_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.cc index 09931034936ad12c7b7fbd90d0cb8c284f8d9ade..277f797ff484a0b6bbe5251f53a7d797a95ec9d4 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/root_node.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/data_queue_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // constructor @@ -94,4 +94,4 @@ Status EpochCtrlPass::RunOnTree(std::shared_ptr root_ir, bool *cons return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.h index 0f857143a2e246275d42ce43d1fc9d201f38742d..dcf6c91f56cf8730690d3143d71960166f55e26c 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.h @@ -21,7 +21,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DatasetOp; @@ -93,6 +93,6 @@ class EpochCtrlPass : public IRTreePass { Status RunOnTree(std::shared_ptr root_ir, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_OPT_PASS_PRE_EPOCH_INJECTION_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.cc index 8602fcc9a67218d5ca67a1bf2b7f63edf23bcf41..afd4dcc3948ac9aefdf5f5f967a87db982704f4f 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/map_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status GetterPass::Visit(std::shared_ptr node, bool *const modified) { @@ -24,4 +24,4 @@ Status GetterPass::Visit(std::shared_ptr node, bool *const modified) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.h index b8f90cccae7272fbc23f0233929deabd1b6759aa..9a3d24b5b8fa8734ebb6b9c13523b891daca982e 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/getter_pass.h @@ -21,7 +21,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DatasetOp; @@ -39,6 +39,6 @@ class GetterPass : public IRNodePass { Status Visit(std::shared_ptr node, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_OPT_PASS_PRE_GETTER_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/input_validation_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/input_validation_pass.cc index 7183b1125631e3dbfbe2e46e939e4a772e4ffbde..958e8155f0bb4695a55ee427bdaf70bfb285bdb9 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/input_validation_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/input_validation_pass.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/datasets.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status InputValidationPass::Visit(std::shared_ptr node, bool *const modified) { @@ -42,4 +42,4 @@ Status InputValidationPass::Visit(std::shared_ptr node, bool *const return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/input_validation_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/input_validation_pass.h index 25d0febb593878fbd2e01185135bb5da10cce763..6eb01776764c8d9abcd5981467c547a853161284 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/input_validation_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/input_validation_pass.h @@ -21,7 +21,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class InputValidationPass @@ -35,6 +35,6 @@ class InputValidationPass : public IRNodePass { Status Visit(std::shared_ptr node, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // DATASET_ENGINE_OPT_PRE_INPUT_VALIDATION_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.cc index 834f8ea2e50f0d7a8df916e4e1fe3389c2de4339..26d52feac92526968c2b3d0abe534ac12c1ffe56 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.cc @@ -25,7 +25,7 @@ #endif #include "mindspore-lite/minddata/dataset/kernels/ir/data/transforms_ir.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { #ifndef ENABLE_ANDROID Status InsertMapPass::Visit(std::shared_ptr node, bool *const modified) { RETURN_UNEXPECTED_IF_NULL(node); @@ -77,4 +77,4 @@ Status InsertMapPass::Visit(std::shared_ptr node, bool *const modi return Status ::OK(); } #endif -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.h index f2d8959463e42e702f6d639cbf3e517b5e5003c0..cf08e365d08b12678f88412c45e96b39913cfd32 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.h @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class InsertMapPass : public IRNodePass { public: @@ -40,5 +40,5 @@ class InsertMapPass : public IRNodePass { #endif }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_OPT_PRE_INSERT_MAP_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.cc index 29ae267772d8b9c6271796b56f084e5c5e64f86f..306a8e03850c33061532d988bf6c59b4526070c7 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/skip_node.h" #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/take_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { NodeRemovalPass::RemovalNodes::RemovalNodes() {} @@ -74,4 +74,4 @@ Status NodeRemovalPass::RunOnTree(std::shared_ptr root_ir, bool *co return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.h index d5598aa51c4d278107e26930f62e110fc2fc2391..e65298c3faeca15a60edae17d2421f0e5f16cf21 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.h @@ -21,7 +21,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DatasetOp; @@ -81,6 +81,6 @@ class NodeRemovalPass : public IRTreePass { Status RunOnTree(std::shared_ptr root_ir, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_OPT_PRE_NODE_REMOVAL_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/skip_pushdown_pass.cc b/mindspore-lite/minddata/dataset/engine/opt/pre/skip_pushdown_pass.cc index b40333ff51bfffaf3b61c9f32da5d7ecc5d3a3f9..bbf6a66c893d8bc38cfe24f58f6c0b55cbba0533 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/skip_pushdown_pass.cc +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/skip_pushdown_pass.cc @@ -30,7 +30,7 @@ #endif #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/source/samplers/skip_first_epoch_sampler_ir.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { SkipPushdownPass::SkipNodes::SkipNodes() : skip_count_(0), skip_steps_(0) {} @@ -182,4 +182,4 @@ Status SkipPushdownPass::RunOnTree(std::shared_ptr root_ir, bool *c return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/opt/pre/skip_pushdown_pass.h b/mindspore-lite/minddata/dataset/engine/opt/pre/skip_pushdown_pass.h index feca21d279131769cec07359c6b136ef24fb7469..b8ef652e6bd3706db8543ef2b2455bd67a3da3e7 100644 --- a/mindspore-lite/minddata/dataset/engine/opt/pre/skip_pushdown_pass.h +++ b/mindspore-lite/minddata/dataset/engine/opt/pre/skip_pushdown_pass.h @@ -22,7 +22,7 @@ #include #include "mindspore-lite/minddata/dataset/engine/opt/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class BatchNode; class DatasetNode; @@ -172,6 +172,6 @@ class SkipPushdownPass : public IRTreePass { Status RunOnTree(std::shared_ptr root_ir, bool *const modified) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_OPT_PRE_SKIP_PUSHDOWN_PASS_H_ diff --git a/mindspore-lite/minddata/dataset/engine/perf/auto_tune.cc b/mindspore-lite/minddata/dataset/engine/perf/auto_tune.cc index ef9a7ccb48fd58dc416cd1a2942f520f0e708f52..398f0319fcf63e3e1338b2cabd2680e939d88c02 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/auto_tune.cc +++ b/mindspore-lite/minddata/dataset/engine/perf/auto_tune.cc @@ -30,7 +30,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { AutoTune::AutoTune(TreeAdapter *tree_adap, ProfilingManager *profiling_mgr) : tree_adapter_(tree_adap), @@ -754,4 +754,4 @@ Status AutoTune::AnalyseMemory() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/perf/auto_tune.h b/mindspore-lite/minddata/dataset/engine/perf/auto_tune.h index 84e28ad3eec85ec565e1150fb73df6bd89d7fd6a..4bc75bc305b1577a68ac23c6c138a8d8132c2ea6 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/auto_tune.h +++ b/mindspore-lite/minddata/dataset/engine/perf/auto_tune.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/engine/tree_modifier.h" #include "mindspore-lite/minddata/dataset/engine/perf/profiling.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TreeModifier; class AutoTune { @@ -302,5 +302,5 @@ class AutoTune { nlohmann::json autotune_config_json_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_PERF_AUTO_TUNE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/perf/connector_size.cc b/mindspore-lite/minddata/dataset/engine/perf/connector_size.cc index d9a16675ccd7c71d5f11694e18abe994bc75d81c..83f78b803e2fceb67e1cf4fe15c515e50c2f1f4b 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/connector_size.cc +++ b/mindspore-lite/minddata/dataset/engine/perf/connector_size.cc @@ -32,7 +32,7 @@ namespace platform = mindspore::lite; #endif using json = nlohmann::json; -namespace mindspore { +namespace mindspore::lite { namespace dataset { using Qrow = std::vector; @@ -167,4 +167,4 @@ Path ConnectorSize::GetFileName(const std::string &dir_path, const std::string & return Path(dir_path) / Path("pipeline_profiling_" + rank_id + ".json"); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/perf/connector_size.h b/mindspore-lite/minddata/dataset/engine/perf/connector_size.h index b8e71e97f43b4e9fc9b206d442db0ad5e5dbe47f..0e19e539acaf0bb03b47a2353f8e01247ab39b85 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/connector_size.h +++ b/mindspore-lite/minddata/dataset/engine/perf/connector_size.h @@ -24,7 +24,7 @@ using json = nlohmann::json; -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ExecutionTree; @@ -82,6 +82,6 @@ class ConnectorSize : public Sampling { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CONNECTOR_SIZE_H diff --git a/mindspore-lite/minddata/dataset/engine/perf/cpu_sampler.cc b/mindspore-lite/minddata/dataset/engine/perf/cpu_sampler.cc index dee5e6c1728e45596c49dd7205c987d8edefa924..7cd6800db2ee38c00158fd6bf348da6038a27023 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/cpu_sampler.cc +++ b/mindspore-lite/minddata/dataset/engine/perf/cpu_sampler.cc @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using json = nlohmann::json; #if !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__) @@ -779,4 +779,4 @@ Status CpuSampler::GetSystemMemoryInfo(SystemMemoryMetric metric, uint64_t start return (sys_info_.GetSystemMemInfo(metric, start_index, end_index, result)); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/perf/cpu_sampler.h b/mindspore-lite/minddata/dataset/engine/perf/cpu_sampler.h index 21f533885e036385b5f53d777dcd6c48727dda13..70c76a75c6e3e8c53b0aa8f8f180d0971914f9a1 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/cpu_sampler.h +++ b/mindspore-lite/minddata/dataset/engine/perf/cpu_sampler.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/engine/perf/profiling.h" #include "mindspore-lite/minddata/dataset/engine/datasetops/dataset_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ExecutionTree; @@ -212,5 +212,5 @@ class CpuSampler : public Sampling { Path GetFileName(const std::string &dir_path, const std::string &rank_id) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_PERF_CPU_SAMPLER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/perf/cyclic_array.h b/mindspore-lite/minddata/dataset/engine/perf/cyclic_array.h index 42631683487e0c3aa1741364ea2212beee56023d..2b5f64e84ffdb2458da69681a80b70425b5c36a8 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/cyclic_array.h +++ b/mindspore-lite/minddata/dataset/engine/perf/cyclic_array.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class CyclicArray "include/cyclic_array.h /// \brief This is a container with a contiguous memory layout that pnly keeps N last entries, @@ -193,5 +193,5 @@ class CyclicArray { dsize_t capacity_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CYCLIC_ARRAY_H diff --git a/mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.cc b/mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.cc index 52e9e9669ecfac39267dc74b57a96d838bdef2fc..ad25c5ebb63b5ba41f97aba6bd90838e3da3c928 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.cc +++ b/mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.cc @@ -18,10 +18,10 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/path.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Path DatasetIteratorTracing::GetFileName(const std::string &dir_path, const std::string &rank_id) { return Path(dir_path) / Path("dataset_iterator_profiling_" + rank_id + ".txt"); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.h b/mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.h index 5e179fc65c85ec4da38bf6d4978f65a8afff8961..a1cc364b3247e2a647ada04e68eae3d21ac7408a 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.h +++ b/mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/perf/profiling.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DatasetIteratorTracing : public Tracing { public: @@ -38,6 +38,6 @@ class DatasetIteratorTracing : public Tracing { Path GetFileName(const std::string &dir_path, const std::string &rank_id) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_DATASET_ITERATOR_TRACING_H diff --git a/mindspore-lite/minddata/dataset/engine/perf/device_queue_tracing.cc b/mindspore-lite/minddata/dataset/engine/perf/device_queue_tracing.cc index 3e2ea183f2ae99017fcf8ddd3dfbc497bc757b32..936f96e07d0c2792ae6d7e7574aa77d28738a02e 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/device_queue_tracing.cc +++ b/mindspore-lite/minddata/dataset/engine/perf/device_queue_tracing.cc @@ -19,10 +19,10 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/path.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Path DeviceQueueTracing::GetFileName(const std::string &dir_path, const std::string &rank_id) { return Path(dir_path) / Path("device_queue_profiling_" + rank_id + ".txt"); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/perf/device_queue_tracing.h b/mindspore-lite/minddata/dataset/engine/perf/device_queue_tracing.h index fb54c1ac6013ec5be374a0c6fd5bd9bd3e6c6073..6741fe11efa7df0fe89d5b2f17730db6003fce57 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/device_queue_tracing.h +++ b/mindspore-lite/minddata/dataset/engine/perf/device_queue_tracing.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/engine/perf/profiling.h" #include "mindspore-lite/minddata/dataset/util/path.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DeviceQueueTracing : public Tracing { public: @@ -38,6 +38,6 @@ class DeviceQueueTracing : public Tracing { Path GetFileName(const std::string &dir_path, const std::string &rank_id) override; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_DEVICE_QUEUE_TRACING_H diff --git a/mindspore-lite/minddata/dataset/engine/perf/info_collector.cc b/mindspore-lite/minddata/dataset/engine/perf/info_collector.cc index 3809c3b93b4defcc669c2c92cade7bbc985d481e..0fa336eef73094b0e7b25a96468e516d19bd30e1 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/info_collector.cc +++ b/mindspore-lite/minddata/dataset/engine/perf/info_collector.cc @@ -17,7 +17,7 @@ #include "mindspore-lite/minddata/dataset/engine/perf/info_collector.h" #include "mindspore/mindspore/ccsrc/tools/profiler/profiling.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { uint64_t GetSyscnt() { uint64_t time_cnt = 0; @@ -50,4 +50,4 @@ Status CollectOpInfo(const std::string &event, const std::string &stage, const u #endif return Status::OK(); } -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset diff --git a/mindspore-lite/minddata/dataset/engine/perf/info_collector.h b/mindspore-lite/minddata/dataset/engine/perf/info_collector.h index f814b2ce374632f5a48eba36a9c38013d11ed720..e94ffe6f8ccedebab8ee6f0b6d8d755a6e7f92eb 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/info_collector.h +++ b/mindspore-lite/minddata/dataset/engine/perf/info_collector.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { enum InfoLevel : uint8_t { kDeveloper = 0, kUser = 1 }; enum InfoType : uint8_t { kAll = 0, kMemory = 1, kTime = 2 }; enum TimeType : uint8_t { kStart = 0, kEnd = 1, kStamp = 2 }; @@ -36,5 +36,5 @@ Status CollectPipelineInfo(const std::string &event, const std::string &stage, c Status CollectOpInfo(const std::string &event, const std::string &stage, const uint64_t &start_time, const std::map &custom_info = {}); -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_PERF_INFO_COLLECTOR_H_ diff --git a/mindspore-lite/minddata/dataset/engine/perf/monitor.cc b/mindspore-lite/minddata/dataset/engine/perf/monitor.cc index 1722630c47be21f7b33525cdda7a0e99a6d98ba9..d46451a820758f43d528fdeef17fc883da49947b 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/monitor.cc +++ b/mindspore-lite/minddata/dataset/engine/perf/monitor.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/engine/execution_tree.h" #include "mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Monitor::Monitor(ProfilingManager *profiling_manager) : Monitor(profiling_manager, GlobalContext::config_manager()) {} @@ -64,4 +64,4 @@ Status Monitor::operator()() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/perf/monitor.h b/mindspore-lite/minddata/dataset/engine/perf/monitor.h index 95022d89290eb4f7d98a1e1c39e9491eba04b211..406a8a2a59ced58405bfb750c2182e5962401df1 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/monitor.h +++ b/mindspore-lite/minddata/dataset/engine/perf/monitor.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/cond_var.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ExecutionTree; class ProfilingManager; @@ -56,6 +56,6 @@ class Monitor { CondVar cv_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_MONITOR_H diff --git a/mindspore-lite/minddata/dataset/engine/perf/perf_data.h b/mindspore-lite/minddata/dataset/engine/perf/perf_data.h index 480ee7a162c16c1b22659c59c4cf058549645cb0..28cf913ac5e38bde5a1206c782d4af87bca2c5f9 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/perf_data.h +++ b/mindspore-lite/minddata/dataset/engine/perf/perf_data.h @@ -20,7 +20,7 @@ #include #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // PerfData is a convenience class to record and store the data produced by Monitor @@ -88,5 +88,5 @@ class PerfData { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_PERF_DATA_H diff --git a/mindspore-lite/minddata/dataset/engine/perf/profiling.cc b/mindspore-lite/minddata/dataset/engine/perf/profiling.cc index b82d1e0a2c0e636198f0a795be66ddc15a3f0192..74828bcebc0df047b94955f73bb0bb1c2cc6cf52 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/profiling.cc +++ b/mindspore-lite/minddata/dataset/engine/perf/profiling.cc @@ -40,7 +40,7 @@ namespace platform = mindspore; namespace platform = mindspore::lite; #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr int32_t PUSH_TIME_OFFSET = 0; constexpr int32_t BATCH_TIME_OFFSET = 1; @@ -873,4 +873,4 @@ uint64_t ProfilingTime::GetCurMilliSecond() { return static_cast(duration_cast(steady_clock::now().time_since_epoch()).count()); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/perf/profiling.h b/mindspore-lite/minddata/dataset/engine/perf/profiling.h index de3c98bd3bf1245e571a694c2813a00d9687c247..543a20c03e837631d603fb4a7fdcb88972d4a379 100644 --- a/mindspore-lite/minddata/dataset/engine/perf/profiling.h +++ b/mindspore-lite/minddata/dataset/engine/perf/profiling.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/engine/perf/monitor.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Monitor; @@ -620,5 +620,5 @@ class ProfilingTime { static uint64_t GetCurMilliSecond(); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_PERF_PROFILING_H_ diff --git a/mindspore-lite/minddata/dataset/engine/python_runtime_context.cc b/mindspore-lite/minddata/dataset/engine/python_runtime_context.cc index 16acbc66b74810f6dfeb6ac54dbaa2d49d8dbc26..2d1dd75043d0348d360a313d6ce503aaf4b68dab 100644 --- a/mindspore-lite/minddata/dataset/engine/python_runtime_context.cc +++ b/mindspore-lite/minddata/dataset/engine/python_runtime_context.cc @@ -17,7 +17,7 @@ #include "mindspore-lite/minddata/dataset/engine/python_runtime_context.h" #include "pybind11/pybind11.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { Status PythonRuntimeContext::Terminate() { MS_LOG(INFO) << "Terminating a Dataset PythonRuntime."; if (tree_consumer_ != nullptr) { @@ -51,4 +51,4 @@ TreeConsumer *PythonRuntimeContext::GetPythonConsumer() { return dynamic_cast(tree_consumer_.get()); } } -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset diff --git a/mindspore-lite/minddata/dataset/engine/python_runtime_context.h b/mindspore-lite/minddata/dataset/engine/python_runtime_context.h index 7f5df61944fefbc2d756bc0f683326ba0aeadae3..23cd2f61e768ca1cdbd22af4a5ddfd74626a1048 100644 --- a/mindspore-lite/minddata/dataset/engine/python_runtime_context.h +++ b/mindspore-lite/minddata/dataset/engine/python_runtime_context.h @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/engine/consumers/python_tree_consumer.h" #include "mindspore-lite/minddata/dataset/engine/runtime_context.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { class NativeRuntimeContext; /// Class that represents Python single runtime instance which can consume data from a data pipeline @@ -42,5 +42,5 @@ class PythonRuntimeContext : public RuntimeContext { Status TerminateImpl(); }; -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_PYTHON_RUNTIME_CONTEXT_H_ diff --git a/mindspore-lite/minddata/dataset/engine/runtime_context.cc b/mindspore-lite/minddata/dataset/engine/runtime_context.cc index 3e9361de3c30cef366610dfb171a8e3d0d05b66f..ad5bccbbc7bbeeb4fb734d977e6748f374482d68 100644 --- a/mindspore-lite/minddata/dataset/engine/runtime_context.cc +++ b/mindspore-lite/minddata/dataset/engine/runtime_context.cc @@ -17,7 +17,7 @@ #include "mindspore-lite/minddata/dataset/engine/runtime_context.h" #include -namespace mindspore::dataset { +namespace mindspore::lite::dataset { void RuntimeContext::AssignConsumer(std::shared_ptr tree_consumer) { tree_consumer_ = std::move(tree_consumer); } @@ -45,4 +45,4 @@ NativeRuntimeContext::~NativeRuntimeContext() { TreeConsumer *RuntimeContext::GetConsumer() { return tree_consumer_.get(); } Status RuntimeContext::Init() const { return GlobalInit(); } -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset diff --git a/mindspore-lite/minddata/dataset/engine/runtime_context.h b/mindspore-lite/minddata/dataset/engine/runtime_context.h index 7d5d763945c5314b5f53594d00b66d3c2b63a358..2a3cbe31e7e435b2ac1a143192c6a4b8210f3a7c 100644 --- a/mindspore-lite/minddata/dataset/engine/runtime_context.h +++ b/mindspore-lite/minddata/dataset/engine/runtime_context.h @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/core/client.h" #include "mindspore-lite/minddata/dataset/engine/consumers/tree_consumer.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { class TreeConsumer; /// Class that represents single runtime instance which can consume data from a data pipeline class RuntimeContext { @@ -64,5 +64,5 @@ class NativeRuntimeContext : public RuntimeContext { Status TerminateImpl(); }; -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_RUNTIME_CONTEXT_H_ diff --git a/mindspore-lite/minddata/dataset/engine/serdes.cc b/mindspore-lite/minddata/dataset/engine/serdes.cc index c114549a61a1a5bc4228c76c2c0da5e90f27e8f4..2ff52e3892dccc8c90b1378f291464425172ecff 100644 --- a/mindspore-lite/minddata/dataset/engine/serdes.cc +++ b/mindspore-lite/minddata/dataset/engine/serdes.cc @@ -28,7 +28,7 @@ #endif #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { std::map *operation)> Serdes::func_ptr_ = Serdes::InitializeFuncPtr(); @@ -484,4 +484,4 @@ void ParseMindIRPreprocess_C(const std::vector &dataset_json, } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/serdes.h b/mindspore-lite/minddata/dataset/engine/serdes.h index 46b33d5d03f54e97cc2ae44aa5eb4e022f782bd8..f3e134fb5cb95096abf0d6c0bc6ec1e6d88d6fe6 100644 --- a/mindspore-lite/minddata/dataset/engine/serdes.h +++ b/mindspore-lite/minddata/dataset/engine/serdes.h @@ -134,7 +134,7 @@ #include "mindspore-lite/minddata/dataset/text/ir/kernels/text_ir.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief The Serdes class is used to serialize an IR tree into JSON string and dump into file if file name /// specified. @@ -242,6 +242,6 @@ class Serdes { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_SERDES_H_ diff --git a/mindspore-lite/minddata/dataset/engine/tree_adapter.cc b/mindspore-lite/minddata/dataset/engine/tree_adapter.cc index a31b2e28ddffa8253b72022132d517e5679eeecc..42eba813745d0c9d7a9b34c1c7de4c1f4b6cb3dc 100644 --- a/mindspore-lite/minddata/dataset/engine/tree_adapter.cc +++ b/mindspore-lite/minddata/dataset/engine/tree_adapter.cc @@ -59,7 +59,7 @@ #include "utils/ms_context.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { TreeAdapter::TreeAdapter(UsageFlag usage) : usage_(usage), @@ -838,4 +838,4 @@ Status TreeAdapter::Launch() { nlohmann::json TreeAdapter::GetOffloadJson() { return offload_json_; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/tree_adapter.h b/mindspore-lite/minddata/dataset/engine/tree_adapter.h index 2bb9da3bc1db087f18ed0ec0ade6e1248ae1f699..12ab4b5e3510accbafe565e30973c0aa6a88767d 100644 --- a/mindspore-lite/minddata/dataset/engine/tree_adapter.h +++ b/mindspore-lite/minddata/dataset/engine/tree_adapter.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/engine/perf/auto_tune.h" #include "mindspore-lite/minddata/dataset/engine/perf/dataset_iterator_tracing.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DatasetNode; class TreeModifier; @@ -186,6 +186,6 @@ class TreeAdapter { nlohmann::json offload_json_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_TREE_ADAPTER_H_ diff --git a/mindspore-lite/minddata/dataset/engine/tree_adapter_lite.cc b/mindspore-lite/minddata/dataset/engine/tree_adapter_lite.cc index b6328d2d4912f47219655626c06fe32e97706a5e..2ba986b46fcac29f43549ad0c6a5a4745e82488c 100644 --- a/mindspore-lite/minddata/dataset/engine/tree_adapter_lite.cc +++ b/mindspore-lite/minddata/dataset/engine/tree_adapter_lite.cc @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/engine/opt/pre/insert_map_pass.h" #include "mindspore-lite/minddata/dataset/engine/opt/pre/node_removal_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { TreeAdapterLite::TreeAdapterLite(UsageFlag usage) : root_(nullptr), usage_(usage) { // Create ExecutionTree. @@ -177,4 +177,4 @@ Status TreeAdapterLite::Compile(const std::shared_ptr &input_ir, in nlohmann::json TreeAdapterLite::GetOffloadJson() { return offload_json_; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/tree_adapter_lite.h b/mindspore-lite/minddata/dataset/engine/tree_adapter_lite.h index af5b61a613f95b5c17690ce1162b2a27524dca1c..0c0aa854a86ed785b57966ebcdee29535725eef4 100644 --- a/mindspore-lite/minddata/dataset/engine/tree_adapter_lite.h +++ b/mindspore-lite/minddata/dataset/engine/tree_adapter_lite.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/engine/ir/datasetops/dataset_node.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TensorRow; @@ -79,6 +79,6 @@ class TreeAdapterLite { }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_TREE_ADAPTER_LITE_H_ diff --git a/mindspore-lite/minddata/dataset/engine/tree_modifier.cc b/mindspore-lite/minddata/dataset/engine/tree_modifier.cc index 111df095c0cbba6025855dda0b2a03f7c3ca11c2..71837d47801edcc846193cec3c46b9519acc7322 100644 --- a/mindspore-lite/minddata/dataset/engine/tree_modifier.cc +++ b/mindspore-lite/minddata/dataset/engine/tree_modifier.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/engine/tree_modifier.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status AutotuneCallback::DSNStepBegin(const CallbackParam &cb_param) { // check if the queue is empty, no need to wait until a change request is ready @@ -67,4 +67,4 @@ Status ChangeNumWorkersRequest::ApplyChange(DatasetOp *op) { TreeModifier::TreeModifier(const TreeAdapter *adapter) : TreeModifier(adapter->tree_.get()) {} } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/engine/tree_modifier.h b/mindspore-lite/minddata/dataset/engine/tree_modifier.h index 332505dcd9facce47410ec6e592df46514668eef..bb7edf549f1ae6e69a7174ef7f22d4bc0756a81d 100644 --- a/mindspore-lite/minddata/dataset/engine/tree_modifier.h +++ b/mindspore-lite/minddata/dataset/engine/tree_modifier.h @@ -29,7 +29,7 @@ constexpr int64_t queue_size = 10; -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DatasetNode; @@ -158,6 +158,6 @@ class TreeModifier { uint64_t num_requests_ = 0; // counter for number of requests received }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_TREE_MODIFIER_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/audio.h b/mindspore-lite/minddata/dataset/include/dataset/audio.h index ddf2315a347131b7e51be6d01d8b7fa56bcac18f..0b51285431c0c59b3b96e349d79461320eab9e0f 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/audio.h +++ b/mindspore-lite/minddata/dataset/include/dataset/audio.h @@ -1,1437 +1,1437 @@ -/** - * Copyright 2021-2024 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_AUDIO_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_AUDIO_H_ - -#include -#include -#include -#include -#include -#include - -#include "include/api/dual_abi_helper.h" -#include "include/api/status.h" -#include "include/api/visible.h" -#include "include/dataset/constants.h" -#include "include/dataset/transforms.h" - -namespace mindspore { -namespace dataset { -class TensorOperation; - -// Transform operations for performing computer audio. -namespace audio { -/// \brief Compute the angle of complex tensor input. -class DATASET_API Angle final : public TensorTransform { - public: - /// \brief Constructor. - Angle(); - - /// \brief Destructor. - ~Angle() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; -}; - -/// \brief Design two-pole allpass filter. Similar to SoX implementation. -class DATASET_API AllpassBiquad final : public TensorTransform { - public: - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] central_freq Central frequency (in Hz). - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - explicit AllpassBiquad(int32_t sample_rate, float central_freq, float Q = 0.707); - - /// \brief Destructor. - ~AllpassBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief AmplitudeToDB TensorTransform. -/// \notes Turn a tensor from the power/amplitude scale to the decibel scale. -class DATASET_API AmplitudeToDB final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] stype Scale of input tensor, must be one of [ScaleType::kPower, ScaleType::kMagnitude]. - /// Default: ScaleType::kPower. - /// \param[in] ref_value Calculate db_multiplier. Default: 1.0. - /// \param[in] amin Minimum threshold for input tensor and ref_value. It must be greater than zero. Default: 1e-10. - /// \param[in] top_db Decibels cut-off value. It must be greater than or equal to zero. Default: 80.0. - explicit AmplitudeToDB(ScaleType stype = ScaleType::kPower, float ref_value = 1.0, float amin = 1e-10, - float top_db = 80.0); - - /// \brief Destructor. - ~AmplitudeToDB() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Design two-pole band filter. -class DATASET_API BandBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] central_freq Central frequency (in Hz). - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - /// \param[in] noise Choose alternate mode for un-pitched audio or mode oriented to pitched audio. Default: False. - explicit BandBiquad(int32_t sample_rate, float central_freq, float Q = 0.707, bool noise = false); - - /// \brief Destructor. - ~BandBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Design two-pole band-pass filter. -class DATASET_API BandpassBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] central_freq Central frequency (in Hz). - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - /// \param[in] const_skirt_gain, If True, uses a constant skirt gain (peak gain = Q). If False, uses a - /// constant 0dB peak gain. Default: False. - explicit BandpassBiquad(int32_t sample_rate, float central_freq, float Q = 0.707, bool const_skirt_gain = false); - - /// \brief Destructor. - ~BandpassBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Design two-pole band-reject filter. Similar to SoX implementation. -class DATASET_API BandrejectBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] central_freq Central frequency (in Hz). - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - explicit BandrejectBiquad(int32_t sample_rate, float central_freq, float Q = 0.707); - - /// \brief Destructor. - ~BandrejectBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Design a bass tone-control effect. -class DATASET_API BassBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] gain Desired gain at the boost (or attenuation) in dB. - /// \param[in] central_freq Central frequency (in Hz). Default: 100.0. - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - explicit BassBiquad(int32_t sample_rate, float gain, float central_freq = 100.0, float Q = 0.707); - - /// \brief Destructor. - ~BassBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Perform a biquad filter of input tensor. -class DATASET_API Biquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] b0 Numerator coefficient of current input, x[n]. - /// \param[in] b1 Numerator coefficient of input one time step ago x[n-1]. - /// \param[in] b2 Numerator coefficient of input two time steps ago x[n-2]. - /// \param[in] a0 Denominator coefficient of current output y[n], the value can't be zero, typically 1. - /// \param[in] a1 Denominator coefficient of current output y[n-1]. - /// \param[in] a2 Denominator coefficient of current output y[n-2]. - explicit Biquad(float b0, float b1, float b2, float a0, float a1, float a2); - - /// \brief Destructor. - ~Biquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief ComplexNorm TensorTransform. -/// \notes Compute the norm of complex tensor input. -class DATASET_API ComplexNorm final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] power Power of the norm, which must be non-negative. Default: 1.0. - explicit ComplexNorm(float power = 1.0); - - /// \brief Destructor. - ~ComplexNorm() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief ComputeDeltas Transform. -/// \note Compute delta coefficients of a spectrogram. -class DATASET_API ComputeDeltas final : public TensorTransform { - public: - /// \brief Construct a new Compute Deltas object. - /// \f[ - /// d_{t}=\frac{{\textstyle\sum_{n=1}^{N}}n(c_{t+n}-c_{t-n})}{2{\textstyle\sum_{n=1}^{N}}n^{2}} - /// \f] - /// \param[in] win_length The window length used for computing delta, must be no less than 3. Default: 5. - /// \param[in] pad_mode Padding mode. Can be one of BorderType::kConstant, BorderType::kEdge, - /// BorderType::kReflect or BorderType::kSymmetric. Default: BorderType::kEdge. - explicit ComputeDeltas(int32_t win_length = 5, BorderType pad_mode = BorderType::kEdge); - - /// \brief Destructor. - ~ComputeDeltas() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Apply contrast effect. -class DATASET_API Contrast final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] enhancement_amount Controls the amount of the enhancement. Default: 75.0. - explicit Contrast(float enhancement_amount = 75.0); - - /// \brief Destructor. - ~Contrast() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Turn a waveform from the decibel scale to the power/amplitude scale. -class DATASET_API DBToAmplitude final : public TensorTransform { - public: - /// \brief Constructor - /// \param[in] ref Reference which the output will be scaled by. - /// \param[in] power If power equals 1, will compute DB to power. If 0.5, will compute DB to amplitude. - explicit DBToAmplitude(float ref, float power); - - /// \brief Destructor. - ~DBToAmplitude() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Apply a DC shift to the audio. -class DATASET_API DCShift : public TensorTransform { - public: - /// \brief Constructor - /// \param[in] shift Indicates the amount to shift the audio, the value must be in the range [-2.0, 2.0]. - /// \param[in] limiter_gain Used only on peaks to prevent clipping. - DCShift(float shift, float limiter_gain); - - /// \brief Constructor - /// \param[in] shift Indicates the amount to shift the audio. - /// \note This constructor will use `shift` as `limiter_gain`. - explicit DCShift(float shift); - - /// \brief Destructor. - ~DCShift() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \param[in] n_mfcc Number of mfc coefficients to retain, the value must be greater than 0. -/// \param[in] n_mels Number of mel filterbanks, the value must be greater than 0. -/// \param[in] norm Norm to use, can be NormMode::kNone or NormMode::kOrtho. -/// \return Status error code, returns OK if no error encountered. -Status CreateDct(mindspore::MSTensor *output, int32_t n_mfcc, int32_t n_mels, NormMode norm = NormMode::kNone); - -/// \brief Design two-pole deemph filter. Similar to SoX implementation. -class DATASET_API DeemphBiquad final : public TensorTransform { - public: - /// \param[in] sample_rate Sampling rate of the waveform, the value can only be 44100 (Hz) or 48000(hz). - explicit DeemphBiquad(int32_t sample_rate); - - /// \brief Destructor. - ~DeemphBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Detect pitch frequency. -class DATASET_API DetectPitchFrequency final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] frame_time Duration of a frame, the value must be greater than zero. Default: 0.02. - /// \param[in] win_length The window length for median smoothing (in number of frames), the value must - /// be greater than zero. Default: 30. - /// \param[in] freq_low Lowest frequency that can be detected (Hz), the value must be greater than zero. Default: 85. - /// \param[in] freq_high Highest frequency that can be detected (Hz), the value must be greater than - /// zero. Default: 3400. - explicit DetectPitchFrequency(int32_t sample_rate, float frame_time = 0.01, int32_t win_length = 30, - int32_t freq_low = 85, int32_t freq_high = 3400); - - /// \brief Destructor. - ~DetectPitchFrequency() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Dither increases the perceived dynamic range of audio stored at a -/// particular bit-depth by eliminating nonlinear truncation distortion. -class DATASET_API Dither final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] density_function The density function of a continuous random variable. - /// Can be one of DensityFunction::kTPDF (Triangular Probability Density Function), - /// DensityFunction::kRPDF (Rectangular Probability Density Function) or - /// DensityFunction::kGPDF (Gaussian Probability Density Function). Default: DensityFunction::kTPDF. - /// \param[in] noise_shaping A filtering process that shapes the spectral energy of - /// quantisation error. Default: false. - explicit Dither(DensityFunction density_function = DensityFunction::kTPDF, bool noise_shaping = false); - - /// \brief Destructor. - ~Dither() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief EqualizerBiquad TensorTransform. Apply highpass biquad filter on audio. -class DATASET_API EqualizerBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] center_freq Filter's central frequency (in Hz). - /// \param[in] gain Desired gain at the boost (or attenuation) in dB. - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - EqualizerBiquad(int32_t sample_rate, float center_freq, float gain, float Q = 0.707); - - /// \brief Destructor. - ~EqualizerBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Add fade in or/and fade out on the input audio. -class DATASET_API Fade final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] fade_in_len Length of fade-in (time frames), which must be non-negative - /// and no more than the length of waveform. Default: 0. - /// \param[in] fade_out_len Length of fade-out (time frames), which must be non-negative - /// and no more than the length of waveform. Default: 0. - /// \param[in] fade_shape An enum for the fade shape. Default: FadeShape::kLinear. - explicit Fade(int32_t fade_in_len = 0, int32_t fade_out_len = 0, FadeShape fade_shape = FadeShape::kLinear); - - /// \brief Destructor. - ~Fade() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Design IIR forward and backward filter. -class DATASET_API Filtfilt final : public TensorTransform { - public: - /// \param[in] a_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). - /// Lower delays coefficients are first, e.g. [a0, a1, a2, ...]. - /// Must be same size as b_coeffs (pad with 0's as necessary). - /// \param[in] b_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). - /// Lower delays coefficients are first, e.g. [b0, b1, b2, ...]. - /// Must be same size as a_coeffs (pad with 0's as necessary). - /// \param[in] clamp If True, clamp the output signal to be in the range [-1, 1]. Default: True. - Filtfilt(const std::vector &a_coeffs, const std::vector &b_coeffs, bool clamp = true); - - /// \brief Destructor. - ~Filtfilt() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Apply a flanger effect to the audio. -class DATASET_API Flanger final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). - /// \param[in] delay Desired delay in milliseconds (ms), range: [0, 30]. Default: 0.0. - /// \param[in] depth Desired delay depth in milliseconds (ms), range: [0, 10]. Default: 2.0. - /// \param[in] regen Desired regen (feedback gain) in dB., range: [-95, 95]. Default: 0.0. - /// \param[in] width Desired width (delay gain) in dB, range: [0, 100]. Default: 71.0. - /// \param[in] speed Modulation speed in Hz, range: [0.1, 10]. Default: 0.5. - /// \param[in] phase Percentage phase-shift for multi-channel, range: [0, 100]. Default: 25.0. - /// \param[in] modulation Modulation of input tensor, must be one of [Modulation::kSinusoidal, - /// Modulation::kTriangular]. Default:Modulation::kSinusoidal. - /// \param[in] interpolation Interpolation of input tensor, must be one of [Interpolation::kLinear, - /// Interpolation::kQuadratic]. Default:Interpolation::kLinear. - explicit Flanger(int32_t sample_rate, float delay = 0.0, float depth = 2.0, float regen = 0.0, float width = 71.0, - float speed = 0.5, float phase = 25.0, Modulation modulation = Modulation::kSinusoidal, - Interpolation interpolation = Interpolation::kLinear); - - /// \brief Destructor. - ~Flanger() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief FrequencyMasking TensorTransform. -/// \notes Apply masking to a spectrogram in the frequency domain. -class DATASET_API FrequencyMasking final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] iid_masks Whether to apply different masks to each example. - /// \param[in] frequency_mask_param Maximum possible length of the mask, range: [0, freq_length]. Default: 0. - /// Indices uniformly sampled from [0, frequency_mask_param]. - /// Mask width when iid_masks=true. - /// \param[in] mask_start Mask start when iid_masks=true, range: [0, freq_length-frequency_mask_param]. Default: 0. - /// \param[in] mask_value Mask value. - explicit FrequencyMasking(bool iid_masks = false, int32_t frequency_mask_param = 0, int32_t mask_start = 0, - float mask_value = 0.0); - - /// \brief Destructor. - ~FrequencyMasking() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Apply amplification or attenuation to the whole waveform. -class DATASET_API Gain final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] gain_db Gain adjustment in decibels (dB). Default: 1.0. - explicit Gain(float gain_db = 1.0); - - /// \brief Destructor. - ~Gain() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Waveform calculation from linear scalar amplitude spectrogram using GriffinLim transform. -class DATASET_API GriffinLim final : public TensorTransform { - public: - /// \brief Constructor. - /// \notes Calculated by formula: - /// x(n)=\frac{\sum_{m=-\infty}^{\infty} w(m S-n) y_{w}(m S, n)}{\sum_{m=-\infty}^{\infty} w^{2}(m S-n)} - /// where w represents the window function, y represents the reconstructed signal of each frame and x represents - /// the whole signal. - /// \param[in] n_fft Size of FFT. Default: 400. - /// \param[in] n_iter Number of iteration for phase recovery. Default: 32. - /// \param[in] win_length Window size for GriffinLim. Default: 0, will be set to n_fft. - /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to win_length / 2. - /// \param[in] window_type Window type for GriffinLim. Default: WindowType::kHann. - /// \param[in] power Exponent for the magnitude spectrogram. Default: 2.0. - /// \param[in] momentum The momentum for fast Griffin-Lim. Default: 0.99. - /// \param[in] length Length of the expected output waveform. Default: 0.0, will be set to the value of last - /// dimension of the stft matrix. - /// \param[in] rand_init Flag for random phase initialization or all-zero phase initialization. Default: true. - explicit GriffinLim(int32_t n_fft = 400, int32_t n_iter = 32, int32_t win_length = 0, int32_t hop_length = 0, - WindowType window_type = WindowType::kHann, float power = 2.0, float momentum = 0.99, - int32_t length = 0, bool rand_init = true); - - /// \brief Destructor. - ~GriffinLim() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief HighpassBiquad TensorTransform. Apply highpass biquad filter on audio. -class DATASET_API HighpassBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] cutoff_freq Filter cutoff frequency (in Hz). - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - HighpassBiquad(int32_t sample_rate, float cutoff_freq, float Q = 0.707); - - /// \brief Destructor. - ~HighpassBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief InverseMelScale TensorTransform -/// \notes Solve for a normal STFT from a mel frequency STFT, using a conversion matrix. -class DATASET_API InverseMelScale final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] n_stft Number of bins in STFT, must be positive. - /// \param[in] n_mels Number of mel filter, must be positive. Default: 128. - /// \param[in] sample_rate Sample rate of the signal, the value can't be zero. Default: 16000. - /// \param[in] f_min Minimum frequency, must be non-negative. Default: 0.0. - /// \param[in] f_max Maximum frequency, must be non-negative. Default: 0.0, will be set to sample_rate / 2. - /// \param[in] max_iter Maximum number of optimization iterations, must be positive. Default: 100000. - /// \param[in] tolerance_loss Value of loss to stop optimization at, must be non-negative. Default: 1e-5. - /// \param[in] tolerance_change Difference in losses to stop optimization at, must be non-negative. Default: 1e-8. - /// \param[in] sgdargs Parameters of SGD optimizer, including lr, momentum. - /// Default: {{"sgd_lr", 0.1}, {"sgd_momentum", 0.0}}. - /// \param[in] norm Type of norm, value should be NormType::kSlaney or NormType::kNone. If norm is NormType::kSlaney, - /// divide the triangle mel weight by the width of the mel band. Default: NormType::kNone. - /// \param[in] mel_type Type of mel, value should be MelType::kHtk or MelType::kSlaney. Default: MelType::kHtk. - explicit InverseMelScale(int32_t n_stft, int32_t n_mels = 128, int32_t sample_rate = 16000, float f_min = 0.0, - float f_max = 0.0, int32_t max_iter = 100000, float tolerance_loss = 1e-5, - float tolerance_change = 1e-8, - const std::map &sgdargs = {{"sgd_lr", 0.1}, {"sgd_momentum", 0.0}}, - NormType norm = NormType::kNone, MelType mel_type = MelType::kHtk); - - /// \brief Destructor. - ~InverseMelScale() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Create an inverse spectrogram to recover an audio signal from a spectrogram. -class DATASET_API InverseSpectrogram final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] length The output length of the waveform. Default: 0, means to output the whole waveform. - /// \param[in] n_fft Size of FFT, creates n_fft // 2 + 1 bins. Default: 400. - /// \param[in] win_length Window size. Default: 0, will be set to `n_fft` . - /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to `win_length // 2` . - /// \param[in] pad Two sided padding of signal. Default: 0. - /// \param[in] window A function to create a window tensor that is applied/multiplied to each frame/window. - /// Default: WindowType::kHann. - /// \param[in] normalized Whether the spectrogram was normalized by magnitude after stft. Default:false. - /// \param[in] center Whether the signal in spectrogram was padded on both sides. Default: true. - /// \param[in] pad_mode Controls the padding method used when center is True. Default: BorderType::kReflect. - /// \param[in] onesided Controls whether spectrogram was used to return half of results to avoid - /// redundancy. Default: true. - explicit InverseSpectrogram(int32_t length = 0, int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, - int32_t pad = 0, WindowType window = WindowType::kHann, bool normalized = false, - bool center = true, BorderType pad_mode = BorderType::kReflect, bool onesided = true); - - /// \brief Destructor. - ~InverseSpectrogram() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Create LFCC for a raw audio signal. -class DATASET_API LFCC final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sample rate of audio signal. Default: 16000. - /// \param[in] n_filter Number of linear filters to apply. Default: 128. - /// \param[in] n_lfcc Number of lfc coefficients to retain. Default: 40. - /// \param[in] f_min Minimum frequency. Default: 0.0. - /// \param[in] f_max Maximum frequency. Default: 0.0, will be set to sample_rate // 2. - /// \param[in] dct_type Type of DCT (discrete cosine transform) to use. Default: 2. - /// \param[in] norm Norm to use. Default: NormMode::kOrtho. - /// \param[in] log_lf Whether to use log-lf spectrograms instead of db-scaled. Default: false. - /// \param[in] n_fft Size of FFT, creates n_fft // 2 + 1 bins. Default: 400. - /// \param[in] win_length Window size. Default: 0, will be set to n_fft. - /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to win_length // 2. - /// \param[in] pad Two sided padding of signal. Default: 0. - /// \param[in] window A function to create a window tensor that is applied/multiplied to - /// each frame/window. Default: WindowType::kHann. - /// \param[in] power Exponent for the magnitude spectrogram, (must be > 0) e.g., 1 for energy, 2 - /// for power, etc. Default: 2.0. - /// \param[in] normalized Whether to normalize by magnitude after stft. Default: false - /// \param[in] center Whether to pad waveform on both sides so that the tt-th frame is centered at - /// time t t*hop_length. Default: true. - /// \param[in] pad_mode Controls the padding method used when center is True. Default: - /// BorderType::kReflect. - /// \param[in] onesided Controls whether to return half of results to avoid - /// redundancy. Default: true. - explicit LFCC(int32_t sample_rate = 16000, int32_t n_filter = 128, int32_t n_lfcc = 40, float f_min = 0.0, - float f_max = 0.0, int32_t dct_type = 2, NormMode norm = NormMode::kOrtho, bool log_lf = false, - int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, int32_t pad = 0, - WindowType window = WindowType::kHann, float power = 2.0, bool normalized = false, bool center = true, - BorderType pad_mode = BorderType::kReflect, bool onesided = true); - - /// \brief Destructor. - ~LFCC() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Design filter. Similar to SoX implementation. -class DATASET_API LFilter final : public TensorTransform { - public: - /// \param[in] a_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). - /// Lower delays coefficients are first, e.g. [a0, a1, a2, ...]. - /// Must be same size as b_coeffs (pad with 0's as necessary). - /// \param[in] b_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). - /// Lower delays coefficients are first, e.g. [b0, b1, b2, ...]. - /// Must be same size as a_coeffs (pad with 0's as necessary). - /// \param[in] clamp If True, clamp the output signal to be in the range [-1, 1]. Default: True. - explicit LFilter(const std::vector &a_coeffs, const std::vector &b_coeffs, bool clamp = true); - - /// \brief Destructor. - ~LFilter() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Creates a linear triangular filterbank. -/// \param output Tensor of a linear triangular filterbank. -/// \param n_freqs: Number of frequency. -/// \param f_min: Minimum of frequency in Hz. -/// \param f_max: Maximum of frequency in Hz. -/// \param n_filter: Number of (linear) triangular filter. -/// \param sample_rate: Sample rate. -/// \return Status code. -Status DATASET_API LinearFbanks(MSTensor *output, int32_t n_freqs, float f_min, float f_max, int32_t n_filter, - int32_t sample_rate); - -/// \brief Design biquad lowpass filter and perform filtering. Similar to SoX implementation. -class DATASET_API LowpassBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] cutoff_freq Filter cutoff frequency. - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - LowpassBiquad(int32_t sample_rate, float cutoff_freq, float Q = 0.707); - - /// \brief Destructor. - ~LowpassBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Separate a complex-valued spectrogram with shape (..., 2) into its magnitude and phase. -class DATASET_API Magphase final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] power Power of the norm, which must be non-negative. Default: 1.0. - explicit Magphase(float power); - - /// \brief Destructor. - ~Magphase() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief MaskAlongAxis TensorTransform. -/// \note Tensor operation to mask the input tensor along axis. -class MaskAlongAxis final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] mask_start Starting position of the mask, which must be non negative. - /// \param[in] mask_width The width of the mask, which must be positive. - /// \param[in] mask_value Value to assign to the masked columns. - /// \param[in] axis Axis to apply masking on (1 for frequency and 2 for time). - MaskAlongAxis(int32_t mask_start, int32_t mask_width, float mask_value, int32_t axis); - - /// \brief Destructor. - ~MaskAlongAxis() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief MaskAlongAxisIID TensorTransform. -/// \note Apply a mask along axis. -class MaskAlongAxisIID final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] mask_param Number of columns to be masked, will be uniformly sampled from [0, mask_param], - /// must be non negative. - /// \param[in] mask_value Value to assign to the masked columns. - /// \param[in] axis Axis to apply masking on (1 for frequency and 2 for time). - MaskAlongAxisIID(int32_t mask_param, float mask_value, int32_t axis); - - /// \brief Destructor. - ~MaskAlongAxisIID() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief MelScale TensorTransform. -/// \notes Convert normal STFT to STFT at the Mel scale. -class DATASET_API MelScale final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] n_mels Number of mel filter, which must be positive. Default: 128. - /// \param[in] sample_rate Sample rate of the signal, the value can't be zero. Default: 16000. - /// \param[in] f_min Minimum frequency, which must be non negative. Default: 0.0. - /// \param[in] f_max Maximum frequency, which must be positive. Default: 0.0, will be set to sample_rate / 2. - /// \param[in] n_stft Number of bins in STFT, which must be positive. Default: 201. - /// \param[in] norm Type of norm, value should be NormType::kSlaney or NormType::kNone. If norm is NormType::kSlaney, - /// divide the triangle mel weight by the width of the mel band. Default: NormType::kNone. - /// \param[in] mel_type Type of mel, value should be MelType::kHtk or MelType::kSlaney. Default: MelType::kHtk. - explicit MelScale(int32_t n_mels = 128, int32_t sample_rate = 16000, float f_min = 0.0, float f_max = 0.0, - int32_t n_stft = 201, NormType norm = NormType::kNone, MelType mel_type = MelType::kHtk); - - /// \brief Destructor. - ~MelScale() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Create a frequency transformation matrix with shape (n_freqs, n_mels). -/// \param[in] output Tensor of the frequency transformation matrix. -/// \param[in] n_freqs Number of frequencies to highlight/apply. -/// \param[in] f_min Minimum frequency (Hz). -/// \param[in] f_max Maximum frequency (Hz). -/// \param[in] n_mels Number of mel filterbanks. -/// \param[in] sample_rate Sample rate of the audio waveform. -/// \param[in] norm Norm to use, can be NormType::kNone or NormType::kSlaney. Default: NormType::kNone. -/// \param[in] mel_type Scale to use, can be MelType::kHtk or MelType::kSlaney. Default: MelType::kHtz. -/// \return Status code. -Status DATASET_API MelscaleFbanks(MSTensor *output, int32_t n_freqs, float f_min, float f_max, int32_t n_mels, - int32_t sample_rate, NormType norm = NormType::kNone, - MelType mel_type = MelType::kHtk); - -/// \brief Create MelSpectrogram for a raw audio signal. -class DATASET_API MelSpectrogram final : public TensorTransform { - public: - /// \param[in] sample_rate Sample rate of audio signal. Default: 16000. - /// \param[in] n_fft Size of FFT, creates `n_fft // 2 + 1` bins. Default: 400. - /// \param[in] win_length Window size. Default: 0, will be set to `n_fft` . - /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to `win_length // 2` . - /// \param[in] f_min Minimum frequency. Default: 0.0. - /// \param[in] f_max Maximum frequency. Default: 0.0. - /// \param[in] pad Two sided padding of signal. Default: 0. - /// \param[in] n_mels Number of mel filterbanks. Default: 128. - /// \param[in] window A function to create a window tensor that is applied/multiplied to each frame/window. - /// Default: WindowType::kHann. - /// \param[in] power Exponent for the magnitude spectrogram, (must be > 0) e.g., 1 for energy, 2 for power, etc. - /// Default: 2.0. - /// \param[in] normalized Whether to normalize by magnitude after stft Default: false. - /// \param[in] center Whether to pad waveform on both sides. Default: true. - /// \param[in] pad_mode Controls the padding method used when center is True. Default: BorderType::kReflect. - /// \param[in] onesided Controls whether to return half of results to avoid redundancy. Default: true. - /// \param[in] norm If 'slaney', divide the triangular mel weights by the width of the mel band (area normalization). - /// Default: NormType::kNone. - /// \param[in] mel_scale Scale to use: htk or slaney. Default: MelType::kHtk. - explicit MelSpectrogram(int32_t sample_rate = 16000, int32_t n_fft = 400, int32_t win_length = 0, - int32_t hop_length = 0, float f_min = 0.0, float f_max = 0.0, int32_t pad = 0, - int32_t n_mels = 128, WindowType window = WindowType::kHann, float power = 2.0, - bool normalized = false, bool center = true, BorderType pad_mode = BorderType::kReflect, - bool onesided = true, NormType norm = NormType::kNone, MelType mel_scale = MelType::kHtk); - - /// \brief Destructor. - ~MelSpectrogram() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Create MFCC for a raw audio signal. -class DATASET_API MFCC final : public TensorTransform { - public: - /// \param[in] sample_rate Sample rate of audio signal. Default: 16000. - /// \param[in] n_mfcc Number of mfc coefficients to retain. Default: 40. - /// \param[in] dct_type Type of DCT (discrete cosine transform) to use. Default: 2. - /// \param[in] norm If 'slaney', divide the triangular mel weights by the width of the mel band (area normalization). - /// Default: NormMode::kOrtho. - /// \param[in] log_mels Whether to use log-mel spectrograms instead of db-scaled. Default: false. - /// \param[in] n_fft Size of FFT, creates n_fft // 2 + 1 bins. Default: 400. - /// \param[in] win_length Window size. Default: 0. - /// \param[in] hop_length Length of hop between STFT windows. Default: 0. - /// \param[in] f_min Minimum frequency. Default: 0.0. - /// \param[in] f_max Maximum frequency. Default: 0.0. - /// \param[in] pad Two sided padding of signal. Default: 0. - /// \param[in] n_mels Number of mel filterbanks. Default: 128. - /// \param[in] window A function to create a window tensor that is applied/multiplied to each frame/window. - /// Default: WindowType::kHann. - /// \param[in] power Exponent for the magnitude spectrogram, (must be > 0) e.g., 1 for energy, 2 for power, etc. - /// Default: 2.0. - /// \param[in] normalized Whether to normalize by magnitude after stft. Default: false. - /// \param[in] center Whether to pad waveform on both sides. Default: true. - /// \param[in] pad_mode Controls the padding method used when center is True. Default: BorderType::kReflect. - /// \param[in] onesided Controls whether to return half of results to avoid redundancy. Default: true. - /// \param[in] norm_mel Norm to use. Default: NormType::kNone. - /// \param[in] mel_scale Scale to use: htk or slaney. Default: MelType::kHtk. - explicit MFCC(int32_t sample_rate = 16000, int32_t n_mfcc = 40, int32_t dct_type = 2, - NormMode norm = NormMode::kOrtho, bool log_mels = false, int32_t n_fft = 400, int32_t win_length = 0, - int32_t hop_length = 0, float f_min = 0.0, float f_max = 0.0, int32_t pad = 0, int32_t n_mels = 128, - WindowType window = WindowType::kHann, float power = 2.0, bool normalized = false, bool center = true, - BorderType pad_mode = BorderType::kReflect, bool onesided = true, NormType norm_mel = NormType::kNone, - MelType mel_scale = MelType::kHtk); - - /// \brief Destructor. - ~MFCC() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief MuLawDecoding TensorTransform. -/// \note Decode mu-law encoded signal. -class DATASET_API MuLawDecoding final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] quantization_channels Number of channels, which must be positive. Default: 256. - explicit MuLawDecoding(int32_t quantization_channels = 256); - - /// \brief Destructor. - ~MuLawDecoding() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief MuLawEncoding TensorTransform. -/// \note Encode signal based on mu-law companding. -class DATASET_API MuLawEncoding final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] quantization_channels Number of channels, which must be positive. Default: 256. - explicit MuLawEncoding(int32_t quantization_channels = 256); - - /// \brief Destructor. - ~MuLawEncoding() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Overdrive TensorTransform. -class DATASET_API Overdrive final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] gain Coefficient of overload in dB, in range of [0, 100]. Default: 20.0. - /// \param[in] color Coefficient of translation, in range of [0, 100]. Default: 20.0. - explicit Overdrive(float gain = 20.0, float color = 20.0); - - /// \brief Destructor. - ~Overdrive() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Phaser TensorTransform. -class DATASET_API Phaser final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). - /// \param[in] gain_in Desired input gain at the boost (or attenuation) in dB. - /// Allowed range of values is [0, 1]. Default: 0.4. - /// \param[in] gain_out Desired output gain at the boost (or attenuation) in dB. - /// Allowed range of values is [0, 1e9]. Default: 0.74. - /// \param[in] delay_ms Desired delay in milli seconds. Allowed range of values is [0, 5]. Default: 3.0. - /// \param[in] decay Desired decay relative to gain-in. Allowed range of values is [0, 0.99]. Default: 0.4. - /// \param[in] mod_speed Modulation speed in Hz. Allowed range of values is [0.1, 2]. Default: 0.5. - /// \param[in] sinusoidal If true, use sinusoidal modulation (preferable for multiple instruments). - /// If false, use triangular modulation (gives single instruments a sharper phasing effect). Default: true. - explicit Phaser(int32_t sample_rate, float gain_in = 0.4, float gain_out = 0.74, float delay_ms = 3.0, - float decay = 0.4, float mod_speed = 0.5, bool sinusoidal = true); - - /// \brief Destructor. - ~Phaser() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief PhaseVocoder TensorTransform -/// \notes Given a STFT tensor, speed up in time without modifying pitch by factor of rate. -class DATASET_API PhaseVocoder final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] rate Speed-up factor. - /// \param[in] phase_advance Expected phase advance in each bin in shape of (freq, 1). - PhaseVocoder(float rate, const MSTensor &phase_advance); - - /// \brief Destructor. - ~PhaseVocoder() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -// \brief Shift the pitch of a waveform by 'n_steps' steps. -class DATASET_API PitchShift final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of "waveform". Default: 0. - /// \param[in] n_steps The (fractional) steps to shift "waveform". Default: 0. - /// \param[in] bins_per_octave The number of steps per octave. Default: 12. - /// \param[in] n_fft Size of FFT, creates "n_fft // 2 + 1" bins. Default: 512. - /// \param[in] win_length Window size. Default: 0, will be set to `n_fft` . - /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to `win_length // 4` . - /// \param[in] window Window tensor that is applied/multiplied to each frame/window. Default: WindowType::kHann. - explicit PitchShift(int32_t sample_rate = 0, int32_t n_steps = 0, int32_t bins_per_octave = 12, int32_t n_fft = 512, - int32_t win_length = 0, int32_t hop_length = 0, WindowType window = WindowType::kHann); - - /// \brief Destructor. - ~PitchShift() override = default; - - protected: - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Resample TensorTransform. -/// \notes Resample a signal from one frequency to another. A sampling method can be given. -class DATASET_API Resample : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] orig_freq The original frequency of the signal, which must be positive. Default: 16000.0. - /// \param[in] new_freq The desired frequency, which must be positive. Default: 16000.0. - /// \param[in] resample_method The resampling method, which can be ResampleMethod::kSincInterpolation - /// and ResampleMethod::kKaiserWindow. Default: ResampleMethod::kSincInterpolation. - /// \param[in] lowpass_filter_width Controls the sharpness of the filter, more means sharper but less efficient, - /// which must be positive. Default: 6. - /// \param[in] rolloff The roll-off frequency of the filter, as a fraction of the Nyquist. Lower values - /// reduce anti-aliasing, but also reduce some of the highest frequencies, range: (0, 1]. Default: 0.99. - /// \param[in] beta The shape parameter used for kaiser window. Default: 14.769656459379492. - explicit Resample(float orig_freq = 16000.0, float new_freq = 16000.0, - ResampleMethod resample_method = ResampleMethod::kSincInterpolation, - int32_t lowpass_filter_width = 6, float rolloff = 0.99, float beta = 14.769656459379492); - - /// \brief Destructor. - ~Resample() override = default; - - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Apply RIAA vinyl playback equalization. -class DATASET_API RiaaBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), - /// can only be one of 44100, 48000, 88200, 96000. - explicit RiaaBiquad(int32_t sample_rate); - - /// \brief Destructor. - ~RiaaBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Apply sliding-window cepstral mean (and optionally variance) normalization per utterance. -class DATASET_API SlidingWindowCmn final : public TensorTransform { - public: - /// \brief Constructor of SlidingWindowCmnOp. - /// \param[in] cmn_window The window in frames for running average CMN computation. Default: 600. - /// \param[in] min_cmn_window The minimum CMN window. Only applicable if center is false, ignored if center - /// is true. Default: 100. - /// \param[in] center If true, use a window centered on the current frame. If false, window is to the left. - /// Default: false. - /// \param[in] norm_vars If true, normalize variance to one. Default: false. - explicit SlidingWindowCmn(int32_t cmn_window = 600, int32_t min_cmn_window = 100, bool center = false, - bool norm_vars = false); - - /// \brief Destructor. - ~SlidingWindowCmn() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Create a spectral centroid from an audio signal. -class DATASET_API SpectralCentroid : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). - /// \param[in] n_fft Size of FFT, creates n_fft / 2 + 1 bins. Default: 400. - /// \param[in] win_length Window size. Default: 0, will use n_fft. - /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will use win_length / 2. - /// \param[in] pad Two sided padding of signal. Default: 0. - /// \param[in] window Window function that is applied/multiplied to each frame/window, - /// which can be WindowType::kBartlett, WindowType::kBlackman, WindowType::kHamming, - /// WindowType::kHann or WindowType::kKaiser. Default: WindowType::kHann. - explicit SpectralCentroid(int32_t sample_rate, int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, - int32_t pad = 0, WindowType window = WindowType::kHann); - - ~SpectralCentroid() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - int32_t sample_rate_; - int32_t n_fft_; - int32_t win_length_; - int32_t hop_length_; - int32_t pad_; - WindowType window_; - struct Data; - std::shared_ptr data_; -}; - -/// \brief Create a spectrogram from an audio signal. -class DATASET_API Spectrogram : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] n_fft Size of FFT, creates n_fft / 2 + 1 bins. Default: 400. - /// \param[in] win_length Window size. Default: 0, will use n_fft. - /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will use win_length / 2. - /// \param[in] pad Two sided padding of signal. Default: 0. - /// \param[in] window Window function that is applied/multiplied to each frame/window, - /// which can be WindowType::kBartlett, WindowType::kBlackman, WindowType::kHamming, - /// WindowType::kHann or WindowType::kKaiser. Default: WindowType::kHann. - /// \param[in] power Exponent for the magnitude spectrogram, which must be greater than or equal to 0. Default: 2.0. - /// \param[in] normalized Whether to normalize by magnitude after stft. Default: false. - /// \param[in] center Whether to pad waveform on both sides. Default: true. - /// \param[in] pad_mode Controls the padding method used when center is true, - /// which can be BorderType::kReflect, BorderType::kConstant, BorderType::kEdge, - /// BorderType::kSymmetric. Default: BorderType::kReflect. - /// \param[in] onesided Controls whether to return half of results to avoid redundancy. Default: true. - explicit Spectrogram(int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, int32_t pad = 0, - WindowType window = WindowType::kHann, float power = 2.0, bool normalized = false, - bool center = true, BorderType pad_mode = BorderType::kReflect, bool onesided = true); - - /// \brief Destructor. - ~Spectrogram() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - int32_t n_fft_; - int32_t win_length_; - int32_t hop_length_; - int32_t pad_; - WindowType window_; - float power_; - bool normalized_; - bool center_; - BorderType pad_mode_; - bool onesided_; - struct Data; - std::shared_ptr data_; -}; - -/// \brief TimeMasking TensorTransform. -/// \notes Apply masking to a spectrogram in the time domain. -class DATASET_API TimeMasking final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] iid_masks Whether to apply different masks to each example. - /// \param[in] time_mask_param Maximum possible length of the mask, range: [0, time_length]. Default: 0. - /// Indices uniformly sampled from [0, time_mask_param]. - /// Mask width when iid_masks=true. - /// \param[in] mask_start Mask start when iid_masks=true, range: [0, time_length-time_mask_param]. Default: 0. - /// \param[in] mask_value Mask value. - explicit TimeMasking(bool iid_masks = false, int32_t time_mask_param = 0, int32_t mask_start = 0, - float mask_value = 0.0); - - /// \brief Destructor. - ~TimeMasking() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief TimeStretch TensorTransform -/// \notes Stretch STFT in time at a given rate, without changing the pitch. -class DATASET_API TimeStretch final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] hop_length Length of hop between STFT windows. Default: None, will use ((n_freq - 1) * 2) // 2. - /// \param[in] n_freq Number of filter banks form STFT. Default: 201. - /// \param[in] fixed_rate Rate to speed up or slow down the input in time. - /// Default: std::numeric_limits::quiet_NaN(), will keep the original rate. - explicit TimeStretch(float hop_length = std::numeric_limits::quiet_NaN(), int n_freq = 201, - float fixed_rate = std::numeric_limits::quiet_NaN()); - - /// \brief Destructor. - ~TimeStretch() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Design a treble tone-control effect. -class DATASET_API TrebleBiquad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. - /// \param[in] gain Desired gain at the boost (or attenuation) in dB. - /// \param[in] central_freq Central frequency (in Hz). Default: 3000.0. - /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. - TrebleBiquad(int32_t sample_rate, float gain, float central_freq = 3000.0, float Q = 0.707); - - /// \brief Destructor. - ~TrebleBiquad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Vad TensorTransform. -/// \notes Attempt to trim silent background sounds from the end of the voice recording. -class DATASET_API Vad final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] sample_rate Sample rate of audio signal. - /// \param[in] trigger_level The measurement level used to trigger activity detection. Default: 7.0. - /// \param[in] trigger_time The time constant (in seconds) used to help ignore short sounds. Default: 0.25. - /// \param[in] search_time The amount of audio (in seconds) to search for quieter/shorter sounds to include prior to - /// the detected trigger point. Default: 1.0. - /// \param[in] allowed_gap The allowed gap (in seconds) between quiteter/shorter sounds to include prior to the - /// detected trigger point. Default: 0.25. - /// \param[in] pre_trigger_time The amount of audio (in seconds) to preserve before the trigger point and any found - /// quieter/shorter bursts. Default: 0.0. - /// \param[in] boot_time The time for the initial noise estimate. Default: 0.35. - /// \param[in] noise_up_time Time constant used by the adaptive noise estimator, when the noise level is increasing. - /// Default: 0.1. - /// \param[in] noise_down_time Time constant used by the adaptive noise estimator, when the noise level is decreasing. - /// Default: 0.01. - /// \param[in] noise_reduction_amount The amount of noise reduction used in the detection algorithm. Default: 1.35. - /// \param[in] measure_freq The frequency of the algorithm’s processing. Default: 20.0. - /// \param[in] measure_duration The duration of measurement. Default: 0, use twice the measurement period. - /// \param[in] measure_smooth_time The time constant used to smooth spectral measurements. Default: 0.4. - /// \param[in] hp_filter_freq The "Brick-wall" frequency of high-pass filter applied at the input to the detector - /// algorithm. Default: 50.0. - /// \param[in] lp_filter_freq The "Brick-wall" frequency of low-pass filter applied at the input to the detector - /// algorithm. Default: 6000.0. - /// \param[in] hp_lifter_freq The "Brick-wall" frequency of high-pass lifter applied at the input to the detector - /// algorithm. Default: 150.0. - /// \param[in] lp_lifter_freq The "Brick-wall" frequency of low-pass lifter applied at the input to the detector - /// algorithm. Default: 2000.0. - explicit Vad(int32_t sample_rate, float trigger_level = 7.0, float trigger_time = 0.25, float search_time = 1.0, - float allowed_gap = 0.25, float pre_trigger_time = 0.0, float boot_time = 0.35, - float noise_up_time = 0.1, float noise_down_time = 0.01, float noise_reduction_amount = 1.35, - float measure_freq = 20.0, float measure_duration = 0.0, float measure_smooth_time = 0.4, - float hp_filter_freq = 50.0, float lp_filter_freq = 6000.0, float hp_lifter_freq = 150.0, - float lp_lifter_freq = 2000.0); - - /// \brief Destructor. - ~Vad() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; - -/// \brief Vol TensorTransform. -/// \notes Add a volume to an waveform. -class DATASET_API Vol final : public TensorTransform { - public: - /// \brief Constructor. - /// \param[in] gain Gain value, varies according to the value of gain_type. If gain_type is GainType::kAmplitude, - /// gain must be greater than or equal to zero. If gain_type is GainType::kPower, gain must be greater than zero. - /// If gain_type is GainType::kDb, there is no limit for gain. - /// \param[in] gain_type Type of gain, should be one of [GainType::kAmplitude, GainType::kDb, GainType::kPower]. - explicit Vol(float gain, GainType gain_type = GainType::kAmplitude); - - /// \brief Destructor. - ~Vol() override = default; - - protected: - /// \brief Function to convert TensorTransform object into a TensorOperation object. - /// \return Shared pointer to TensorOperation object. - std::shared_ptr Parse() override; - - private: - struct Data; - std::shared_ptr data_; -}; -} // namespace audio -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_AUDIO_H_ +/** + * Copyright 2021-2024 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_AUDIO_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_AUDIO_H_ + +#include +#include +#include +#include +#include +#include + +#include "include/api/dual_abi_helper.h" +#include "include/api/status.h" +#include "include/api/visible.h" +#include "include/dataset/constants.h" +#include "include/dataset/transforms.h" + +namespace mindspore::lite { +namespace dataset { +class TensorOperation; + +// Transform operations for performing computer audio. +namespace audio { +/// \brief Compute the angle of complex tensor input. +class DATASET_API Angle final : public TensorTransform { + public: + /// \brief Constructor. + Angle(); + + /// \brief Destructor. + ~Angle() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; +}; + +/// \brief Design two-pole allpass filter. Similar to SoX implementation. +class DATASET_API AllpassBiquad final : public TensorTransform { + public: + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] central_freq Central frequency (in Hz). + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + explicit AllpassBiquad(int32_t sample_rate, float central_freq, float Q = 0.707); + + /// \brief Destructor. + ~AllpassBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief AmplitudeToDB TensorTransform. +/// \notes Turn a tensor from the power/amplitude scale to the decibel scale. +class DATASET_API AmplitudeToDB final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] stype Scale of input tensor, must be one of [ScaleType::kPower, ScaleType::kMagnitude]. + /// Default: ScaleType::kPower. + /// \param[in] ref_value Calculate db_multiplier. Default: 1.0. + /// \param[in] amin Minimum threshold for input tensor and ref_value. It must be greater than zero. Default: 1e-10. + /// \param[in] top_db Decibels cut-off value. It must be greater than or equal to zero. Default: 80.0. + explicit AmplitudeToDB(ScaleType stype = ScaleType::kPower, float ref_value = 1.0, float amin = 1e-10, + float top_db = 80.0); + + /// \brief Destructor. + ~AmplitudeToDB() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Design two-pole band filter. +class DATASET_API BandBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] central_freq Central frequency (in Hz). + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + /// \param[in] noise Choose alternate mode for un-pitched audio or mode oriented to pitched audio. Default: False. + explicit BandBiquad(int32_t sample_rate, float central_freq, float Q = 0.707, bool noise = false); + + /// \brief Destructor. + ~BandBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Design two-pole band-pass filter. +class DATASET_API BandpassBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] central_freq Central frequency (in Hz). + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + /// \param[in] const_skirt_gain, If True, uses a constant skirt gain (peak gain = Q). If False, uses a + /// constant 0dB peak gain. Default: False. + explicit BandpassBiquad(int32_t sample_rate, float central_freq, float Q = 0.707, bool const_skirt_gain = false); + + /// \brief Destructor. + ~BandpassBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Design two-pole band-reject filter. Similar to SoX implementation. +class DATASET_API BandrejectBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] central_freq Central frequency (in Hz). + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + explicit BandrejectBiquad(int32_t sample_rate, float central_freq, float Q = 0.707); + + /// \brief Destructor. + ~BandrejectBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Design a bass tone-control effect. +class DATASET_API BassBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] gain Desired gain at the boost (or attenuation) in dB. + /// \param[in] central_freq Central frequency (in Hz). Default: 100.0. + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + explicit BassBiquad(int32_t sample_rate, float gain, float central_freq = 100.0, float Q = 0.707); + + /// \brief Destructor. + ~BassBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Perform a biquad filter of input tensor. +class DATASET_API Biquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] b0 Numerator coefficient of current input, x[n]. + /// \param[in] b1 Numerator coefficient of input one time step ago x[n-1]. + /// \param[in] b2 Numerator coefficient of input two time steps ago x[n-2]. + /// \param[in] a0 Denominator coefficient of current output y[n], the value can't be zero, typically 1. + /// \param[in] a1 Denominator coefficient of current output y[n-1]. + /// \param[in] a2 Denominator coefficient of current output y[n-2]. + explicit Biquad(float b0, float b1, float b2, float a0, float a1, float a2); + + /// \brief Destructor. + ~Biquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief ComplexNorm TensorTransform. +/// \notes Compute the norm of complex tensor input. +class DATASET_API ComplexNorm final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] power Power of the norm, which must be non-negative. Default: 1.0. + explicit ComplexNorm(float power = 1.0); + + /// \brief Destructor. + ~ComplexNorm() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief ComputeDeltas Transform. +/// \note Compute delta coefficients of a spectrogram. +class DATASET_API ComputeDeltas final : public TensorTransform { + public: + /// \brief Construct a new Compute Deltas object. + /// \f[ + /// d_{t}=\frac{{\textstyle\sum_{n=1}^{N}}n(c_{t+n}-c_{t-n})}{2{\textstyle\sum_{n=1}^{N}}n^{2}} + /// \f] + /// \param[in] win_length The window length used for computing delta, must be no less than 3. Default: 5. + /// \param[in] pad_mode Padding mode. Can be one of BorderType::kConstant, BorderType::kEdge, + /// BorderType::kReflect or BorderType::kSymmetric. Default: BorderType::kEdge. + explicit ComputeDeltas(int32_t win_length = 5, BorderType pad_mode = BorderType::kEdge); + + /// \brief Destructor. + ~ComputeDeltas() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Apply contrast effect. +class DATASET_API Contrast final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] enhancement_amount Controls the amount of the enhancement. Default: 75.0. + explicit Contrast(float enhancement_amount = 75.0); + + /// \brief Destructor. + ~Contrast() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Turn a waveform from the decibel scale to the power/amplitude scale. +class DATASET_API DBToAmplitude final : public TensorTransform { + public: + /// \brief Constructor + /// \param[in] ref Reference which the output will be scaled by. + /// \param[in] power If power equals 1, will compute DB to power. If 0.5, will compute DB to amplitude. + explicit DBToAmplitude(float ref, float power); + + /// \brief Destructor. + ~DBToAmplitude() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Apply a DC shift to the audio. +class DATASET_API DCShift : public TensorTransform { + public: + /// \brief Constructor + /// \param[in] shift Indicates the amount to shift the audio, the value must be in the range [-2.0, 2.0]. + /// \param[in] limiter_gain Used only on peaks to prevent clipping. + DCShift(float shift, float limiter_gain); + + /// \brief Constructor + /// \param[in] shift Indicates the amount to shift the audio. + /// \note This constructor will use `shift` as `limiter_gain`. + explicit DCShift(float shift); + + /// \brief Destructor. + ~DCShift() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \param[in] n_mfcc Number of mfc coefficients to retain, the value must be greater than 0. +/// \param[in] n_mels Number of mel filterbanks, the value must be greater than 0. +/// \param[in] norm Norm to use, can be NormMode::kNone or NormMode::kOrtho. +/// \return Status error code, returns OK if no error encountered. +Status CreateDct(mindspore::MSTensor *output, int32_t n_mfcc, int32_t n_mels, NormMode norm = NormMode::kNone); + +/// \brief Design two-pole deemph filter. Similar to SoX implementation. +class DATASET_API DeemphBiquad final : public TensorTransform { + public: + /// \param[in] sample_rate Sampling rate of the waveform, the value can only be 44100 (Hz) or 48000(hz). + explicit DeemphBiquad(int32_t sample_rate); + + /// \brief Destructor. + ~DeemphBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Detect pitch frequency. +class DATASET_API DetectPitchFrequency final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] frame_time Duration of a frame, the value must be greater than zero. Default: 0.02. + /// \param[in] win_length The window length for median smoothing (in number of frames), the value must + /// be greater than zero. Default: 30. + /// \param[in] freq_low Lowest frequency that can be detected (Hz), the value must be greater than zero. Default: 85. + /// \param[in] freq_high Highest frequency that can be detected (Hz), the value must be greater than + /// zero. Default: 3400. + explicit DetectPitchFrequency(int32_t sample_rate, float frame_time = 0.01, int32_t win_length = 30, + int32_t freq_low = 85, int32_t freq_high = 3400); + + /// \brief Destructor. + ~DetectPitchFrequency() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Dither increases the perceived dynamic range of audio stored at a +/// particular bit-depth by eliminating nonlinear truncation distortion. +class DATASET_API Dither final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] density_function The density function of a continuous random variable. + /// Can be one of DensityFunction::kTPDF (Triangular Probability Density Function), + /// DensityFunction::kRPDF (Rectangular Probability Density Function) or + /// DensityFunction::kGPDF (Gaussian Probability Density Function). Default: DensityFunction::kTPDF. + /// \param[in] noise_shaping A filtering process that shapes the spectral energy of + /// quantisation error. Default: false. + explicit Dither(DensityFunction density_function = DensityFunction::kTPDF, bool noise_shaping = false); + + /// \brief Destructor. + ~Dither() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief EqualizerBiquad TensorTransform. Apply highpass biquad filter on audio. +class DATASET_API EqualizerBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] center_freq Filter's central frequency (in Hz). + /// \param[in] gain Desired gain at the boost (or attenuation) in dB. + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + EqualizerBiquad(int32_t sample_rate, float center_freq, float gain, float Q = 0.707); + + /// \brief Destructor. + ~EqualizerBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Add fade in or/and fade out on the input audio. +class DATASET_API Fade final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] fade_in_len Length of fade-in (time frames), which must be non-negative + /// and no more than the length of waveform. Default: 0. + /// \param[in] fade_out_len Length of fade-out (time frames), which must be non-negative + /// and no more than the length of waveform. Default: 0. + /// \param[in] fade_shape An enum for the fade shape. Default: FadeShape::kLinear. + explicit Fade(int32_t fade_in_len = 0, int32_t fade_out_len = 0, FadeShape fade_shape = FadeShape::kLinear); + + /// \brief Destructor. + ~Fade() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Design IIR forward and backward filter. +class DATASET_API Filtfilt final : public TensorTransform { + public: + /// \param[in] a_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). + /// Lower delays coefficients are first, e.g. [a0, a1, a2, ...]. + /// Must be same size as b_coeffs (pad with 0's as necessary). + /// \param[in] b_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). + /// Lower delays coefficients are first, e.g. [b0, b1, b2, ...]. + /// Must be same size as a_coeffs (pad with 0's as necessary). + /// \param[in] clamp If True, clamp the output signal to be in the range [-1, 1]. Default: True. + Filtfilt(const std::vector &a_coeffs, const std::vector &b_coeffs, bool clamp = true); + + /// \brief Destructor. + ~Filtfilt() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Apply a flanger effect to the audio. +class DATASET_API Flanger final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). + /// \param[in] delay Desired delay in milliseconds (ms), range: [0, 30]. Default: 0.0. + /// \param[in] depth Desired delay depth in milliseconds (ms), range: [0, 10]. Default: 2.0. + /// \param[in] regen Desired regen (feedback gain) in dB., range: [-95, 95]. Default: 0.0. + /// \param[in] width Desired width (delay gain) in dB, range: [0, 100]. Default: 71.0. + /// \param[in] speed Modulation speed in Hz, range: [0.1, 10]. Default: 0.5. + /// \param[in] phase Percentage phase-shift for multi-channel, range: [0, 100]. Default: 25.0. + /// \param[in] modulation Modulation of input tensor, must be one of [Modulation::kSinusoidal, + /// Modulation::kTriangular]. Default:Modulation::kSinusoidal. + /// \param[in] interpolation Interpolation of input tensor, must be one of [Interpolation::kLinear, + /// Interpolation::kQuadratic]. Default:Interpolation::kLinear. + explicit Flanger(int32_t sample_rate, float delay = 0.0, float depth = 2.0, float regen = 0.0, float width = 71.0, + float speed = 0.5, float phase = 25.0, Modulation modulation = Modulation::kSinusoidal, + Interpolation interpolation = Interpolation::kLinear); + + /// \brief Destructor. + ~Flanger() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief FrequencyMasking TensorTransform. +/// \notes Apply masking to a spectrogram in the frequency domain. +class DATASET_API FrequencyMasking final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] iid_masks Whether to apply different masks to each example. + /// \param[in] frequency_mask_param Maximum possible length of the mask, range: [0, freq_length]. Default: 0. + /// Indices uniformly sampled from [0, frequency_mask_param]. + /// Mask width when iid_masks=true. + /// \param[in] mask_start Mask start when iid_masks=true, range: [0, freq_length-frequency_mask_param]. Default: 0. + /// \param[in] mask_value Mask value. + explicit FrequencyMasking(bool iid_masks = false, int32_t frequency_mask_param = 0, int32_t mask_start = 0, + float mask_value = 0.0); + + /// \brief Destructor. + ~FrequencyMasking() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Apply amplification or attenuation to the whole waveform. +class DATASET_API Gain final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] gain_db Gain adjustment in decibels (dB). Default: 1.0. + explicit Gain(float gain_db = 1.0); + + /// \brief Destructor. + ~Gain() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Waveform calculation from linear scalar amplitude spectrogram using GriffinLim transform. +class DATASET_API GriffinLim final : public TensorTransform { + public: + /// \brief Constructor. + /// \notes Calculated by formula: + /// x(n)=\frac{\sum_{m=-\infty}^{\infty} w(m S-n) y_{w}(m S, n)}{\sum_{m=-\infty}^{\infty} w^{2}(m S-n)} + /// where w represents the window function, y represents the reconstructed signal of each frame and x represents + /// the whole signal. + /// \param[in] n_fft Size of FFT. Default: 400. + /// \param[in] n_iter Number of iteration for phase recovery. Default: 32. + /// \param[in] win_length Window size for GriffinLim. Default: 0, will be set to n_fft. + /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to win_length / 2. + /// \param[in] window_type Window type for GriffinLim. Default: WindowType::kHann. + /// \param[in] power Exponent for the magnitude spectrogram. Default: 2.0. + /// \param[in] momentum The momentum for fast Griffin-Lim. Default: 0.99. + /// \param[in] length Length of the expected output waveform. Default: 0.0, will be set to the value of last + /// dimension of the stft matrix. + /// \param[in] rand_init Flag for random phase initialization or all-zero phase initialization. Default: true. + explicit GriffinLim(int32_t n_fft = 400, int32_t n_iter = 32, int32_t win_length = 0, int32_t hop_length = 0, + WindowType window_type = WindowType::kHann, float power = 2.0, float momentum = 0.99, + int32_t length = 0, bool rand_init = true); + + /// \brief Destructor. + ~GriffinLim() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief HighpassBiquad TensorTransform. Apply highpass biquad filter on audio. +class DATASET_API HighpassBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] cutoff_freq Filter cutoff frequency (in Hz). + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + HighpassBiquad(int32_t sample_rate, float cutoff_freq, float Q = 0.707); + + /// \brief Destructor. + ~HighpassBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief InverseMelScale TensorTransform +/// \notes Solve for a normal STFT from a mel frequency STFT, using a conversion matrix. +class DATASET_API InverseMelScale final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] n_stft Number of bins in STFT, must be positive. + /// \param[in] n_mels Number of mel filter, must be positive. Default: 128. + /// \param[in] sample_rate Sample rate of the signal, the value can't be zero. Default: 16000. + /// \param[in] f_min Minimum frequency, must be non-negative. Default: 0.0. + /// \param[in] f_max Maximum frequency, must be non-negative. Default: 0.0, will be set to sample_rate / 2. + /// \param[in] max_iter Maximum number of optimization iterations, must be positive. Default: 100000. + /// \param[in] tolerance_loss Value of loss to stop optimization at, must be non-negative. Default: 1e-5. + /// \param[in] tolerance_change Difference in losses to stop optimization at, must be non-negative. Default: 1e-8. + /// \param[in] sgdargs Parameters of SGD optimizer, including lr, momentum. + /// Default: {{"sgd_lr", 0.1}, {"sgd_momentum", 0.0}}. + /// \param[in] norm Type of norm, value should be NormType::kSlaney or NormType::kNone. If norm is NormType::kSlaney, + /// divide the triangle mel weight by the width of the mel band. Default: NormType::kNone. + /// \param[in] mel_type Type of mel, value should be MelType::kHtk or MelType::kSlaney. Default: MelType::kHtk. + explicit InverseMelScale(int32_t n_stft, int32_t n_mels = 128, int32_t sample_rate = 16000, float f_min = 0.0, + float f_max = 0.0, int32_t max_iter = 100000, float tolerance_loss = 1e-5, + float tolerance_change = 1e-8, + const std::map &sgdargs = {{"sgd_lr", 0.1}, {"sgd_momentum", 0.0}}, + NormType norm = NormType::kNone, MelType mel_type = MelType::kHtk); + + /// \brief Destructor. + ~InverseMelScale() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Create an inverse spectrogram to recover an audio signal from a spectrogram. +class DATASET_API InverseSpectrogram final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] length The output length of the waveform. Default: 0, means to output the whole waveform. + /// \param[in] n_fft Size of FFT, creates n_fft // 2 + 1 bins. Default: 400. + /// \param[in] win_length Window size. Default: 0, will be set to `n_fft` . + /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to `win_length // 2` . + /// \param[in] pad Two sided padding of signal. Default: 0. + /// \param[in] window A function to create a window tensor that is applied/multiplied to each frame/window. + /// Default: WindowType::kHann. + /// \param[in] normalized Whether the spectrogram was normalized by magnitude after stft. Default:false. + /// \param[in] center Whether the signal in spectrogram was padded on both sides. Default: true. + /// \param[in] pad_mode Controls the padding method used when center is True. Default: BorderType::kReflect. + /// \param[in] onesided Controls whether spectrogram was used to return half of results to avoid + /// redundancy. Default: true. + explicit InverseSpectrogram(int32_t length = 0, int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, + int32_t pad = 0, WindowType window = WindowType::kHann, bool normalized = false, + bool center = true, BorderType pad_mode = BorderType::kReflect, bool onesided = true); + + /// \brief Destructor. + ~InverseSpectrogram() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Create LFCC for a raw audio signal. +class DATASET_API LFCC final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sample rate of audio signal. Default: 16000. + /// \param[in] n_filter Number of linear filters to apply. Default: 128. + /// \param[in] n_lfcc Number of lfc coefficients to retain. Default: 40. + /// \param[in] f_min Minimum frequency. Default: 0.0. + /// \param[in] f_max Maximum frequency. Default: 0.0, will be set to sample_rate // 2. + /// \param[in] dct_type Type of DCT (discrete cosine transform) to use. Default: 2. + /// \param[in] norm Norm to use. Default: NormMode::kOrtho. + /// \param[in] log_lf Whether to use log-lf spectrograms instead of db-scaled. Default: false. + /// \param[in] n_fft Size of FFT, creates n_fft // 2 + 1 bins. Default: 400. + /// \param[in] win_length Window size. Default: 0, will be set to n_fft. + /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to win_length // 2. + /// \param[in] pad Two sided padding of signal. Default: 0. + /// \param[in] window A function to create a window tensor that is applied/multiplied to + /// each frame/window. Default: WindowType::kHann. + /// \param[in] power Exponent for the magnitude spectrogram, (must be > 0) e.g., 1 for energy, 2 + /// for power, etc. Default: 2.0. + /// \param[in] normalized Whether to normalize by magnitude after stft. Default: false + /// \param[in] center Whether to pad waveform on both sides so that the tt-th frame is centered at + /// time t t*hop_length. Default: true. + /// \param[in] pad_mode Controls the padding method used when center is True. Default: + /// BorderType::kReflect. + /// \param[in] onesided Controls whether to return half of results to avoid + /// redundancy. Default: true. + explicit LFCC(int32_t sample_rate = 16000, int32_t n_filter = 128, int32_t n_lfcc = 40, float f_min = 0.0, + float f_max = 0.0, int32_t dct_type = 2, NormMode norm = NormMode::kOrtho, bool log_lf = false, + int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, int32_t pad = 0, + WindowType window = WindowType::kHann, float power = 2.0, bool normalized = false, bool center = true, + BorderType pad_mode = BorderType::kReflect, bool onesided = true); + + /// \brief Destructor. + ~LFCC() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Design filter. Similar to SoX implementation. +class DATASET_API LFilter final : public TensorTransform { + public: + /// \param[in] a_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). + /// Lower delays coefficients are first, e.g. [a0, a1, a2, ...]. + /// Must be same size as b_coeffs (pad with 0's as necessary). + /// \param[in] b_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). + /// Lower delays coefficients are first, e.g. [b0, b1, b2, ...]. + /// Must be same size as a_coeffs (pad with 0's as necessary). + /// \param[in] clamp If True, clamp the output signal to be in the range [-1, 1]. Default: True. + explicit LFilter(const std::vector &a_coeffs, const std::vector &b_coeffs, bool clamp = true); + + /// \brief Destructor. + ~LFilter() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Creates a linear triangular filterbank. +/// \param output Tensor of a linear triangular filterbank. +/// \param n_freqs: Number of frequency. +/// \param f_min: Minimum of frequency in Hz. +/// \param f_max: Maximum of frequency in Hz. +/// \param n_filter: Number of (linear) triangular filter. +/// \param sample_rate: Sample rate. +/// \return Status code. +Status DATASET_API LinearFbanks(MSTensor *output, int32_t n_freqs, float f_min, float f_max, int32_t n_filter, + int32_t sample_rate); + +/// \brief Design biquad lowpass filter and perform filtering. Similar to SoX implementation. +class DATASET_API LowpassBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] cutoff_freq Filter cutoff frequency. + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + LowpassBiquad(int32_t sample_rate, float cutoff_freq, float Q = 0.707); + + /// \brief Destructor. + ~LowpassBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Separate a complex-valued spectrogram with shape (..., 2) into its magnitude and phase. +class DATASET_API Magphase final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] power Power of the norm, which must be non-negative. Default: 1.0. + explicit Magphase(float power); + + /// \brief Destructor. + ~Magphase() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief MaskAlongAxis TensorTransform. +/// \note Tensor operation to mask the input tensor along axis. +class MaskAlongAxis final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] mask_start Starting position of the mask, which must be non negative. + /// \param[in] mask_width The width of the mask, which must be positive. + /// \param[in] mask_value Value to assign to the masked columns. + /// \param[in] axis Axis to apply masking on (1 for frequency and 2 for time). + MaskAlongAxis(int32_t mask_start, int32_t mask_width, float mask_value, int32_t axis); + + /// \brief Destructor. + ~MaskAlongAxis() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief MaskAlongAxisIID TensorTransform. +/// \note Apply a mask along axis. +class MaskAlongAxisIID final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] mask_param Number of columns to be masked, will be uniformly sampled from [0, mask_param], + /// must be non negative. + /// \param[in] mask_value Value to assign to the masked columns. + /// \param[in] axis Axis to apply masking on (1 for frequency and 2 for time). + MaskAlongAxisIID(int32_t mask_param, float mask_value, int32_t axis); + + /// \brief Destructor. + ~MaskAlongAxisIID() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief MelScale TensorTransform. +/// \notes Convert normal STFT to STFT at the Mel scale. +class DATASET_API MelScale final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] n_mels Number of mel filter, which must be positive. Default: 128. + /// \param[in] sample_rate Sample rate of the signal, the value can't be zero. Default: 16000. + /// \param[in] f_min Minimum frequency, which must be non negative. Default: 0.0. + /// \param[in] f_max Maximum frequency, which must be positive. Default: 0.0, will be set to sample_rate / 2. + /// \param[in] n_stft Number of bins in STFT, which must be positive. Default: 201. + /// \param[in] norm Type of norm, value should be NormType::kSlaney or NormType::kNone. If norm is NormType::kSlaney, + /// divide the triangle mel weight by the width of the mel band. Default: NormType::kNone. + /// \param[in] mel_type Type of mel, value should be MelType::kHtk or MelType::kSlaney. Default: MelType::kHtk. + explicit MelScale(int32_t n_mels = 128, int32_t sample_rate = 16000, float f_min = 0.0, float f_max = 0.0, + int32_t n_stft = 201, NormType norm = NormType::kNone, MelType mel_type = MelType::kHtk); + + /// \brief Destructor. + ~MelScale() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Create a frequency transformation matrix with shape (n_freqs, n_mels). +/// \param[in] output Tensor of the frequency transformation matrix. +/// \param[in] n_freqs Number of frequencies to highlight/apply. +/// \param[in] f_min Minimum frequency (Hz). +/// \param[in] f_max Maximum frequency (Hz). +/// \param[in] n_mels Number of mel filterbanks. +/// \param[in] sample_rate Sample rate of the audio waveform. +/// \param[in] norm Norm to use, can be NormType::kNone or NormType::kSlaney. Default: NormType::kNone. +/// \param[in] mel_type Scale to use, can be MelType::kHtk or MelType::kSlaney. Default: MelType::kHtz. +/// \return Status code. +Status DATASET_API MelscaleFbanks(MSTensor *output, int32_t n_freqs, float f_min, float f_max, int32_t n_mels, + int32_t sample_rate, NormType norm = NormType::kNone, + MelType mel_type = MelType::kHtk); + +/// \brief Create MelSpectrogram for a raw audio signal. +class DATASET_API MelSpectrogram final : public TensorTransform { + public: + /// \param[in] sample_rate Sample rate of audio signal. Default: 16000. + /// \param[in] n_fft Size of FFT, creates `n_fft // 2 + 1` bins. Default: 400. + /// \param[in] win_length Window size. Default: 0, will be set to `n_fft` . + /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to `win_length // 2` . + /// \param[in] f_min Minimum frequency. Default: 0.0. + /// \param[in] f_max Maximum frequency. Default: 0.0. + /// \param[in] pad Two sided padding of signal. Default: 0. + /// \param[in] n_mels Number of mel filterbanks. Default: 128. + /// \param[in] window A function to create a window tensor that is applied/multiplied to each frame/window. + /// Default: WindowType::kHann. + /// \param[in] power Exponent for the magnitude spectrogram, (must be > 0) e.g., 1 for energy, 2 for power, etc. + /// Default: 2.0. + /// \param[in] normalized Whether to normalize by magnitude after stft Default: false. + /// \param[in] center Whether to pad waveform on both sides. Default: true. + /// \param[in] pad_mode Controls the padding method used when center is True. Default: BorderType::kReflect. + /// \param[in] onesided Controls whether to return half of results to avoid redundancy. Default: true. + /// \param[in] norm If 'slaney', divide the triangular mel weights by the width of the mel band (area normalization). + /// Default: NormType::kNone. + /// \param[in] mel_scale Scale to use: htk or slaney. Default: MelType::kHtk. + explicit MelSpectrogram(int32_t sample_rate = 16000, int32_t n_fft = 400, int32_t win_length = 0, + int32_t hop_length = 0, float f_min = 0.0, float f_max = 0.0, int32_t pad = 0, + int32_t n_mels = 128, WindowType window = WindowType::kHann, float power = 2.0, + bool normalized = false, bool center = true, BorderType pad_mode = BorderType::kReflect, + bool onesided = true, NormType norm = NormType::kNone, MelType mel_scale = MelType::kHtk); + + /// \brief Destructor. + ~MelSpectrogram() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Create MFCC for a raw audio signal. +class DATASET_API MFCC final : public TensorTransform { + public: + /// \param[in] sample_rate Sample rate of audio signal. Default: 16000. + /// \param[in] n_mfcc Number of mfc coefficients to retain. Default: 40. + /// \param[in] dct_type Type of DCT (discrete cosine transform) to use. Default: 2. + /// \param[in] norm If 'slaney', divide the triangular mel weights by the width of the mel band (area normalization). + /// Default: NormMode::kOrtho. + /// \param[in] log_mels Whether to use log-mel spectrograms instead of db-scaled. Default: false. + /// \param[in] n_fft Size of FFT, creates n_fft // 2 + 1 bins. Default: 400. + /// \param[in] win_length Window size. Default: 0. + /// \param[in] hop_length Length of hop between STFT windows. Default: 0. + /// \param[in] f_min Minimum frequency. Default: 0.0. + /// \param[in] f_max Maximum frequency. Default: 0.0. + /// \param[in] pad Two sided padding of signal. Default: 0. + /// \param[in] n_mels Number of mel filterbanks. Default: 128. + /// \param[in] window A function to create a window tensor that is applied/multiplied to each frame/window. + /// Default: WindowType::kHann. + /// \param[in] power Exponent for the magnitude spectrogram, (must be > 0) e.g., 1 for energy, 2 for power, etc. + /// Default: 2.0. + /// \param[in] normalized Whether to normalize by magnitude after stft. Default: false. + /// \param[in] center Whether to pad waveform on both sides. Default: true. + /// \param[in] pad_mode Controls the padding method used when center is True. Default: BorderType::kReflect. + /// \param[in] onesided Controls whether to return half of results to avoid redundancy. Default: true. + /// \param[in] norm_mel Norm to use. Default: NormType::kNone. + /// \param[in] mel_scale Scale to use: htk or slaney. Default: MelType::kHtk. + explicit MFCC(int32_t sample_rate = 16000, int32_t n_mfcc = 40, int32_t dct_type = 2, + NormMode norm = NormMode::kOrtho, bool log_mels = false, int32_t n_fft = 400, int32_t win_length = 0, + int32_t hop_length = 0, float f_min = 0.0, float f_max = 0.0, int32_t pad = 0, int32_t n_mels = 128, + WindowType window = WindowType::kHann, float power = 2.0, bool normalized = false, bool center = true, + BorderType pad_mode = BorderType::kReflect, bool onesided = true, NormType norm_mel = NormType::kNone, + MelType mel_scale = MelType::kHtk); + + /// \brief Destructor. + ~MFCC() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief MuLawDecoding TensorTransform. +/// \note Decode mu-law encoded signal. +class DATASET_API MuLawDecoding final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] quantization_channels Number of channels, which must be positive. Default: 256. + explicit MuLawDecoding(int32_t quantization_channels = 256); + + /// \brief Destructor. + ~MuLawDecoding() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief MuLawEncoding TensorTransform. +/// \note Encode signal based on mu-law companding. +class DATASET_API MuLawEncoding final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] quantization_channels Number of channels, which must be positive. Default: 256. + explicit MuLawEncoding(int32_t quantization_channels = 256); + + /// \brief Destructor. + ~MuLawEncoding() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Overdrive TensorTransform. +class DATASET_API Overdrive final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] gain Coefficient of overload in dB, in range of [0, 100]. Default: 20.0. + /// \param[in] color Coefficient of translation, in range of [0, 100]. Default: 20.0. + explicit Overdrive(float gain = 20.0, float color = 20.0); + + /// \brief Destructor. + ~Overdrive() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Phaser TensorTransform. +class DATASET_API Phaser final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). + /// \param[in] gain_in Desired input gain at the boost (or attenuation) in dB. + /// Allowed range of values is [0, 1]. Default: 0.4. + /// \param[in] gain_out Desired output gain at the boost (or attenuation) in dB. + /// Allowed range of values is [0, 1e9]. Default: 0.74. + /// \param[in] delay_ms Desired delay in milli seconds. Allowed range of values is [0, 5]. Default: 3.0. + /// \param[in] decay Desired decay relative to gain-in. Allowed range of values is [0, 0.99]. Default: 0.4. + /// \param[in] mod_speed Modulation speed in Hz. Allowed range of values is [0.1, 2]. Default: 0.5. + /// \param[in] sinusoidal If true, use sinusoidal modulation (preferable for multiple instruments). + /// If false, use triangular modulation (gives single instruments a sharper phasing effect). Default: true. + explicit Phaser(int32_t sample_rate, float gain_in = 0.4, float gain_out = 0.74, float delay_ms = 3.0, + float decay = 0.4, float mod_speed = 0.5, bool sinusoidal = true); + + /// \brief Destructor. + ~Phaser() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief PhaseVocoder TensorTransform +/// \notes Given a STFT tensor, speed up in time without modifying pitch by factor of rate. +class DATASET_API PhaseVocoder final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] rate Speed-up factor. + /// \param[in] phase_advance Expected phase advance in each bin in shape of (freq, 1). + PhaseVocoder(float rate, const MSTensor &phase_advance); + + /// \brief Destructor. + ~PhaseVocoder() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +// \brief Shift the pitch of a waveform by 'n_steps' steps. +class DATASET_API PitchShift final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of "waveform". Default: 0. + /// \param[in] n_steps The (fractional) steps to shift "waveform". Default: 0. + /// \param[in] bins_per_octave The number of steps per octave. Default: 12. + /// \param[in] n_fft Size of FFT, creates "n_fft // 2 + 1" bins. Default: 512. + /// \param[in] win_length Window size. Default: 0, will be set to `n_fft` . + /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will be set to `win_length // 4` . + /// \param[in] window Window tensor that is applied/multiplied to each frame/window. Default: WindowType::kHann. + explicit PitchShift(int32_t sample_rate = 0, int32_t n_steps = 0, int32_t bins_per_octave = 12, int32_t n_fft = 512, + int32_t win_length = 0, int32_t hop_length = 0, WindowType window = WindowType::kHann); + + /// \brief Destructor. + ~PitchShift() override = default; + + protected: + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Resample TensorTransform. +/// \notes Resample a signal from one frequency to another. A sampling method can be given. +class DATASET_API Resample : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] orig_freq The original frequency of the signal, which must be positive. Default: 16000.0. + /// \param[in] new_freq The desired frequency, which must be positive. Default: 16000.0. + /// \param[in] resample_method The resampling method, which can be ResampleMethod::kSincInterpolation + /// and ResampleMethod::kKaiserWindow. Default: ResampleMethod::kSincInterpolation. + /// \param[in] lowpass_filter_width Controls the sharpness of the filter, more means sharper but less efficient, + /// which must be positive. Default: 6. + /// \param[in] rolloff The roll-off frequency of the filter, as a fraction of the Nyquist. Lower values + /// reduce anti-aliasing, but also reduce some of the highest frequencies, range: (0, 1]. Default: 0.99. + /// \param[in] beta The shape parameter used for kaiser window. Default: 14.769656459379492. + explicit Resample(float orig_freq = 16000.0, float new_freq = 16000.0, + ResampleMethod resample_method = ResampleMethod::kSincInterpolation, + int32_t lowpass_filter_width = 6, float rolloff = 0.99, float beta = 14.769656459379492); + + /// \brief Destructor. + ~Resample() override = default; + + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Apply RIAA vinyl playback equalization. +class DATASET_API RiaaBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), + /// can only be one of 44100, 48000, 88200, 96000. + explicit RiaaBiquad(int32_t sample_rate); + + /// \brief Destructor. + ~RiaaBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Apply sliding-window cepstral mean (and optionally variance) normalization per utterance. +class DATASET_API SlidingWindowCmn final : public TensorTransform { + public: + /// \brief Constructor of SlidingWindowCmnOp. + /// \param[in] cmn_window The window in frames for running average CMN computation. Default: 600. + /// \param[in] min_cmn_window The minimum CMN window. Only applicable if center is false, ignored if center + /// is true. Default: 100. + /// \param[in] center If true, use a window centered on the current frame. If false, window is to the left. + /// Default: false. + /// \param[in] norm_vars If true, normalize variance to one. Default: false. + explicit SlidingWindowCmn(int32_t cmn_window = 600, int32_t min_cmn_window = 100, bool center = false, + bool norm_vars = false); + + /// \brief Destructor. + ~SlidingWindowCmn() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Create a spectral centroid from an audio signal. +class DATASET_API SpectralCentroid : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). + /// \param[in] n_fft Size of FFT, creates n_fft / 2 + 1 bins. Default: 400. + /// \param[in] win_length Window size. Default: 0, will use n_fft. + /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will use win_length / 2. + /// \param[in] pad Two sided padding of signal. Default: 0. + /// \param[in] window Window function that is applied/multiplied to each frame/window, + /// which can be WindowType::kBartlett, WindowType::kBlackman, WindowType::kHamming, + /// WindowType::kHann or WindowType::kKaiser. Default: WindowType::kHann. + explicit SpectralCentroid(int32_t sample_rate, int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, + int32_t pad = 0, WindowType window = WindowType::kHann); + + ~SpectralCentroid() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + int32_t sample_rate_; + int32_t n_fft_; + int32_t win_length_; + int32_t hop_length_; + int32_t pad_; + WindowType window_; + struct Data; + std::shared_ptr data_; +}; + +/// \brief Create a spectrogram from an audio signal. +class DATASET_API Spectrogram : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] n_fft Size of FFT, creates n_fft / 2 + 1 bins. Default: 400. + /// \param[in] win_length Window size. Default: 0, will use n_fft. + /// \param[in] hop_length Length of hop between STFT windows. Default: 0, will use win_length / 2. + /// \param[in] pad Two sided padding of signal. Default: 0. + /// \param[in] window Window function that is applied/multiplied to each frame/window, + /// which can be WindowType::kBartlett, WindowType::kBlackman, WindowType::kHamming, + /// WindowType::kHann or WindowType::kKaiser. Default: WindowType::kHann. + /// \param[in] power Exponent for the magnitude spectrogram, which must be greater than or equal to 0. Default: 2.0. + /// \param[in] normalized Whether to normalize by magnitude after stft. Default: false. + /// \param[in] center Whether to pad waveform on both sides. Default: true. + /// \param[in] pad_mode Controls the padding method used when center is true, + /// which can be BorderType::kReflect, BorderType::kConstant, BorderType::kEdge, + /// BorderType::kSymmetric. Default: BorderType::kReflect. + /// \param[in] onesided Controls whether to return half of results to avoid redundancy. Default: true. + explicit Spectrogram(int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, int32_t pad = 0, + WindowType window = WindowType::kHann, float power = 2.0, bool normalized = false, + bool center = true, BorderType pad_mode = BorderType::kReflect, bool onesided = true); + + /// \brief Destructor. + ~Spectrogram() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + int32_t n_fft_; + int32_t win_length_; + int32_t hop_length_; + int32_t pad_; + WindowType window_; + float power_; + bool normalized_; + bool center_; + BorderType pad_mode_; + bool onesided_; + struct Data; + std::shared_ptr data_; +}; + +/// \brief TimeMasking TensorTransform. +/// \notes Apply masking to a spectrogram in the time domain. +class DATASET_API TimeMasking final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] iid_masks Whether to apply different masks to each example. + /// \param[in] time_mask_param Maximum possible length of the mask, range: [0, time_length]. Default: 0. + /// Indices uniformly sampled from [0, time_mask_param]. + /// Mask width when iid_masks=true. + /// \param[in] mask_start Mask start when iid_masks=true, range: [0, time_length-time_mask_param]. Default: 0. + /// \param[in] mask_value Mask value. + explicit TimeMasking(bool iid_masks = false, int32_t time_mask_param = 0, int32_t mask_start = 0, + float mask_value = 0.0); + + /// \brief Destructor. + ~TimeMasking() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief TimeStretch TensorTransform +/// \notes Stretch STFT in time at a given rate, without changing the pitch. +class DATASET_API TimeStretch final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] hop_length Length of hop between STFT windows. Default: None, will use ((n_freq - 1) * 2) // 2. + /// \param[in] n_freq Number of filter banks form STFT. Default: 201. + /// \param[in] fixed_rate Rate to speed up or slow down the input in time. + /// Default: std::numeric_limits::quiet_NaN(), will keep the original rate. + explicit TimeStretch(float hop_length = std::numeric_limits::quiet_NaN(), int n_freq = 201, + float fixed_rate = std::numeric_limits::quiet_NaN()); + + /// \brief Destructor. + ~TimeStretch() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Design a treble tone-control effect. +class DATASET_API TrebleBiquad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. + /// \param[in] gain Desired gain at the boost (or attenuation) in dB. + /// \param[in] central_freq Central frequency (in Hz). Default: 3000.0. + /// \param[in] Q Quality factor, https://en.wikipedia.org/wiki/Q_factor, range: (0, 1]. Default: 0.707. + TrebleBiquad(int32_t sample_rate, float gain, float central_freq = 3000.0, float Q = 0.707); + + /// \brief Destructor. + ~TrebleBiquad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Vad TensorTransform. +/// \notes Attempt to trim silent background sounds from the end of the voice recording. +class DATASET_API Vad final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] sample_rate Sample rate of audio signal. + /// \param[in] trigger_level The measurement level used to trigger activity detection. Default: 7.0. + /// \param[in] trigger_time The time constant (in seconds) used to help ignore short sounds. Default: 0.25. + /// \param[in] search_time The amount of audio (in seconds) to search for quieter/shorter sounds to include prior to + /// the detected trigger point. Default: 1.0. + /// \param[in] allowed_gap The allowed gap (in seconds) between quiteter/shorter sounds to include prior to the + /// detected trigger point. Default: 0.25. + /// \param[in] pre_trigger_time The amount of audio (in seconds) to preserve before the trigger point and any found + /// quieter/shorter bursts. Default: 0.0. + /// \param[in] boot_time The time for the initial noise estimate. Default: 0.35. + /// \param[in] noise_up_time Time constant used by the adaptive noise estimator, when the noise level is increasing. + /// Default: 0.1. + /// \param[in] noise_down_time Time constant used by the adaptive noise estimator, when the noise level is decreasing. + /// Default: 0.01. + /// \param[in] noise_reduction_amount The amount of noise reduction used in the detection algorithm. Default: 1.35. + /// \param[in] measure_freq The frequency of the algorithm’s processing. Default: 20.0. + /// \param[in] measure_duration The duration of measurement. Default: 0, use twice the measurement period. + /// \param[in] measure_smooth_time The time constant used to smooth spectral measurements. Default: 0.4. + /// \param[in] hp_filter_freq The "Brick-wall" frequency of high-pass filter applied at the input to the detector + /// algorithm. Default: 50.0. + /// \param[in] lp_filter_freq The "Brick-wall" frequency of low-pass filter applied at the input to the detector + /// algorithm. Default: 6000.0. + /// \param[in] hp_lifter_freq The "Brick-wall" frequency of high-pass lifter applied at the input to the detector + /// algorithm. Default: 150.0. + /// \param[in] lp_lifter_freq The "Brick-wall" frequency of low-pass lifter applied at the input to the detector + /// algorithm. Default: 2000.0. + explicit Vad(int32_t sample_rate, float trigger_level = 7.0, float trigger_time = 0.25, float search_time = 1.0, + float allowed_gap = 0.25, float pre_trigger_time = 0.0, float boot_time = 0.35, + float noise_up_time = 0.1, float noise_down_time = 0.01, float noise_reduction_amount = 1.35, + float measure_freq = 20.0, float measure_duration = 0.0, float measure_smooth_time = 0.4, + float hp_filter_freq = 50.0, float lp_filter_freq = 6000.0, float hp_lifter_freq = 150.0, + float lp_lifter_freq = 2000.0); + + /// \brief Destructor. + ~Vad() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; + +/// \brief Vol TensorTransform. +/// \notes Add a volume to an waveform. +class DATASET_API Vol final : public TensorTransform { + public: + /// \brief Constructor. + /// \param[in] gain Gain value, varies according to the value of gain_type. If gain_type is GainType::kAmplitude, + /// gain must be greater than or equal to zero. If gain_type is GainType::kPower, gain must be greater than zero. + /// If gain_type is GainType::kDb, there is no limit for gain. + /// \param[in] gain_type Type of gain, should be one of [GainType::kAmplitude, GainType::kDb, GainType::kPower]. + explicit Vol(float gain, GainType gain_type = GainType::kAmplitude); + + /// \brief Destructor. + ~Vol() override = default; + + protected: + /// \brief Function to convert TensorTransform object into a TensorOperation object. + /// \return Shared pointer to TensorOperation object. + std::shared_ptr Parse() override; + + private: + struct Data; + std::shared_ptr data_; +}; +} // namespace audio +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_AUDIO_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/config.h b/mindspore-lite/minddata/dataset/include/dataset/config.h index 47d12903e2641dee37a1aedd3379856539156131..d3802e8800783b60fce35bf98e9592536018a633 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/config.h +++ b/mindspore-lite/minddata/dataset/include/dataset/config.h @@ -24,7 +24,7 @@ #include "include/api/dual_abi_helper.h" #include "include/api/visible.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Config operations for setting and getting the configuration. namespace config { @@ -159,5 +159,5 @@ bool DATASET_API load(const std::vector &file); inline bool DATASET_API load(const std::string &file) { return load(StringToChar(file)); } } // namespace config } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_CONFIG_H diff --git a/mindspore-lite/minddata/dataset/include/dataset/constants.h b/mindspore-lite/minddata/dataset/include/dataset/constants.h index e2b760bb4a08b52d008f85e165681f4933a10bb0..8bbf2793537384cf2ef246441bd37e8637468108 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/constants.h +++ b/mindspore-lite/minddata/dataset/include/dataset/constants.h @@ -22,7 +22,7 @@ #include "include/api/visible.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Various type defines for convenience using uchar = unsigned char; @@ -362,5 +362,5 @@ using row_id_type = int64_t; constexpr uint32_t kCfgAutoTuneInterval = 0; // default number of steps } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_CONSTANTS_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/data_helper.h b/mindspore-lite/minddata/dataset/include/dataset/data_helper.h index 138a06e071d0dae88909dd4ca71dcac2134676c6..2a5c4881e10067e77d6a14bf157534976ad361f9 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/data_helper.h +++ b/mindspore-lite/minddata/dataset/include/dataset/data_helper.h @@ -37,7 +37,7 @@ #include "include/api/dual_abi_helper.h" #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Simple class to do data manipulation, contains helper function to update json files in dataset class DATASET_API DataHelper { @@ -483,5 +483,5 @@ class DATASET_API DataHelper { Status RemoveKeyIF(const std::vector &in_file, const std::vector &key, const std::vector &out_file); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_DATA_HELPER_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/datasets.h b/mindspore-lite/minddata/dataset/include/dataset/datasets.h index ad3981733faa1a1f214ac1b9944c264d4f0bf909..598bafb3a252e633912b500372a4f53240f3a12a 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/datasets.h +++ b/mindspore-lite/minddata/dataset/include/dataset/datasets.h @@ -36,7 +36,7 @@ #include "include/dataset/samplers.h" #include "include/dataset/text.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CsvBase; class DatasetCache; @@ -6534,5 +6534,5 @@ inline std::shared_ptr DATASET_API Zip(const std::vector(datasets); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_DATASETS_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/execute.h b/mindspore-lite/minddata/dataset/include/dataset/execute.h index a21888077b8b23cca83560cbe5d07cfe8a6d10ba..66ef58b6607fb889eab45cc9e38ddba8dcced52f 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/execute.h +++ b/mindspore-lite/minddata/dataset/include/dataset/execute.h @@ -31,7 +31,7 @@ #include "runtime/hardware_abstract/device_context/device_context_manager.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DeviceResource; class Tensor; @@ -192,5 +192,5 @@ class PyExecute : public Execute { std::vector> *out); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_EXECUTE_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/iterator.h b/mindspore-lite/minddata/dataset/include/dataset/iterator.h index 3dce9d91134d679118e3d72839bb09f2b889fa46..9ede03f28af4c7d3131248764d1cfa338a56fe3d 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/iterator.h +++ b/mindspore-lite/minddata/dataset/include/dataset/iterator.h @@ -27,7 +27,7 @@ #include "include/api/status.h" #include "include/api/types.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declare class ExecutionTree; @@ -192,5 +192,5 @@ class DATASET_API PullIterator : public Iterator { std::unique_ptr pull_consumer_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_ITERATOR_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/samplers.h b/mindspore-lite/minddata/dataset/include/dataset/samplers.h index d0061f97ee6de661d22c0295e6f376d33145d247..4fae574436bec07ea73752ee49ec3fa0c5fb7ac1 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/samplers.h +++ b/mindspore-lite/minddata/dataset/include/dataset/samplers.h @@ -24,7 +24,7 @@ #include "include/api/status.h" #include "include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declare class SamplerObj; @@ -342,5 +342,5 @@ class DATASET_API WeightedRandomSampler final : public Sampler { bool replacement_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_SAMPLERS_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/text.h b/mindspore-lite/minddata/dataset/include/dataset/text.h index 244770b0af8a91a598df325c3c612d5f0198c5eb..d0bb90dccd115e035aaa885ee792102bbb8ac01e 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/text.h +++ b/mindspore-lite/minddata/dataset/include/dataset/text.h @@ -29,7 +29,7 @@ #include "include/dataset/constants.h" #include "include/dataset/transforms.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TensorOperation; class Vectors; @@ -1088,5 +1088,5 @@ class DATASET_API WhitespaceTokenizer final : public TensorTransform { #endif } // namespace text } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_TEXT_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/transforms.h b/mindspore-lite/minddata/dataset/include/dataset/transforms.h index 24242834ceeaae4e5c602c7fade02f69b2d233ad..c52c37b6634f52adf8135ba51c115f70fa7bbd66 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/transforms.h +++ b/mindspore-lite/minddata/dataset/include/dataset/transforms.h @@ -27,7 +27,7 @@ #include "include/api/types.h" #include "include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TensorOperation; @@ -634,5 +634,5 @@ class DATASET_API Unique final : public TensorTransform { }; } // namespace transforms } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_TRANSFORMS_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/vision.h b/mindspore-lite/minddata/dataset/include/dataset/vision.h old mode 100755 new mode 100644 index 10e00e5443888c9bb012b65e3222e39f2f14d6a7..f2652e73dd76044aff3fa5a8d5de3aca3d8e4907 --- a/mindspore-lite/minddata/dataset/include/dataset/vision.h +++ b/mindspore-lite/minddata/dataset/include/dataset/vision.h @@ -30,7 +30,7 @@ #include "include/dataset/transforms.h" #include "include/dataset/vision_lite.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TensorOperation; @@ -2125,5 +2125,5 @@ Status DATASET_API WriteJpeg(const std::string &filename, const mindspore::MSTen Status DATASET_API WritePng(const std::string &filename, const mindspore::MSTensor &image, int compression_level = 6); } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_VISION_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/vision_ascend.h b/mindspore-lite/minddata/dataset/include/dataset/vision_ascend.h index 5093ad5987af2d0fb78e2e5ea7dbe72e5f465812..54e3f6615039bece1dc1f31e04c2f8ebc821842c 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/vision_ascend.h +++ b/mindspore-lite/minddata/dataset/include/dataset/vision_ascend.h @@ -27,7 +27,7 @@ #include "include/dataset/constants.h" #include "include/dataset/transforms.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Transform operations for performing computer vision. namespace vision { @@ -202,5 +202,5 @@ class DATASET_API DvppDecodePng final : public TensorTransform { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_VISION_ASCEND_H_ diff --git a/mindspore-lite/minddata/dataset/include/dataset/vision_lite.h b/mindspore-lite/minddata/dataset/include/dataset/vision_lite.h index 1fafb68cbac7bf15d023f763c047ffd0b13c7474..69230b985e547c8c018c5f01a5784888dd5ed3d6 100644 --- a/mindspore-lite/minddata/dataset/include/dataset/vision_lite.h +++ b/mindspore-lite/minddata/dataset/include/dataset/vision_lite.h @@ -27,7 +27,7 @@ #include "include/dataset/constants.h" #include "include/dataset/transforms.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Transform operations for performing computer vision. namespace vision { @@ -621,5 +621,5 @@ class DATASET_API SwapRedBlue final : public TensorTransform { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_VISION_LITE_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/c_func_op.cc b/mindspore-lite/minddata/dataset/kernels/c_func_op.cc index c025dc2b8f1b4e7e3562bf160df7ae8ddefde26d..9dc0be90dae835e0d9857f37712f6446d33605de 100644 --- a/mindspore-lite/minddata/dataset/kernels/c_func_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/c_func_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status CFuncOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -31,4 +31,4 @@ Status CFuncOp::Compute(const TensorRow &input, TensorRow *output) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/c_func_op.h b/mindspore-lite/minddata/dataset/kernels/c_func_op.h index 38484216cc3da8e5dd5ff949f9221c5753f5aa6f..b94eb9240b316c68f8964085180a265aa43da58b 100644 --- a/mindspore-lite/minddata/dataset/kernels/c_func_op.h +++ b/mindspore-lite/minddata/dataset/kernels/c_func_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CFuncOp : public TensorOp { public: @@ -46,5 +46,5 @@ class CFuncOp : public TensorOp { std::function c_func_ptr_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_C_FUNC_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/compose_op.cc b/mindspore-lite/minddata/dataset/kernels/data/compose_op.cc index bb19aa4ed4f5f44f7950790a2124980cc94116ea..f0bdb1a2e45bed343bb739de02eda2ad3edb91b6 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/compose_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/compose_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status ComposeOp::OutputShape(const std::vector &inputs, std::vector &outputs) { std::vector in_shapes = inputs; @@ -55,4 +55,4 @@ Status ComposeOp::Compute(const TensorRow &inputs, TensorRow *outputs) { ComposeOp::ComposeOp(const std::vector> &ops) : ops_(ops) {} } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/compose_op.h b/mindspore-lite/minddata/dataset/kernels/data/compose_op.h index 61d199c169df1120d0580a3fadc585464ab3dadf..576afbd7710b9bfdcd1e68ad0133762d16c9c988 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/compose_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/compose_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ComposeOp : public TensorOp { public: @@ -102,5 +102,5 @@ class ComposeOp : public TensorOp { std::vector> ops_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_COMPOSE_OP_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/concatenate_op.cc b/mindspore-lite/minddata/dataset/kernels/data/concatenate_op.cc index 4eff0249bac37b34cdde3d5994a395f5981c583f..627a652393ee2faf53aa6fcd4464437630ebd141 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/concatenate_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/concatenate_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status ConcatenateOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -65,4 +65,4 @@ Status ConcatenateOp::OutputShape(const std::vector &inputs, std::v return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/concatenate_op.h b/mindspore-lite/minddata/dataset/kernels/data/concatenate_op.h index 2d440ad1be5bbddbc8c9642b323de82f096d0e83..04ac112932a6d4d1be9c6ba85a29e03e5fb39a70 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/concatenate_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/concatenate_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ConcatenateOp : public TensorOp { public: @@ -59,5 +59,5 @@ class ConcatenateOp : public TensorOp { std::shared_ptr append_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CONCATENATE_OP_H diff --git a/mindspore-lite/minddata/dataset/kernels/data/data_utils.cc b/mindspore-lite/minddata/dataset/kernels/data/data_utils.cc index 58860e36f4bb8c1c0154a2b63b594cd7db5c7367..eb948d9b46a0685bcce63d1dbfcc0f913b5d2cb2 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/data_utils.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/data_utils.cc @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/type_cast_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { template Status OneHotEncodingImpl(const std::shared_ptr &input, std::shared_ptr *output, dsize_t num_classes, @@ -897,4 +897,4 @@ Status Unique(const std::shared_ptr &input, std::shared_ptr *out return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/data_utils.h b/mindspore-lite/minddata/dataset/kernels/data/data_utils.h index 955cf13b620abed531e4fcd7708e51e3682e00e1..81fcd02370850bf947e8e6cecb3b7e024c43a059 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/data_utils.h +++ b/mindspore-lite/minddata/dataset/kernels/data/data_utils.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor_row.h" #include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Returns Onehot encoding of the input tensor. // Example: if input=2 and numClasses=3, the output is [0 0 1]. @@ -191,5 +191,5 @@ Status UniqueHelper(const std::shared_ptr &input, std::shared_ptr &input, std::shared_ptr *output, std::shared_ptr *output_idx, std::shared_ptr *output_cnt); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_DATA_UTILS_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/duplicate_op.cc b/mindspore-lite/minddata/dataset/kernels/data/duplicate_op.cc index c4f40f21f1f80a78a298cc2ee1e0d781d93fe066..d009064815f5d73298edcbd3a985e24820876081 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/duplicate_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/duplicate_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DuplicateOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -33,4 +33,4 @@ Status DuplicateOp::Compute(const TensorRow &input, TensorRow *output) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/duplicate_op.h b/mindspore-lite/minddata/dataset/kernels/data/duplicate_op.h index 3fda07abfc9c7c7a560bac9b0657920e6f3d5ece..6a2c9e6038741a32edb6a8e81175cfe105ce7133 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/duplicate_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/duplicate_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DuplicateOp : public TensorOp { public: @@ -38,5 +38,5 @@ class DuplicateOp : public TensorOp { std::string Name() const override { return kDuplicateOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_DUPLICATE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/fill_op.cc b/mindspore-lite/minddata/dataset/kernels/data/fill_op.cc index 3abd8d9f3f38c99d7dcaef1874fb7ddcc7ad84b6..69270bc9c9c5de163bde11e217330264c496ca46 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/fill_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/fill_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status FillOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -27,4 +27,4 @@ Status FillOp::Compute(const std::shared_ptr &input, std::shared_ptr fill_value_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_FILL_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/mask_op.cc b/mindspore-lite/minddata/dataset/kernels/data/mask_op.cc index 2cd12f9cb8f80652813ada1347e06995a8220d09..888e7cc1864fcaed4f3afa050f946c4c8513dd5b 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/mask_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/mask_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status MaskOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -45,4 +45,4 @@ Status MaskOp::OutputType(const std::vector &inputs, std::vector cast_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_MASK_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/no_op.h b/mindspore-lite/minddata/dataset/kernels/data/no_op.h index bb5bebfc155c467e949cb2c8c9de254e94d1dbe9..84430ada40bd06672978ab57de360cdaba98b8fa 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/no_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/no_op.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class NoOp : public TensorOp { public: @@ -35,5 +35,5 @@ class NoOp : public TensorOp { std::string Name() const override { return kNoOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_NO_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/one_hot_op.cc b/mindspore-lite/minddata/dataset/kernels/data/one_hot_op.cc index 29aca51f036b5b92fb432c0d0f9bccc2483386c2..cfc1998c3a420d8d40d6e80621349ca2c760e36a 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/one_hot_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/one_hot_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status OneHotOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -44,4 +44,4 @@ Status OneHotOp::OutputShape(const std::vector &inputs, std::vector return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/one_hot_op.h b/mindspore-lite/minddata/dataset/kernels/data/one_hot_op.h index 7b36dcd22c8a43d1a8d7a60593dbb070564e0eb2..0310c05a5d3dad129ceb49e1a6fcd18dfdf33594 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/one_hot_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/one_hot_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class OneHotOp : public TensorOp { public: @@ -42,5 +42,5 @@ class OneHotOp : public TensorOp { double smoothing_rate_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_ONE_HOT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/pad_end_op.cc b/mindspore-lite/minddata/dataset/kernels/data/pad_end_op.cc index 4cc66b67687a1cd7b18c5c7f63dd31d90d972977..b402fe29f99139fd3c330ef5cb0443d89acc561d 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/pad_end_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/pad_end_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status PadEndOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -36,4 +36,4 @@ Status PadEndOp::OutputShape(const std::vector &inputs, std::vector return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/pad_end_op.h b/mindspore-lite/minddata/dataset/kernels/data/pad_end_op.h index ba570cb9456ab29b8d3ab3d45db2c8ab57a67399..a1890b4c7c76bba1bc3855da49503e78151f58fe 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/pad_end_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/pad_end_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class PadEndOp : public TensorOp { public: @@ -44,5 +44,5 @@ class PadEndOp : public TensorOp { std::shared_ptr pad_val_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_PAD_END_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/parse_example_op.cc b/mindspore-lite/minddata/dataset/kernels/data/parse_example_op.cc index 959179c6d59bf664867b009efa46cd5aad715b36..5013597ffc0ef6a795cb9f60ee5c17cbfa89ce6a 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/parse_example_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/parse_example_op.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { namespace protobuf = ::google::protobuf; constexpr bool kLittleEndian = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__; @@ -1459,4 +1459,4 @@ void ParseExampleOp::CheckAndInitPool() { pool_ = std::make_unique(kThreadPoolSize); } } -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset diff --git a/mindspore-lite/minddata/dataset/kernels/data/parse_example_op.h b/mindspore-lite/minddata/dataset/kernels/data/parse_example_op.h index 2d31d26321d39b74b5b00c22b7aeb15ae4df30d4..56d2b24431472f611b59bd54e9c230d7778b344b 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/parse_example_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/parse_example_op.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/engine/data_schema.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr int kThreadPoolSize = 32; @@ -72,5 +72,5 @@ class ParseExampleOp : public TensorOp { std::unordered_map column_name_id_map_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_PARSE_EXAMPLE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/random_apply_op.cc b/mindspore-lite/minddata/dataset/kernels/data/random_apply_op.cc index f1e55382beb2d2f5f981390984d11f45d3540dad..4274a2538fcb167f8e24e2d9550da7b7d646e50a 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/random_apply_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/random_apply_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomApplyOp::RandomApplyOp(const std::vector> &ops, double prob) : prob_(prob), rand_double_(0.0, 1.0) { @@ -63,4 +63,4 @@ Status RandomApplyOp::Compute(const TensorRow &input, TensorRow *output) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/random_apply_op.h b/mindspore-lite/minddata/dataset/kernels/data/random_apply_op.h index b9bc0f5a0fc9756bd2bc99984b8b55d34582e976..baa3de1bbb1daa99c641efdb54e2dbe1de34e5de 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/random_apply_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/random_apply_op.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomApplyOp : public RandomTensorOp { public: @@ -73,5 +73,5 @@ class RandomApplyOp : public RandomTensorOp { std::uniform_real_distribution rand_double_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_RANDOM_APPLY_OP_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/random_choice_op.cc b/mindspore-lite/minddata/dataset/kernels/data/random_choice_op.cc index eccb9f9f54dca539f806c896e49ddf4938fdc059..e090f1b3c8c7ffabc7c4c7912721d6daf7dd137e 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/random_choice_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/random_choice_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomChoiceOp::RandomChoiceOp(const std::vector> &ops) : ops_(ops), rand_int_(0, ops.size() - 1) {} @@ -86,4 +86,4 @@ Status RandomChoiceOp::Compute(const TensorRow &input, TensorRow *output) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/random_choice_op.h b/mindspore-lite/minddata/dataset/kernels/data/random_choice_op.h index 67c55ef250f63961d2705da995aa0353606dc05f..38c715efea12fc96393f12c31eac530a671d1c8a 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/random_choice_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/random_choice_op.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/compose_op.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomChoiceOp : public RandomTensorOp { public: @@ -71,5 +71,5 @@ class RandomChoiceOp : public RandomTensorOp { std::uniform_int_distribution rand_int_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_RANDOM_CHOICE_OP_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/slice_op.cc b/mindspore-lite/minddata/dataset/kernels/data/slice_op.cc index 96db1563d1f2e7cb98f3caa461deb2b8ec99494c..4120a26f433e8070700aab87572abfc8f3564e09 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/slice_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/slice_op.cc @@ -19,11 +19,11 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status SliceOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); return input->Slice(output, slice_options_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/slice_op.h b/mindspore-lite/minddata/dataset/kernels/data/slice_op.h index 70097ddebfdb5cebd244ca791473e6056c841a91..194323432700d5e277fd31e16b839b56ca1b083d 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/slice_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/slice_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor_helpers.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SliceOp : public TensorOp { public: @@ -51,5 +51,5 @@ class SliceOp : public TensorOp { std::vector slice_options_ = {}; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_SLICE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/to_float16_op.cc b/mindspore-lite/minddata/dataset/kernels/data/to_float16_op.cc index 6543e7571f0359cd684d35ca8295736216ebe037..2d15358058f7d69cf6238ef3aab102e35fc6b7bc 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/to_float16_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/to_float16_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status ToFloat16Op::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -33,4 +33,4 @@ Status ToFloat16Op::OutputType(const std::vector &inputs, std::vector< return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/data/to_float16_op.h b/mindspore-lite/minddata/dataset/kernels/data/to_float16_op.h index dd107d3f770f75b516608608b412238e622d930f..de695192deaa64073423a5ba1cc02cf18635beec 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/to_float16_op.h +++ b/mindspore-lite/minddata/dataset/kernels/data/to_float16_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ToFloat16Op : public TensorOp { public: @@ -44,5 +44,5 @@ class ToFloat16Op : public TensorOp { std::string Name() const override { return kToFloat16Op; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_DATA_TO_FLOAT16_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/data/type_cast_op.cc b/mindspore-lite/minddata/dataset/kernels/data/type_cast_op.cc index 97bb58605b7d94461e39ee5d22e729ba9d477a3d..cd0779b02f161eb819e979c5ff33c4f59a5a6a1a 100644 --- a/mindspore-lite/minddata/dataset/kernels/data/type_cast_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/data/type_cast_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { TypeCastOp::TypeCastOp(const DataType &new_type) : type_(new_type) {} @@ -37,4 +37,4 @@ Status TypeCastOp::OutputType(const std::vector &inputs, std::vector &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -27,4 +27,4 @@ Status AdjustBrightnessOp::Compute(const std::shared_ptr &input, std::sh return AdjustBrightness(input, output, brightness_factor_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_brightness_op.h b/mindspore-lite/minddata/dataset/kernels/image/adjust_brightness_op.h index e02ebf3d7eff7c0f360f31c33bd881f265696615..edf3de67496f1f92b3e00fe9c057935d75ed24bb 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_brightness_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_brightness_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class AdjustBrightnessOp : public TensorOp { public: @@ -41,5 +41,5 @@ class AdjustBrightnessOp : public TensorOp { float brightness_factor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_ADJUST_BRIGHTNESS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_contrast_op.cc b/mindspore-lite/minddata/dataset/kernels/image/adjust_contrast_op.cc index 19712d28199f12b1162941fb919ac1a9a1732d1e..4c77e5245cf1358041b67b384450b69026830a00 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_contrast_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_contrast_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status AdjustContrastOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -27,4 +27,4 @@ Status AdjustContrastOp::Compute(const std::shared_ptr &input, std::shar return AdjustContrast(input, output, contrast_factor_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_contrast_op.h b/mindspore-lite/minddata/dataset/kernels/image/adjust_contrast_op.h index 8ca54b6ae9d2d41b67a6cb63dfd14fd201d344e2..5c95b0774d62229af4d51da2434670b044d41140 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_contrast_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_contrast_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class AdjustContrastOp : public TensorOp { public: @@ -41,5 +41,5 @@ class AdjustContrastOp : public TensorOp { float contrast_factor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_CONTRAST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_gamma_op.cc b/mindspore-lite/minddata/dataset/kernels/image/adjust_gamma_op.cc index 6a0f597bd97d5b3c1eb5fbda1a353f64f4525fa6..3a2dbf2c6884e4a60527bc1939281fa2f1ab429a 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_gamma_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_gamma_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr float AdjustGammaOp::kGain = 1.0; @@ -40,4 +40,4 @@ Status AdjustGammaOp::Compute(const std::shared_ptr &input, std::shared_ } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_gamma_op.h b/mindspore-lite/minddata/dataset/kernels/image/adjust_gamma_op.h index 9c33d946f7d9244c701473bde36a5a9986adc6f3..b35c7fafaa44fa597fd41bc633419cde102931af 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_gamma_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_gamma_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class AdjustGammaOp : public TensorOp { public: @@ -50,5 +50,5 @@ class AdjustGammaOp : public TensorOp { float gain_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_ADJUST_GAMMA_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_hue_op.cc b/mindspore-lite/minddata/dataset/kernels/image/adjust_hue_op.cc index 8f3484b21149d2c97d489c6cfbe7f126b9ed79c6..0e10aea064ad1e4eaa4bc1afefd63b7554b3d50b 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_hue_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_hue_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status AdjustHueOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -27,4 +27,4 @@ Status AdjustHueOp::Compute(const std::shared_ptr &input, std::shared_pt return AdjustHue(input, output, hue_factor_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_hue_op.h b/mindspore-lite/minddata/dataset/kernels/image/adjust_hue_op.h index 1148011a816af84e1a86e09dcefd8b68e4e47724..e026fd21c09e1b98e34f23ac58bfa99a17b7f3c0 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_hue_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_hue_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class AdjustHueOp : public TensorOp { public: @@ -41,5 +41,5 @@ class AdjustHueOp : public TensorOp { float hue_factor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_ADJUST_HUE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_saturation_op.cc b/mindspore-lite/minddata/dataset/kernels/image/adjust_saturation_op.cc index 20e9eb39ec28620c9d78baf68d360d7ce4e80b22..7674dc1d451c72698c05997c46fdd5b5fc171258 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_saturation_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_saturation_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status AdjustSaturationOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -27,4 +27,4 @@ Status AdjustSaturationOp::Compute(const std::shared_ptr &input, std::sh return AdjustSaturation(input, output, saturation_factor_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/adjust_saturation_op.h b/mindspore-lite/minddata/dataset/kernels/image/adjust_saturation_op.h index 26a1e79dcf9a3b934b1a8ddc0d28c9735253158d..6b62bf1742f055ddf1738472056605da3ea84d5f 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/adjust_saturation_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/adjust_saturation_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class AdjustSaturationOp : public TensorOp { public: @@ -41,5 +41,5 @@ class AdjustSaturationOp : public TensorOp { float saturation_factor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_ADJUST_SATURATION_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/affine_op.cc b/mindspore-lite/minddata/dataset/kernels/image/affine_op.cc index d2b4704b715b7dcbc3fd5e97e659877b93745227..99740a38481cde0035041f45d5990557a1b1e1dc 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/affine_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/affine_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/math_utils.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const InterpolationMode AffineOp::kDefInterpolation = InterpolationMode::kNearestNeighbour; const float_t AffineOp::kDegrees = 0.0; @@ -60,4 +60,4 @@ Status AffineOp::Compute(const std::shared_ptr &input, std::shared_ptr fill_value_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_AFFINE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.cc b/mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.cc index fdbb89fb2b89fad48aa50444b6499ff161e5f640..a898d94e2bea39f50d49a5cfdf0ff175ab7a73db 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { AutoAugmentOp::AutoAugmentOp(AutoAugmentPolicy policy, InterpolationMode interpolation, const std::vector &fill_value) @@ -152,4 +152,4 @@ Space AutoAugmentOp::GetSpace(int32_t num_bins, const std::vector &imag return space; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.h b/mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.h index 1329095457582462b025bb464b3ab080fa536960..fa8aa519a12b3ac376f1812f2b4f422eac5556ac 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.h @@ -36,7 +36,7 @@ typedef std::vector>> Transforms; typedef std::map, bool>> Space; -namespace mindspore { +namespace mindspore::lite { namespace dataset { class AutoAugmentOp : public RandomTensorOp { public: @@ -62,5 +62,5 @@ class AutoAugmentOp : public RandomTensorOp { Transforms transforms_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_AUTO_AUGMENT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/auto_contrast_op.cc b/mindspore-lite/minddata/dataset/kernels/image/auto_contrast_op.cc index 240cd27170d6b431b3aa5339f15331f5f2694501..670c9e352994736b9d43c839e58a2f76e885460e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/auto_contrast_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/auto_contrast_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const float AutoContrastOp::kCutOff = 0.0; const std::vector AutoContrastOp::kIgnore = {}; @@ -28,4 +28,4 @@ Status AutoContrastOp::Compute(const std::shared_ptr &input, std::shared return AutoContrast(input, output, cutoff_, ignore_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/auto_contrast_op.h b/mindspore-lite/minddata/dataset/kernels/image/auto_contrast_op.h index 632566585b179bf0bb7aba8c0dee735d68bfe6bf..5a79387235796f8e0feed4d9f5359b6120d66a54 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/auto_contrast_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/auto_contrast_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class AutoContrastOp : public TensorOp { public: @@ -54,5 +54,5 @@ class AutoContrastOp : public TensorOp { std::vector ignore_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_AUTO_CONTRAST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/bounding_box.cc b/mindspore-lite/minddata/dataset/kernels/image/bounding_box.cc index 133df5316bb10e80685f8fccd425fd16beb6e497..9b4e39bfd2a9eab45607f134bac205c6ddecb9ae 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/bounding_box.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/bounding_box.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const uint8_t kNumOfCols = 4; const float kEpsilon = 1e-4; @@ -231,4 +231,4 @@ Status BoundingBox::UpdateBBoxesForResize(const TensorPtr &bbox_list, size_t bbo return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/bounding_box.h b/mindspore-lite/minddata/dataset/kernels/image/bounding_box.h index 06677f6808c4eb1820a001a577280676962cd336..e581fde2197c9cd31f18518e849aaf7b3277771b 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/bounding_box.h +++ b/mindspore-lite/minddata/dataset/kernels/image/bounding_box.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor_row.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class BoundingBox { public: @@ -133,5 +133,5 @@ class BoundingBox { bbox_float height_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_BOUNDING_BOX_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/bounding_box_augment_op.cc b/mindspore-lite/minddata/dataset/kernels/image/bounding_box_augment_op.cc index 9ff49b66889c23a7bdd40785f334fad100714bbf..7985b24096ac5e087f502172333ac6ace5d68feb 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/bounding_box_augment_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/bounding_box_augment_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/kernels/image/resize_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const float BoundingBoxAugmentOp::kDefRatio = 0.3; @@ -74,4 +74,4 @@ Status BoundingBoxAugmentOp::Compute(const TensorRow &input, TensorRow *output) return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/bounding_box_augment_op.h b/mindspore-lite/minddata/dataset/kernels/image/bounding_box_augment_op.h index cecb3e920813017e7bf02461b5d4bef63083bf83..923e45ca9d21f6df252a0ff6ecbd47f8b4654c84 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/bounding_box_augment_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/bounding_box_augment_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class BoundingBoxAugmentOp : public RandomTensorOp { public: @@ -59,5 +59,5 @@ class BoundingBoxAugmentOp : public RandomTensorOp { std::shared_ptr transform_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_BOUNDING_BOX_AUGMENT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/center_crop_op.cc b/mindspore-lite/minddata/dataset/kernels/image/center_crop_op.cc index 9fe708713052da44952aff1c9e28a9b541caf373..e2514d6b45c55eab34023783ac5f8c4fda826f2c 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/center_crop_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/center_crop_op.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int32_t CenterCropOp::kDefWidth = 0; @@ -140,4 +140,4 @@ Status CenterCropOp::OutputShape(const std::vector &inputs, std::ve return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/center_crop_op.h b/mindspore-lite/minddata/dataset/kernels/image/center_crop_op.h index 6cf77a2a7bdbd7334fcec1bf3092c339c9c0c7aa..b9ff6834489608bb70ebe4163b447456dee0256c 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/center_crop_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/center_crop_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CenterCropOp : public TensorOp { public: @@ -52,5 +52,5 @@ class CenterCropOp : public TensorOp { int32_t crop_wid_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_CENTER_CROP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/convert_color_op.cc b/mindspore-lite/minddata/dataset/kernels/image/convert_color_op.cc index 3a1c9963d06a716ea7f1c5271c853635fb86f8ba..b54c4ffbd36bca3d514733d004173d6add6f0188 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/convert_color_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/convert_color_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { ConvertColorOp::ConvertColorOp(ConvertMode convert_mode) : convert_mode_(convert_mode) {} @@ -30,4 +30,4 @@ Status ConvertColorOp::Compute(const std::shared_ptr &input, std::shared return ConvertColor(input, output, convert_mode_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/convert_color_op.h b/mindspore-lite/minddata/dataset/kernels/image/convert_color_op.h index 0ecd7c2b93677f0f3c442473c717ff9fbf7bb1ec..750044d376d30298e0588cc29492bd51f1d16926 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/convert_color_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/convert_color_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ConvertColorOp : public TensorOp { public: @@ -41,5 +41,5 @@ class ConvertColorOp : public TensorOp { ConvertMode convert_mode_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_CONVERT_COLOR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/crop_op.cc b/mindspore-lite/minddata/dataset/kernels/image/crop_op.cc index 13a47efabab315632265f7b883ded083bb06fac6..e31621432f060d691b61df892f47a74d16ff3109 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/crop_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/crop_op.cc @@ -22,7 +22,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status CropOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -53,4 +53,4 @@ Status CropOp::OutputShape(const std::vector &inputs, std::vector &input, std::shared_ptr &inputs, std::vector &inputs, std::vecto return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/decode_video_op.h b/mindspore-lite/minddata/dataset/kernels/image/decode_video_op.h index d49944791237df7c1b8bca78b9536636beb2b6f7..ea8941deffdc0824fe5738033f3ab1e6e5422f56 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/decode_video_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/decode_video_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DecodeVideoOp : public TensorOp { public: @@ -41,5 +41,5 @@ class DecodeVideoOp : public TensorOp { std::string Name() const override { return kDecodeVideoOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DECODE_VIDEO_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.cc index c9c3d5262e066230d02fbd2deae7613dc336134f..e12f7f336e53ad9e4ed37676c5c7d89852bc244c 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.cc @@ -23,7 +23,7 @@ #include "utils/ms_context.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace { #if defined(BUILD_LITE) @@ -757,4 +757,4 @@ APP_ERROR AclAdapter::DestroyIntArray(void *int_array) { } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.h index f8a51dfec9613b268e830cd6380792269e3fbf83..97801d0357198fd5d7b9445366fd557d6cb1489e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/AclLiteError.h" #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/ErrorCode.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { class AclAdapter { public: static AclAdapter &GetInstance(); @@ -263,5 +263,5 @@ class AclAdapter { DestroyIntArrayFunObj destroy_int_array_fun_obj_; #endif }; -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_ACL_ADAPTER_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_crop_jpeg_op.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_crop_jpeg_op.cc index ffef87fdd08d2f6be68c2f43522e5c4a1ab7e8af..8f1642391d8a5f39bc760e49cf21f652b56981fa 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_crop_jpeg_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_crop_jpeg_op.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/CommonDataType.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DvppCropJpegOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -159,4 +159,4 @@ Status DvppCropJpegOp::SetAscendResource(const std::shared_ptr & return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_crop_jpeg_op.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_crop_jpeg_op.h index d976b24a9b28141b70aada9c8d11d425bc273329..0140cca857d502e378b333c5a16ed2d9454238a3 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_crop_jpeg_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_crop_jpeg_op.h @@ -31,7 +31,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DvppCropJpegOp : public TensorOp { public: @@ -56,5 +56,5 @@ class DvppCropJpegOp : public TensorOp { std::shared_ptr processor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_CROP_JPEG_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_jpeg_op.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_jpeg_op.cc index 0208ae2be640cf9fb131db9fb65113cd5f711c39..a89a980504b224889ef9e64ba853c5c176bb804e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_jpeg_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_jpeg_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/CommonDataType.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Compute() will be called when context=="Ascend310" Status DvppDecodeJpegOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { @@ -145,4 +145,4 @@ Status DvppDecodeJpegOp::OutputShape(const std::vector &inputs, std return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_jpeg_op.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_jpeg_op.h index 35135eca5277868c49e9d811b00ad521ce98bb79..1163f65aacdf1a10cfe33c00992822f2aaed8740 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_jpeg_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_jpeg_op.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DvppDecodeJpegOp : public TensorOp { public: @@ -53,5 +53,5 @@ class DvppDecodeJpegOp : public TensorOp { std::shared_ptr processor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_JPEG_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_png_op.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_png_op.cc index b60d982b74d87e21f43cba5820d68862b17346b5..04f98952dc12a50cfc36ed09c59fa5e902ad518a 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_png_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_png_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/CommonDataType.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DvppDecodePngOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -140,4 +140,4 @@ Status DvppDecodePngOp::SetAscendResource(const std::shared_ptr return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_png_op.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_png_op.h index f329f87d49ae18fa5dca71273f2a0ebf6bd51366..549f87cca241bb9931160064a0b54c935cab9b13 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_png_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_png_op.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DvppDecodePngOp : public TensorOp { public: @@ -53,5 +53,5 @@ class DvppDecodePngOp : public TensorOp { std::shared_ptr processor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_PNG_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_resize_crop_jpeg_op.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_resize_crop_jpeg_op.cc index 0ace3a58ededae9bf8fd708f808ca09c8b795e6d..7a6f475f3ce4d036f7153dee3257f742f6778e31 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_resize_crop_jpeg_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_resize_crop_jpeg_op.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/CommonDataType.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DvppDecodeResizeCropJpegOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { @@ -148,4 +148,4 @@ Status DvppDecodeResizeCropJpegOp::SetAscendResource(const std::shared_ptr processor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_RESIZE_CROP_JPEG_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_resize_jpeg_op.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_resize_jpeg_op.cc index a85eb8d65ff97c677573054580a0a6eedbc3ee35..d22ecb35ece4269701b9361b397e41e1a9e1d992 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_resize_jpeg_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_resize_jpeg_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/CommonDataType.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DvppDecodeResizeJpegOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { @@ -141,4 +141,4 @@ Status DvppDecodeResizeJpegOp::SetAscendResource(const std::shared_ptr processor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_RESIZE_JPEG_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_video_op.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_video_op.cc index 46b3031a46aa8cadf1e27d4230c12221c88ffe9e..917c04863823e7a4265cc86b5f5576e0735b6b36 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_video_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_video_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/acl_adapter.h" #include "mindspore-lite/minddata/dataset/util/path.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const VdecOutputFormat DvppDecodeVideoOp::kDefVdecOutputFormat = VdecOutputFormat::kYuvSemiplanar420; const char DvppDecodeVideoOp::kDefOutput[] = "./output"; @@ -87,4 +87,4 @@ Status DvppDecodeVideoOp::OutputShape(const std::vector &inputs, st return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_video_op.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_video_op.h index 9e240388e43ff24a37033dcbf871d727369ae112..ebe314ed96781251fe51fc405d289f6207fb5bda 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_video_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_decode_video_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DvppDecodeVideoOp : public TensorOp { public: @@ -68,5 +68,5 @@ class DvppDecodeVideoOp : public TensorOp { std::string output_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_VIDEO_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_normalize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_normalize_op.cc index c66f4fdd4c2dc8ed9ae70919f588b270748a867a..78ff72a5f023380e6097dfe43fc9298087494d6f 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_normalize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_normalize_op.cc @@ -18,7 +18,7 @@ #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DvppNormalizeOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { const TensorShape dvpp_shape({1, 1, 1}); @@ -38,4 +38,4 @@ Status DvppNormalizeOp::Compute(const std::shared_ptr &input, std: Status DvppNormalizeOp::SetAscendResource(const std::shared_ptr &resource) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_normalize_op.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_normalize_op.h index 00544d7aa09919935293c3afbdefdb8e52dcfb18..0090b6fae26f720ccd6be53a694fbd99c0b7b9e7 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_normalize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_normalize_op.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DvppNormalizeOp : public TensorOp { public: @@ -47,5 +47,5 @@ class DvppNormalizeOp : public TensorOp { std::vector std_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_NORMALIZE_JPEG_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_resize_jpeg_op.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_resize_jpeg_op.cc index 8b288abebc23cf5964638cf2135fe72206b3f042..a05b1b35031275dbe344c1af8059e3fd345e6a64 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_resize_jpeg_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_resize_jpeg_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/CommonDataType.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DvppResizeJpegOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -159,4 +159,4 @@ Status DvppResizeJpegOp::OutputShape(const std::vector &inputs, std return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_resize_jpeg_op.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_resize_jpeg_op.h index 1e6b98dc2c080dc144f675cb141be97c3466d9a0..2211e1fc82f03a398aeb43a7c55afeb18ea6c8d1 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_resize_jpeg_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend310/dvpp_resize_jpeg_op.h @@ -31,7 +31,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class DvppResizeJpegOp : public TensorOp { public: @@ -57,5 +57,5 @@ class DvppResizeJpegOp : public TensorOp { std::shared_ptr processor_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_RESIZE_JPEG_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/acl_env_guard.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/acl_env_guard.cc index 10c3c393ff5eb9dd63ecd3a1141ae208849cc788..f02e5132adac4e303411f8fefe62fd605d64fceb 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/acl_env_guard.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/acl_env_guard.cc @@ -19,7 +19,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { std::shared_ptr AclEnvGuard::global_acl_env_ = nullptr; std::mutex AclEnvGuard::global_acl_env_mutex_; @@ -91,4 +91,4 @@ std::shared_ptr AclEnvGuard::GetAclEnv() { } return acl_env; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/acl_env_guard.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/acl_env_guard.h index 66bd7c877b6a9262b36b658f8cddca6339c94fce..e2291898b2487e61937790e81cfdacc3cb3dc64e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/acl_env_guard.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/acl_env_guard.h @@ -20,7 +20,7 @@ #include #include "acl/acl_base.h" -namespace mindspore { +namespace mindspore::lite { class __attribute__((visibility("default"))) AclInitAdapter { public: static AclInitAdapter &GetInstance(); @@ -49,5 +49,5 @@ class __attribute__((visibility("default"))) AclEnvGuard { aclError errno_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_CXX_API_GRAPH_ACL_ACL_ENV_GUARD_H diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/dvpp_image_utils.cc b/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/dvpp_image_utils.cc index adaf1891bfcb64438ce22805810465ec1f66d983..35c8ce4b349d5fba3c64eabd2b0a0c1c48018c46 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/dvpp_image_utils.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/dvpp_image_utils.cc @@ -70,7 +70,7 @@ #include "acldvppop/acldvpp_warp_perspective.h" #include "plugin/ascend/res_manager/stream_manager/ascend_stream_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { APP_ERROR DvppAdjustBrightness(const std::shared_ptr &input, std::shared_ptr *output, float factor) { @@ -2837,4 +2837,4 @@ APP_ERROR DestroyIntArray(void *int_array) { return APP_ERR_OK; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/dvpp_image_utils.h b/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/dvpp_image_utils.h index 7e242228f2b35d5f83ba9603d2b5f82aba3e36da..3264cc716b568127c934798185aaec735c2069fa 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/dvpp_image_utils.h +++ b/mindspore-lite/minddata/dataset/kernels/image/dvpp/utils/dvpp_image_utils.h @@ -40,7 +40,7 @@ #include "acldvppop/acldvpp_base.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int kInvalidInterpolationMode = 100; const int kInvalidPaddingMode = 101; @@ -352,5 +352,5 @@ APP_ERROR DestroyFloatArray(void *float_array); APP_ERROR DestroyIntArray(void *int_array); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_UTILS_DVPP_IMAGE_UTILS_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/equalize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/equalize_op.cc index 723bab0f4d6ff4c81abdc8a054d3003d45ee3551..040f21a3d245a4d6d58fc3676629da900c1f6e72 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/equalize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/equalize_op.cc @@ -17,7 +17,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // only supports RGB images Status EqualizeOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { @@ -25,4 +25,4 @@ Status EqualizeOp::Compute(const std::shared_ptr &input, std::shared_ptr return Equalize(input, output); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/equalize_op.h b/mindspore-lite/minddata/dataset/kernels/image/equalize_op.h index 5802bb4c5d46a1f2f3760a95297d24dd066e6133..56167957c389eaeedb7b85fa296deb5869127c0a 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/equalize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/equalize_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class EqualizeOp : public TensorOp { public: @@ -37,5 +37,5 @@ class EqualizeOp : public TensorOp { std::string Name() const override { return kEqualizeOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_EQUALIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/erase_op.cc b/mindspore-lite/minddata/dataset/kernels/image/erase_op.cc index cf7755a6e722062601be6b0a478c19c7856cedd0..03323089324b3c429a11569a18ef6e0d535bac83 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/erase_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/erase_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // constructor EraseOp::EraseOp(int32_t top, int32_t left, int32_t height, int32_t width, const std::vector &value, @@ -40,4 +40,4 @@ Status EraseOp::Compute(const std::shared_ptr &input, std::shared_ptr T parse_bytes(const uint8_t *buf, bool intel_align); @@ -158,4 +158,4 @@ int ExifInfo::parseOrientation(const unsigned char *data, unsigned len) { return parseExif(data + offset, len - offset); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/exif_utils.h b/mindspore-lite/minddata/dataset/kernels/image/exif_utils.h index 7a35847521a549f111c5598b84beb851b4a5ca03..ced28b9f2830513554d1afb199310993e160d8ac 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/exif_utils.h +++ b/mindspore-lite/minddata/dataset/kernels/image/exif_utils.h @@ -17,7 +17,7 @@ #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_EXIF_H_ #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_EXIF_H_ -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ExifInfo { @@ -25,5 +25,5 @@ class ExifInfo { int parseOrientation(const unsigned char *data, unsigned len); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_EXIF_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/gaussian_blur_op.cc b/mindspore-lite/minddata/dataset/kernels/image/gaussian_blur_op.cc index 0d37747dcff97f63fda564dc5310dd1494d4eafc..62a612a07d564dbcd72aa71f6a61e326ac6da8cb 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/gaussian_blur_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/gaussian_blur_op.cc @@ -22,7 +22,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status GaussianBlurOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -30,4 +30,4 @@ Status GaussianBlurOp::Compute(const std::shared_ptr &input, std::shared return GaussianBlur(input, output, kernel_x_, kernel_y_, sigma_x_, sigma_y_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/gaussian_blur_op.h b/mindspore-lite/minddata/dataset/kernels/image/gaussian_blur_op.h index 01ba7600d0e37eb011cb4e045b18b8fb3d3c545b..cf96ff6b4783dea859611c11b08ccda895217597 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/gaussian_blur_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/gaussian_blur_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class GaussianBlurOp : public TensorOp { public: @@ -59,5 +59,5 @@ class GaussianBlurOp : public TensorOp { float sigma_y_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_GAUSSIAN_BLUR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/horizontal_flip_op.cc b/mindspore-lite/minddata/dataset/kernels/image/horizontal_flip_op.cc index 784a37dc16562e984e1c889456740c730ca63ba0..33616614c98e75b366fa8adada8309581efa7f95 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/horizontal_flip_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/horizontal_flip_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status HorizontalFlipOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -52,4 +52,4 @@ Status HorizontalFlipOp::Compute(const std::shared_ptr &input, std::shar return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/horizontal_flip_op.h b/mindspore-lite/minddata/dataset/kernels/image/horizontal_flip_op.h index e34e0bee0c2f06113e17ea02725682c90f00f30f..622242a3ecf1c1d847f6dde7ea564e095cc801fe 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/horizontal_flip_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/horizontal_flip_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class HorizontalFlipOp : public TensorOp { public: @@ -36,5 +36,5 @@ class HorizontalFlipOp : public TensorOp { std::string Name() const override { return kHorizontalFlipOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_HORIZONTAL_FLIP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/hwc_to_chw_op.cc b/mindspore-lite/minddata/dataset/kernels/image/hwc_to_chw_op.cc index a9e329909adf2413801e093c6a3c81acedd4b5da..c357abab831d07be66400191ceb5a0f0a5186124 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/hwc_to_chw_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/hwc_to_chw_op.cc @@ -22,7 +22,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status HwcToChwOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -44,4 +44,4 @@ Status HwcToChwOp::OutputShape(const std::vector &inputs, std::vect return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/hwc_to_chw_op.h b/mindspore-lite/minddata/dataset/kernels/image/hwc_to_chw_op.h index 9bfedf1accfae39950fcfe2b806b538bc5b52f8b..0869973c6ae2f31ebcb3915e27c0c98bb50732f1 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/hwc_to_chw_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/hwc_to_chw_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class HwcToChwOp : public TensorOp { public: @@ -35,5 +35,5 @@ class HwcToChwOp : public TensorOp { std::string Name() const override { return kHwcToChwOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_HWC_TO_CHW_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/image_utils.cc b/mindspore-lite/minddata/dataset/kernels/image/image_utils.cc index f8a76f908ee4e3207309b1a58e0de85c89b76733..a72d271e5f61b84c8c8d917fc259a5dff487dceb 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/image_utils.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/image_utils.cc @@ -45,7 +45,7 @@ const int32_t DOUBLING_FACTOR = 2; // used as multiplier with MAX_INT_ const int32_t DEFAULT_NUM_HEIGHT = 1; const int32_t DEFAULT_NUM_WIDTH = 1; -namespace mindspore { +namespace mindspore::lite { namespace dataset { int GetCVInterpolationMode(InterpolationMode mode) { switch (mode) { @@ -2864,4 +2864,4 @@ Status CheckUnsupportedImage(const std::shared_ptr &image) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/image_utils.h b/mindspore-lite/minddata/dataset/kernels/image/image_utils.h old mode 100755 new mode 100644 index 664c359457339978f305964e5c7e653c90c740c7..c44fe582c10789e5c2ed282096450090bd5b0d1c --- a/mindspore-lite/minddata/dataset/kernels/image/image_utils.h +++ b/mindspore-lite/minddata/dataset/kernels/image/image_utils.h @@ -41,7 +41,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr dsize_t kChannelIndexHWC = 2; // images are hwc, so index 2 represents number of channels constexpr dsize_t kChannelIndexCHW = 0; // images are chw, so index 0 represents number of channels @@ -597,5 +597,5 @@ Status DumpImageAndAppendStatus(const std::shared_ptr &image, const Stat /// \return Status code. Status CheckUnsupportedImage(const std::shared_ptr &image); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_IMAGE_UTILS_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/invert_op.cc b/mindspore-lite/minddata/dataset/kernels/image/invert_op.cc index e59c819c7f77fcd9c917085d3e050f24abf3a1e1..ce25b902df02fb0443b36e724115f38c75edc518 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/invert_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/invert_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // only supports RGB images Status InvertOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { @@ -32,4 +32,4 @@ Status InvertOp::Compute(const std::shared_ptr &input, std::shared_ptr buffer(ksize + 1); @@ -281,4 +281,4 @@ bool Canny(const LiteMat &src, LiteMat &dst, double low_thresh, double high_thre return true; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/gaussian_blur.cc b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/gaussian_blur.cc index b7ee90c347e2f4b9e4057901b57f83d5551ba0b8..d9f5c2c9f1885b02d5c61f097957e62ec6fe9a0b 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/gaussian_blur.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/gaussian_blur.cc @@ -26,7 +26,7 @@ #endif #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { static void GetGaussianKernel(float *kernel, int size, double sigma) { int n = (size - 1) / 2; @@ -86,4 +86,4 @@ bool GaussianBlur(const LiteMat &src, LiteMat &dst, const std::vector &ksiz return ConvRowCol(src, kx, ky, dst, src.data_type_, pad_type); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/image_process.cc b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/image_process.cc index b0298d500773cc78f1db1df4ee9f22a1b073ff00..74c2ab51096be2922ff9ac4309e60a4cef80600e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/image_process.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/image_process.cc @@ -29,7 +29,7 @@ #include #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr uint32_t kR2Gray = 9798; constexpr uint32_t kG2Gray = 19235; @@ -2157,4 +2157,4 @@ bool HWC2CHW(LiteMat &src, LiteMat &dst) { return true; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/image_process.h b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/image_process.h index 034bbe752c618c6bc7b28f700d38ebd6e1e2ef71..fda82bc99692fcd70cb3ad69532dd585c275c3c1 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/image_process.h +++ b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/image_process.h @@ -25,7 +25,7 @@ #include "lite_cv/lite_mat.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #define CV_PI 3.1415926535897932384626433832795 #define IM_TOOL_EXIF_ORIENTATION_0_DEG 1 @@ -653,5 +653,5 @@ bool DATASET_API ResizePreserveARWithFiller(LiteMat &src, LiteMat &dst, int h, i /// \return Return true if transform successfully. bool DATASET_API HWC2CHW(LiteMat &src, LiteMat &dst); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // IMAGE_PROCESS_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/lite_mat.cc b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/lite_mat.cc index afb12019180f8b4e1a8a9479d8ece2a309e2aae8..3fb71dd33d64bc56881ef23c7e0629744ef54a46 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/lite_mat.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/lite_mat.cc @@ -23,7 +23,7 @@ #include #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { LiteMat::LiteMat() { data_ptr_ = nullptr; @@ -746,4 +746,4 @@ bool Multiply(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst) { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/lite_mat.h b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/lite_mat.h index 782d9bfb90bc394281c524bee7ec467eb71dc324..97decc32b9cf852e4e3375fb08ba07a4a31b3389 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/lite_mat.h +++ b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/lite_mat.h @@ -22,7 +22,7 @@ #include "include/api/visible.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr int kAlign = 16; constexpr size_t kMaxDims = 3; @@ -477,5 +477,5 @@ bool DATASET_API Multiply(const LiteMat &src_a, const LiteMat &src_b, LiteMat *d } while (false) } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINI_MAT_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/warp_affine.cc b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/warp_affine.cc index 95d52e331c09ba33dd113a398336c6276ecb79b5..afd4509c5b572e29e71c772ce040559a78e9cc6f 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/lite_cv/warp_affine.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/lite_cv/warp_affine.cc @@ -26,7 +26,7 @@ constexpr int kTabSz = 1 << kBits; constexpr int kTabSz2 = kTabSz * kTabSz; constexpr int kRemapScale = 1 << 15; -namespace mindspore { +namespace mindspore::lite { namespace dataset { static int16_t BWBlock_i[kTabSz2][2][2]; @@ -575,4 +575,4 @@ bool WarpPerspectiveBilinear(const LiteMat &src, LiteMat &dst, const LiteMat &M, } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.cc b/mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.cc index dd6b0ac17277a4fdf12df7583669a7f3d097ac6a..6b629d7d6f5038ad47abbfc766f3e5746384f8b9 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.cc @@ -44,7 +44,7 @@ constexpr int64_t hw_shape = 2; constexpr int64_t hwc_rank = 3; #define MAX_INT_PRECISION 16777216 // float int precision is 16777216 -namespace mindspore { +namespace mindspore::lite { namespace dataset { #if defined(ENABLE_CLOUD_FUSION_INFERENCE) bool IsNonEmptyPNG(const std::shared_ptr &input) { @@ -1216,4 +1216,4 @@ Status HwcToChw(const std::shared_ptr &input, std::shared_ptr *o return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h b/mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h index 238d0c3fb23ddaf119afe25f33a0c96af64ac230..7f122d43c004b4b871d09ba75880f8c7b2698929 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h +++ b/mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h @@ -38,7 +38,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr dsize_t kChannelIndexHWC = 2; // images are hwc, so index 2 represents number of channels constexpr dsize_t kChannelIndexCHW = 0; // images are chw, so index 0 represents number of channels @@ -235,5 +235,5 @@ Status ValidateImageRank(const std::string &op_name, int32_t rank); /// \param output: Tensor of shape or and same input type. Status HwcToChw(const std::shared_ptr &input, std::shared_ptr *output); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_LITE_IMAGE_UTILS_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/math_utils.cc b/mindspore-lite/minddata/dataset/kernels/image/math_utils.cc index a944dab1efe06092b7d8d598e501ac097d53c441..4cb468004bb10dce4fab8bc3fae37837177f2d82 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/math_utils.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/math_utils.cc @@ -20,7 +20,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status ComputeUpperAndLowerPercentiles(std::vector *hist, int32_t hi_p, int32_t low_p, int32_t *hi, int32_t *lo) { @@ -84,4 +84,4 @@ Status GenerateRealNumber(float_t a, float_t b, std::mt19937 *rnd, float_t *resu return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/math_utils.h b/mindspore-lite/minddata/dataset/kernels/image/math_utils.h index 116cf11215f9f1b129c88aa41169f82288e1ad52..8f564f418ecb99049059d48d7ed5bf974d999981 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/math_utils.h +++ b/mindspore-lite/minddata/dataset/kernels/image/math_utils.h @@ -24,7 +24,7 @@ #define CV_PI 3.1415926535897932384626433832795 -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Returns lower and upper pth percentiles of the input histogram. /// \param[in] hist: Input histogram (mutates the histogram for computation purposes) @@ -47,5 +47,5 @@ Status DegreesToRadians(float_t degrees, float_t *radians_target); /// \param[out] result: Random number in range [a,b) Status GenerateRealNumber(float_t a, float_t b, std::mt19937 *rnd, float_t *result); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_MATH_UTILS_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/mixup_batch_op.cc b/mindspore-lite/minddata/dataset/kernels/image/mixup_batch_op.cc index dd564f6ea09c44e3b001f86c25600b3e9ad18481..7f53a9e368e690fe3ed4d36fced7e51d5a762b84 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/mixup_batch_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/mixup_batch_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr size_t kExpectedImageShapeSize = 4; constexpr size_t kMaxLabelShapeSize = 3; @@ -168,4 +168,4 @@ void MixUpBatchOp::Print(std::ostream &out) const { << "alpha: " << alpha_ << "\n"; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/mixup_batch_op.h b/mindspore-lite/minddata/dataset/kernels/image/mixup_batch_op.h index e00df80ac7e78ce0971a775c779d29cc585c98e1..defdeb1c26c61a40c03d14e79fb0b755ee949edf 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/mixup_batch_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/mixup_batch_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class MixUpBatchOp : public RandomTensorOp { public: @@ -48,5 +48,5 @@ class MixUpBatchOp : public RandomTensorOp { float alpha_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_MIXUP_BATCH_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/normalize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/normalize_op.cc index 9212bd2cef0b5c76693abd4523cff981912b9a82..964d44dd8a5296edc58bb205a1b949ca265f6152 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/normalize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/normalize_op.cc @@ -27,7 +27,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { NormalizeOp::NormalizeOp(std::vector mean, std::vector std, bool is_hwc) : mean_(std::move(mean)), std_(std::move(std)), is_hwc_(is_hwc) {} @@ -85,4 +85,4 @@ void NormalizeOp::Print(std::ostream &out) const { out << "}" << std::endl; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/normalize_op.h b/mindspore-lite/minddata/dataset/kernels/image/normalize_op.h index 5472a27c988ade17fce2dd35fe6d4ca775dfc08f..01669950d7e4fcd4296700b1e4505e24129c4af6 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/normalize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/normalize_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class NormalizeOp : public TensorOp { public: @@ -44,5 +44,5 @@ class NormalizeOp : public TensorOp { bool is_hwc_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_NORMALIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/normalize_pad_op.cc b/mindspore-lite/minddata/dataset/kernels/image/normalize_pad_op.cc index 5ef81a5cbd2ecc96813be2a5e7b5ec705143b43e..b4ec7d37dc654298e0825ef60094b663ef65ddd1 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/normalize_pad_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/normalize_pad_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { NormalizePadOp::NormalizePadOp(std::vector mean, std::vector std, std::string dtype, bool is_hwc) : mean_(std::move(mean)), std_(std::move(std)), dtype_(std::move(dtype)), is_hwc_(is_hwc) {} @@ -45,4 +45,4 @@ void NormalizePadOp::Print(std::ostream &out) const { out << "}" << std::endl; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/normalize_pad_op.h b/mindspore-lite/minddata/dataset/kernels/image/normalize_pad_op.h index 3c4af56322031d09dacb99450f774d18bdebd025..19828c73a6051eff97cfd1526c8ddf7eda2a0526 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/normalize_pad_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/normalize_pad_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class NormalizePadOp : public TensorOp { public: @@ -45,5 +45,5 @@ class NormalizePadOp : public TensorOp { bool is_hwc_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_NORMALIZE_PAD_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/pad_op.cc b/mindspore-lite/minddata/dataset/kernels/image/pad_op.cc index a8e7301a0f3b8cb37fb043145e752743c44cf34c..790cae097e96a688da38b375adfa9bf776f6cea3 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/pad_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/pad_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const BorderType PadOp::kDefBorderType = BorderType::kConstant; const uint8_t PadOp::kDefFillR = 0; @@ -56,4 +56,4 @@ Status PadOp::OutputShape(const std::vector &inputs, std::vector size, std::vector offset, std::vector fill_value, BorderType padding_mode) @@ -87,4 +87,4 @@ Status PadToSizeOp::OutputShape(const std::vector &inputs, std::vec return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/pad_to_size_op.h b/mindspore-lite/minddata/dataset/kernels/image/pad_to_size_op.h index 70166ccca20e1f2bcae3a0efdc1d7cb1239da91d..df9d0bfaef549ea99f2cd04823c698b3c677115a 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/pad_to_size_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/pad_to_size_op.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class PadToSizeOp : public TensorOp { public: @@ -44,5 +44,5 @@ class PadToSizeOp : public TensorOp { BorderType boarder_type_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_PAD_TO_SIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/perspective_op.cc b/mindspore-lite/minddata/dataset/kernels/image/perspective_op.cc index 84d3b48551496588d42378a803812adaff20d354..e85578f7e8407329215e84e3b627414d197b9601 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/perspective_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/perspective_op.cc @@ -17,7 +17,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { PerspectiveOp::PerspectiveOp(const std::vector> &start_points, const std::vector> &end_points, InterpolationMode interpolation) @@ -28,4 +28,4 @@ Status PerspectiveOp::Compute(const std::shared_ptr &input, std::shared_ return Perspective(input, output, start_points_, end_points_, interpolation_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/perspective_op.h b/mindspore-lite/minddata/dataset/kernels/image/perspective_op.h index 104b25e586b4e63ba59889394dca09e502a6d838..e5180222d9f8efaa5d361758c984295516a19f30 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/perspective_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/perspective_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class PerspectiveOp : public TensorOp { public: @@ -45,5 +45,5 @@ class PerspectiveOp : public TensorOp { InterpolationMode interpolation_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_PERSPECTIVE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/posterize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/posterize_op.cc index f9c6587a8b84b9b4c52ba0cbd91560f3c71dbf16..a076a9d845498a1bc894de2ba6f787d7f917bb27 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/posterize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/posterize_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { PosterizeOp::PosterizeOp(uint8_t bit) : bit_(bit) {} @@ -27,4 +27,4 @@ Status PosterizeOp::Compute(const std::shared_ptr &input, std::shared_pt return Posterize(input, output, bit_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/posterize_op.h b/mindspore-lite/minddata/dataset/kernels/image/posterize_op.h index a62a1549cde73b057617c84d1417e677e8862e8c..0f5d5635dbff5456791bd30c8f19207f73f86909 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/posterize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/posterize_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class PosterizeOp : public TensorOp { public: @@ -42,5 +42,5 @@ class PosterizeOp : public TensorOp { uint8_t bit_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_POSTERIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.cc b/mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.cc index a1736dbeb540fea31b6625a65de41130d7f464b6..88bfdf6e20873b1f8ef015ef16205e97d24f5a8a 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandAugmentOp::RandAugmentOp(int32_t num_ops, int32_t magnitude, int32_t num_magnitude_bins, InterpolationMode interpolation, std::vector fill_value) @@ -90,4 +90,4 @@ int32_t RandAugmentOp::RandInt(int32_t low, int32_t high) { return dis(random_generator_) % (high - low) + low; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.h b/mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.h index 73c53c7c980536094e0776d3f19cfe1675c48838..dea3ff93695eb0eacc802b30ba5a602e51be7c79 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.h @@ -37,7 +37,7 @@ typedef std::map, bool>> Space; -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandAugmentOp : public RandomTensorOp { public: @@ -62,5 +62,5 @@ class RandAugmentOp : public RandomTensorOp { std::vector fill_value_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RAND_AUGMENT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_adjust_sharpness_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_adjust_sharpness_op.cc index b021c1a567dc6e8ff140c05aa58f705134d5a40d..3e9fa2225c9d584d7721baa66ab03578e9625b93 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_adjust_sharpness_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_adjust_sharpness_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomAdjustSharpnessOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -39,4 +39,4 @@ Status RandomAdjustSharpnessOp::Compute(const std::shared_ptr &input, st return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_adjust_sharpness_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_adjust_sharpness_op.h index 1c531e4ebe74edc9a785d38e2847ebc3768103f1..dea8c6cf5cbbe47c5e9e6a33e6cefced07f36c82 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_adjust_sharpness_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_adjust_sharpness_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomAdjustSharpnessOp : public RandomTensorOp { public: @@ -47,5 +47,5 @@ class RandomAdjustSharpnessOp : public RandomTensorOp { std::bernoulli_distribution distribution_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_ADJUST_SHARPNESS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_affine_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_affine_op.cc index fbcd7e1c6c211b10ba04be15ed0597fcdd0f4bcc..a22dd1a995c763028bd3607bef487d736f47cec6 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_affine_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_affine_op.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/math_utils.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const std::vector RandomAffineOp::kDegreesRange = {0.0, 0.0}; const std::vector RandomAffineOp::kTranslationPercentages = {0.0, 0.0, 0.0, 0.0}; @@ -88,4 +88,4 @@ Status RandomAffineOp::Compute(const std::shared_ptr &input, std::shared return Affine(input, output, degrees, translation, scale, shear, interpolation_, fill_value_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_affine_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_affine_op.h index b2e70ef5e4652fba13655fc77130068e1473bb83..478e26bd723d0520edeaaefbbb9c6d33e3cdca41 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_affine_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_affine_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/affine_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomAffineOp : public RandomTensorOp { public: @@ -58,5 +58,5 @@ class RandomAffineOp : public RandomTensorOp { std::vector fill_value_; // fill_value }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_AFFINE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_auto_contrast_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_auto_contrast_op.cc index 6e39092019f570b9cd02a30a649f88a57a4aa43e..e9fc54ffa4d7051d38257e829d956748c79dc1ad 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_auto_contrast_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_auto_contrast_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomAutoContrastOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -45,4 +45,4 @@ Status RandomAutoContrastOp::Compute(const std::shared_ptr &input, std:: return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_auto_contrast_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_auto_contrast_op.h index 20aae6c68255c20921ab52b93583bfb66d08957e..3bf092a5c0904e162f01e6ddc08519a6a9ffae9d 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_auto_contrast_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_auto_contrast_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomAutoContrastOp : public RandomTensorOp { public: @@ -51,5 +51,5 @@ class RandomAutoContrastOp : public RandomTensorOp { std::bernoulli_distribution distribution_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_AUTO_CONTRAST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_color_adjust_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_color_adjust_op.cc index 32af5d40a860dc8d17c86eb6b307630d68293f49..a30fcba896a117a4aa9c2e3fd0eb89169c59f4be 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_color_adjust_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_color_adjust_op.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomColorAdjustOp::RandomColorAdjustOp(float s_bright_factor, float e_bright_factor, float s_contrast_factor, float e_contrast_factor, float s_saturation_factor, float e_saturation_factor, @@ -90,4 +90,4 @@ Status RandomColorAdjustOp::Compute(const std::shared_ptr &input, std::s return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_color_adjust_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_color_adjust_op.h index a256a23b64c42f5a269129997cc5411229ef4008..5b95780803723c84eb2d3838ca5f6fdee070fa8b 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_color_adjust_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_color_adjust_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomColorAdjustOp : public RandomTensorOp { public: @@ -69,5 +69,5 @@ class RandomColorAdjustOp : public RandomTensorOp { float hue_factor_end_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_COLOR_ADJUST_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_color_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_color_op.cc index ecefa1e6640f4db0ccd82eaf8e2cf98eb82dee24..1cc75bfd48ee9015c17e6849d79e19f08efd493b 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_color_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_color_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/core/cv_tensor.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomColorOp::RandomColorOp(float t_lb, float t_ub) : dist_(t_lb, t_ub), t_lb_(t_lb), t_ub_(t_ub) {} @@ -64,4 +64,4 @@ Status RandomColorOp::Compute(const std::shared_ptr &input, std::shared_ return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_color_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_color_op.h index 418cbb0833ab3b58ca32debc9833e7161cb5b3c0..ed7ba1368c8163d5c2c27232dfa45f4127368e3f 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_color_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_color_op.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \class RandomColorOp random_color_op.h /// \brief Blends an image with its grayscale version with random weights @@ -63,5 +63,5 @@ class RandomColorOp : public RandomTensorOp { float t_ub_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_RANDOM_COLOR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.cc index 38230e1513f9e54f664b71671ff6b74e88133b18..dc33a27014d46e45c94e6f42790a143e38afab57 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomCropAndResizeOp::RandomCropAndResizeOp(int32_t target_height, int32_t target_width, float scale_lb, float scale_ub, float aspect_lb, float aspect_ub, @@ -196,4 +196,4 @@ Status RandomCropAndResizeOp::GetCropBox(int h_in, int w_in, int *x, int *y, int return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.h index f32ba950033421b220704a8d73a06a2a96469f81..146ea75b598fb8be9c0ddf07493c6276928166d4 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomCropAndResizeOp : public RandomTensorOp { public: @@ -65,5 +65,5 @@ class RandomCropAndResizeOp : public RandomTensorOp { double aspect_ub_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_CROP_AND_RESIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_with_bbox_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_with_bbox_op.cc index 0eb46ef437fad0c18208025a5713d397cdbbdb65..350f4c14e0bfe052ce1aefd33360ae6803dbea06 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_with_bbox_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_with_bbox_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomCropAndResizeWithBBoxOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -53,4 +53,4 @@ Status RandomCropAndResizeWithBBoxOp::Compute(const TensorRow &input, TensorRow return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_with_bbox_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_with_bbox_op.h index 1b7095444bd373568d45715a7992e818d35b590a..cfbb3ab3eb76a6cc0439b05019d77b426bffe173 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_with_bbox_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_with_bbox_op.h @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/random_crop_and_resize_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomCropAndResizeWithBBoxOp : public RandomCropAndResizeOp { public: @@ -42,5 +42,5 @@ class RandomCropAndResizeWithBBoxOp : public RandomCropAndResizeOp { std::string Name() const override { return kRandomCropAndResizeWithBBoxOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_CROP_AND_RESIZE_WITH_BBOX_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_decode_resize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_crop_decode_resize_op.cc index ee5b13f17ba10eea86bda90729fa8d9320b07e67..b0983d0c873c6f61f2af455057ddb064d9799ea4 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_decode_resize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_decode_resize_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/decode_op.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomCropDecodeResizeOp::RandomCropDecodeResizeOp(int32_t target_height, int32_t target_width, float scale_lb, float scale_ub, float aspect_lb, float aspect_ub, @@ -62,4 +62,4 @@ Status RandomCropDecodeResizeOp::Compute(const TensorRow &input, TensorRow *outp return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_decode_resize_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_crop_decode_resize_op.h index 45bcef68982234e407a5b4e0754a456529ebb24c..9f348ede493a6ce10eb8ca54e2b080cd2bfe8002 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_decode_resize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_decode_resize_op.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomCropDecodeResizeOp : public RandomCropAndResizeOp { public: @@ -48,5 +48,5 @@ class RandomCropDecodeResizeOp : public RandomCropAndResizeOp { std::string Name() const override { return kRandomCropDecodeResizeOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_CROP_DECODE_RESIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_crop_op.cc index 6213bc409aa2d08ff485300d4191a87615fae9a3..6306297f12f756e4c56a9168ad2ff0b57c633d98 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomCropOp::RandomCropOp(int32_t crop_height, int32_t crop_width, int32_t pad_top, int32_t pad_bottom, int32_t pad_left, int32_t pad_right, bool pad_if_needed, BorderType padding_mode, @@ -223,4 +223,4 @@ Status RandomCropOp::OutputShape(const std::vector &inputs, std::ve std::to_string(inputs[0].Rank())); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_crop_op.h index 7fbe9b10639127edecb05718c520c46d6f7b6b56..627bc3238eb833bfa9dfed05a967e07151b22685 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomCropOp : public RandomTensorOp { public: @@ -88,5 +88,5 @@ class RandomCropOp : public RandomTensorOp { uint8_t fill_b_ = 0; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_CROP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_with_bbox_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_crop_with_bbox_op.cc index aff3ee7ccaba1ab0f79b87a7e69dcf72ed24f599..2b99bc47e45a7f2495739b4dfd573a6e57f50b46 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_with_bbox_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_with_bbox_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomCropWithBBoxOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -71,4 +71,4 @@ Status RandomCropWithBBoxOp::Compute(const TensorRow &input, TensorRow *output) return Crop(pad_image, &(*output)[0], x, y, RandomCropOp::crop_width_, RandomCropOp::crop_height_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_crop_with_bbox_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_crop_with_bbox_op.h index 71e2ace0a4fe8d1521ffa2d86f0e1023ffeea1ce..a68efdd7234e414d18c36a76c348f1016205fa7e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_crop_with_bbox_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_crop_with_bbox_op.h @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/random_crop_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomCropWithBBoxOp : public RandomCropOp { public: @@ -44,5 +44,5 @@ class RandomCropWithBBoxOp : public RandomCropOp { std::string Name() const override { return kRandomCropWithBBoxOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_CROP_WITH_BBOX_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_equalize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_equalize_op.cc index 85f6c61b6157d4d26c093fd25ec3dcb715116f23..744cb0b1294c744a4534861960044abfb8d7b84d 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_equalize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_equalize_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomEqualizeOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -41,4 +41,4 @@ Status RandomEqualizeOp::Compute(const std::shared_ptr &input, std::shar return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_equalize_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_equalize_op.h index f954b93c25f1daa0683b0deb555f9ce21b3773a5..1f89760ed0c27b91fba93417fa8baf563863ead0 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_equalize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_equalize_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomEqualizeOp : public RandomTensorOp { public: @@ -47,5 +47,5 @@ class RandomEqualizeOp : public RandomTensorOp { std::bernoulli_distribution distribution_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_EQUALIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_op.cc index 8fde3486996a881710c885ac39dd760671a2e049..88b9e6b9c49afbc412ec3829c4ce9f2609a7dac0 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomHorizontalFlipOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -64,4 +64,4 @@ Status RandomHorizontalFlipOp::Compute(const TensorRow &input, TensorRow *output return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_op.h index 2d04115b91e1d0f363374372a37d66f3722f0ad0..6a2e59c3091bc5bf2c093c1d57a2dbe4bfde3755 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomHorizontalFlipOp : public RandomTensorOp { public: @@ -51,5 +51,5 @@ class RandomHorizontalFlipOp : public RandomTensorOp { std::bernoulli_distribution distribution_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_HORIZONTAL_FLIP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.cc index b08d95ba137797f530db4f1f83d2356344ae1042..00b092f3ffbc7be14ea3004bab697e4f81b236df 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomHorizontalFlipWithBBoxOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -55,4 +55,4 @@ Status RandomHorizontalFlipWithBBoxOp::Compute(const TensorRow &input, TensorRow return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h index 2ff91c6437b97c52cec59fd8443d62c9da4dc2ad..ed618d614c204cb6335c5f02af3b26cc11ad0ac5 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomHorizontalFlipWithBBoxOp : public RandomTensorOp { public: @@ -49,5 +49,5 @@ class RandomHorizontalFlipWithBBoxOp : public RandomTensorOp { std::bernoulli_distribution distribution_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_HORIZONTAL_FLIP_BBOX_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_invert_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_invert_op.cc index 88f8dfbf0714db6f967df3662000d1de43aea9a3..738abe0bf62fed5bbf2d0bea833723da459511f3 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_invert_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_invert_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomInvertOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -42,4 +42,4 @@ Status RandomInvertOp::Compute(const std::shared_ptr &input, std::shared return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_invert_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_invert_op.h index e2ccfb01d9f6358eaff3b42d565f149bb557b1bb..65df6b1e81d597487f723d8776e7683e6ef14713 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_invert_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_invert_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomInvertOp : public RandomTensorOp { public: @@ -48,5 +48,5 @@ class RandomInvertOp : public RandomTensorOp { std::bernoulli_distribution distribution_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_INVERT_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_lighting_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_lighting_op.cc index d7164465817ae72d9353623d6a4e15a34af7d6c4..6bbca37bfd32efdbc4d542a91151fa7d0c8bec18 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_lighting_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_lighting_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomLightingOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -33,4 +33,4 @@ Status RandomLightingOp::Compute(const std::shared_ptr &input, std::shar return RandomLighting(input, output, rnd_r, rnd_g, rnd_b); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_lighting_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_lighting_op.h index e1f9b882bf83258e92488175c08aa9779b1e3105..4cd6df923b4ea36a3bcbe9ca808f698714bb7c8f 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_lighting_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_lighting_op.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomLightingOp : public RandomTensorOp { public: @@ -43,5 +43,5 @@ class RandomLightingOp : public RandomTensorOp { std::normal_distribution dist_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_RANDOM_LIGHTING_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_posterize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_posterize_op.cc index 1e18005f59e46c459534ea231b72b74c8174c0ff..aeccdff622d0c2468c72b3a74cbd1e1a6c032ca7 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_posterize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_posterize_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomPosterizeOp::RandomPosterizeOp(const std::vector &bit_range) : bit_range_(bit_range) {} @@ -32,4 +32,4 @@ Status RandomPosterizeOp::Compute(const std::shared_ptr &input, std::sha return Posterize(input, output, bits); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_posterize_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_posterize_op.h index 0e58ebdf24eb6db386f930568249959f989f7943..c4b63d878c9a4420b98398aee8b54a5a0483fc4b 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_posterize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_posterize_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomPosterizeOp : public RandomTensorOp { public: @@ -42,5 +42,5 @@ class RandomPosterizeOp : public RandomTensorOp { std::vector bit_range_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_POSTERIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_resize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_resize_op.cc index b9ef7e1724cfe9ee54e56cbd06e489efcce927c8..8e51cd2655916a1cc8feafb0b4774579cbb26ca9 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_resize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_resize_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/core/config_manager.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomResizeOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -34,4 +34,4 @@ Status RandomResizeOp::Compute(const TensorRow &input, TensorRow *output) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_resize_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_resize_op.h index 06e577034f97cf576ae40e62ec48838225a3270e..3f32e11888c907db6f9c883fc6133494990f0247 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_resize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_resize_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomResizeOp : public RandomTensorOp { public: @@ -51,5 +51,5 @@ class RandomResizeOp : public RandomTensorOp { std::uniform_int_distribution distribution_{0, 3}; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_RESIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_resize_with_bbox_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_resize_with_bbox_op.cc index 5d9a80dfce77ee7081550bb3567fcd5ef863d0f0..7de4d0c7281df854cc065f9b77a4b7af6a284d45 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_resize_with_bbox_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_resize_with_bbox_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomResizeWithBBoxOp::Compute(const TensorRow &input, TensorRow *output) { // Randomly selects from the following four interpolation methods @@ -31,4 +31,4 @@ Status RandomResizeWithBBoxOp::Compute(const TensorRow &input, TensorRow *output return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_resize_with_bbox_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_resize_with_bbox_op.h index 60d08462967a2435ed2f5760d5f0b80f644276ce..064e25b19636db2e6030896fef56967bb24fa90b 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_resize_with_bbox_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_resize_with_bbox_op.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomResizeWithBBoxOp : public RandomTensorOp { public: @@ -49,5 +49,5 @@ class RandomResizeWithBBoxOp : public RandomTensorOp { std::uniform_int_distribution distribution_{0, 3}; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_RESIZE_WITH_BBOX_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_rotation_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_rotation_op.cc index 6c787f202662ba9bed68ca21d76ecec069f5be98..6dd42e2f8034d5d30ea3676a905f630ae057b306 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_rotation_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_rotation_op.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // constructor RandomRotationOp::RandomRotationOp(float start_degree, float end_degree, InterpolationMode resample, bool expand, @@ -82,4 +82,4 @@ Status RandomRotationOp::OutputShape(const std::vector &inputs, std return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_rotation_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_rotation_op.h index 6f7d287c74466960bdc03b044f182ea0222a54e2..113ad73ea211256c14901fa24e9438842a07ca52 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_rotation_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_rotation_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomRotationOp : public RandomTensorOp { public: @@ -69,5 +69,5 @@ class RandomRotationOp : public RandomTensorOp { std::uniform_real_distribution distribution_{-1.0, 1.0}; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_ROTATION_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_select_subpolicy_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_select_subpolicy_op.cc index baa745219338c4e59dfe6187d4e59d5cf6145acc..07684ef90310ac94d4ed2280de2ed1d783b4b596 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_select_subpolicy_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_select_subpolicy_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { RandomSelectSubpolicyOp::RandomSelectSubpolicyOp(const std::vector &policy) : policy_(policy), rand_int_(0, policy.size() - 1), rand_double_(0, 1) {} @@ -90,4 +90,4 @@ Status RandomSelectSubpolicyOp::OutputType(const std::vector &inputs, return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_select_subpolicy_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_select_subpolicy_op.h index 685119ca2ce3f7811bbec366332f4b6a97a3d0fe..b7c288e6440291b5a39f2ae31453df6277e0ec59 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_select_subpolicy_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_select_subpolicy_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using Subpolicy = std::vector, double>>; @@ -72,5 +72,5 @@ class RandomSelectSubpolicyOp : public RandomTensorOp { std::uniform_real_distribution rand_double_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_SELECT_SUBPOLICY_OP_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_sharpness_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_sharpness_op.cc index 94eb3be9435039c2aeab251e7631025ead6ed623..a9b5a875549576d4b0309e2ddd427ee70dc4b8f3 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_sharpness_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_sharpness_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// constructor RandomSharpnessOp::RandomSharpnessOp(float start_degree, float end_degree) @@ -37,4 +37,4 @@ Status RandomSharpnessOp::Compute(const std::shared_ptr &input, std::sha return AdjustSharpness(input, output, alpha); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_sharpness_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_sharpness_op.h index 23d4f207b88afcd24540957821b62fac499070dc..8a2e4cd5c6ef03859d97a78177c168deca440972 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_sharpness_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_sharpness_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomSharpnessOp : public RandomTensorOp { public: @@ -46,5 +46,5 @@ class RandomSharpnessOp : public RandomTensorOp { std::uniform_real_distribution distribution_{-1.0, 1.0}; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_SHARPNESS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_solarize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_solarize_op.cc index 210d79a8f35e2f6feff2f45de7adbca51a5ca12c..f22ff5857c8c8ecd574ed1eb74913992a83d494b 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_solarize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_solarize_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomSolarizeOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -43,4 +43,4 @@ Status RandomSolarizeOp::Compute(const std::shared_ptr &input, std::shar return Solarize(input, output, {threshold_min, threshold_max}); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_solarize_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_solarize_op.h index 2a6494666f919beb39ee014d257a993cceb67c5b..d031f8b71605a3b4c381213584da03558ed54c0c 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_solarize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_solarize_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomSolarizeOp : public RandomTensorOp { public: @@ -43,5 +43,5 @@ class RandomSolarizeOp : public RandomTensorOp { std::vector threshold_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_SOLARIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_op.cc index e2775243b3e15010c27750d33233625171567f32..a9a9cdcf7ba484d55318683b41cb823cd3b9c3fc 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomVerticalFlipOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -41,4 +41,4 @@ Status RandomVerticalFlipOp::Compute(const TensorRow &input, TensorRow *output) return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_op.h index e6197d7c44c033a5c81c6ff50f3db54dbf514def..e98433ebfe0112a1c1d8b9bc9a0c48ed2c161716 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomVerticalFlipOp : public RandomTensorOp { public: @@ -45,5 +45,5 @@ class RandomVerticalFlipOp : public RandomTensorOp { std::bernoulli_distribution distribution_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_VERTICAL_FLIP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.cc b/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.cc index 00379bd223d83594247db91be5e7b9d6143f4d97..2e4031ca8410c7208f9a1b56909b846cff834d75 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/bounding_box.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RandomVerticalFlipWithBBoxOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -53,4 +53,4 @@ Status RandomVerticalFlipWithBBoxOp::Compute(const TensorRow &input, TensorRow * return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h b/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h index a77f600e8474fc24704758edb83d1937d11ee947..cedb1c635870942703404f2222d3f0e313a3a505 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RandomVerticalFlipWithBBoxOp : public RandomTensorOp { public: @@ -43,5 +43,5 @@ class RandomVerticalFlipWithBBoxOp : public RandomTensorOp { std::bernoulli_distribution distribution_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RANDOM_VERTICAL_FLIP_WITH_BBOX_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/rescale_op.cc b/mindspore-lite/minddata/dataset/kernels/image/rescale_op.cc index 9f3080a0c6df54a8174033b6671afbe2f8752ded..9bbb1860df97e19cf9de20499adc11eeea962f91 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rescale_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/rescale_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RescaleOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -32,4 +32,4 @@ Status RescaleOp::OutputType(const std::vector &inputs, std::vector #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { // using 8 bits for result constexpr uint8_t PrecisionBits = 22; @@ -300,4 +300,4 @@ bool ResizeCubic(const LiteMat &input, const LiteMat &dst, int dst_w, int dst_h) return res; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/resize_cubic_op.h b/mindspore-lite/minddata/dataset/kernels/image/resize_cubic_op.h index cb31c148e357e06c1d203301bbc025e2f5d184c4..6eb99d669e7e9fa3079c89cee5993f1039bc0631 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resize_cubic_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/resize_cubic_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Calculate the coefficient for interpolation firstly int calc_coeff(int input_size, int out_size, int input0, int input1, const struct interpolation *interp, @@ -52,5 +52,5 @@ bool ImageInterpolation(LiteMat input, LiteMat &output, int x_size, int y_size, /// \param[in] dst_h expected Output image height bool ResizeCubic(const LiteMat &input, const LiteMat &dst, int dst_w, int dst_h); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RESIZE_CUBIC_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/resize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/resize_op.cc index d53f5044343fc0ecbd257ab45712e24bfc0c534e..4debaf128774d401db4ff673751244448593606a 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/resize_op.cc @@ -25,7 +25,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int32_t ResizeOp::kDefWidth = 0; const InterpolationMode ResizeOp::kDefInterpolation = InterpolationMode::kLinear; @@ -121,4 +121,4 @@ TensorShape ResizeOp::ComputeOutputShape(const TensorShape &input, int32_t outpu return out; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/resize_op.h b/mindspore-lite/minddata/dataset/kernels/image/resize_op.h index db81abec451ea11cbccbf5aa44ab34944bbaa961..918d5f5944b87079bf10a83ed21b7e2e55b06ecf 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/resize_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ResizeOp : public TensorOp { public: @@ -64,5 +64,5 @@ class ResizeOp : public TensorOp { InterpolationMode interpolation_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RESIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/resize_preserve_ar_op.cc b/mindspore-lite/minddata/dataset/kernels/image/resize_preserve_ar_op.cc index 681d94e4a6a2d0e01a102b163ac9859c7e5977e0..1f99cbb20926abbe04d66ebce1b88c6866e6b818 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resize_preserve_ar_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/resize_preserve_ar_op.cc @@ -20,7 +20,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int32_t ResizePreserveAROp::kDefImgOrientation = 0; @@ -35,4 +35,4 @@ Status ResizePreserveAROp::Compute(const TensorRow &inputs, TensorRow *outputs) return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/resize_preserve_ar_op.h b/mindspore-lite/minddata/dataset/kernels/image/resize_preserve_ar_op.h index d8956e901c585ed098044811ce50d7daca923985..eda59653631b0d848dee51e0e9a49c1a5a0f1b2d 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resize_preserve_ar_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/resize_preserve_ar_op.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ResizePreserveAROp : public TensorOp { public: @@ -50,5 +50,5 @@ class ResizePreserveAROp : public TensorOp { int32_t img_orientation_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RESIZE_PRESERVE_AR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.cc b/mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.cc index a415eabc912bb4e161a881650978428583df4e80..7823087cef11935b03bcb04202e8981aeb078299 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status ResizeWithBBoxOp::Compute(const TensorRow &input, TensorRow *output) { IO_CHECK_VECTOR(input, output); @@ -49,4 +49,4 @@ Status ResizeWithBBoxOp::Compute(const TensorRow &input, TensorRow *output) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.h b/mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.h index b2bc0f6ac1414488e1c5ffd80836d2d8c17ccf29..f8744fb42820bb965880f0741312bc2b4fa3a37f 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/resize_with_bbox_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ResizeWithBBoxOp : public ResizeOp { public: @@ -55,5 +55,5 @@ class ResizeWithBBoxOp : public ResizeOp { uint32_t NumOutput() override { return 2; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RESIZE_WITH_BBOX_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/resized_crop_op.cc b/mindspore-lite/minddata/dataset/kernels/image/resized_crop_op.cc index a1b56e4f53e80ea61bb13aa0b2a4bbc277150a9c..674a28bd377e7f24581f5357fb1724c14672d71c 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resized_crop_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/resized_crop_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status ResizedCropOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { // input output tensor shape check @@ -90,4 +90,4 @@ Status ResizedCropOp::OutputShape(const std::vector &inputs, std::v return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/resized_crop_op.h b/mindspore-lite/minddata/dataset/kernels/image/resized_crop_op.h index ea883db8ced962637155f0b88afd47fb8ecb3b8b..90c40f1e21a18a1db4d15e44c973f46704ad829e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/resized_crop_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/resized_crop_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ResizedCropOp : public TensorOp { public: @@ -55,5 +55,5 @@ class ResizedCropOp : public TensorOp { InterpolationMode interpolation_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_RESIZED_CROP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/rgb_to_bgr_op.cc b/mindspore-lite/minddata/dataset/kernels/image/rgb_to_bgr_op.cc index 918450b5d5ab2b2eaaa169774dffc8f2fe5e09c1..bc959411d960ce6e7b10bf50de22c5cbd06a5c96 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rgb_to_bgr_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/rgb_to_bgr_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RgbToBgrOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -33,4 +33,4 @@ Status RgbToBgrOp::Compute(const std::shared_ptr &input, std::shared_ptr return RgbToBgr(input, output); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/rgb_to_bgr_op.h b/mindspore-lite/minddata/dataset/kernels/image/rgb_to_bgr_op.h index 59b34de4960c1ff945f275130480b353cee6a526..4d7fe493dc3f917bfaa5890238a577834b041d7e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rgb_to_bgr_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/rgb_to_bgr_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RgbToBgrOp : public TensorOp { public: @@ -37,5 +37,5 @@ class RgbToBgrOp : public TensorOp { std::string Name() const override { return kRgbToBgrOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_RGB_TO_BGR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/rgb_to_gray_op.cc b/mindspore-lite/minddata/dataset/kernels/image/rgb_to_gray_op.cc index 96ff4f766307a0028bb85b96b3eb82ea0b5fbec4..356378b7dda6292cb87f19de53649bb76aa1af78 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rgb_to_gray_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/rgb_to_gray_op.cc @@ -21,11 +21,11 @@ #include "mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RgbToGrayOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); return RgbToGray(input, output); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/rgb_to_gray_op.h b/mindspore-lite/minddata/dataset/kernels/image/rgb_to_gray_op.h index 26174c42d31ea8190bd60b730a3f8df6951fcbc9..f5e46e442199aac58def7b17f6b1cdbc2ea48fbc 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rgb_to_gray_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/rgb_to_gray_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RgbToGrayOp : public TensorOp { public: @@ -37,5 +37,5 @@ class RgbToGrayOp : public TensorOp { std::string Name() const override { return kRgbToGrayOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_RGB_TO_GRAY_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/rgba_to_bgr_op.cc b/mindspore-lite/minddata/dataset/kernels/image/rgba_to_bgr_op.cc index 611a85720f9569ad0558fc3dcc03266e3741b4c5..a20aa1ba305d300b101d8ae2a4c34fc849ada987 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rgba_to_bgr_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/rgba_to_bgr_op.cc @@ -18,11 +18,11 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RgbaToBgrOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); return RgbaToBgr(input, output); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/rgba_to_bgr_op.h b/mindspore-lite/minddata/dataset/kernels/image/rgba_to_bgr_op.h index 3466d6d3cba9dd6b13b30f3d269c3e31c01eeb4f..7deac49ea8e65cea156dd4810fbbd8d8081375ec 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rgba_to_bgr_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/rgba_to_bgr_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RgbaToBgrOp : public TensorOp { public: @@ -38,5 +38,5 @@ class RgbaToBgrOp : public TensorOp { std::string Name() const override { return kRgbaToBgrOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_RGBA_TO_BGR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/rgba_to_rgb_op.cc b/mindspore-lite/minddata/dataset/kernels/image/rgba_to_rgb_op.cc index 3bcc4959a1a53e5f390077633661acb956a5bd95..f9cad1e37f5f7faa7021220c7acde4011fae2b51 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rgba_to_rgb_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/rgba_to_rgb_op.cc @@ -18,11 +18,11 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status RgbaToRgbOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); return RgbaToRgb(input, output); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/rgba_to_rgb_op.h b/mindspore-lite/minddata/dataset/kernels/image/rgba_to_rgb_op.h index d0840a38b2bf2dd3039992d6f325c9762911c5aa..2c81f8e5d0d5f5ae4f1d8f8160dd6e3edab57b75 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rgba_to_rgb_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/rgba_to_rgb_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RgbaToRgbOp : public TensorOp { public: @@ -38,5 +38,5 @@ class RgbaToRgbOp : public TensorOp { std::string Name() const override { return kRgbaToRgbOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_RGBA_TO_RGB_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/rotate_op.cc b/mindspore-lite/minddata/dataset/kernels/image/rotate_op.cc index 5f542d9f936cdb9dc58f206a31d524e0f253bc32..9b3efc7f8495b75e8d78c300e014a9be4569a2d6 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rotate_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/rotate_op.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/lite_image_utils.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { const std::vector RotateOp::kDefCenter = {}; const InterpolationMode RotateOp::kDefInterpolation = InterpolationMode::kNearestNeighbour; @@ -150,4 +150,4 @@ TensorShape RotateOp::ConstructShape(const TensorShape &in_shape) const { return out; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/rotate_op.h b/mindspore-lite/minddata/dataset/kernels/image/rotate_op.h index 79b57ea623560b580cb4846821d1ca5493376eba..4fe7319734f5df6051875d16e6bf5072f793e8bc 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/rotate_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/rotate_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class RotateOp : public TensorOp { public: @@ -70,5 +70,5 @@ class RotateOp : public TensorOp { uint8_t fill_b_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_ROTATE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/sharpness_op.cc b/mindspore-lite/minddata/dataset/kernels/image/sharpness_op.cc index 3be4a47b2088e4cdf49a736b41d1743648d2ae32..241889a20ff724bbf2c9a89abfdadadd3e4d98d4 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/sharpness_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/sharpness_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/core/cv_tensor.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const float SharpnessOp::kDefAlpha = 1.0; @@ -29,4 +29,4 @@ Status SharpnessOp::Compute(const std::shared_ptr &input, std::shared_pt return AdjustSharpness(input, output, alpha_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/sharpness_op.h b/mindspore-lite/minddata/dataset/kernels/image/sharpness_op.h index 2c4facf60fd18deb3f5d2708873ca2f58437a025..d492d62368dbc6a07d0f77d9d9e9b43231fed995 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/sharpness_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/sharpness_op.h @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SharpnessOp : public TensorOp { public: @@ -48,5 +48,5 @@ class SharpnessOp : public TensorOp { float alpha_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_SHARPNESS_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/slice_patches_op.cc b/mindspore-lite/minddata/dataset/kernels/image/slice_patches_op.cc index 0b04b61be9265617c969fb681cb4b7ad73fc36a0..6785e0916026106f47833600f7d095ca8e66af64 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/slice_patches_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/slice_patches_op.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int32_t SlicePatchesOp::kDefNumH = 1; const int32_t SlicePatchesOp::kDefNumW = 1; @@ -49,4 +49,4 @@ Status SlicePatchesOp::Compute(const TensorRow &input, TensorRow *output) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/slice_patches_op.h b/mindspore-lite/minddata/dataset/kernels/image/slice_patches_op.h index 738280c2f6e2d05543f51ef03543421953e8be82..7be831b87716ecd344f16564f83593ae19470e35 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/slice_patches_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/slice_patches_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SlicePatchesOp : public TensorOp { public: @@ -55,5 +55,5 @@ class SlicePatchesOp : public TensorOp { uint8_t fill_value_; // border width in number of pixels in right and bottom direction }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_SLICE_PATCHES_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/solarize_op.cc b/mindspore-lite/minddata/dataset/kernels/image/solarize_op.cc index 5ab2be9ff91fdfc37687d98b33ecffb621679c71..b51abf603cd23282e4264f1b3c2685c07e8fab09 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/solarize_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/solarize_op.cc @@ -19,11 +19,11 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status SolarizeOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); return Solarize(input, output, threshold_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/solarize_op.h b/mindspore-lite/minddata/dataset/kernels/image/solarize_op.h index f663604d7931260021b777849ea56bb10a0e6c40..7895158ca4bdc1030fa71bd14a9add6b15b019d3 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/solarize_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/solarize_op.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SolarizeOp : public TensorOp { public: @@ -42,5 +42,5 @@ class SolarizeOp : public TensorOp { std::vector threshold_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_SOLARIZE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/swap_red_blue_op.cc b/mindspore-lite/minddata/dataset/kernels/image/swap_red_blue_op.cc index 9b24c74d46c55a9500bba2f4e4d8f589de0387af..c226b8a5783763bf07a51671327e13d451ab9f8a 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/swap_red_blue_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/swap_red_blue_op.cc @@ -18,11 +18,11 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status SwapRedBlueOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); return SwapRedAndBlue(input, output); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/swap_red_blue_op.h b/mindspore-lite/minddata/dataset/kernels/image/swap_red_blue_op.h index cbd6ce5f002ef9ee606080670ac937d90907a165..16d7618c42ead2c99b478e69b8b21c3b493f269c 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/swap_red_blue_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/swap_red_blue_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SwapRedBlueOp : public TensorOp { public: @@ -45,5 +45,5 @@ class SwapRedBlueOp : public TensorOp { std::string Name() const override { return kSwapRedBlueOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_SWAP_RED_BLUE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/to_tensor_op.cc b/mindspore-lite/minddata/dataset/kernels/image/to_tensor_op.cc index 0eaebf19558c4d518391443bde43c10a47a6ce8b..a517e427a7adb913a9c03a899b4b4593473bda9f 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/to_tensor_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/to_tensor_op.cc @@ -22,7 +22,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status ToTensorOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -35,4 +35,4 @@ Status ToTensorOp::Compute(const std::shared_ptr &input, std::shared_ptr return ToTensor(input, output, output_type_); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/to_tensor_op.h b/mindspore-lite/minddata/dataset/kernels/image/to_tensor_op.h index 533db0984f71f32789c152bc21d18a77c48f8f81..dade1e5725280452f06b850b6d9a0f49caadd61d 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/to_tensor_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/to_tensor_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class ToTensorOp : public TensorOp { public: @@ -41,5 +41,5 @@ class ToTensorOp : public TensorOp { DataType output_type_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_TO_TENSOR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/trivial_augment_wide_op.cc b/mindspore-lite/minddata/dataset/kernels/image/trivial_augment_wide_op.cc index 3896a70822fba81921aaa2639ad39980b64d4c91..dd69bc47cdbf152efa34467950fbb1f6e5ad20b3 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/trivial_augment_wide_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/trivial_augment_wide_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { TrivialAugmentWideOp::TrivialAugmentWideOp(int32_t num_magnitude_bins, InterpolationMode interpolation, const std::vector &fill_value) @@ -87,4 +87,4 @@ int32_t TrivialAugmentWideOp::RandInt(int32_t low, int32_t high) { return dis(random_generator_) % (high - low) + low; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/trivial_augment_wide_op.h b/mindspore-lite/minddata/dataset/kernels/image/trivial_augment_wide_op.h index cef441888d315929f2e078c4a2c71102bb28652e..612a9810677fa4b2e5bee08d7530eb3973709e95 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/trivial_augment_wide_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/trivial_augment_wide_op.h @@ -35,7 +35,7 @@ typedef std::map, bool>> Space; -namespace mindspore { +namespace mindspore::lite { namespace dataset { constexpr char kTrivialAugmentWideOp[] = "TrivialAugmentWideOp"; @@ -60,5 +60,5 @@ class TrivialAugmentWideOp : public RandomTensorOp { std::vector fill_value_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_TRIVIAL_AUGMENT_WIDE_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/uniform_aug_op.cc b/mindspore-lite/minddata/dataset/kernels/image/uniform_aug_op.cc index caca1596934a109a57418b783df045b8976b1f50..8feccca71903141d48e0ee1d072fa4ce405d096e 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/uniform_aug_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/uniform_aug_op.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/util/random.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { UniformAugOp::UniformAugOp(std::vector> op_list, int32_t num_ops) : tensor_op_list_(std::move(op_list)), num_ops_(num_ops) {} @@ -59,4 +59,4 @@ Status UniformAugOp::Compute(const TensorRow &input, TensorRow *output) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/uniform_aug_op.h b/mindspore-lite/minddata/dataset/kernels/image/uniform_aug_op.h index 932137e7f3eea6ad342373d342cf4bade1484623..bcdf3afaf4238ecf65f4fb489d34deb9b3a6e01c 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/uniform_aug_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/uniform_aug_op.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class UniformAugOp : public RandomTensorOp { public: @@ -50,5 +50,5 @@ class UniformAugOp : public RandomTensorOp { int32_t num_ops_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_UNIFORM_AUG_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/vertical_flip_op.cc b/mindspore-lite/minddata/dataset/kernels/image/vertical_flip_op.cc index 496bd41d60ef018ff65413ef4fdf681326eff7c3..ac461c8c85cab51545575d74e5f3047e6444d93f 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/vertical_flip_op.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/vertical_flip_op.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/data/data_utils.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status VerticalFlipOp::Compute(const std::shared_ptr &input, std::shared_ptr *output) { IO_CHECK(input, output); @@ -53,4 +53,4 @@ Status VerticalFlipOp::Compute(const std::shared_ptr &input, std::shared return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/vertical_flip_op.h b/mindspore-lite/minddata/dataset/kernels/image/vertical_flip_op.h index d508caa009b1254798e6f1a672e153c2bb2dd0ad..4bab8868c76a0a950d6fb996809980263a409129 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/vertical_flip_op.h +++ b/mindspore-lite/minddata/dataset/kernels/image/vertical_flip_op.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/tensor_op.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class VerticalFlipOp : public TensorOp { public: @@ -36,5 +36,5 @@ class VerticalFlipOp : public TensorOp { std::string Name() const override { return kVerticalFlipOp; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_VERTICAL_FLIP_OP_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/image/video_utils.cc b/mindspore-lite/minddata/dataset/kernels/image/video_utils.cc index f2c1e74e56204d8e6e6e58aa257034ea6571b8fa..5e114651da019f3dc6a263e863e051055ba6a422 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/video_utils.cc +++ b/mindspore-lite/minddata/dataset/kernels/image/video_utils.cc @@ -42,7 +42,7 @@ extern "C" { const int32_t MAX_AVIO_BUFFER_SIZE = 1073741824; -namespace mindspore { +namespace mindspore::lite { namespace dataset { struct MediaContainer { int channels = 1; @@ -1460,4 +1460,4 @@ Status ReadVideoTimestamps(const std::string &filename, std::vector *pt return AVReadVisualPts(&avinfo, pts_int64_vector, video_fps, time_base); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/image/video_utils.h b/mindspore-lite/minddata/dataset/kernels/image/video_utils.h index 4750c08f26c6d0435f84b55ab2a6bb5d29716de4..3108e33320bfd698f4697a2ce1d6e53274c3de1c 100644 --- a/mindspore-lite/minddata/dataset/kernels/image/video_utils.h +++ b/mindspore-lite/minddata/dataset/kernels/image/video_utils.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor_row.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Decode the raw input video bytes. Supported video formats are AVI, H264, H265, MOV, MP4 and WMV. /// \param input: CVTensor containing the not decoded video 1D bytes. @@ -56,5 +56,5 @@ Status ReadVideo(const std::string &filename, std::shared_ptr *video_out Status ReadVideoTimestamps(const std::string &filename, std::vector *pts_int64_vector, float *video_fps, float *time_base, const std::string &pts_unit); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_VIDEO_UTILS_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/data/transforms_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/data/transforms_ir.cc index c6c0d6fc673aa784ff5f928fb08f9fb653e936b4..93762cbe4be589a906fb66b999264641cd0c300e 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/data/transforms_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/data/transforms_ir.cc @@ -57,7 +57,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Transform operations for data. namespace transforms { @@ -530,4 +530,4 @@ Status PluginOperation::from_json(nlohmann::json op_params, std::shared_ptr { @@ -57,5 +57,5 @@ class TensorOperation : public std::enable_shared_from_this { bool random_op_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_TENSOR_OPERATION_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/transforms_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/transforms_ir.cc index c6c0d6fc673aa784ff5f928fb08f9fb653e936b4..93762cbe4be589a906fb66b999264641cd0c300e 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/transforms_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/transforms_ir.cc @@ -57,7 +57,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Transform operations for data. namespace transforms { @@ -530,4 +530,4 @@ Status PluginOperation::from_json(nlohmann::json op_params, std::shared_ptr &translation, float scale, @@ -155,4 +155,4 @@ MapTargetDevice AffineOperation::Type() { } } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/affine_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/affine_ir.h index fbc3f42ad47337abe5b5bb49b176f31f243cb24c..d4369b9b54b60489538ea72fc331ea6b31e7fc49 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/affine_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/affine_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kAffineOperation[] = "Affine"; @@ -63,5 +63,5 @@ class AffineOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_AFFINE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/ascend_vision_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/ascend_vision_ir.cc index 072be52d4b446f79b30ee6d25a7e5cf237ad6797..e75d05502c6347000af3e9f1ba59e017b17e19f6 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/ascend_vision_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/ascend_vision_ir.cc @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Transform operations for computer vision namespace vision { @@ -489,4 +489,4 @@ Status DvppResizeJpegOperation::from_json(nlohmann::json op_params, std::shared_ } } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/ascend_vision_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/ascend_vision_ir.h index 55628936ad8f06ddfa0fb3bbc1f5b71e799d53b2..73b608b58d0abaaef388f3076307ac4ca7f0015a 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/ascend_vision_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/ascend_vision_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Transform operations for computer vision namespace vision { @@ -197,5 +197,5 @@ class DvppResizeJpegOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_ASCEND_VISION_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_augment_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_augment_ir.cc index c2f5f50e8c95247e4c63edf0a8e5171aa3234faa..3f0716c8c611e5cc58474fa8333cf6ff2953ffe2 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_augment_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_augment_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -78,4 +78,4 @@ Status AutoAugmentOperation::from_json(nlohmann::json op_params, std::shared_ptr #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_augment_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_augment_ir.h index 0b17ca523ebe5e6e1c83e3c11896408b37c0afc2..e2bb2cf4af279720a864d02e570b1fff9338ff82 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_augment_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_augment_ir.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" #include "mindspore-lite/minddata/dataset/kernels/image/auto_augment_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kAutoAugmentOperation[] = "AutoAugment"; @@ -59,5 +59,5 @@ class AutoAugmentOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_AUTO_AUGMENT_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_contrast_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_contrast_ir.cc index 1b3eade4ae0dba0d331f5c96caf75be1a8ea5352..07d702ac691c0ca29050b28fb2b8bb4927bdab69 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_contrast_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_contrast_ir.cc @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -114,4 +114,4 @@ MapTargetDevice AutoContrastOperation::Type() { #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_contrast_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_contrast_ir.h index 0301ba4245204c79e8988ef589cfc05d4e71f1e4..9d15be9c45fbd2294ac14d2ade053b9eda6f9ac5 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_contrast_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/auto_contrast_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kAutoContrastOperation[] = "AutoContrast"; @@ -57,5 +57,5 @@ class AutoContrastOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_AUTO_CONTRAST_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.cc index 44f96a57e48c437281371560fbf3929dc79b0836..ea5d297f11c1be1fbd441fb64795c4a147ad5c7e 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -74,4 +74,4 @@ Status BoundingBoxAugmentOperation::from_json(nlohmann::json op_params, std::sha #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.h index dc01f7a1b6c6f713d657c96d1be01f213f42a457..7ab288aa5779c26944df0696e07903751ad77e69 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/bounding_box_augment_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kBoundingBoxAugmentOperation[] = "BoundingBoxAugment"; @@ -54,5 +54,5 @@ class BoundingBoxAugmentOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_BOUNDING_BOX_AUGMENT_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/center_crop_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/center_crop_ir.cc index 187f03ac6b06f6fc0be9bbd83c4b9945d820c5d0..4391335a1148c4b54b9c6d9987491f6d39cdb869 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/center_crop_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/center_crop_ir.cc @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { CenterCropOperation::CenterCropOperation(const std::vector &size) : size_(size) {} @@ -61,4 +61,4 @@ Status CenterCropOperation::from_json(nlohmann::json op_params, std::shared_ptr< } } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/center_crop_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/center_crop_ir.h index 72c97c67b423a640fce0adfa42c571f31d7abf50..69ec589a56608d4d4b5cc9cfdfb90ca1bd247a4a 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/center_crop_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/center_crop_ir.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/vision.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kCenterCropOperation[] = "CenterCrop"; @@ -55,5 +55,5 @@ class CenterCropOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_CENTER_CROP_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/convert_color_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/convert_color_ir.cc index 7d6cbed40e5f57c275c653d42e1c0c1cfe4fce5d..bb17d8c93adb95329fbb79efe9efe9e1c5ca89b1 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/convert_color_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/convert_color_ir.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -97,4 +97,4 @@ MapTargetDevice ConvertColorOperation::Type() { #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/convert_color_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/convert_color_ir.h index 3761ad4fac5367b8ff8b1afd9b9ab1af63b6b9a2..fc0b5a728f7383bc89e105c4895d039fe759f08d 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/convert_color_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/convert_color_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kConvertColorOperation[] = "ConvertColor"; @@ -57,5 +57,5 @@ class ConvertColorOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_CONVERT_COLOR_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/crop_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/crop_ir.cc index 6668f789dc5e0f985dd6c19ec9415c71b7c5e9d8..a5defc693b0dd654ab29cf3514bcd4076da15b66 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/crop_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/crop_ir.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { CropOperation::CropOperation(const std::vector &coordinates, const std::vector &size, @@ -112,4 +112,4 @@ MapTargetDevice CropOperation::Type() { } } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/crop_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/crop_ir.h index bd394bfeca63439d6d743b467fc2ed003dc6f001..848af0a0adae160ec8254fd46cd3eea1b89766b2 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/crop_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/crop_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kCropOperation[] = "Crop"; @@ -58,5 +58,5 @@ class CropOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_CROP_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/cutmix_batch_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/cutmix_batch_ir.cc index 4e140eb78f5a183e466164b7d0d1f1816aafcc3a..3f0263fd584c55b4a39f050c87e1d82a0a79820a 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/cutmix_batch_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/cutmix_batch_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -72,4 +72,4 @@ Status CutMixBatchOperation::from_json(nlohmann::json op_params, std::shared_ptr #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/cutmix_batch_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/cutmix_batch_ir.h index fceb7be4342c32f5ce041bc35dad28ffe417abee..8e21e343008654571721afad3b592920d94048f7 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/cutmix_batch_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/cutmix_batch_ir.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kCutMixBatchOperation[] = "CutMixBatch"; @@ -54,5 +54,5 @@ class CutMixBatchOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_CUTMIX_BATCH_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/cutout_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/cutout_ir.cc index e74de0736132dd4a1fe2855692f9b30e3d9f2184..e02f93213b6eec7650e8c43c0601aa141606b5a9 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/cutout_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/cutout_ir.cc @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -73,4 +73,4 @@ Status CutOutOperation::from_json(nlohmann::json op_params, std::shared_ptr> &start_points, @@ -125,4 +125,4 @@ MapTargetDevice PerspectiveOperation::Type() { } } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/perspective_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/perspective_ir.h index c32bff05fd17fdc2e3755d46acf805953b084f55..417907afecc607d1ee5d55f09a7ee7f281afb40b 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/perspective_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/perspective_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kPerspectiveOperation[] = "Perspective"; @@ -61,5 +61,5 @@ class PerspectiveOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_PERSPECTIVE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.cc index d008bf516f85a8896386ae17f1d49edcc2629eb4..13edcc15bb17778e037ce35fc10ca645a9c1edac 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.cc @@ -1,99 +1,99 @@ -/** - * Copyright 2022-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.h" - -#ifndef ENABLE_ANDROID -#include "mindspore-lite/minddata/dataset/kernels/image/posterize_op.h" -#endif -#if !defined(BUILD_LITE) && defined(ENABLE_D) -#include "mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend910b/dvpp_posterize_op.h" -#endif -#include "mindspore-lite/minddata/dataset/util/validators.h" - -namespace mindspore { -namespace dataset { -namespace vision { -#ifndef ENABLE_ANDROID -// PosterizeOperation -PosterizeOperation::PosterizeOperation(uint8_t bits, const std::string &device_target) - : bits_(bits), device_target_(device_target) {} - -PosterizeOperation::~PosterizeOperation() = default; - -Status PosterizeOperation::ValidateParams() { - constexpr uint8_t kMinimumBitValue = 0; - constexpr uint8_t kMaximumBitValue = 8; - - if (bits_ < kMinimumBitValue || bits_ > kMaximumBitValue) { - std::string err_msg = "Posterize: bits is out of range [0, 8], got: " + std::to_string(bits_); - LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); - } - - // device target - if (device_target_ != "CPU" && device_target_ != "Ascend") { - std::string err_msg = "Posterize: Invalid device target. It's not CPU or Ascend."; - LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); - } - - return Status::OK(); -} - -std::shared_ptr PosterizeOperation::Build() { - if (device_target_ == "CPU") { - std::shared_ptr tensor_op = std::make_shared(bits_); - return tensor_op; -#if !defined(BUILD_LITE) && defined(ENABLE_D) - } else if (device_target_ == "Ascend") { - std::shared_ptr dvpp_tensor_op = std::make_shared(bits_); - return dvpp_tensor_op; -#endif - } else { - MS_LOG(ERROR) << "Posterize: Invalid device target. It's not CPU or Ascend."; - return nullptr; - } -} - -Status PosterizeOperation::to_json(nlohmann::json *out_json) { - RETURN_UNEXPECTED_IF_NULL(out_json); - (*out_json)["bits"] = bits_; - (*out_json)["device_target"] = device_target_; - return Status::OK(); -} - -Status PosterizeOperation::from_json(nlohmann::json op_params, std::shared_ptr *operation) { - RETURN_UNEXPECTED_IF_NULL(operation); - RETURN_IF_NOT_OK(ValidateParamInJson(op_params, "bits", kPosterizeOperation)); - RETURN_IF_NOT_OK(ValidateParamInJson(op_params, "device_target", kPosterizeOperation)); - uint8_t bits_ = op_params["bits"]; - std::string device_target = op_params["device_target"]; - *operation = std::make_shared(bits_, device_target); - return Status::OK(); -} - -MapTargetDevice PosterizeOperation::Type() { - if (device_target_ == "CPU") { - return MapTargetDevice::kCpu; - } else if (device_target_ == "Ascend") { - return MapTargetDevice::kAscend910B; - } else { - MS_LOG(ERROR) << "Posterize: Invalid device target. It's not CPU or Ascend."; - } - return MapTargetDevice::kInvalid; -} -#endif -} // namespace vision -} // namespace dataset -} // namespace mindspore +/** + * Copyright 2022-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.h" + +#ifndef ENABLE_ANDROID +#include "mindspore-lite/minddata/dataset/kernels/image/posterize_op.h" +#endif +#if !defined(BUILD_LITE) && defined(ENABLE_D) +#include "mindspore-lite/minddata/dataset/kernels/image/dvpp/ascend910b/dvpp_posterize_op.h" +#endif +#include "mindspore-lite/minddata/dataset/util/validators.h" + +namespace mindspore::lite { +namespace dataset { +namespace vision { +#ifndef ENABLE_ANDROID +// PosterizeOperation +PosterizeOperation::PosterizeOperation(uint8_t bits, const std::string &device_target) + : bits_(bits), device_target_(device_target) {} + +PosterizeOperation::~PosterizeOperation() = default; + +Status PosterizeOperation::ValidateParams() { + constexpr uint8_t kMinimumBitValue = 0; + constexpr uint8_t kMaximumBitValue = 8; + + if (bits_ < kMinimumBitValue || bits_ > kMaximumBitValue) { + std::string err_msg = "Posterize: bits is out of range [0, 8], got: " + std::to_string(bits_); + LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); + } + + // device target + if (device_target_ != "CPU" && device_target_ != "Ascend") { + std::string err_msg = "Posterize: Invalid device target. It's not CPU or Ascend."; + LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); + } + + return Status::OK(); +} + +std::shared_ptr PosterizeOperation::Build() { + if (device_target_ == "CPU") { + std::shared_ptr tensor_op = std::make_shared(bits_); + return tensor_op; +#if !defined(BUILD_LITE) && defined(ENABLE_D) + } else if (device_target_ == "Ascend") { + std::shared_ptr dvpp_tensor_op = std::make_shared(bits_); + return dvpp_tensor_op; +#endif + } else { + MS_LOG(ERROR) << "Posterize: Invalid device target. It's not CPU or Ascend."; + return nullptr; + } +} + +Status PosterizeOperation::to_json(nlohmann::json *out_json) { + RETURN_UNEXPECTED_IF_NULL(out_json); + (*out_json)["bits"] = bits_; + (*out_json)["device_target"] = device_target_; + return Status::OK(); +} + +Status PosterizeOperation::from_json(nlohmann::json op_params, std::shared_ptr *operation) { + RETURN_UNEXPECTED_IF_NULL(operation); + RETURN_IF_NOT_OK(ValidateParamInJson(op_params, "bits", kPosterizeOperation)); + RETURN_IF_NOT_OK(ValidateParamInJson(op_params, "device_target", kPosterizeOperation)); + uint8_t bits_ = op_params["bits"]; + std::string device_target = op_params["device_target"]; + *operation = std::make_shared(bits_, device_target); + return Status::OK(); +} + +MapTargetDevice PosterizeOperation::Type() { + if (device_target_ == "CPU") { + return MapTargetDevice::kCpu; + } else if (device_target_ == "Ascend") { + return MapTargetDevice::kAscend910B; + } else { + MS_LOG(ERROR) << "Posterize: Invalid device target. It's not CPU or Ascend."; + } + return MapTargetDevice::kInvalid; +} +#endif +} // namespace vision +} // namespace dataset +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.h index 728bafb1ee1ac2a9e9a554bfa28bf7a12435ecee..0b6f2a7460442ff8acdec629786eb3f8336eed6e 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/posterize_ir.h @@ -1,59 +1,59 @@ -/** - * Copyright 2022-2023 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_POSTERIZE_IR_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_POSTERIZE_IR_H_ - -#include -#include -#include - -#include "include/api/status.h" -#include "mindspore-lite/minddata/dataset/include/dataset/constants.h" -#include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" -#include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" - -namespace mindspore { -namespace dataset { -namespace vision { -constexpr char kPosterizeOperation[] = "Posterize"; - -class PosterizeOperation : public TensorOperation { - public: - explicit PosterizeOperation(uint8_t bits, const std::string &device_target = "CPU"); - - ~PosterizeOperation() override; - - std::shared_ptr Build() override; - - Status ValidateParams() override; - - std::string Name() const override { return kPosterizeOperation; }; - - Status to_json(nlohmann::json *out_json) override; - - static Status from_json(nlohmann::json op_params, std::shared_ptr *operation); - - MapTargetDevice Type() override; - - private: - uint8_t bits_; - std::string device_target_; -}; -} // namespace vision -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_POSTERIZE_IR_H_ +/** + * Copyright 2022-2023 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_POSTERIZE_IR_H_ +#define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_POSTERIZE_IR_H_ + +#include +#include +#include + +#include "include/api/status.h" +#include "mindspore-lite/minddata/dataset/include/dataset/constants.h" +#include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" +#include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" + +namespace mindspore::lite { +namespace dataset { +namespace vision { +constexpr char kPosterizeOperation[] = "Posterize"; + +class PosterizeOperation : public TensorOperation { + public: + explicit PosterizeOperation(uint8_t bits, const std::string &device_target = "CPU"); + + ~PosterizeOperation() override; + + std::shared_ptr Build() override; + + Status ValidateParams() override; + + std::string Name() const override { return kPosterizeOperation; }; + + Status to_json(nlohmann::json *out_json) override; + + static Status from_json(nlohmann::json op_params, std::shared_ptr *operation); + + MapTargetDevice Type() override; + + private: + uint8_t bits_; + std::string device_target_; +}; +} // namespace vision +} // namespace dataset +} // namespace mindspore::lite +#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_POSTERIZE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/rand_augment_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/rand_augment_ir.cc index 8a5f170ee34918f61f3bda69d1be34b2be745fe2..a26d6c00e6350b691758ce79ef2a6a740764cc9e 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/rand_augment_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/rand_augment_ir.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -94,4 +94,4 @@ Status RandAugmentOperation::from_json(nlohmann::json op_params, std::shared_ptr #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/rand_augment_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/rand_augment_ir.h index 116755b7c8017ecf6b1ed2e408915f5b4a95f866..04808af61187b19fb73aaa7db442091537945071 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/rand_augment_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/rand_augment_ir.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" #include "mindspore-lite/minddata/dataset/kernels/image/rand_augment_op.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandAugmentOperation[] = "RandAugment"; @@ -61,5 +61,5 @@ class RandAugmentOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RAND_AUGMENT_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_adjust_sharpness_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_adjust_sharpness_ir.cc index 7aab0c3a28c7cd770e04397d0839f88af6533b71..cca04bcf2692d3447390c72313ae9d3367c06b86 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_adjust_sharpness_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_adjust_sharpness_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -66,4 +66,4 @@ Status RandomAdjustSharpnessOperation::from_json(nlohmann::json op_params, #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_adjust_sharpness_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_adjust_sharpness_ir.h index 8813d1b67edfbdf8115d8425d71c28642546fbfb..3a0ea873239a7d54bfb92141e9e544afc39b0345 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_adjust_sharpness_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_adjust_sharpness_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomAdjustSharpnessOperation[] = "RandomAdjustSharpness"; @@ -55,5 +55,5 @@ class RandomAdjustSharpnessOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_ADJUST_SHARPNESS_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_affine_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_affine_ir.cc index 5ea27d7449a3c213bbd82bd3cc23ca31345bc810..52e1a488ed32bb5db448d24ff734784d163f0ed6 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_affine_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_affine_ir.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr size_t dimension_zero = 0; @@ -176,4 +176,4 @@ Status RandomAffineOperation::from_json(nlohmann::json op_params, std::shared_pt } } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_affine_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_affine_ir.h index 08f398b4e7525aa32f3ceb8895af61f9197072d7..db424fda0b6798e338f557acd62deda14cd49502 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_affine_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_affine_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomAffineOperation[] = "RandomAffine"; @@ -60,5 +60,5 @@ class RandomAffineOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_AFFINE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_auto_contrast_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_auto_contrast_ir.cc index 470db715aa1b8e9cc693b8f43fddcc17cbc2595a..d5d791854622b0adde68be4b0ed50c48cb7eb2c3 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_auto_contrast_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_auto_contrast_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -74,4 +74,4 @@ Status RandomAutoContrastOperation::from_json(nlohmann::json op_params, std::sha #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_auto_contrast_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_auto_contrast_ir.h index 636c8d84e54b7d2a149f10fb56a73d936683abe6..d4e11a1b06598eae48a6dc923801ed188d6bd6b4 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_auto_contrast_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_auto_contrast_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomAutoContrastOperation[] = "RandomAutoContrast"; @@ -56,5 +56,5 @@ class RandomAutoContrastOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_AUTO_CONTRAST_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_adjust_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_adjust_ir.cc index 5e04af69a73f49f30ffc3dcae65457f6fe8c65b4..ef8d7517b0090e4efac6184439202d7bff03ee3b 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_adjust_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_adjust_ir.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr size_t dimension_zero = 0; @@ -120,4 +120,4 @@ Status RandomColorAdjustOperation::from_json(nlohmann::json op_params, std::shar #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_adjust_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_adjust_ir.h index 25ef6231f022901c8343b96f0274eed8f9be14b0..f0d9017d576bb06c51c850051d9c2720514d4812 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_adjust_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_adjust_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomColorAdjustOperation[] = "RandomColorAdjust"; @@ -57,5 +57,5 @@ class RandomColorAdjustOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_COLOR_ADJUST_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_ir.cc index fd580aab59d9456e1dd48430af05c759818c3e97..3a3a36c9da7b2f9311d779ff51008ca2e23f95ea 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_ir.cc @@ -23,7 +23,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -74,4 +74,4 @@ Status RandomColorOperation::from_json(nlohmann::json op_params, std::shared_ptr #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_ir.h index 80ddabe38cf3428a525d129751585b1dc803990d..12b7a0305c5f0475d5e05801b365897534c9b8d8 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_color_ir.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomColorOperation[] = "RandomColor"; @@ -53,5 +53,5 @@ class RandomColorOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_COLOR_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.cc index b5f048ea04a6efe594c283103cc61be30c7dc3dd..756f6483cf368e20080dccb9392cbcdcf66ae2ee 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -98,4 +98,4 @@ Status RandomCropDecodeResizeOperation::from_json(nlohmann::json op_params, #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.h index 7c79b46ddb11528619c71e0764159ab4906930eb..2f16b78d21ca0a1eaf76a82942a7fd2015df29e2 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_decode_resize_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" #include "mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomCropDecodeResizeOperation[] = "RandomCropDecodeResize"; @@ -53,5 +53,5 @@ class RandomCropDecodeResizeOperation : public RandomResizedCropOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_CROP_DECODE_RESIZE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_ir.cc index bf0ebea39927181cd186cdd8625f15040a87ec42..7eca13bb2f81b719a05caa701783d96417550085 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_ir.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -144,4 +144,4 @@ Status RandomCropOperation::from_json(nlohmann::json op_params, std::shared_ptr< #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_ir.h index f4edfe4e1511109fdb0a353a22bfb19958e3ba05..288be09518f8b57189c9b964b0f1704b78fc9286 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomCropOperation[] = "RandomCrop"; @@ -58,5 +58,5 @@ class RandomCropOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_CROP_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.cc index bb849eb5bb1320da9a9abd7013152a708807abbe..89ddd43487cbe6d094dff9e47368b867aefb68cb 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -146,4 +146,4 @@ Status RandomCropWithBBoxOperation::from_json(nlohmann::json op_params, std::sha #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.h index ee80b613e78dc6a3a03f4825ab32b49d5f6191ef..dad7eed107e9867d7b197250ddbbf7547783adbe 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_crop_with_bbox_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomCropWithBBoxOperation[] = "RandomCropWithBBox"; @@ -58,5 +58,5 @@ class RandomCropWithBBoxOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_CROP_WITH_BBOX_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_equalize_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_equalize_ir.cc index 791c972cefeeb419f2dbd8110057c77df852d512..6abe4da91da10a87a16e94fcf9e18ac07f51ab26 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_equalize_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_equalize_ir.cc @@ -22,7 +22,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -59,4 +59,4 @@ Status RandomEqualizeOperation::from_json(nlohmann::json op_params, std::shared_ #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_equalize_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_equalize_ir.h index edf31282b7b1ed350fa33ac8b29a5886229b2209..a2297984ab49372552d3ec269a141f52d9b60313 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_equalize_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_equalize_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomEqualizeOperation[] = "RandomEqualize"; @@ -54,5 +54,5 @@ class RandomEqualizeOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_EQUALIZE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.cc index 70694d299ddd80364e44dc4b3938b4db4da8dea7..331a0b7c6138ef30f5220430e80dc1cf4d05878c 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -58,4 +58,4 @@ Status RandomHorizontalFlipOperation::from_json(nlohmann::json op_params, std::s #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.h index 2a528d3143e1baa362b7f5d7545d0ff088ec7006..e2a9e5ae61c5a4363efb19211ca8afccdfb7dbdb 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_ir.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomHorizontalFlipOperation[] = "RandomHorizontalFlip"; @@ -52,5 +52,5 @@ class RandomHorizontalFlipOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_HORIZONTAL_FLIP_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.cc index f6ca83e90b44af738daf35eaf4f9ef3fdc1a21e5..0daf41d57b7f5c0230b8b4108b668aab07a024ca 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -61,4 +61,4 @@ Status RandomHorizontalFlipWithBBoxOperation::from_json(nlohmann::json op_params #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.h index 5cb86247c8bbf6e23c2d95635739b05372b3febb..e7fc8513131fab9d9ec78517a5758e74e016598d 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_horizontal_flip_with_bbox_ir.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomHorizontalFlipWithBBoxOperation[] = "RandomHorizontalFlipWithBBox"; @@ -52,5 +52,5 @@ class RandomHorizontalFlipWithBBoxOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_HORIZONTAL_FLIP_WITH_BBOX_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_invert_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_invert_ir.cc index 2546dae691a1848cf6d5367b4216c55cdadb6994..c4de8dda88abfd4169a1e918128ca55409961bfd 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_invert_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_invert_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -58,4 +58,4 @@ Status RandomInvertOperation::from_json(nlohmann::json op_params, std::shared_pt #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_invert_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_invert_ir.h index 841cf1b3cd04303bd4c6bc763e3aae1a0eb00871..27efdfacef95ce468abe10425abf56591bb81c5b 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_invert_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_invert_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomInvertOperation[] = "RandomInvert"; @@ -54,5 +54,5 @@ class RandomInvertOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_INVERT_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_lighting_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_lighting_ir.cc index 022853ce0ecaf3ae62ab941d4c7ed0c10b72ed6c..e7eeeb2176990674db087111ee03c9302d33ee5d 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_lighting_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_lighting_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -60,4 +60,4 @@ Status RandomLightingOperation::from_json(nlohmann::json op_params, std::shared_ #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_lighting_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_lighting_ir.h index da7cee060265a54adda0ae44398c5cf3c4e495f1..9f23433fb64db256f2bde0ccd653a7f23f2d9400 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_lighting_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_lighting_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomLightingOperation[] = "RandomLighting"; @@ -53,5 +53,5 @@ class RandomLightingOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_LIGHTING_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_posterize_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_posterize_ir.cc index cd2b359bf221c43f0253dd92349d516025f148eb..56dd1fb9f1b9fe88fde7ec57817df8de842b6397 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_posterize_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_posterize_ir.cc @@ -23,7 +23,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -87,4 +87,4 @@ Status RandomPosterizeOperation::from_json(nlohmann::json op_params, std::shared #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_posterize_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_posterize_ir.h index ad24fb801acacd74ec2b734ea6431643c50065cb..02c0e46edd2fe696414be543d1ef7c3e45fe637e 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_posterize_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_posterize_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomPosterizeOperation[] = "RandomPosterize"; @@ -53,5 +53,5 @@ class RandomPosterizeOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_POSTERIZE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_ir.cc index 95f7f259cf4cb02d49ddc2a88cd1f2f6752ce94c..4549084d2f871cf93daf008d7c68fa40ec6ae890 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_ir.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -74,4 +74,4 @@ Status RandomResizeOperation::from_json(nlohmann::json op_params, std::shared_pt #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_ir.h index be21f9b937e466f1e2c9e772476621d5b2f9b32c..b943767e6d620f17b538de99179fea871f69ffa5 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomResizeOperation[] = "RandomResize"; @@ -53,5 +53,5 @@ class RandomResizeOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_RESIZE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.cc index 67cc1df570175c305881db36ee8c270ceda7b220..7cfc200aecbe4a777103f9e13b54e324d120599c 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -76,4 +76,4 @@ Status RandomResizeWithBBoxOperation::from_json(nlohmann::json op_params, std::s #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.h index cdce4e0c1d21a30ea6ab42b52153ef882b201897..ca100b39ac3b626db8f7c7ed72170451d15bcddc 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resize_with_bbox_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomResizeWithBBoxOperation[] = "RandomResizeWithBBox"; @@ -53,5 +53,5 @@ class RandomResizeWithBBoxOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_RESIZE_WITH_BBOX_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.cc index 475c7baafa76cd7292ee89bf5cb794ef1eafb6fc..98f45bb935bca2f7aa73508a6bc7e06f27451fb4 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.cc @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -114,4 +114,4 @@ Status RandomResizedCropOperation::from_json(nlohmann::json op_params, std::shar #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.h index 388f730febf5884859fd73fe1b6cafab989406c8..5ea8e207b553c6313479667a170afb9a06759ff7 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomResizedCropOperation[] = "RandomResizedCrop"; @@ -64,5 +64,5 @@ class RandomResizedCropOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_RESIZED_CROP_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.cc index ff3301d8841a4a27c66779a7fbd8619719d2a5ef..ca7bfe7e75f78a46cd0cafd692c97b6fdab89a2d 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -112,4 +112,4 @@ Status RandomResizedCropWithBBoxOperation::from_json(nlohmann::json op_params, #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.h index a761360576e6051b7059fa48541ca1c3ee30b792..6e402f7d6594a3c85f850b8cbbce04d9b1b7044c 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_with_bbox_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" #include "mindspore-lite/minddata/dataset/kernels/ir/vision/random_resized_crop_ir.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomResizedCropWithBBoxOperation[] = "RandomResizedCropWithBBox"; @@ -60,5 +60,5 @@ class RandomResizedCropWithBBoxOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_RESIZED_CROP_WITH_BBOX_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_rotation_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_rotation_ir.cc index 9054a7d7d78200ba134bdd91a2d683be5a1b2fea..7c9686b5587098f797d972340f029114c68f87f4 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_rotation_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_rotation_ir.cc @@ -24,7 +24,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -142,4 +142,4 @@ Status RandomRotationOperation::from_json(nlohmann::json op_params, std::shared_ #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_rotation_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_rotation_ir.h index f3821f0db278ec363c141bb81cc957d5c37af7cf..204b1a537967208b0d1f274c54e7d4c168f144d8 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_rotation_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_rotation_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomRotationOperation[] = "RandomRotation"; @@ -58,5 +58,5 @@ class RandomRotationOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_ROTATION_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.cc index 0569d46b2eb17fae4567b9f8d1286d66b753ce4f..e933d6c4e2f160a76cb601faf700f07e5bae50aa 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.cc @@ -24,7 +24,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -129,4 +129,4 @@ Status RandomSelectSubpolicyOperation::from_json(nlohmann::json op_params, #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.h index 6fd37c1eb31e07107a2f694020976a63869d13bc..3b974ae9c60541aadb718bdd98922deaa7e0dbf6 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_select_subpolicy_ir.h @@ -28,7 +28,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomSelectSubpolicyOperation[] = "RandomSelectSubpolicy"; @@ -55,5 +55,5 @@ class RandomSelectSubpolicyOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_SELECT_SUBPOLICY_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_sharpness_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_sharpness_ir.cc index 724b8141291420f19d99291886fa121e8e796402..0ec2addc876456949d1c4f2190e5bef07cacc0ac 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_sharpness_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_sharpness_ir.cc @@ -23,7 +23,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -76,4 +76,4 @@ Status RandomSharpnessOperation::from_json(nlohmann::json op_params, std::shared #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_sharpness_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_sharpness_ir.h index f5e8d6d840b120ad469190f5e9612ffb369aa811..5f0d2e811365bc6e2a879868cef6a782b3864d75 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_sharpness_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_sharpness_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomSharpnessOperation[] = "RandomSharpness"; @@ -53,5 +53,5 @@ class RandomSharpnessOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_SHARPNESS_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_solarize_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_solarize_ir.cc index b054125874759620745341bd1c6dbc195c98c6c9..5a50fafc02eff689475b3d81a3a276c8c63e8293 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_solarize_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_solarize_ir.cc @@ -23,7 +23,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -81,4 +81,4 @@ Status RandomSolarizeOperation::from_json(nlohmann::json op_params, std::shared_ #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_solarize_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_solarize_ir.h index faa8a854959203e34d8f6ea18243d74b897580a6..83d3ccfb61ee7ef5b7d29f94ff2382774a9dafdc 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_solarize_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_solarize_ir.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomSolarizeOperation[] = "RandomSolarize"; @@ -53,5 +53,5 @@ class RandomSolarizeOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_SOLARIZE_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.cc index 5ac0377b4e51b336b2ecf07c70fbcac1a2bba890..65fdaf5871a6cd05ebb83c74128c2e623c597fd6 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -58,4 +58,4 @@ Status RandomVerticalFlipOperation::from_json(nlohmann::json op_params, std::sha #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.h index a900b701e9e1f485a1836f01b0ba4639540988a4..cc23951c72a02c455cec61d779d47d216a66568b 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_ir.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomVerticalFlipOperation[] = "RandomVerticalFlip"; @@ -52,5 +52,5 @@ class RandomVerticalFlipOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_VERTICAL_FLIP_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.cc index c7e8715df3c5d78ed830df3ea079b18055ddeb6f..d938ad66218f8b8a36ee80c75a3b0ab6e47d816c 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/kernels/ir/validators.h" #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #ifndef ENABLE_ANDROID @@ -61,4 +61,4 @@ Status RandomVerticalFlipWithBBoxOperation::from_json(nlohmann::json op_params, #endif } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.h b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.h index ab6756e8c7dcd10415934af264d84fe8302a7e77..d1d73b03b1a2243d7a06286079d773480f73fef4 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.h +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/random_vertical_flip_with_bbox_ir.h @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/include/dataset/transforms.h" #include "mindspore-lite/minddata/dataset/kernels/ir/tensor_operation.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { constexpr char kRandomVerticalFlipWithBBoxOperation[] = "RandomVerticalFlipWithBBox"; @@ -52,5 +52,5 @@ class RandomVerticalFlipWithBBoxOperation : public TensorOperation { }; } // namespace vision } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_VERTICAL_FLIP_WITH_BBOX_IR_H_ diff --git a/mindspore-lite/minddata/dataset/kernels/ir/vision/rescale_ir.cc b/mindspore-lite/minddata/dataset/kernels/ir/vision/rescale_ir.cc index 515c585942d4f7812e4618bfee57616d3403e49c..fabb1ce8a88fbcc1173e7f951061cd1653d91b73 100644 --- a/mindspore-lite/minddata/dataset/kernels/ir/vision/rescale_ir.cc +++ b/mindspore-lite/minddata/dataset/kernels/ir/vision/rescale_ir.cc @@ -20,7 +20,7 @@ #endif #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace vision { #if !defined(ENABLE_ANDROID) @@ -65,4 +65,4 @@ Status RescaleOperation::from_json(nlohmann::json op_params, std::shared_ptr #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Name: Compute() // Description: This Compute() take 1 Tensor and produce 1 Tensor. @@ -80,4 +80,4 @@ RandomTensorOp::RandomTensorOp() { void RandomTensorOp::SetSeed(uint32_t seed) { random_generator_.seed(seed); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/kernels/tensor_op.h b/mindspore-lite/minddata/dataset/kernels/tensor_op.h index c4981fd8d862cdc5cddbbe59e2feb66d07e19786..7d3673d78e93703ccfe453d0fea2444e88a993d3 100644 --- a/mindspore-lite/minddata/dataset/kernels/tensor_op.h +++ b/mindspore-lite/minddata/dataset/kernels/tensor_op.h @@ -49,7 +49,7 @@ } \ } while (false) -namespace mindspore { +namespace mindspore::lite { namespace dataset { // base class constexpr char kTensorOp[] = "TensorOp"; @@ -363,5 +363,5 @@ class RandomTensorOp : public TensorOp { std::mt19937 random_generator_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_TENSOR_OP_H_ diff --git a/mindspore-lite/minddata/dataset/liteapi/include/datasets.h b/mindspore-lite/minddata/dataset/liteapi/include/datasets.h index b8b201a4142b0bb3781fc29bb80ae19befd6f393..f692b380486039903b350b96c1f2ea4806d369a5 100644 --- a/mindspore-lite/minddata/dataset/liteapi/include/datasets.h +++ b/mindspore-lite/minddata/dataset/liteapi/include/datasets.h @@ -36,7 +36,7 @@ #include "include/dataset/samplers.h" #include "include/dataset/transforms.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Tensor; class TensorShape; @@ -708,5 +708,5 @@ inline std::shared_ptr DATASET_API Mnist(const std::string &datase return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_DATASETS_H_ diff --git a/mindspore-lite/minddata/dataset/util/allocator.h b/mindspore-lite/minddata/dataset/util/allocator.h index acd92f201866e53998955646139643dc43da9002..760abae22459dc6c4d973553cf7b3da0e04dc992 100644 --- a/mindspore-lite/minddata/dataset/util/allocator.h +++ b/mindspore-lite/minddata/dataset/util/allocator.h @@ -23,7 +23,7 @@ #include #include "mindspore-lite/minddata/dataset/util/memory_pool.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // The following conforms to the requirements of // std::allocator. Do not rename/change any needed @@ -199,6 +199,6 @@ class MemGuard { std::unique_ptr> ptr_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_ALLOCATOR_H_ diff --git a/mindspore-lite/minddata/dataset/util/arena.cc b/mindspore-lite/minddata/dataset/util/arena.cc index 56d119a03f74c653c6110d1ee11d8ea0581c1898..056b7e41fe6ba3aa0a8b4d1d5a559d2974ed1c6e 100644 --- a/mindspore-lite/minddata/dataset/util/arena.cc +++ b/mindspore-lite/minddata/dataset/util/arena.cc @@ -22,7 +22,7 @@ #include "mindspore/ccsrc/runtime/hardware/device_context_manager.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { struct MemHdr { uint32_t sig; @@ -290,4 +290,4 @@ Status Arena::CreateArena(std::shared_ptr *p_ba, size_t val_in_MB, bool i return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/arena.h b/mindspore-lite/minddata/dataset/util/arena.h index d8c060bca1f112d263f25c5328dfa583fb0fd957..a418f94056f712388e70ce0d7c0f36247b684d8d 100644 --- a/mindspore-lite/minddata/dataset/util/arena.h +++ b/mindspore-lite/minddata/dataset/util/arena.h @@ -26,7 +26,7 @@ #define ARENA_LOG_BLK_SZ (6u) #define ARENA_BLK_SZ (static_cast(1u << ARENA_LOG_BLK_SZ)) #define ARENA_WALL_OVERHEAD_SZ 32 -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// This is a memory arena based on a treap data structure. /// The constructor of the Arena takes the size of the initial memory size (in MB). @@ -151,6 +151,6 @@ class Arena : public MemoryPool { Status Init(); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_ARENA_H_ diff --git a/mindspore-lite/minddata/dataset/util/auto_index.h b/mindspore-lite/minddata/dataset/util/auto_index.h index 3a31e150b96d61e4b37bf8ec78131d09810adce6..b1d87c77bcdd3f826753a0e591737ed59c1674f1 100644 --- a/mindspore-lite/minddata/dataset/util/auto_index.h +++ b/mindspore-lite/minddata/dataset/util/auto_index.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/btree.h" #include "mindspore-lite/minddata/dataset/util/system_pool.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// This is a B+ tree with generated int64_t value as key. /// Use minKey() function to query the min key. @@ -96,5 +96,5 @@ class AutoIndexObj : public BPlusTree, T> { std::atomic inx_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_AUTO_INDEX_H_ diff --git a/mindspore-lite/minddata/dataset/util/bit.h b/mindspore-lite/minddata/dataset/util/bit.h index e4872a3662f7a6a36abab243d54382d2308fa0d4..cd49127d32465c53f24e2168694e67bbe47758a9 100644 --- a/mindspore-lite/minddata/dataset/util/bit.h +++ b/mindspore-lite/minddata/dataset/util/bit.h @@ -16,7 +16,7 @@ #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_BIT_H_ #define MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_BIT_H_ -namespace mindspore { +namespace mindspore::lite { namespace dataset { template Enum operator|(Enum lhs, Enum rhs) { @@ -70,6 +70,6 @@ Enum operator~(Enum v) { return static_cast(~static_cast(v)); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_BIT_H_ diff --git a/mindspore-lite/minddata/dataset/util/btree.h b/mindspore-lite/minddata/dataset/util/btree.h index 35170da976f31e51b0f66a39f595c8ec120a0f54..3d9f460f43b130ad49ab20675c755b0356e8bdad 100644 --- a/mindspore-lite/minddata/dataset/util/btree.h +++ b/mindspore-lite/minddata/dataset/util/btree.h @@ -30,7 +30,7 @@ #include "mindspore-lite/minddata/dataset/util/services.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Default traits for a B+ tree struct BPlusTreeTraits { @@ -522,7 +522,7 @@ class BPlusTree { value_type operator[](key_type key); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_INDEX_H_ #include "mindspore-lite/minddata/dataset/util/btree_impl.tpp" diff --git a/mindspore-lite/minddata/dataset/util/buddy.cc b/mindspore-lite/minddata/dataset/util/buddy.cc index a993a4145f617bdfa0d5fd3f9a7c432c500dc8eb..c1b104564eaf531c24d073aa0a7ed8405f7fde7f 100644 --- a/mindspore-lite/minddata/dataset/util/buddy.cc +++ b/mindspore-lite/minddata/dataset/util/buddy.cc @@ -29,7 +29,7 @@ inline uint64_t BitEx(uint64_t rhs, uint64_t lhs) { return rhs ^ lhs; } inline uint64_t BitAnd(uint64_t rhs, uint64_t lhs) { return rhs & lhs; } -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status BuddySpace::Init() { const uint64_t kBitOffset = 3; @@ -412,4 +412,4 @@ Status BuddySpace::CreateBuddySpace(std::unique_ptr *out_bs, int log return rc; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/buddy.h b/mindspore-lite/minddata/dataset/util/buddy.h index 9f4ecea431ff9afe8c13722350f81b1dc938a8bf..aae667f940635083a34790820b516275fa4083fa 100644 --- a/mindspore-lite/minddata/dataset/util/buddy.h +++ b/mindspore-lite/minddata/dataset/util/buddy.h @@ -32,7 +32,7 @@ using log_t = int; #define TWO_BIT 0x20 #define MORE_BIT 0x10 #define NOSPACE ((addr_t)(-1)) -namespace mindspore { +namespace mindspore::lite { namespace dataset { struct BSpaceDescriptor { int32_t sig; @@ -122,6 +122,6 @@ class BuddySpace { void FreeBuddySeg(rel_addr_t addr, size_t blk_size, size_t req_size); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_BUDDY_H_ diff --git a/mindspore-lite/minddata/dataset/util/circular_pool.cc b/mindspore-lite/minddata/dataset/util/circular_pool.cc index 0a193bc4308580e868c84ed6a0a53bebac4f5ceb..d994080faf2ea2b8355536c98b95d3c3750abf4f 100644 --- a/mindspore-lite/minddata/dataset/util/circular_pool.cc +++ b/mindspore-lite/minddata/dataset/util/circular_pool.cc @@ -21,7 +21,7 @@ #include "include/securec.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status CircularPool::AddOneArena() { Status rc; @@ -224,4 +224,4 @@ Status CircularPool::CreateCircularPool(std::shared_ptr *out_pool, i CircularPool::~CircularPool() = default; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/circular_pool.h b/mindspore-lite/minddata/dataset/util/circular_pool.h index be34b636d71d440c4cb2be7d95c5e5c7d8caced9..2da62dcceb284a995079364f85447a487e8aeeae 100644 --- a/mindspore-lite/minddata/dataset/util/circular_pool.h +++ b/mindspore-lite/minddata/dataset/util/circular_pool.h @@ -23,7 +23,7 @@ #include "mindspore-lite/minddata/dataset/util/arena.h" #include "mindspore-lite/minddata/dataset/util/lock.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using ListOfArenas = std::vector>; @@ -104,6 +104,6 @@ class CircularPool : public MemoryPool { Status AddOneArena(); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_CIRCULAR_POOL_H_ diff --git a/mindspore-lite/minddata/dataset/util/cond_var.cc b/mindspore-lite/minddata/dataset/util/cond_var.cc index 77e0aa7c5d7ed88e01782b01898a3dfd79a00fac..8508de8d9038a17f85be8fa4509c350381d99f6e 100644 --- a/mindspore-lite/minddata/dataset/util/cond_var.cc +++ b/mindspore-lite/minddata/dataset/util/cond_var.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/util/services.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { CondVar::CondVar() : svc_(nullptr), my_name_(Services::GetUniqueID()) {} @@ -121,4 +121,4 @@ Status CondVar::Deregister() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/cond_var.h b/mindspore-lite/minddata/dataset/util/cond_var.h index 6b83a88f12e1c6f660e25d356c92d393a332cb2b..4c61cc97034c9968f3ef0df2c7c78a3d88ee7115 100644 --- a/mindspore-lite/minddata/dataset/util/cond_var.h +++ b/mindspore-lite/minddata/dataset/util/cond_var.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/intrp_resource.h" #include "mindspore-lite/minddata/dataset/util/intrp_service.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class CondVar : public IntrpResource { public: @@ -62,5 +62,5 @@ class CondVar : public IntrpResource { std::mutex interrupt_mux_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_COND_VAR_H_ diff --git a/mindspore-lite/minddata/dataset/util/ftok_key.cc b/mindspore-lite/minddata/dataset/util/ftok_key.cc index 07be24697118c34e22dc9af2d0c34ce035bc3556..7186b37ff221b1fe00f208311291226b0f2f4ea4 100644 --- a/mindspore-lite/minddata/dataset/util/ftok_key.cc +++ b/mindspore-lite/minddata/dataset/util/ftok_key.cc @@ -46,7 +46,7 @@ #include "mindspore-lite/minddata/dataset/util/task_manager.h" #include "mindspore-lite/minddata/dataset/kernels/image/image_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #if !defined(__APPLE__) && !defined(BUILD_LITE) && !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && \ !defined(ANDROID) @@ -80,4 +80,4 @@ Status GetKey(key_t *key) { } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/ftok_key.h b/mindspore-lite/minddata/dataset/util/ftok_key.h index 615d268baa7c24f7f2975f285c37a8efd279685c..2c7c654511c34a8725a972ebc14258357f7b239a 100644 --- a/mindspore-lite/minddata/dataset/util/ftok_key.h +++ b/mindspore-lite/minddata/dataset/util/ftok_key.h @@ -45,7 +45,7 @@ namespace platform = mindspore; namespace platform = mindspore::lite; #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { #if !defined(__APPLE__) && !defined(BUILD_LITE) && !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && \ !defined(ANDROID) @@ -53,6 +53,6 @@ extern std::atomic inc_id; Status GetKey(key_t *key); #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_FTOK_KEY_H_ diff --git a/mindspore-lite/minddata/dataset/util/gil_scoped.h b/mindspore-lite/minddata/dataset/util/gil_scoped.h index 15def6cf13fd9955d8c287f11d8b41a0b1c91009..7b7fb708f13a1bcd120ff8c52e4334b6f756f5d9 100644 --- a/mindspore-lite/minddata/dataset/util/gil_scoped.h +++ b/mindspore-lite/minddata/dataset/util/gil_scoped.h @@ -23,7 +23,7 @@ namespace py = pybind11; -namespace mindspore { +namespace mindspore::lite { namespace dataset { class GilAcquireWithCheck { @@ -56,5 +56,5 @@ class GilAcquireWithCheck { std::unique_ptr acquire_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_GIL_SCOPED_H_ diff --git a/mindspore-lite/minddata/dataset/util/intrp_resource.h b/mindspore-lite/minddata/dataset/util/intrp_resource.h index d5f13ccad25b6b4e9c727d8fcd4f647a6c994a6d..47c3de75f71456303263756dfa13638b85ed00ce 100644 --- a/mindspore-lite/minddata/dataset/util/intrp_resource.h +++ b/mindspore-lite/minddata/dataset/util/intrp_resource.h @@ -19,7 +19,7 @@ #include #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class IntrpResource { public: @@ -48,5 +48,5 @@ class IntrpResource { std::atomic st_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_INTRP_RESOURCE_H_ diff --git a/mindspore-lite/minddata/dataset/util/intrp_service.cc b/mindspore-lite/minddata/dataset/util/intrp_service.cc index 32c72b3d0cd8e2eed3eae37398577b13f680af0d..5ad76bb1a94d4eac59048a24711d5bc258286d48 100644 --- a/mindspore-lite/minddata/dataset/util/intrp_service.cc +++ b/mindspore-lite/minddata/dataset/util/intrp_service.cc @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/util/services.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int64_t kServiceRetryGetUniqueIdInterVal = 10; IntrpService::IntrpService() try : high_water_mark_(0) { (void)ServiceStart(); } catch (const std::exception &e) { @@ -96,4 +96,4 @@ void IntrpService::InterruptAll() noexcept { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/intrp_service.h b/mindspore-lite/minddata/dataset/util/intrp_service.h index d47e7ccfa782bcaf14c1bbc6c812f5bb08402b38..19b83777902cdd272f0bab4cae8f16401017f48a 100644 --- a/mindspore-lite/minddata/dataset/util/intrp_service.h +++ b/mindspore-lite/minddata/dataset/util/intrp_service.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/service.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { using SvcAllocator = Allocator>; @@ -57,5 +57,5 @@ class IntrpService : public Service { std::map all_intrp_resources_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_INTRP_SERVICE_H_ diff --git a/mindspore-lite/minddata/dataset/util/json_helper.cc b/mindspore-lite/minddata/dataset/util/json_helper.cc index 63d587486d230eb448b3c57aa875cca90de9af92..21e0e6d84720357bd5d4f913e028ddc6e0ca692a 100644 --- a/mindspore-lite/minddata/dataset/util/json_helper.cc +++ b/mindspore-lite/minddata/dataset/util/json_helper.cc @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/util/path.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Create a numbered json file from image folder Status JsonHelper::CreateAlbum(const std::string &in_dir, const std::string &out_dir) { @@ -158,4 +158,4 @@ size_t JsonHelper::DumpData(const unsigned char *tensor_addr, const size_t &tens return tensor_size; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/json_helper.h b/mindspore-lite/minddata/dataset/util/json_helper.h index 6ba72bbb3d93bacc92e1d54d059f8f4359974914..04304496532b1156c0da364ddd8b4f663220514c 100644 --- a/mindspore-lite/minddata/dataset/util/json_helper.h +++ b/mindspore-lite/minddata/dataset/util/json_helper.h @@ -37,7 +37,7 @@ namespace platform = mindspore; namespace platform = mindspore::lite; #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief Simple class to do data manipulation, contains helper function to update json files in dataset @@ -254,6 +254,6 @@ class JsonHelper { } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_JSON_HELPER_H_ diff --git a/mindspore-lite/minddata/dataset/util/list.h b/mindspore-lite/minddata/dataset/util/list.h index 776827aa751bc3f7433d99c92bc3143ff4d09dc3..29582385d276fe069c3577bc672fcba6668b1e04 100644 --- a/mindspore-lite/minddata/dataset/util/list.h +++ b/mindspore-lite/minddata/dataset/util/list.h @@ -21,7 +21,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { template struct Node { @@ -211,6 +211,6 @@ struct List { } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_LIST_H_ diff --git a/mindspore-lite/minddata/dataset/util/lock.cc b/mindspore-lite/minddata/dataset/util/lock.cc index 490834382eb03f316db5bd463b9afa2298688dcf..19df81420a0de4953370e45aadd1ee8ac4535976 100644 --- a/mindspore-lite/minddata/dataset/util/lock.cc +++ b/mindspore-lite/minddata/dataset/util/lock.cc @@ -15,7 +15,7 @@ */ #include "mindspore-lite/minddata/dataset/util/lock.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { void SpinLock::Lock() { while (true) { @@ -167,4 +167,4 @@ void LockGuard::Lock() { own_lock_ = true; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/lock.h b/mindspore-lite/minddata/dataset/util/lock.h index 35f15ef93458c7a6da95a54de202a26526b8984c..fa47f4da3eed75ce476519a772b8a5dfe57cfba2 100644 --- a/mindspore-lite/minddata/dataset/util/lock.h +++ b/mindspore-lite/minddata/dataset/util/lock.h @@ -20,7 +20,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { class SpinLock { public: @@ -168,6 +168,6 @@ class LockGuard { bool own_lock_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_LOCK_H_ diff --git a/mindspore-lite/minddata/dataset/util/md_log_adapter.cc b/mindspore-lite/minddata/dataset/util/md_log_adapter.cc index 0a1dd83a1b6761556c4c33e2b3eb9d14d155c5ac..85c746de0305e5709b27bc0af1c96fb87250e834 100644 --- a/mindspore-lite/minddata/dataset/util/md_log_adapter.cc +++ b/mindspore-lite/minddata/dataset/util/md_log_adapter.cc @@ -18,7 +18,7 @@ #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status MDLogAdapter::Apply(Status *rc) { std::string status_msg = ConstructMsg(rc->StatusCode(), rc->CodeAsString(rc->StatusCode()), "", rc->GetLineOfCode(), @@ -81,4 +81,4 @@ std::string MDLogAdapter::ConstructMsg(const enum StatusCode &status_code, const return ss.str(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/md_log_adapter.h b/mindspore-lite/minddata/dataset/util/md_log_adapter.h index d93ecd782e00962abc266564f8eab3a982f16016..b2dd779199cb6e3b49bcd3d0301a1560520fe6a1 100644 --- a/mindspore-lite/minddata/dataset/util/md_log_adapter.h +++ b/mindspore-lite/minddata/dataset/util/md_log_adapter.h @@ -22,7 +22,7 @@ #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class MDLogAdapter { public: @@ -37,5 +37,5 @@ class MDLogAdapter { const std::string &err_description); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_MD_LOG_ADAPTER_H diff --git a/mindspore-lite/minddata/dataset/util/memory_pool.cc b/mindspore-lite/minddata/dataset/util/memory_pool.cc index 7f9b0dcafbf6bbcc755d6bdad8da891b6d095108..8d14387d01788df6531c09bfd52a4d5d33013769 100644 --- a/mindspore-lite/minddata/dataset/util/memory_pool.cc +++ b/mindspore-lite/minddata/dataset/util/memory_pool.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/util/memory_pool.h" #include "include/securec.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status DeMalloc(std::size_t s, void **p, bool init_to_zero = false) { if (p == nullptr) { @@ -34,7 +34,7 @@ Status DeMalloc(std::size_t s, void **p, bool init_to_zero = false) { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite void *operator new(std::size_t s, mindspore::Status *rc, std::shared_ptr b) { void *ptr = nullptr; diff --git a/mindspore-lite/minddata/dataset/util/memory_pool.h b/mindspore-lite/minddata/dataset/util/memory_pool.h index 0da6a45ddd168fdd3cc0f2a79e5111643398555c..e4d1038d3eae3f7c3f49cf62532c6fbbc9016ec3 100644 --- a/mindspore-lite/minddata/dataset/util/memory_pool.h +++ b/mindspore-lite/minddata/dataset/util/memory_pool.h @@ -21,7 +21,7 @@ #include #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Abstract class of a memory pool class MemoryPool { @@ -46,7 +46,7 @@ class MemoryPool { Status DeMalloc(std::size_t s, void **p, bool); } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite void *operator new(std::size_t, mindspore::Status *, std::shared_ptr); diff --git a/mindspore-lite/minddata/dataset/util/monitor.cc b/mindspore-lite/minddata/dataset/util/monitor.cc index 35edd98db258b07399ced7c1d712b14f5d40e277..cbc903b89f82b912efc741c78bc6fe840cdb57a7 100644 --- a/mindspore-lite/minddata/dataset/util/monitor.cc +++ b/mindspore-lite/minddata/dataset/util/monitor.cc @@ -17,7 +17,7 @@ #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { #if !defined(__APPLE__) && !defined(BUILD_LITE) && !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && \ !defined(ANDROID) @@ -58,4 +58,4 @@ Status MonitorSubprocess(int pid) { } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/monitor.h b/mindspore-lite/minddata/dataset/util/monitor.h index 2cbeee82e4659ce25c09869c4fc041ed0dd038b3..3b7eda05f94d1a02b5db496e3f5a0fccc5fb55ef 100644 --- a/mindspore-lite/minddata/dataset/util/monitor.h +++ b/mindspore-lite/minddata/dataset/util/monitor.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #if !defined(__APPLE__) && !defined(BUILD_LITE) && !defined(_WIN32) && !defined(_WIN64) && !defined(__ANDROID__) && \ !defined(ANDROID) @@ -33,6 +33,6 @@ namespace dataset { Status MonitorSubprocess(int pid); #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_MONITOR_H_ diff --git a/mindspore-lite/minddata/dataset/util/path.cc b/mindspore-lite/minddata/dataset/util/path.cc index 7ebc7265f11838e5d8bb7e6cf45908176b69720f..24daa9d43cf7983d1173ef777c65f4c08ff6fd25 100644 --- a/mindspore-lite/minddata/dataset/util/path.cc +++ b/mindspore-lite/minddata/dataset/util/path.cc @@ -35,7 +35,7 @@ #include "utils/ms_utils.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #if defined(_WIN32) || defined(_WIN64) char Path::separator_ = '\\'; @@ -410,4 +410,4 @@ std::ostream &operator<<(std::ostream &os, const Path &s) { return os; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/path.h b/mindspore-lite/minddata/dataset/util/path.h index ae0c690dba36bba5a1b6d3112a39c9a09e2e38ca..06e0aacdd2c806a488effbd9c011ecf25430a087 100644 --- a/mindspore-lite/minddata/dataset/util/path.h +++ b/mindspore-lite/minddata/dataset/util/path.h @@ -21,7 +21,7 @@ #include "utils/os.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Path { public: @@ -126,6 +126,6 @@ class Path { std::string path_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_PATH_H_ diff --git a/mindspore-lite/minddata/dataset/util/queue.h b/mindspore-lite/minddata/dataset/util/queue.h index 20dd0c2553dccfbd2669af8e596c13571bda7200..ea9d28c924b1df61e1adb1a406a93fe758617806 100644 --- a/mindspore-lite/minddata/dataset/util/queue.h +++ b/mindspore-lite/minddata/dataset/util/queue.h @@ -29,7 +29,7 @@ #include "mindspore-lite/minddata/dataset/util/cond_var.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // A simple thread safe queue using a fixed size array template @@ -315,5 +315,5 @@ class QueueList { mutable std::mutex mux_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_QUEUE_H_ diff --git a/mindspore-lite/minddata/dataset/util/queue_map.h b/mindspore-lite/minddata/dataset/util/queue_map.h index 52bd3795c8d5188813d7913e8ff4257ad35224a7..c4eaf1d4f0d2c493434a501cc9df10a8eb9ea2ae 100644 --- a/mindspore-lite/minddata/dataset/util/queue_map.h +++ b/mindspore-lite/minddata/dataset/util/queue_map.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/util/system_pool.h" #include "mindspore-lite/minddata/dataset/util/semaphore.h" #include "mindspore-lite/minddata/dataset/util/services.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { template /// \brief QueueMap is like a Queue but instead of there is a map of deque. @@ -160,6 +160,6 @@ class QueueMap { std::atomic num_rows_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_QUEUE_MAP_H_ diff --git a/mindspore-lite/minddata/dataset/util/random.h b/mindspore-lite/minddata/dataset/util/random.h index 54604fa1199d6f30b04e529c1eafe5fbedfc5bae..93ac16a0390afb7e13d17ee0dd0873b2b3d0d224 100644 --- a/mindspore-lite/minddata/dataset/util/random.h +++ b/mindspore-lite/minddata/dataset/util/random.h @@ -33,7 +33,7 @@ #include "mindspore-lite/minddata/dataset/core/global_context.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { inline std::mt19937 GetRandomDevice() { #if defined(_WIN32) || defined(_WIN64) @@ -73,6 +73,6 @@ inline uint32_t GetSeed() { } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_RANDOM_H_ diff --git a/mindspore-lite/minddata/dataset/util/rdr.cc b/mindspore-lite/minddata/dataset/util/rdr.cc index aa3750769b6ffa10c73ac7553208f81393b0432a..42d9f57cdfcd6ac32ce4227eed4c8351afe01a90 100644 --- a/mindspore-lite/minddata/dataset/util/rdr.cc +++ b/mindspore-lite/minddata/dataset/util/rdr.cc @@ -19,7 +19,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const int32_t kMdRdrRecordLimit = 10; @@ -167,4 +167,4 @@ Status MDChannelInfo::RecordPushEndTime() { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/rdr.h b/mindspore-lite/minddata/dataset/util/rdr.h index c8f3861ec001669e1346810031805a3ecbc90516..8f4e4e4af78ea519cd8d7c43aabd90d4b6ff07a0 100644 --- a/mindspore-lite/minddata/dataset/util/rdr.h +++ b/mindspore-lite/minddata/dataset/util/rdr.h @@ -21,7 +21,7 @@ #include #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class MDChannelInfo { public: @@ -59,6 +59,6 @@ class MDChannelInfo { std::deque push_end_time_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_RDR_H_ diff --git a/mindspore-lite/minddata/dataset/util/semaphore.cc b/mindspore-lite/minddata/dataset/util/semaphore.cc index 40a5a4bf3e7e67c0a0c9459646cb82339be54739..c26a6085d7ddfddd63d36fe69373398fb4597ac3 100644 --- a/mindspore-lite/minddata/dataset/util/semaphore.cc +++ b/mindspore-lite/minddata/dataset/util/semaphore.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/util/semaphore.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status Semaphore::P() { std::unique_lock lck(mutex_); @@ -35,4 +35,4 @@ Status Semaphore::Deregister() { return (wait_cond_.Deregister()); } void Semaphore::ResetIntrpState() { wait_cond_.ResetIntrpState(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/semaphore.h b/mindspore-lite/minddata/dataset/util/semaphore.h index f3bf736f13b4d3c153c0e57e3bfb2823b8401b77..7ff155e2b213dca261e367020d9051e615f13fa2 100644 --- a/mindspore-lite/minddata/dataset/util/semaphore.h +++ b/mindspore-lite/minddata/dataset/util/semaphore.h @@ -18,7 +18,7 @@ #include "mindspore-lite/minddata/dataset/util/cond_var.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TaskGroup; @@ -50,5 +50,5 @@ class Semaphore { CondVar wait_cond_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_SEMAPHORE_H_ diff --git a/mindspore-lite/minddata/dataset/util/service.cc b/mindspore-lite/minddata/dataset/util/service.cc index a3ca1db732443ee5bc81efda5d31950076fbb880..fffabbb597a73b5ef40c3bb071824080f6fff2fb 100644 --- a/mindspore-lite/minddata/dataset/util/service.cc +++ b/mindspore-lite/minddata/dataset/util/service.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/util/service.h" #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { Status Service::ServiceStart() { do { @@ -79,4 +79,4 @@ Status Service::ServiceStop() noexcept { } while (true); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/service.h b/mindspore-lite/minddata/dataset/util/service.h index a97be754493ae28928ab425e858ce867c98eece2..58a55c34ca04884ffa45fdd8fa28020c082fcf59 100644 --- a/mindspore-lite/minddata/dataset/util/service.h +++ b/mindspore-lite/minddata/dataset/util/service.h @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/util/lock.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Service { public: @@ -49,5 +49,5 @@ class Service { RWLock state_lock_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_SERVICE_H_ diff --git a/mindspore-lite/minddata/dataset/util/services.cc b/mindspore-lite/minddata/dataset/util/services.cc index fc4f214c464cae7a5d483bcb340c8cdd016e5931..3fb6f207e0a9a64ba1d167e428e7bd4067973c8b 100644 --- a/mindspore-lite/minddata/dataset/util/services.cc +++ b/mindspore-lite/minddata/dataset/util/services.cc @@ -30,7 +30,7 @@ #define LOGIN_NAME_MAX 256 #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { std::unique_ptr Services::instance_ = nullptr; std::once_flag Services::init_instance_flag_; @@ -119,4 +119,4 @@ Services::~Services() noexcept { } } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/services.h b/mindspore-lite/minddata/dataset/util/services.h index f209668d3affac8b378449a16aafca186f5be643..431d1b38df0efb469f73005030cd823e07fcc2ee 100644 --- a/mindspore-lite/minddata/dataset/util/services.h +++ b/mindspore-lite/minddata/dataset/util/services.h @@ -30,7 +30,7 @@ #define UNIQUEID_LEN 36 #define UNIQUEID_LIST_LIMITS 1024 #define UNIQUEID_HALF_INDEX ((UNIQUEID_LIST_LIMITS) / 2) -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TaskManager; @@ -114,6 +114,6 @@ class Services { Status CreateAllInstances(); }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_SERVICES_H_ diff --git a/mindspore-lite/minddata/dataset/util/shared_mem.cc b/mindspore-lite/minddata/dataset/util/shared_mem.cc index d0bcf8605f007688a74568c1e2c3789348e248a1..47c79946be9a975c3471ed80a5dbcd0cdd6a5f74 100644 --- a/mindspore-lite/minddata/dataset/util/shared_mem.cc +++ b/mindspore-lite/minddata/dataset/util/shared_mem.cc @@ -25,7 +25,7 @@ #include #include -namespace mindspore::dataset { +namespace mindspore::lite::dataset { #if !defined(_WIN32) && !defined(_WIN64) std::string GenerateShmName() { static std::atomic counter{0}; @@ -117,4 +117,4 @@ void SharedMem::Close() { MS_LOG(INFO) << "Shared memory " << name_ << " has been closed."; } #endif -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset diff --git a/mindspore-lite/minddata/dataset/util/shared_mem.h b/mindspore-lite/minddata/dataset/util/shared_mem.h index 60aca87e07f3eab1fd5566e906d3b829f9e92672..7404e3d6762b388f3fbeb4cecfecfdba12a663c1 100644 --- a/mindspore-lite/minddata/dataset/util/shared_mem.h +++ b/mindspore-lite/minddata/dataset/util/shared_mem.h @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { std::string GenerateShmName(); class SharedMem { @@ -48,5 +48,5 @@ class SharedMem { size_t size_; void *buf_; }; -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_SHARED_MEM_H_ diff --git a/mindspore-lite/minddata/dataset/util/sig_handler.cc b/mindspore-lite/minddata/dataset/util/sig_handler.cc index 92a268f56bc77706ccc016e0d0f9814084cc701e..4d1351dfd3a5be7ccb4b97ac9263ad303d0130c2 100644 --- a/mindspore-lite/minddata/dataset/util/sig_handler.cc +++ b/mindspore-lite/minddata/dataset/util/sig_handler.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore::dataset { +namespace mindspore::lite::dataset { static std::unordered_map> worker_groups = {}; #if !defined(_WIN32) && !defined(_WIN64) /// \brief Set handler for the specified signal. @@ -222,4 +222,4 @@ void DeregisterWorkerPIDs(int64_t id) { MS_LOG(INFO) << "Watch dog stops monitoring process(es): " << GetPIDsString(worker_groups[id]); (void)worker_groups.erase(id); } -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset diff --git a/mindspore-lite/minddata/dataset/util/sig_handler.h b/mindspore-lite/minddata/dataset/util/sig_handler.h index dd7e96c92ba856fc4d84d649a730d71122afe778..2df6530e56a60573aa877ff6765dc383b191dc6d 100644 --- a/mindspore-lite/minddata/dataset/util/sig_handler.h +++ b/mindspore-lite/minddata/dataset/util/sig_handler.h @@ -19,7 +19,7 @@ #include #include -namespace mindspore::dataset { +namespace mindspore::lite::dataset { /// \brief Register the custom signal handlers. extern void RegisterHandlers(); @@ -34,5 +34,5 @@ extern void RegisterWorkerPIDs(int64_t id, const std::set &pids); /// \brief Deregister workers to be monitored by the watch dog. extern void DeregisterWorkerPIDs(int64_t id); -} // namespace mindspore::dataset +} // namespace mindspore::lite::dataset #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_SIG_HANDLER_H_ diff --git a/mindspore-lite/minddata/dataset/util/slice.cc b/mindspore-lite/minddata/dataset/util/slice.cc index a93e6d8cc88fceb66f8a74f099adf568b1a0a3b3..ef96707cc08a5d9451f1821f707e1d6ebb02ae36 100644 --- a/mindspore-lite/minddata/dataset/util/slice.cc +++ b/mindspore-lite/minddata/dataset/util/slice.cc @@ -15,7 +15,7 @@ */ #include "mindspore-lite/minddata/dataset/util/slice.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { WritableSlice::WritableSlice(const WritableSlice &src, off64_t offset, size_t len) : ReadableSlice(src, offset, len) { mutable_data_ = static_cast(src.mutable_data_) + offset; @@ -35,4 +35,4 @@ Status WritableSlice::Copy(WritableSlice *dest, const ReadableSlice &src) { return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/slice.h b/mindspore-lite/minddata/dataset/util/slice.h index 473b26b0a4fd378704aec9ea9b44dd66c87e96a7..3d223498c159a8914c7f53604f03e62d4184adad 100644 --- a/mindspore-lite/minddata/dataset/util/slice.h +++ b/mindspore-lite/minddata/dataset/util/slice.h @@ -25,7 +25,7 @@ #define off64_t off_t #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { /// \brief A ReadableSlice wraps a const pointer in memory and its size. /// \see WritableSlice for a non-const version @@ -129,5 +129,5 @@ class WritableSlice : public ReadableSlice { void *GetMutablePointer() { return mutable_data_; } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_SLICE_H_ diff --git a/mindspore-lite/minddata/dataset/util/status.cc b/mindspore-lite/minddata/dataset/util/status.cc index 09bfce3b01d0b79112f504c9793ba51f3608bbdd..3f1b89a5a6dcdf2d94e6bf6cc19de0b333081400 100644 --- a/mindspore-lite/minddata/dataset/util/status.cc +++ b/mindspore-lite/minddata/dataset/util/status.cc @@ -26,7 +26,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { #if !defined(_WIN32) && !defined(_WIN64) && !defined(__APPLE__) float GetMemoryUsage() { @@ -87,4 +87,4 @@ float GetMemoryUsage() { } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/status.h b/mindspore-lite/minddata/dataset/util/status.h index cb5f9aa52ba7f8f381fd061ed1be4e56f6e4e8f3..8a7ff2aadf1111aabab9e1b80243b75228a04540 100644 --- a/mindspore-lite/minddata/dataset/util/status.h +++ b/mindspore-lite/minddata/dataset/util/status.h @@ -32,7 +32,7 @@ #include "include/api/status.h" #include "mindspore-lite/minddata/dataset/util/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { #define RETURN_IF_NOT_OK(_s) \ do { \ @@ -137,5 +137,5 @@ float GetMemoryUsage(); } while (false) #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_STATUS_H_ diff --git a/mindspore-lite/minddata/dataset/util/system_pool.h b/mindspore-lite/minddata/dataset/util/system_pool.h index e69df666e8f66d0bbb6e82cc7e16cc9ef93f5344..74ec4a049d7377ba3a031a4364a1eaf79d2f4b35 100644 --- a/mindspore-lite/minddata/dataset/util/system_pool.h +++ b/mindspore-lite/minddata/dataset/util/system_pool.h @@ -25,7 +25,7 @@ #include "mindspore-lite/minddata/dataset/util/allocator.h" #include "mindspore-lite/minddata/dataset/util/memory_pool.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // This class demonstrate how to implement a simple MemoryPool // for minddata/dataset using malloc/free/realloc. We need to @@ -75,6 +75,6 @@ class SystemPool : public MemoryPool { } }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_SYSTEM_POOL_H_ diff --git a/mindspore-lite/minddata/dataset/util/task.cc b/mindspore-lite/minddata/dataset/util/task.cc index 9b0eb54422a3451aee35013190df71da33df6b20..62f7ebf5561c52dd6c19b82797c3396fc247bd51 100644 --- a/mindspore-lite/minddata/dataset/util/task.cc +++ b/mindspore-lite/minddata/dataset/util/task.cc @@ -24,7 +24,7 @@ #include "utils/ms_context.h" #include "mindspore/ccsrc/include/runtime/hardware_abstract/data_queue/data_queue_mgr.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace dataset { thread_local Task *gMyTask = nullptr; @@ -270,4 +270,4 @@ pthread_t Task::GetNativeHandle() const { return native_handle_; } #endif } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/task.h b/mindspore-lite/minddata/dataset/util/task.h index 19b6e30cddf74a53dc5c17ef69957ab1249bb9dc..a968df794a7242d113bded2ce854f055fa4c4de4 100644 --- a/mindspore-lite/minddata/dataset/util/task.h +++ b/mindspore-lite/minddata/dataset/util/task.h @@ -40,7 +40,7 @@ #include "mindspore-lite/minddata/dataset/util/log_adapter.h" #include "mindspore-lite/minddata/dataset/util/wait_post.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { const uint32_t kWaitInterruptTaskTime = 30; // the wait time of interrupt task @@ -149,6 +149,6 @@ class Task : public IntrpResource { extern thread_local Task *gMyTask; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_TASK_H_ diff --git a/mindspore-lite/minddata/dataset/util/task_manager.cc b/mindspore-lite/minddata/dataset/util/task_manager.cc index 081b24a41e7d009641083627e14388dfd9f5604f..bae282fdf3f85a86e123e4202d43fa6e9396f4f7 100644 --- a/mindspore-lite/minddata/dataset/util/task_manager.cc +++ b/mindspore-lite/minddata/dataset/util/task_manager.cc @@ -20,7 +20,7 @@ #include "include/securec.h" #include "utils/ms_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { TaskManager *TaskManager::instance_ = nullptr; std::once_flag TaskManager::init_instance_flag_; @@ -400,4 +400,4 @@ Status TaskGroup::GetTaskErrorIfAny() { std::shared_ptr TaskGroup::GetIntrpService() { return intrp_svc_; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/task_manager.h b/mindspore-lite/minddata/dataset/util/task_manager.h index 88c04c4f616ac9b6f41ef35d786744e6392866f9..e803598a80e4e9de126280c90336a5c6b30547e8 100644 --- a/mindspore-lite/minddata/dataset/util/task_manager.h +++ b/mindspore-lite/minddata/dataset/util/task_manager.h @@ -32,7 +32,7 @@ #include "mindspore-lite/minddata/dataset/util/status.h" #include "mindspore-lite/minddata/dataset/util/task.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { namespace thread { using id = std::thread::id; @@ -194,6 +194,6 @@ inline Status GetInterruptStatus() { } while (false) } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_TASK_MANAGER_H_ diff --git a/mindspore-lite/minddata/dataset/util/treap.h b/mindspore-lite/minddata/dataset/util/treap.h index 8e8003f2ce99779ed8b9dba5c398f58d37693c07..a76e18f3f0064743ae3be835cc0544e98be367f5 100644 --- a/mindspore-lite/minddata/dataset/util/treap.h +++ b/mindspore-lite/minddata/dataset/util/treap.h @@ -22,7 +22,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace dataset { // A treap is a combination of binary search tree and heap. Each key is given a priority. The priority // for any non-leaf node is greater than or equal to the priority of its children. @@ -403,5 +403,5 @@ class Treap { std::vector free_list_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_TREAP_H_ diff --git a/mindspore-lite/minddata/dataset/util/validators.cc b/mindspore-lite/minddata/dataset/util/validators.cc index 4a9c65fec7833b486974450b4aa60a85f48feb8a..cda08a5134b9b2b70dc016dfc0cd620bdc621773 100644 --- a/mindspore-lite/minddata/dataset/util/validators.cc +++ b/mindspore-lite/minddata/dataset/util/validators.cc @@ -15,8 +15,8 @@ */ #include "mindspore-lite/minddata/dataset/util/validators.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // implement the validate function here } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/validators.h b/mindspore-lite/minddata/dataset/util/validators.h index 6ce42d05d5196d6749dfe54ea2fbfbe2effcd6e9..bbeb7391fd2bbc8e922a1d75e1cbcca3b8919843 100644 --- a/mindspore-lite/minddata/dataset/util/validators.h +++ b/mindspore-lite/minddata/dataset/util/validators.h @@ -27,7 +27,7 @@ #include "mindspore-lite/minddata/dataset/core/tensor.h" #include "mindspore-lite/minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // validator Parameter in json file inline Status ValidateParamInJson(const nlohmann::json &json_obj, const std::string ¶m_name, @@ -223,5 +223,5 @@ std::string NumberSetToString(const std::set &valid_value) { return "(" + err_msg + ")"; } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_VALIDATORS_H_ diff --git a/mindspore-lite/minddata/dataset/util/wait_post.cc b/mindspore-lite/minddata/dataset/util/wait_post.cc index 82f97feb33492da3018eedfdc80a48d7a2f9d27d..2304aa9de3c6ed8e3dea0589c3dbff91faf9598e 100644 --- a/mindspore-lite/minddata/dataset/util/wait_post.cc +++ b/mindspore-lite/minddata/dataset/util/wait_post.cc @@ -16,7 +16,7 @@ #include "mindspore-lite/minddata/dataset/util/wait_post.h" #include "mindspore-lite/minddata/dataset/util/task_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { WaitPost::WaitPost() : value_(0) {} @@ -42,4 +42,4 @@ void WaitPost::ResetIntrpState() { wait_cond_.ResetIntrpState(); } Status WaitPost::Deregister() { return wait_cond_.Deregister(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/dataset/util/wait_post.h b/mindspore-lite/minddata/dataset/util/wait_post.h index 38522f32f01028b2ba71b0f3d1b2bc9ba32c3f9b..5568a08a1012b5491943867eecaa97b3b343791b 100644 --- a/mindspore-lite/minddata/dataset/util/wait_post.h +++ b/mindspore-lite/minddata/dataset/util/wait_post.h @@ -20,7 +20,7 @@ #include "mindspore-lite/minddata/dataset/util/cond_var.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class TaskGroup; @@ -48,6 +48,6 @@ class WaitPost { int value_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_WAIT_POST_H_ diff --git a/mindspore-lite/minddata/wrapper/MDToDApi.cc b/mindspore-lite/minddata/wrapper/MDToDApi.cc index 62c9d2f5f24abb5b54deaf28e6ecb846e10850a2..17388201ec1fb7f1f6cd0c105333fb86d0e964ad 100644 --- a/mindspore-lite/minddata/wrapper/MDToDApi.cc +++ b/mindspore-lite/minddata/wrapper/MDToDApi.cc @@ -53,7 +53,7 @@ using mindspore::Status; using mindspore::dataset::BorderType; using mindspore::dataset::InterpolationMode; -namespace mindspore { +namespace mindspore::lite { class MDToDApi { public: std::shared_ptr _iter; @@ -468,4 +468,4 @@ extern "C" int MDToDApi_UpdateNoOfFaces(MDToDApi *pMDToDApi, int32_t noOfFaces) } return 0; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/wrapper/MDToDApi.h b/mindspore-lite/minddata/wrapper/MDToDApi.h index 4dcab8f9b28edfcc0842bfa80b52bb5961d98a7d..6f09e957815a0dc77d593dd820ec87f9e3be8922 100644 --- a/mindspore-lite/minddata/wrapper/MDToDApi.h +++ b/mindspore-lite/minddata/wrapper/MDToDApi.h @@ -19,7 +19,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { class MDToDApi; typedef struct MDToDBuff { @@ -58,7 +58,7 @@ typedef struct MDToDResult { MDToDBuff_t imageQualitiesBuff; MDToDBuff_t faceEmbeddingsBuff; } MDToDResult_t; -} // namespace mindspore +} // namespace mindspore::lite using (*MDToDApi_pathTest_t)(const char *path) = int; using (*MDToDApi_testAlbum_t)() = int; diff --git a/mindspore-lite/minddata/wrapper/album_op_android.cc b/mindspore-lite/minddata/wrapper/album_op_android.cc index af5c02656a3beac805c99334aff0f1f7775b1a9a..49b00b0f1031e0324c1e3cbb047768df1adb2a61 100644 --- a/mindspore-lite/minddata/wrapper/album_op_android.cc +++ b/mindspore-lite/minddata/wrapper/album_op_android.cc @@ -21,7 +21,7 @@ #include "minddata/dataset/kernels/image/lite_image_utils.h" #include "minddata/dataset/kernels/image/exif_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { AlbumOp::AlbumOp(const std::string &file_dir, bool do_decode, const std::string &schema_file, @@ -515,4 +515,4 @@ Status AlbumOp::LoadTensorRow(row_id_type row_id, const std::string &file, return Status::OK(); } } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/minddata/wrapper/album_op_android.h b/mindspore-lite/minddata/wrapper/album_op_android.h index 226ba66c9a4b50cf804620780dec62b4be08f8fa..2b53b79f7e33d888c22d21d425ffc9d956d7427c 100644 --- a/mindspore-lite/minddata/wrapper/album_op_android.h +++ b/mindspore-lite/minddata/wrapper/album_op_android.h @@ -32,7 +32,7 @@ #include "minddata/dataset/util/path.h" #include "minddata/dataset/util/status.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { // Forward declares template @@ -189,5 +189,5 @@ class AlbumOp { std::vector column_names_; }; } // namespace dataset -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_MINDDATA_WRAPPER_ALBUM_OP_ANDROID_H_ diff --git a/mindspore-lite/providers/dpico/common/log_util.cc b/mindspore-lite/providers/dpico/common/log_util.cc index aba00a4ca577350294250bc0994dd88abedff4b8..53171189798eb6294d6ee9c57ea5e382ee2fb8d3 100644 --- a/mindspore-lite/providers/dpico/common/log_util.cc +++ b/mindspore-lite/providers/dpico/common/log_util.cc @@ -16,7 +16,7 @@ #include "common/log_util.h" #include #include -namespace mindspore { +namespace mindspore::lite { int StrToInt(const char *env) { if (env == nullptr) { return static_cast(mindspore::DpicoLogLevel::WARNING); @@ -71,4 +71,4 @@ void DpicoLogWriter::operator<(const DpicoLogStream &stream) const noexcept { msg << stream.sstream_->rdbuf(); OutputLog(msg); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/dpico/common/log_util.h b/mindspore-lite/providers/dpico/common/log_util.h index be234231f581e9dfe30f33bfebb3c9a57bfb9706..391d437dce8cb3960a465ac6fe27d6bdefe4fc97 100644 --- a/mindspore-lite/providers/dpico/common/log_util.h +++ b/mindspore-lite/providers/dpico/common/log_util.h @@ -30,7 +30,7 @@ static constexpr size_t GetRealPathPos() noexcept { : 0; } -namespace mindspore { +namespace mindspore::lite { #define DPICO_FILE_NAME \ (sizeof(__FILE__) > GetRealPathPos() ? static_cast(__FILE__) + GetRealPathPos() \ : static_cast(__FILE__)) @@ -95,6 +95,6 @@ class DpicoLogWriter { #define MS_LOG_INFO MSLOG_IF(mindspore::DpicoLogLevel::INFO) #define MS_LOG_WARNING MSLOG_IF(mindspore::DpicoLogLevel::WARNING) #define MS_LOG_ERROR MSLOG_IF(mindspore::DpicoLogLevel::ERROR) -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_DPICO_COMMON_LOG_UTIL_H_ diff --git a/mindspore-lite/providers/dpico/common/op_attr.h b/mindspore-lite/providers/dpico/common/op_attr.h index a7e43e309965b9356b31522b7efc869dba04127a..f28462e634abb5a11ea17560c0696bdab5e73980 100644 --- a/mindspore-lite/providers/dpico/common/op_attr.h +++ b/mindspore-lite/providers/dpico/common/op_attr.h @@ -17,7 +17,7 @@ #ifndef MINDSPORE_LITE_PROVIDERS_DPICO_COMMON_OP_ATTR_H_ #define MINDSPORE_LITE_PROVIDERS_DPICO_COMMON_OP_ATTR_H_ -namespace mindspore { +namespace mindspore::lite { constexpr auto kAclConfigPath = "AclConfigPath"; constexpr auto kLastDimStride = "internal_stride"; constexpr auto kSupportZeroCopy = "SupportZeroCopy"; @@ -36,5 +36,5 @@ constexpr auto kNmsThreshold = "NmsThreshold"; constexpr auto kOutputsFormat = "outputs_format"; constexpr auto kOutputsShape = "outputs_shape"; constexpr auto kScoreThreshold = "ScoreThreshold"; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_DPICO_COMMON_OP_ATTR_H_ diff --git a/mindspore-lite/providers/dpico/infer/custom_infer.cc b/mindspore-lite/providers/dpico/infer/custom_infer.cc index 0cb655d69ed8fa9906455ad1a8cd25f934bd77cb..2efbcd41420232c3897b9d82c781314121319b86 100644 --- a/mindspore-lite/providers/dpico/infer/custom_infer.cc +++ b/mindspore-lite/providers/dpico/infer/custom_infer.cc @@ -33,7 +33,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Custom; -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kOmParameterNum = 1; @@ -209,9 +209,9 @@ std::shared_ptr CustomInferCreator() { return infer; } } // namespace dpico -} // namespace mindspore -namespace mindspore { +} // namespace mindspore::lite +namespace mindspore::lite { namespace kernel { REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, DPICO, dpico::CustomInferCreator); } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/dpico/infer/custom_infer.h b/mindspore-lite/providers/dpico/infer/custom_infer.h index 1dec5cb0c8ff888f709eefc977196a444fdf417b..e94d76e338f2f040c7aacefd9095b206778f838c 100644 --- a/mindspore-lite/providers/dpico/infer/custom_infer.h +++ b/mindspore-lite/providers/dpico/infer/custom_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class CustomInterface : public kernel::KernelInterface { public: @@ -32,6 +32,6 @@ class CustomInterface : public kernel::KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_DPICO_INFER_CUSTOM_INFER_H_ diff --git a/mindspore-lite/providers/nnie/src/custom_allocator.h b/mindspore-lite/providers/nnie/src/custom_allocator.h index 444552e8263264e5cd898b2fb06996c085c4ad33..21be154a1e4fa933e687f4d8c0b447ddf1a4b49b 100644 --- a/mindspore-lite/providers/nnie/src/custom_allocator.h +++ b/mindspore-lite/providers/nnie/src/custom_allocator.h @@ -28,7 +28,7 @@ #include "include/api/allocator.h" #include "include/hi_type.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { class CustomAllocator : public Allocator { public: @@ -42,6 +42,6 @@ class CustomAllocator : public Allocator { int IncRefCount(void *ptr, int ref_count) override { return 1; } }; } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_SRC_CUSTOM_ALLOCATOR_H_ diff --git a/mindspore-lite/providers/nnie/src/custom_fp32.cc b/mindspore-lite/providers/nnie/src/custom_fp32.cc index 5ddebc367d8dc9276dccb9a84961c04e9b0924c8..97a7d3dcd07ccc1a070d85d27547fb2aca0d72b3 100644 --- a/mindspore-lite/providers/nnie/src/custom_fp32.cc +++ b/mindspore-lite/providers/nnie/src/custom_fp32.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Custom; -namespace mindspore { +namespace mindspore::lite { namespace nnie { static std::shared_ptr kCustomAllocator = std::make_shared(); @@ -183,8 +183,8 @@ std::shared_ptr CustomCreateKernel(const std::vector< return kernel; } } // namespace nnie -} // namespace mindspore -namespace mindspore { +} // namespace mindspore::lite +namespace mindspore::lite { namespace registry { namespace { const auto kFloat32 = DataType::kNumberTypeFloat32; @@ -195,4 +195,4 @@ REGISTER_CUSTOM_KERNEL(CPU, NNIE, kFloat32, NNIE, nnie::CustomCreateKernel) REGISTER_CUSTOM_KERNEL(CPU, NNIE, kInt8, NNIE, nnie::CustomCreateKernel) REGISTER_CUSTOM_KERNEL(CPU, NNIE, kUint8, NNIE, nnie::CustomCreateKernel) } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie/src/custom_fp32.h b/mindspore-lite/providers/nnie/src/custom_fp32.h index 4e4acf4ef30539f41fb855b1ed46d6d88fe4739d..65d754dc1a008a1c2e8875438d4c3bd70bc7455a 100644 --- a/mindspore-lite/providers/nnie/src/custom_fp32.h +++ b/mindspore-lite/providers/nnie/src/custom_fp32.h @@ -31,7 +31,7 @@ using mindspore::MSTensor; using mindspore::kernel::Kernel; -namespace mindspore { +namespace mindspore::lite { namespace nnie { class CustomCPUKernel : public Kernel { public: @@ -67,5 +67,5 @@ class CustomCPUKernel : public Kernel { std::vector> outputs_shapes_; }; } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_SRC_CUSTOM_FP32_H_ diff --git a/mindspore-lite/providers/nnie/src/custom_infer.cc b/mindspore-lite/providers/nnie/src/custom_infer.cc index 08a587006ad41de02d3fc4c82f5c145ae7865baf..89ea0d4c94f7f76c085f8425ffc1e649c1d7b58d 100644 --- a/mindspore-lite/providers/nnie/src/custom_infer.cc +++ b/mindspore-lite/providers/nnie/src/custom_infer.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Custom; -namespace mindspore { +namespace mindspore::lite { namespace nnie { std::shared_ptr CustomInferCreater() { auto infer = new (std::nothrow) CustomInterface(); @@ -158,9 +158,9 @@ Status CustomInterface::Infer(std::vector *inputs, std::vec return kSuccess; } } // namespace nnie -} // namespace mindspore -namespace mindspore { +} // namespace mindspore::lite +namespace mindspore::lite { namespace kernel { REGISTER_CUSTOM_KERNEL_INTERFACE(NNIE, NNIE, nnie::CustomInferCreater); } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie/src/custom_infer.h b/mindspore-lite/providers/nnie/src/custom_infer.h index ec9ddc0a1e4a0b217a257c7e7bca7eb61bb1404e..e2d383c5570903242096673a5ed2f4e5cf6c024f 100644 --- a/mindspore-lite/providers/nnie/src/custom_infer.h +++ b/mindspore-lite/providers/nnie/src/custom_infer.h @@ -19,7 +19,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { class CustomInterface : public mindspore::kernel::KernelInterface { public: @@ -31,5 +31,5 @@ class CustomInterface : public mindspore::kernel::KernelInterface { const mindspore::schema::Primitive *primitive) override; }; } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_SRC_CUSTOM_INFER_H_ diff --git a/mindspore-lite/providers/nnie/src/nnie_cfg_parser.cc b/mindspore-lite/providers/nnie/src/nnie_cfg_parser.cc index d51744ff77dd1b21dba5629f96b8219cb0b07077..a82c84e1ed9cf1b5e77fd66a5ea54e93d4fe6922 100644 --- a/mindspore-lite/providers/nnie/src/nnie_cfg_parser.cc +++ b/mindspore-lite/providers/nnie/src/nnie_cfg_parser.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace nnie { namespace { constexpr auto kTimeStep = "TimeStep"; @@ -114,4 +114,4 @@ int Flags::Init(const kernel::Kernel &kernel) { return RET_OK; } } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie/src/nnie_cfg_parser.h b/mindspore-lite/providers/nnie/src/nnie_cfg_parser.h index 92875bc1452cf579a2d2b94d4400ef441f651ee3..e7fdd3c322419e5a0deeaafa4051c85bffee13a4 100644 --- a/mindspore-lite/providers/nnie/src/nnie_cfg_parser.h +++ b/mindspore-lite/providers/nnie/src/nnie_cfg_parser.h @@ -21,7 +21,7 @@ #include "include/api/kernel.h" #include "include/hi_type.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { typedef struct { HI_U64 phy_; @@ -53,5 +53,5 @@ class Flags { int ParserBool(const std::map &nnie_arg, const std::string key, bool *val); }; } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/providers/nnie/src/nnie_common.cc b/mindspore-lite/providers/nnie/src/nnie_common.cc index 135bd8996b6272d04b102c3c22ec7f3b7ece950a..1f296bd0f68df62c3a04073327c6e5f43df97e44 100644 --- a/mindspore-lite/providers/nnie/src/nnie_common.cc +++ b/mindspore-lite/providers/nnie/src/nnie_common.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace nnie { constexpr int kSleepUs = 100; constexpr int kCompressionWidth = 2; @@ -969,4 +969,4 @@ int NnieCommRun(NnieRunCfg *nnie_run_cfg, bool run_box) { return RET_OK; } } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie/src/nnie_common.h b/mindspore-lite/providers/nnie/src/nnie_common.h index ddd6ddb2ccee3d7dd9a15d318649bb1c566182f5..ad9565e98d90e34a30e14e0bbdac94e3b0978cdb 100644 --- a/mindspore-lite/providers/nnie/src/nnie_common.h +++ b/mindspore-lite/providers/nnie/src/nnie_common.h @@ -27,7 +27,7 @@ #include "include/ir/dtype/type_id.h" #include "src/nnie_cfg_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { #define NNIE_ALIGN_16 16 #define NNIE_ALIGN16(u32Num) ((u32Num + NNIE_ALIGN_16 - 1) / NNIE_ALIGN_16 * NNIE_ALIGN_16) @@ -117,5 +117,5 @@ int NnieCommGetOutputData(NnieRunCfg *nnie_run_cfg, float *data, HI_U32 output_s HI_U32 GetBlobSize(const SVP_SRC_BLOB_S &blob); } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_SRC_NNIE_COMMON_H_ diff --git a/mindspore-lite/providers/nnie/src/nnie_manager.cc b/mindspore-lite/providers/nnie/src/nnie_manager.cc index 48ae58f23ff6e70b0bdbac0fe270b5aa957b5eaa..7564be5b508bf5c7cc96d2dd99425fbda1493dc5 100644 --- a/mindspore-lite/providers/nnie/src/nnie_manager.cc +++ b/mindspore-lite/providers/nnie/src/nnie_manager.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace nnie { constexpr int kUINT16_MAX = 65535; constexpr int kNumInput2 = 2; @@ -545,4 +545,4 @@ int NNIEManager::FillData(std::vector *inputs, unsigned int return RET_OK; } } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie/src/nnie_manager.h b/mindspore-lite/providers/nnie/src/nnie_manager.h index b0fdc8ce806ddb564bee6b45a757d0e5620a5f8e..d8b39df5587d522b8b2e7d01db86d157bfee5819 100644 --- a/mindspore-lite/providers/nnie/src/nnie_manager.h +++ b/mindspore-lite/providers/nnie/src/nnie_manager.h @@ -26,7 +26,7 @@ #include "src/nnie_common.h" #include "src/nnie_cfg_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { class NNIEManager { public: @@ -113,5 +113,5 @@ class NNIEManager { std::vector tensors_; }; } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_SRC_NNIE_MANAGER_H_ diff --git a/mindspore-lite/providers/nnie/src/nnie_memory.cc b/mindspore-lite/providers/nnie/src/nnie_memory.cc index 4f80dacf76c52e13788318817c4370fd335a40bb..797fe7f53e2a3bae5597d5b90360046ee98ebc3c 100644 --- a/mindspore-lite/providers/nnie/src/nnie_memory.cc +++ b/mindspore-lite/providers/nnie/src/nnie_memory.cc @@ -18,7 +18,7 @@ #include "include/mpi_sys.h" #include "src/nnie_common.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { HI_S32 NnieMemMalloc(const HI_CHAR *mmb, HI_CHAR *zone, HI_U64 *pu_phy_addr, HI_VOID **ppv_vir_addr, HI_U32 size) { return HI_MPI_SYS_MmzAlloc(pu_phy_addr, ppv_vir_addr, mmb, zone, size); @@ -42,4 +42,4 @@ HI_S32 NnieGetVirMemInfo(HI_U64 pv_vir_addr, HI_U64 *phy_addr) { return ret; } } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie/src/nnie_memory.h b/mindspore-lite/providers/nnie/src/nnie_memory.h index 7c72499a5f2ca3e24bf273fa80e688470fda26ea..1230d678ee4f7cf81b211b314bdc9e2c55248cfd 100644 --- a/mindspore-lite/providers/nnie/src/nnie_memory.h +++ b/mindspore-lite/providers/nnie/src/nnie_memory.h @@ -27,7 +27,7 @@ #include "include/mpi_nnie.h" #include "include/mpi_sys.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { #define NNIE_MEM_FREE(phy, vir) \ do { \ @@ -46,5 +46,5 @@ HI_S32 NnieMemFlushCache(HI_U64 phy_addr, HI_VOID *pv_vir_addr, HI_U32 size); HI_S32 NnieGetVirMemInfo(HI_U64 pv_vir_addr, HI_U64 *phy_addr); } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_SRC_NNIE_MEMORY_H_ diff --git a/mindspore-lite/providers/nnie/src/nnie_print.cc b/mindspore-lite/providers/nnie/src/nnie_print.cc index dc1d2c5b718680107131d6dc3157d7fa3761cd41..435f341e789739b4a7cd081e543caca5c7709788 100644 --- a/mindspore-lite/providers/nnie/src/nnie_print.cc +++ b/mindspore-lite/providers/nnie/src/nnie_print.cc @@ -16,7 +16,7 @@ #include "src/nnie_print.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { HI_S32 NniePrintReportResult(NnieParam *pst_nnie_param) { HI_U32 u32seg_num = pst_nnie_param->model_->u32NetSegNum; @@ -173,4 +173,4 @@ HI_S32 NniePrintReportResultInputSeg(NnieParam *pst_nnie_param, int segnum) { return HI_SUCCESS; } } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie/src/nnie_print.h b/mindspore-lite/providers/nnie/src/nnie_print.h index 389716df7aa349687e3d8dba17cbfc9d86e74c15..d1697ad3d7371ca7d18f890f54b292f6537b1557 100644 --- a/mindspore-lite/providers/nnie/src/nnie_print.h +++ b/mindspore-lite/providers/nnie/src/nnie_print.h @@ -48,11 +48,11 @@ constexpr int kMaxSize = 1024; constexpr int kDecimal = 10; -namespace mindspore { +namespace mindspore::lite { namespace nnie { HI_S32 NniePrintReportResult(NnieParam *pst_nnie_param); HI_S32 NniePrintReportResultInputSeg(NnieParam *pst_nnie_param, int segnum); } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_SRC_NNIE_PRINT_H_ diff --git a/mindspore-lite/providers/nnie_proposal/src/proposal.cc b/mindspore-lite/providers/nnie_proposal/src/proposal.cc index 240558db93433ef4dff8db00ad85f7c6aba8bbec..b0a4ce26bd99a6f28565514c6e620dd229c23bde 100644 --- a/mindspore-lite/providers/nnie_proposal/src/proposal.cc +++ b/mindspore-lite/providers/nnie_proposal/src/proposal.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace proposal { constexpr int kNumInput2 = 2; constexpr int kScoreSizeIndex = 2; @@ -619,4 +619,4 @@ void ProposalDeInit(ProposalParam *param) { } } } // namespace proposal -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie_proposal/src/proposal.h b/mindspore-lite/providers/nnie_proposal/src/proposal.h index 41b23c42ff39ffb9d29723d07c697a6006b5ddc5..920cce1b63ea92837602f2f74c8702ed3ac1caaa 100644 --- a/mindspore-lite/providers/nnie_proposal/src/proposal.h +++ b/mindspore-lite/providers/nnie_proposal/src/proposal.h @@ -36,7 +36,7 @@ } \ } while (0) -namespace mindspore { +namespace mindspore::lite { namespace proposal { typedef struct { uint32_t stride_; @@ -89,5 +89,5 @@ int32_t ProposalInit(ProposalParam *param, uint32_t max_roi_num, uint32_t ori_im int32_t ProposalRun(ProposalParam *param); void ProposalDeInit(ProposalParam *param); } // namespace proposal -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_PROPOSAL_SRC_PROPOSAL_H_ diff --git a/mindspore-lite/providers/nnie_proposal/src/proposal_fp32.cc b/mindspore-lite/providers/nnie_proposal/src/proposal_fp32.cc index c87b5ece7ebeabcf238560dde8a8c7349cea0257..93d910fd9c23f62a0ce129bf32cf4217164e875f 100644 --- a/mindspore-lite/providers/nnie_proposal/src/proposal_fp32.cc +++ b/mindspore-lite/providers/nnie_proposal/src/proposal_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Custom; -namespace mindspore { +namespace mindspore::lite { namespace proposal { constexpr int kMaxSize = 1024; constexpr int kNumInput2 = 2; @@ -224,13 +224,13 @@ std::shared_ptr ProposalCreateKernel(const std::vecto return kernel; } } // namespace proposal -} // namespace mindspore +} // namespace mindspore::lite -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { const auto kFloat32 = DataType::kNumberTypeFloat32; } REGISTER_CUSTOM_KERNEL(CPU, NNIE, kFloat32, Proposal, proposal::ProposalCreateKernel) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie_proposal/src/proposal_fp32.h b/mindspore-lite/providers/nnie_proposal/src/proposal_fp32.h index e46d618e3ce7db840d88e8a3fee3a01b841cddab..5eb5e5be437bd165bbc7a9a29f92565df1690f21 100644 --- a/mindspore-lite/providers/nnie_proposal/src/proposal_fp32.h +++ b/mindspore-lite/providers/nnie_proposal/src/proposal_fp32.h @@ -23,7 +23,7 @@ #include "src/proposal.h" using mindspore::kernel::Kernel; -namespace mindspore { +namespace mindspore::lite { namespace proposal { class ProposalCPUKernel : public Kernel { public: @@ -45,6 +45,6 @@ class ProposalCPUKernel : public Kernel { int64_t image_weight_; }; } // namespace proposal -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_PROPOSAL_SRC_PROPOSAL_FP32_H_ diff --git a/mindspore-lite/providers/nnie_proposal/src/proposal_infer.cc b/mindspore-lite/providers/nnie_proposal/src/proposal_infer.cc index 58e4a6d07712d932fe41a3184488bf493edc8e24..ce23cff95f489f58609c1399fc912ba9eec4692b 100644 --- a/mindspore-lite/providers/nnie_proposal/src/proposal_infer.cc +++ b/mindspore-lite/providers/nnie_proposal/src/proposal_infer.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Custom; -namespace mindspore { +namespace mindspore::lite { namespace proposal { std::shared_ptr ProposalInferCreater() { auto infer = std::make_shared(); @@ -64,9 +64,9 @@ Status ProposalInterface::Infer(std::vector *inputs, std::v return kSuccess; } } // namespace proposal -} // namespace mindspore -namespace mindspore { +} // namespace mindspore::lite +namespace mindspore::lite { namespace kernel { REGISTER_CUSTOM_KERNEL_INTERFACE(NNIE, Proposal, proposal::ProposalInferCreater); } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/providers/nnie_proposal/src/proposal_infer.h b/mindspore-lite/providers/nnie_proposal/src/proposal_infer.h index fe81d8b7cb63dad27cfa466e990311219e69c145..1bd7351a15030a3b2476ec1e0da670c5d00eb60a 100644 --- a/mindspore-lite/providers/nnie_proposal/src/proposal_infer.h +++ b/mindspore-lite/providers/nnie_proposal/src/proposal_infer.h @@ -19,7 +19,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace proposal { class ProposalInterface : public mindspore::kernel::KernelInterface { public: @@ -31,5 +31,5 @@ class ProposalInterface : public mindspore::kernel::KernelInterface { const mindspore::schema::Primitive *primitive) override; }; } // namespace proposal -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_PROVIDERS_NNIE_PROPOSAL_SRC_PROPOSAL_INFER_H_ diff --git a/mindspore-lite/python/src/tensor_numpy_impl.h b/mindspore-lite/python/src/tensor_numpy_impl.h index f1a6b7f26e82bd82024434cf6a0b8eb30f400b35..5dacc097f0117067f092d46a9d69c5c15cec9a6e 100644 --- a/mindspore-lite/python/src/tensor_numpy_impl.h +++ b/mindspore-lite/python/src/tensor_numpy_impl.h @@ -33,7 +33,7 @@ #endif namespace py = pybind11; -namespace mindspore { +namespace mindspore::lite { class TensorNumpyImpl : public MutableTensorImpl { public: TensorNumpyImpl(const std::string &name, py::buffer_info &&buffer, const std::vector &ms_shape) @@ -176,6 +176,6 @@ class TensorNumpyImpl : public MutableTensorImpl { std::string device_ = ""; int device_id_ = -1; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_UTILS_TENSOR_NUMPY_IMPL_H_ diff --git a/mindspore-lite/src/common/config_infos.cc b/mindspore-lite/src/common/config_infos.cc index a8c679461a41a495b1a399ad379d3b29efca9861..391d45a03f0ec4c21c56f61291dcc060eaa2640a 100644 --- a/mindspore-lite/src/common/config_infos.cc +++ b/mindspore-lite/src/common/config_infos.cc @@ -21,7 +21,7 @@ #include "src/common/common.h" #include "src/common/utils.h" -namespace mindspore { +namespace mindspore::lite { bool ProfileParser::ParseRangeStr(const std::string &range_str, int64_t *min_ptr, int64_t *max_ptr) { if (min_ptr == nullptr || max_ptr == nullptr) { return false; @@ -327,4 +327,4 @@ std::string ProfileParser::GetOption(const std::map &c } return it->second; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/common/config_infos.h b/mindspore-lite/src/common/config_infos.h index a5c4996d86d024703d4825f2971355273c61de12..5a24608618da1b89d3628719badaaacebc6688ee 100644 --- a/mindspore-lite/src/common/config_infos.h +++ b/mindspore-lite/src/common/config_infos.h @@ -23,7 +23,7 @@ #include "include/api/visible.h" #include "mindapi/base/shape_vector.h" -namespace mindspore { +namespace mindspore::lite { using ConfigInfos = std::map>; struct ProfileInputInfo { @@ -65,6 +65,6 @@ class MS_API ProfileParser { static bool ParseOptDimStr(const std::string &opt_dim_str, int64_t *opt_ptr); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_COMMON_CONFIG_INFOS_H_ diff --git a/mindspore-lite/src/common/log.cc b/mindspore-lite/src/common/log.cc index 962027536d9594b48105ca672afd8f2afc0edc56..5f950111f3dde6948df7dd13c573511d1f650285 100644 --- a/mindspore-lite/src/common/log.cc +++ b/mindspore-lite/src/common/log.cc @@ -22,7 +22,7 @@ #endif // namespace to support utils module definition namespace mindspore constexpr const char *ANDROID_LOG_TAG = "MS_LITE"; -namespace mindspore { +namespace mindspore::lite { #if defined(__ANDROID__) constexpr const char *ANDROID_LOG_TAG = "MS_LITE"; #endif @@ -120,4 +120,4 @@ void LiteLogWriter::operator<(const LiteLogStream &stream) const noexcept { msg << stream.sstream_->rdbuf(); OutputLog(msg); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/common/log.h b/mindspore-lite/src/common/log.h index 5dae9ab8b2cead45a594384e822ec3945524871c..2460eaee6bf582187dc35451042e7935893de1bc 100644 --- a/mindspore-lite/src/common/log.h +++ b/mindspore-lite/src/common/log.h @@ -40,7 +40,7 @@ static constexpr size_t GetRealPathPos() noexcept { : 0; } -namespace mindspore { +namespace mindspore::lite { #define LITE_FILE_NAME \ (sizeof(__FILE__) > GetRealPathPos() ? static_cast(__FILE__) + GetRealPathPos() \ : static_cast(__FILE__)) @@ -150,7 +150,7 @@ class LiteLogWriter { #define MS_LOG_INFO MSLOG_IF(mindspore::LiteLogLevel::INFO) #define MS_LOG_WARNING MSLOG_IF(mindspore::LiteLogLevel::WARNING) #define MS_LOG_ERROR MSLOG_IF(mindspore::LiteLogLevel::ERROR) -} // namespace mindspore +} // namespace mindspore::lite #ifdef Debug #include diff --git a/mindspore-lite/src/common/log_adapter.h b/mindspore-lite/src/common/log_adapter.h index 39bb69c206a5b5bdf319e3474b543c02adffddf1..a0727a9f06a40e2b1865dcfda4143b53de9a30fb 100644 --- a/mindspore-lite/src/common/log_adapter.h +++ b/mindspore-lite/src/common/log_adapter.h @@ -23,7 +23,7 @@ #endif // USE_GLOG #include "src/common/log_util.h" -namespace mindspore { +namespace mindspore::lite { const char *const unsupport_string_tensor_log = "This mindspore-lite library does not support string tensors. Set environment variable MSLITE_ENABLE_STRING_KERNEL " "to on to " @@ -60,6 +60,6 @@ static inline bool IsPrintDebug() { auto env = std::getenv("GLOG_v"); return env != nullptr && env[0] == '0'; } -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_COMMON_LOG_ADAPTER_H_ diff --git a/mindspore-lite/src/common/mutable_tensor_impl.h b/mindspore-lite/src/common/mutable_tensor_impl.h index d782b5b46f8ba50134be2baacb3d5aa63fc448b2..64b6c75d1d5a4cc63a9588c7ad9bdc91723cd072 100644 --- a/mindspore-lite/src/common/mutable_tensor_impl.h +++ b/mindspore-lite/src/common/mutable_tensor_impl.h @@ -22,7 +22,7 @@ #include #include "ir/api_tensor_impl.h" -namespace mindspore { +namespace mindspore::lite { class MutableTensorImpl : public MSTensor::Impl { public: virtual void SetName(const std::string &name) = 0; @@ -66,5 +66,5 @@ class MutableTensorImpl : public MSTensor::Impl { } }; using MutableTensorImplPtr = std::shared_ptr; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_COMMON_MUTABLE_TESNOR_IMPL_H_ diff --git a/mindspore-lite/src/control_flow/kernel/entrance_subgraph_kernel.cc b/mindspore-lite/src/control_flow/kernel/entrance_subgraph_kernel.cc index 6063ad961fc0a5287ce8fa663c62af92f8f15b0e..690f6015b644b02b1ec7c4a74abd840d0cbbf310 100644 --- a/mindspore-lite/src/control_flow/kernel/entrance_subgraph_kernel.cc +++ b/mindspore-lite/src/control_flow/kernel/entrance_subgraph_kernel.cc @@ -17,7 +17,7 @@ #include "src/control_flow/kernel/entrance_subgraph_kernel.h" #include "src/tensor.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int EntranceSubGraphKernel::Execute(const KernelCallBack &, const KernelCallBack &) { return lite::RET_OK; } SubGraphKernel *EntranceSubGraphKernel::Create(MSKernel *kernel) { @@ -27,4 +27,4 @@ SubGraphKernel *EntranceSubGraphKernel::Create(MSKernel *kernel) { } return sub_kernel; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/control_flow/kernel/entrance_subgraph_kernel.h b/mindspore-lite/src/control_flow/kernel/entrance_subgraph_kernel.h index f0804e2afb29ed87b17f06bbb96b565e42a9b2a5..a19a361479e724ff7d0f08717c389e372672fcbc 100644 --- a/mindspore-lite/src/control_flow/kernel/entrance_subgraph_kernel.h +++ b/mindspore-lite/src/control_flow/kernel/entrance_subgraph_kernel.h @@ -29,7 +29,7 @@ #include "src/litert/cpu_info.h" #include "src/executor/sub_graph_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class EntranceSubGraphKernel : public SubGraphKernel { public: explicit EntranceSubGraphKernel(MSKernel *kernel) : SubGraphKernel({}, {}, {}, kernel) { @@ -48,5 +48,5 @@ class EntranceSubGraphKernel : public SubGraphKernel { int ReSize() override { return RET_OK; }; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_CONTROL_FLOW_KERNEL_ENTRANCE_SUBGRAPH_KERNEL_H_ diff --git a/mindspore-lite/src/control_flow/kernel/exit_subgraph_kernel.cc b/mindspore-lite/src/control_flow/kernel/exit_subgraph_kernel.cc index d8718153f31767578ea210961bfe136607356bb7..0f47b41621dac1f5428ca2437074b41d9a86b9e2 100644 --- a/mindspore-lite/src/control_flow/kernel/exit_subgraph_kernel.cc +++ b/mindspore-lite/src/control_flow/kernel/exit_subgraph_kernel.cc @@ -17,7 +17,7 @@ #include "src/control_flow/kernel/exit_subgraph_kernel.h" #include "src/tensor.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ExitSubGraphKernel::Execute(const KernelCallBack &, const KernelCallBack &) { return lite::RET_OK; } SubGraphKernel *ExitSubGraphKernel::Create(MSKernel *kernel) { @@ -29,4 +29,4 @@ SubGraphKernel *ExitSubGraphKernel::Create(MSKernel *kernel) { } void ExitSubGraphKernel::SetPartial(kernel::KernelExec *partial_node) { (void)partials_.insert(partial_node); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/control_flow/kernel/exit_subgraph_kernel.h b/mindspore-lite/src/control_flow/kernel/exit_subgraph_kernel.h index a3fb7464741b8bfce133f47c7bf35dad20bd4620..029c9a94cb92fb0898271754f2ea83ece532e911 100644 --- a/mindspore-lite/src/control_flow/kernel/exit_subgraph_kernel.h +++ b/mindspore-lite/src/control_flow/kernel/exit_subgraph_kernel.h @@ -30,7 +30,7 @@ #include "src/litert/cpu_info.h" #include "src/executor/sub_graph_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ExitSubGraphKernel : public SubGraphKernel { public: explicit ExitSubGraphKernel(MSKernel *kernel) : SubGraphKernel({}, {}, {}, kernel) { subgraph_type_ = kExitSubGraph; } @@ -55,5 +55,5 @@ class ExitSubGraphKernel : public SubGraphKernel { int schema_version_ = lite::SCHEMA_VERSION::SCHEMA_CUR; std::set partials_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_CONTROL_FLOW_KERNEL_EXIT_SUBGRAPH_KERNEL_H_ diff --git a/mindspore-lite/src/control_flow/kernel/identity_kernel.cc b/mindspore-lite/src/control_flow/kernel/identity_kernel.cc index 8c372adf75e99200bb83c0a08d2dac61ecb19018..04d8bc2b6675ad2f467571f4cce5d7f20900f2b8 100644 --- a/mindspore-lite/src/control_flow/kernel/identity_kernel.cc +++ b/mindspore-lite/src/control_flow/kernel/identity_kernel.cc @@ -20,7 +20,7 @@ #include "src/common/tensor_util.h" #include "src/common/prim_inner.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int IdentityKernel::Run() { auto ret = lite::RET_OK; for (size_t i = 0; i < in_tensors().size(); ++i) { @@ -108,4 +108,4 @@ KernelExec *IdentityKernel::Create(std::vector in_tensors, std:: return nullptr; } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/control_flow/kernel/identity_kernel.h b/mindspore-lite/src/control_flow/kernel/identity_kernel.h index 7f4ae0278bce17c48e172b79473a6b4b6369e0cf..2c077965f2776a4514dffb623c6097a189a6746e 100644 --- a/mindspore-lite/src/control_flow/kernel/identity_kernel.h +++ b/mindspore-lite/src/control_flow/kernel/identity_kernel.h @@ -30,7 +30,7 @@ #include "src/litert/cpu_info.h" #include "src/executor/sub_graph_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { // Identity kernel is used to update a reference to a tensor. This is useful in control flow model. class IdentityKernel : public LiteKernel { public: @@ -57,5 +57,5 @@ class IdentityKernel : public LiteKernel { std::vector need_resize_{}; bool support_fp16_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_CONTROL_FLOW_KERNEL_IDENTITY_KERNEL_H_ diff --git a/mindspore-lite/src/executor/kernel_exec.cc b/mindspore-lite/src/executor/kernel_exec.cc index 4efe7046608cdbefad329f0028d7555af3b56f38..f0c4fdd573d7538ca18240b964f833c7c49616d2 100644 --- a/mindspore-lite/src/executor/kernel_exec.cc +++ b/mindspore-lite/src/executor/kernel_exec.cc @@ -20,7 +20,7 @@ #include "src/common/utils.h" #include "src/common/version_manager.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; @@ -90,4 +90,4 @@ int KernelExec::DoExecute() { } return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/executor/sub_graph_kernel.cc b/mindspore-lite/src/executor/sub_graph_kernel.cc index 5a0ad96c28c9812e85ce72f18b0e472ae5b62ee3..535a3d7f3cbc83b8663935584307538fab77e985 100644 --- a/mindspore-lite/src/executor/sub_graph_kernel.cc +++ b/mindspore-lite/src/executor/sub_graph_kernel.cc @@ -29,7 +29,7 @@ #include "src/common/utils.h" #include "src/litert/kernel_exec_util.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using mindspore::lite::RET_ERROR; using mindspore::lite::RET_INFER_ERR; using mindspore::lite::RET_INFER_INVALID; @@ -645,4 +645,4 @@ int AclSubGraph::Execute(const KernelCallBack &before, const KernelCallBack &aft } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/executor/sub_graph_kernel.h b/mindspore-lite/src/executor/sub_graph_kernel.h index 8f84a021eba793c2e1423d2f85a64752e56e15d5..a3b7da91e68baf82d16d52e93f2663ff4a4a9f13 100644 --- a/mindspore-lite/src/executor/sub_graph_kernel.h +++ b/mindspore-lite/src/executor/sub_graph_kernel.h @@ -32,7 +32,7 @@ #include "nnacl_c/constant_of_shape_parameter.h" #endif -namespace mindspore::kernel { +namespace mindspore::lite::kernel { // store origin data and allocator of input tensor of subgraph for PreProcess and PostProcess struct DataStore { void *data_ = nullptr; @@ -310,5 +310,5 @@ class AclSubGraph : public SubGraphKernel { int Execute() override { return Execute(nullptr, nullptr); } int Execute(const KernelCallBack &before, const KernelCallBack &after) override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_SUB_GRAPH_KERNEL_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/cell.cc b/mindspore-lite/src/extendrt/cxx_api/cell.cc index 18927cd1ba20cfc975c6d71dcac1ca5da6003a18..b85712f3c1e63cbc7552ec6a8a86d57a78906189 100644 --- a/mindspore-lite/src/extendrt/cxx_api/cell.cc +++ b/mindspore-lite/src/extendrt/cxx_api/cell.cc @@ -17,7 +17,7 @@ #include "include/api/cell.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { std::vector CellBase::operator()(const std::vector &inputs) const { std::vector empty; MS_LOG(ERROR) << "Unsupported feature."; @@ -58,4 +58,4 @@ InputAndOutput::InputAndOutput(const std::shared_ptr &cell, const std: int32_t index) { MS_LOG(ERROR) << "Unsupported feature."; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/context.cc b/mindspore-lite/src/extendrt/cxx_api/context.cc index af4d2a05eda70f481065b8316971aae977a03d8b..6a4dd42f33b61fa94d16cbffbc150c0382be30fd 100644 --- a/mindspore-lite/src/extendrt/cxx_api/context.cc +++ b/mindspore-lite/src/extendrt/cxx_api/context.cc @@ -23,7 +23,7 @@ #include "src/common/log_adapter.h" #include "src/extendrt/delegate_graph_executor.h" -namespace mindspore { +namespace mindspore::lite { constexpr auto kModelOptionCpuEnableFP16 = "mindspore.option.cpu.enable_fp16"; constexpr auto kModelOptionGPUEnableFP16 = "mindspore.option.gpu.enable_fp16"; constexpr auto kModelOptionNPUEnableFP16 = "mindspore.option.npu.enable_fp16"; @@ -539,4 +539,4 @@ int KirinNPUDeviceInfo::GetFrequency() const { MS_LOG(ERROR) << "Unsupported Feature."; return 0; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/context.h b/mindspore-lite/src/extendrt/cxx_api/context.h index aee463b9878e5bbef67ec8dea0d2a54f94d49fe5..85c2e38b460b5acac1dd7caac361f544678e1eb5 100644 --- a/mindspore-lite/src/extendrt/cxx_api/context.h +++ b/mindspore-lite/src/extendrt/cxx_api/context.h @@ -29,7 +29,7 @@ #include "include/api/context.h" #include "include/api/delegate_api.h" -namespace mindspore { +namespace mindspore::lite { struct Context::Data { std::vector> device_info_list; int affinity_mode_ = 0; @@ -47,6 +47,6 @@ struct DeviceInfoContext::Data { #endif std::shared_ptr allocator = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_CONTEXT_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/dlutils.h b/mindspore-lite/src/extendrt/cxx_api/dlutils.h index dd495936efd49b1ada0310aa472f81d803c95b89..584190cd2889ed365b48acfee5a1a202febe6b14 100644 --- a/mindspore-lite/src/extendrt/cxx_api/dlutils.h +++ b/mindspore-lite/src/extendrt/cxx_api/dlutils.h @@ -26,7 +26,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { inline std::string FindFileWithRecursion(const std::string &parent_dir, const std::string &target_so, int depth = 0) { constexpr int MAX_RECURSION_DEPTH = 5; if (depth == MAX_RECURSION_DEPTH) { @@ -183,7 +183,7 @@ inline void DLSoClose(void *handle) { return __rc; \ } \ } while (false) -} // namespace mindspore +} // namespace mindspore::lite #else inline mindspore::Status FindSoPath(const std::string &benchmark_so_path, const std::string &target_so, std::string *target_so_path) { diff --git a/mindspore-lite/src/extendrt/cxx_api/file_utils.h b/mindspore-lite/src/extendrt/cxx_api/file_utils.h index e827cb649ffc70eabe96cb9b9376177f3b7b2732..3593450b575f65dd37440a27b1335693f1f2b818 100644 --- a/mindspore-lite/src/extendrt/cxx_api/file_utils.h +++ b/mindspore-lite/src/extendrt/cxx_api/file_utils.h @@ -20,8 +20,8 @@ #include #include "include/api/types.h" -namespace mindspore { +namespace mindspore::lite { Buffer ReadFile(const std::string &file); std::vector ReadFileNames(const std::string &dir); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_FILE_UTILS_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/graph/graph.cc b/mindspore-lite/src/extendrt/cxx_api/graph/graph.cc index e6c335001e1d21e53615b5690d758c225274ed39..c4cd18b40b0e07fa2275f0099d4e008aff60f9a7 100644 --- a/mindspore-lite/src/extendrt/cxx_api/graph/graph.cc +++ b/mindspore-lite/src/extendrt/cxx_api/graph/graph.cc @@ -17,7 +17,7 @@ #include "extendrt/cxx_api/graph/graph_data.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { Graph::Graph() : graph_data_(nullptr) {} Graph::Graph(const std::shared_ptr &graph_data) : graph_data_(graph_data) {} @@ -36,4 +36,4 @@ ModelType Graph::ModelType() const { MS_EXCEPTION_IF_NULL(graph_data_); return graph_data_->ModelType(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/graph/graph_data.cc b/mindspore-lite/src/extendrt/cxx_api/graph/graph_data.cc index f3d1cffe59164022aad886c4a883b5c73a4b22c6..e9a6880dbebb105b76ae354d992e36b66ef742b6 100644 --- a/mindspore-lite/src/extendrt/cxx_api/graph/graph_data.cc +++ b/mindspore-lite/src/extendrt/cxx_api/graph/graph_data.cc @@ -16,7 +16,7 @@ #include "extendrt/cxx_api/graph/graph_data.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { Graph::GraphData::GraphData(const FuncGraphPtr &func_graph, mindspore::ModelType model_type) : func_graph_(nullptr), om_data_(), model_type_(ModelType::kUnknownType), data_graph_({}) { if (model_type != ModelType::kMindIR) { @@ -57,4 +57,4 @@ Buffer Graph::GraphData::GetOMData() const { void Graph::GraphData::SetPreprocess(const std::vector> &data_graph) { data_graph_ = data_graph; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/graph/graph_data.h b/mindspore-lite/src/extendrt/cxx_api/graph/graph_data.h index 1b0ad53a6469721938bf1a372d5b328798a0b3b1..bc162084009ef2401583913d9487a5d33d944456 100644 --- a/mindspore-lite/src/extendrt/cxx_api/graph/graph_data.h +++ b/mindspore-lite/src/extendrt/cxx_api/graph/graph_data.h @@ -23,7 +23,7 @@ #include "include/api/types.h" #include "ir/func_graph.h" -namespace mindspore { +namespace mindspore::lite { namespace dataset { class Execute; } @@ -53,5 +53,5 @@ class Graph::GraphData { enum ModelType model_type_; std::vector> data_graph_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_GRAPH_GRAPH_DATA_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/graph/graph_impl.h b/mindspore-lite/src/extendrt/cxx_api/graph/graph_impl.h index f310e017ef81e3be5821559c81e7d48d7ec8eda9..21c82f778e0ff3b114fa1bb223f37a5ca21d6c25 100644 --- a/mindspore-lite/src/extendrt/cxx_api/graph/graph_impl.h +++ b/mindspore-lite/src/extendrt/cxx_api/graph/graph_impl.h @@ -26,7 +26,7 @@ #include "extendrt/cxx_api/graph/graph_data.h" #include "include/common/utils/utils.h" -namespace mindspore { +namespace mindspore::lite { class GraphCell::GraphImpl { public: GraphImpl() : graph_(nullptr), graph_context_(nullptr) {} @@ -48,5 +48,5 @@ class GraphCell::GraphImpl { std::shared_ptr graph_; std::shared_ptr graph_context_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_GRAPH_GRAPH_IMPL_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/model/model.cc b/mindspore-lite/src/extendrt/cxx_api/model/model.cc index f75089724ddec75c5ca050c443940d527a053aec..cb92ac4618be9ea221ee06a035e30716bc49dfb8 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/model.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model/model.cc @@ -23,7 +23,7 @@ #include "src/common/file_utils.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace { #ifdef USE_GLOG extern "C" { @@ -500,4 +500,4 @@ Status Model::Finalize() { } return impl_->Finalize(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model/model_group.cc b/mindspore-lite/src/extendrt/cxx_api/model/model_group.cc index b6e5d7bcc892b083660463d0d08a5bea5eb8e4de..3c3a1a42f6189f354e6ed9b994d2d018c9483b48 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/model_group.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model/model_group.cc @@ -22,7 +22,7 @@ #include "src/extendrt/cxx_api/model/model_group_impl.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { ModelGroup::ModelGroup(ModelGroupFlag flags) { impl_ = std::make_shared(flags); if (impl_ == nullptr) { @@ -64,4 +64,4 @@ Status ModelGroup::CalMaxSizeOfWorkspace(ModelType model_type, const std::shared } return impl_->CalMaxSizeOfWorkspace(model_type, ms_context); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model/model_group_impl.cc b/mindspore-lite/src/extendrt/cxx_api/model/model_group_impl.cc index e6082156c0ef1022f005c78fb92ced686f1a2f47..7868bc3ff8765081629e0885b1b25bf43d7b72fe 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/model_group_impl.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model/model_group_impl.cc @@ -26,7 +26,7 @@ #include "extendrt/cxx_api/model/model_impl.h" #include "src/common/common.h" -namespace mindspore { +namespace mindspore::lite { ModelGroupImpl::ModelGroupImpl(ModelGroupFlag flags) : flags_(flags) { static uint32_t g_model_group_id = 0; model_group_id_ = ++g_model_group_id; @@ -132,4 +132,4 @@ Status ModelGroupImpl::CalMaxSizeOfWorkspace(ModelType model_type, const std::sh } return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model/model_group_impl.h b/mindspore-lite/src/extendrt/cxx_api/model/model_group_impl.h index 94e86c9c5efa8f19f14bf28ab55b71bc50bfd886..92b61f32b0b10f08fde291a6ffcffcb240c533cb 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/model_group_impl.h +++ b/mindspore-lite/src/extendrt/cxx_api/model/model_group_impl.h @@ -28,7 +28,7 @@ #include "include/api/model_group.h" #include "include/api/context.h" -namespace mindspore { +namespace mindspore::lite { class ModelGroupImpl { public: explicit ModelGroupImpl(ModelGroupFlag flags); @@ -48,6 +48,6 @@ class ModelGroupImpl { ModelGroupFlag flags_; uint32_t model_group_id_ = 0; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_MODEL_MODEL_GROUP_IMPL_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/model/model_impl.cc b/mindspore-lite/src/extendrt/cxx_api/model/model_impl.cc index a8c6a2d140a476545faee5feb19c903522f667a8..14597f29ef1434f56c8e266777a7e9333d7e296a 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/model_impl.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model/model_impl.cc @@ -48,7 +48,7 @@ #include "src/common/common.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { const char *const kExecutionPlan = "execution_plan"; constexpr size_t kMaxSectionNum = 100; @@ -1044,4 +1044,4 @@ Status ModelImpl::Finalize() { } return session_->Finalize(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model/model_impl.h b/mindspore-lite/src/extendrt/cxx_api/model/model_impl.h index 86c56d957fa94cfd4601dc56bcbe0c21836c84eb..3e33d7764eeab9362e95941b7fc518fcbce994a5 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/model_impl.h +++ b/mindspore-lite/src/extendrt/cxx_api/model/model_impl.h @@ -37,7 +37,7 @@ #ifndef _WIN32 #include #endif -namespace mindspore { +namespace mindspore::lite { class ConverterPlugin { public: typedef int (*ConverterFunc)(const mindspore::api::FuncGraphPtr &, const std::shared_ptr &, @@ -289,5 +289,5 @@ class ModelImpl { uint32_t graph_id_ = 0; std::map model_info_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_MODEL_MODEL_IMPL_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/model/multi_model_runner.cc b/mindspore-lite/src/extendrt/cxx_api/model/multi_model_runner.cc index 2e5cbcaab9af61a4a664be303b020a5e67e292fa..90b964b112258ddf5b69533dc4cb35d82b99bacf 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/multi_model_runner.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model/multi_model_runner.cc @@ -25,7 +25,7 @@ #include "mindspore/core/include/ir/graph_utils.h" #include "include/api/types.h" #include "src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h" -namespace mindspore { +namespace mindspore::lite { namespace { std::mutex g_load_mindir_lock; std::mutex g_config_lock; @@ -397,4 +397,4 @@ std::vector ModelExecutor::GetOutputs() const { } return exec_outputs; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner.cc b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner.cc index 931736d06b4e282e81e6e320a4529b147e23cf9d..26631b8bac37197212c08dd420f774316247d0f6 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner.cc @@ -20,7 +20,7 @@ #ifdef CAPTURE_SIGNALS #include "src/extendrt/signal_handler.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace { constexpr size_t kMaxSectionNum = 100; constexpr size_t kMaxConfigNumPerSection = 1000; @@ -197,4 +197,4 @@ Status ModelParallelRunner::Predict(const std::vector &inputs, std::ve } return model_parallel_runner_impl_->Predict(inputs, outputs, before, after); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner_impl.cc b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner_impl.cc index 4fcdace8b48b11175e0bc6be7257d4bfce75bdad..0784bf0b2c05e7f16463b917edcfd4cdac041f50 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner_impl.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner_impl.cc @@ -21,7 +21,7 @@ #ifdef CAPTURE_SIGNALS #include "src/extendrt/signal_handler.h" #endif -namespace mindspore { +namespace mindspore::lite { Status ModelParallelRunnerImpl::Init(const std::string &model_path, const std::shared_ptr &runner_config) { std::unique_lock l(model_parallel_runner_impl_mutex_); @@ -118,4 +118,4 @@ ModelParallelRunnerImpl::~ModelParallelRunnerImpl() { } MS_LOG(INFO) << "delete model pool done."; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner_impl.h b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner_impl.h index 7bb53b2d4e40c13a11149e1da5ef049308c8f286..3f4bad0d4423b83154dc0ad130b8b4c9f3762535 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner_impl.h +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_parallel_runner_impl.h @@ -22,7 +22,7 @@ #include #include "src/extendrt/cxx_api/model_pool/model_pool.h" #include "include/api/context.h" -namespace mindspore { +namespace mindspore::lite { class ModelParallelRunnerImpl { public: ModelParallelRunnerImpl() = default; @@ -43,5 +43,5 @@ class ModelParallelRunnerImpl { ModelPool *model_pool_ = nullptr; std::shared_mutex model_parallel_runner_impl_mutex_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_MODEL_POOL_MODEL_PARALLEL_RUNNER_IMPL_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.cc b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.cc index cde73b54676abc1390a940e7aea0c9745ea96663..5ece473129a19ec0e19f698b43310dfc10170859 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.cc @@ -31,7 +31,7 @@ #include "thread/parallel_thread_pool_manager.h" #endif #include "src/common/config_file.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kNumDeviceInfo = 2; constexpr int kNumIndex = 2; @@ -1229,4 +1229,4 @@ Status ModelPool::ParseDeviceIds(const std::shared_ptr &runner_con } return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.h b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.h index fe1374e6430e65d99d587f3cf2f104080756bcf0..0170a1bb8aeedf709f40e355d34678d796971747 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.h +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.h @@ -30,7 +30,7 @@ #include "include/api/model_parallel_runner.h" #include "src/extendrt/cxx_api/model_pool/model_worker.h" #include "src/extendrt/cxx_api/model_pool/predict_task_queue.h" -namespace mindspore { +namespace mindspore::lite { using ModelPoolConfig = std::vector>; struct TensorInfo { @@ -175,5 +175,5 @@ class ModelPool { std::shared_ptr allocator_ = nullptr; std::vector threads_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_MODEL_POOL_MODEL_POOL_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_worker.cc b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_worker.cc index abed1765c0b9a95c2474fc9358adbbddb7e82e84..ab2ccac5e722080093f408c6083b76ffa56d3f5e 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_worker.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_worker.cc @@ -19,7 +19,7 @@ #include "src/extendrt/numa_adapter.h" #include "src/common/common.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { void ModelWorker::PrintWorkerInfo() { MS_LOG(ERROR) << "worker id: " << worker_config_->worker_id << " | bind core mode: " << worker_config_->context->GetThreadAffinityMode() @@ -275,4 +275,4 @@ Status ModelWorker::Predict(const std::vector &inputs, std::vectorActiveTaskQueue(); return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_worker.h b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_worker.h index be9ad0fad32f01328f996cc5b43bfeeff097bf27..24d0b2cfdb9fe0c2851a2ad5bdf9c4287e340806 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_worker.h +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_worker.h @@ -26,7 +26,7 @@ #include #include "include/api/model.h" #include "src/extendrt/cxx_api/model_pool/predict_task_queue.h" -namespace mindspore { +namespace mindspore::lite { class PredictTaskQueue; struct WorkerConfig { @@ -92,5 +92,5 @@ class ModelWorker { bool model_is_nullptr_ = false; int worker_id_ = -1; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_MODEL_POOL_MODEL_WORKER_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/predict_task_queue.cc b/mindspore-lite/src/extendrt/cxx_api/model_pool/predict_task_queue.cc index 2205b7ac5b9d3e339316e6fd0b33cffb7a55affd..3abfd9ac1f6e7d683a687441880e6433e1de89cf 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/predict_task_queue.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/predict_task_queue.cc @@ -16,7 +16,7 @@ #include "src/extendrt/cxx_api/model_pool/predict_task_queue.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { PredictTaskQueue::~PredictTaskQueue() { MS_LOG(INFO) << "free predict task queue."; if (predict_task_ != nullptr) { @@ -133,4 +133,4 @@ PredictTask *PredictTaskQueue::GetPredictTask(int node_id, ModelWorker *worker) return predict_task; #endif } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/predict_task_queue.h b/mindspore-lite/src/extendrt/cxx_api/model_pool/predict_task_queue.h index 26fd61d66339d5759776f5648b38f72f7b7e15f5..811063196f336d9498c4577d2e04f562b3c8a4a4 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/predict_task_queue.h +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/predict_task_queue.h @@ -28,7 +28,7 @@ #ifndef USE_HQUEUE #define USE_HQUEUE #endif -namespace mindspore { +namespace mindspore::lite { class ModelWorker; struct PredictTask { PredictTask(const std::vector *in = nullptr, std::vector *out = nullptr, @@ -75,5 +75,5 @@ class PredictTaskQueue { std::condition_variable task_push_cond_; bool predict_task_done_ = false; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_MODEL_POOL_PREDICT_TASK_QUEUE_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/resource_manager.cc b/mindspore-lite/src/extendrt/cxx_api/model_pool/resource_manager.cc index a22224fdae58a9ef1766ed26a70b2ac152b63ccc..d79948b3061c4bd12c393acfbcb696805cddd517 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/resource_manager.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/resource_manager.cc @@ -27,7 +27,7 @@ namespace { constexpr int kNumIndex = 2; } -namespace mindspore { +namespace mindspore::lite { ResourceManager *ResourceManager::GetInstance() { static ResourceManager instance; return &instance; @@ -309,4 +309,4 @@ InitWorkerManager::~InitWorkerManager() { } MS_LOG(INFO) << "~InitWorkerManager() end."; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/resource_manager.h b/mindspore-lite/src/extendrt/cxx_api/model_pool/resource_manager.h index 3ddde36a83f27098d59e1d999e89fc6e0b28b4d2..f63c23ae9bc99df0d562833db974b8c33755b169 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/resource_manager.h +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/resource_manager.h @@ -25,7 +25,7 @@ #include "src/common/log_adapter.h" #include "include/api/status.h" #include "src/extendrt/cxx_api/model_pool/model_worker.h" -namespace mindspore { +namespace mindspore::lite { class ResourceManager { public: static ResourceManager *GetInstance(); @@ -101,5 +101,5 @@ class InitWorkerManager { // numa id <=> reuse worker init thread std::unordered_map>> all_init_worker_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_MODEL_POOL_RESOURCE_MANAGER_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/runner_config.h b/mindspore-lite/src/extendrt/cxx_api/model_pool/runner_config.h index beaeaf5d00d007cbc68eb17b96a60d37014d5a0f..80f7b2768d3527615722bcb98963f8c46c63451c 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/runner_config.h +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/runner_config.h @@ -20,7 +20,7 @@ #include #include #include "include/api/model_parallel_runner.h" -namespace mindspore { +namespace mindspore::lite { struct RunnerConfig::Data { int workers_num = 0; std::shared_ptr context = nullptr; @@ -28,5 +28,5 @@ struct RunnerConfig::Data { std::string config_path = ""; std::vector device_ids; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_MODEL_POOL_RUNNER_CONFIG_H_ diff --git a/mindspore-lite/src/extendrt/cxx_api/serialization.cc b/mindspore-lite/src/extendrt/cxx_api/serialization.cc index d436d72699013c07792d8886fbc807dcefdc7fd3..09b017bf0fd8817401b60fa37a4f79261b6bb2a0 100644 --- a/mindspore-lite/src/extendrt/cxx_api/serialization.cc +++ b/mindspore-lite/src/extendrt/cxx_api/serialization.cc @@ -26,7 +26,7 @@ #include "extendrt/cxx_api/file_utils.h" #include "src/common/crypto.h" -namespace mindspore { +namespace mindspore::lite { static Status RealPath(const std::string &file, std::string *realpath_str) { MS_EXCEPTION_IF_NULL(realpath_str); char real_path_mem[PATH_MAX] = {0}; @@ -377,4 +377,4 @@ Status Serialization::ExportWeightsCollaborateWithMicro(const Model &, ModelType MS_LOG(ERROR) << "Unsupported feature."; return kMEFailed; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_allocator.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_allocator.cc index 0486ffc7e7b26486ed85f39a6ef068a7101099c2..221ebf0a74790bbd6801bd018e806ccc7b6aecbf 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_allocator.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_allocator.cc @@ -22,7 +22,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_symbol.h" #include "extendrt/delegate/ascend_acl/acl_env_guard.h" -namespace mindspore { +namespace mindspore::lite { AclAllocator *CreateAclAllocator() { MS_LOG(INFO) << "LoadAscendApiSymbols for MindSpore lite."; device::ascend::LoadAscendApiSymbols(); @@ -301,4 +301,4 @@ Status AclAllocator::Finalize() { } return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_allocator.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_allocator.h index 7417b0e24ae7005b12043292c87a282e8d91f83a..6bc7c426ad8652596e0613dcb64decf70e9e2ebf 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_allocator.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_allocator.h @@ -24,7 +24,7 @@ #include "include/api/status.h" #include "src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h" -namespace mindspore { +namespace mindspore::lite { class AclAllocator : public AscendAllocatorPluginImpl { public: AclAllocator() = default; @@ -58,5 +58,5 @@ class AclAllocator : public AscendAllocatorPluginImpl { extern "C" MS_API AclAllocator *CreateAclAllocator(); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_KERNEL_ASCEND_ACL_ALLOCATOR_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.cc index a4633d7ca3e4a68b25b4e2d98c664fe75dfd5b56..c4da0979977f35bea9f9eb111e849b3ea77b8dbf 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.cc @@ -20,7 +20,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" #include "plugin/ascend/res_manager/symbol_interface/acl_rt_symbol.h" -namespace mindspore { +namespace mindspore::lite { std::shared_ptr AclEnvGuard::global_acl_env_ = nullptr; std::vector> AclEnvGuard::model_infers_ = {}; std::mutex AclEnvGuard::global_acl_env_mutex_; @@ -208,4 +208,4 @@ int32_t AclEnvGuard::GetModelNum() { return model_infers_.size(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.h index 3de39b3dc0e1110e6968d379153ad8b8e6d8ba7e..31cc2d5afe9277e2c220d974f8fdd3f01ba6975a 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.h @@ -23,7 +23,7 @@ #include "acl/acl_base.h" #include "include/api/visible.h" -namespace mindspore { +namespace mindspore::lite { class AclInitAdapter { public: static AclInitAdapter &GetInstance(); @@ -64,6 +64,6 @@ class AclEnvGuard { aclError errno_; }; extern "C" MS_API bool GetPid(int32_t *pid); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_KERNEL_ASCEND_MODEL_ACL_ENV_GUARD_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_graph_executor.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_graph_executor.cc index fc71804dc800de7d4dd3a2f72adf8292c3d06b52..fedeee52811212bb183ba7f3a43151d4e14a9515 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_graph_executor.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_graph_executor.cc @@ -29,7 +29,7 @@ #include "src/common/utils.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr auto kProviderAcl = "litert"; constexpr size_t kSupportedWeightNum = 1; @@ -382,4 +382,4 @@ static std::shared_ptr AclGraphExecutorCreator(const std::sha } REG_DELEGATE(kAscend, kProviderAcl, AclGraphExecutorCreator) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_graph_executor.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_graph_executor.h index c7c4023c5a3b00fecd298796c6a8e6be0f6b0c00..7d9c4e6f340ee8bf2fea00372e03feeb2ac4e84a 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_graph_executor.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_graph_executor.h @@ -29,7 +29,7 @@ #include "src/common/common.h" #include "extendrt/delegate/ascend_acl/model_infer.h" -namespace mindspore { +namespace mindspore::lite { class AclGraphExecutor : public LiteGraphExecutor { public: AclGraphExecutor(const std::shared_ptr &context, const ConfigInfos &config_info) { @@ -75,5 +75,5 @@ class AclGraphExecutor : public LiteGraphExecutor { bool load_model_ = false; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_ASCEND_ACL_ACL_GRAPH_EXECUTOR_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_mem_manager.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_mem_manager.cc index d0585abdcc7fe0210bb7c0a328e91316c309cf9d..d5f7831da11b3a9ea75c74549efbd72010a28ea3 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_mem_manager.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_mem_manager.cc @@ -24,7 +24,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_rt_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { STATUS AclMemManager::UpdateWorkspace(size_t work_size, size_t weight_size, int32_t device_id) { auto it = work_mem_info_map_.find(device_id); if (it == work_mem_info_map_.end()) { @@ -268,4 +268,4 @@ AclMemManager::~AclMemManager() { } } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_mem_manager.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_mem_manager.h index 25a928cc3708ae438f75ebc87142dfc61bf5305f..f962a2542705ee28a298178c1ed91519427faf17 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_mem_manager.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_mem_manager.h @@ -26,7 +26,7 @@ #include #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::STATUS; struct AclModelMemInfo { @@ -74,5 +74,5 @@ class AclMemManager { std::map> weight_mem_info_map_; AclModelMemInfo weight_mem_info_ = {nullptr, 0}; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ASCEND_SRC_ACL_MEM_MANAGER_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_model_options.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_model_options.h index e7eee260370b6a50b66ba5b16d3f63402ffd1d06..e75134fe2b2bfb62d74962e59ba3f0ad23dba5bb 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_model_options.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_model_options.h @@ -25,7 +25,7 @@ #include "mindapi/base/format.h" #include "acl/acl_mdl.h" -namespace mindspore { +namespace mindspore::lite { struct AclModelOptions { int32_t device_id; std::string dump_path; @@ -52,5 +52,5 @@ struct AclDynamicShapeOptions { std::vector> input_shapes; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_KERNEL_ASCEND_SRC_ACL_MODEL_OPTIONS_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_plugin_impl.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_plugin_impl.cc index db07867c4a5c7b78ee5f12b691af11b3bcc8718a..45c64c0ce3cb207058db787b963cf75866dcd880 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_plugin_impl.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_plugin_impl.cc @@ -17,7 +17,7 @@ #include #include "extendrt/delegate/ascend_acl/acl_plugin_impl.h" -namespace mindspore { +namespace mindspore::lite { std::shared_ptr AscendAclExecutorPluginImpl::InitAclGraphExecutor( const std::shared_ptr &context, const ConfigInfos &config_infos) { if (context == nullptr) { @@ -37,4 +37,4 @@ std::shared_ptr AscendAclExecutorPluginImpl::InitAclGraphExecu } AscendAclExecutorPluginImpl *CreateAscendAclExecutorPluginImpl() { return new AscendAclExecutorPluginImpl(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_plugin_impl.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_plugin_impl.h index 09afe6109806c66bcae8c4c86026cfb4d4f0c2ff..3ad525df8db751a4dc509289a0375286ba9c495c 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_plugin_impl.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_plugin_impl.h @@ -22,7 +22,7 @@ #include "extendrt/delegate/plugin/ascend_acl_executor_plugin.h" #include "extendrt/delegate/ascend_acl/acl_graph_executor.h" -namespace mindspore { +namespace mindspore::lite { class AscendAclExecutorPluginImpl : public lite::AscendAclExecutorPluginImplBase { public: AscendAclExecutorPluginImpl() = default; @@ -34,5 +34,5 @@ class AscendAclExecutorPluginImpl : public lite::AscendAclExecutorPluginImplBase }; extern "C" MS_API AscendAclExecutorPluginImpl *CreateAscendAclExecutorPluginImpl(); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_ASCEND_ACL_ACL_PLUGIN_IMPL_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.cc index 9c1a4ac0f3eede7d48ad571a9e1afadbc9917b4a..473deb61b1713b2a373b937acfe244c1c1ad07ae 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.cc @@ -20,7 +20,7 @@ #include "src/extendrt/cxx_api/dlutils.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace { constexpr auto kAscendkernelPluginSoNmae = "libascend_acl_plugin.so"; constexpr auto kFunCreateAscendAllocatorPluginImpl = "CreateAclAllocator"; @@ -270,4 +270,4 @@ Status AscendAllocatorPlugin::Finalize() { return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h index e2cd99ed479740809bc60e6a08ad9b12112473bf..1ecf2458d33adc74ebc007b773b86ad659aeaf15 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h @@ -19,7 +19,7 @@ #include #include #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { class AscendAllocatorPluginImpl { public: AscendAllocatorPluginImpl() = default; @@ -65,5 +65,5 @@ class MS_API AscendAllocatorPlugin { std::shared_ptr ascend_allocator_plugin_impl_ = nullptr; void *get_pid_func_ = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/dyn_shape_process.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/dyn_shape_process.cc index d90572407073423112d8d6314ca152190406bb38..9a57b08b6ca9a90cc3cbfe8d0a48c264288add0b 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/dyn_shape_process.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/dyn_shape_process.cc @@ -20,7 +20,7 @@ #include "include/errorcode.h" #include "src/common/log.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr auto kInputDimNum = 4; constexpr auto kNHWCNIdx = 0; @@ -286,4 +286,4 @@ bool DynShapeProcess::GetRealImageSize(const std::vector &new_shape MS_LOG(INFO) << "Current height " << height << " width " << width; return true; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/dyn_shape_process.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/dyn_shape_process.h index d623ab3c7e510601ae7fb6af73ff85b1b245e7e5..c3570f80a2764a6784207c5977b50499d3daca7e 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/dyn_shape_process.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/dyn_shape_process.h @@ -29,7 +29,7 @@ using ShapeValueDType = int64_t; using ShapeVector = std::vector; using ShapeArray = std::vector; -namespace mindspore { +namespace mindspore::lite { class DynShapeProcess { public: bool Init(const AclDynamicShapeOptions &options); @@ -49,5 +49,5 @@ class DynShapeProcess { size_t input_data_idx_ = 0; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_KERNEL_ASCEND_MODEL_DYN_SHAPE_PROCESS_H diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/model_infer.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/model_infer.cc index 31fa19652d14e10499d6b1da0dd7208c883ab549..a6e6563ed942c6a86eedc01318339e74ca7572ee 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/model_infer.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/model_infer.cc @@ -19,7 +19,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_rt_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { std::mutex g_context_mutex; @@ -255,4 +255,4 @@ bool ModelInfer::Resize(const std::vector> &new_shapes) { } return true; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/model_infer.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/model_infer.h index e119ab15946b55666acbedc26422690b4b2b2096..afea6173caced08774e1fa1c745ec1f5cda523ed 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/model_infer.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/model_infer.h @@ -30,7 +30,7 @@ #include "extendrt/delegate/ascend_acl/acl_model_options.h" #include "extendrt/delegate/ascend_acl/profiling.h" #include "mindspore/core/include/mindapi/base/type_id.h" -namespace mindspore { +namespace mindspore::lite { class ModelInfer { public: @@ -63,5 +63,5 @@ class ModelInfer { std::shared_ptr acl_env_; uint64_t sharable_handle_ = 0; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_KERNEL_ASCEND_MODEL_MODEL_INFER_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/model_process.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/model_process.cc index e02358b36162a6dd3a57a21813c6b49c97d73b71..b7dccec0440f3ddb9580c1cee83ad39ca5985cbc 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/model_process.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/model_process.cc @@ -31,7 +31,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr size_t kBatchSizeNum = 1; constexpr size_t kImageSizeHwNum = 2; @@ -1817,4 +1817,4 @@ Status ModelProcess::GetOutputs(const std::vector *outputs) { const_cast *>(outputs)->insert(outputs->end(), new_outputs.begin(), new_outputs.end()); return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/model_process.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/model_process.h index c05e609b8a6a45669958dcb9d32d46dc26239e3d..9c41f87c03c2ae26b79181705e75f8c9df07dab7 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/model_process.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/model_process.h @@ -36,7 +36,7 @@ #include "mindspore/core/include/mindapi/base/type_id.h" #include "src/extendrt/delegate/ascend_acl/acl_allocator.h" -namespace mindspore { +namespace mindspore::lite { struct AclTensorInfo { void *cur_device_data; void *device_data; @@ -164,5 +164,5 @@ class ModelProcess { uint64_t sharable_handle_ = 0; AclAllocator *allocator_ = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_KERNEL_ASCEND_MODEL_MODEL_PROCESS_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/profiling.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/profiling.cc index 1f32eca130a323be6a14ed5380633ff9beda1f7b..cde8797d9ca767a519fc74f23fd4a9057adc5a79 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/profiling.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/profiling.cc @@ -23,7 +23,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_prof_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { std::map kAicMetrics{{"ArithmeticUtilization", ACL_AICORE_ARITHMETIC_UTILIZATION}, {"PipeUtilization", ACL_AICORE_PIPE_UTILIZATION}, @@ -149,4 +149,4 @@ bool Profiling::StopProfiling(const aclrtStream &stream) { } return true; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/profiling.h b/mindspore-lite/src/extendrt/delegate/ascend_acl/profiling.h index b18226c24e0a44eaced6c1d629f347a89bfe00fc..ddb8a5d344949ad6fdfe187a9a36b0dd7209fe9e 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/profiling.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/profiling.h @@ -21,7 +21,7 @@ #include #include "acl/acl_prof.h" -namespace mindspore { +namespace mindspore::lite { class Profiling { public: @@ -42,5 +42,5 @@ class Profiling { nlohmann::json profiling_json_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_KERNEL_ASCEND_PROFILING_ASCEND_PROFILING_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.cc index d52e5259cab98d37616c4f275e1cf8cfa13985eb..701ab98e59fef4fbb721bb77acce851f7eb904a5 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.cc @@ -26,7 +26,7 @@ #include "mindspore/ccsrc/utils/dlopen_macro.h" #include "cxx_api/acl_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr const char *kSubgraphTurning = "subgraph tuning"; constexpr const char *kOperatorTurning = "operator tuning"; @@ -474,4 +474,4 @@ Status AoeApiTuning::AoeTurningGraph(const std::shared_ptr &session } return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.h b/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.h index 03e6c27807736cfed2149b84fa1c8e245b5309ce..919e1b0f02232c56d2161aec766e3ef4255cdfdd 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.h @@ -26,7 +26,7 @@ #include "cxx_api/model/acl/acl_model_options.h" #include "ge/ge_api.h" -namespace mindspore { +namespace mindspore::lite { using ConfigInfos = std::map>; class AoeApiTuning { public: @@ -46,5 +46,5 @@ class AoeApiTuning { const std::map &global_options, const std::map &tuning_options); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_ASCEND_GE_AOE_API_TUNING_PROCESS_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_context_manager.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_context_manager.cc index c6abaa81f2fedebf46e85098a7b87df0b41c81fd..8c6cea075b5ba398f6b571ab3b3300bca8d5ace3 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_context_manager.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_context_manager.cc @@ -19,7 +19,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_rt_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { GeContextManager::GeContextManager() {} GeContextManager::~GeContextManager() { DestroyContext(); } @@ -118,4 +118,4 @@ void GeContextManager::DestroyDefaultStream() { } default_stream_ = nullptr; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_context_manager.h b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_context_manager.h index 79db5cf178698b5879992bb949d26ad3c9fbc827..2412649930f243d49da257cadff3d82f7b9b5732 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_context_manager.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_context_manager.h @@ -21,7 +21,7 @@ #include #include "acl/acl_rt.h" -namespace mindspore { +namespace mindspore::lite { class GeContextManager { public: GeContextManager(); @@ -43,5 +43,5 @@ class GeContextManager { void DestroyDefaultStream(); bool CreateDefaultStream(); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_ASCEND_GE_GE_CONTEXT_MANAGER_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_device_context.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_device_context.cc index e9fdb12d69eff21360be5386d4243f06c0f654ca..5debc212b621f5b7c95cb39ad3f588dd2cf594c1 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_device_context.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_device_context.cc @@ -30,7 +30,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_rt_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { constexpr auto kHcclPluginFileName = "libhccl.so"; typedef enum { @@ -418,4 +418,4 @@ bool GeDeviceContext::FinalizeGe(const std::shared_ptr &inst_context) } return true; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_device_context.h b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_device_context.h index 620b518f5b66fae27ed29a23c60413070508c60b..2f514d12026525eefe55e533bc5b7ecc549353e7 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_device_context.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_device_context.h @@ -25,7 +25,7 @@ #include "include/api/status.h" #include "utils/ms_context.h" -namespace mindspore { +namespace mindspore::lite { class GeDeviceContext { public: GeDeviceContext(); @@ -56,5 +56,5 @@ class GeDeviceContext { static std::weak_ptr global_ge_context_; static std::mutex global_ge_context_mutex_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_ASCEND_GE_GE_DEVICE_CONTEXT_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_dynamic_utils.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_dynamic_utils.cc index bf6ee376fc4639b6eb186627a344ec5fca2be3b2..7df1e5a87e68215bef1820dde524789a7bdf9f13 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_dynamic_utils.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_dynamic_utils.cc @@ -18,7 +18,7 @@ #include "common/common.h" #include "extendrt/delegate/ascend_ge/ge_utils.h" -namespace mindspore { +namespace mindspore::lite { bool GeDynamicUtils::IsDynamicInputShapes(const std::vector &input_shapes) { return std::any_of(input_shapes.begin(), input_shapes.end(), [](const ShapeVector &shape) { return std::any_of(shape.begin(), shape.end(), [](auto dim) { return dim < 0; }); @@ -462,4 +462,4 @@ bool GeDynamicUtils::GetGraphOneRealShapes(const std::shared_ptr &context, const ConfigInfos &config_infos, std::vector> *dynamic_dims); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_ASCEND_GE_GE_DYNAMIC_UTILS_H diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.cc index bdeb4596dd42d48b85c263e6b6532ad462a8b9c8..e4af132be5bae0d332585b9fd43a3aa7b67d45b8 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.cc @@ -42,7 +42,7 @@ #include "utils/ms_utils_secure.h" #include "src/extendrt/utils/tensor_default_impl.h" #include "mindspore/core/include/utils/misc.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr auto kProviderGe = "ge"; constexpr auto kDump = "dump"; @@ -1917,4 +1917,4 @@ static std::shared_ptr GeGraphExecutorCreator(const std::shar } REG_DELEGATE(kAscend, kProviderGe, GeGraphExecutorCreator) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.h b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.h index f91ed28eb6c290b26c7728fd213c42a734619b12..d3e391912195faa5b3700448412b9860fd2f6593 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.h @@ -34,7 +34,7 @@ #include "extendrt/delegate/ascend_ge/ge_context_manager.h" #include "src/common/common.h" -namespace mindspore { +namespace mindspore::lite { using MSTensorPtr = std::shared_ptr; class MSTensorRel { @@ -247,5 +247,5 @@ class GeSessionManager { static std::map> ge_session_map_; static std::mutex session_mutex_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_ASCEND_GE_GE_GRAPH_EXECUTOR_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_memory_manager.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_memory_manager.cc index 4f3dbb93f68cc3de070682147d28b9a9f4c43807..9f96a98fa03eb9c4b1b67dec3bf55436705639e7 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_memory_manager.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_memory_manager.cc @@ -20,7 +20,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_rt_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { size_t ALIGN_OFFSET(void *addr) { auto extra = (reinterpret_cast(addr) & 0xff); if (extra == 0) { @@ -158,4 +158,4 @@ void GeMemoryManager::FreeAllMemory() { } host_memories_.clear(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_memory_manager.h b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_memory_manager.h index fdbc85ab66f46b3afb80b829bf69d2932e018015..4c13f5b57b0003e0a141a23fd18600d9f4e65f43 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_memory_manager.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_memory_manager.h @@ -20,7 +20,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { class GeMemoryManager { public: @@ -52,5 +52,5 @@ class GeMemoryManager { std::vector device_memories_; std::vector host_memories_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_ASCEND_GE_GE_MEMORY_MANAGER_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_plugin_impl.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_plugin_impl.cc index 45527559f247c60547be7840e7292da87a77e48d..f1a02c4581de6241af4396f58856bd6fed3e50ce 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_plugin_impl.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_plugin_impl.cc @@ -19,7 +19,7 @@ #include "extendrt/delegate/ascend_ge/ge_device_context.h" #include "extendrt/delegate/ascend_ge/ge_utils.h" -namespace mindspore { +namespace mindspore::lite { Status AscendGeExecutorPluginImpl::AdaptGraph(FuncGraphPtr graph) const { return GeUtils::AdaptGraph(graph); } bool AscendGeExecutorPluginImpl::AoeTuning(const FuncGraphPtr &graph, @@ -62,4 +62,4 @@ std::shared_ptr AscendGeExecutorPluginImpl::InitGeGraphExecutor } AscendGeExecutorPluginImpl *CreateAscendGeExecutorPluginImpl() { return new AscendGeExecutorPluginImpl(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_plugin_impl.h b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_plugin_impl.h index bb2014fcb7482f0e0481730ce238185856e014ae..523c8bc2f10b75c69f22f40a20615779966365d4 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_plugin_impl.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_plugin_impl.h @@ -23,7 +23,7 @@ #include "extendrt/delegate/ascend_ge/ge_device_context.h" #include "extendrt/delegate/ascend_ge/ge_graph_executor.h" -namespace mindspore { +namespace mindspore::lite { class AscendGeExecutorPluginImpl : public lite::AscendGeExecutorPluginImplBase { public: AscendGeExecutorPluginImpl() = default; @@ -41,5 +41,5 @@ class AscendGeExecutorPluginImpl : public lite::AscendGeExecutorPluginImplBase { }; extern "C" MS_API AscendGeExecutorPluginImpl *CreateAscendGeExecutorPluginImpl(); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_ASCEND_GE_GE_PLUGIN_IMPL_H_ diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_utils.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_utils.cc index 2372d3464c8cb8995c51fbd13513987348ca4c55..ed85e71f360acbb06f656e73553737fe06b21fe3 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_utils.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_utils.cc @@ -27,7 +27,7 @@ #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { static std::string AdjustCnodeName(const PrimitivePtr &prim) { if (prim == nullptr) { MS_LOG(ERROR) << "prim is nullptr."; @@ -144,4 +144,4 @@ std::string GetSocVersion() { return version; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_utils.h b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_utils.h index 0d643489b2ce97341ee5de26f2aed0fe3a92131c..82f76662306e64676a4c2035130b1b34e6e12d68 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_utils.h +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_utils.h @@ -26,7 +26,7 @@ #include "runtime/hardware_abstract/device_context/device_context.h" #include "extendrt/session/lite_graph_executor.h" #include "extendrt/delegate/ascend_ge/ge_device_context.h" -namespace mindspore { +namespace mindspore::lite { class GeUtils { public: static Status AdaptGraph(const FuncGraphPtr &func_graph); @@ -34,5 +34,5 @@ class GeUtils { }; std::string GetSocVersion(); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_ASCEND_GE_GE_UTILS_H_ diff --git a/mindspore-lite/src/extendrt/delegate/factory.cc b/mindspore-lite/src/extendrt/delegate/factory.cc index fb5b378096dcee617412e0d8bb014535f6db1c84..d9162578c18dc20cd63112d6aeecd3b2209c6d21 100644 --- a/mindspore-lite/src/extendrt/delegate/factory.cc +++ b/mindspore-lite/src/extendrt/delegate/factory.cc @@ -16,7 +16,7 @@ #include "src/extendrt/delegate/factory.h" -namespace mindspore { +namespace mindspore::lite { template DelegateRegistry &DelegateRegistry::GetInstance() { @@ -64,4 +64,4 @@ T DelegateRegistry::GetDelegate(const mindspore::DeviceType &device_type, con template class DelegateRegistry>; -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/factory.h b/mindspore-lite/src/extendrt/delegate/factory.h index 03bdf92a43864aedff001ac7a6dc14e1ca769988..6115bb7301aa739b5acbadbd7c71de18bec05c2f 100644 --- a/mindspore-lite/src/extendrt/delegate/factory.h +++ b/mindspore-lite/src/extendrt/delegate/factory.h @@ -26,7 +26,7 @@ #include "include/api/context.h" #include "src/common/config_infos.h" -namespace mindspore { +namespace mindspore::lite { template using DelegateCreator = std::function &, const ConfigInfos &)>; @@ -63,6 +63,6 @@ class DelegateRegistrar { return creator(context, config_infos); \ }; \ static DelegateRegistrar g_##device_type##provider##Delegate(device_type, provider, &func); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_FACTORY_H_ diff --git a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.cc b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.cc index 4c85f7524dae6a621768e1f5f0868aa0af702b9b..10ef218262fc759aaad0df4892e96a70e26d3273 100644 --- a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.cc +++ b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.cc @@ -17,7 +17,7 @@ #include "extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.h" #include #include "src/common/common.h" -namespace mindspore { +namespace mindspore::lite { std::mutex mtx_manager_; FuncGraphReuseManager *FuncGraphReuseManager::GetInstance() { @@ -201,4 +201,4 @@ FuncGraphReuseManager::~FuncGraphReuseManager() { all_fb_model_buf_.clear(); MS_LOG(INFO) << "~FuncGraphReuseManager() end."; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.h b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.h index 78f52e487ff4f465a78398607f26680b92767582..159db335f67dfd1f625ee33e2d19398dc5bb3ee5 100644 --- a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.h +++ b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.h @@ -26,7 +26,7 @@ #include "include/api/status.h" #include "src/common/helper/infer_helpers.h" #include "src/extendrt/session/lite_graph_executor.h" -namespace mindspore { +namespace mindspore::lite { using MSTensorPtr = std::shared_ptr; struct ModelBufPair { @@ -70,5 +70,5 @@ class FuncGraphReuseManager { std::unordered_map> all_in_names_; std::unordered_map> all_out_names_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_GRAPH_EXECUTOR_LITERT_FUNC_GRAPH_REUSE_MANAGER_H_ diff --git a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/graph_executor.cc b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/graph_executor.cc index 2981e4598c05b1bf43382b9c2dfd44651f17652b..c7246f8fc4c0d42ff15111a44d106f6cf518e069 100644 --- a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/graph_executor.cc +++ b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/graph_executor.cc @@ -35,7 +35,7 @@ #include "src/executor/kernel_exec.h" #include "src/extendrt/delegate/graph_executor/litert/func_graph_reuse_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace { // leave 200MB for the model struct to make sure the model will not large than 2GB const size_t kOnlineExtractDataSize = 1800 * 1024 * 1024; @@ -459,4 +459,4 @@ static std::shared_ptr LiteRTGraphExecutorCreator(const std:: } REG_DELEGATE(kCPU, litert_provider, LiteRTGraphExecutorCreator); -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/graph_executor.h b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/graph_executor.h index 9c54929c93ee03368f0b27b05ee58cbad6c454e0..0c113c5f8daf64f42f3060e47766cbbfe8b2e63f 100644 --- a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/graph_executor.h +++ b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/graph_executor.h @@ -30,7 +30,7 @@ #include "src/common/helper/infer_helpers.h" #include "src/common/config_infos.h" -namespace mindspore { +namespace mindspore::lite { class LiteRTGraphExecutor : public LiteGraphExecutor { public: LiteRTGraphExecutor() = default; @@ -74,5 +74,5 @@ class LiteRTGraphExecutor : public LiteGraphExecutor { bool is_shared_fb_buf_ = false; void *fb_model_buf_ = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_GRAPH_EXECUTOR_LITERT_GRAPH_EXECUTOR_H_ diff --git a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/litert_plugin_impl.h b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/litert_plugin_impl.h index 57008cc2c82ab6f8204d5ebc4a1e080b28bd6b8a..a91720e2ae1e47406f7a9ead9d203d725217f45b 100644 --- a/mindspore-lite/src/extendrt/delegate/graph_executor/litert/litert_plugin_impl.h +++ b/mindspore-lite/src/extendrt/delegate/graph_executor/litert/litert_plugin_impl.h @@ -19,13 +19,13 @@ #include "src/common/log_adapter.h" #include "extendrt/delegate/plugin/litert_executor_plugin.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { class LiteRTPluginImpl : public LiteRTExecutorPluginImplBase { public: LiteRTPluginImpl() = default; ~LiteRTPluginImpl() = default; }; -} // namespace mindspore::infer +} // namespace mindspore::lite::infer extern "C" MS_API mindspore::infer::LiteRTExecutorPluginImplBase *CreateLiteRTPluginImpl(); #endif // MINDSPORE_LITE_SRC_EXTENDRT_DELEGATE_GRAPH_EXECUTOR_LITERT_GRAPH_EXECUTO_LITERT_PLUGIN_IMPL_H_ diff --git a/mindspore-lite/src/extendrt/delegate/plugin/litert_executor_plugin.cc b/mindspore-lite/src/extendrt/delegate/plugin/litert_executor_plugin.cc index 598619797d3ebad160b4f9f37c804beef2b3444b..c24208ed7ce516d0fd9fa2bfdd2c9fe603382156 100644 --- a/mindspore-lite/src/extendrt/delegate/plugin/litert_executor_plugin.cc +++ b/mindspore-lite/src/extendrt/delegate/plugin/litert_executor_plugin.cc @@ -22,7 +22,7 @@ #include "extendrt/cxx_api/dlutils.h" #endif -namespace mindspore::infer { +namespace mindspore::lite::infer { namespace { constexpr auto kLiteRtPluginSoName = "libmsplugin-ge-litert.so"; constexpr auto kFunCreateLiteRTPluginImp = "CreateLiteRTPluginImpl"; @@ -75,4 +75,4 @@ bool LiteRTExecutorPlugin::Register() { #endif return true; } -} // namespace mindspore::infer +} // namespace mindspore::lite::infer diff --git a/mindspore-lite/src/extendrt/delegate/plugin/litert_executor_plugin.h b/mindspore-lite/src/extendrt/delegate/plugin/litert_executor_plugin.h index 1875964facf3a202decdb9851502a54f02de5189..0325570a5ef00e7c68eb887a480e696bf9d63831 100644 --- a/mindspore-lite/src/extendrt/delegate/plugin/litert_executor_plugin.h +++ b/mindspore-lite/src/extendrt/delegate/plugin/litert_executor_plugin.h @@ -19,7 +19,7 @@ #include "src/common/log_adapter.h" #include "mindapi/base/macros.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { class MS_API LiteRTExecutorPlugin { public: static LiteRTExecutorPlugin &GetInstance(); @@ -38,5 +38,5 @@ class LiteRTExecutorPluginImplBase { LiteRTExecutorPluginImplBase() = default; virtual ~LiteRTExecutorPluginImplBase() = default; }; -} // namespace mindspore::infer +} // namespace mindspore::lite::infer #endif // MINDSPORE_LITE_SRC_EXTENDRT_LITERT_EXECUTOR_PLUGIN_H_ diff --git a/mindspore-lite/src/extendrt/delegate_graph_executor.cc b/mindspore-lite/src/extendrt/delegate_graph_executor.cc index 81a4d2e51cd94f84989bb33454d6a3b6769db4c4..8d0116d160c0647b6fc5693b53abc2d4f09ca566 100644 --- a/mindspore-lite/src/extendrt/delegate_graph_executor.cc +++ b/mindspore-lite/src/extendrt/delegate_graph_executor.cc @@ -18,7 +18,7 @@ #include #include "src/extendrt/subgraph_kernel.h" #include "infer/cxx_api/partial_fusion.h" -namespace mindspore { +namespace mindspore::lite { // Graph sink delegate, the whole FuncGraph as a node to execute. void GraphSinkDelegate::ReplaceNodes(const std::shared_ptr &graph) { sink_graph_ = graph; @@ -47,4 +47,4 @@ std::shared_ptr GraphExecutorDelegate::CreateKernel(cons auto kernel = std::make_shared(sink_graph_, executor_); return kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/delegate_graph_executor.h b/mindspore-lite/src/extendrt/delegate_graph_executor.h index b38b233f779ced02066ae9ea172ee9831e459464..4329fb4a35865f1cafd3967037269556d09e10bb 100644 --- a/mindspore-lite/src/extendrt/delegate_graph_executor.h +++ b/mindspore-lite/src/extendrt/delegate_graph_executor.h @@ -27,7 +27,7 @@ #include "src/extendrt/session/lite_graph_executor.h" #include "src/extendrt/subgraph_kernel.h" -namespace mindspore { +namespace mindspore::lite { // Graph sink delegate, the whole FuncGraph as a node to execute. class GraphSinkDelegate { public: @@ -54,5 +54,5 @@ class GraphExecutorDelegate : public GraphSinkDelegate { private: const std::shared_ptr executor_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/src/extendrt/dynamic_mem_allocator.cc b/mindspore-lite/src/extendrt/dynamic_mem_allocator.cc index 0363f2fa9cb7eecc04ffccd0118976198a498c1f..3d4ac01cbcce03646198dfa4ecfd6700d37bdb1a 100644 --- a/mindspore-lite/src/extendrt/dynamic_mem_allocator.cc +++ b/mindspore-lite/src/extendrt/dynamic_mem_allocator.cc @@ -17,7 +17,7 @@ #include "src/common/utils.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { void *DynamicMemAllocator::Malloc(size_t size) { if (mem_oper_ != nullptr) { return mem_oper_->Malloc(size); @@ -67,4 +67,4 @@ DynamicMemAllocator::DynamicMemAllocator(int node_id) { } mem_oper_ = mem_manager_->GetMemOperator(node_id); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/dynamic_mem_allocator.h b/mindspore-lite/src/extendrt/dynamic_mem_allocator.h index e6e8067264b71f33c91de8361d2f67016c57f112..9772eba150ab5366d05e6d6463e68e23d3ff612b 100644 --- a/mindspore-lite/src/extendrt/dynamic_mem_allocator.h +++ b/mindspore-lite/src/extendrt/dynamic_mem_allocator.h @@ -24,7 +24,7 @@ #include "include/api/allocator.h" #include "src/extendrt/dynamic_mem_manager.h" -namespace mindspore { +namespace mindspore::lite { class DynamicMemAllocator : public Allocator { public: explicit DynamicMemAllocator(int node_id); @@ -41,6 +41,6 @@ class DynamicMemAllocator : public Allocator { std::shared_ptr mem_manager_ = nullptr; std::shared_ptr mem_oper_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DYNAMIC_MEM_ALLOCATOR_H_ diff --git a/mindspore-lite/src/extendrt/dynamic_mem_manager.cc b/mindspore-lite/src/extendrt/dynamic_mem_manager.cc index 2b34ec2a28b86c82ee0890dec3f1a305d9b3c174..6fa36d84ba1a4db359ba5481df212420cae33aee 100644 --- a/mindspore-lite/src/extendrt/dynamic_mem_manager.cc +++ b/mindspore-lite/src/extendrt/dynamic_mem_manager.cc @@ -22,7 +22,7 @@ using mindspore::numa::NUMAAdapter; using mindspore::numa::MemoryInfo; -namespace mindspore { +namespace mindspore::lite { namespace { // Alloc memory aligned according to 64 bytes. static constexpr size_t kMemAlginSize = 64; @@ -328,4 +328,4 @@ std::shared_ptr DynamicMemManager::GetMemOperator(const int node_id } return mem_oper; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/dynamic_mem_manager.h b/mindspore-lite/src/extendrt/dynamic_mem_manager.h index 8fd72d116afcf718f2c9c3d9fc79a8b7faaa243c..955755ea71d58971ecbf4510878ee332af635b44 100644 --- a/mindspore-lite/src/extendrt/dynamic_mem_manager.h +++ b/mindspore-lite/src/extendrt/dynamic_mem_manager.h @@ -25,7 +25,7 @@ #include #include "src/extendrt/numa_adapter.h" -namespace mindspore { +namespace mindspore::lite { struct Block { // used_ may be true when ref_count_ == 0 bool used_ = false; @@ -83,6 +83,6 @@ class DynamicMemManager { std::map> nodes_mem_; std::mutex mutex_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_DYNAMIC_MEM_MANAGER_H_ diff --git a/mindspore-lite/src/extendrt/execution_flow.cc b/mindspore-lite/src/extendrt/execution_flow.cc index 4277bd5f10c4fe12b1498a42d795d35dc5133df8..859e13591253b05aee6b353f727aa449b7a3e1b3 100644 --- a/mindspore-lite/src/extendrt/execution_flow.cc +++ b/mindspore-lite/src/extendrt/execution_flow.cc @@ -19,7 +19,7 @@ #include "src/litert/kernel_exec_util.h" #include "src/executor/sub_graph_kernel.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { ExecutionFlow::~ExecutionFlow() { for (auto kernel : kernels_) { delete kernel; @@ -110,4 +110,4 @@ mindspore::kernel::SubGraphType ExecutionFlow::GetSubGraphType(abstract::Kernel return kernel::kNotSubGraph; } } -} // namespace mindspore::infer +} // namespace mindspore::lite::infer diff --git a/mindspore-lite/src/extendrt/execution_flow.h b/mindspore-lite/src/extendrt/execution_flow.h index 3ea180b757b03f6222d4af304be29ec66c885452..899ce293bbb836f1da649da9a1e7160645844f85 100644 --- a/mindspore-lite/src/extendrt/execution_flow.h +++ b/mindspore-lite/src/extendrt/execution_flow.h @@ -24,7 +24,7 @@ #include "infer/execution_flow.h" #include "src/executor/sub_graph_kernel.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { class ExecutionFlow : public abstract::ExecutionFlow { public: ExecutionFlow() = default; @@ -74,6 +74,6 @@ class ExecutionFlow : public abstract::ExecutionFlow { abstract::KernelCallBack after_; }; using ExecutionFlowPtr = std::shared_ptr; -} // namespace mindspore::infer +} // namespace mindspore::lite::infer #endif // MINDSPORE_LITE_SRC_EXTENDRT_EXECUTION_FLOW_H_ diff --git a/mindspore-lite/src/extendrt/execution_plan.cc b/mindspore-lite/src/extendrt/execution_plan.cc index 936bbbf447df909d5cefe9e25112b99b59326f60..17c5edf2da58f8e70ca05cce0e02144ce6af4030 100644 --- a/mindspore-lite/src/extendrt/execution_plan.cc +++ b/mindspore-lite/src/extendrt/execution_plan.cc @@ -22,7 +22,7 @@ #include "litert/kernel_exec_util.h" #include "executor/sub_graph_kernel.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { ExecutionPlan::~ExecutionPlan() { delete input_isolate_map_; delete output_isolate_map_; @@ -89,4 +89,4 @@ bool ExecutionPlan::CalcTensorRefCount(abstract::Kernel *subgraph_kernel) { } return true; } -} // namespace mindspore::infer +} // namespace mindspore::lite::infer diff --git a/mindspore-lite/src/extendrt/execution_plan.h b/mindspore-lite/src/extendrt/execution_plan.h index 46edbb2458996dc4e70ef18e3eb1933e0472d85a..804a82bfd707eb30800d654bcc544ee7116ce69d 100644 --- a/mindspore-lite/src/extendrt/execution_plan.h +++ b/mindspore-lite/src/extendrt/execution_plan.h @@ -25,7 +25,7 @@ #include "infer/execution_plan.h" #include "src/executor/sub_graph_kernel.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { /** * ExecutionPlan: Execution plan for cloud infer */ @@ -105,6 +105,6 @@ class ExecutionPlan : public abstract::ExecutionPlan { std::unordered_map *input_isolate_map_ = nullptr; std::unordered_map *output_isolate_map_ = nullptr; }; -} // namespace mindspore::infer +} // namespace mindspore::lite::infer #endif // MINDSPORE_LITE_SRC_EXTENDRT_EXECUTION_PLAN_H_ diff --git a/mindspore-lite/src/extendrt/factory.h b/mindspore-lite/src/extendrt/factory.h index 5466df10f8c485f2b73cb3723d0b438e15f5e0b7..1be52a65e26af0505dac8c00589e82c462e30164 100644 --- a/mindspore-lite/src/extendrt/factory.h +++ b/mindspore-lite/src/extendrt/factory.h @@ -23,7 +23,7 @@ #include #include "include/common/utils/utils.h" -namespace mindspore { +namespace mindspore::lite { inline enum DeviceType g_device_target = kInvalidDeviceType; static inline LogStream &operator<<(LogStream &stream, DeviceType device_type) { @@ -87,5 +87,5 @@ class Registrar { #define API_FACTORY_CREATOR(DERIVE_CLASS) []() { return std::make_shared(); } #define API_FACTORY_REG(BASE, DERIVE) static const Registrar g_api_##DERIVE##_reg(API_FACTORY_CREATOR(DERIVE)); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXTENDRT_FACTORY_H diff --git a/mindspore-lite/src/extendrt/graph_scheduler.cc b/mindspore-lite/src/extendrt/graph_scheduler.cc index e9e89bd377cf9b6ad5a062170afa384954ec8dca..02327965c0b9f4bea955e30941ff8002a14d97f6 100644 --- a/mindspore-lite/src/extendrt/graph_scheduler.cc +++ b/mindspore-lite/src/extendrt/graph_scheduler.cc @@ -16,8 +16,8 @@ #include "extendrt/graph_scheduler.h" #include "extendrt/graph_compiler.h" -namespace mindspore { +namespace mindspore::lite { namespace infer { ExcutionPlan GraphScheduler::Schedule(const CompileResult &compile_result) { return {}; } } // namespace infer -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/graph_scheduler.h b/mindspore-lite/src/extendrt/graph_scheduler.h index 4870615a9f4e4b5bd16030259b549cffe994a095..0bd5261379a783371106926d69ff4138cc715668 100644 --- a/mindspore-lite/src/extendrt/graph_scheduler.h +++ b/mindspore-lite/src/extendrt/graph_scheduler.h @@ -27,7 +27,7 @@ #include "ir/func_graph.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { namespace infer { struct ScheduleStrategy {}; struct GraphCompilerInfo; @@ -47,5 +47,5 @@ class GraphScheduler : public std::enable_shared_from_this { ExcutionPlan Schedule(const CompileResult &); }; } // namespace infer -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/src/extendrt/infer_session.cc b/mindspore-lite/src/extendrt/infer_session.cc index d174f8ee6818929a069f7c410505cbb1e2f1dcce..ca90483270e8a9179017010cb0b4f5876d5d3fbf 100644 --- a/mindspore-lite/src/extendrt/infer_session.cc +++ b/mindspore-lite/src/extendrt/infer_session.cc @@ -22,7 +22,7 @@ #include "extendrt/delegate/plugin/ascend_acl_executor_plugin.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace { void AscendPluginRegistration(const std::shared_ptr &ascend_device, bool use_experimental_rts) { constexpr auto default_npu_provider = "ge"; @@ -121,4 +121,4 @@ Status InferSession::Finalize() { MS_LOG(INFO) << "Finalize is only implemented in delegate_session now."; return kLiteError; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/infer_session.h b/mindspore-lite/src/extendrt/infer_session.h index b2e36b7cc91cb4d2b1287201d05530b68023b681..90c4b0378586e5631a4e2f1663abfcfd0dad4cc9 100644 --- a/mindspore-lite/src/extendrt/infer_session.h +++ b/mindspore-lite/src/extendrt/infer_session.h @@ -29,7 +29,7 @@ #include "common/mutable_tensor_impl.h" #include "src/common/config_infos.h" -namespace mindspore { +namespace mindspore::lite { class InferSession : public std::enable_shared_from_this { public: virtual ~InferSession() = default; @@ -158,5 +158,5 @@ class InferSession : public std::enable_shared_from_this { static SessionType SelectSession(const std::shared_ptr &context, bool use_experimental_rts = false); uint64_t sharable_handle_ = 0; }; // namespace mindspore -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/src/extendrt/mindir_loader/abstract_base_model.h b/mindspore-lite/src/extendrt/mindir_loader/abstract_base_model.h index 2c30f0b00df426e0da18c5a5b3ea04251e65ee52..80076d880942020441ee3bd7d532c00ae4c1d9dc 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/abstract_base_model.h +++ b/mindspore-lite/src/extendrt/mindir_loader/abstract_base_model.h @@ -27,7 +27,7 @@ using Model = mindspore::lite::Model; using LiteGraph = mindspore::lite::LiteGraph; -namespace mindspore::infer { +namespace mindspore::lite::infer { class AbstractBaseModel : public Model { public: virtual bool ModelVerify() const = 0; @@ -38,6 +38,6 @@ class AbstractBaseModel : public Model { const LiteGraph::Node *node, lite::InnerContext *context, TypeId prefer_data_type) = 0; }; -} // namespace mindspore::infer +} // namespace mindspore::lite::infer #endif // MINDSPORE_LITE_SRC_EXTENDRT_MINDIR_LOADER_ABSTRACT_BASE_MODEL_H_ diff --git a/mindspore-lite/src/extendrt/mindir_loader/abstract_kernel.h b/mindspore-lite/src/extendrt/mindir_loader/abstract_kernel.h index 4421ed11e1dd42d0ef92012bb198d3e050ee20f5..655c3666385517b62c0c68ec33925504bcf8e37a 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/abstract_kernel.h +++ b/mindspore-lite/src/extendrt/mindir_loader/abstract_kernel.h @@ -24,7 +24,7 @@ using mindspore::kernel::Kernel; -namespace mindspore::infer { +namespace mindspore::lite::infer { class Abstractkernel : public Kernel { public: virtual int Train() = 0; @@ -51,6 +51,6 @@ class Abstractkernel : public Kernel { virtual const std::vector &out_tensors() const = 0; }; -} // namespace mindspore::infer +} // namespace mindspore::lite::infer #endif // MINDSPORE_LITE_SRC_EXTENDRT_MINDIR_LOADER_ABSTRACT_KERNEL_H_ diff --git a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/inner_kernel.cc b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/inner_kernel.cc index b6a74d6465ab952818e554fcc198ba6d59baadf6..2251d02380f1d1b9f882e3b8a0fdac785800b0a6 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/inner_kernel.cc +++ b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/inner_kernel.cc @@ -20,7 +20,7 @@ #include "extendrt/mindir_loader/mindir_model/inner_kernel.h" #include "abstract/abstract_value.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int InnerKernel::Prepare() { auto inputs = CloudTensorUtils::LiteTensorToKernelTensorPtrVec(this->in_tensors_); auto outputs = CloudTensorUtils::LiteTensorToKernelTensorPtrVec(this->out_tensors_); @@ -45,4 +45,4 @@ int InnerKernel::ReSize() { return this->kernel_mod_->Init(inputs, outputs) ? mindspore::lite::RET_OK : mindspore::lite::RET_ERROR; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/inner_kernel.h b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/inner_kernel.h index 488328e12de75a22b680825762c0a70c7be9457f..be8dba089ff203814d62449f9ab72541f4f30d8d 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/inner_kernel.h +++ b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/inner_kernel.h @@ -31,7 +31,7 @@ using mindspore::infer::Abstractkernel; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class InnerKernel : public Abstractkernel { public: InnerKernel() = default; @@ -98,6 +98,6 @@ class InnerKernel : public Abstractkernel { std::vector out_tensors_; const mindspore::lite::InnerContext *ms_context_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_EXTENDRT_MINDIR_LOADER_MINDIR_MODEL_INNER_KERNEL_H_ diff --git a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_mock.cc b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_mock.cc index 9d0d5bbf5416e313350bb25888ed602041f6067e..450f4d1edf663f64024daee7df357678e4e0219d 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_mock.cc +++ b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_mock.cc @@ -19,9 +19,9 @@ #include "runtime/hardware_abstract/kernel_base/kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { KernelErrorCode KernelMod::Resize(const std::vector &inputs, const std::vector &outputs) { return KRET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_util.cc b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_util.cc index 2c1699d2b560c6214207f3a4627c2edce3215ce9..ea3b2edb16a1a37f74a53056c0befb9cf2f24f8e 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_util.cc +++ b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_util.cc @@ -23,7 +23,7 @@ #include "runtime/hardware_abstract/kernel_base/ms_factory.h" #include "mindspore/ops/kernel/cpu/cpu_kernel_mod.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { std::shared_ptr KernelModUtil::GetInnerKernel( const std::vector &in_tensors, const std::vector &out_tensors, const mindspore::lite::LiteGraph::Node *node, lite::InnerContext *context) { @@ -38,4 +38,4 @@ std::shared_ptr KernelModUtil::GetInnerKernel( auto base_operator = std::reinterpret_pointer_cast(node->base_operator_); return std::make_shared(kernel_mod, base_operator, in_tensors, out_tensors, context); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_util.h b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_util.h index bdd687f796d01c7c62bfd170a1a5deb897ef6d1c..b898dfef60e8d236d93bda6ff37e85d8ea5d62e5 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_util.h +++ b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/kernel_mod_util.h @@ -24,13 +24,13 @@ #include "src/tensor.h" #include "include/model.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class KernelModUtil { public: static std::shared_ptr GetInnerKernel( const std::vector &in_tensors, const std::vector &out_tensors, const mindspore::lite::LiteGraph::Node *node, lite::InnerContext *context); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_EXTENDRT_MINDIR_LOADER_MINDIR_MODEL_KERNEL_MOD_UTIL_H_ diff --git a/mindspore-lite/src/extendrt/mindir_loader/model_loader.cc b/mindspore-lite/src/extendrt/mindir_loader/model_loader.cc index 0c68e11d50b9e72498af04ad9861b8d68c2c4280..bc785abab240ca84832e0273e7338bc40cc410cb 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/model_loader.cc +++ b/mindspore-lite/src/extendrt/mindir_loader/model_loader.cc @@ -16,7 +16,7 @@ #include "extendrt/mindir_loader/model_loader.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { constexpr size_t kMaxModelBufferSize = static_cast(1024) * 1024 * 1024 * 2; int ModelLoader::InitModelBuffer(AbstractBaseModel *model, const char *model_buf, size_t size, bool take_buf) { @@ -51,4 +51,4 @@ ModelLoaderRegistry *ModelLoaderRegistry::GetInstance() { static ModelLoaderRegistry instance; return &instance; } -} // namespace mindspore::infer +} // namespace mindspore::lite::infer diff --git a/mindspore-lite/src/extendrt/mindir_loader/model_loader.h b/mindspore-lite/src/extendrt/mindir_loader/model_loader.h index c21fb954791a307b9462e289753698c886613979..a33bd2b44eca10d32d5178f8f43c4378f81b5f9c 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/model_loader.h +++ b/mindspore-lite/src/extendrt/mindir_loader/model_loader.h @@ -21,7 +21,7 @@ #include "extendrt/mindir_loader/abstract_base_model.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { class ModelLoader { public: virtual AbstractBaseModel *ImportModel(const char *model_buf, size_t size, bool take_buf) = 0; @@ -63,6 +63,6 @@ class ModelLoaderRegistrar { #define REG_MODEL_LOADER(model_type, model_loader_creator) \ static ModelLoaderRegistrar g_##model_type##model_loader##ModelLoader(model_type, model_loader_creator); -} // namespace mindspore::infer +} // namespace mindspore::lite::infer #endif // MINDSPORE_LITE_SRC_EXTENDRT_MINDIR_LOADER_MODEL_LOADER_H_ diff --git a/mindspore-lite/src/extendrt/mock/lite_runtime/converters.cc b/mindspore-lite/src/extendrt/mock/lite_runtime/converters.cc index b12f1536778ca210e4f343bd3d017f9f2b949e5f..1dc9bd52990b9462f11bc037c6101c477daba608 100644 --- a/mindspore-lite/src/extendrt/mock/lite_runtime/converters.cc +++ b/mindspore-lite/src/extendrt/mock/lite_runtime/converters.cc @@ -18,7 +18,7 @@ #include "src/common/log_adapter.h" #include "src/common/utils.h" -namespace mindspore { +namespace mindspore::lite { constexpr static int kMaxNumOfDevices = 3; constexpr static int kDefaultThreadNumTwo = 2; constexpr static int kDefaultThreadNumFour = 4; @@ -135,4 +135,4 @@ std::shared_ptr ContextUtils::Convert(Context *context) { } return inner_context; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/mock/lite_runtime/converters.h b/mindspore-lite/src/extendrt/mock/lite_runtime/converters.h index e8943835e915086518a23bfba45e84bee2644e16..a5ff098a8c549d272f929d373bd24910a1d15354 100644 --- a/mindspore-lite/src/extendrt/mock/lite_runtime/converters.h +++ b/mindspore-lite/src/extendrt/mock/lite_runtime/converters.h @@ -26,7 +26,7 @@ #include "src/litert/inner_context.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { class ContextUtils { public: static std::shared_ptr Convert(Context *context); @@ -63,6 +63,6 @@ inline lite::QuantizationType A2L_ConvertQT(mindspore::QuantizationType qt) { } Status A2L_ConvertConfig(const TrainCfg *a_train_cfg, lite::TrainCfg *l_train_cfg); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_CXX_API_CONVERTERS_H_ diff --git a/mindspore-lite/src/extendrt/mock/lite_runtime/populate/arithmetic_populate.cc b/mindspore-lite/src/extendrt/mock/lite_runtime/populate/arithmetic_populate.cc index da6174518a12c922463e63afa369d8877c9fae72..607bac80227b3352a8a3a0087c3a6dda615358e8 100644 --- a/mindspore-lite/src/extendrt/mock/lite_runtime/populate/arithmetic_populate.cc +++ b/mindspore-lite/src/extendrt/mock/lite_runtime/populate/arithmetic_populate.cc @@ -37,7 +37,7 @@ using mindspore::schema::PrimitiveType_NotEqual; using mindspore::schema::PrimitiveType_RealDiv; using mindspore::schema::PrimitiveType_SquaredDifference; -namespace mindspore { +namespace mindspore::lite { ArithmeticParameter *PopulateArithmeticCommonPara(void *base_operator) { MS_CHECK_TRUE_RET(base_operator != nullptr, nullptr); auto base_operator_ptr = static_cast(base_operator); @@ -89,4 +89,4 @@ REG_BASE_POPULATE(PrimitiveType_FloorMod, PopulateArithmetic) REG_BASE_POPULATE(PrimitiveType_Mod, PopulateArithmetic) REG_BASE_POPULATE(PrimitiveType_SquaredDifference, PopulateArithmetic) REG_BASE_POPULATE(PrimitiveType_BiasAddGrad, PopulateArithmetic) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/mock/lite_runtime/populate/arithmetic_populate.h b/mindspore-lite/src/extendrt/mock/lite_runtime/populate/arithmetic_populate.h index 404acb0ed2b766225e2676cb404f13ec06a1543b..d335ba8be824a2bf1afe9052a7e08f4f5bad2eb0 100644 --- a/mindspore-lite/src/extendrt/mock/lite_runtime/populate/arithmetic_populate.h +++ b/mindspore-lite/src/extendrt/mock/lite_runtime/populate/arithmetic_populate.h @@ -18,8 +18,8 @@ #include "nnacl_c/arithmetic_parameter.h" -namespace mindspore { +namespace mindspore::lite { ArithmeticParameter *PopulateArithmeticCommonPara(void *prim); OpParameter *PopulateArithmetic(void *primitive); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_COMMON_OPS_POPULATE_ARITHMETIC_POPULATE_H_ diff --git a/mindspore-lite/src/extendrt/mock/lite_runtime/populate/base_operator_populate_register.cc b/mindspore-lite/src/extendrt/mock/lite_runtime/populate/base_operator_populate_register.cc index 97aafc7d975c48c82d2871f21cdae2aa779de67d..d170e7b7c62d2dacab26213f99799d131ab3f377 100644 --- a/mindspore-lite/src/extendrt/mock/lite_runtime/populate/base_operator_populate_register.cc +++ b/mindspore-lite/src/extendrt/mock/lite_runtime/populate/base_operator_populate_register.cc @@ -16,9 +16,9 @@ #include "extendrt/mock/lite_runtime/populate/base_operator_populate_register.h" -namespace mindspore { +namespace mindspore::lite { BaseOperatorPopulateRegistry *BaseOperatorPopulateRegistry::GetInstance() { static BaseOperatorPopulateRegistry registry; return ®istry; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/mock/lite_runtime/populate/base_operator_populate_register.h b/mindspore-lite/src/extendrt/mock/lite_runtime/populate/base_operator_populate_register.h index 1a6e1251afe9d92b9d85c065a5c72d8d69d5bcb8..47693b77a8784440433b820a926e1fc40871e47d 100644 --- a/mindspore-lite/src/extendrt/mock/lite_runtime/populate/base_operator_populate_register.h +++ b/mindspore-lite/src/extendrt/mock/lite_runtime/populate/base_operator_populate_register.h @@ -30,7 +30,7 @@ #include "src/common/utils.h" #include "src/common/log_util.h" -namespace mindspore { +namespace mindspore::lite { constexpr int kOffsetTwo = 2; constexpr int kOffsetThree = 3; constexpr size_t kMinShapeSizeTwo = 2; @@ -95,5 +95,5 @@ class BaseRegistry { #define REG_BASE_POPULATE(primitive_type, creator) \ static BaseRegistry g_##primitive_type##base_populate(primitive_type, creator); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_COMMON_OPS_POPULATE_POPULATE_REGISTER_H_ diff --git a/mindspore-lite/src/extendrt/model_manager.cc b/mindspore-lite/src/extendrt/model_manager.cc index 4125df261fbc63c1bead7af80778ceb47d0d0667..e9ec357d7812bd2da229ff6f41712c385b3fc0b8 100644 --- a/mindspore-lite/src/extendrt/model_manager.cc +++ b/mindspore-lite/src/extendrt/model_manager.cc @@ -21,7 +21,7 @@ #include #include "include/api/model_group.h" -namespace mindspore { +namespace mindspore::lite { bool JudgeMergeFlag(ModelGroupFlag input_flag, ModelGroupFlag cur_flag) { return (input_flag == ModelGroupFlag::kShareWeight && cur_flag == ModelGroupFlag::kShareWorkspace) || (cur_flag == ModelGroupFlag::kShareWeight && input_flag == ModelGroupFlag::kShareWorkspace); @@ -49,4 +49,4 @@ ModelManager::~ModelManager() { model_path_set_.clear(); model_buff_set_.clear(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/model_manager.h b/mindspore-lite/src/extendrt/model_manager.h index 6ddd361dcba86e37650433631b51cb74e49923c5..c75a90bbc9ce9a2587c8ced841a1d3437ff3cb70 100644 --- a/mindspore-lite/src/extendrt/model_manager.h +++ b/mindspore-lite/src/extendrt/model_manager.h @@ -25,7 +25,7 @@ #include #include "include/api/model_group.h" -namespace mindspore { +namespace mindspore::lite { class ModelManager { public: ModelManager() {} @@ -49,6 +49,6 @@ class ModelManager { std::map model_path_set_; std::set> model_buff_set_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_MODEL_MANAGER_H_ diff --git a/mindspore-lite/src/extendrt/numa_adapter.cc b/mindspore-lite/src/extendrt/numa_adapter.cc index 459da65be9c610812a870ce152dae9d0cdec0b2a..16ebd7dc957fde8beff803ab04645eb594f1bb06 100644 --- a/mindspore-lite/src/extendrt/numa_adapter.cc +++ b/mindspore-lite/src/extendrt/numa_adapter.cc @@ -22,7 +22,7 @@ #include "src/common/common.h" #include "src/common/utils.h" -namespace mindspore { +namespace mindspore::lite { namespace numa { namespace { static constexpr auto kNodeBase = "/sys/devices/system/node/node"; @@ -222,4 +222,4 @@ NUMAAdapter::~NUMAAdapter() { MS_LOG(DEBUG) << "~NUMAAdapter() end."; } } // namespace numa -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/numa_adapter.h b/mindspore-lite/src/extendrt/numa_adapter.h index 8d42ece7057269fba42e249bb3fc5dc2f98ba0d3..cbca84349c69c55e54432e1531bf4bdf38eb3a68 100644 --- a/mindspore-lite/src/extendrt/numa_adapter.h +++ b/mindspore-lite/src/extendrt/numa_adapter.h @@ -22,7 +22,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace numa { struct bitmask { uint64_t size; @@ -73,5 +73,5 @@ class NUMAAdapter { std::unordered_map> node_cpu_list_; }; } // namespace numa -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_NUMA_ADAPTER_H_ diff --git a/mindspore-lite/src/extendrt/session/delegate_session.cc b/mindspore-lite/src/extendrt/session/delegate_session.cc index 579efa3a9b923da4148d9a3aa77920c9b340b485..aba538cf54064b743bc480b5ff9847f417ae4c37 100644 --- a/mindspore-lite/src/extendrt/session/delegate_session.cc +++ b/mindspore-lite/src/extendrt/session/delegate_session.cc @@ -29,7 +29,7 @@ #include "common/common.h" #include "src/extendrt/session/lite_graph_executor.h" #include "extendrt/delegate/plugin/ascend_acl_executor_plugin.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr auto kIsAdapted = "is_adapted"; constexpr size_t kSupportedWeightNum = 1; @@ -444,4 +444,4 @@ static std::shared_ptr DelegateSessionCreator(const std::shared_pt return session; } REG_SESSION(kDelegateSession, DelegateSessionCreator); -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/session/delegate_session.h b/mindspore-lite/src/extendrt/session/delegate_session.h index e5658d8041e251c3ff3dfdd85e87135f97eaa117..4e0c51d57b57b4c50b1d13697b5f70d4dcb12f6e 100644 --- a/mindspore-lite/src/extendrt/session/delegate_session.h +++ b/mindspore-lite/src/extendrt/session/delegate_session.h @@ -25,7 +25,7 @@ #include "runtime/hardware_abstract/device_context/device_context.h" #include "extendrt/session/lite_graph_executor.h" #include "extendrt/delegate/ascend_acl/ascend_allocator_plugin.h" -namespace mindspore { +namespace mindspore::lite { /// \brief Delegate Session implementation, use delegate api for inference. struct DelegateGraphInfo { std::vector inputs; @@ -79,6 +79,6 @@ class GraphSinkSession : public InferSession { std::shared_ptr context_; ConfigInfos config_infos_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXTENDRT_SESSION_DELEGATE_SESSION_H_ diff --git a/mindspore-lite/src/extendrt/session/factory.cc b/mindspore-lite/src/extendrt/session/factory.cc index e0ce297dec4ec8b23a1c79445efc0867021e79bf..6ac98783da1c838e9232eeb35b16f8e598e591a6 100644 --- a/mindspore-lite/src/extendrt/session/factory.cc +++ b/mindspore-lite/src/extendrt/session/factory.cc @@ -20,7 +20,7 @@ #include "extendrt/session/type.h" #include "extendrt/infer_session.h" -namespace mindspore { +namespace mindspore::lite { SessionRegistry &SessionRegistry::GetInstance() { static SessionRegistry instance; return instance; @@ -39,4 +39,4 @@ std::shared_ptr SessionRegistry::GetSession(const mindspore::Sessi } return it->second(ctx, config_info); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/session/factory.h b/mindspore-lite/src/extendrt/session/factory.h index d0809e797a07ee0cc7cd419b2202e4d48b869b92..546cbb29ea015e01924fdf2901723bc8addbfcb4 100644 --- a/mindspore-lite/src/extendrt/session/factory.h +++ b/mindspore-lite/src/extendrt/session/factory.h @@ -22,7 +22,7 @@ #include "extendrt/session/type.h" #include "extendrt/infer_session.h" #include "include/api/context.h" -namespace mindspore { +namespace mindspore::lite { using InferSessionRegFunc = std::function(const std::shared_ptr &, const ConfigInfos &)>; @@ -51,6 +51,6 @@ class SessionRegistrar { }; #define REG_SESSION(session_type, creator) static SessionRegistrar g_##session_type##Session(session_type, creator); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXTENDRT_SESSION_FACTORY_H_ diff --git a/mindspore-lite/src/extendrt/session/lite_graph_executor.h b/mindspore-lite/src/extendrt/session/lite_graph_executor.h index 99610698b46597fee7b1f89a1f722d4e06257304..da167a75548a69051ce33a8685469e2c05709d75 100644 --- a/mindspore-lite/src/extendrt/session/lite_graph_executor.h +++ b/mindspore-lite/src/extendrt/session/lite_graph_executor.h @@ -25,7 +25,7 @@ #include "runtime/hardware_abstract/device_context/device_context.h" #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { /// \brief Adaptive Graph Executor for cloud Graph Executor to solve interface conflicts. class LiteGraphExecutor { public: @@ -100,6 +100,6 @@ class LiteGraphExecutor { MSKernelCallBack after_; uint64_t sharable_handle_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXTENDRT_SESSION_LITE_GRAPH_EXECUTOR_H_ diff --git a/mindspore-lite/src/extendrt/session/type.h b/mindspore-lite/src/extendrt/session/type.h index 076fa8924f28066da2f37c3252e9e59db7497d30..2884f7251486d83ee48f53cbcda417760cd54829 100644 --- a/mindspore-lite/src/extendrt/session/type.h +++ b/mindspore-lite/src/extendrt/session/type.h @@ -19,7 +19,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { enum SessionType { kDefaultSession = 0, kSingleOpSession, @@ -29,5 +29,5 @@ enum SessionType { kMemoryOffloadSession, kNoneSession }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EXTENDRT_SESSION_TYPE_H_ diff --git a/mindspore-lite/src/extendrt/signal_handler.cc b/mindspore-lite/src/extendrt/signal_handler.cc index f1216507f1693afdad73a7232ddff4d053bb9e60..10e24c7440592622df8faafc626f5fe3332affcf 100644 --- a/mindspore-lite/src/extendrt/signal_handler.cc +++ b/mindspore-lite/src/extendrt/signal_handler.cc @@ -21,7 +21,7 @@ #include #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace { static std::map kSigs = { {SIGSEGV, "SIGSEGV"}, {SIGABRT, "SIGABRT"}, {SIGFPE, "SIGFPE"}, {SIGBUS, "SIGBUS"}, {SIGILL, "SIGILL"}}; @@ -77,4 +77,4 @@ void CaptureSignal() { } capture_already = true; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/signal_handler.h b/mindspore-lite/src/extendrt/signal_handler.h index 9b309da3b5af8d9d7be9586a1482e8ee533abc9e..61bdb819e14cd728551c00a27265e698e6f9f325 100644 --- a/mindspore-lite/src/extendrt/signal_handler.h +++ b/mindspore-lite/src/extendrt/signal_handler.h @@ -17,9 +17,9 @@ #ifndef MINDSPORE_LITE_SRC_EXTENDRT_SIGNAL_HANDLER_H_ #define MINDSPORE_LITE_SRC_EXTENDRT_SIGNAL_HANDLER_H_ -namespace mindspore { +namespace mindspore::lite { // capture exception signals void CaptureSignal(); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_SIGNAL_HANDLER_H_ diff --git a/mindspore-lite/src/extendrt/subgraph_kernel.cc b/mindspore-lite/src/extendrt/subgraph_kernel.cc index d077753fd68ee86f47e2ea429c2e8d5371db6f71..9a9d8a0433cb4dd46151ba3bf25422eacf2d2f53 100644 --- a/mindspore-lite/src/extendrt/subgraph_kernel.cc +++ b/mindspore-lite/src/extendrt/subgraph_kernel.cc @@ -14,7 +14,7 @@ * limitations under the License. */ #include "src/extendrt/subgraph_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { bool SubgraphKernel::Launch(const std::vector &inputs, const std::vector &workspace, const std::vector &outputs, void *stream_ptr) { std::vector in; @@ -29,4 +29,4 @@ bool SubgraphKernel::Init(const std::vector &inputs, const std::vect } int SubgraphKernel::Resize(const std::vector &inputs, const std::vector &outputs) { return 0; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/extendrt/subgraph_kernel.h b/mindspore-lite/src/extendrt/subgraph_kernel.h index 769e4040c1db50687d768286062f8db94a241b53..a32c48379fbaa667e265a253315115f1b3695a4b 100644 --- a/mindspore-lite/src/extendrt/subgraph_kernel.h +++ b/mindspore-lite/src/extendrt/subgraph_kernel.h @@ -25,7 +25,7 @@ #include "runtime/hardware_abstract/kernel_base/common_utils.h" #include "src/extendrt/session/lite_graph_executor.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SubgraphKernel { public: SubgraphKernel(FuncGraphPtr subgraph, std::shared_ptr executor) @@ -43,5 +43,5 @@ class SubgraphKernel { FuncGraphPtr subgraph_; std::shared_ptr executor_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/extendrt/utils/func_graph_utils.cc b/mindspore-lite/src/extendrt/utils/func_graph_utils.cc index 931ae1d335b42010d12054d3d7d3dd32caf91ae3..9dcfcdc0db580f4839acecd104d1f251e111f960 100644 --- a/mindspore-lite/src/extendrt/utils/func_graph_utils.cc +++ b/mindspore-lite/src/extendrt/utils/func_graph_utils.cc @@ -37,7 +37,7 @@ #include "mindspore/core/include/ir/func_graph_flag.h" #include "ir/tensor_new.h" -namespace mindspore { +namespace mindspore::lite { const PrimitivePtr kPrimMakeTupleV2 = std::make_shared("make_tuple"); ValuePtr FuncGraphUtils::GetNodeValuePtr(AnfNodePtr input_node) { if (input_node == nullptr) { @@ -555,4 +555,4 @@ AnfNodePtr FuncGraphUtils::RefSubGraphNode(const FuncGraphPtr &fg, const AnfNode } return eqv[node]; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/utils/func_graph_utils.h b/mindspore-lite/src/extendrt/utils/func_graph_utils.h index a15ecd71f4694026d61bf5342bf97a3b7d139b60..18efbe37704e4486dda6063953031ddccee5c4c4 100644 --- a/mindspore-lite/src/extendrt/utils/func_graph_utils.h +++ b/mindspore-lite/src/extendrt/utils/func_graph_utils.h @@ -33,7 +33,7 @@ #include "runtime/hardware_abstract/kernel_base/kernel.h" #include "include/common/utils/anfalgo.h" -namespace mindspore { +namespace mindspore::lite { using AnfWithOutIndex = std::pair; using kernel::BaseOperatorPtr; @@ -76,6 +76,6 @@ class FuncGraphUtils { private: static ValuePtr GetNodeValuePtr(AnfNodePtr input_node); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_UTILS_FUNC_GRAPH_UTILS_H_ diff --git a/mindspore-lite/src/extendrt/utils/segment_utils.h b/mindspore-lite/src/extendrt/utils/segment_utils.h index af4925c8f0b83c9821028475aaddccacfd87365c..0910e370cc0891c273936f01109578f1cca59c17 100644 --- a/mindspore-lite/src/extendrt/utils/segment_utils.h +++ b/mindspore-lite/src/extendrt/utils/segment_utils.h @@ -27,10 +27,10 @@ #include "utils/hash_map.h" #include "ir/anf.h" -namespace mindspore { +namespace mindspore::lite { namespace infer { std::tuple TransformSegmentToAnfGraph(const AnfNodePtrList &lst); } // namespace infer -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_VM_SEGMENT_UTILS_H_ diff --git a/mindspore-lite/src/extendrt/utils/serialization.cc b/mindspore-lite/src/extendrt/utils/serialization.cc index 01521fd4e0066d65161d4effd8dca2d0b73aa0d4..752c77605b2f859257a20cee733f9d2e95183658 100644 --- a/mindspore-lite/src/extendrt/utils/serialization.cc +++ b/mindspore-lite/src/extendrt/utils/serialization.cc @@ -27,7 +27,7 @@ #include "include/api/types.h" #include "src/common/crypto.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { static mindspore::Status RealPath(const std::string &file, std::string *realpath_str) { MS_EXCEPTION_IF_NULL(realpath_str); char real_path_mem[PATH_MAX] = {0}; @@ -151,4 +151,4 @@ mindspore::Status Serialization::Load(const void *model_data, size_t data_size, MS_LOG(ERROR) << err_msg.str(); return mindspore::Status(kMEInvalidInput, err_msg.str()); } -} // namespace mindspore::infer +} // namespace mindspore::lite::infer diff --git a/mindspore-lite/src/extendrt/utils/serialization.h b/mindspore-lite/src/extendrt/utils/serialization.h index 5af05794931cd729db66f015252fe57c4e03fc1e..7b33985086e515295820e3f0783fd0643a1094d6 100644 --- a/mindspore-lite/src/extendrt/utils/serialization.h +++ b/mindspore-lite/src/extendrt/utils/serialization.h @@ -27,7 +27,7 @@ #include "include/api/dual_abi_helper.h" #include "base/base.h" -namespace mindspore::infer { +namespace mindspore::lite::infer { class Serialization { public: static mindspore::Status Load(const void *model_data, size_t data_size, mindspore::ModelType model_type, @@ -38,5 +38,5 @@ class Serialization { static mindspore::FuncGraphPtr ConvertStreamToFuncGraph(const char *buf, const size_t buf_size, bool is_lite, const std::string &mindir_path = ""); }; -} // namespace mindspore::infer +} // namespace mindspore::lite::infer #endif // MINDSPORE_LITE_SRD_EXTENDRT_UTILS_SERIALIZATION_H_ diff --git a/mindspore-lite/src/extendrt/utils/tensor_default_impl.h b/mindspore-lite/src/extendrt/utils/tensor_default_impl.h index 238b3fd040d036924d1358cb88ec630a8b7916eb..12894ac5eba8a45a740c97e8c541be0b21271652 100644 --- a/mindspore-lite/src/extendrt/utils/tensor_default_impl.h +++ b/mindspore-lite/src/extendrt/utils/tensor_default_impl.h @@ -32,9 +32,8 @@ #include "common/mutable_tensor_impl.h" #include "src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h" -namespace mindspore { +namespace mindspore::lite { #define CHECK_SIZE_MUL_OVERFLOW(x, y) (((x) == 0) ? false : (SIZE_MAX / (x)) < (y)) - class TensorDefaultImpl : public MutableTensorImpl { public: TensorDefaultImpl() = default; @@ -216,6 +215,6 @@ class TensorDefaultImpl : public MutableTensorImpl { } } }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_UTILS_TENSOR_DEFAULT_IMPL_H_ diff --git a/mindspore-lite/src/extendrt/utils/tensor_utils.cc b/mindspore-lite/src/extendrt/utils/tensor_utils.cc index edaf632117859bc5aa01b2e092437c0c9c15abaf..bbfe78430c9a388c99b85fb029b5ca6f023bfb0c 100644 --- a/mindspore-lite/src/extendrt/utils/tensor_utils.cc +++ b/mindspore-lite/src/extendrt/utils/tensor_utils.cc @@ -22,7 +22,7 @@ #include "extendrt/utils/tensor_utils.h" -namespace mindspore { +namespace mindspore::lite { kernel::AddressPtr CloudTensorUtils::LiteTensorToAddressPtr(const lite::Tensor *lite_tensor) { kernel::AddressPtr address_ptr = std::make_shared(lite_tensor->data(), lite_tensor->Size()); return address_ptr; @@ -73,4 +73,4 @@ std::vector CloudTensorUtils::LiteTensorToKernelTensorPt return kernel_tensor_list; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/extendrt/utils/tensor_utils.h b/mindspore-lite/src/extendrt/utils/tensor_utils.h index b1c98d50fe37536c9571d48398c50acf9933692a..f8d3404d7939e6e42c31fdbd2e43f9b8692dd0e3 100644 --- a/mindspore-lite/src/extendrt/utils/tensor_utils.h +++ b/mindspore-lite/src/extendrt/utils/tensor_utils.h @@ -35,7 +35,7 @@ #ifdef ENABLE_CLOUD_INFERENCE #include "src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h" #endif -namespace mindspore { +namespace mindspore::lite { class CloudTensorUtils { public: /* lite tensor ---> Address */ @@ -48,6 +48,6 @@ class CloudTensorUtils { static std::vector LiteTensorToKernelTensorPtrVec( const std::vector &lite_tensors); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_UTILS_TENSOR_UTILS_H_ diff --git a/mindspore-lite/src/infer/context.h b/mindspore-lite/src/infer/context.h index 9e88b0d156eabfe8cf09445d0072cf275b6e7060..9b7b7851c6bab8620b0d6732091e368e206d2254 100644 --- a/mindspore-lite/src/infer/context.h +++ b/mindspore-lite/src/infer/context.h @@ -20,12 +20,12 @@ #include "litert/inner_context.h" -namespace mindspore { +namespace mindspore::lite { namespace infer::abstract { using Context = mindspore::lite::InnerContext; } using InferContext = infer::abstract::Context; using InferContextPtr = std::shared_ptr; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INFER_CONTEXT_H_ diff --git a/mindspore-lite/src/infer/kernel.h b/mindspore-lite/src/infer/kernel.h index 5d9e5721ed32b396b9f259a1de675e18da1cbe72..174bd41b50262d3fd70901d2967b06efcf64696d 100644 --- a/mindspore-lite/src/infer/kernel.h +++ b/mindspore-lite/src/infer/kernel.h @@ -22,11 +22,11 @@ #include "infer/tensor.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { namespace infer::abstract { using Kernel = mindspore::kernel::KernelExec; } using InferKernel = infer::abstract::Kernel; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INFER_KERNEL_H_ diff --git a/mindspore-lite/src/infer/primitive_type.cc b/mindspore-lite/src/infer/primitive_type.cc index 9eaaf430ed559dbcebfa7eb27ed3e533c665925b..59b68992750120129254a0bab7c8432e1981edb5 100644 --- a/mindspore-lite/src/infer/primitive_type.cc +++ b/mindspore-lite/src/infer/primitive_type.cc @@ -17,7 +17,7 @@ #include "src/infer/primitive_type.h" #include "nnacl_c/op_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { #ifdef ENABLE_CLOUD_INFERENCE namespace { class PrimitiveTypeHelper { @@ -116,4 +116,4 @@ schema::PrimitiveType PrimitiveType::SchemaType() const { return static_cast(this->flatbuffers_type_); } #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/infer/tensor.h b/mindspore-lite/src/infer/tensor.h index d0a85facec380fd2ea2660270f3390fe510288d0..9b698edefc433200d0d8efd56d8802a847d0445a 100644 --- a/mindspore-lite/src/infer/tensor.h +++ b/mindspore-lite/src/infer/tensor.h @@ -21,12 +21,12 @@ #include #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { namespace infer::abstract { using Tensor = mindspore::lite::Tensor; } using InferTensor = infer::abstract::Tensor; using InferTensorPtr = std::shared_ptr; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_INFER_TENSOR_H_ diff --git a/mindspore-lite/src/litert/allocator.cc b/mindspore-lite/src/litert/allocator.cc index 32eda3bfc0fa74f36764b612e32b8c47ff757da8..c50cf778995c2654b449eecb39d1e8be55ae815c 100644 --- a/mindspore-lite/src/litert/allocator.cc +++ b/mindspore-lite/src/litert/allocator.cc @@ -15,6 +15,6 @@ */ #include "src/litert/inner_allocator.h" -namespace mindspore { +namespace mindspore::lite { std::shared_ptr Allocator::Create() { return std::make_shared(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/c_api/model_c.cc b/mindspore-lite/src/litert/c_api/model_c.cc index b27b2dde5dfe9b66cd883ea4601f8c75f06c0d10..aba29fe35d92fbd08176bb68e7499da65b204c32 100644 --- a/mindspore-lite/src/litert/c_api/model_c.cc +++ b/mindspore-lite/src/litert/c_api/model_c.cc @@ -21,7 +21,7 @@ #include "include/api/types.h" #include "src/litert/cxx_api/tensor/tensor_impl.h" -namespace mindspore { +namespace mindspore::lite { class ModelC { public: ModelC() : model_(nullptr) {} @@ -139,7 +139,7 @@ mindspore::MSKernelCallBack ModelC::TransCallBack(const MSKernelCallBackC &ms_ca } return call_back; } -} // namespace mindspore +} // namespace mindspore::lite MSModelHandle MSModelCreate() { auto impl = new (std::nothrow) mindspore::ModelC(); diff --git a/mindspore-lite/src/litert/cxx_api/callback/callback_adapter.h b/mindspore-lite/src/litert/cxx_api/callback/callback_adapter.h index f3be8c47d7441e8ee43f91661e31832a81dc24d0..c6f566cc5df38d5c89c4ff1157d37dc3598ff50e 100644 --- a/mindspore-lite/src/litert/cxx_api/callback/callback_adapter.h +++ b/mindspore-lite/src/litert/cxx_api/callback/callback_adapter.h @@ -20,7 +20,7 @@ #include "include/api/model.h" #include "include/train/train_loop_callback.h" -namespace mindspore { +namespace mindspore::lite { class TrainLoopCallBackAdapter : public lite::TrainLoopCallBack { public: @@ -55,6 +55,6 @@ class TrainLoopCallBackAdapter : public lite::TrainLoopCallBack { Model *model_; TrainCallBack *call_back_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_CALLBACK_CALLBACK_ADAPTER_H_ diff --git a/mindspore-lite/src/litert/cxx_api/callback/callback_impl.h b/mindspore-lite/src/litert/cxx_api/callback/callback_impl.h index 956f8cde51db12228816909e25ef891c2819d8d2..d44bb4c5b7b5a3ad30473283b8f0d899b03aca55 100644 --- a/mindspore-lite/src/litert/cxx_api/callback/callback_impl.h +++ b/mindspore-lite/src/litert/cxx_api/callback/callback_impl.h @@ -19,7 +19,7 @@ #include "include/train/train_loop_callback.h" -namespace mindspore { +namespace mindspore::lite { class CallbackImpl { public: @@ -30,6 +30,6 @@ class CallbackImpl { protected: lite::TrainLoopCallBack *internal_call_back_ = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_CALLBACK_CALLBACK_IMPL_H_ diff --git a/mindspore-lite/src/litert/cxx_api/callback/ckpt_saver.cc b/mindspore-lite/src/litert/cxx_api/callback/ckpt_saver.cc index 6ed26cf59cea96525a24f14444703b5a6e08896c..bc756c18ed010f17ba2d1ee25b1b37d83b789331 100644 --- a/mindspore-lite/src/litert/cxx_api/callback/ckpt_saver.cc +++ b/mindspore-lite/src/litert/cxx_api/callback/ckpt_saver.cc @@ -22,7 +22,7 @@ #include "src/litert/cxx_api/callback/callback_impl.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { CkptSaver::CkptSaver(int save_every_n, const std::vector &filename_prefix) { callback_impl_ = new (std::nothrow) CallbackImpl(new (std::nothrow) lite::CkptSaver(save_every_n, CharToString(filename_prefix))); @@ -43,4 +43,4 @@ CkptSaver::~CkptSaver() { delete callback_impl_; callback_impl_ = nullptr; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/callback/loss_monitor.cc b/mindspore-lite/src/litert/cxx_api/callback/loss_monitor.cc index 6094143bba8ae753c703a1ab91c37eec51c08dbb..55cb4adf6338b7c748caaac9960d6f4d6843082e 100644 --- a/mindspore-lite/src/litert/cxx_api/callback/loss_monitor.cc +++ b/mindspore-lite/src/litert/cxx_api/callback/loss_monitor.cc @@ -22,7 +22,7 @@ #include "src/litert/cxx_api/callback/callback_impl.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { LossMonitor::LossMonitor(int print_every_n_steps) { callback_impl_ = new (std::nothrow) CallbackImpl(new (std::nothrow) lite::LossMonitor(print_every_n_steps)); if (callback_impl_ == nullptr) { @@ -58,4 +58,4 @@ const std::vector &LossMonitor::GetLossPoints() { return (reinterpret_cast(internal_call_back))->GetLossPoints(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/callback/lr_scheduler.cc b/mindspore-lite/src/litert/cxx_api/callback/lr_scheduler.cc index 527f16039ef447334b3007a2d74f5c63e966a8e4..5c86e2642a859a12485a57fa0359ea55bc0c7ea1 100644 --- a/mindspore-lite/src/litert/cxx_api/callback/lr_scheduler.cc +++ b/mindspore-lite/src/litert/cxx_api/callback/lr_scheduler.cc @@ -22,7 +22,7 @@ #include "src/litert/cxx_api/callback/callback_impl.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { int StepLRLambda(float *lr, int epoch, void *lr_cb_data) { if ((lr == nullptr) || (lr_cb_data == nullptr)) { MS_LOG(ERROR) << "nullptr passed as input to MultiplicativeLRLambda"; @@ -59,4 +59,4 @@ LRScheduler::~LRScheduler() { delete callback_impl_; callback_impl_ = nullptr; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/callback/train_accuracy.cc b/mindspore-lite/src/litert/cxx_api/callback/train_accuracy.cc index 7081d04ccf0afeb76fd44c9854416f46e6f46896..db279bf878a6341eecab04bf845e125602b9ea73 100644 --- a/mindspore-lite/src/litert/cxx_api/callback/train_accuracy.cc +++ b/mindspore-lite/src/litert/cxx_api/callback/train_accuracy.cc @@ -22,7 +22,7 @@ #include "src/litert/cxx_api/callback/callback_impl.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { TrainAccuracy::TrainAccuracy(int print_every_n, int accuracy_metrics, const std::vector &input_indexes, const std::vector &output_indexes) { callback_impl_ = new (std::nothrow) CallbackImpl(new (std::nothrow) lite::ClassificationTrainAccuracyMonitor( @@ -60,4 +60,4 @@ const std::vector &TrainAccuracy::GetAccuracyPoints() { return (reinterpret_cast(internal_call_back))->GetAccuracyPoints(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/cell.cc b/mindspore-lite/src/litert/cxx_api/cell.cc index d392a70e4916b71e20233b56815db568157c47f9..0363f5fbc90f479d4e9147b321282c230e42865a 100644 --- a/mindspore-lite/src/litert/cxx_api/cell.cc +++ b/mindspore-lite/src/litert/cxx_api/cell.cc @@ -17,7 +17,7 @@ #include "include/api/cell.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { std::vector CellBase::operator()(const std::vector &inputs) const { std::vector empty; MS_LOG(ERROR) << "Unsupported feature."; @@ -58,4 +58,4 @@ InputAndOutput::InputAndOutput(const std::shared_ptr &cell, const std: int32_t index) { MS_LOG(ERROR) << "Unsupported feature."; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/context.cc b/mindspore-lite/src/litert/cxx_api/context.cc index 23673c5db17921b7383a588f024379422fcc796f..4f5854531b780827da1c8844ac982f042e6c92ed 100644 --- a/mindspore-lite/src/litert/cxx_api/context.cc +++ b/mindspore-lite/src/litert/cxx_api/context.cc @@ -22,7 +22,7 @@ #include "src/litert/inner_allocator.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { constexpr auto kModelOptionCpuEnableFP16 = "mindspore.option.cpu.enable_fp16"; constexpr auto kModelOptionGPUEnableFP16 = "mindspore.option.gpu.enable_fp16"; constexpr auto kModelOptionNPUEnableFP16 = "mindspore.option.npu.enable_fp16"; @@ -683,4 +683,4 @@ std::vector AscendDeviceInfo::GetBufferOptimizeModeChar() const { const std::string &ref = GetValue(data_, kModelOptionAscendBufferOptimize); return StringToChar(ref); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/context.h b/mindspore-lite/src/litert/cxx_api/context.h index 0923d1a4160ea78e46964499b81817f1280183d6..beaed580838cee057971397731562d569b341f58 100644 --- a/mindspore-lite/src/litert/cxx_api/context.h +++ b/mindspore-lite/src/litert/cxx_api/context.h @@ -29,7 +29,7 @@ #include "include/api/context.h" #include "include/api/delegate.h" -namespace mindspore { +namespace mindspore::lite { struct Context::Data { std::vector> device_info_list; int affinity_mode_ = 0; @@ -51,6 +51,6 @@ struct DeviceInfoContext::Data { #endif std::shared_ptr allocator = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_CONTEXT_H_ diff --git a/mindspore-lite/src/litert/cxx_api/converters.cc b/mindspore-lite/src/litert/cxx_api/converters.cc index 8daf0242090d51e82e693269de7a7c41bf26add3..2445091d5b342c9c183e8f898cb24957daca3b6d 100644 --- a/mindspore-lite/src/litert/cxx_api/converters.cc +++ b/mindspore-lite/src/litert/cxx_api/converters.cc @@ -17,7 +17,7 @@ #include "src/common/log_adapter.h" #include "src/common/utils.h" -namespace mindspore { +namespace mindspore::lite { constexpr static int kMaxNumOfDevices = 3; constexpr static int kDefaultThreadNumTwo = 2; constexpr static int kDefaultThreadNumFour = 4; @@ -171,4 +171,4 @@ std::shared_ptr ContextUtils::Convert(Context *context) { } return inner_context; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/converters.h b/mindspore-lite/src/litert/cxx_api/converters.h index d510300274006963d7a6330fd39bfb364cf23fae..1595e1081b39b6df5b49fd442515306b3c96e368 100644 --- a/mindspore-lite/src/litert/cxx_api/converters.h +++ b/mindspore-lite/src/litert/cxx_api/converters.h @@ -26,7 +26,7 @@ #include "src/litert/inner_context.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { class MS_API ContextUtils { public: static std::shared_ptr Convert(Context *context); @@ -66,6 +66,6 @@ inline lite::QuantizationType A2L_ConvertQT(mindspore::QuantizationType qt) { } Status A2L_ConvertConfig(const TrainCfg *a_train_cfg, lite::TrainCfg *l_train_cfg); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_CONVERTERS_H_ diff --git a/mindspore-lite/src/litert/cxx_api/graph/graph.cc b/mindspore-lite/src/litert/cxx_api/graph/graph.cc index 5c1567ccf3ffc6e839afeded88a4974177563d2e..71b11fdabb43cb95f4ff18edbbfa128e53d8349e 100644 --- a/mindspore-lite/src/litert/cxx_api/graph/graph.cc +++ b/mindspore-lite/src/litert/cxx_api/graph/graph.cc @@ -18,7 +18,7 @@ #include "include/api/cell.h" #include "src/litert/cxx_api/graph/graph_data.h" -namespace mindspore { +namespace mindspore::lite { Graph::Graph() : graph_data_(nullptr) {} Graph::Graph(const std::shared_ptr &graph_data) : graph_data_(graph_data) {} @@ -34,4 +34,4 @@ bool Graph::operator==(std::nullptr_t) const { return graph_data_ == nullptr; } bool Graph::operator!=(std::nullptr_t) const { return graph_data_ != nullptr; } ModelType Graph::ModelType() const { return kMindIR_Lite; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/graph/graph_data.h b/mindspore-lite/src/litert/cxx_api/graph/graph_data.h index 040a90c9e0d4e7197fde65d414d9d7721436b7ec..8b2b150a9a18d4d6b7f7c173cba7db32adf54625 100644 --- a/mindspore-lite/src/litert/cxx_api/graph/graph_data.h +++ b/mindspore-lite/src/litert/cxx_api/graph/graph_data.h @@ -25,7 +25,7 @@ #include "include/api/types.h" #include "src/litert/lite_model.h" -namespace mindspore { +namespace mindspore::lite { class Graph::GraphData { public: GraphData() : lite_model_(nullptr) {} @@ -42,6 +42,6 @@ class Graph::GraphData { std::shared_ptr lite_model_ = nullptr; std::string file_name_ = ""; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_GRAPH_GRAPH_DATA_H_ diff --git a/mindspore-lite/src/litert/cxx_api/kernel.cc b/mindspore-lite/src/litert/cxx_api/kernel.cc index 9d321b24b2f6f70d488d5d5eaac82ca30911e4f7..8068a84161ffb4b3f2536bfdbaba4f91cc3f53e9 100644 --- a/mindspore-lite/src/litert/cxx_api/kernel.cc +++ b/mindspore-lite/src/litert/cxx_api/kernel.cc @@ -1,71 +1,71 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "include/api/kernel.h" -#include "include/errorcode.h" -#include "src/registry/kernel_interface_registry.h" -#include "src/common/log_adapter.h" - -namespace mindspore::kernel { -void Kernel::Initialize() { - if (primitive_ == nullptr) { - return; - } - type_ = primitive_->value_type(); - if (type_ == schema::PrimitiveType_Custom) { - auto param = primitive_->value_as_Custom(); - if (param != nullptr && param->type() != nullptr) { - SetAttr("type", param->type()->str()); - } - } -} - -int Kernel::InferShape() { -#ifndef CUSTOM_KERNEL_REGISTRY_CLIP - std::shared_ptr kernel_interface = nullptr; - if (type() == schema::PrimitiveType_Custom) { - kernel_interface = registry::KernelInterfaceRegistry::Instance()->GetKernelInterface("", nullptr, this); - } else { - auto device_list = const_cast(context_)->MutableDeviceInfo(); - for (auto &device : device_list) { - MS_CHECK_TRUE_RET(device != nullptr, lite::RET_NULL_PTR); - kernel_interface = - registry::KernelInterfaceRegistry::Instance()->GetKernelInterface(device->GetProvider(), nullptr, this); - if (kernel_interface != nullptr) { - break; - } - } - } - - if (kernel_interface == nullptr) { - MS_LOG(ERROR) << "op_type: " << schema::EnumNamePrimitiveType(type_) << " can not find infer interface."; - return lite::RET_NOT_SUPPORT; - } - auto ret = kernel_interface->Infer(&inputs_, &outputs_, static_cast(primitive_), this); - if (ret == kLiteInferInvalid) { - for (auto output : outputs_) { - output.SetShape({-1}); - } - return lite::RET_INFER_INVALID; - } - if (ret != kSuccess) { - MS_LOG(ERROR) << "op_type: " << schema::EnumNamePrimitiveType(type_) << " infer fail!ret: " << ret; - return lite::RET_ERROR; - } - return lite::RET_OK; -#endif - return lite::RET_NOT_SUPPORT; -} -} // namespace mindspore::kernel +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "include/api/kernel.h" +#include "include/errorcode.h" +#include "src/registry/kernel_interface_registry.h" +#include "src/common/log_adapter.h" + +namespace mindspore::lite::kernel { +void Kernel::Initialize() { + if (primitive_ == nullptr) { + return; + } + type_ = primitive_->value_type(); + if (type_ == schema::PrimitiveType_Custom) { + auto param = primitive_->value_as_Custom(); + if (param != nullptr && param->type() != nullptr) { + SetAttr("type", param->type()->str()); + } + } +} + +int Kernel::InferShape() { +#ifndef CUSTOM_KERNEL_REGISTRY_CLIP + std::shared_ptr kernel_interface = nullptr; + if (type() == schema::PrimitiveType_Custom) { + kernel_interface = registry::KernelInterfaceRegistry::Instance()->GetKernelInterface("", nullptr, this); + } else { + auto device_list = const_cast(context_)->MutableDeviceInfo(); + for (auto &device : device_list) { + MS_CHECK_TRUE_RET(device != nullptr, lite::RET_NULL_PTR); + kernel_interface = + registry::KernelInterfaceRegistry::Instance()->GetKernelInterface(device->GetProvider(), nullptr, this); + if (kernel_interface != nullptr) { + break; + } + } + } + + if (kernel_interface == nullptr) { + MS_LOG(ERROR) << "op_type: " << schema::EnumNamePrimitiveType(type_) << " can not find infer interface."; + return lite::RET_NOT_SUPPORT; + } + auto ret = kernel_interface->Infer(&inputs_, &outputs_, static_cast(primitive_), this); + if (ret == kLiteInferInvalid) { + for (auto output : outputs_) { + output.SetShape({-1}); + } + return lite::RET_INFER_INVALID; + } + if (ret != kSuccess) { + MS_LOG(ERROR) << "op_type: " << schema::EnumNamePrimitiveType(type_) << " infer fail!ret: " << ret; + return lite::RET_ERROR; + } + return lite::RET_OK; +#endif + return lite::RET_NOT_SUPPORT; +} +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_infer.cc b/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_infer.cc index 14f49ac9793f44516942ab16efe455f1bd5004c4..202f3afda12f30e1b8bb08c2b9e61d5be8f2995a 100644 --- a/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_infer.cc +++ b/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_infer.cc @@ -17,7 +17,7 @@ #include "include/api/status.h" #include "include/registry/register_kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { class CustomOMInfer : public kernel::KernelInterface { public: CustomOMInfer() = default; @@ -30,4 +30,4 @@ class CustomOMInfer : public kernel::KernelInterface { }; std::shared_ptr CustomOMInferCreator() { return std::make_shared(); } REGISTER_CUSTOM_KERNEL_INTERFACE(Tutorial, Custom_OM, CustomOMInferCreator) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_kernel.cc b/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_kernel.cc index fddfb99828f29e4222431a36434fdbb36c7e1c6a..e4f1ab5d0a5cafa4829ecefd2eeabcec6fc49bdc 100644 --- a/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_kernel.cc +++ b/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_kernel.cc @@ -24,7 +24,7 @@ #include "include/securec.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { const auto kFloat32 = DataType::kNumberTypeFloat32; const int MODEL_MAX_RUN_TIME_MS = 100; @@ -194,4 +194,4 @@ std::shared_ptr CustomOMKernelCreator(const std::vector &input REGISTER_CUSTOM_KERNEL(NPU, Tutorial, kFloat32, Custom_OM, CustomOMKernelCreator) REGISTER_CUSTOM_KERNEL(CPU, Tutorial, kFloat32, Custom_OM, CustomOMKernelCreator) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_kernel.h b/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_kernel.h index 5bfab632a1ef2fd57cb1f701b354b592bee663d8..b4c979bbeb9efb176667a27a84d9afdef931a0e8 100644 --- a/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_kernel.h +++ b/mindspore-lite/src/litert/cxx_api/kernel_executor/custom_om_kernel.h @@ -24,7 +24,7 @@ #include "model_manager/model_manager.h" #include "model/built_model.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class CustomOMKernel : public Kernel { public: @@ -53,5 +53,5 @@ class CustomOMKernel : public Kernel { std::vector> hiai_outputs_{}; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_KERNEL_EXECUTOR_CUSTOM_OM_KERNEL_H diff --git a/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor.cc b/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor.cc index 6524b56891c1c121b984fa4a32873c285c9b5d5a..e3c60433852454384d88fcb30e038c51f8b0337a 100644 --- a/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor.cc +++ b/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor.cc @@ -17,7 +17,7 @@ #include "src/litert/cxx_api/kernel_executor/kernel_executor.h" #include "src/litert/cxx_api/kernel_executor/kernel_executor_impl.h" -namespace mindspore { +namespace mindspore::lite { Status KernelExecutor::Build(const std::shared_ptr &op, const std::vector &inputs, const std::shared_ptr &ms_context) { if (impl_ == nullptr) { @@ -59,4 +59,4 @@ Status KernelExecutor::Execute(const std::vector &inputs, std::vector< } return impl_->Execute(inputs, outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor.h b/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor.h index 8a2cde46f22d53dc5a4a28d4351e473342ad8cbc..35545ae7aa19d5d0b516cea131f6a18abee1cb89 100644 --- a/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor.h +++ b/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor.h @@ -25,7 +25,7 @@ #include "ops/base_operator.h" #include "infer/custom.h" -namespace mindspore { +namespace mindspore::lite { class KernelExecutorImpl; class MS_API KernelExecutor { @@ -79,5 +79,5 @@ class MS_API KernelExecutor { private: std::shared_ptr impl_ = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_KERNEL_EXECUTOR_KERNEL_EXECUTOR_H_ diff --git a/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor_impl.cc b/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor_impl.cc index e063cfc62f8a402d674d1b09bda664d548f44e49..2fc36f00ecfe65fd16d9d7e7555e1c3af860d346 100644 --- a/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor_impl.cc +++ b/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor_impl.cc @@ -30,7 +30,7 @@ #include "src/litert/cxx_api/kernel_executor/op_converter.h" #include "src/litert/cpu_info.h" -namespace mindspore { +namespace mindspore::lite { namespace { std::unordered_set support_ops = { "Abs", "ReLU", "Sigmoid", "Add", "Argmax", "Argmin", "AvgPool", @@ -404,4 +404,4 @@ bool KernelExecutorImpl::TensorIsValid(const MSTensor &ms_tensor, const lite::Te } return true; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor_impl.h b/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor_impl.h index 3e36e3c015a1a600dc5c419a82f95efb448430ed..ad275501abfe773e723d2a61b315734d453d38bb 100644 --- a/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor_impl.h +++ b/mindspore-lite/src/litert/cxx_api/kernel_executor/kernel_executor_impl.h @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "common/version_manager.h" -namespace mindspore { +namespace mindspore::lite { class KernelExecutorImpl { public: KernelExecutorImpl(); @@ -59,5 +59,5 @@ class KernelExecutorImpl { std::shared_ptr fbb_; bool support_fp16_ = false; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_KERNEL_EXECUTOR_KERNEL_EXECUTOR_IMPL_H_ diff --git a/mindspore-lite/src/litert/cxx_api/metrics/accuracy.cc b/mindspore-lite/src/litert/cxx_api/metrics/accuracy.cc index d24d880bc1117a782e9d4b2b9a047496201a51c2..fcac76099a19f73a8d77b0b0a771356df654b792 100644 --- a/mindspore-lite/src/litert/cxx_api/metrics/accuracy.cc +++ b/mindspore-lite/src/litert/cxx_api/metrics/accuracy.cc @@ -22,7 +22,7 @@ #include "src/litert/cxx_api/metrics/metrics_impl.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { AccuracyMetrics::AccuracyMetrics(int accuracy_metrics, const std::vector &input_indexes, const std::vector &output_indexes) { metrics_impl_ = new (std::nothrow) @@ -62,4 +62,4 @@ float AccuracyMetrics::Eval() { auto internal_metrics = metrics_impl_->GetInternalMetrics(); return (reinterpret_cast(internal_metrics))->Eval(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/metrics/metrics_adapter.h b/mindspore-lite/src/litert/cxx_api/metrics/metrics_adapter.h index 63e00ff21b52ff70fe953b739be88358da7618d7..e2608312b01f716535dedb09b8ce730803b41f5b 100644 --- a/mindspore-lite/src/litert/cxx_api/metrics/metrics_adapter.h +++ b/mindspore-lite/src/litert/cxx_api/metrics/metrics_adapter.h @@ -20,7 +20,7 @@ #include #include "include/train/metrics.h" -namespace mindspore { +namespace mindspore::lite { class MetricsAdapter : public session::Metrics { public: @@ -35,6 +35,6 @@ class MetricsAdapter : public session::Metrics { private: mindspore::Metrics *metrics_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_METRICS_METRICS_ADAPTER_H_ diff --git a/mindspore-lite/src/litert/cxx_api/metrics/metrics_impl.h b/mindspore-lite/src/litert/cxx_api/metrics/metrics_impl.h index 6c984a7f42a033b6cd69de4e7bd6948400342ed0..c8bcd611c79126f85fee37850298520a2118661c 100644 --- a/mindspore-lite/src/litert/cxx_api/metrics/metrics_impl.h +++ b/mindspore-lite/src/litert/cxx_api/metrics/metrics_impl.h @@ -27,7 +27,7 @@ #include "include/api/model.h" #include "include/train/metrics.h" -namespace mindspore { +namespace mindspore::lite { class MetricsImpl { public: @@ -38,6 +38,6 @@ class MetricsImpl { protected: session::Metrics *metrics_ = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_METRICS_METRICS_IMPL_H_ diff --git a/mindspore-lite/src/litert/cxx_api/model/model.cc b/mindspore-lite/src/litert/cxx_api/model/model.cc index ea5aed4676e35c7c2875fd844326b5e60431b662..4072d8a1a1947757f44a38b453a9e55b9bb779ea 100644 --- a/mindspore-lite/src/litert/cxx_api/model/model.cc +++ b/mindspore-lite/src/litert/cxx_api/model/model.cc @@ -38,7 +38,7 @@ #include "src/common/file_utils.h" #endif -namespace mindspore { +namespace mindspore::lite { #ifdef USE_GLOG extern "C" { extern void mindspore_log_init(); @@ -623,4 +623,4 @@ Status Model::Finalize() { MS_LOG(INFO) << "Finalize is only support for mindspore_lite's ascend backend."; return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/model/model_group.cc b/mindspore-lite/src/litert/cxx_api/model/model_group.cc old mode 100755 new mode 100644 index 6de883a6e1f29467901b5748ec0e486c906dcbe1..bc2d6b655cabfe76af633028952342685dd5c8c7 --- a/mindspore-lite/src/litert/cxx_api/model/model_group.cc +++ b/mindspore-lite/src/litert/cxx_api/model/model_group.cc @@ -22,7 +22,7 @@ #include "src/litert/cxx_api/model/model_group_impl.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { ModelGroup::ModelGroup(ModelGroupFlag flags) { impl_ = std::make_shared(flags); if (impl_ == nullptr) { @@ -58,4 +58,4 @@ Status ModelGroup::CalMaxSizeOfWorkspace(ModelType model_type, const std::shared } return impl_->CalMaxSizeOfWorkspace(model_type, ms_context); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/model/model_group_impl.cc b/mindspore-lite/src/litert/cxx_api/model/model_group_impl.cc old mode 100755 new mode 100644 index e915e57d32739c06326e11a36ac96b3f7d17678e..89b7165d1a6edddc584725aa808c1382f29dde6d --- a/mindspore-lite/src/litert/cxx_api/model/model_group_impl.cc +++ b/mindspore-lite/src/litert/cxx_api/model/model_group_impl.cc @@ -29,7 +29,7 @@ #include "src/litert/model_manager.h" #include "src/common/config_file.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::RET_OK; ModelGroupImpl::ModelGroupImpl(ModelGroupFlag flags) : flags_(flags) { static uint32_t g_model_group_id = 0; @@ -144,4 +144,4 @@ Status ModelGroupImpl::CalMaxSizeOfWorkspace(ModelType model_type, const std::sh } return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/model/model_group_impl.h b/mindspore-lite/src/litert/cxx_api/model/model_group_impl.h index d93721df1b753e608c9be3a801e58a6cbbbab0c6..125d218b58e0238642867266b63ddefdd4daa37d 100644 --- a/mindspore-lite/src/litert/cxx_api/model/model_group_impl.h +++ b/mindspore-lite/src/litert/cxx_api/model/model_group_impl.h @@ -29,7 +29,7 @@ #include "src/litert/lite_session.h" #include "src/litert/inner_context.h" -namespace mindspore { +namespace mindspore::lite { class ModelGroupImpl { public: explicit ModelGroupImpl(ModelGroupFlag flags); @@ -48,6 +48,6 @@ class ModelGroupImpl { ModelGroupFlag flags_; uint32_t model_group_id_ = 0; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_CXX_API_MODEL_MODEL_GROUP_IMPL_H_ diff --git a/mindspore-lite/src/litert/cxx_api/model/model_impl.cc b/mindspore-lite/src/litert/cxx_api/model/model_impl.cc index 272c01ddc726a19a7bbbca1d102d104dde48bbaf..c92db3e694e249694cafcebc511ed9e46f8857e8 100644 --- a/mindspore-lite/src/litert/cxx_api/model/model_impl.cc +++ b/mindspore-lite/src/litert/cxx_api/model/model_impl.cc @@ -39,7 +39,7 @@ #include "src/common/config_file.h" #include "src/litert/cpu_info.h" #include "src/litert/pack_weight_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace { const char *const kExecutionPlan = "execution_plan"; constexpr size_t kMaxSectionNum = 100; @@ -1048,4 +1048,4 @@ int ModelImpl::ModelDeObfuscate() { } return RET_OK; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/model/model_impl.h b/mindspore-lite/src/litert/cxx_api/model/model_impl.h index f8943afcb7c85895dfb28200b73c06a6c8548101..0daf2e3b101a3768fa77ef5c17351b8cf76c801f 100644 --- a/mindspore-lite/src/litert/cxx_api/model/model_impl.h +++ b/mindspore-lite/src/litert/cxx_api/model/model_impl.h @@ -42,7 +42,7 @@ void clearVectorOfPointers(std::vector *v) { } } -namespace mindspore { +namespace mindspore::lite { typedef std::shared_ptr(CreateTrainSessionProto)(std::shared_ptr graph_data, std::shared_ptr cfg, @@ -143,6 +143,6 @@ class ModelImpl { std::map execution_plan_; std::map> config_info_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_MODEL_MODEL_IMPL_H_ diff --git a/mindspore-lite/src/litert/cxx_api/serialization.cc b/mindspore-lite/src/litert/cxx_api/serialization.cc index 1bc33a69924fb12050c991bc1babf09b1cc4666e..f57fefa53a6f95c9a4fc64860e9e8dec320b4f65 100644 --- a/mindspore-lite/src/litert/cxx_api/serialization.cc +++ b/mindspore-lite/src/litert/cxx_api/serialization.cc @@ -26,7 +26,7 @@ #include "src/common/log_adapter.h" #include "src/litert/lite_session.h" -namespace mindspore { +namespace mindspore::lite { Key::Key(const char *dec_key, size_t key_len) { len = 0; if (key_len >= max_key_len) { @@ -230,4 +230,4 @@ Status Serialization::ExportWeightsCollaborateWithMicro(const Model &model, Mode return (ret == mindspore::lite::RET_OK) ? kSuccess : kLiteError; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/tensor/tensor_impl.cc b/mindspore-lite/src/litert/cxx_api/tensor/tensor_impl.cc index 933f2de6691330f3becc288a57c4a3fe70c2af9f..be14b8821c5c9645b18f2916ed98993b8722a64e 100644 --- a/mindspore-lite/src/litert/cxx_api/tensor/tensor_impl.cc +++ b/mindspore-lite/src/litert/cxx_api/tensor/tensor_impl.cc @@ -28,7 +28,7 @@ #ifdef ENABLE_CLOUD_INFERENCE #include "src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h" #endif -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::RET_OK; std::shared_ptr LiteTensorImpl::CreateTensorImpl(const std::string &name, enum DataType type, @@ -152,4 +152,4 @@ std::vector LiteTensorImpl::TensorImplToStrings(const std::shared_p return result; } #endif -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/tensor/tensor_impl.h b/mindspore-lite/src/litert/cxx_api/tensor/tensor_impl.h index fccabd864497e9ae54d1c68b52d2348575990aea..3819d3b8fc5b1e87b0bfde733e7843288cf49bfe 100644 --- a/mindspore-lite/src/litert/cxx_api/tensor/tensor_impl.h +++ b/mindspore-lite/src/litert/cxx_api/tensor/tensor_impl.h @@ -35,7 +35,7 @@ #include "src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h" #endif -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::RET_OK; class LiteTensorImpl : public MutableTensorImpl { @@ -307,6 +307,6 @@ class LiteTensorImpl : public MutableTensorImpl { bool from_session_ = false; }; using LiteTensorImplPtr = std::shared_ptr; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_TENSOR_TENSOR_IMPL_H_ diff --git a/mindspore-lite/src/litert/cxx_api/tensor_utils.cc b/mindspore-lite/src/litert/cxx_api/tensor_utils.cc index 01db45ea11f82e2fdae7572e623d9ec795978f0e..7dc98d0bc369a249fe8b829477616a0ba309097f 100644 --- a/mindspore-lite/src/litert/cxx_api/tensor_utils.cc +++ b/mindspore-lite/src/litert/cxx_api/tensor_utils.cc @@ -18,7 +18,7 @@ #include "src/common/log_adapter.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { size_t MS_API CalTensorDataSize(const std::vector &shape, enum DataType type) { size_t element_size = lite::DataTypeSize(static_cast(type)); for (size_t i = 0; i < shape.size(); i++) { @@ -85,4 +85,4 @@ std::vector LiteTensorsToMSTensors(const std::vector MS_API TruncateShape(const std::vector &shape, enum TypeId type, size_t data_len, bool verify_size); @@ -36,6 +36,6 @@ Status MS_API LiteTensorToMSTensor(lite::Tensor *srcTensor, MSTensor *dstTensor, std::vector MS_API LiteTensorsToMSTensors(const std::vector &srcTensors, bool fromSession = true); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_CXX_API_TENSOR_UTILS_H_ diff --git a/mindspore-lite/src/litert/cxx_api/train/converters.cc b/mindspore-lite/src/litert/cxx_api/train/converters.cc index 8c49337d07fc121ad3f2e70fa1fbcb0238a8e8c0..bfe7e4f423695ccba746c025280023c57685141a 100644 --- a/mindspore-lite/src/litert/cxx_api/train/converters.cc +++ b/mindspore-lite/src/litert/cxx_api/train/converters.cc @@ -18,7 +18,7 @@ #include "include/api/cfg.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { Status A2L_ConvertConfig(const TrainCfg *a_train_cfg, lite::TrainCfg *l_train_cfg) { if ((a_train_cfg == nullptr) || (l_train_cfg == nullptr)) { MS_LOG(ERROR) << "Invalid train_cfg pointers"; @@ -34,4 +34,4 @@ Status A2L_ConvertConfig(const TrainCfg *a_train_cfg, lite::TrainCfg *l_train_cf l_train_cfg->accumulate_gradients_ = a_train_cfg->accumulate_gradients_; return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/train/model.cc b/mindspore-lite/src/litert/cxx_api/train/model.cc index 7ac2c3c157a15ddaabf56927d8ac2afea52e3941..32ab53f7550c7a22a978d55be288ca861be68289 100644 --- a/mindspore-lite/src/litert/cxx_api/train/model.cc +++ b/mindspore-lite/src/litert/cxx_api/train/model.cc @@ -23,7 +23,7 @@ #include "src/train/train_loop.h" #include "include/train/train_loop_callback.h" -namespace mindspore { +namespace mindspore::lite { Status Model::Train(int epochs, std::shared_ptr ds, std::vector i_cbs) { if ((impl_ == nullptr) || (impl_->session_ == nullptr) || ds == nullptr) { MS_LOG(ERROR) << "Model implement or dataset is null."; @@ -106,4 +106,4 @@ Status Model::Finalize() { MS_LOG(INFO) << "Finalize is only support for mindspore_lite's ascend inference backend."; return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/train/model_build.cc b/mindspore-lite/src/litert/cxx_api/train/model_build.cc index 6ec79777dffc73197def8b8aa2f6c02dc9139731..3df13bb7e158760ed7fae6193684674ef2e0d669 100644 --- a/mindspore-lite/src/litert/cxx_api/train/model_build.cc +++ b/mindspore-lite/src/litert/cxx_api/train/model_build.cc @@ -17,7 +17,7 @@ #include "include/api/model.h" #include "src/common/log_adapter.h" #include "src/litert/cxx_api/model/model_impl.h" -namespace mindspore { +namespace mindspore::lite { Status Model::BuildTransferLearning(GraphCell backbone, GraphCell head, const std::shared_ptr &context, const std::shared_ptr &train_cfg) { std::stringstream err_msg; @@ -49,4 +49,4 @@ Status Model::BuildTransferLearning(GraphCell backbone, GraphCell head, const st } return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/train/model_build_impl.cc b/mindspore-lite/src/litert/cxx_api/train/model_build_impl.cc index ef5617083acec6056751b22f22c15b8f396f57b0..66530e1d403aab411474b82fd538842196f05a40 100644 --- a/mindspore-lite/src/litert/cxx_api/train/model_build_impl.cc +++ b/mindspore-lite/src/litert/cxx_api/train/model_build_impl.cc @@ -18,7 +18,7 @@ #include "include/train/train_cfg.h" #include "src/litert/cxx_api/converters.h" #include "src/train/transfer_session.h" -namespace mindspore { +namespace mindspore::lite { Status ModelImpl::BuildTransferLearning(const std::shared_ptr &backbone, const std::shared_ptr &head) { const auto b_graph_data = backbone->graph_data_; const auto h_graph_data = head->graph_data_; @@ -57,4 +57,4 @@ Status ModelImpl::BuildTransferLearning(const std::shared_ptr &backbone, MS_LOG(DEBUG) << "Session is not a train session."; return kLiteError; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/train/model_impl.cc b/mindspore-lite/src/litert/cxx_api/train/model_impl.cc index 726b0585f7396a8ec2b7ff791e16cf317bbf41d4..d02f952944e4cdab93923a4a79b03664a50db075 100644 --- a/mindspore-lite/src/litert/cxx_api/train/model_impl.cc +++ b/mindspore-lite/src/litert/cxx_api/train/model_impl.cc @@ -29,7 +29,7 @@ #include "src/train/train_session.h" #include "src/train/transfer_session.h" -namespace mindspore { +namespace mindspore::lite { Status ModelImpl::PrepareMetrics(Model *model, std::vector *out_ms, std::vector *adapter_ms) { if (out_ms == nullptr || adapter_ms == nullptr) { @@ -100,4 +100,4 @@ Status ModelImpl::ConvertCallbacks(Model *model, std::vector *i } return kSuccess; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/train/train_support.cc b/mindspore-lite/src/litert/cxx_api/train/train_support.cc index 13c68a3b57be04877f1f242aa48243719644d1c1..47073b8a21acf863819e29232f521590728edf2a 100644 --- a/mindspore-lite/src/litert/cxx_api/train/train_support.cc +++ b/mindspore-lite/src/litert/cxx_api/train/train_support.cc @@ -38,7 +38,7 @@ #include "src/train/train_session.h" #include "src/train/static_allocator.h" -namespace mindspore { +namespace mindspore::lite { std::shared_ptr CreateTrainSession(std::shared_ptr graph_data, std::shared_ptr cfg, const std::shared_ptr &context) { @@ -97,4 +97,4 @@ class TrainSupport { }; TrainSupport support_train_api; -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/cxx_api/types.cc b/mindspore-lite/src/litert/cxx_api/types.cc index dab419444704264915eaf3e887560e164c77c7cb..6f7d192e25e691f257d5d4f5af3274208030eb2b 100644 --- a/mindspore-lite/src/litert/cxx_api/types.cc +++ b/mindspore-lite/src/litert/cxx_api/types.cc @@ -31,7 +31,7 @@ #include "src/extendrt/delegate/ascend_acl/ascend_allocator_plugin.h" #endif -namespace mindspore { +namespace mindspore::lite { class Buffer::Impl { public: Impl() : data_() {} @@ -735,4 +735,4 @@ std::vector CharVersion() { std::string version = VERSION_STR; return StringToChar("MindSpore Lite " + version); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/delegate/coreml/stub/coreml_delegate_stub.cc b/mindspore-lite/src/litert/delegate/coreml/stub/coreml_delegate_stub.cc index 992dff07c58e386fef802b2bda25c4095d973304..9f1fb3516ada4b34b8628c17cd8366381c56bbab 100644 --- a/mindspore-lite/src/litert/delegate/coreml/stub/coreml_delegate_stub.cc +++ b/mindspore-lite/src/litert/delegate/coreml/stub/coreml_delegate_stub.cc @@ -16,7 +16,7 @@ #include "include/api/delegate.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { Status CoreMLDelegate::Init() { MS_LOG(ERROR) << "Only supported by IOS system and the MSLITE_ENABLE_COREML is turned on"; return kLiteError; @@ -26,4 +26,4 @@ Status CoreMLDelegate::Build(DelegateModel *model) { MS_LOG(ERROR) << "Only supported by IOS system and the MSLITE_ENABLE_COREML is turned on"; return kLiteError; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/cache_algorithm.h b/mindspore-lite/src/litert/delegate/parameter_cache/cache_algorithm.h index c496b76b947e551db04857882b0bfc280af234b5..f64180bec6101d6f2db862186a5a91f638142cae 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/cache_algorithm.h +++ b/mindspore-lite/src/litert/delegate/parameter_cache/cache_algorithm.h @@ -20,7 +20,7 @@ #include #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { namespace cache { struct CacheNoe { CacheNoe(int _index, int _frequency, int _value) : key(_index), frequency(_frequency), value(_value) {} @@ -39,5 +39,5 @@ class CacheAlgorithm { std::vector *need_swap_indies, std::vector *need_swap_indies_cache_index) = 0; }; } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_PARAMETER_CACHE_CACHE_ALGORITHM_H_ diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/cache_mem_base.h b/mindspore-lite/src/litert/delegate/parameter_cache/cache_mem_base.h index 8844e7874042f26ac37fbee1ecdb82a6cf3e81e0..240f076325b3c615e0c2441b11eb3ec4f1ed047f 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/cache_mem_base.h +++ b/mindspore-lite/src/litert/delegate/parameter_cache/cache_mem_base.h @@ -19,7 +19,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace cache { class CacheMemBase { public: @@ -37,5 +37,5 @@ class CacheMemBase { size_t cache_vocab_size, size_t embedding_size, size_t swap_in_size) = 0; }; } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_PARAMETER_CACHE_CACHE_MEM_BASE_H_ diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache.cc b/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache.cc index d41485e65813a5d3f56c1fc4cddd909ca4fbb2d8..f12169c66c4520fb8c9651f3784a95f912c699be 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache.cc +++ b/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache.cc @@ -29,7 +29,7 @@ namespace { constexpr size_t kEmbeddingTensorShapeSize = 2; } -namespace mindspore { +namespace mindspore::lite { namespace cache { void LookUpTableTask(size_t indices_lens, size_t first_dim_size, const char *input_addr, const int *indices_addr, char *output_addr, size_t embedding_len, int min_host_index) { @@ -234,4 +234,4 @@ Status EmbeddingCache::CheckCacheHit(const int *batch_ids, const size_t batch_id return kSuccess; } } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache.h b/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache.h index ba3c1d895d4d806c6f9dff14d4961e91579b7bec..3997e7d5e30bc80ac5038d09d7f3d44a075cea01 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache.h +++ b/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache.h @@ -26,7 +26,7 @@ #include "src/litert/delegate/parameter_cache/cache_algorithm.h" #include "src/litert/delegate/parameter_cache/cache_mem_base.h" -namespace mindspore { +namespace mindspore::lite { namespace cache { class EmbeddingCache { public: @@ -89,5 +89,5 @@ class EmbeddingCache { int max_host_index_{0}; }; } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_PARAMETER_CACHE_EMBEDDING_CACHE_H_ diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache_manager.cc b/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache_manager.cc index 3023d1a5095492ca9ccd82dd0cecee352e018956..c153ca9cbb86e4903d5dd01de0ee4d194c762c30 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache_manager.cc +++ b/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache_manager.cc @@ -23,7 +23,7 @@ namespace { constexpr size_t kGatherInputsSize = 3; } -namespace mindspore { +namespace mindspore::lite { namespace cache { Status EmbeddingCacheManager::Init(const std::string &cache_model_path, size_t vocab_size, size_t device_cache_size) { if (cache_model_path.empty() || vocab_size == 0 || device_cache_size >= vocab_size) { @@ -191,4 +191,4 @@ int EmbeddingCacheManager::CacheHandle(const std::string &tensor_name, mindspore return lite::RET_OK; } } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache_manager.h b/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache_manager.h index c811384f34dae5f524329bf39bda47963230e754..6bf15661cfaca1adef69e49b0f25edf85996a00c 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache_manager.h +++ b/mindspore-lite/src/litert/delegate/parameter_cache/embedding_cache_manager.h @@ -27,7 +27,7 @@ #include "src/litert/delegate/parameter_cache/load_host_cache_model.h" #include "src/litert/delegate/tensorrt/distribution/distribution_base.h" -namespace mindspore { +namespace mindspore::lite { namespace cache { class EmbeddingCacheManager { public: @@ -58,5 +58,5 @@ class EmbeddingCacheManager { size_t device_cache_size_; }; } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_PARAMETER_CACHE_EMBEDDING_CACHE_MANAGER_H_ diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/gpu/gpu_cache_mem.cc b/mindspore-lite/src/litert/delegate/parameter_cache/gpu/gpu_cache_mem.cc index 4132f922718e70f46a019f704c42f56e78a6dda1..4fbf30a33086457aabd1eecf5ebaff98c8db3130 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/gpu/gpu_cache_mem.cc +++ b/mindspore-lite/src/litert/delegate/parameter_cache/gpu/gpu_cache_mem.cc @@ -21,7 +21,7 @@ #include "plugin/res_manager/gpu/device/cuda_driver.h" #include "src/common/log_adapter.h" #include "src/litert/delegate/parameter_cache/factory_mgr_base.h" -namespace mindspore { +namespace mindspore::lite { namespace cache { namespace gpu { RET_COMMON_PRODUCT_REGISTRAR(std::string, cache::CacheMemBase, cache::gpu::GPUCacheMem, "gpu", GPUCacheMem); @@ -156,4 +156,4 @@ bool GPUCacheMem::HashSwapIn(void *hash_table_addr, void *swap_in_value_addr, vo } } // namespace gpu } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/gpu/gpu_cache_mem.h b/mindspore-lite/src/litert/delegate/parameter_cache/gpu/gpu_cache_mem.h index 739eba7c31f830e6bb77abb2d54924753627690f..cea39eafc0e34979dfb3a80e3554ea1d3d61ee38 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/gpu/gpu_cache_mem.h +++ b/mindspore-lite/src/litert/delegate/parameter_cache/gpu/gpu_cache_mem.h @@ -21,7 +21,7 @@ #include #include "src/litert/delegate/parameter_cache/cache_mem_base.h" -namespace mindspore { +namespace mindspore::lite { namespace cache { namespace gpu { class GPUCacheMem : public cache::CacheMemBase { @@ -45,5 +45,5 @@ class GPUCacheMem : public cache::CacheMemBase { }; } // namespace gpu } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_PARAMETER_CACHE_GPU_GPU_CACHE_MEM_H_ diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/lfu_cache.cc b/mindspore-lite/src/litert/delegate/parameter_cache/lfu_cache.cc index b00e4d988895bce353a6a0014e9c9f5879d08687..23ee1e6169bf3c168a7508f742a0eabdbd96c62b 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/lfu_cache.cc +++ b/mindspore-lite/src/litert/delegate/parameter_cache/lfu_cache.cc @@ -18,7 +18,7 @@ #include "src/common/log_adapter.h" #include "src/litert/delegate/parameter_cache/lfu_cache.h" #include "src/litert/delegate/parameter_cache/factory_mgr_base.h" -namespace mindspore { +namespace mindspore::lite { namespace cache { RET_COMMON_PRODUCT_REGISTRAR(std::string, cache::CacheAlgorithm, cache::LFUCacheAlgorithm, "lfu", LFUCacheAlgorithm); @@ -240,4 +240,4 @@ Status LFUCacheAlgorithm::CheckCacheHit(const int *batch_ids, const size_t batch return kSuccess; } } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/lfu_cache.h b/mindspore-lite/src/litert/delegate/parameter_cache/lfu_cache.h index 1e5d0f87f089a92e49c46a918363a223e51606fd..48445168242b0be93bcf257e5c91fe8be2f4dd90 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/lfu_cache.h +++ b/mindspore-lite/src/litert/delegate/parameter_cache/lfu_cache.h @@ -23,7 +23,7 @@ #include #include "include/api/status.h" #include "src/litert/delegate/parameter_cache/cache_algorithm.h" -namespace mindspore { +namespace mindspore::lite { namespace cache { class LFUCacheAlgorithm : public CacheAlgorithm { public: @@ -51,5 +51,5 @@ class LFUCacheAlgorithm : public CacheAlgorithm { int max_host_index_{1}; }; } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_PARAMETER_CACHE_LFU_CACHE_H_ diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/load_host_cache_model.cc b/mindspore-lite/src/litert/delegate/parameter_cache/load_host_cache_model.cc index d3da0e4b44d5467db16dbd473bf79608ac4f5fa0..a5b2a5afb7ab9db6fd75b276acf62d2bdd7972a0 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/load_host_cache_model.cc +++ b/mindspore-lite/src/litert/delegate/parameter_cache/load_host_cache_model.cc @@ -27,7 +27,7 @@ namespace { constexpr size_t kGatherInputsSize = 3; } -namespace mindspore { +namespace mindspore::lite { namespace cache { HostCacheModel::~HostCacheModel() { if (cache_model_ != nullptr) { @@ -145,4 +145,4 @@ MSTensor HostCacheModel::GetHostCacheTensor(kernel::Kernel *kernel) { return MSTensor(nullptr); } } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/delegate/parameter_cache/load_host_cache_model.h b/mindspore-lite/src/litert/delegate/parameter_cache/load_host_cache_model.h index 93e5217151ee90a421e1f5e343c5c19c3685cc60..a45ab64b2cfbed57d81fccf18f9de4832fcce99f 100644 --- a/mindspore-lite/src/litert/delegate/parameter_cache/load_host_cache_model.h +++ b/mindspore-lite/src/litert/delegate/parameter_cache/load_host_cache_model.h @@ -26,7 +26,7 @@ #include "include/api/delegate.h" #include "src/litert/lite_model.h" -namespace mindspore { +namespace mindspore::lite { namespace cache { class HostCacheModel { public: @@ -44,5 +44,5 @@ class HostCacheModel { size_t model_size_; }; } // namespace cache -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_EMBEDDING_CACHE_H_ diff --git a/mindspore-lite/src/litert/inner_allocator.cc b/mindspore-lite/src/litert/inner_allocator.cc index f96d7d65d26314d4f5e4b1bd841d88a255e7eaf7..0886f10e728a731884e89541c147ecb065f03e93 100644 --- a/mindspore-lite/src/litert/inner_allocator.cc +++ b/mindspore-lite/src/litert/inner_allocator.cc @@ -19,7 +19,7 @@ #include "src/common/log_adapter.h" #include "src/common/utils.h" -namespace mindspore { +namespace mindspore::lite { DefaultAllocator::DefaultAllocator(size_t aligned_size) { aligned_size_ = aligned_size; max_malloc_size_ = lite::GetMaxMallocSize(); @@ -178,4 +178,4 @@ void DefaultAllocator::Clear() { freeList_.clear(); UnLock(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/inner_allocator.h b/mindspore-lite/src/litert/inner_allocator.h index 8c89508ca01eaae778a4354e9632ea0b82dee742..c87dffee838f664ad1d5819683f56db5a58fafa6 100644 --- a/mindspore-lite/src/litert/inner_allocator.h +++ b/mindspore-lite/src/litert/inner_allocator.h @@ -27,7 +27,7 @@ #include #include "include/api/allocator.h" -namespace mindspore { +namespace mindspore::lite { struct AllocatorContext { int shiftFactor; bool lockFlag; @@ -71,6 +71,6 @@ class DefaultAllocator : public Allocator { constexpr int64_t MAX_MALLOC_SIZE = static_cast(2000) * 1024 * 1024; constexpr int64_t MAX_THREAD_POOL_SIZE = static_cast(3000) * 1024 * 1024; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_INNER_ALLOCATOR_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/arithmetic_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/arithmetic_base.cc index 7b97daddb45c603e25cdc9362f37e8cebe2d2625..88b2fce5e9dd32f9149b62f367ec31062886df94 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/arithmetic_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/arithmetic_base.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ArithmeticBaseRun(void *cdata, int task_id, float lhs_scale, float rhs_scale) { auto kernel = reinterpret_cast(cdata); CHECK_NULL_RETURN(kernel); @@ -453,4 +453,4 @@ void ArithmeticBaseCPUKernel::ComputeOffset(int task_id) { block_boundary_infos_[task_id].b_offset.push_back(b_offset * b_matric_.inner_size * in_data_size_); } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/arithmetic_base.h b/mindspore-lite/src/litert/kernel/cpu/base/arithmetic_base.h index 3e3ad63dc3005ea57419ab62a76152de5f2d2399..b868b7e0926963dc4d195d32a44daceaafa00764 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/arithmetic_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/arithmetic_base.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/arithmetic_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArithmeticBaseCPUKernel : public LiteKernel { public: ArithmeticBaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -95,5 +95,5 @@ class ArithmeticBaseCPUKernel : public LiteKernel { std::vector broadcast_buffer_; std::vector block_boundary_infos_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_ARITHMETIC_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/assert.cc b/mindspore-lite/src/litert/kernel/cpu/base/assert.cc index dcac9666e9964410c5751570cf5e65d682c631c1..3acda260ac4c3a55908d134f02603f74bec5fad3 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/assert.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/assert.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Assert; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int AssertCPUKernel::Prepare() { CHECK_NOT_EQUAL_RETURN(in_tensors_.size(), 1); CHECK_NOT_EQUAL_RETURN(out_tensors_.size(), 1); @@ -50,4 +50,4 @@ int AssertCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Assert, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Assert, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_Assert, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/assert.h b/mindspore-lite/src/litert/kernel/cpu/base/assert.h index 2a1f48b5b7b92fa1ba43514597818cb9186ca3ba..0b9f6f16eb74168792c164687d5bfe4423542bbd 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/assert.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/assert.h @@ -19,7 +19,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class AssertCPUKernel : public LiteKernel { public: AssertCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,6 +31,6 @@ class AssertCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_ASSERT_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/call.cc b/mindspore-lite/src/litert/kernel/cpu/base/call.cc index a894aa1903abf104cf3dd0fa95a904464d19d24e..c4d004d25e9371245ca9e70e4dadf527946d4907 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/call.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/call.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Call; // this file is useless when move create actor before schedule. -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int CallCPUKernel::Prepare() { return RET_OK; } int CallCPUKernel::ReSize() { return RET_OK; } int CallCPUKernel::Run() { return RET_OK; } @@ -34,4 +34,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Call, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_Call, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_Call, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/call.h b/mindspore-lite/src/litert/kernel/cpu/base/call.h index 81fefd067293867f774d024c9378a1d6c0e37dce..b455f64b7d29b4614d129b535286a6337cece068 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/call.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/call.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" // this file is useless when move create actor before schedule. -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CallCPUKernel : public LiteKernel { public: CallCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -32,6 +32,6 @@ class CallCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_CALL_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/constant_of_shape.cc b/mindspore-lite/src/litert/kernel/cpu/base/constant_of_shape.cc index e31bc3d6ebf3c688a53dcb3f6062cca757dee1a8..769fd0f6d14bca23cfb485e4572b2fd64ba46d0f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/constant_of_shape.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/constant_of_shape.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ConstantOfShape; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConstantOfShapeRun(void *cdata, int task_id, float lhs_scale, float rhs_scale) { auto g_kernel = reinterpret_cast(cdata); CHECK_NULL_RETURN(g_kernel); @@ -105,4 +105,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_ConstantOfShape, LiteKernelCr REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_ConstantOfShape, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt64, PrimitiveType_ConstantOfShape, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_ConstantOfShape, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/constant_of_shape.h b/mindspore-lite/src/litert/kernel/cpu/base/constant_of_shape.h index b2032cab5a1c30d13a44c68df7aef965b52272e6..1ec0c30e4b05b9fd7a67096cd05741408ddaf82b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/constant_of_shape.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/constant_of_shape.h @@ -23,7 +23,7 @@ #include "nnacl_c/fp32/constant_of_shape_fp32.h" #include "nnacl_c/fp16/constant_of_shape_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConstantOfShapeCPUKernel : public LiteKernel { public: ConstantOfShapeCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -43,6 +43,6 @@ class ConstantOfShapeCPUKernel : public LiteKernel { void *output_ptr_ = nullptr; int thread_stride_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_CONSTANT_OF_SHAPE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/convolution_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/convolution_base.cc index 0aedf4b94cba02af288039a08099d45d5393df67..dc3ff788976fe5b9151f30000145c4aa03ce3f58 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/convolution_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/convolution_base.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; using mindspore::schema::ActivationType; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void *ConvolutionBaseCPUKernel::MallocAlignedData(size_t alignment, size_t size) { MS_CHECK_TRUE_RET(size + alignment < MAX_MALLOC_SIZE, nullptr); auto ptr = malloc(size + alignment); @@ -574,4 +574,4 @@ void *ConvolutionBaseCPUKernel::GetConvPackWeightData(size_t data_size) { } return data; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/convolution_base.h b/mindspore-lite/src/litert/kernel/cpu/base/convolution_base.h index cc69c621b2ae6585df40e7920c9dd1963418d27b..fb1564347821776d6c19714c21781c8f13a293ee 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/convolution_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/convolution_base.h @@ -35,7 +35,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionBaseCPUKernel : public LiteKernel { public: ConvolutionBaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -95,6 +95,6 @@ class ConvolutionBaseCPUKernel : public LiteKernel { void *origin_bias_; // do not free bool use_batch_cut_flag_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_CONVOLUTION_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/custom_is_inf.cc b/mindspore-lite/src/litert/kernel/cpu/base/custom_is_inf.cc index 44ac568e4d0e3e5811c85f6e683e0f6c9e09187d..fc62faec4a8e488ac0db8af5d0feb1fd02855712 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/custom_is_inf.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/custom_is_inf.cc @@ -23,7 +23,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int CustomIsInfCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C1NUM); @@ -58,4 +58,4 @@ int CustomIsInfCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimType_Inner_CustomIsInf, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/custom_is_inf.h b/mindspore-lite/src/litert/kernel/cpu/base/custom_is_inf.h index e63d8ec7160cb0f87a7e5ff12d4295f447458825..da3457a7238cc390927e8dee9f717479c3bb50e9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/custom_is_inf.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/custom_is_inf.h @@ -19,7 +19,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CustomIsInfCPUKernel : public LiteKernel { public: CustomIsInfCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -33,6 +33,6 @@ class CustomIsInfCPUKernel : public LiteKernel { private: void LaunchKernelFloat(const float *input, bool *output); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_IS_INF_CPU_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/custom_masked_fill.cc b/mindspore-lite/src/litert/kernel/cpu/base/custom_masked_fill.cc index cb384f0ad62af73c42f848c0174597a5ff5b9d3d..2e08c51cd211fc13d00424b4b202f8f5ac49a72d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/custom_masked_fill.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/custom_masked_fill.cc @@ -23,7 +23,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int CustomMaskedFillCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C3NUM); @@ -87,4 +87,4 @@ int CustomMaskedFillCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimType_Inner_CustomMaskedFill, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/custom_masked_fill.h b/mindspore-lite/src/litert/kernel/cpu/base/custom_masked_fill.h index 04a2dcab8025281208360cf122cdb1c4b02c75fd..d4788f698d9793304071d6bd8f16a82388c58ee4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/custom_masked_fill.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/custom_masked_fill.h @@ -19,7 +19,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CustomMaskedFillCPUKernel : public LiteKernel { public: CustomMaskedFillCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,6 +30,6 @@ class CustomMaskedFillCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CUSTOM_MASKED_FILL_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/custom_tensor_scatter.cc b/mindspore-lite/src/litert/kernel/cpu/base/custom_tensor_scatter.cc index be974c847c3b933b4b3ad08fff253be49dc658fa..4f2fdbb90dfd500b6e4813a067bd4c5cecf05de1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/custom_tensor_scatter.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/custom_tensor_scatter.cc @@ -26,7 +26,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int TensorScatterRun(void *cdata, int task_id, float, float) { auto kernel = static_cast(cdata); @@ -71,4 +71,4 @@ int CustomTensorScatterCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimType_Inner_CustomTensorScatterMax, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/custom_tensor_scatter.h b/mindspore-lite/src/litert/kernel/cpu/base/custom_tensor_scatter.h index e39733c56fcd45649bc011ee64c8b745967987f9..a1e565957e569a4335c74391a063d13db81588de 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/custom_tensor_scatter.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/custom_tensor_scatter.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/base/scatter_nd_binary.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CustomTensorScatterCPUKernel : public ScatterNDBinaryCPUKernel { public: explicit CustomTensorScatterCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,6 +31,6 @@ class CustomTensorScatterCPUKernel : public ScatterNDBinaryCPUKernel { int Run() override; int TensorScatterDispatch(int task_id); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_BASE_TENSOR_SCATTER_ADD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/detection_post_process_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/detection_post_process_base.cc index a13c9c9067f313a84e4ee7e9b21394a76d903a0e..26422557a45bfe7d17f1b651c7b91fffe6d8267c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/detection_post_process_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/detection_post_process_base.cc @@ -32,7 +32,7 @@ namespace { const constexpr int kSecondTensorIndex = 2; } -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void PartialArgSort(const float *scores, int *indexes, int num_to_sort, int num_values) { std::partial_sort(indexes, indexes + num_to_sort, indexes + num_values, [&scores](const int i, const int j) { if (std::abs(scores[i] - scores[j]) < FLT_EPSILON) { @@ -285,4 +285,4 @@ int DetectionPostProcessBaseCPUKernel::Run() { FreeAllocatedBuffer(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/detection_post_process_base.h b/mindspore-lite/src/litert/kernel/cpu/base/detection_post_process_base.h index 41e0458b1034e6fcc20657ab20bf549ec7b1f57f..4e4d11b24fe3b90792a0bba3788771fa16a0fbef 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/detection_post_process_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/detection_post_process_base.h @@ -23,7 +23,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DetectionPostProcessBaseCPUKernel : public LiteKernel { public: DetectionPostProcessBaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -49,5 +49,5 @@ class DetectionPostProcessBaseCPUKernel : public LiteKernel { virtual int GetInputData() = 0; int ParamInit(); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_DETECTION_POST_PROCESS_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/format_transpose.cc b/mindspore-lite/src/litert/kernel/cpu/base/format_transpose.cc index 7f77e9780e57159d96e370c706ad4e1061b3fa3d..9b593530ff2ece3979dc2d970c0ae5b55fee5f38 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/format_transpose.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/format_transpose.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_FormatTranspose; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int FormatTransposeCPUKernel::Run() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -76,4 +76,4 @@ std::string FormatTransposeCPUKernel::name() const { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_FormatTranspose, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_FormatTranspose, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/format_transpose.h b/mindspore-lite/src/litert/kernel/cpu/base/format_transpose.h index 1468808d934b284ea88a0ea3762c0e4c792b028e..e00da65fb947745d1ea99e5174817fb2da06a269 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/format_transpose.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/format_transpose.h @@ -22,7 +22,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/format_transpose_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class FormatTransposeCPUKernel : public LiteKernel { public: FormatTransposeCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -39,5 +39,5 @@ class FormatTransposeCPUKernel : public LiteKernel { private: FormatTransposeParameter *param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_FORMAT_TRANSPOSE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_base.cc index eda78f6ba545451cfeda5819d5936e9b9bf121a3..096c6e975de831f7c0e626951a43df8f749bb38f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_base.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int GroupConvolutionBaseCPUKernel::Prepare() { for (int i = 0; i < group_num_; ++i) { auto sub_conv = group_convs_.at(i); @@ -212,4 +212,4 @@ int GroupConvolutionBaseCPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_base.h b/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_base.h index e11b85dd9f3b256a52b83e6db42d8fb36921f4b9..48dbf6144e1e2d002e1924e8f61d66b939cfc8bf 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_base.h @@ -25,7 +25,7 @@ #include "nnacl_c/fp32/conv_common_fp32.h" #include "src/litert/kernel/cpu/base/group_convolution_creator.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GroupConvolutionBaseCPUKernel : public ConvolutionBaseCPUKernel { public: GroupConvolutionBaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -62,6 +62,6 @@ class GroupConvolutionBaseCPUKernel : public ConvolutionBaseCPUKernel { int ori_out_channel_ = 0; int out_thread_num_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_GROUP_CONVOLUTION_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_creator.cc b/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_creator.cc index 25cb776bb1657cdbe418bc6c9b833363ec17184f..55a40f69e96307d7ade47233741c841a0fcbb9cd 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_creator.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_creator.cc @@ -16,7 +16,7 @@ #include "src/litert/kernel/cpu/base/group_convolution_creator.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void CopyTensorQuantParam(lite::Tensor *dst, const lite::Tensor *src) { for (size_t i = 0; i < src->quant_params().size(); i++) { dst->AddQuantParam(src->quant_params().at(i)); @@ -237,4 +237,4 @@ int GroupConvCreator::GetSingleConvParam(ConvParameter *conv_param, std::vector< } return lite::RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_creator.h b/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_creator.h index c362a7ef1e4bd4f691a734d751bcdd5d079089f8..5b4ec0a32a319b51edb0adf1bfd614df48d478bd 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_creator.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/group_convolution_creator.h @@ -24,7 +24,7 @@ #include "src/litert/tensor_category.h" #include "include/api/allocator.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { struct TensorInfo { std::vector shape_; AllocatorPtr allocator_; @@ -82,6 +82,6 @@ class GroupConvCreator { }; ConvParameter *CreateNewConvParameter(const ConvParameter *parameter); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_GROUP_CONVOLUTION_CREATOR_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/layout_transform.cc b/mindspore-lite/src/litert/kernel/cpu/base/layout_transform.cc index 32ffe2714cccfd20e6a0c9c225891619c906bf9b..f2e1cf907aa596657a9f4278f11b63d1466fa54e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/layout_transform.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/layout_transform.cc @@ -18,7 +18,7 @@ #include "src/common/log_adapter.h" #include "schema/ops_types_generated.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { LayoutConvertor LayoutTransformFp32(mindspore::Format src_format, mindspore::Format dst_format) { if (src_format == mindspore::NHWC && dst_format == mindspore::NC4HW4) { return PackNHWCToNC4HW4Fp32; @@ -55,4 +55,4 @@ LayoutConvertor LayoutTransform(TypeId data_type, mindspore::Format src_format, return nullptr; } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/layout_transform.h b/mindspore-lite/src/litert/kernel/cpu/base/layout_transform.h index db0fb59fbfcfb53a97e381191d3de766f8ee1679..37b147a942c24051d1c82a6fd6ef0fb075aefc24 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/layout_transform.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/layout_transform.h @@ -23,7 +23,7 @@ #include "nnacl_c/pack.h" #include "src/tensor.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { typedef void (*LayoutConvertor)(const void *src, void *dst, int batch, int plane, int channel); #ifdef ENABLE_FP16 LayoutConvertor LayoutTransformFp16(mindspore::Format src_format, mindspore::Format dst_format); @@ -34,6 +34,6 @@ LayoutConvertor LayoutTransformFp32(mindspore::Format src_format, mindspore::For LayoutConvertor LayoutTransformInt8(mindspore::Format src_format, mindspore::Format dst_format); LayoutConvertor LayoutTransform(TypeId data_type, mindspore::Format src_format, mindspore::Format dst_format); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_LAYOUT_TRANSFORM_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/partial_fusion.cc b/mindspore-lite/src/litert/kernel/cpu/base/partial_fusion.cc index 76a52612db825f1887965956f8f97c6d78b84065..8255fe0a8786277891dd5a0dc4657bdb40cb7d68 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/partial_fusion.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/partial_fusion.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_PartialFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int PartialFusionKernel::Prepare() { return RET_OK; } int PartialFusionKernel::ReSize() { return RET_OK; } int PartialFusionKernel::Run() { return RET_OK; } @@ -33,4 +33,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_PartialFusion, LiteKernelCrea REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_PartialFusion, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_PartialFusion, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_PartialFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/partial_fusion.h b/mindspore-lite/src/litert/kernel/cpu/base/partial_fusion.h index 9862204c5a404bbec2d1e2b8d6310d486dd07534..8b9bd08c4a4fa06581e5cbf1382d295230163c60 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/partial_fusion.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/partial_fusion.h @@ -21,7 +21,7 @@ #include "src/executor/kernel_exec.h" // this file is going to be removed when move create actor before schedule. -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PartialFusionKernel : public LiteKernel { public: PartialFusionKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,6 +37,6 @@ class PartialFusionKernel : public LiteKernel { // graphs, so use a vector. std::vector subgraph_kernels_{}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_PARTIAL_FUSION_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/quant_dtype_cast.cc b/mindspore-lite/src/litert/kernel/cpu/base/quant_dtype_cast.cc index 812f6dc34de441f59bd41dcb288e0ca783a8373a..8c30a2d8fc09b3ba336a5020202248873d485c8f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/quant_dtype_cast.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/quant_dtype_cast.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_QuantDTypeCast; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int QuantDTypeCastCPUKernel::Prepare() { if (in_tensors_.size() != 1) { MS_LOG(ERROR) << "inputs number should be 1, but " << in_tensors_.size() << " is given."; @@ -319,4 +319,4 @@ int QuantDTypeCastCPUKernel::DoDequanInt8ToFp32ChannelCol(const int8_t *quant_va REG_KERNEL(kCPU, kNumberTypeUInt8, PrimitiveType_QuantDTypeCast, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_QuantDTypeCast, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_QuantDTypeCast, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/quant_dtype_cast.h b/mindspore-lite/src/litert/kernel/cpu/base/quant_dtype_cast.h index 240dc1b55c3ffb13577406cd62cc4ad721d630a3..20f93ade6c449c6dc13f716735c6a4302136661a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/quant_dtype_cast.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/quant_dtype_cast.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class QuantDTypeCastCPUKernel : public LiteKernel { public: QuantDTypeCastCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -72,6 +72,6 @@ class QuantDTypeCastCPUKernel : public LiteKernel { int32_t dst_dtype{0}; int32_t quant_dst_dtype{0}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_QUANT_DTYPE_CAST_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/random_normal.cc b/mindspore-lite/src/litert/kernel/cpu/base/random_normal.cc index 456ee89fbefd2bdbde328b40d767063de2dd6872..b5e3e170af9c44bf3a958431a7cbde9ebd554932 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/random_normal.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/random_normal.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_RandomNormal; using mindspore::schema::PrimitiveType_RandomStandardNormal; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int RandomNormalCPUKernel::Prepare() { CHECK_NULL_RETURN(param_); return RET_OK; @@ -72,4 +72,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_RandomStandardNormal, LiteKer REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_RandomNormal, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_RandomStandardNormal, LiteKernelCreator) #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/random_normal.h b/mindspore-lite/src/litert/kernel/cpu/base/random_normal.h index 91ba1db05d53d4437b6d083f6ce9d53a8861a713..ef2a96a32311aa258e3bd7845e00ff58bbf7f6f8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/random_normal.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/random_normal.h @@ -23,7 +23,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class RandomNormalCPUKernel : public LiteKernel { public: RandomNormalCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class RandomNormalCPUKernel : public LiteKernel { protected: RandomNormalParam *param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_RANDOM_NORMAL_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/reduce_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/reduce_base.cc index 7089577453cee79cafae0341a6be1bfba1b06b5a..ab2460a8f3227c81bfc74916e2d230f1c2ab4b0f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/reduce_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/reduce_base.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kInputNum = 1; constexpr size_t kOutputNum = 1; @@ -205,4 +205,4 @@ void ReduceBaseCPUKernel::DecideIfOnlyCopy() { only_copy_ = false; } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/reduce_base.h b/mindspore-lite/src/litert/kernel/cpu/base/reduce_base.h index 963e808571a7045cd89633105b05ec6226af3a8c..3d133413dde51c43d3f414e189a628ed4f8d52bd 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/reduce_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/reduce_base.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/reduce_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ReduceBaseCPUKernel : public LiteKernel { public: ReduceBaseCPUKernel(OpParameter *param, const std::vector &inputs, @@ -54,6 +54,6 @@ class ReduceBaseCPUKernel : public LiteKernel { int inner_size_{0}; int axis_size_{0}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_REDUCE_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/resize_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/resize_base.cc index eebc0ec8035c7ded2033c4bf6b6c42f652da7aea..a2ee5af4c633c127762cb94b7b0e0f03abeeb9d9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/resize_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/resize_base.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_INVALID_OP_ATTR; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kMaxInputNum = 4; constexpr int kOutputNum = 1; @@ -116,4 +116,4 @@ int ResizeBaseCPUKernel::Prepare() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/resize_base.h b/mindspore-lite/src/litert/kernel/cpu/base/resize_base.h index 1f94416e52cb57c916254ddc56d0f7f641d8b969..1c9e8aa88f5b40b1ff2c3b5777fc7d3057392d02 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/resize_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/resize_base.h @@ -23,7 +23,7 @@ using mindspore::schema::PrimitiveType_Resize; using mindspore::schema::ResizeMethod; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ResizeBaseCPUKernel : public LiteKernel { public: ResizeBaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class ResizeBaseCPUKernel : public LiteKernel { int CheckParameters(); int CheckInputsOuputs(); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_RESIZE_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_base.cc index ea6bfa4f9dcee84f02aa2b3ae030b96b0da9ec84..11ede50216502846f57b9b8dc7965a190c500431 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_base.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ScatterNd; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kScatterIndicesIndex = 0; constexpr int kScatterUpdateIndex = 1; @@ -133,4 +133,4 @@ int ScatterNDCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_ScatterNd, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_base.h b/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_base.h index 043481f971c11add79ac5df3c72e5e62df26ee05..7945e4a691af55a527bab07a1c15b5540c5bf10d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_base.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/base/scatter_nd_binary.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ScatterNDCPUKernel : public LiteKernel { public: explicit ScatterNDCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -41,6 +41,6 @@ class ScatterNDCPUKernel : public LiteKernel { std::vector output_unit_offsets_; std::vector out_strides_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_SCATTER_ND_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_binary.cc b/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_binary.cc index 0c98fedcab14e5873cd773d8d9774f00b74a24d1..6934040edea4456c326fbdd410aebdff1dd2cda8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_binary.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_binary.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ScatterNDBinaryCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), DIMENSION_3D); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -109,4 +109,4 @@ int ScatterNDBinaryCPUKernel::ReSize() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_binary.h b/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_binary.h index 88972f13a022bab3cbce180f8ab82f2ef2165d1e..6f44513b6288c1c2ea99bee247a1ab68a6cce13d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_binary.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/scatter_nd_binary.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/base/scatter_nd_binary.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr int kScatterUpdateInputIndex = 0; constexpr int kScatterIndicesIndex = 1; constexpr int kScatterUpdateIndex = 2; @@ -42,6 +42,6 @@ class ScatterNDBinaryCPUKernel : public LiteKernel { ScatterNDParameter *param_ = nullptr; std::vector output_unit_offsets_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_BASE_SCATTER_ND_BINARY_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/select.cc b/mindspore-lite/src/litert/kernel/cpu/base/select.cc index e8b9882c10c03873d5c8479c4339c4abeee5e36a..c2e7258e5b5eb17258b190ea499eb3cf79792caf 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/select.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/select.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Select; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kConditionIdx = 0; constexpr static int kFirstIdx = 1; constexpr static int kSecondIdx = 2; @@ -190,4 +190,4 @@ int SelectCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_Select, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/select.h b/mindspore-lite/src/litert/kernel/cpu/base/select.h index 44626c09517aba4601c286ac819fe73e99faf79b..635c6a57cbee0b29c0ac6a054e28783252eace82 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/select.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/select.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "src/tensorlist.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SelectCPUKernel : public LiteKernel { public: SelectCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,6 +31,6 @@ class SelectCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_SELECT_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/split_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/split_base.cc index 78b2d5526b8c327e867f0ed02f7e7f9aa1c1e559..60c11b03a17a07717237d5de273ba44e1f58f425 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/split_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/split_base.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Split; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SplitBaseCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -178,4 +178,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Split, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt64, PrimitiveType_Split, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Split, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/split_base.h b/mindspore-lite/src/litert/kernel/cpu/base/split_base.h index 8ec8ce5c3cdaa5e6729fe317b44a469dbcb912cf..72b733822d974e54f9a48c0956b96212ea29f161 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/split_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/split_base.h @@ -23,7 +23,7 @@ #include "nnacl_c/split_parameter.h" #include "nnacl_c/base/split_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SplitBaseCPUKernel : public LiteKernel { public: SplitBaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -50,6 +50,6 @@ class SplitBaseCPUKernel : public LiteKernel { void *input_ptr_ = nullptr; std::vector output_ptr_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_SPLIT_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/split_with_over_lap_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/split_with_over_lap_base.cc index 77cf39ceeac99738de082d32360cdf4c3df78628..3ff58b1a50c5d8fd1d5d7a85bcc94eeb032f2612 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/split_with_over_lap_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/split_with_over_lap_base.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SplitWithOverlap; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { const int MIN_NUM_SPLIT = 2; int SplitWithOverlapBaseCPUKernel::CalculateSplitedShapes(const std::vector &shape) { @@ -152,4 +152,4 @@ int SplitWithOverlapBaseCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SplitWithOverlap, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_SplitWithOverlap, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/split_with_over_lap_base.h b/mindspore-lite/src/litert/kernel/cpu/base/split_with_over_lap_base.h index dc674980848d21a50a2d23ef30623725cd9da213..4fe9278e6e5eb6ed7ec0b4d7e8628ed22e65db64 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/split_with_over_lap_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/split_with_over_lap_base.h @@ -23,7 +23,7 @@ #include "nnacl_c/split_parameter.h" #include "nnacl_c/base/split_with_over_lap_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SplitWithOverlapBaseCPUKernel : public LiteKernel { public: SplitWithOverlapBaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -50,6 +50,6 @@ class SplitWithOverlapBaseCPUKernel : public LiteKernel { char *input_ptr_{nullptr}; std::vector output_ptr_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_SPLIT_WITH_OVER_LAP_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/tensor_scatter_add.cc b/mindspore-lite/src/litert/kernel/cpu/base/tensor_scatter_add.cc index 41af720f042e7a3830aa0f9d0b704e32baa21ebc..29f3bed3d5f1970a384e8b2c67e5f5736052a28c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/tensor_scatter_add.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/tensor_scatter_add.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_TensorScatterAdd; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int TensorScatterAddRun(void *cdata, int task_id, float, float) { auto kernel = static_cast(cdata); @@ -72,4 +72,4 @@ int TensorScatterAddCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_TensorScatterAdd, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_TensorScatterAdd, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/tensor_scatter_add.h b/mindspore-lite/src/litert/kernel/cpu/base/tensor_scatter_add.h index 11ea39f9c2c1d0d9f292f847c401e607aea27b5d..8a70d8310b275b856faec029b527323e76efa335 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/tensor_scatter_add.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/tensor_scatter_add.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/base/scatter_nd_binary.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TensorScatterAddCPUKernel : public ScatterNDBinaryCPUKernel { public: explicit TensorScatterAddCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,6 +31,6 @@ class TensorScatterAddCPUKernel : public ScatterNDBinaryCPUKernel { int Run() override; int TensorScatterAdd(int task_id); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_BASE_TENSOR_SCATTER_ADD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/base/transpose_base.cc b/mindspore-lite/src/litert/kernel/cpu/base/transpose_base.cc index a6b56f077e2f5a8080fa5e4991b5a48284b17eaf..48bd294a676ff3dcdf4fdda11cecece24cc626e8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/transpose_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/base/transpose_base.cc @@ -19,7 +19,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const std::vector kPermOpt = {0, 2, 1}; } // namespace @@ -280,4 +280,4 @@ int TransposeBaseCPUKernel::Run() { } return ParallelLaunch(this->ms_context_, TransposeImpl, this, thread_num_); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/base/transpose_base.h b/mindspore-lite/src/litert/kernel/cpu/base/transpose_base.h index d664ab2b0c8bdee765b208af0bd918b3cfbe3308..eac9e3472231529d6522f99039cf89fc1befbde6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/base/transpose_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/base/transpose_base.h @@ -20,7 +20,7 @@ #include "nnacl_c/transpose_parameter.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TransposeBaseCPUKernel : public LiteKernel { public: explicit TransposeBaseCPUKernel(OpParameter *param, const std::vector &inputs, @@ -75,6 +75,6 @@ class TransposeBaseCPUKernel : public LiteKernel { // optimized perm std::vector perm_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_TRANSPOSE_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/control/switch.cc b/mindspore-lite/src/litert/kernel/cpu/control/switch.cc index 3efbb6ca5fc11265864c79062ea5a7f812ec5f0f..50174e51dc4a25d5203511e7e246a447b2d348a0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/switch.cc +++ b/mindspore-lite/src/litert/kernel/cpu/control/switch.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Switch; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SwitchCPUKernel::Prepare() { return RET_OK; } int SwitchCPUKernel::ReSize() { return RET_OK; } int SwitchCPUKernel::Run() { return RET_OK; } @@ -31,4 +31,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Switch, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_Switch, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_Switch, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/control/switch.h b/mindspore-lite/src/litert/kernel/cpu/control/switch.h index 338725ca427bdd5883c448120e0bad6293411fee..3515268fed75bedab27dd4bde154f43aecf6d94d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/switch.h +++ b/mindspore-lite/src/litert/kernel/cpu/control/switch.h @@ -19,7 +19,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SwitchCPUKernel : public LiteKernel { public: SwitchCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,6 +30,6 @@ class SwitchCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_CONTROL_SWITCH_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/control/switch_layer.cc b/mindspore-lite/src/litert/kernel/cpu/control/switch_layer.cc index 9d41c6ca5664093bbd44453c1c67fe70dfde287f..106ef7e8072d5070df57fdf68f44df026ca273b5 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/switch_layer.cc +++ b/mindspore-lite/src/litert/kernel/cpu/control/switch_layer.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SwitchLayer; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SwitchLayerCPUKernel::Prepare() { return RET_OK; } int SwitchLayerCPUKernel::ReSize() { return RET_OK; } int SwitchLayerCPUKernel::Run() { return RET_OK; } @@ -31,4 +31,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SwitchLayer, LiteKernelCreato REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_SwitchLayer, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_SwitchLayer, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_SwitchLayer, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/control/switch_layer.h b/mindspore-lite/src/litert/kernel/cpu/control/switch_layer.h index c5d2accb96277ede3b05a8a1531b43fa510a85bc..56be98b469be840c0408b432bba8cc41dc195d73 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/switch_layer.h +++ b/mindspore-lite/src/litert/kernel/cpu/control/switch_layer.h @@ -19,7 +19,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SwitchLayerCPUKernel : public LiteKernel { public: SwitchLayerCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,6 +30,6 @@ class SwitchLayerCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_CONTROL_SWITCH_LAYER_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensor_array.cc b/mindspore-lite/src/litert/kernel/cpu/control/tensor_array.cc index 46d0bd369974ba093cd8e43df9ec4d844d358a11..2b0c98c12e758e90caeb8b20b5f6981c5b2c7037 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensor_array.cc +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensor_array.cc @@ -31,7 +31,7 @@ using mindspore::schema::PrimitiveType_TensorArray; using mindspore::schema::PrimitiveType_TensorArrayRead; using mindspore::schema::PrimitiveType_TensorArrayWrite; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr int kTensorArrayReadInSize = 3; constexpr int kTensorArrayWriteInSize = 4; constexpr int kHandleIndex = 0; @@ -166,4 +166,4 @@ int TensorArrayWriteCPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensor_array.h b/mindspore-lite/src/litert/kernel/cpu/control/tensor_array.h index 6413ccdb40f557e32f0802b77ca6dcd6c863f9f3..eb2373403b5a7a1ddf84bc6be9ab103020a712ae 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensor_array.h +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensor_array.h @@ -23,7 +23,7 @@ #include "src/litert/lite_kernel.h" #include "src/tensorlist.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TensorArrayCPUKernel : public LiteKernel { public: TensorArrayCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -83,6 +83,6 @@ class TensorArrayWriteCPUKernel : public TensorArrayBaseCPUKernel { int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_CONTROL_TENSOR_ARRAY_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_fromtensor.cc b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_fromtensor.cc index 9910c83e8c80a6f8a7576b1b23dd9d0a762d363f..d602f71a90f40834da01af6c18c5b1b38f7a4ae4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_fromtensor.cc +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_fromtensor.cc @@ -26,7 +26,7 @@ using mindspore::schema::PrimitiveType_TensorListFromTensor; namespace { constexpr int kNumInputSize = 2; } -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TensorListFromTensorCPUKernel::IsCompatibleShape() { if (input1_->data_type() != kNumberTypeInt && input1_->data_type() != kNumberTypeInt32) { // element_shape MS_LOG(ERROR) << "in_tensors_[1] data type is must be int"; @@ -122,4 +122,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_TensorListFromTensor, REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_TensorListFromTensor, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_TensorListFromTensor, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_fromtensor.h b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_fromtensor.h index 0cbf87fe40ea12ca033b68a8506a92ae7bcf6ce3..4c3f3827e1cfbf4de0c8ddf58c7a8eb79b9a1163 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_fromtensor.h +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_fromtensor.h @@ -23,7 +23,7 @@ #include "schema/model_generated.h" #include "nnacl_c/tensorlist_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TensorListFromTensorCPUKernel : public LiteKernel { public: TensorListFromTensorCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -44,6 +44,6 @@ class TensorListFromTensorCPUKernel : public LiteKernel { lite::Tensor *input1_ = nullptr; TypeId dtype_ = kTypeUnknown; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_CONTROL_TENSORLIST_FROMTENSOR_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_getitem.cc b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_getitem.cc index 722438eda53c8172ccb8c0878f58db74ed6d324b..66fcd6b9bdd95711baab90bdae69e7480f1d9946 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_getitem.cc +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_getitem.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_TensorListGetItem; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TensorListGetItemCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), kInputSize1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -75,4 +75,4 @@ int TensorListGetItemCPUKernel::ReSize() { return RET_OK; } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_TensorListGetItem, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_TensorListGetItem, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_TensorListGetItem, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_getitem.h b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_getitem.h index 374c82340596c5cd638443c87a89c4467aad0327..29525dc3c04575047e7fd5669bfb83e4dcd98142 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_getitem.h +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_getitem.h @@ -23,7 +23,7 @@ #include "schema/model_generated.h" #include "nnacl_c/tensorlist_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TensorListGetItemCPUKernel : public LiteKernel { public: TensorListGetItemCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -41,6 +41,6 @@ class TensorListGetItemCPUKernel : public LiteKernel { int index_ = 0; int dtype_ = kTypeUnknown; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_CONTROL_TENSORLIST_GETITEM_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_reserve.cc b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_reserve.cc index a8e51e6db1eba2f5cdbb669ffd54a420a13952f0..8fe3e0dfc8350180fee320f113b232aba4991b00 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_reserve.cc +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_reserve.cc @@ -27,7 +27,7 @@ using mindspore::schema::PrimitiveType_TensorListReserve; namespace { constexpr int kNumInputSize = 2; } -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TensorListReserveCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), kNumInputSize); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -67,4 +67,4 @@ int TensorListReserveCPUKernel::ReSize() { return RET_OK; } REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_TensorListReserve, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_TensorListReserve, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_TensorListReserve, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_reserve.h b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_reserve.h index 4fdb8d9299324ada4258f8ad0e8e92e6294f55ed..84fb2eb9fa607e3f93106197286bb4535301663a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_reserve.h +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_reserve.h @@ -23,7 +23,7 @@ #include "schema/model_generated.h" #include "nnacl_c/tensorlist_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TensorListReserveCPUKernel : public LiteKernel { public: TensorListReserveCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -39,6 +39,6 @@ class TensorListReserveCPUKernel : public LiteKernel { private: TypeId element_dtype_ = kTypeUnknown; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_CONTROL_TENSORLIST_RESERVE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_setitem.cc b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_setitem.cc index 7f7a3b614186f8fd98a9d7d6927d795ef7c70312..a2500e2a5fffe51513e8454c8bf35cc3877e46cb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_setitem.cc +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_setitem.cc @@ -28,7 +28,7 @@ namespace { constexpr int kNumInputSize = 3; constexpr int kNumInput2 = 2; } // namespace -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TensorListSetItemCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), kNumInputSize); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -157,4 +157,4 @@ int TensorListSetItemCPUKernel::ReSize() { return RET_OK; } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_TensorListSetItem, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_TensorListSetItem, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_TensorListSetItem, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_setitem.h b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_setitem.h index f3f516ba64c1eab2109d4551493a8bb8c527a3c3..a27e5b09289dbf81030e34eb33161253c96c0521 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_setitem.h +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_setitem.h @@ -23,7 +23,7 @@ #include "schema/model_generated.h" #include "nnacl_c/tensorlist_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TensorListSetItemCPUKernel : public LiteKernel { public: TensorListSetItemCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -44,6 +44,6 @@ class TensorListSetItemCPUKernel : public LiteKernel { lite::TensorList *output0_ = nullptr; int index_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_CONTROL_TENSORLIST_SETITEM_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_stack.cc b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_stack.cc index f3e8bcf4d41a21ecb04a99a2b510b59f5535bdd2..1bfd668587b2b7cd0e22ae99ab1eb055640fdad2 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_stack.cc +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_stack.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_TensorListStack; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TensorListStackCPUKernel::CheckParam() { MS_CHECK_TRUE_RET(input0_ != nullptr, RET_NULL_PTR); MS_CHECK_TRUE_RET(output0_ != nullptr, RET_NULL_PTR); @@ -191,4 +191,4 @@ int TensorListStackCPUKernel::ReSize() { return RET_OK; } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_TensorListStack, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_TensorListStack, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_TensorListStack, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_stack.h b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_stack.h index 85d3f03f00cb1b42c594d46739d4a1516e947c82..b2d331f0ed0d20e989e346b34c21e082eea42d06 100644 --- a/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_stack.h +++ b/mindspore-lite/src/litert/kernel/cpu/control/tensorlist_stack.h @@ -24,7 +24,7 @@ #include "schema/model_generated.h" #include "nnacl_c/tensorlist_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TensorListStackCPUKernel : public LiteKernel { public: TensorListStackCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -51,6 +51,6 @@ class TensorListStackCPUKernel : public LiteKernel { lite::Tensor *output0_ = nullptr; std::vector output_shape_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_CONTROL_TENSORLIST_STACK_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/biasadd_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/biasadd_fp16.cc index 78bdbaed4f4beac4757fffc4afc5d3c9a76fb50c..62550850a12e52cd567ceaf52f574816f07e58eb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/biasadd_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/biasadd_fp16.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BiasAdd; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int BiasAddCPUFp16Kernel::ReSize() { auto dims = in_tensors_.at(0)->shape(); bias_param_->ndim_ = dims.size(); @@ -149,4 +149,4 @@ int BiasAddCPUFp16Kernel::Eval() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_BiasAdd, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/biasadd_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/biasadd_fp16.h index c4b838cd6457ffb881ac86e7bce60d9c3bfa6495..ad311b90852e195144280f94457d634d9896c2ba 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/biasadd_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/biasadd_fp16.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp16/arithmetic_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BiasAddCPUFp16Kernel : public LiteKernel { public: BiasAddCPUFp16Kernel(OpParameter *parameter, const std::vector &inputs, @@ -45,6 +45,6 @@ class BiasAddCPUFp16Kernel : public LiteKernel { TypeId bias_data_type_ = kNumberTypeFloat16; bool is_repack_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_BIASADD_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/cast_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/cast_fp16.cc index e564d6efadad05fdcf8d664dae93dbdc49da606d..83c7fb59eeb6eb9d88766f92b0eb5450a4ae0a74 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/cast_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/cast_fp16.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Cast; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int CastFp16Run(void *cdata, int task_id, float lhs_scale, float rhs_scale) { if (cdata == nullptr) { @@ -145,4 +145,4 @@ int CastFp16CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Cast, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/cast_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/cast_fp16.h index 447daff336d015c58e58f103eb7ca224ffa8914b..c206e09257bf0048b56ca86d0814395962dd1d94 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/cast_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/cast_fp16.h @@ -22,7 +22,7 @@ #include "nnacl_c/fp16/cast_fp16.h" #include "nnacl_c/base/cast_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CastFp16CPUKernel : public LiteKernel { public: CastFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class CastFp16CPUKernel : public LiteKernel { int stride_ = 0; int data_num_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_CAST_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/common_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/common_fp16.cc index 1a1d5dc6ae9e331a9d9f459c3860000df827156e..a5f26ac47012ebe97ce3a5e7af2502295f816b78 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/common_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/common_fp16.cc @@ -20,7 +20,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { float16_t *ConvertInputFp32toFp16(lite::Tensor *input, const lite::InnerContext *ctx) { MS_CHECK_TRUE_MSG(input != nullptr, nullptr, "input must be not a nullptr."); float16_t *fp16_data = nullptr; @@ -77,4 +77,4 @@ int ConvertFp32TensorToFp16(lite::Tensor *tensor, const lite::InnerContext *ctx) ctx->allocator->Free(fp32_data); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/common_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/common_fp16.h index cb43da36425d269c1567cd0315056385183b9a52..866f2380dbfed62c2a0af3b859363d0711a342f0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/common_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/common_fp16.h @@ -19,12 +19,12 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { float16_t *ConvertInputFp32toFp16(lite::Tensor *input, const lite::InnerContext *ctx); float16_t *MallocOutputFp16(lite::Tensor *output, const lite::InnerContext *ctx); int ConvertFp32TensorToFp16(lite::Tensor *tensor, const lite::InnerContext *ctx); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_COMMON_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_1x1_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_1x1_fp16.cc index 493f7fa0c08165957b8858e671e7f1252e31c860..c9591f948bfd55db06974aa5579b5b59bfb621fd 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_1x1_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_1x1_fp16.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int Convolution1x1FP16CPUKernel::InitMatmulParam() { matmul_param_->row_ = conv_param_->output_h_ * conv_param_->output_w_; matmul_param_->col_ = conv_param_->output_channel_; @@ -334,4 +334,4 @@ int Convolution1x1FP16CPUKernel::Run() { pack_input_ = nullptr; return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_1x1_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_1x1_fp16.h index 640e789ad261a9864aa527b64f37279937151993..e79cf5b75e01e3fba5d7df1ae4d2c04191736db2 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_1x1_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_1x1_fp16.h @@ -25,7 +25,7 @@ #include "nnacl_c/matmul_parameter.h" #include "nnacl_c/fp16/matmul_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class Convolution1x1FP16CPUKernel : public ConvolutionBaseCPUKernel { public: Convolution1x1FP16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -61,6 +61,6 @@ class Convolution1x1FP16CPUKernel : public ConvolutionBaseCPUKernel { int col_tile_; int row_tile_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_CONVOLUTION_1X1_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_delegate_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_delegate_fp16.cc index 53d04f421f2fa7293830f34d08ed36b9d1f1c44c..9693e7e281d7aaa77b123f19197ce6fbefdf7ee4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_delegate_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_delegate_fp16.cc @@ -35,7 +35,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2DFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionDelegateFP16CPUKernel::FreeCopiedData() { if ((origin_weight_ != nullptr) && (need_free_ & WEIGHT_NEED_FREE)) { free(origin_weight_); @@ -245,4 +245,4 @@ kernel::LiteKernel *CpuConvFp16KernelCreator(const std::vector & } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Conv2DFusion, CpuConvFp16KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_delegate_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_delegate_fp16.h index 94c294d3b507ffce5c37b633e3450d913703f113..77e1b750fac9245a3ac2efec76a1f16c4b9b640a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_delegate_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_delegate_fp16.h @@ -25,7 +25,7 @@ #define WEIGHT_NEED_FREE 0001 #define BIAS_NEED_FREE 0010 -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDelegateFP16CPUKernel : public LiteKernel { public: ConvolutionDelegateFP16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -100,6 +100,6 @@ class ConvolutionDelegateFP16CPUKernel : public LiteKernel { void *origin_bias_ = nullptr; kernel::LiteKernel *fp16_conv_kernel_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_CONVOLUTION_DELEGATE_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_3x3_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_3x3_fp16.cc index 88e9f7202c59f214424d609796810ac58dc8c526..fe48ef906bbfb79cb70087803ca4f51be8b3da68 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_3x3_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_3x3_fp16.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionDepthwise3x3Fp16CPUKernel::PackWeight() { auto weight_tensor = in_tensors_.at(kWeightIndex); int channel = weight_tensor->Batch(); @@ -148,5 +148,5 @@ int ConvolutionDepthwise3x3Fp16CPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_3x3_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_3x3_fp16.h index 28a8714aa3c1b92c0d7c1b247ba6c3d4f7dfa74b..ec6b583e78be9b85846e98bb592c6ee45a92725a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_3x3_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_3x3_fp16.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwise3x3Fp16CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwise3x3Fp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -45,6 +45,6 @@ class ConvolutionDepthwise3x3Fp16CPUKernel : public ConvolutionBaseCPUKernel { float16_t *output_ptr_ = nullptr; float16_t *buffer_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_CONVOLUTION_DEPTHWISE_3X3_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_fp16.cc index b38c694a780126943d2fc3e23430dbac56f70f08..ae5bcf4426fa8d5271c03162d9ed492c47bc69df 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_fp16.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionDepthwiseFp16CPUKernel::PackWeight() { auto weight_tensor = in_tensors_.at(kWeightIndex); void *origin_weight = (op_parameter_->is_train_session_) ? weight_tensor->data() : origin_weight_; @@ -126,4 +126,4 @@ int ConvolutionDepthwiseFp16CPUKernel::Run() { } return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_fp16.h index bc8ded4ba674d5c63f32b1125d1d39452b8be64e..959fe355836b0759868c42fb62a5c283bc1291e0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_fp16.h @@ -31,7 +31,7 @@ void ConvDwFp16(float16_t *output_data, const float16_t *input_data, const float } #endif -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwiseFp16CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwiseFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -50,6 +50,6 @@ class ConvolutionDepthwiseFp16CPUKernel : public ConvolutionBaseCPUKernel { void PackWeight() override; int MallocWeightBiasData() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_CONVOLUTION_DEPTHWISE_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_slidewindow_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_slidewindow_fp16.cc index 50edd50dfe7621d8e94d58512c4100a105c53747..d80d057e556add0423f655bf20d974e81bcad7f4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_slidewindow_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_slidewindow_fp16.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { ConvolutionDepthwiseSWFp16CPUKernel::~ConvolutionDepthwiseSWFp16CPUKernel() { if (sliding_ != nullptr) { delete sliding_; @@ -196,4 +196,4 @@ void ConvolutionDepthwiseSWFp16CPUKernel::FreePackedInputOutput() { packed_output_ = nullptr; } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_slidewindow_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_slidewindow_fp16.h index a535bedf60d702e8898274ebe13d2ee5d179a1db..c45738c74ab90f78fb2ff4c681455531d1b7612f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_slidewindow_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_depthwise_slidewindow_fp16.h @@ -32,7 +32,7 @@ void ConvDwC8Fp16(float16_t *output_data, const float16_t *input_data, const flo } #endif -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwiseSWFp16CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwiseSWFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -57,6 +57,6 @@ class ConvolutionDepthwiseSWFp16CPUKernel : public ConvolutionBaseCPUKernel { float16_t *packed_output_ = nullptr; bool need_align_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_CONVOLUTION_DEPTHWISE_SLIDEWINDOW_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_fp16.cc index a8d04577dfacac34334d4f094b72892c1e8ce6b9..3460f2160296f62fcc3e98a557b6dd7369237f04 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_fp16.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionFP16CPUKernel::PackWeight() { auto filter_tensor = in_tensors_.at(kWeightIndex); int in_channel = filter_tensor->Channel(); @@ -190,4 +190,4 @@ int ConvolutionFP16CPUKernel::Run() { FreeTmpBuffer(); return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_fp16.h index 08afcf514a64145fe99c66f58d4c603a37351148..15af5e0dda86abaea3afe628a90a7a7955acb5f2 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_fp16.h @@ -22,7 +22,7 @@ #include "src/litert/lite_kernel.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionFP16CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionFP16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -56,6 +56,6 @@ class ConvolutionFP16CPUKernel : public ConvolutionBaseCPUKernel { int col_tile_; int row_tile_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_CONVOLUTION_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_winograd_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_winograd_fp16.cc index 569c5a862bcb8484e73769a1ee4922b693924921..8dfe27d2aaf651ef3b97b3157530bb202b047878 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_winograd_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_winograd_fp16.cc @@ -19,7 +19,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConvolutionWinogradFP16CPUKernel::WinogradFilterTransformFp16(const float16_t *weight_data, const float *matrix_g, const float *matrix_gt, int oc_block) { if (oc_block == 0) { @@ -272,4 +272,4 @@ int ConvolutionWinogradFP16CPUKernel::Run() { FreeTmpBuffer(); return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_winograd_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_winograd_fp16.h index c12cf98085e8d48be7a268b044d90990f4213fb5..b57bf2f90839a55feb0832e2b800c26c0655e91f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_winograd_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/convolution_winograd_fp16.h @@ -26,7 +26,7 @@ #include "src/common/utils.h" #include "nnacl_c/base/minimal_filtering_generator.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionWinogradFP16CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionWinogradFP16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -86,6 +86,6 @@ class ConvolutionWinogradFP16CPUKernel : public ConvolutionBaseCPUKernel { int col_tile_ = 0; int row_tile_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_CONVOLUTION_WINOGRAD_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/custom_gru_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/custom_gru_fp16.cc index 4dda8d7af463bade03041d6827253e548919f54c..ed78774cc41de7edc01d4848dc784978b07d589b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/custom_gru_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/custom_gru_fp16.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NOT_SUPPORT; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int CustomGruFp16CPUKernel::InitWeightAndBias() { auto weight_shape = in_tensors_[1]->shape(); auto hidden_size = weight_shape[0] / C3NUM; @@ -129,5 +129,5 @@ int CustomGruFp16CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimType_Inner_CustomGru, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/custom_gru_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/custom_gru_fp16.h index 6ff3fd4b2ad4a2887496d7c01b0b056c6ce05eb7..81debf2df572da8b7a3bcd696c6c91ba7cf43619 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/custom_gru_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/custom_gru_fp16.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/custom_gru_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CustomGruFp16CPUKernel : public CustomGruCPUKernel { public: CustomGruFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class CustomGruFp16CPUKernel : public CustomGruCPUKernel { protected: int InitWeightAndBias() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP16_CUSTOM_GRU_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_depthwise_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_depthwise_fp16.cc index 9059260bafd172703187473480a8eedf0ab2f224..cdee75329c59c62b35bfbe05638d003f9f85c22c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_depthwise_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_depthwise_fp16.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DeconvolutionDepthwiseFp16CPUKernel::~DeconvolutionDepthwiseFp16CPUKernel() { if (sliding_ != nullptr) { delete sliding_; @@ -227,4 +227,4 @@ void DeconvolutionDepthwiseFp16CPUKernel::FreePackedInputOutput() { packed_output_ = nullptr; } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_depthwise_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_depthwise_fp16.h index ea28cb1c483840feb5ebf3ea95b4dadf3e62b3b2..575241a13e95508d9b4b9ded18c4913ddd9a9774 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_depthwise_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_depthwise_fp16.h @@ -33,7 +33,7 @@ void ComputeStrides(int *shape, int *strides, int ndim); } #endif -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DeconvolutionDepthwiseFp16CPUKernel : public ConvolutionBaseCPUKernel { public: DeconvolutionDepthwiseFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -59,6 +59,6 @@ class DeconvolutionDepthwiseFp16CPUKernel : public ConvolutionBaseCPUKernel { float16_t *packed_output_ = nullptr; bool need_align_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_DECONVOLUTION_DEPTHWISE_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_fp16.cc index b764ac88bd3e299ba1892f647fe5dd44d31cd541..899251221f843b4b42af856d0661d26e85ec122b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_fp16.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2dTransposeFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DeConvolutionFp16CPUKernel::~DeConvolutionFp16CPUKernel() { if (matmul_param_ != nullptr) { delete matmul_param_; @@ -348,4 +348,4 @@ kernel::LiteKernel *CpuDeConvFp16KernelCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Conv2dTransposeFusion, CpuDeConvFp16KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_fp16.h index 2966679775e7f6253fb97bf138365d26c8e2478b..29ab52aca6dd68ac72e91cc7026a6a5b571338c8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_fp16.h @@ -23,7 +23,7 @@ #include "src/litert/kernel_registry.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DeConvolutionFp16CPUKernel : public ConvolutionBaseCPUKernel { public: DeConvolutionFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -59,5 +59,5 @@ class DeConvolutionFp16CPUKernel : public ConvolutionBaseCPUKernel { float16_t *batch_input_ = nullptr; float16_t *batch_output_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_DECONVOLUTION_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_winograd_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_winograd_fp16.cc index 04c16cef74552900ce71afcbeed404a50c0cc9d9..36eca55c801aef244e0e8729d19f051360f3deff 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_winograd_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_winograd_fp16.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DeConvWinogradFp16CPUKernel::~DeConvWinogradFp16CPUKernel() { FreeResizeBuf(); FreeDeconvParam(); @@ -501,4 +501,4 @@ int DeConvWinogradFp16CPUKernel::Run() { FreeRunBuf(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_winograd_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_winograd_fp16.h index 6e276d3f08dd79105afe646825e69af9aecfa015..8219445d71653e7b886124e8dcebd96b10bd8d24 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_winograd_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/deconvolution_winograd_fp16.h @@ -24,7 +24,7 @@ #include "nnacl_c/fp16/pack_fp16.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DeConvWinogradFp16CPUKernel : public ConvolutionBaseCPUKernel { public: DeConvWinogradFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -61,5 +61,5 @@ class DeConvWinogradFp16CPUKernel : public ConvolutionBaseCPUKernel { int thread_stride_hw_ = 0; bool valid_weight_shape_ = true; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_DECONVOLUTION_WINOGRAD_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/dynamic_quant_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/dynamic_quant_fp16.cc index 0722c9d6747017cb56b698f5c91ae26f3ac78fb4..1835eacf38988430e35d1a3316fe7c808a679993 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/dynamic_quant_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/dynamic_quant_fp16.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_DynamicQuant; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kBucketNums = 8; constexpr int k8Bit = 8; @@ -223,4 +223,4 @@ kernel::LiteKernel *DynamicQuantFp16CPUCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_DynamicQuant, DynamicQuantFp16CPUCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/dynamic_quant_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/dynamic_quant_fp16.h index 8ceb33b8ec44b9de8e9112f7d5b7b0291e5a9bae..d553e0cb00d1c35281cdf03951995893ba8e5241 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/dynamic_quant_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/dynamic_quant_fp16.h @@ -21,7 +21,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DynamicQuantFp16CPUKernel : public LiteKernel { public: DynamicQuantFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -53,6 +53,6 @@ class DynamicQuantFp16CPUKernel : public LiteKernel { int32_t dst_dtype_{0}; bool symmetric_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_BASE_DYNAMIC_QUANT_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/fullconnection_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/fullconnection_fp16.cc index bb925bf6721d1502f1660d8b7f5afe0bdb693c03..70f452de2c5e3a8af2607046ef64c70c77a35ed9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/fullconnection_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/fullconnection_fp16.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_FullConnection; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int FullconnectionFP16CPUKernel::InitAShape() { auto a_shape = in_tensors_.at(0)->shape(); MS_CHECK_TRUE_MSG(a_shape.size(), C2NUM, "fully-connection A-metrics' shape is invalid."); @@ -80,4 +80,4 @@ int FullconnectionFP16CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_FullConnection, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/fullconnection_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/fullconnection_fp16.h index 79560d7a0c3cc8420dd10291b4816d48a596b74f..68c43ad03d3cbfae7d690e7149198a7893a98e5a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/fullconnection_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/fullconnection_fp16.h @@ -21,7 +21,7 @@ #include #include "src/litert/kernel/cpu/fp16/matmul_base_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class FullconnectionFP16CPUKernel : public MatmulBaseFP16CPUKernel { public: explicit FullconnectionFP16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,6 +37,6 @@ class FullconnectionFP16CPUKernel : public MatmulBaseFP16CPUKernel { int InitAShape() override; int InitBShape() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_FULLCONNECTION_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/group_convolution_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/group_convolution_fp16.cc index 7d431744803b1760e5620109c6f4cbbe44e4426f..9dca7c9aa3807757e6d8e682e109138aec013def 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/group_convolution_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/group_convolution_fp16.cc @@ -20,7 +20,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int GroupConvolutionFP16CPUKernel::Separate(int task_id) { auto plane_step = UP_DIV(in_plane_, in_thread_num_); auto begin_plane = plane_step * task_id; @@ -156,4 +156,4 @@ int GroupConvolutionFP16CPUKernel::Prepare() { } return GroupConvolutionBaseCPUKernel::Prepare(); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/group_convolution_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/group_convolution_fp16.h index 1441abc419362424c4c04aa87178fa6a0334f222..9398b9d44e9fad9e2a5f3145c079d6331f1b6884 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/group_convolution_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/group_convolution_fp16.h @@ -24,7 +24,7 @@ #include "src/litert/kernel/cpu/base/group_convolution_base.h" #include "nnacl_c/fp16/conv_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GroupConvolutionFP16CPUKernel : public GroupConvolutionBaseCPUKernel { public: GroupConvolutionFP16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -48,6 +48,6 @@ class GroupConvolutionFP16CPUKernel : public GroupConvolutionBaseCPUKernel { float16_t *sub_out_src_ = nullptr; float16_t *sub_out_dst_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GROUP_CONVOLUTION_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/gru_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/gru_fp16.cc index 5bdbdd9fd041b2600e74ce02d1180926a27f2f2a..28ce0ef048a32132bc5ead95e0419f7104a1cb77 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/gru_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/gru_fp16.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_GRU; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void GruFp16CPUKernel::FreeTmpBuffer() { if (weight_g_ptr_ != nullptr) { free(weight_g_ptr_); @@ -302,4 +302,4 @@ int GruFp16CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_GRU, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/gru_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/gru_fp16.h index c5bf5dacc89d054300be2344060db4f57e97e213..ea28902805d9208e633ef86ca4ea03582f0b9f09 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/gru_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/gru_fp16.h @@ -19,7 +19,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/gru_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GruFp16CPUKernel : public LiteKernel { public: GruFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -58,6 +58,6 @@ class GruFp16CPUKernel : public LiteKernel { bool is_vec_ = false; GruParameter *gru_param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRU_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/instance_norm_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/instance_norm_fp16.cc index 9dc1d9ca49a862c24d1297ee806154308bdc362e..aceb62843847c4187790990551769996b12fdc9d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/instance_norm_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/instance_norm_fp16.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_InstanceNorm; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void InstanceNormFp16CPUKernel::FreeTmpBuffer() { if (in_tensors_[1]->data_type() == kNumberTypeFloat32) { if (gamma_data_ != nullptr) { @@ -121,4 +121,4 @@ int InstanceNormFp16CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_InstanceNorm, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/instance_norm_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/instance_norm_fp16.h index 31009de6012117ad2c1fa76976a0bfb31f5e2534..c8c96d5fd9642e5a9d1d5d4ae9511d85175b9b50 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/instance_norm_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/instance_norm_fp16.h @@ -21,7 +21,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class InstanceNormFp16CPUKernel : public LiteKernel { public: InstanceNormFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -52,6 +52,6 @@ class InstanceNormFp16CPUKernel : public LiteKernel { float16_t *beta_data_ = nullptr; bool input_pack_to_nc8hw8_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_INSTANCE_NORM_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/layout_transform_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/layout_transform_fp16.cc index 361a0870a4148e6ec8fca55be1ee1ec24e135058..9cd406ad10ca074faa68e528faa22383abd37701 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/layout_transform_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/layout_transform_fp16.cc @@ -18,7 +18,7 @@ #include "src/common/log_adapter.h" #include "schema/ops_types_generated.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { LayoutConvertor LayoutTransformFp16(mindspore::Format src_format, mindspore::Format dst_format) { if (src_format == mindspore::NHWC && dst_format == mindspore::NC4HW4) { return PackNHWCToNC4HW4Fp16; @@ -36,4 +36,4 @@ LayoutConvertor LayoutTransformFp16(mindspore::Format src_format, mindspore::For return nullptr; } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/layout_transform_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/layout_transform_fp16.h index 821fd7047a8501231971b91e8a92f5fb75ef82f1..51847ddfc33fed851e9a84b38452c7814d8294d0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/layout_transform_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/layout_transform_fp16.h @@ -19,8 +19,8 @@ #include "src/litert/kernel/cpu/base/layout_transform.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { LayoutConvertor LayoutTransformFp16(mindspore::Format src_format, mindspore::Format dst_format); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_LAYOUT_TRANSFORM_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16.cc index a91cb249ba9140177ebe7af8f4962e0194320c32..0e31f3e7eba680d74967d76f69580b93c837d9c0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LSTM; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kMindirInputTensorNum = 4; } // namespace @@ -55,4 +55,4 @@ LiteKernel *LstmFp16KernelCreator(const std::vector &inputs, con } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_LSTM, LstmFp16KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16_base.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16_base.cc index 2d82ff3248243247fdb20e5f4280a51ea1aec2b1..17fe70d55155bf4c49888392d1d717c4249d552d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16_base.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kGateNum = 4; constexpr int kTempInputBufferIndex = 0; @@ -391,4 +391,4 @@ void LstmFp16BaseCPUKernel::FreeRunBuffer() { } } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16_base.h b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16_base.h index f68ac600f318a8e1d5cb2c9de4d54342124e7d04..d42646882528f11c5a43ae13f5fbc7bc2638727b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_fp16_base.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/lstm_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LstmFp16BaseCPUKernel : public LiteKernel { public: LstmFp16BaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -68,6 +68,6 @@ class LstmFp16BaseCPUKernel : public LiteKernel { void FreeRunBuffer(); int MallocRunBuffer(); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP16_LSTM_FP16_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_mindir_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_mindir_fp16.cc index 4977df7be6f8a432efe916196bb6f835c084f094..7ec4b97a43a5990729eec14d38ab69782b58f5db 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_mindir_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_mindir_fp16.cc @@ -17,7 +17,7 @@ #include "src/litert/kernel/cpu/fp16/lstm_mindir_fp16.h" #include "nnacl_c/fp16/lstm_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kMindirInputTensorNum = 4; constexpr int kWeightsIndex = 3; @@ -155,4 +155,4 @@ int LstmMindirFp16CPUKernel::InitProjectWeight() { (void)memset(project_bias_, 0, bias_size); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_mindir_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_mindir_fp16.h index 5cae076a5b2207d1fb64f455cfe8356c6b7eb6ee..d0725d7bb9b99841bec6b2a584814640fd7dd033 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_mindir_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_mindir_fp16.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp16/lstm_fp16_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { /* * 1. LSTM without project, output_size = hidden_size * h_init: second input, shape is [bidirectional, batch_size, hidden_size] @@ -55,6 +55,6 @@ class LstmMindirFp16CPUKernel : public LstmFp16BaseCPUKernel { private: bool gpu_orig_state_{false}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP16_LSTM_MINDIR_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_non_mindir_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_non_mindir_fp16.cc index cf7a32e42c7ab5ba92f03db6efff017b94e3d7de..4496a0b07561961eb0f4bc131cb32dc70a258279 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_non_mindir_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_non_mindir_fp16.cc @@ -20,7 +20,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kGateNum = 4; constexpr size_t kInputTensorNumMin = 6; @@ -128,4 +128,4 @@ int LstmNonMindirFp16CPUKernel::InitProjectWeight() { (void)memset(project_bias_, 0, bias_size); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_non_mindir_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_non_mindir_fp16.h index 0202fa7f8fb0514aa95fd8af41e97635db66ff47..df4e118093f9c86526d804212c4251e97373ad18 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_non_mindir_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/lstm_non_mindir_fp16.h @@ -19,7 +19,7 @@ #include #include "src/litert/kernel/cpu/fp16/lstm_fp16_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { /* * 1. LSTM without project, output_size = hidden_size * weight_ih: second input, shape is [bidirectional, 4 * hidden_size, input_size] @@ -55,6 +55,6 @@ class LstmNonMindirFp16CPUKernel : public LstmFp16BaseCPUKernel { int InitStateWeightBias() override; int InitProjectWeight() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP16_LSTM_NON_MINDIR_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_base_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_base_fp16.cc index 9f01f0f51edb3dc9c4984818033d39f8dbc7bb55..7ca800f420320560e5732b1397bbd44f6c79e9d7 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_base_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_base_fp16.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_INPUT_TENSOR_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int MatmulBaseFP16Run(void *cdata, int task_id, float lhs_scale, float rhs_scale) { CHECK_NULL_RETURN(cdata); auto op = reinterpret_cast(cdata); @@ -387,4 +387,4 @@ int MatmulBaseFP16CPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_base_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_base_fp16.h index 3a467f3401ecd539cc3770a81f8b72e040a37e5e..aae5c3d87873d09b56e1b6bd711b4932ccbde0b7 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_base_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_base_fp16.h @@ -25,7 +25,7 @@ #include "src/common/common.h" #include "nnacl_c/matmul_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulBaseFP16CPUKernel : public LiteKernel { public: explicit MatmulBaseFP16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -79,6 +79,6 @@ class MatmulBaseFP16CPUKernel : public LiteKernel { float16_t *batch_b_ptr_ = nullptr; float16_t *batch_c_ptr_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_MATMUL_BASE_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_fp16.cc index 70650f2b6adc833ae319f5e1a46958d6f3ca10b5..e6d0091481ce3afde0d56fef5c237148ed3f1f30 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_fp16.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_MatMulFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int MatmulFP16CPUKernel::InitAShape() { auto a_shape = in_tensors_[0]->shape(); MS_CHECK_TRUE_MSG(a_shape.size() >= DIMENSION_2D, RET_ERROR, "A-metric tensor's shape is invalid."); @@ -108,4 +108,4 @@ int MatmulFP16CPUKernel::Eval() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_MatMulFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_fp16.h index d99d8d2c4a18a555f77f50102f728fcdea84af8c..053fbea47a83d1e4352b68077d9dd82c763e6536 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/matmul_fp16.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp16/matmul_base_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulFP16CPUKernel : public MatmulBaseFP16CPUKernel { public: explicit MatmulFP16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -36,6 +36,6 @@ class MatmulFP16CPUKernel : public MatmulBaseFP16CPUKernel { int InitAShape() override; int InitBShape() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_MATMUL_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/quant_dtype_cast_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/quant_dtype_cast_fp16.cc index 4841a3bb3bd65c1a89ff823ea7f2615c9b032f9c..aa6755cb1743b9511270943a0ca808ee8a595f0f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/quant_dtype_cast_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/quant_dtype_cast_fp16.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_QuantDTypeCast; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int QuantDTypeCastFp16CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -226,4 +226,4 @@ kernel::LiteKernel *CpuQuantDTypeCastFp16KernelCreator(const std::vector #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class QuantDTypeCastFp16CPUKernel : public LiteKernel { public: QuantDTypeCastFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -44,6 +44,6 @@ class QuantDTypeCastFp16CPUKernel : public LiteKernel { bool int_to_float_ = false; bool is_uint8_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_QUANT_DTYPE_CAST_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/resize_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16/resize_fp16.cc index 2f26862cc36a12906bf1180621315673f8c1dce0..25a8d05364fbc772c96eb425b0d07a950735c0c6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/resize_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/resize_fp16.cc @@ -30,7 +30,7 @@ using mindspore::schema::CoordinateTransformMode_ASYMMETRIC; using mindspore::schema::CoordinateTransformMode_HALF_PIXEL; using mindspore::schema::PrimitiveType_Resize; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ResizeFp16CPUKernel::ResizePrepare() { CHECK_NULL_RETURN(in_tensors_.front()); CHECK_NULL_RETURN(out_tensors_.front()); @@ -92,4 +92,4 @@ int ResizeFp16CPUKernel::RunImpl(int task_id) { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Resize, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16/resize_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16/resize_fp16.h index faf0944b869ade12988a50bb00ea3982acb0a044..c07036a122e381706de22008f69c7476abe306e8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16/resize_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16/resize_fp16.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/fp32/resize_fp32.h" #include "nnacl_c/fp16/resize_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ResizeFp16CPUKernel : public ResizeCPUKernel { public: ResizeFp16CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class ResizeFp16CPUKernel : public ResizeCPUKernel { int DataTypeLen() override; int RunImpl(int task_id) override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_RESIZE_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/activation_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/activation_fp16_grad.cc index f6d1a1d2230c26f1585d6f8e26c495895f1bdc1a..a8cb3e5ffa7fae3b90ce89c7930feea3bb557e5c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/activation_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/activation_fp16_grad.cc @@ -28,7 +28,7 @@ using mindspore::schema::ActivationType_RELU; using mindspore::schema::ActivationType_SIGMOID; using mindspore::schema::PrimitiveType_ActivationGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ActivationGradCPUKernelFp16::Prepare() { if (in_tensors_.size() != C2NUM) { MS_LOG(ERROR) << "ActivationGrad should have 2 input tensors"; @@ -112,4 +112,4 @@ int ActivationGradCPUKernelFp16::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_ActivationGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/activation_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/activation_fp16_grad.h index ee88b288076b454e8d8d5ee411b4b7c6fd2e087b..2eacf41b0aa3a6e41afafb8595888c89651d7f96 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/activation_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/activation_fp16_grad.h @@ -22,7 +22,7 @@ #include "nnacl_c/fp16_grad/activation_grad_fp16.h" #include "nnacl_c/fp32_grad/activation_grad_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ActivationGradCPUKernelFp16 : public LiteKernel { public: explicit ActivationGradCPUKernelFp16(OpParameter *param, const std::vector &inputs, @@ -41,6 +41,6 @@ class ActivationGradCPUKernelFp16 : public LiteKernel { ActivationGradParameter *param_act_grad_; int thread_count_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_ACTIVATION_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_grad.cc index 064eb5f38c111ef443bf13bf2524edfeb9695c8d..b28ed5d705e1d572b8d9e86fe233f8dacf6a6e48 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_grad.cc @@ -25,7 +25,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kX1Idx = 0; constexpr static int kX2Idx = 1; constexpr static int kDyIdx = 2; @@ -108,4 +108,4 @@ int ArithmeticGradCPUKernelFp16::Run() { REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_MaximumGrad, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_MinimumGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_grad.h index 20c45cebae762d738228c5a639dc7a524b39205c..84ea8b01cc7cf06db3280fadc34cd4dfb3497c5e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_grad.h @@ -29,7 +29,7 @@ using mindspore::schema::PrimitiveType_MinimumGrad; using mindspore::schema::PrimitiveType_MulGrad; using mindspore::schema::PrimitiveType_SubGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArithmeticGradCPUKernelFp16; @@ -74,6 +74,6 @@ class ArithmeticGradCPUKernelFp16 : public LiteKernel { float16_t *tile_data1; float16_t *tile_data2; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_ARITHMETIC_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_self_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_self_grad.cc index 382ca27ca3ca932254326ca4098ffa1869372532..8ccf2e3ca99d7bce0374ca9ba0e6c6089d13c05a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_self_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_self_grad.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LogGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ArithmeticSelfGradFp16CPUKernel::Prepare() { if (in_tensors_.size() != C2NUM) { MS_LOG(ERROR) << "ActivationGrad should have 2 input tensors"; @@ -88,4 +88,4 @@ int ArithmeticSelfGradFp16CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_LogGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_self_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_self_grad.h index ac5e6e73746c0f46714214f36f2ec6f16e7af945..2450706c0f90b4c012c748e5beb42e53850dbb34 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_self_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/arithmetic_fp16_self_grad.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp16_grad/arithmetic_self_grad.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArithmeticSelfGradFp16CPUKernel : public LiteKernel { public: explicit ArithmeticSelfGradFp16CPUKernel(OpParameter *param, const std::vector &inputs, @@ -40,6 +40,6 @@ class ArithmeticSelfGradFp16CPUKernel : public LiteKernel { ArithmeticSelfGradParameterFp16 *param_act_grad_; int thread_count_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_ARITHMETIC_FP16_SELF_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bias_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bias_fp16_grad.cc index a94117b33af64d7dfd33c60aa3e7509b6686c18f..7d808ef93ac30ab4ddbe46c8900d53385ad7ff62 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bias_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bias_fp16_grad.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BiasAddGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kMaxDim = 4; int BiasGradCPUKernelFp16::ReSize() { @@ -100,4 +100,4 @@ int BiasGradCPUKernelFp16::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_BiasAddGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bias_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bias_fp16_grad.h index 24c72273aec008839e36da0f796e30a7ad12496f..b41aaede7a5e109ea5d1049f0f53f543e3d948a8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bias_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bias_fp16_grad.h @@ -21,7 +21,7 @@ #include "src/executor/kernel_exec.h" #include "nnacl_c/fp16/arithmetic_fp16.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BiasGradCPUKernelFp16 : public LiteKernel { public: explicit BiasGradCPUKernelFp16(OpParameter *parameter, const std::vector &inputs, @@ -39,6 +39,6 @@ class BiasGradCPUKernelFp16 : public LiteKernel { private: ArithmeticParameter *bias_param; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_BIAS_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bn_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bn_fp16_grad.cc index b8817f9ee73a42f2d4126b8807e7955047ac961f..c6586aa44b3883ae17240fa0eba0d197c17cd79b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bn_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bn_fp16_grad.cc @@ -33,7 +33,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BatchNormGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kNumInputDim_0 = 0; constexpr int kNumInputDim_1 = 1; @@ -191,4 +191,4 @@ int BNGradCPUKernelFp16::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_BatchNormGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bn_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bn_fp16_grad.h index 6b931821b73c12ca8681278b655046975382721a..2f3ad3c8f83ca208fe641ab993c58d60398e957c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bn_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/bn_fp16_grad.h @@ -21,7 +21,7 @@ #include "src/executor/kernel_exec.h" #include "nnacl_c/fp32_grad/batch_norm_grad.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BNGradCPUKernelFp16 : public LiteKernel { public: @@ -39,5 +39,5 @@ class BNGradCPUKernelFp16 : public LiteKernel { int stage_ = 0; size_t ws_size_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_BN_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_filter.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_filter.cc index 29b3f479c5e5e6c280339482c10bb98df0eb27f1..5dbf2d58739d10cc4dffb66332a1645d3518c7ee 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_filter.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_filter.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2DBackpropFilterFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConvolutionGradFilterCPUKernelFp16::ReSize() { // dy is in input 0 // x is in input 1 @@ -214,4 +214,4 @@ int ConvolutionGradFilterCPUKernelFp16::Run() { REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Conv2DBackpropFilterFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_filter.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_filter.h index bd1e4912cc9b6c3d700fb7771d8f910724f7c9d6..281fb89dc98fcbfd541145f8ea89d2e8252159d6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_filter.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_filter.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionGradFilterCPUKernelFp16 : public LiteKernel { public: explicit ConvolutionGradFilterCPUKernelFp16(OpParameter *parameter, const std::vector &inputs, @@ -46,6 +46,6 @@ class ConvolutionGradFilterCPUKernelFp16 : public LiteKernel { const int chunk_ = C32NUM; #endif }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_CONVOLUTION_FP16_GRAD_FILTER_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_input.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_input.cc index 80c65cb7240d4b2894d6bb04e11d0324e5779730..f57ec02e50a71d6a3856e2d201d10388a7caebd6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_input.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_input.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2DBackpropInputFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConvolutionGradInputCPUKernelFp16::ReSize() { auto *dy_tensor = in_tensors_.at(kInputIndex); MS_ASSERT(dy_tensor != nullptr); @@ -191,4 +191,4 @@ int ConvolutionGradInputCPUKernelFp16::Run() { REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Conv2DBackpropInputFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_input.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_input.h index 99e1f68d30f92d3a0e5ac6afa01ac6645b7565d5..4fa6c9ee40f39b5f625cf9d325c5d98cd0ffdffc 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_input.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/convolution_fp16_grad_input.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionGradInputCPUKernelFp16 : public LiteKernel { public: explicit ConvolutionGradInputCPUKernelFp16(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class ConvolutionGradInputCPUKernelFp16 : public LiteKernel { bool do_dw_fp16_ = false; const int chunk_ = C16NUM; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_CONVOLUTION_FP16_GRAD_INPUT_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/dropout_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/dropout_fp16_grad.cc index 86ad09d5a11e5414339d1da8abf08230489a8b41..edbce653b43426a0d8114c298032c786f351683d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/dropout_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/dropout_fp16_grad.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_DropoutGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int DropoutGradCPUKernelFp16::Prepare() { CHECK_NULL_RETURN(op_parameter_); auto param = reinterpret_cast(op_parameter_); @@ -99,4 +99,4 @@ int DropoutGradCPUKernelFp16::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_DropoutGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/dropout_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/dropout_fp16_grad.h index cac1e92cca0f65813aa31f69592b95ff2853bf4c..0d7c56cc670daadcb4ceab05904125f8051538c1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/dropout_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/dropout_fp16_grad.h @@ -19,7 +19,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DropoutGradCPUKernelFp16 : public LiteKernel { public: DropoutGradCPUKernelFp16(OpParameter *parameter, const std::vector &inputs, @@ -38,6 +38,6 @@ class DropoutGradCPUKernelFp16 : public LiteKernel { int thread_count_ = 1; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_DROPOUT_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/layernorm_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/layernorm_fp16_grad.cc index a77b764a33c5d13be30d45fa07d9003e7793b5ff..91908fbd0f6272eedbaa7d31c65b9a1222d2ec1a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/layernorm_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/layernorm_fp16_grad.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LayerNormGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kNumInputDim_0 = 0; constexpr int kNumInputDim_1 = 1; @@ -135,4 +135,4 @@ int LayerNormGradCPUKernelFp16::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_LayerNormGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/layernorm_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/layernorm_fp16_grad.h index bc4622c8839c54e70ea7a336c58628e25a17e157..ca2ceba68da46143e4902542b652c671f2c1c8c1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/layernorm_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/layernorm_fp16_grad.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LayerNormGradCPUKernelFp16 : public LiteKernel { public: @@ -39,5 +39,5 @@ class LayerNormGradCPUKernelFp16 : public LiteKernel { int param_num_ = 1; int param_size_ = 1; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_LAYERNORM_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/neg_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/neg_fp16_grad.cc index 10cf6d17bc92ecf2f02691a4504cfa29d41cb17b..62b77c25c6aa08404a1503b0b2a7a2042a86e4d9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/neg_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/neg_fp16_grad.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_NegGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int NegGradRun(void *cdata, int task_id, float lhs_scale, float rhs_scale) { CHECK_NULL_RETURN(cdata); @@ -72,4 +72,4 @@ int NegGradCPUKernelFp16::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_NegGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/neg_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/neg_fp16_grad.h index 189d952a022b6609f6e5fa807f7f65c9aa1d86b3..40ba094d828162a622bc898b45bb0b74ce57a641 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/neg_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/neg_fp16_grad.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "schema/model_generated.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class NegGradCPUKernelFp16 : public LiteKernel { public: @@ -37,6 +37,6 @@ class NegGradCPUKernelFp16 : public LiteKernel { private: int thread_count_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_NEG_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/pooling_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/pooling_fp16_grad.cc index 2dc0d177f8989705baf4066d177e4fb4363d3cd3..e6da2677b23eea9cd65d3ee73d4b581c5f755058 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/pooling_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/pooling_fp16_grad.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_AvgPoolGrad; using mindspore::schema::PrimitiveType_MaxPoolGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kNumInputDim_2 = 2; constexpr int kNumShapeDim_2 = 2; @@ -127,4 +127,4 @@ int PoolingGradCPUKernelFp16::Run() { REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_AvgPoolGrad, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_MaxPoolGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/pooling_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/pooling_fp16_grad.h index 10bf78d79126d40a683572ec2aeca5a139929645..3eeda0795334828ca7ad1c81a8c3b8eb5c7fe0c0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/pooling_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/pooling_fp16_grad.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/kernel/pooling.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using mindspore::schema::PadMode; using mindspore::schema::PoolMode; using mindspore::schema::QuantType; @@ -44,6 +44,6 @@ class PoolingGradCPUKernelFp16 : public LiteKernel { PoolingComputeParam compute_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_POOLING_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/resize_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/resize_fp16_grad.cc index 57064d04641486a0f412edb4c7fe38656073ef4b..2f63cc578d272ad38053eb50e1bbe84da0420e02 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/resize_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/resize_fp16_grad.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ResizeGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { float16_t ScalingFp16(size_t in_size, size_t out_size, bool align_corners) { return (align_corners && out_size > 1) ? (in_size - 1) / static_cast(out_size - 1) : in_size / static_cast(out_size); @@ -113,4 +113,4 @@ int ResizeGradCPUKernelFp16::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_ResizeGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/resize_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/resize_fp16_grad.h index 8d51a0920c95916f30d2449f5ce2723a58782f4a..5f8d35f0a9ed657e6359f721a917f00c9e86964d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/resize_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/resize_fp16_grad.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ResizeGradCPUKernelFp16 : public LiteKernel { public: explicit ResizeGradCPUKernelFp16(OpParameter *parameter, const std::vector &inputs, @@ -33,6 +33,6 @@ class ResizeGradCPUKernelFp16 : public LiteKernel { int ExecuteInit(int task_id); int DoExecute(int task_id); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_RESIZE_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/strided_slice_fp16_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/strided_slice_fp16_grad.cc index ca0fb484012eeb56d254ae58c497ef1f0d48ceb0..cdaa852c25a43ec6ffebca8185c36ff5cf53d6f6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/strided_slice_fp16_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/strided_slice_fp16_grad.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_StridedSliceGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int StridedSliceGradCPUKernelFp16::Prepare() { if (!InferShapeDone()) { return RET_OK; @@ -151,4 +151,4 @@ int StridedSliceGradCPUKernelFp16::DoExecute(int task_id) { } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_StridedSliceGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/strided_slice_fp16_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/strided_slice_fp16_grad.h index 4c9015473ad97f835ffe1a1664158e3a7380d29c..abbdc4721decd94c7406151f317f52b899f7da25 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/strided_slice_fp16_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/strided_slice_fp16_grad.h @@ -21,7 +21,7 @@ #include "nnacl_c/fp16_grad/strided_slice_grad.h" #include "src/executor/kernel_exec.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class StridedSliceGradCPUKernelFp16 : public LiteKernel { public: StridedSliceGradCPUKernelFp16(OpParameter *parameter, const std::vector &inputs, @@ -44,6 +44,6 @@ class StridedSliceGradCPUKernelFp16 : public LiteKernel { StridedSliceParameter *param_; std::vector output_shape_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_STRIDED_SLICE_FP16_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/unsorted_segment_sum_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/unsorted_segment_sum_fp16.cc index f6e1eefcc505d1234787c17ade63981935ca94ab..c49b04cf4aa34467b036dbb9302ea1dce6e9af8e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/unsorted_segment_sum_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/unsorted_segment_sum_fp16.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_UnsortedSegmentSum; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int UnsortedSegmentSumCPUKernelFp16::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -101,4 +101,4 @@ int UnsortedSegmentSumCPUKernelFp16::DoExecute(int task_id) { REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_UnsortedSegmentSum, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/unsorted_segment_sum_fp16.h b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/unsorted_segment_sum_fp16.h index 65e11e0ed43a95ede54aff5e923b37ff380211d9..3861a92ab8a8354b934a6218316c64b52a972c19 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp16_grad/unsorted_segment_sum_fp16.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp16_grad/unsorted_segment_sum_fp16.h @@ -20,7 +20,7 @@ #include #include "src/executor/kernel_exec.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class UnsortedSegmentSumCPUKernelFp16 : public LiteKernel { public: UnsortedSegmentSumCPUKernelFp16(OpParameter *parameter, const std::vector &inputs, @@ -39,6 +39,6 @@ class UnsortedSegmentSumCPUKernelFp16 : public LiteKernel { private: }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP16_GRAD_UNSORTED_SEGMENT_SUM_FP16_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/adder_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/adder_fp32.cc index 1095386120ae51a5e1706965fb20a78f9d679e3a..28b0fe52d27a46961cdf5de1c68f32ae544f136c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/adder_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/adder_fp32.cc @@ -31,7 +31,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::Format; using mindspore::schema::PrimitiveType_AdderFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int AdderCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -153,5 +153,5 @@ int AdderCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_AdderFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/adder_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/adder_fp32.h index b2b1a7e80e3b10b308d90b748598ffde40ece4b2..2c9980d79209fb3a9707ec3b996757fd075154c0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/adder_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/adder_fp32.h @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "src/litert/kernel/cpu/fp32/convolution_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class AdderCPUKernel : public ConvolutionCPUKernel { public: AdderCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,7 +37,7 @@ class AdderCPUKernel : public ConvolutionCPUKernel { int Run() override; int RunImpl(int task_id) override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_ADDER_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/affine_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/affine_fp32.cc index a183abc9e3e16d3c7540c422e990c39655adb996..abc5b34240fb30e58d2d05ac0cfcfccde2725a8d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/affine_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/affine_fp32.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_Affine; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int AffineFp32CPUKernel::DoActivation(lite::Tensor *tensor) { auto data = static_cast(tensor->MutableData()); int length = tensor->ElementsNum(); @@ -478,4 +478,4 @@ int AffineFp32CPUKernel::FullMatmulRun() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Affine, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/affine_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/affine_fp32.h index 917c0d8f89d650a6aaf2b3f6c3cce6944568b4fb..1657c9c81d08996127c3d0813e3172b459b323cc 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/affine_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/affine_fp32.h @@ -22,7 +22,7 @@ #include "nnacl_c/affine_parameter.h" #include "nnacl_c/splice_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr auto kAffineMinInputNum = 2; constexpr auto kAffineMaxInputNum = 3; constexpr auto kAffineMaxOutputNum = 1; @@ -74,5 +74,5 @@ class AffineFp32CPUKernel : public LiteKernel { int splice_src_col_{0}; int splice_dst_col_{0}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_AFFINE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/all_gather_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/all_gather_fp32.cc index 8f0ad2da6650021d2979882aaac0659ee25d1de4..df5fb1f96f08f612933ac2832f3c31e071f2c30f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/all_gather_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/all_gather_fp32.cc @@ -23,7 +23,7 @@ using mindspore::kernel::KERNEL_ARCH; using mindspore::lite::KernelRegistrar; using mindspore::schema::PrimitiveType_AllGather; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int AllGatherCPUKernel::Prepare() { MS_LOG(ERROR) << "unsupported AllGather kernel"; return lite::RET_NOT_SUPPORT; @@ -52,4 +52,4 @@ int AllGatherCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_AllGather, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/all_gather_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/all_gather_fp32.h index 80585bf0c7405e70f846ef7abf8ec9909eb12328..4fd91cf7776e501a9748e264ca83f8c5a2e512c0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/all_gather_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/all_gather_fp32.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/all_gather_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class AllGatherCPUKernel : public LiteKernel { public: AllGatherCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -38,6 +38,6 @@ class AllGatherCPUKernel : public LiteKernel { private: AllGatherParameter *param_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_ALL_GATHER_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/arithmetic_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/arithmetic_fp32.cc index 30ef80fa5fd2fb84c05fbb2c6a472d2e17d11567..e1601729fe3e3a32cbdc3b5720b70bd067b85b6f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/arithmetic_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/arithmetic_fp32.cc @@ -37,7 +37,7 @@ using mindspore::schema::PrimitiveType_RealDiv; using mindspore::schema::PrimitiveType_SquaredDifference; using mindspore::schema::PrimitiveType_SubFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ArithmeticCPUKernel::ReSize() { in_data_size_ = static_cast(lite::DataTypeSize(in_tensors_.front()->data_type())); out_data_size_ = static_cast(lite::DataTypeSize(out_tensors_.front()->data_type())); @@ -206,4 +206,4 @@ REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_FloorMod, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Eltwise, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_DivFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/arithmetic_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/arithmetic_fp32.h index 8d70bb59e5c83131a9c9d07c23df9bae9d2a46c8..43c2eb9a794a0492f1bc700d391f01d44cb966b6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/arithmetic_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/arithmetic_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/base/arithmetic_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArithmeticCPUKernel : public ArithmeticBaseCPUKernel { public: ArithmeticCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -54,5 +54,5 @@ class ArithmeticCPUKernel : public ArithmeticBaseCPUKernel { ArithmeticFunc arithmetic_run_bool_{nullptr}; ArithmeticOptFunc arithmetic_opt_run_bool_{nullptr}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_ARITHMETIC_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/broadcast_to_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/broadcast_to_fp32.cc index 991a6157e85ff8638cd209a261c58d546bfbeb0b..2bde0bc766ac702210168b6d2be333a2ee85812c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/broadcast_to_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/broadcast_to_fp32.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BroadcastTo; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int BroadcastToCPUKernel::ReSize() { auto input_shape = in_tensors_.at(0)->shape(); for (size_t i = 0; i < input_shape.size(); ++i) { @@ -79,4 +79,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_BroadcastTo, LiteKernelCreato REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_BroadcastTo, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_BroadcastTo, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeUInt8, PrimitiveType_BroadcastTo, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/broadcast_to_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/broadcast_to_fp32.h index 76360efd3c56067498485c923d7c8919b50f3975..ff372e3141e77c2bbe75670ba130d6821020c82b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/broadcast_to_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/broadcast_to_fp32.h @@ -21,7 +21,7 @@ #include "nnacl_c/base/broadcast_to.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BroadcastToCPUKernel : public LiteKernel { public: BroadcastToCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -36,6 +36,6 @@ class BroadcastToCPUKernel : public LiteKernel { private: BroadcastShapeInfo shape_info_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_BROADCAST_TO_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/cast_for_x86_fp16.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/cast_for_x86_fp16.cc index d4db78f042dd164dbd3df49a42aadccab04b78fc..9f457c637aa84d4ac40e4fc5b158b8ab965f55b1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/cast_for_x86_fp16.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/cast_for_x86_fp16.cc @@ -21,6 +21,6 @@ using mindspore::kernel::KERNEL_ARCH; using mindspore::lite::KernelRegistrar; using mindspore::schema::PrimitiveType_Cast; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Cast, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/cast_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/cast_fp32.cc index 08aec60c23aaf5d017c294ff737828f017df516c..139ffae68cb44d20a074b2f794638fbf243bd22d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/cast_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/cast_fp32.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Cast; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int CastRun(void *cdata, int task_id, float lhs_scale, float rhs_scale) { if (cdata == nullptr) { @@ -221,4 +221,4 @@ REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Cast, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt64, PrimitiveType_Cast, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_Cast, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/cast_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/cast_fp32.h index c90b2156fa8fc6b5f52df1148e70048ee1f54474..5933a90b1b8815d92b979d6407a440d36faac391 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/cast_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/cast_fp32.h @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "nnacl_c/base/cast_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CastCPUKernel : public LiteKernel { public: CastCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -44,6 +44,6 @@ class CastCPUKernel : public LiteKernel { int stride_ = 0; int data_num_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CAST_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_1x1_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_1x1_fp32.cc index 138740c0c4006d7dda7d9f8123e659ff5bedf224..87d0031c474e1a52f4fc09ced69c100dd8b929be 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_1x1_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_1x1_fp32.cc @@ -20,7 +20,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { Convolution1x1CPUKernel::~Convolution1x1CPUKernel() { FreeTmpBuffer(); @@ -367,4 +367,4 @@ int Convolution1x1CPUKernel::MallocWeightBiasData() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_1x1_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_1x1_fp32.h index 15efa5b86dab3a1c51e00c6f04d81d29b801589a..14f8cfc0066a0c17fb7f16db3c467f13338af6c5 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_1x1_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_1x1_fp32.h @@ -29,7 +29,7 @@ #include "nnacl_c/matmul_parameter.h" #include "nnacl_c/fp32/matmul_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class Convolution1x1CPUKernel : public ConvolutionBaseCPUKernel { public: Convolution1x1CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -65,5 +65,5 @@ class Convolution1x1CPUKernel : public ConvolutionBaseCPUKernel { int row_tile_ = 0; int col_tile_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_1X1_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_delegate_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_delegate_fp32.cc index 9d26b96c0fc7b579bb32832281362115d841494e..acfbcb66d12513b83f05ebb49c92e75297e420f9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_delegate_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_delegate_fp32.cc @@ -47,7 +47,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2DFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kMaxDwConvSWSize = 32; } // namespace @@ -410,4 +410,4 @@ kernel::LiteKernel *CpuConvFp32KernelCreator(const std::vector & } return kernel; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_delegate_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_delegate_fp32.h index 3fcbf754a68653079cdece31e23939ef1c0a009e..5151f34a963781d223fd8166ece890eb238a0cfe 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_delegate_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_delegate_fp32.h @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDelegateCPUKernel : public LiteKernel { public: ConvolutionDelegateCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -134,6 +134,6 @@ class ConvolutionDelegateCPUKernel : public LiteKernel { bool input_const_{false}; bool weight_const_{false}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_DELEGATE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_3x3_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_3x3_fp32.cc index bacd4d528b6b33f217620b2d1102ca8d8c8c4287..4328fbc4292c9b58f5e4fda3538479aab88b807f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_3x3_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_3x3_fp32.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConvolutionDepthwise3x3CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -160,5 +160,5 @@ int ConvolutionDepthwise3x3CPUKernel::MallocWeightBiasData() { memset(bias_data_, 0, c4 * sizeof(float)); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_3x3_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_3x3_fp32.h index fa3ed605ff2057414af7e499913bbbc6356473c3..4f2a361718f867fd1891adaef4ccf5f40d451056 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_3x3_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_3x3_fp32.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwise3x3CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwise3x3CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -45,6 +45,6 @@ class ConvolutionDepthwise3x3CPUKernel : public ConvolutionBaseCPUKernel { float *output_ptr_ = nullptr; float *buffer_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_DEPTHWISE_3X3_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_fp32.cc index 3ea5ac11183386c3490767685671ecd0303ed192..8b9553a4e9ef6fb2b04b0458e605041bbad3e168 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_fp32.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConvolutionDepthwiseCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -215,4 +215,4 @@ int ConvolutionDepthwiseCPUKernel::MallocWeightBiasData() { memset(bias_data_, 0, channel * sizeof(float)); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_fp32.h index 8bdef907b8a892cc70991d9c249868b89aa16a71..4a0712d3d90cc489b69f80b17622f1f2058bcab4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_fp32.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwiseCPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwiseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -63,6 +63,6 @@ class ConvolutionDepthwiseCPUKernel : public ConvolutionBaseCPUKernel { float *output_ptr_ = nullptr; ConvDwCalcParam *conv_dw_calc_param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_DEPTHWISE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_indirect_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_indirect_fp32.cc index 0abb382af538277e15ea84e3201f0b8e171efc84..07c7a55bd571fc10feba5a0ab077e357ccf9a3db 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_indirect_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_indirect_fp32.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { ConvolutionDepthwiseIndirectCPUKernel::~ConvolutionDepthwiseIndirectCPUKernel() { if (zero_ptr_ != nullptr) { free(zero_ptr_); @@ -240,4 +240,4 @@ int ConvolutionDepthwiseIndirectCPUKernel::MallocWeightBiasData() { memset(zero_ptr_, 0, batch_flag * div_flag * sizeof(float)); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_indirect_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_indirect_fp32.h index ae08a9de36c45dd97a04fc8bec55377d42dbbe61..1e4b63e4d9156ec447307be17925f09e95468d56 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_indirect_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_indirect_fp32.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwiseIndirectCPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwiseIndirectCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -49,6 +49,6 @@ class ConvolutionDepthwiseIndirectCPUKernel : public ConvolutionBaseCPUKernel { float *output_ptr_ = nullptr; float *packed_input_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_DEPTHWISE_INDIRECT_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_fp32.cc index 18ce636dfd85b60e9f3f056503bae8aa824e0d7b..b310e56a777c6d9e2f79997501b05fefcc7d87c6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_fp32.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { ConvolutionDepthwiseSWCPUKernel::~ConvolutionDepthwiseSWCPUKernel() { if (sliding_ != nullptr) { delete sliding_; @@ -211,4 +211,4 @@ int ConvolutionDepthwiseSWCPUKernel::MallocWeightBiasData() { conv_param_->thread_num_ = MSMIN(thread_count_, OC4); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_fp32.h index ecc94cd9ae21a00a40ad03e9a6bfcbbd9c683734..6d109dbe60a4700a9919c491a622ee89c3939f8d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_fp32.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwiseSWCPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwiseSWCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class ConvolutionDepthwiseSWCPUKernel : public ConvolutionBaseCPUKernel { float *packed_output_ = nullptr; bool need_align_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_DEPTHWISE_SLIDEWINDOW_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_x86_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_x86_fp32.cc index fbde537bfe6b4d3627a6801bca138c39463d688b..eff8a3c851a06a1a4a6242df22e570eedac735e6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_x86_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_x86_fp32.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { ConvolutionDepthwiseSWCPUKernelX86::~ConvolutionDepthwiseSWCPUKernelX86() { if (sliding_ != nullptr) { delete sliding_; @@ -213,5 +213,5 @@ int ConvolutionDepthwiseSWCPUKernelX86::MallocWeightBiasData() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_x86_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_x86_fp32.h index d6b7ca98689719082c250feb0dce8e424d5454c3..0c2b5bb5a3eb7b2c71309be19a5d3958f5b0956a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_x86_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_depthwise_slidewindow_x86_fp32.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwiseSWCPUKernelX86 : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwiseSWCPUKernelX86(OpParameter *parameter, const std::vector &inputs, @@ -49,7 +49,7 @@ class ConvolutionDepthwiseSWCPUKernelX86 : public ConvolutionBaseCPUKernel { bool input_need_align_ = false; bool output_need_align_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_DEPTHWISE_SLIDEWINDOW_X86_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_fp32.cc index 6ce671278f3f71baea478a8f0f43e87e5e109224..a1338e15a71cfd657ea1921aa0031f8fffb84832 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_fp32.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { #define CONV_MIN_CALC_BLOCK C1NUM #ifdef ENABLE_AVX #define OC_BLOCK C16NUM @@ -294,5 +294,5 @@ int ConvolutionCPUKernel::MallocWeightBiasData() { memset(bias_data_, 0, oc_block_num * sizeof(float)); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_fp32.h index 5ca88340f60926af1a2bab5a10148aa4f2358b63..14bc834d5593ec80f79d2fd7f1fb7898dd66b3f8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_fp32.h @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionCPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -65,7 +65,7 @@ class ConvolutionCPUKernel : public ConvolutionBaseCPUKernel { float *col_major_input_ = nullptr; bool output_need_align_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.cc index 1e4035ebf14079288277d64ee52d8a2a57c12c09..c9e55f2aa2b933fe2c4b1a79d2804d1b33580e77 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.cc @@ -16,11 +16,11 @@ #include "src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionIm2ColARM32CPUKernel::InitGlobalVariable() { oc_tile_ = C4NUM; row_tile_ = C12NUM; rowMajor2ColNMajorFunc = RowMajor2Col4Major; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.h index ad444d12a51b2b285c0427d8e0a67d0de869df8f..7e650b1310feb0d197fdfdd11a0fde5bcc36507f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm32_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionIm2ColARM32CPUKernel : public ConvolutionIm2ColBaseCPUKernel { public: ConvolutionIm2ColARM32CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,6 +31,6 @@ class ConvolutionIm2ColARM32CPUKernel : public ConvolutionIm2ColBaseCPUKernel { void InitGlobalVariable() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_IM2COL_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm64_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm64_fp32.cc index de407f717ff4a6ce3cb7adf2dde12b91c5f18c78..15fd699c5d5aa454fd6df366f17f8d80ea01072f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm64_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm64_fp32.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionIm2ColARM64CPUKernel::InitGlobalVariable() { oc_tile_ = C8NUM; row_tile_ = C12NUM; @@ -46,4 +46,4 @@ int ConvolutionIm2ColARM64CPUKernel::RunImpl(int task_id) { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm64_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm64_fp32.h index 3dc832086fb55af9cdb9eeeae34eb50b799344b7..7c9e23a5ec6421ea1ff352dedf392483a36bfaff 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm64_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_arm64_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionIm2ColARM64CPUKernel : public ConvolutionIm2ColBaseCPUKernel { public: ConvolutionIm2ColARM64CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -32,6 +32,6 @@ class ConvolutionIm2ColARM64CPUKernel : public ConvolutionIm2ColBaseCPUKernel { void InitGlobalVariable() override; int RunImpl(int task_id) override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_IM2COL_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx512_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx512_fp32.cc index 0b7ba386689159479b72fa14ad9b0c5c80e764f6..63fba5684bde46a601ec4a1439fa6a72a5c1d5bb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx512_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx512_fp32.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionIm2ColAVX512CPUKernel::InitGlobalVariable() { oc_tile_ = C16NUM; row_tile_ = MSMIN(UP_DIV(conv_param_->output_h_ * conv_param_->output_w_, op_parameter_->thread_num_), C150NUM); @@ -129,4 +129,4 @@ int ConvolutionIm2ColAVX512CPUKernel::Run() { FreeTmpBuffer(); return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx512_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx512_fp32.h index f16bee7717fd589ac35ff903fb4e4289bd887770..a882757e589ebc82c215fbadf40a9a84cbfe4cd0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx512_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx512_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionIm2ColAVX512CPUKernel : public ConvolutionIm2ColBaseCPUKernel { public: ConvolutionIm2ColAVX512CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -34,6 +34,6 @@ class ConvolutionIm2ColAVX512CPUKernel : public ConvolutionIm2ColBaseCPUKernel { int RunImpl(int task_id) override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_IM2COL_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx_fp32.cc index aaf7f597859d667086cbbd8c0aa14d34d6bdd38e..6d341eeb4684e51e2e5f5562eec71e4997e7da81 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx_fp32.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionIm2ColAVXCPUKernel::InitGlobalVariable() { oc_tile_ = C16NUM; row_tile_ = C6NUM; @@ -134,4 +134,4 @@ int ConvolutionIm2ColAVXCPUKernel::Run() { FreeTmpBuffer(); return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx_fp32.h index 818516e66b05ec94a2d8ffeb8d1afee72970a861..a49f5660740e565f1baa61b5497df028ea420676 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_avx_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionIm2ColAVXCPUKernel : public ConvolutionIm2ColBaseCPUKernel { public: ConvolutionIm2ColAVXCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class ConvolutionIm2ColAVXCPUKernel : public ConvolutionIm2ColBaseCPUKernel { int Run() override; int RunImpl(int task_id) override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_IM2COL_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.cc index 9484973a67e3f04a360e8724012161c3089d3c58..7190b6bce2c448451c64166592a5ddcd59a75087 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { #define CONV_MIN_CALC_BLOCK C1NUM void ConvolutionIm2ColBaseCPUKernel::InitGlobalVariable() { @@ -240,4 +240,4 @@ int ConvolutionIm2ColBaseCPUKernel::MallocWeightBiasData() { memset(bias_data_, 0, oc_block_num * sizeof(float)); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h index 70d00e87ddf79c2f6c292e27450b2d1d3cfcaaf8..175fca9d4e98e25b15a8be366d3b6ae51ba1a45c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h @@ -22,7 +22,7 @@ #include "nnacl_c/op_base.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using RowMajor2ColNMajorFunc = void (*)(const float *src_ptr, float *dst_ptr, int row, int col); int ConvolutionIm2ColImpl(void *cdata, int task_id, float lhs_scale, float rhs_scale); @@ -72,6 +72,6 @@ class ConvolutionIm2ColBaseCPUKernel : public ConvolutionBaseCPUKernel { int row_tile_ = C12NUM; // oc tile is C12NUM in C RowMajor2ColNMajorFunc rowMajor2ColNMajorFunc = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_IM2COL_BASE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_fp32.cc index 908af5b0125c58fe852b06766554d3a602326d40..a31b9ad2fd0461dbd956f9ac55c5e8c2e0e22d68 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_fp32.cc @@ -36,7 +36,7 @@ #endif #include "nnacl_c/intrinsics/ms_simd_cpu_info.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { LiteKernel *CreateConvolutionIm2ColCPUKernel(OpParameter *parameter, const std::vector &inputs, const std::vector &outputs, const lite::InnerContext *ctx, float *origin_weight, float *origin_bias) { @@ -82,4 +82,4 @@ LiteKernel *CreateConvolutionIm2ColCPUKernel(OpParameter *parameter, const std:: } return kernel; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_fp32.h index e1b22015a579cabc6afe39c05097497d77b44ea6..5734575907112358a6a97707caf7e5dba6472f44 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_fp32.h @@ -22,9 +22,9 @@ #include "nnacl_c/op_base.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { LiteKernel *CreateConvolutionIm2ColCPUKernel(OpParameter *parameter, const std::vector &inputs, const std::vector &outputs, const lite::InnerContext *ctx, float *origin_weight, float *origin_bias); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_IM2COL_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.cc index 7d86b0cf7fced2e03f1503e67c7e1b00681cc8f6..df81aeb3d9cbf7e8c715d4e9f7d7883850594c94 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.cc @@ -16,11 +16,11 @@ #include "src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionIm2ColSSECPUKernel::InitGlobalVariable() { oc_tile_ = C8NUM; row_tile_ = C4NUM; rowMajor2ColNMajorFunc = RowMajor2Col8Major; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.h index ccb3de7738ab4ab6423d4a242233dbf64043b96c..fae6b212c32e9f7b1227f53a0292777ef8fb8dfe 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_im2col_sse_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_im2col_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionIm2ColSSECPUKernel : public ConvolutionIm2ColBaseCPUKernel { public: ConvolutionIm2ColSSECPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,6 +31,6 @@ class ConvolutionIm2ColSSECPUKernel : public ConvolutionIm2ColBaseCPUKernel { void InitGlobalVariable() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_IM2COL_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.cc index 111388796b25fe64750b90075577b78fdb1b9256..6189afe139472b9277d71a97687642657a70588e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.cc @@ -16,7 +16,7 @@ #include "src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.h" #include "nnacl_c/fp32/conv_sw_arm64_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionSWARM64CPUKernel::InitGlobalVariable() { oc_tile_ = C8NUM; oc_res_ = conv_param_->output_channel_ % oc_tile_; @@ -27,4 +27,4 @@ int ConvolutionSWARM64CPUKernel::RunImpl(int task_id) { output_data_, task_id, conv_param_, slidingWindow_param_); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.h index b2af75e2fb23662af199f381ab8bafa14bd92fc9..3931375e289cdd2505a342104922d7bf4ed94592 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_arm64_fp32.h @@ -18,7 +18,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionSWARM64CPUKernel : public ConvolutionSWCPUKernel { public: ConvolutionSWARM64CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -29,5 +29,5 @@ class ConvolutionSWARM64CPUKernel : public ConvolutionSWCPUKernel { void InitGlobalVariable() override; int RunImpl(int task_id) override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP32_CONVOLUTION_SLIDEWINDOW_ARM64_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_avx_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_avx_fp32.cc index 54dcd0a2fd4c53cba8fb022c9f9e29756dfe11b1..bebeadd2c52a8528cc8d4ceac7b0b8de50c9e1f2 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_avx_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_avx_fp32.cc @@ -18,7 +18,7 @@ #include "nnacl_c/fp32/conv_common_fp32.h" #include "nnacl_c/fp32/conv_1x1_x86_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionSWAVXCPUKernel::InitGlobalVariable() { oc_tile_ = C8NUM; oc_res_ = conv_param_->output_channel_ % oc_tile_; @@ -39,5 +39,5 @@ int ConvolutionSWAVXCPUKernel::RunImpl(int task_id) { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // ENABLE_AVX diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_avx_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_avx_fp32.h index 606b411a570d69722263b7917a02fbddd61d668d..589568581ff511ed8c5710265880d7ab0f0a3acb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_avx_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_avx_fp32.h @@ -19,7 +19,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionSWAVXCPUKernel : public ConvolutionSWCPUKernel { public: ConvolutionSWAVXCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,6 +30,6 @@ class ConvolutionSWAVXCPUKernel : public ConvolutionSWCPUKernel { void InitGlobalVariable() override; int RunImpl(int task_id) override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // ENABLE_AVX #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_SLIDEWINDOW_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.cc index 4026cf8535922077fc51004966d50dc1ec12ec4b..393df0cf21ba7336e01b293c8ff96cfea429533a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_INFER_INVALID; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionSWCPUKernel::InitGlobalVariable() { oc_tile_ = C1NUM; oc_res_ = conv_param_->output_channel_ % oc_tile_; @@ -236,5 +236,5 @@ int ConvolutionSWCPUKernel::MallocWeightBiasData() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // ENABLE_AVX diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.h index 6f8f40805e20d263ce99f879725a36ff443cd63d..ca7992a6f1f20b33ba31bd6e07abb24c557b7082 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_slidewindow_fp32.h @@ -21,7 +21,7 @@ #include "nnacl_c/op_base.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionSWCPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionSWCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -66,6 +66,6 @@ class ConvolutionSWCPUKernel : public ConvolutionBaseCPUKernel { float *input_data_ = nullptr; SlidingWindowParam *slidingWindow_param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // ENABLE_AVX #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_SLIDEWINDOW_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_sw_1x1_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_sw_1x1_fp32.cc index 728f81d594b6bd86f7bba7f37d5f960e1f85f654..48600b91c9ad8c3a370caec96fe21fba0b08cd71 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_sw_1x1_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_sw_1x1_fp32.cc @@ -22,7 +22,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConvolutionSW1x1CPUKernel::Prepare() { CHECK_NULL_RETURN(matmul_base_); matmul_base_->set_name(name_); @@ -43,4 +43,4 @@ int ConvolutionSW1x1CPUKernel::Run() { matmul_base_->set_workspace(workspace()); return matmul_base_->Run(); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_sw_1x1_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_sw_1x1_fp32.h index 071d21d3c1cd0f0301b5165e30480d4fc86dc88b..f76afa703a553f857f977d6da63b8d5db5435916 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_sw_1x1_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_sw_1x1_fp32.h @@ -25,7 +25,7 @@ #include "src/litert/kernel/cpu/fp32/matmul_fp32_base.h" #include "src/litert/kernel/cpu/fp32/matmul_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionSW1x1CPUKernel : public LiteKernel { public: ConvolutionSW1x1CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -96,5 +96,5 @@ class ConvolutionSW1x1CPUKernel : public LiteKernel { float *origin_weight_ = nullptr; float *origin_bias_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_SW_1X1_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.cc index 2f22126d20458732d465681d79f467c872bcbd6b..2c74d4239189600a7a77d8e4b02088af0274dbf9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.cc @@ -16,10 +16,10 @@ #include "src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionWinogradARM32CPUKernel::InitGlobalVariable() { oc_block_ = C8NUM; tmp_data_tile_ = C4NUM; tile_num_ = C12NUM; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.h index d3cd9a2147549df29172216e28506ca0df54be95..8afec9abf5fa4f3fb03af7550c1b64f7951eb321 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm32_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionWinogradARM32CPUKernel : public ConvolutionWinogradBaseCPUKernel { public: ConvolutionWinogradARM32CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,5 +30,5 @@ class ConvolutionWinogradARM32CPUKernel : public ConvolutionWinogradBaseCPUKerne ~ConvolutionWinogradARM32CPUKernel() override {} void InitGlobalVariable() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_ARM32_FP32_CONVOLUTION_WINOGRAD_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm64_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm64_fp32.cc index ee8ea71c0b129bfd45daa888b1f0321a85f1a306..aaa0de352ff8cc2a4ae0ab0ea0e2b27642e2bbcc 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm64_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm64_fp32.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionWinogradARM64CPUKernel::InitGlobalVariable() { oc_block_ = C8NUM; tmp_data_tile_ = C4NUM; @@ -52,4 +52,4 @@ int ConvolutionWinogradARM64CPUKernel::ConfigInputOutput() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm64_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm64_fp32.h index e72a0cbef5ac32de86b7be752dcdd15fd164b03e..3a15e0de29061c02caf1baa3ebaeb0028f875674 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm64_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_arm64_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionWinogradARM64CPUKernel : public ConvolutionWinogradBaseCPUKernel { public: ConvolutionWinogradARM64CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,5 +31,5 @@ class ConvolutionWinogradARM64CPUKernel : public ConvolutionWinogradBaseCPUKerne void InitGlobalVariable() override; int ConfigInputOutput() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_ARM64_FP32_CONVOLUTION_WINOGRAD_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_avx_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_avx_fp32.cc index 1837425a7d6c11814fccc94864efa3c65720b0cf..0f21ecad868013af5b21e57617f2a45a4a0b8bb2 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_avx_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_avx_fp32.cc @@ -24,10 +24,10 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionWinogradAVXCPUKernel::InitGlobalVariable() { oc_block_ = C16NUM; tmp_data_tile_ = C8NUM; tile_num_ = C12NUM; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_avx_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_avx_fp32.h index 90c0c5c407e119fb0e5606cefc4be2b790ac4101..a77c1bfb0aae55c3ac127d16105955096166e1ab 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_avx_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_avx_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionWinogradAVXCPUKernel : public ConvolutionWinogradBaseCPUKernel { public: ConvolutionWinogradAVXCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,5 +30,5 @@ class ConvolutionWinogradAVXCPUKernel : public ConvolutionWinogradBaseCPUKernel ~ConvolutionWinogradAVXCPUKernel() override {} void InitGlobalVariable() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_AVX_FP32_CONVOLUTION_WINOGRAD_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.cc index e77872c127f8d6100811e72ca3b9df23f0f6e741..3f08417572b2b622607ae3321efdd3a750baa5a9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { #define CONV_MIN_CALC_BLOCK C1NUM void ConvolutionWinogradBaseCPUKernel::InitGlobalVariable() { oc_block_ = C8NUM; @@ -305,4 +305,4 @@ void ConvolutionWinogradBaseCPUKernel::PackWeight() { MS_ASSERT(origin_weight != nullptr); WinogradFilterTransform(reinterpret_cast(origin_weight), matrix_g_, matrix_gt_, oc_block_); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.h index 0968c500b1e678545ee54a87ffb1f47cc5799004..b539830f3a907d79be2fd40a2408680c9e1b6ced 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.h @@ -25,7 +25,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #define CONV_INPUT_UNIT_SIZE 8 -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionWinogradBaseCPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionWinogradBaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -90,5 +90,5 @@ class ConvolutionWinogradBaseCPUKernel : public ConvolutionBaseCPUKernel { TmpBufferAddress tmp_buffer_address_list_[5] = {nullptr}; TransFuncList trans_func_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_BASE_FP32_CONVOLUTION_WINOGRAD_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_fp32.cc index c6a2e2e133d34800a5d14a9ddc58f0267ff27097..eefdd54d985450e0dc5b0e275e5029f96a252b55 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_fp32.cc @@ -33,7 +33,7 @@ #endif #include "nnacl_c/intrinsics/ms_simd_cpu_info.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { LiteKernel *CreateConvolutionWinogradCPUKernel(OpParameter *parameter, const std::vector &inputs, const std::vector &outputs, const lite::InnerContext *ctx, int out_unit, float *origin_weight, @@ -72,4 +72,4 @@ LiteKernel *CreateConvolutionWinogradCPUKernel(OpParameter *parameter, const std } return kernel; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_fp32.h index 67c69734f1cf628acec6115e8a36c625bfedbfab..be5f680ea16c3e54a03c81f9616676abf5cf4240 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_fp32.h @@ -22,10 +22,10 @@ #include "nnacl_c/op_base.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { LiteKernel *CreateConvolutionWinogradCPUKernel(OpParameter *parameter, const std::vector &inputs, const std::vector &outputs, const lite::InnerContext *ctx, int out_unit, float *origin_weight, float *origin_bias); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CONVOLUTION_WINOGRAD_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.cc index b7a092a9f54ec7a753fb4d2d35ee4f755536ae1e..b642fec4cec877a205036b2aa70460dca0c9a392 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.cc @@ -16,10 +16,10 @@ #include "src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionWinogradSSECPUKernel::InitGlobalVariable() { oc_block_ = C8NUM; tmp_data_tile_ = C4NUM; tile_num_ = C12NUM; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.h index 703221c8290af88f7b616121dc6a74f9abb9f72a..3f3a1af03a00b54fe2205a845b1a8b96b2c3ee27 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/convolution_winograd_sse_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/convolution_winograd_base_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionWinogradSSECPUKernel : public ConvolutionWinogradBaseCPUKernel { public: ConvolutionWinogradSSECPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,5 +30,5 @@ class ConvolutionWinogradSSECPUKernel : public ConvolutionWinogradBaseCPUKernel ~ConvolutionWinogradSSECPUKernel() override {} void InitGlobalVariable() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_SSE_FP32_CONVOLUTION_WINOGRAD_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/cumsum_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/cumsum_fp32.cc index 969ecc6cb3f2b3ee0155a587c04936418cac35f7..60557c2688b510c8192e7406634dcd599d38d973 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/cumsum_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/cumsum_fp32.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_CumSum; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int CumsumLaunch(void *cdata, int task_id, float lhs_scale, float rhs_scale) { if (cdata == nullptr) { @@ -146,4 +146,4 @@ int CumSumCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_CumSum, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_CumSum, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/cumsum_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/cumsum_fp32.h index d26af0b5d8ac673e22c66b22b429f99d3b23b38b..e21c4cb80ef22ab8b963145e17cab48033ac2586 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/cumsum_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/cumsum_fp32.h @@ -21,7 +21,7 @@ #include "nnacl_c/cumsum_parameter.h" #include "src/executor/kernel_exec.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CumSumCPUKernel : public LiteKernel { public: CumSumCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -44,5 +44,5 @@ class CumSumCPUKernel : public LiteKernel { int unit_ = 1; CumSumParameter *param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_CUMSUM_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/custom_gru_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/custom_gru_fp32.cc index 1b9d7e6d1d71b412c6735569d26b05cb641212c2..53b8b329eb22f6ae55c6a44e4019fa05025e22bd 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/custom_gru_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/custom_gru_fp32.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NOT_SUPPORT; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { CustomGruCPUKernel::~CustomGruCPUKernel() { if (weight_in_) { lite::PackWeightManager::GetInstance()->Free(weight_in_); @@ -247,5 +247,5 @@ int CustomGruCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimType_Inner_CustomGru, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/custom_gru_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/custom_gru_fp32.h index 75df5165ed7e5d27da20b7b1184a4fb09f76d196..e8213987b8d9a3e999f672b7a6c7c39861ce5603 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/custom_gru_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/custom_gru_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CustomGruCPUKernel : public LiteKernel { public: CustomGruCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -46,6 +46,6 @@ class CustomGruCPUKernel : public LiteKernel { void *init_h_{nullptr}; void *run_buffer_{nullptr}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP32_CUSTOM_GRU_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_depthwise_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_depthwise_fp32.cc index 35dcb3718f18c2534450f1351dc2d5a17a7a9dd1..7768ebb7df5c3e585c0a28afe7e068d460b6a750 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_depthwise_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_depthwise_fp32.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DeconvolutionDepthwiseCPUKernel::~DeconvolutionDepthwiseCPUKernel() { if (sliding_ != nullptr) { delete sliding_; @@ -256,5 +256,5 @@ void DeconvolutionDepthwiseCPUKernel::FreePackedInputOutput() { packed_output_ = nullptr; } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_depthwise_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_depthwise_fp32.h index de8298cb13272607bae4822618ab23b84a13e08f..32ec9f8f0ff5248864176f67ae11015f310157ef 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_depthwise_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_depthwise_fp32.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DeconvolutionDepthwiseCPUKernel : public ConvolutionBaseCPUKernel { public: DeconvolutionDepthwiseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -49,7 +49,7 @@ class DeconvolutionDepthwiseCPUKernel : public ConvolutionBaseCPUKernel { float *packed_output_ = nullptr; bool need_align_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_DECONVOLUTION_DEPTHWISE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_fp32.cc index b9fcfb9ae98083a03d32d6301d1d4725a659c700..c9474270bb694b0cd1ab90df0b0d405e50fccf3e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_fp32.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2dTransposeFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DeConvolutionCPUKernel::~DeConvolutionCPUKernel() { if (matmul_param_ != nullptr) { delete matmul_param_; @@ -391,5 +391,5 @@ kernel::LiteKernel *CpuDeConvFp32KernelCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Conv2dTransposeFusion, CpuDeConvFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_fp32.h index af0579a77ac8317968371a215da8ff0cf4ba2ce9..4396204cc070d11a2caa54a3104e652590173e55 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_fp32.h @@ -28,7 +28,7 @@ #include "nnacl_c/fp32/deconv_fp32.h" #include "nnacl_c/fp32/matmul_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { #define DECONV_WINOGRAD_MAX 2000 class DeConvolutionCPUKernel : public ConvolutionBaseCPUKernel { public: @@ -65,6 +65,6 @@ class DeConvolutionCPUKernel : public ConvolutionBaseCPUKernel { float *input_ptr_ = nullptr; float *output_ptr_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_DECONVOLUTION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_winograd_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_winograd_fp32.cc index fdbb9ac604ca6e7621e8f8f096e9905c3352d9f6..ec4d1cc2a391e53d240ed4194108f588e8ce428a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_winograd_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_winograd_fp32.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { const int kDeconvWinogradMaxPixel = 3145728; DeConvolutionWinogradCPUKernel::~DeConvolutionWinogradCPUKernel() { FreeResizeBuf(); @@ -595,5 +595,5 @@ int DeConvolutionWinogradCPUKernel::Run() { FreeRunBuf(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_winograd_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_winograd_fp32.h index 1aff6a336c596b5568aaf8701414cfaf9ea61101..2c3fafa6927dcd3bb7a4a9423593268cb1df7525 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_winograd_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/deconvolution_winograd_fp32.h @@ -28,7 +28,7 @@ #include "nnacl_c/fp32/deconv_winograd_fp32.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DeConvolutionWinogradCPUKernel : public ConvolutionBaseCPUKernel { public: DeConvolutionWinogradCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -65,6 +65,6 @@ class DeConvolutionWinogradCPUKernel : public ConvolutionBaseCPUKernel { int thread_stride_hw_ = 0; bool valid_weight_shape_ = true; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_DECONVOLUTION_WINOGRAD_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/detection_post_process_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/detection_post_process_fp32.cc index b29aa3fdc99cda478c460f0335fcb03aabbc9d78..29257a0a51d27f5d11a046ac2ebad6590797c78d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/detection_post_process_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/detection_post_process_fp32.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_DetectionPostProcess; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int DetectionPostProcessCPUKernel::GetInputData() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); if ((in_tensors_.at(0)->data_type() != kNumberTypeFloat32 && in_tensors_.at(0)->data_type() != kNumberTypeFloat) || @@ -41,4 +41,4 @@ int DetectionPostProcessCPUKernel::GetInputData() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_DetectionPostProcess, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/detection_post_process_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/detection_post_process_fp32.h index d641c8c030322604593c910880f9d9202611b8df..46b8feb5f37b12c0779e9291a8e7fcebdc919681 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/detection_post_process_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/detection_post_process_fp32.h @@ -24,7 +24,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DetectionPostProcessCPUKernel : public DetectionPostProcessBaseCPUKernel { public: DetectionPostProcessCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,5 +35,5 @@ class DetectionPostProcessCPUKernel : public DetectionPostProcessBaseCPUKernel { private: int GetInputData() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_DETECTION_POST_PROCESS_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/embedding_lookup_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/embedding_lookup_fp32.cc index 045366ecb8034ab8a9994bfb1fc9551e8eefbcf1..87c85dd7dd686301a238b5f8ed6c6f5901590e55 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/embedding_lookup_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/embedding_lookup_fp32.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_EmbeddingLookupFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int EmbeddingLookupCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -124,4 +124,4 @@ void EmbeddingLookupCPUKernel::FreeRunBuff() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_EmbeddingLookupFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/embedding_lookup_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/embedding_lookup_fp32.h index 6813374c9818f2414c63e8c81763ea1bc6269065..5c6a9aa47de251e320b399761d5885f4b8a2574e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/embedding_lookup_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/embedding_lookup_fp32.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32/embedding_lookup_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class EmbeddingLookupCPUKernel : public LiteKernel { public: explicit EmbeddingLookupCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -41,6 +41,6 @@ class EmbeddingLookupCPUKernel : public LiteKernel { EmbeddingLookupParameter *param_ = nullptr; float *input_addr_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_EMBEDDING_LOOKUP_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/glu_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/glu_fp32.cc index c97df7cc9ae55da2d1d63226f0b30f3bad381dea..94bea238a7a504761303d557763e31b53e98ab7d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/glu_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/glu_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_GLU; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { const int kGluBranchNum = 2; int GluCPUKernel::MallocTmpBuffer() { FreeTmpBuffer(); @@ -197,4 +197,4 @@ int GluCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_GLU, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/glu_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/glu_fp32.h index 903e8fe7665b7d8bbb0b6ddad9da9a80a8ac312d..51aa2d09b9c8eb6949cb2d2f229ad9b1251d11a5 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/glu_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/glu_fp32.h @@ -26,7 +26,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr size_t kSplitNum = 2; class GluCPUKernel : public LiteKernel { @@ -62,6 +62,6 @@ class GluCPUKernel : public LiteKernel { int usable_thread_num_ = 0; int num_unit_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GLU_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/group_convolution_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/group_convolution_fp32.cc index 62347c45bfc04a172f75bd12b8cdafb21eb597f3..fe8b366f06dd116d86f3007e28ac92ad0e5c9e8f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/group_convolution_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/group_convolution_fp32.cc @@ -20,7 +20,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int GroupConvolutionFp32CPUKernel::Separate(const int &task_id) const { auto plane_step = UP_DIV(in_plane_, in_thread_num_); MS_CHECK_INT_MUL_NOT_OVERFLOW(plane_step, task_id, RET_ERROR); @@ -136,4 +136,4 @@ int GroupConvolutionFp32CPUKernel::Prepare() { } return GroupConvolutionBaseCPUKernel::Prepare(); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/group_convolution_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/group_convolution_fp32.h index de04f9025095b65b972535a9c866e4334b7d06b1..e8a8b4f72e9be1901cd89654cfee1893c960a578 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/group_convolution_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/group_convolution_fp32.h @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "src/litert/kernel/cpu/base/group_convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GroupConvolutionFp32CPUKernel : public GroupConvolutionBaseCPUKernel { public: GroupConvolutionFp32CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -46,6 +46,6 @@ class GroupConvolutionFp32CPUKernel : public GroupConvolutionBaseCPUKernel { float *sub_out_src_ = nullptr; float *sub_out_dst_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GROUP_CONVOLUTION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/gru_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/gru_fp32.cc index 7c7a872082086915d8d3512e3ab3c8f16085eff0..2cf9ee2ba0b845c81ba9bc895a49ef04df31acfa 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/gru_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/gru_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_GRU; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void GruCPUKernel::FreeTmpBuffer() { if (weight_g_ptr_ != nullptr) { free(weight_g_ptr_); @@ -294,4 +294,4 @@ int GruCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_GRU, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/gru_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/gru_fp32.h index 0736f4ffdb8778cd416fefa8e9976fadcfb27ee6..f73abf8c4623d48db79c52bc8c4dd7897a052827 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/gru_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/gru_fp32.h @@ -19,7 +19,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/gru_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GruCPUKernel : public LiteKernel { public: GruCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -63,6 +63,6 @@ class GruCPUKernel : public LiteKernel { bool is_vec_ = false; GruParameter *gru_param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRU_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/instance_norm_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/instance_norm_fp32.cc index 83765b80fa2f28ae31f24401167a03c9258c06f5..c83f272d55feed6fcfda134354890b6e47b06ffe 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/instance_norm_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/instance_norm_fp32.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_InstanceNorm; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int InstanceNormCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), DIMENSION_3D); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -140,4 +140,4 @@ int InstanceNormCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_InstanceNorm, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/instance_norm_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/instance_norm_fp32.h index 1ce9cec68936d262181561863d99a7f8f150a716..5773d455c41d35452aef0d65eac864ff6db31fbe 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/instance_norm_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/instance_norm_fp32.h @@ -21,7 +21,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class InstanceNormCPUKernel : public LiteKernel { public: InstanceNormCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -52,6 +52,6 @@ class InstanceNormCPUKernel : public LiteKernel { float *beta_data_ = nullptr; bool input_pack_to_nc4hw4_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_INSTANCE_NORM_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/invert_permutation_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/invert_permutation_fp32.cc index f15019d47e6acd17d3354d20023757b9e45ffcf3..1acc84d4f1ea60afd714ad754b222a1fb5488a55 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/invert_permutation_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/invert_permutation_fp32.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_InvertPermutation; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int InvertPermutationCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -70,4 +70,4 @@ int InvertPermutationCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_InvertPermutation, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_InvertPermutation, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_InvertPermutation, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/invert_permutation_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/invert_permutation_fp32.h index 9a7cd9cbacfabc6d8e6aeaf772a5b3cf4b7c688f..9d756b9d59353cef00a169516bf8514b84e9b990 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/invert_permutation_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/invert_permutation_fp32.h @@ -22,7 +22,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class InvertPermutationCPUKernel : public LiteKernel { public: InvertPermutationCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class InvertPermutationCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_INVERT_PERMUTATION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/l2_norm_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/l2_norm_fp32.cc index 67b2771a514c49cbba7f35e8448e150bcd4d661c..1abb720f8082520d3c4bdedaa64f9f0b41fb801f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/l2_norm_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/l2_norm_fp32.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_L2NormalizeFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const int kMaxThreadNum = 8; } @@ -203,4 +203,4 @@ int L2NormCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_L2NormalizeFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/l2_norm_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/l2_norm_fp32.h index eb09b3b6d191a78777eff58da6978f8ba642e515..67c9b363344f1eb7adb38fd6d93221981a33b5ad 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/l2_norm_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/l2_norm_fp32.h @@ -25,7 +25,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class L2NormCPUKernel : public LiteKernel { public: L2NormCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -54,6 +54,6 @@ class L2NormCPUKernel : public LiteKernel { float *output_ptr_ = nullptr; float *tmp_sum_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_L2_NORM_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32.cc index aef6a970c40a384fef8408782e16b649c3649982..76404ebc6f09f75a191d774ee925c8dc969b1608 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LSTM; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kMindirInputTensorNum = 4; } @@ -55,4 +55,4 @@ LiteKernel *LstmFp32KernelCreator(const std::vector &inputs, con return kernel; } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_LSTM, LstmFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32_base.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32_base.cc index d5975a8d915d3ff670c6568c8f8c8725a778c6f9..7533752337668566c8918e7a5f37487fadc72c32 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32_base.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kMindirInputTensorNum = 4; constexpr int kGateNum = 4; @@ -395,4 +395,4 @@ void LstmFp32BaseCPUKernel::LstmBackwardLoop(float *buffer[]) { LstmUnidirectional(backward_output, backward_weight_h, backward_state_bias, backward_hidden_state, backward_cell_state, backward_weight_project, intermediate_states, buffer, true); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32_base.h b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32_base.h index 2f96c661751084bbb82b29206a2b0e5a3ebdbdec..71877c172b6604c98cdf60742f1115a1d732d92a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_fp32_base.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32/lstm_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LstmFp32BaseCPUKernel : public LiteKernel { public: LstmFp32BaseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -73,6 +73,6 @@ class LstmFp32BaseCPUKernel : public LiteKernel { float *buffer_forward_[C9NUM] = {nullptr}; float *buffer_backward_[C9NUM] = {nullptr}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP32_LSTM_FP32_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_mindir_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_mindir_fp32.cc index 97ccf931d3006bd71fcdde80f1b7f587936ff7b2..526dd75221b148a75b81baa9e6908dda0a8aeb53 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_mindir_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_mindir_fp32.cc @@ -17,7 +17,7 @@ #include "src/litert/kernel/cpu/fp32/lstm_mindir_fp32.h" #include "nnacl_c/fp32/pack_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kInputGateIndex = 0; constexpr int kTempHiddenOutputIndex = 8; @@ -263,4 +263,4 @@ void LstmMindirFp32CPUKernel::RecordStates(const float *hidden_state, float *cel stride += seq_stride; memcpy(states + stride, cell_gate, state_size * sizeof(float)); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_mindir_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_mindir_fp32.h index 1704b7e338234a6adccb8f41bc234d34260fe845..a7673df653569396a38240cfd70f6a29cb5594d4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_mindir_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_mindir_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/lstm_fp32_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { /* * 1. LSTM without project, output_size = hidden_size * h_init: second input, shape is [bidirectional, batch_size, hidden_size] @@ -58,6 +58,6 @@ class LstmMindirFp32CPUKernel : public LstmFp32BaseCPUKernel { float *forget_gate, const float *cell_gate, float *intermediate_states, int step); bool gpu_orig_state_{false}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP32_LSTM_MINDIR_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.cc index 317ea2cfbe205df10def94362e327fe98de0d2a1..3f09141280650c3601c72da1f8a77f055f57b8cb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.cc @@ -17,7 +17,7 @@ #include "src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.h" #include "nnacl_c/fp32/pack_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kInputGateIndex = 0; constexpr int kGateNum = 4; @@ -170,4 +170,4 @@ void LstmNonMindirFp32CPUKernel::LstmUnidirectional(float *output, const float * weight_project, hidden_state, cell_state, buffer, lstm_param_); } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.h index e18d06b9a061339f38d416f32d300ef232776299..b79a373f495e6b2a374e1f5452d81b3c72a8b767 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/lstm_non_mindir_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/fp32/lstm_fp32_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { /* * 1. LSTM without project, output_size = hidden_size * weight_ih: second input, shape is [bidirectional, 4 * hidden_size, input_size] @@ -56,6 +56,6 @@ class LstmNonMindirFp32CPUKernel : public LstmFp32BaseCPUKernel { float *cell_state, const float *weight_project, float *intermediate_states, float *buffer[], bool is_backward) override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP32_LSTM_NON_MINDIR_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32.cc index 42cea2732ce06d515fb9768b02182cf09b0442fe..e6480aa52365ffe400add5609be3dc13b7fd5aa3 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32.cc @@ -48,7 +48,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_MatMulFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int MatmulCPUKernel::Prepare() { CHECK_NULL_RETURN(matmul_base_); matmul_base_->set_name(name_); @@ -115,4 +115,4 @@ int MatmulCPUKernel::PreparePackedWeight(const lite::Tensor *tensor) { matmul_base_->SetWeightIsPacked(true); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32.h index 1f0f3403e2d3359014a6a9752496d838896ed739..0e75df04035929545d0b14cf282cfe49161f4efb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32.h @@ -21,7 +21,7 @@ #include "nnacl_c/matmul_parameter.h" #include "src/litert/kernel/cpu/fp32/matmul_fp32_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { MatmulFp32BaseCPUKernel *CreateMatmulFp32CPUKernel(OpParameter *parameter, const std::vector &inputs, const std::vector &outputs, const lite::InnerContext *ctx); @@ -93,5 +93,5 @@ class MatmulCPUKernel : public LiteKernel { private: MatmulFp32BaseCPUKernel *matmul_base_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_MATMUL_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm32.cc index 55cd42fb4f8db3f48f94c96d4211bd1e334539eb..235af37c4596ccd13a30c2a0d26a3cfa8421201c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm32.cc @@ -20,7 +20,7 @@ #include "nnacl_c/fp32/matmul_fp32.h" #include "nnacl_c/fp32/pack_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void MatmulFp32ARM32CPUKernel::InitGlobalVariable() { matrix_a_.need_pack = true; matrix_b_.need_pack = true; @@ -101,5 +101,5 @@ int MatmulFp32ARM32CPUKernel::ParallelRunByOC(int task_id) const { } bool MatmulFp32ARM32CPUKernel::CheckThreadCuttingByRow() { return false; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm32.h index 95d0200cad1a69c52862c9064f24f34233cee5cc..da2b199f32292db83fa528b8a384500ce693a912 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm32.h @@ -19,7 +19,7 @@ #ifdef ENABLE_ARM32 #include #include "src/litert/kernel/cpu/fp32/matmul_fp32_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulFp32ARM32CPUKernel : public MatmulFp32BaseCPUKernel { public: MatmulFp32ARM32CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -36,6 +36,6 @@ class MatmulFp32ARM32CPUKernel : public MatmulFp32BaseCPUKernel { int ParallelRunByOC(int task_id) const override; bool CheckThreadCuttingByRow() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_MATMUL_FP32_ARM32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm64.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm64.cc index 902c01fc25c5adb3a0bc9933c78fecda6109de26..ba762da810bf3bc99d8868d44ae9fcf190d30358 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm64.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm64.cc @@ -22,7 +22,7 @@ #include "nnacl_c/fp32/pack_fp32.h" #include "nnacl_c/fp32/pack_fp32_opt.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int64_t kPackAMinUnitNum = 1 << 13; } // namespace @@ -171,5 +171,5 @@ bool MatmulFp32ARM64CPUKernel::CheckThreadCuttingByRow() { } return false; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm64.h b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm64.h index 021ba6e2bebc1580dfe37958396012d9cd352a17..031f82a45894dd80ab1c2317bcd987ee6745b336 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm64.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_arm64.h @@ -20,7 +20,7 @@ #ifdef ENABLE_ARM64 #include #include "src/litert/kernel/cpu/fp32/matmul_fp32_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulFp32ARM64CPUKernel : public MatmulFp32BaseCPUKernel { public: MatmulFp32ARM64CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,7 +37,7 @@ class MatmulFp32ARM64CPUKernel : public MatmulFp32BaseCPUKernel { int ParallelRunByOC(int task_id) const override; bool CheckThreadCuttingByRow() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_MATMUL_FP32_ARM64_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx.cc index 401bff220f5b80250c5e5e165509446b45ff1830..855b2b767965a8bfd134472fc2913b8e3a24fc8a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx.cc @@ -20,7 +20,7 @@ #include "nnacl_c/fp32/matmul_fp32.h" #include "nnacl_c/fp32/pack_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void MatmulFp32AVXCPUKernel::InitGlobalVariable() { matrix_a_.need_pack = true; matrix_b_.need_pack = true; @@ -152,5 +152,5 @@ bool MatmulFp32AVXCPUKernel::CheckThreadCuttingByRow() { return MSMIN(row_num_ / row_min_unit_, op_parameter_->thread_num_) > MSMIN(col_step_ / col_min_unit_, op_parameter_->thread_num_); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx.h b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx.h index 0978df91812b3533b6f698bcc91092d3121b1024..76f537f79a9d428a97881219becfc929c3dd2f4f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx.h @@ -20,7 +20,7 @@ #if defined(ENABLE_AVX) #include #include "src/litert/kernel/cpu/fp32/matmul_fp32_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulFp32AVXCPUKernel : public MatmulFp32BaseCPUKernel { public: MatmulFp32AVXCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -38,7 +38,7 @@ class MatmulFp32AVXCPUKernel : public MatmulFp32BaseCPUKernel { bool CheckThreadCuttingByRow() override; bool SupportMulBatchCuttingByRow() { return true; } }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_MATMUL_FP32_AVX_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx512.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx512.cc index bd96027f135ba2f76ddcdc6134519119a1501ece..44055e9d9463847d211f2ecc9c0ac2e72d67d1d2 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx512.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx512.cc @@ -22,7 +22,7 @@ #include "nnacl_c/fp32/matmul_fp32.h" #include "nnacl_c/fp32/pack_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { size_t min_calc_cost_ = 1 * 6 * 64 * 64; } @@ -731,5 +731,5 @@ bool MatmulFp32AVX512CPUKernel::CheckThreadCuttingByRow() { } return MSMIN(row_num_ / row_min_unit_, thread_num_) > MSMIN(col_step_ / col_min_unit_, thread_num_); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx512.h b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx512.h index 8bc1afbf88854a40789c8ef5058f0cee8ebafe08..0ff7482f6190b0b31cd1bf66cbb4d1bae822c49c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx512.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_avx512.h @@ -20,7 +20,7 @@ #ifdef ENABLE_AVX512 #include #include "src/litert/kernel/cpu/fp32/matmul_fp32_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { struct MatmulSlice { int row_s_ = 0; int row_e_ = 0; @@ -58,7 +58,7 @@ class MatmulFp32AVX512CPUKernel : public MatmulFp32BaseCPUKernel { std::vector> matmul_slice_set_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_MATMUL_FP32_AVX512_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_base.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_base.cc index 90d365b837aaa65b8e58a2ddcab2f3330c755176..d46ec4ad885a6c64ea5b15f551e01293b6a62a04 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_base.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_base.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_MatMulFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int MatmulRun(void *cdata, int task_id, float, float) { CHECK_NULL_RETURN(cdata); auto op = reinterpret_cast(cdata); @@ -853,4 +853,4 @@ int MatmulFp32BaseCPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_base.h b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_base.h index f1ac4f117245b38be851d8c2696bae7749f7c831..cb5f2182b4537b289f0c1ab3e839020dff41c00e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_base.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_base.h @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using MatrixPackFun = void (*)(const float *src_ptr, float *dst_ptr, int row, int col, int start_row, int end_row); using GemmIsNotPackFun = void (*)(const float *a, const float *b, float *c, const float *bias, int m, int k, int act_type); @@ -147,5 +147,5 @@ class MatmulFp32BaseCPUKernel : public LiteKernel { bool is_sharing_pack_ = true; bool weight_is_packed_{false}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_MATMUL_FP32_BASE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_sse.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_sse.cc index 996e968dc743870008e060d64f48cd6787a74e7f..4c09f718124a57cbdb982ef7af8f0def34ab714a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_sse.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_sse.cc @@ -20,7 +20,7 @@ #include "nnacl_c/fp32/matmul_fp32.h" #include "nnacl_c/fp32/pack_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void MatmulFp32SSECPUKernel::InitGlobalVariable() { matrix_a_.need_pack = true; matrix_b_.need_pack = true; @@ -101,5 +101,5 @@ int MatmulFp32SSECPUKernel::ParallelRunByOC(int task_id) const { } bool MatmulFp32SSECPUKernel::CheckThreadCuttingByRow() { return false; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_sse.h b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_sse.h index 5484336b85047b159e02e2686ef5dd3180eb0606..2e53a50256764f3f9243d45b681d00c9ae5585e0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_sse.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/matmul_fp32_sse.h @@ -20,7 +20,7 @@ #if defined(ENABLE_SSE) #include #include "src/litert/kernel/cpu/fp32/matmul_fp32_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulFp32SSECPUKernel : public MatmulFp32BaseCPUKernel { public: MatmulFp32SSECPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,7 +37,7 @@ class MatmulFp32SSECPUKernel : public MatmulFp32BaseCPUKernel { int ParallelRunByOC(int task_id) const override; bool CheckThreadCuttingByRow() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_MATMUL_FP32_SSE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/non_max_suppression_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/non_max_suppression_fp32.cc index 5c31033fe9fc4c6538252a2a59fd71f9b81e098e..fda3ad64350bf082349cb7cbb8fb0eff1e8f9281 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/non_max_suppression_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/non_max_suppression_fp32.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NULL_PTR; using mindspore::schema::PrimitiveType_NonMaxSuppression; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kMinInputsSize = 2; constexpr size_t kMaxInputsSize = 5; @@ -256,4 +256,4 @@ int NonMaxSuppressionCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_NonMaxSuppression, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/non_max_suppression_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/non_max_suppression_fp32.h index 0cce8151fd7fe48f0c67e9c346acec4c1667c1b1..06b12756df4bfb7a67e2ddd1474a107139a0534b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/non_max_suppression_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/non_max_suppression_fp32.h @@ -25,7 +25,7 @@ using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class NonMaxSuppressionCPUKernel : public LiteKernel { public: NonMaxSuppressionCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -100,6 +100,6 @@ class NMSBox { float x2_; float area_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_NON_MAX_SUPPRESSION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/cast_gather_reduce_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/cast_gather_reduce_fp32.cc index 5a937d59bbd4a9378eebdbf47246a1699ae00fc2..9033ff7e6b64c43d5661961d4f315dcefc30bd3a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/cast_gather_reduce_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/cast_gather_reduce_fp32.cc @@ -26,7 +26,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int CastGatherReduceFusionCPUKernel::Prepare() { if (!InferShapeDone()) { return RET_OK; @@ -92,4 +92,4 @@ REG_KERNEL(kCPU, kNumberTypeInt32, PrimType_Inner_CastGatherReduceFusion, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt64, PrimType_Inner_CastGatherReduceFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/cast_gather_reduce_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/cast_gather_reduce_fp32.h index 9b6084dc4ff88ae2cb303ebc44482dab96303f18..06d8f844a3d058fab04147b352995acf1fd8d6a8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/cast_gather_reduce_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/cast_gather_reduce_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CastGatherReduceFusionCPUKernel : public LiteKernel { public: CastGatherReduceFusionCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -43,6 +43,6 @@ class CastGatherReduceFusionCPUKernel : public LiteKernel { size_t axis_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_ONLINE_FUSION_CAST_GATHER_REDUCE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/reduce_concat_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/reduce_concat_fp32.cc index 76a7b698199c9a91fea8febea770b5add9cc982a..0b0d986c91867472366f6e023af6dc7d7bb07f2d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/reduce_concat_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/reduce_concat_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ReduceConcatFusionCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -79,4 +79,4 @@ int ReduceConcatFusionCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimType_Inner_ReduceConcatFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/reduce_concat_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/reduce_concat_fp32.h index 0b136f94e669d2dd52026fac0d7c56888f8cf0fc..095722f3e821dbab36d5e109c99f20c540ca9bcb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/reduce_concat_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/reduce_concat_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ReduceConcatFusionCPUKernel : public LiteKernel { public: ReduceConcatFusionCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class ReduceConcatFusionCPUKernel : public LiteKernel { int64_t inner_tile_ = 0; int64_t batch_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_ONLINE_FUSION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/split_reduce_concat_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/split_reduce_concat_fp32.cc index d6f00fb94774fcb07c8f0d5e43702af8ab297c0b..1a78a118e9961beecb0068c54470f6d79932ea30 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/split_reduce_concat_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/split_reduce_concat_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SplitReduceConcatFusionCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -97,4 +97,4 @@ int SplitReduceConcatFusionCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimType_Inner_SplitReduceConcatFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/split_reduce_concat_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/split_reduce_concat_fp32.h index 376cd7c4c56abb71d9e7fe439843fa3b4d4d65bd..fd63cedd2ed316d2c433b8963dc210ccdeedb7ed 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/split_reduce_concat_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/online_fusion/split_reduce_concat_fp32.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/split_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SplitReduceConcatFusionCPUKernel : public LiteKernel { public: SplitReduceConcatFusionCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -49,6 +49,6 @@ class SplitReduceConcatFusionCPUKernel : public LiteKernel { int64_t mid_len_ = 0; size_t axis_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_ONLINE_FUSION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/reduce_scatter_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/reduce_scatter_fp32.cc index 4e72473ca6781da71ccf16e9337e6ee60af5b1ff..98b016999af2b086b010f7191f95cfc79d595b5b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/reduce_scatter_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/reduce_scatter_fp32.cc @@ -23,7 +23,7 @@ using mindspore::kernel::KERNEL_ARCH; using mindspore::lite::KernelRegistrar; using mindspore::schema::PrimitiveType_ReduceScatter; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ReduceScatterCPUKernel::Prepare() { MS_LOG(ERROR) << "unsupported ReduceScatter kernel"; return lite::RET_NOT_SUPPORT; @@ -98,4 +98,4 @@ int ReduceScatterCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_ReduceScatter, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/reduce_scatter_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/reduce_scatter_fp32.h index 6dd140fcdc4b1893d09ff147bb40104bbd813c76..b3361001e082fd42a12ceecc9da53f47d1d777f4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/reduce_scatter_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/reduce_scatter_fp32.h @@ -22,7 +22,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/reduce_scatter_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ReduceScatterCPUKernel : public LiteKernel { public: ReduceScatterCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -43,6 +43,6 @@ class ReduceScatterCPUKernel : public LiteKernel { ReduceScatterParameter *param_; TypeId data_type_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_REDUCE_SCATTER_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/relative_position_attention_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/relative_position_attention_fp32.cc index 1bb57069b830e41b799bb8fa80881ad00ac22211..5f7a28823349b9c74f1b7cf0a1e530cbd7bb8f01 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/relative_position_attention_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/relative_position_attention_fp32.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { RelativePositionAttentionCPUKernel::~RelativePositionAttentionCPUKernel() { FreeAllPackData(); } namespace { @@ -753,4 +753,4 @@ int RelativePositionAttentionCPUKernel::Run() { FreePackedRunBuffers(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/relative_position_attention_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/relative_position_attention_fp32.h index 1ad095d44988ff6249739a88b5084669df85704b..20f5d5f9b85b1dd9c8448bba0eeafe43c5c2b7e1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/relative_position_attention_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/relative_position_attention_fp32.h @@ -22,7 +22,7 @@ #include "nnacl_c/fp32/attention_fp32.h" #include "nnacl_c/matmul_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { // inputs: 0:Q 1:K 2:V 3:P 4:WQ 5:WK 6:WV 7:WP 8:PU 9:PV 10:WO 11:BQ 12:BK 13:BV 14:BO 15:output // if use_bias == true: has BQ BK BV BO inputs class RelativePositionAttentionCPUKernel : public LiteKernel { @@ -152,6 +152,6 @@ class RelativePositionAttentionCPUKernel : public LiteKernel { RelativePositionAttentionParameter *param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_RELATIVE_POSITION_ATTENTION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/resize_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/resize_fp32.cc index 63038d3e7e18c2acac1fe085353e0e0e640f70cd..e0a74e3fb83d70fb1c347fa1444272d9412dbded 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/resize_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/resize_fp32.cc @@ -31,7 +31,7 @@ using mindspore::schema::CoordinateTransformMode_ASYMMETRIC; using mindspore::schema::CoordinateTransformMode_HALF_PIXEL; using mindspore::schema::PrimitiveType_Resize; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kResizeSizeDouble = 2; } // namespace @@ -267,4 +267,4 @@ int ResizeCPUKernel::SelectCalculatorFunc() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Resize, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/resize_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/resize_fp32.h index a38309d6436de546f67efc515deeb8ec80d6eb83..1c35bbc6544e49af060126aa564302f083ee3502 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/resize_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/resize_fp32.h @@ -56,7 +56,7 @@ struct ResizeCoordinate { } }; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ResizeCPUKernel : public ResizeBaseCPUKernel { public: ResizeCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -83,6 +83,6 @@ class ResizeCPUKernel : public ResizeBaseCPUKernel { void *line_buffer_ = nullptr; CalculateOriginalCoordinate calculate_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_RESIZE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/reverse_sequence_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/reverse_sequence_fp32.cc index 389800fcc7552dd80b9a509f7384595c75137f1c..630bbf2545d0ed1ec8c88624da7ad202c76e4ff1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/reverse_sequence_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/reverse_sequence_fp32.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ReverseSequence; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ReverseSequenceCPUKernel::Prepare() { MS_CHECK_TRUE_RET(in_tensors_.size() == kInputSize1, RET_ERROR); MS_CHECK_TRUE_RET(out_tensors_.size() == 1, RET_ERROR); @@ -113,4 +113,4 @@ int ReverseSequenceCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_ReverseSequence, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/reverse_sequence_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/reverse_sequence_fp32.h index 5960b3703bae00181f192b0f9d4592e65589bfa2..b041ae69d68e374d2fe2d97dec4ee25ab4362721 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/reverse_sequence_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/reverse_sequence_fp32.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32/reverse_sequence_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ReverseSequenceCPUKernel : public LiteKernel { public: ReverseSequenceCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,6 +37,6 @@ class ReverseSequenceCPUKernel : public LiteKernel { int CalcCountPreAxis(const std::vector shape, int axis) const; int CalcCountAfterAxis(const std::vector shape, int axis) const; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_REVERSE_SEQUENCE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/roi_pooling_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/roi_pooling_fp32.cc index cbc26b7eafdf8eb3a6fbae9a69a2fa3877d1280d..bad217286b0fc7c1dc0d58e8e12f64e2eb09317a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/roi_pooling_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/roi_pooling_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ROIPooling; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ROIPoolingCPUKernel::Prepare() { MS_CHECK_TRUE_RET(in_tensors_.size() == kInputSize1, RET_ERROR); MS_CHECK_TRUE_RET(out_tensors_.size() == 1, RET_ERROR); @@ -119,4 +119,4 @@ int ROIPoolingCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_ROIPooling, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/roi_pooling_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/roi_pooling_fp32.h index de6af7b0f53125827f88de863dbef9aac6dc208d..9f1420e242e2336778898667704dbcd5b55760cc 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/roi_pooling_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/roi_pooling_fp32.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32/roi_pooling_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ROIPoolingCPUKernel : public LiteKernel { public: ROIPoolingCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class ROIPoolingCPUKernel : public LiteKernel { float *max_c_ = nullptr; ROIPoolingParameter *param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_REVERSE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/scatter_nd_update_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/scatter_nd_update_fp32.cc index 62b90086259e6378d7f02b0c53f58033ec01455c..65b2b03097368d2e52e35575d047e498a9aa591a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/scatter_nd_update_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/scatter_nd_update_fp32.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ScatterNdUpdate; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int ScatterNdUpdateRun(void *cdata, int task_id, float, float) { auto kernel = static_cast(cdata); @@ -80,4 +80,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_ScatterNdUpdate, LiteKernelCr #ifdef ENABLE_FP16 REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_ScatterNdUpdate, LiteKernelCreator) #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/scatter_nd_update_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/scatter_nd_update_fp32.h index a41b33213f3203cc93662be226cbe0dfd08d7347..dd3a3d0b362077b2810c0d6613d1e1c7b64f52fd 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/scatter_nd_update_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/scatter_nd_update_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/base/scatter_nd_binary.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ScatterNdUpdateCPUKernel : public ScatterNDBinaryCPUKernel { public: @@ -32,6 +32,6 @@ class ScatterNdUpdateCPUKernel : public ScatterNDBinaryCPUKernel { int Run() override; int ScatterNdUpdate(int task_id); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_FP32_SCATTER_ND_UPDATE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.cc index c25bb5b43bda21140a2541d439c19ebf3b6ccf0c..90f7e1438ad83add1e6a79adb4ea7e76774f12a6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.cc @@ -25,7 +25,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ShapeFusionCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), kInputSize1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -49,4 +49,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimType_Inner_ShapeFusion, LiteKernelCreat REG_KERNEL(kCPU, kNumberTypeInt8, PrimType_Inner_ShapeFusion, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeUInt8, PrimType_Inner_ShapeFusion, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt64, PrimType_Inner_ShapeFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.h index be8dcfdcda82df5a47576f729eddbf572b30fdfa..8aedcbe06f828690deebfdf44d017df76dfcfdd6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/shape_fusion_fp32.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ShapeFusionCPUKernel : public LiteKernel { public: ShapeFusionCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -32,6 +32,6 @@ class ShapeFusionCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_SHAPE_FUSION_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_batch_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_batch_fp32.cc index dc2cd9641251e114d03e5f5c2c238b1555989042..9a09fa5a7a6606330daf893f08889644fa1e6ccb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_batch_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_batch_fp32.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SpaceToBatch; using mindspore::schema::PrimitiveType_SpaceToBatchND; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void SpaceToBatchCPUKernel::ProcessInput() { auto block_shape_data = in_tensors_.at(SECOND_INPUT)->data(); auto block_shape = static_cast(block_shape_data); @@ -103,4 +103,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SpaceToBatchND, LiteKernelCre REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_SpaceToBatch, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_SpaceToBatchND, LiteKernelCreator) #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_batch_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_batch_fp32.h index 73c99f6f57a5e0ada152995ba997544d87fc1658..40e77ba46eee3f02a3f821de9935ce332a01bd64 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_batch_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_batch_fp32.h @@ -21,7 +21,7 @@ #include "nnacl_c/fp32/space_to_batch_fp32.h" #include "nnacl_c/common_func.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SpaceToBatchCPUKernel : public LiteKernel { public: SpaceToBatchCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -43,6 +43,6 @@ class SpaceToBatchCPUKernel : public LiteKernel { void *input_ptr_ = nullptr; void *output_ptr_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_SPACE_TO_BATCH_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_depth_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_depth_fp32.cc index eb574a07f935d1250104941c1d00692f8f62a6a9..5ff2722747fa2e8632e6f039d9a6d2b00ff4c68e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_depth_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_depth_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_SpaceToDepth; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SpaceToDepthCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -95,4 +95,4 @@ REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SpaceToDepth, LiteKernelCreat #ifdef ENABLE_FP16 REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_SpaceToDepth, LiteKernelCreator) #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_depth_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_depth_fp32.h index 2e46b09129dc6441e49085a374e14805de026b0e..d8a24cf1fd2f55683739c6778c9fe2fed52ca7f6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_depth_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/space_to_depth_fp32.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/space_to_depth_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SpaceToDepthCPUKernel : public LiteKernel { public: SpaceToDepthCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -38,6 +38,6 @@ class SpaceToDepthCPUKernel : public LiteKernel { private: SpaceToDepthParameter *param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_SPACE_TO_DEPTH_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_fill_empty_rows_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_fill_empty_rows_fp32.cc index 2c96dac32f6b084ceba7ec31fb3e90dd342b8e3e..efdc077590d95b09d7e4eb734c7ebed1802bc5af 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_fill_empty_rows_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_fill_empty_rows_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SparseFillEmptyRows; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const uint32_t kInput_indices = 0; const uint32_t kInput_values = 1; @@ -198,4 +198,4 @@ int SparseFillEmptyRowsCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_SparseFillEmptyRows, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SparseFillEmptyRows, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_fill_empty_rows_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_fill_empty_rows_fp32.h index 8c757266160bad8e28d2122990c39aef74580afc..c981f0432154e24c6f3ee11f0a4c5df2bb32ded9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_fill_empty_rows_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_fill_empty_rows_fp32.h @@ -21,7 +21,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SparseFillEmptyRowsCPUKernel : public LiteKernel { public: SparseFillEmptyRowsCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -46,5 +46,5 @@ class SparseFillEmptyRowsCPUKernel : public LiteKernel { int32_t N_ = 0; int32_t rank_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_SPARSE_FILL_EMPTY_ROWS_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_reshape_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_reshape_fp32.cc index 98e637f1d4fe48d730bbc9a9e9019eb66509e6c7..6998dea4674754900ffa421c8ce941d0f7953998 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_reshape_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_reshape_fp32.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SparseReshape; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const uint32_t kInput_indices = 0; const uint32_t kInput_inshape = 1; @@ -186,4 +186,4 @@ int SparseReshapeCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_SparseReshape, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_reshape_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_reshape_fp32.h index c1f84456e55ddf2f327bd78460ac23dd4ea9ec39..cf8b3b919ec2a5b54b34cea7de9250c0e8f1bddf 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_reshape_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_reshape_fp32.h @@ -21,7 +21,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SparseReshapeCPUKernel : public LiteKernel { public: SparseReshapeCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,5 +35,5 @@ class SparseReshapeCPUKernel : public LiteKernel { int Run() override; int SoftCopyInputToOutput(lite::Tensor *src_tensor, lite::Tensor *dst_tensor); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_SPARSE_RESHAPE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_segment_sum_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_segment_sum_fp32.cc index 59491b5b3827eecbbac85c41f08a1f0ea02c75bb..ddb9b28a7de7b02cf17fabf80e3ee37e47654dfe 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_segment_sum_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_segment_sum_fp32.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SparseSegmentSum; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const uint32_t kInput_data = 0; const uint32_t kInput_indices = 1; @@ -118,4 +118,4 @@ int SparseSegmentSumCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_SparseSegmentSum, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SparseSegmentSum, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_segment_sum_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_segment_sum_fp32.h index 448f3f6f3b6b13432dc19f79262cbc012e07f0bc..036b9f352e4c3857dd3323eceb0bea3229b99e4b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_segment_sum_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_segment_sum_fp32.h @@ -21,7 +21,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SparseSegmentSumCPUKernel : public LiteKernel { public: SparseSegmentSumCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -34,5 +34,5 @@ class SparseSegmentSumCPUKernel : public LiteKernel { int ReSize() override { return RET_OK; } int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_SPARSE_SEGMENT_SUM_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_to_dense_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_to_dense_fp32.cc index 23c2d68d587aba84d3fa6614862e0d728b58e56e..d54d535ffd47c277f2cc3654f5eb2e205ac697e6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_to_dense_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_to_dense_fp32.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SparseToDense; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SparseToDenseCPUKernel::Prepare() { MS_CHECK_TRUE_RET(in_tensors_.size() == C4NUM, RET_ERROR); CHECK_NULL_RETURN(in_tensors_[FIRST_INPUT]); // arg: sparse_indices @@ -222,4 +222,4 @@ REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_SparseToDense, LiteKernelCreato #ifdef ENABLE_FP16 REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_SparseToDense, LiteKernelCreator) #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_to_dense_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_to_dense_fp32.h index c4d0d2ce3571b7de49ed3a9c7633a5cc52af87b2..8666448a2fb922c4fc9c1bd1f727c5baefe0ae6c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_to_dense_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/sparse_to_dense_fp32.h @@ -23,7 +23,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SparseToDenseCPUKernel : public LiteKernel { public: SparseToDenseCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,5 +47,5 @@ class SparseToDenseCPUKernel : public LiteKernel { void *sparse_values_ = nullptr; void *default_value_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_SPARSE_TO_DENSE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/topk_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/topk_fp32.cc index 91267ed7d291c994ea42cd0be3e9ae3f3e6a92aa..bfd62f750ff53192d75af1dea6009a3f31259760 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/topk_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/topk_fp32.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_TopKFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TopKCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -93,4 +93,4 @@ REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_TopKFusion, LiteKernelCreator) #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/topk_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/topk_fp32.h index 27ebdfa18ddc9258849e1c611710489d3d4cbbe2..9814995bafed31d4d7abb572f4435f98351775b4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/topk_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/topk_fp32.h @@ -23,7 +23,7 @@ #include "nnacl_c/fp16/topk_fp16.h" #endif -namespace mindspore::kernel { +namespace mindspore::lite::kernel { typedef void (*TopKFunc)(void *input_data, void *output_data, int32_t *output_index, TopkParameter *parameter); class TopKCPUKernel : public LiteKernel { public: @@ -61,6 +61,6 @@ class TopKCPUKernel : public LiteKernel { TopkParameter *topk_param_; TopKFunc topk_func_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_TOPK_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/transpose_server_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/transpose_server_fp32.cc index 18233eea6298e6f82b53d63eefabf7598467af40..23a60eb6802669c29565927bdab16f37202d341b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/transpose_server_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/transpose_server_fp32.cc @@ -22,7 +22,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Transpose; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int64_t kMinCostPerThread = 1 << 18; } @@ -130,5 +130,5 @@ int TransposeServerCPUKernel::DoTransposeMultiThread(int task_id) { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Transpose, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_Transpose, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/transpose_server_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/transpose_server_fp32.h index 3793c3fcdd02373190c6a4d4a3afb6388e5a492e..b04a61b0136d79c6a08ed65e4bf603158532e849 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/transpose_server_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/transpose_server_fp32.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/base/transpose_base.h" #include "nnacl_c/fp32/transpose_server_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TransposeServerCPUKernel : public TransposeBaseCPUKernel { public: explicit TransposeServerCPUKernel(OpParameter *param, const std::vector &inputs, @@ -41,7 +41,7 @@ class TransposeServerCPUKernel : public TransposeBaseCPUKernel { std::vector strides_; std::vector block_boundary_infos_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_TRANSPOSE_SERVER_FP32_H_ #endif diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/uniform_real_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/uniform_real_fp32.cc index 2318a821a98edc39b010785d51743c2f723ed8f3..b8df6288c5ea787da4d4feca0b8fa538a7e40eab 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/uniform_real_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/uniform_real_fp32.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_UniformReal; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kFirstKeyIndex = 0; constexpr size_t kSecondKeyIndex = 1; @@ -231,4 +231,4 @@ int UniformRealCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_UniformReal, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/uniform_real_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/uniform_real_fp32.h index 790d1e29cf3723322f6fc96275bc998b6d339417..c823abd88fa68c0229c2328f77e1837bb6c434f1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/uniform_real_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/uniform_real_fp32.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/random_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class UniformRealCPUKernel : public LiteKernel { public: UniformRealCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -38,6 +38,6 @@ class UniformRealCPUKernel : public LiteKernel { int seed_ = 0; int seed2_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_UNIFORM_REAL_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/unstack_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32/unstack_fp32.cc index 3360ac182604969713d57378cd312561af420186..f105df08ff6099bf9d80f2b7642f69cf92454ab3 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/unstack_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/unstack_fp32.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Unstack; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int UnstackCPUKernel::Prepare() { MS_CHECK_TRUE_RET(in_tensors_.size() == 1, RET_ERROR); MS_CHECK_TRUE_RET(out_tensors_.size() >= 1, RET_ERROR); @@ -90,4 +90,4 @@ REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_Unstack, LiteKernelCreator) #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32/unstack_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32/unstack_fp32.h index 2e11ac413d5bce1a6a073732a2016c7969f5d2ee..588ddfbdcca5382053c0447cd4ab0af0333c8c49 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32/unstack_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32/unstack_fp32.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/base/unstack_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class UnstackCPUKernel : public LiteKernel { public: UnstackCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class UnstackCPUKernel : public LiteKernel { private: void **output_addr_array_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_UNSTACK_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/activation_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/activation_grad.cc index 15f6ac92a88ed9425314ebff41430506b6c21b2b..d75030fdb8349f86cd31a2863a3fe945dc550e89 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/activation_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/activation_grad.cc @@ -32,7 +32,7 @@ using mindspore::schema::ActivationType_RELU; using mindspore::schema::ActivationType_RELU6; using mindspore::schema::PrimitiveType_ActivationGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ActivationGradCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -114,4 +114,4 @@ int ActivationGradCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_ActivationGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/activation_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/activation_grad.h index 1e0e79cc94456ae4c5a8d5850051ae30c8203394..85161d0440211d247923c44dbbbafbfb128c32bd 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/activation_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/activation_grad.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32/activation_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ActivationGradCPUKernel : public LiteKernel { public: explicit ActivationGradCPUKernel(OpParameter *param, const std::vector &inputs, @@ -40,6 +40,6 @@ class ActivationGradCPUKernel : public LiteKernel { ActivationParameter *param_act_grad_; int thread_count_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_ACTIVATION_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam.cc index 1a783e936067682693f962f8d827673c0e25c5ae..2f63a2a3ecf03299a9393050e3cf411cb83949d8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Adam; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kBeta1PowerIdx = 3; constexpr static int kBeta2PowerIdx = 4; constexpr static int kBeta1Idx = 6; @@ -159,4 +159,4 @@ kernel::LiteKernel *CpuAdamFp32KernelCreator(const std::vector & } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Adam, CpuAdamFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam.h index dfcc88355e1c3d253013f0da431d3a47c1598ca2..8ad493ff1b39807809b648c4282dd998f6fc0035 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam.h @@ -21,7 +21,7 @@ #include "src/train/optimizer_kernel.h" #include "nnacl_c/fp32_grad/optimizer.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr int kAdamLrIndex = 5; constexpr int kAdamGradIndex = 9; @@ -51,6 +51,6 @@ class AdamCPUKernel : public OptimizerKernel { int thread_count_; AdamParameter *adam_param_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_ADAM_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam_weight_decay.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam_weight_decay.cc index 5c30fb8db014001ba96d1b6ce778877e93dc888f..8e1308dcf9516986758d2972f98f4b0bcde7b2d2 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam_weight_decay.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/adam_weight_decay.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_AdamWeightDecay; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr static int kBeta1Idx = 4; constexpr static int kBeta2Idx = 5; @@ -146,4 +146,4 @@ kernel::LiteKernel *CpuAdamWeightDecayFp32KernelCreator(const std::vector #include "src/train/optimizer_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kLrIdx = 3; constexpr static int kGradientIdx = 8; @@ -45,6 +45,6 @@ class AdamWeightDecayCPUKernel : public OptimizerKernel { private: int thread_count_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // #define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_ADAM_WEIGHT_DECAY_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/apply_momentum.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/apply_momentum.cc index 7bccec6e91cc14c15562e17043ba117fe60dc6da..7fd4b10be2f444a06fc0eb5ff1263b09abc91083 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/apply_momentum.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/apply_momentum.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ApplyMomentum; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ApplyMomentumCPUKernel::ReSize() { return RET_OK; } static int DoApplyMomentum(float *weight, float *accumulate, float learning_rate, const float *gradient, float moment, @@ -158,4 +158,4 @@ kernel::LiteKernel *CpuApplyMomentumFp32KernelCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Assign, CpuAssignFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/assign.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/assign.h index 9b1391154e217e97774e453b2faf63c860d1a7ca..a72200fca91f4672b95bb5b6f907cfcd96438d59 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/assign.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/assign.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32_grad/optimizer.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class AssignCPUKernel : public LiteKernel { public: explicit AssignCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -36,6 +36,6 @@ class AssignCPUKernel : public LiteKernel { protected: int thread_count_ = 1; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_ASSIGN_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bias_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bias_grad.cc index 0c9c666ef0282e55b5b120367252578afc31b0d8..72953068fa5f2a84202988e30d6d362bf02438c0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bias_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bias_grad.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BiasAddGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int BiasGradCPUKernel::ReSize() { auto dims = in_tensors_[0]->shape(); bias_param->ndim_ = dims.size(); @@ -111,4 +111,4 @@ kernel::LiteKernel *CpuBiasGradFp32KernelCreator(const std::vector &inputs, @@ -39,6 +39,6 @@ class BiasGradCPUKernel : public LiteKernel { private: ArithmeticParameter *bias_param; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_BIAS_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy.cc index d0376e1493d05d8c4d38710e04ef81c509a1fe74..81dba5aa54ce7e0dc2b3bda053d5091d15ccc942 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BinaryCrossEntropy; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { BinaryCrossEntropyCPUKernel::~BinaryCrossEntropyCPUKernel() { if (tmp_loss_ != nullptr) { free(tmp_loss_); @@ -116,4 +116,4 @@ kernel::LiteKernel *CpuBinaryCrossEntropyFp32KernelCreator(const std::vector #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BinaryCrossEntropyCPUKernel : public LiteKernel { public: explicit BinaryCrossEntropyCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,6 +37,6 @@ class BinaryCrossEntropyCPUKernel : public LiteKernel { bool weight_defined_{false}; float *weight_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_BINARY_CROSS_ENTROPY_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy_grad.cc index 36b3676c21ae0a5f33479ef698f9eed606a5943a..45a64dcb83563edabd98d122823ee191c2f5f252 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy_grad.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BinaryCrossEntropyGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int BinaryCrossEntropyGradCPUKernel::ReSize() { CHECK_LESS_RETURN(in_tensors_.size(), C3NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -101,4 +101,4 @@ kernel::LiteKernel *CpuBinaryCrossEntropyGradFp32KernelCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_BinaryCrossEntropyGrad, CpuBinaryCrossEntropyGradFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy_grad.h index 0a088dec7238d8f459c87f3a1d8bdf95bdfe42f0..9bb7018589a5b3108c0d20ab17eba978106569e6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/binary_cross_entropy_grad.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BinaryCrossEntropyGradCPUKernel : public LiteKernel { public: explicit BinaryCrossEntropyGradCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -36,6 +36,6 @@ class BinaryCrossEntropyGradCPUKernel : public LiteKernel { bool weight_defined_{false}; float *weight_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_BINARY_CROSS_ENTROPY_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bn_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bn_grad.cc index ea84f8db062532720dad2c71d88f40abd92853e0..6c2706674aa27358245043f97944e6c4d9d543f9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bn_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bn_grad.cc @@ -32,7 +32,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BatchNormGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kMaxTaskNum = 3; constexpr int kNumInputDim2 = 2; @@ -199,4 +199,4 @@ kernel::LiteKernel *CpuBNGradFp32KernelCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_BatchNormGrad, CpuBNGradFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bn_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bn_grad.h index 8342ca80af93a2f5cadefa87dfe0eb6869915497..280583965fc4651d317e19a50e7be3906ab2a7c0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bn_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/bn_grad.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BNGradCPUKernel : public LiteKernel { public: @@ -36,5 +36,5 @@ class BNGradCPUKernel : public LiteKernel { private: int stage_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_BN_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution.cc index 0639cec2901d2ee02135b72dede8a8e55a76daf0..16613f24bd8ff3efa587eaaf5c0155327eebad69 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution.cc @@ -24,7 +24,7 @@ using mindspore::kernel::KERNEL_ARCH; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConvolutionTrainCPUKernel::ReSize() { if (in_tensors_.size() < 2) { MS_LOG(ERROR) << "Convolution should have at least two inputs"; @@ -185,4 +185,4 @@ kernel::LiteKernel *CpuConvTrainFp32KernelCreator(const std::vector #include "src/executor/kernel_exec.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionTrainCPUKernel : public LiteKernel { public: explicit ConvolutionTrainCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class ConvolutionTrainCPUKernel : public LiteKernel { kernel::LiteKernel *CpuConvTrainFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, const lite::InnerContext *ctx, const kernel::KernelKey &desc); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_CONVOLUTION_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_filter.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_filter.cc index 35fc941ac1c1005c65b8018c23ecef1430ba5da9..7d51b7bcf20c86547a58078b6947d3d6b8e59e1e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_filter.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_filter.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2DBackpropFilterFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kDyIdx = 0; constexpr static int kXIdx = 1; constexpr static int kDwIdx = 0; @@ -226,4 +226,4 @@ kernel::LiteKernel *CpuConvGradFilterFp32KernelCreator(const std::vector #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionGradFilterCPUKernel : public LiteKernel { public: explicit ConvolutionGradFilterCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -46,6 +46,6 @@ class ConvolutionGradFilterCPUKernel : public LiteKernel { const int chunk_ = C12NUM * 2; #endif }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_CONVOLUTION_GRAD_FILTER_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_input.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_input.cc index 515ce2ec573e2e7374cda841bc732e9bd9ab3ce4..4ba63d36904818147ddcdb852411ff609e4a0db6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_input.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_input.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2DBackpropInputFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConvolutionGradInputCPUKernel::ReSize() { auto *dy_tensor = in_tensors_.at(kInputIndex); MS_ASSERT(dy_tensor != nullptr); @@ -188,4 +188,4 @@ int ConvolutionGradInputCPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Conv2DBackpropInputFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_input.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_input.h index 5ab29a8e1cd24e352977343c88cc8135d0bc6ad0..3183b5dc0a6d687335c7d82a4a529a52335f70d6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_input.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/convolution_grad_input.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionGradInputCPUKernel : public LiteKernel { public: explicit ConvolutionGradInputCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -44,6 +44,6 @@ class ConvolutionGradInputCPUKernel : public LiteKernel { const int chunk_ = C12NUM; #endif }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_CONVOLUTION_GRAD_INPUT_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/deconvolution_grad_filter.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/deconvolution_grad_filter.cc index 94ced4c2a71603ae2c72a5dc8da43e1396b5672c..bfa37acac436b61a686cd19354606b274ec03902 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/deconvolution_grad_filter.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/deconvolution_grad_filter.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_DeConv2DGradFilter; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int DeConvolutionGradFilterCPUKernel::Prepare() { // dy is in input 0 // x is in input 1 @@ -158,4 +158,4 @@ kernel::LiteKernel *CpuDeConvGradFilterFp32KernelCreator(const std::vector #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DeConvolutionGradFilterCPUKernel : public LiteKernel { public: explicit DeConvolutionGradFilterCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,6 +37,6 @@ class DeConvolutionGradFilterCPUKernel : public LiteKernel { size_t ws_size = 0; const int chunk = 1; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_DECONVOLUTION_GRAD_FILTER_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/dropout.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/dropout.cc index aef8c820cd41dcbf82e7b8c538a898ade7dcc557..2870b30979cc10dead5e6d31f29d692ca33d112f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/dropout.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/dropout.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Dropout; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr float kOne = 1.0f; int DropoutCPUKernel::Prepare() { @@ -129,4 +129,4 @@ kernel::LiteKernel *CpuDropoutFp32KernelCreator(const std::vector #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DropoutCPUKernel : public LiteKernel { public: DropoutCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -41,6 +41,6 @@ class DropoutCPUKernel : public LiteKernel { std::bernoulli_distribution distribution_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_DROPOUT_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/dropout_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/dropout_grad.cc index f057ba4f00ecd2a072a6eb11fd7a39d8768f9f6f..41645be4d8881020a0e830bfacf86299925914d0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/dropout_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/dropout_grad.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_DropoutGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kInputIdx = 0; constexpr static int kMaskIdx = 1; constexpr static int kOutputIdx = 0; @@ -123,4 +123,4 @@ kernel::LiteKernel *CpuDropoutGradFp32KernelCreator(const std::vector #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DropoutGradCPUKernel : public LiteKernel { public: DropoutGradCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -38,6 +38,6 @@ class DropoutGradCPUKernel : public LiteKernel { int thread_count_ = 1; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_DROPOUT_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/layernorm_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/layernorm_grad.cc index 4edbed4a7ee27a9d8d1cc48681129824981eaeec..757b2a3c6cc3cd76e784566ac34e4618f6b85152 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/layernorm_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/layernorm_grad.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LayerNormGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int LayerNormGradCPUKernel::ReSize() { return RET_OK; } int LayerNormGradCPUKernel::Prepare() { @@ -129,4 +129,4 @@ int LayerNormGradCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_LayerNormGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/layernorm_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/layernorm_grad.h index 4aba8435c5a3fdcedd1291e1adb05cd3a626e113..32cc24067b0898b392b9bc40098c0449ee1eb33e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/layernorm_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/layernorm_grad.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LayerNormGradCPUKernel : public LiteKernel { public: @@ -39,5 +39,5 @@ class LayerNormGradCPUKernel : public LiteKernel { int param_num_ = 1; int param_size_ = 1; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_LAYERNORM_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_data_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_data_fp32.cc index 1d783c5db3c9921633c589d33721d30860a1f6fa..718c0b6951039b2565ca26b710ca0194bca3e08e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_data_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_data_fp32.cc @@ -22,7 +22,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/fp32/lstm_fp32.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; @@ -283,4 +283,4 @@ void LSTMGradDataCPUKernel::FreeRunBuffer() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_LSTMGradData, LiteKernelCreator) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_data_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_data_fp32.h index 6f1f62b0e91d95e449193df4478a815f6de43a33..b6743f8d83cca5aeb9cf3012370fd28979f95813 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_data_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_data_fp32.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32_grad/lstm_grad_fp32.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class LSTMGradDataCPUKernel : public LiteKernel { public: @@ -82,6 +82,6 @@ class LSTMGradDataCPUKernel : public LiteKernel { LstmGradParameter *lstm_param_ = nullptr; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_LSTM_GRAD_DATA_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_fp32.cc index a8edc072c77ece268d4d272bb624507b12f68f30..20f64d481410957a4172e3027067085bc4190035 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_fp32.cc @@ -22,7 +22,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/fp32/lstm_fp32.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; @@ -298,4 +298,4 @@ void LSTMGradCPUKernel::FreeRunBuffer() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_LSTMGrad, LiteKernelCreator) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_fp32.h index bca70e2d8e11532515028c65cbf879806176ae8d..15549af1d2a12fd6822c7e327cd2531c4dce6b73 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_fp32.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32_grad/lstm_grad_fp32.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class LSTMGradCPUKernel : public LiteKernel { public: @@ -88,6 +88,6 @@ class LSTMGradCPUKernel : public LiteKernel { LstmGradParameter *lstm_param_ = nullptr; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_LSTM_GRAD_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_weight_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_weight_fp32.cc index 4b064da1e178ac649ca841a81b6c752470d39de8..55c8bdccf2ca5a5335890153def1cae91419d0d3 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_weight_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_weight_fp32.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/fp32/lstm_fp32.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; @@ -245,4 +245,4 @@ void LSTMGradWeightCPUKernel::FreeRunBuffer() { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_LSTMGradWeight, LiteKernelCreator) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_weight_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_weight_fp32.h index 5db3f80e48bb3fbabe084af7e5059aef2c6d194a..f376e0ab7fd848b527c7d97c49a97ff57fa44d1b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_weight_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/lstm_grad_weight_fp32.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32_grad/lstm_grad_fp32.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class LSTMGradWeightCPUKernel : public LiteKernel { public: @@ -71,6 +71,6 @@ class LSTMGradWeightCPUKernel : public LiteKernel { LstmGradParameter *lstm_param_ = nullptr; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_LSTM_GRAD_WEIGHT_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/make_tuple.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/make_tuple.h index 190907e14e332e631215b8e8ff66a0e01afa99f7..1468926db630104ee681bf3352c920614b288732 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/make_tuple.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/make_tuple.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/nnacl/fp32/arithmetic.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MakeTupleCPUKernel : public LiteKernel { public: explicit MakeTupleCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class MakeTupleCPUKernel : public LiteKernel { private: OpParameter *param; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_MAKE_TUPLE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/neg_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/neg_grad.cc index 916d7e400e1e142eec99b355d8e80cf10c3b6fdb..9ef2db4f1a9ed3ff80e9af0027231b90ad37f065 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/neg_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/neg_grad.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_NegGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int NegGradRun(void *cdata, int task_id, float lhs_scale, float rhs_scale) { CHECK_NULL_RETURN(cdata); @@ -94,4 +94,4 @@ kernel::LiteKernel *CpuNegGradFp32KernelCreator(const std::vector) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/nllloss_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/nllloss_grad.h index 5b58572807499731f63337201fefd5e8dff52211..0718a1f2bdfa7939ff5ca142f6fc523cb99dd765 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/nllloss_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/nllloss_grad.h @@ -22,7 +22,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/nllloss_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class NLLLossGradCPUKernel : public LiteKernel { public: NLLLossGradCPUKernel(OpParameter *param, const std::vector &inputs, @@ -41,6 +41,6 @@ class NLLLossGradCPUKernel : public LiteKernel { int class_num_{0}; NLLLossParameter *nllloss_param_{nullptr}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_NLLLOSS_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/pooling_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/pooling_grad.cc index f79c2401409442d9452e6eb2ce6283228af7fdf0..593f2ce2f49a1d0402a6b81b906694101601a7dc 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/pooling_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/pooling_grad.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_AvgPoolGrad; using mindspore::schema::PrimitiveType_MaxPoolGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kNumShapeDim2 = 1; constexpr int kNumShapeDim3 = 2; @@ -140,4 +140,4 @@ kernel::LiteKernel *CpuPoolingGradFp32KernelCreator(const std::vector &inputs, @@ -47,6 +47,6 @@ class PowerGradCPUKernel : public LiteKernel { float shift_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_POWER_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/resize_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/resize_grad.cc index 43ec046901daa5bd3ccbf6dafef0c5c9dfa67a4b..585a739df533bb65ebc27eb252c1e1b50c67678e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/resize_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/resize_grad.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ResizeGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { float ResizeGradCPUKernel::Scaling(const size_t in_size, const size_t out_size, const bool align_corners) { return (align_corners && out_size > 1) ? (in_size - 1) / (static_cast(out_size - 1)) : in_size / (static_cast(out_size)); @@ -112,4 +112,4 @@ int ResizeGradCPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_ResizeGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/resize_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/resize_grad.h index 9a6ea8e4bd15f1c5ad80d894b569ee7ec0d86d07..491d6a84535da71fe05bd807607412030c66117d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/resize_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/resize_grad.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ResizeGradCPUKernel : public LiteKernel { public: explicit ResizeGradCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -36,6 +36,6 @@ class ResizeGradCPUKernel : public LiteKernel { private: float Scaling(size_t in_size, size_t out_size, bool align_corners); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_RESIZE_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sgd.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sgd.cc index 43db06adb4665c95148e8ec9c3a8ca29ba170469..6c3349a0010fada324d85a4e4aeaa4e8a53abf29 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sgd.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sgd.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SGD; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SgdCPUKernel::ReSize() { return RET_OK; } int DoSgd(float *weight, float *accumulate, float *gradient, float learning_rate, float dampening, float moment, @@ -268,4 +268,4 @@ kernel::LiteKernel *CpuSgdFp32KernelCreator(const std::vector &i } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SGD, CpuSgdFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sgd.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sgd.h index 2b8758b0638908b05046f4d376d84f566c58bbb3..53dda6aca96e12cec1ee8a579c6ec83417f9b4f6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sgd.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sgd.h @@ -22,7 +22,7 @@ #include "src/train/optimizer_kernel.h" #include "nnacl_c/fp32_grad/optimizer.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr int kSgdLrIndex = 2; constexpr int kSgdGradIndex = 1; @@ -55,6 +55,6 @@ class SgdCPUKernel : public OptimizerKernel { SgdParameter *sgd_param_; std::atomic sgd_stat_{0.0f}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_SGD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits.cc index c751a8a0e524835b4eca518174104b170aa07266..6a62ecef39735dad190b57bec35d574db2aa8949 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SigmoidCrossEntropyWithLogits; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SigmoidCrossEntropyWithLogitsCPUKernel::ReSize() { CHECK_NULL_RETURN(op_parameter_); CHECK_LESS_RETURN(in_tensors_.size(), 2); @@ -97,4 +97,4 @@ kernel::LiteKernel *CpuSigmoidCrossEntropyWithLogitsFp32KernelCreator(const std: REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SigmoidCrossEntropyWithLogits, CpuSigmoidCrossEntropyWithLogitsFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits.h index 04a29b576a37ef0219c85b2df289784653507e62..4d47514e8d7236ccaf6f881c761558f7821e7912 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SigmoidCrossEntropyWithLogitsCPUKernel : public LiteKernel { public: explicit SigmoidCrossEntropyWithLogitsCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -33,6 +33,6 @@ class SigmoidCrossEntropyWithLogitsCPUKernel : public LiteKernel { int Run() override; int DoExecute(int task_id); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_SIGMOID_CROSS_ENTROPY_WITH_LOGITS_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits_grad.cc index 7a122f86651e3a847bd2d9b263b72534a398bd76..50db2a4c4962dc20c0280f9700eb29d30652714e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits_grad.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SigmoidCrossEntropyWithLogitsGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SigmoidCrossEntropyWithLogitsGradCPUKernel::ReSize() { CHECK_NULL_RETURN(op_parameter_); CHECK_LESS_RETURN(in_tensors_.size(), 3); @@ -100,4 +100,4 @@ kernel::LiteKernel *CpuSigmoidCrossEntropyWithLogitsGradFp32KernelCreator(const REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SigmoidCrossEntropyWithLogitsGrad, CpuSigmoidCrossEntropyWithLogitsGradFp32KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits_grad.h index 368457ebaf1aeeaf3f3aee580cbc999e46e194ba..d856957e0ec7cf009673eb53b3f4be0788252184 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sigmoid_cross_entropy_with_logits_grad.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SigmoidCrossEntropyWithLogitsGradCPUKernel : public LiteKernel { public: explicit SigmoidCrossEntropyWithLogitsGradCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -33,6 +33,6 @@ class SigmoidCrossEntropyWithLogitsGradCPUKernel : public LiteKernel { int Run() override; int DoExecute(int task_id); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_SIGMOID_CROSS_ENTROPY_WITH_LOGITS_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/smooth_l1_loss.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/smooth_l1_loss.cc index 487778cf10853b9c2c19cad4f1a1eb1bfbda1d31..c4155d815c27a8a400e40f30957652afadded5da 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/smooth_l1_loss.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/smooth_l1_loss.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SmoothL1Loss; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kPredictIdx = 0; constexpr static int kTargetIdx = 1; constexpr static int kOutputIdx = 0; @@ -116,4 +116,4 @@ kernel::LiteKernel *CpuSmoothL1LossFp32KernelCreator(const std::vector &inputs, @@ -39,6 +39,6 @@ class SmoothL1LossCPUKernel : public LiteKernel { SmoothL1LossParameter *smooth_l1_param_; size_t thread_count_ = 1; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_SMOOTH_L1_LOSS_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/smooth_l1_loss_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/smooth_l1_loss_grad.cc index 2b5de96619ba53e9021523cec5d420243534094e..430499efa9d1735b2f1ee4e93686f074d53f2033 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/smooth_l1_loss_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/smooth_l1_loss_grad.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SmoothL1LossGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kPredictIdx = 0; constexpr static int kTargetIdx = 1; constexpr static int kDlossIdx = 2; @@ -112,4 +112,4 @@ kernel::LiteKernel *CpuSmoothL1LossGradFp32KernelCreator(const std::vector &inputs, @@ -39,6 +39,6 @@ class SmoothL1LossGradCPUKernel : public LiteKernel { SmoothL1LossParameter *smooth_l1_param_; int thread_count_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_SMOOTH_L1_LOSS_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/softmax_cross_entropy_with_logits.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/softmax_cross_entropy_with_logits.cc index 67551d30c76ed3f20070d90189b573723dbba70c..b166565cb569febd85b4321950dce7608850e7ba 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/softmax_cross_entropy_with_logits.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/softmax_cross_entropy_with_logits.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SoftmaxCrossEntropyWithLogits; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SoftmaxCrossEntropyWithLogitsCPUKernel::Prepare() { return ReSize(); } int SoftmaxCrossEntropyWithLogitsCPUKernel::DoExecute(int task_id) { @@ -122,4 +122,4 @@ kernel::LiteKernel *CpuSoftmaxCrossEntropyFp32KernelCreator(const std::vector
  • (op_parameter_); auto in_shape = in_tensors_.at(0)->shape(); @@ -105,4 +105,4 @@ kernel::LiteKernel *CpuSoftmaxGradFp32KernelCreator(const std::vector &inputs, @@ -43,6 +43,6 @@ class SoftmaxGradCPUKernel : public LiteKernel { size_t inner_size_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_SOFTMAX_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.cc index 200c0e14f859f427580d4611a5b971a0499cdd62..9fd9e9404d61d5c910fa7e117e8bcfea12c19f6b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SparseSoftmaxCrossEntropyWithLogits; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SparseSoftmaxCrossEntropyWithLogitsCPUKernel::ReSize() { return Prepare(); } int SparseSoftmaxCrossEntropyWithLogitsCPUKernel::ForwardPostExecute(const int *labels, const float *losses, @@ -203,4 +203,4 @@ int SparseSoftmaxCrossEntropyWithLogitsCPUKernel::Prepare() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_SparseSoftmaxCrossEntropyWithLogits, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.h index 12730a04d3c0c9c71e1ee0bb2c09d1c0d51d8a5c..8792db27ff65f0fa0b8122a20126110b3d83bbcf 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.h @@ -23,7 +23,7 @@ #include "nnacl_c/fp32/arithmetic_fp32.h" #include "nnacl_c/softmax_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SparseSoftmaxCrossEntropyWithLogitsCPUKernel : public LossKernel { public: @@ -61,6 +61,6 @@ class SparseSoftmaxCrossEntropyWithLogitsCPUKernel : public LossKernel { int threads_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_SPARSE_SOFTMAX_CROSS_ENTROPY_WITH_LOGITS_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/strided_slice_grad.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/strided_slice_grad.cc index 4e1d2dbef654e07aaf68d23154d9ff2bb368fcc5..b793d1e8bbb56d143bee4f9e88ad52ae12bc6544 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/strided_slice_grad.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/strided_slice_grad.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_StridedSliceGrad; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int StridedSliceGradCPUKernel::Prepare() { if (!InferShapeDone()) { return RET_OK; @@ -225,4 +225,4 @@ void StridedSliceGradCPUKernel::FreeRunBuffer() { } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_StridedSliceGrad, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/strided_slice_grad.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/strided_slice_grad.h index 2beef6a26c6d4a0f7acd7298d7495b4088d5180e..1ada43b7e4f1768ad78fcfc3ebc341bc66a1de2c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/strided_slice_grad.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/strided_slice_grad.h @@ -21,7 +21,7 @@ #include "nnacl_c/strided_slice_parameter.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class StridedSliceGradCPUKernel : public LiteKernel { public: StridedSliceGradCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -49,6 +49,6 @@ class StridedSliceGradCPUKernel : public LiteKernel { float *temp_input_ = nullptr; float *temp_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_STRIDED_SLICE_GRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/unsorted_segment_sum.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/unsorted_segment_sum.cc index ae71435589386d53d55cc40604e82d8389ab6ab8..6324a0ae603b1e115ba620ad231e287bbb3320d1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/unsorted_segment_sum.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/unsorted_segment_sum.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_UnsortedSegmentSum; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int UnsortedSegmentSumCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 2); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -112,4 +112,4 @@ int UnsortedSegmentSumCPUKernel::DoExecute(int task_id) { REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_UnsortedSegmentSum, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_UnsortedSegmentSum, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/unsorted_segment_sum.h b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/unsorted_segment_sum.h index 7bac2af1f6e2266d501887eb88f3fbb8a3649363..f02816699d1116dafc96b1d6b8e3597826431159 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_grad/unsorted_segment_sum.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_grad/unsorted_segment_sum.h @@ -20,7 +20,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class UnsortedSegmentSumCPUKernel : public LiteKernel { public: UnsortedSegmentSumCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -39,6 +39,6 @@ class UnsortedSegmentSumCPUKernel : public LiteKernel { size_t output_dim0_ = 0; size_t output_dim1_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_GRAD_UNSORTED_SEGMENT_SUM_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.cc b/mindspore-lite/src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.cc index 220901e8012fe8476a4d44c8b8f6eb44d3622fd3..25c69824c5b041ed77e5adb91b71cd9f3cb0668b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.cc +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.cc @@ -32,7 +32,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_MatMulFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr size_t kFirstDimIdx = 0; constexpr size_t kSecondDimIdx = 1; constexpr size_t kThirdDimIdx = 2; @@ -336,4 +336,4 @@ MatmulSparseCPUKernel::~MatmulSparseCPUKernel() { free(sparsity_weight_->data); delete (this->sparsity_weight_); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.h b/mindspore-lite/src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.h index 1e6c94b63ff359cb61dbf5d877fc1b4e0df2595e..29a1eb7b3f49e5f54ef6d9c9a30f68fd095a5088 100644 --- a/mindspore-lite/src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.h +++ b/mindspore-lite/src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.h @@ -22,7 +22,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/fp32/transpose_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { struct SparsityWeight { uint32_t nnz; float *data; @@ -58,5 +58,5 @@ class MatmulSparseCPUKernel : public LiteKernel { size_t matrix_a_pack_size_ = 0; float *bias_pack_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_FP32_SPARSE_MATMUL_SPARSE_FP32_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/activation_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/activation_int8.cc index 9bc410e7308591f73736f7f527b674b3856a7f5b..6d82ed31910255f97898c405c41b73f46b33c198 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/activation_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/activation_int8.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Activation; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { kernel::LiteKernel *CpuActivationInt8KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, const lite::InnerContext *ctx, const KernelKey &desc) { @@ -71,4 +71,4 @@ kernel::LiteKernel *CpuActivationInt8KernelCreator(const std::vector) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_AddFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/add_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/add_int8.h index 586184fcee5a83d4162389e085399deb65dc0c40..e4d1f5d666c4c12557defec645fa8a25dd503c8f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/add_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/add_int8.h @@ -23,7 +23,7 @@ #include "nnacl_c/int8/add_int8.h" #include "nnacl_c/arithmetic_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class QuantizedAddCPUKernel : public LiteKernel { public: explicit QuantizedAddCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -55,6 +55,6 @@ class QuantizedAddCPUKernel : public LiteKernel { }; int AddInt8Run(void *cdata, int task_id, float lhs_scale, float rhs_scale); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_ADD_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/argminmax_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/argminmax_int8.cc index bb21bebd0f7207cebc401f67345410cb1de8212a..b8a7d3a7a689fd5e133d78646c8de7702f39f054 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/argminmax_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/argminmax_int8.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_ArgMaxFusion; using mindspore::schema::PrimitiveType_ArgMinFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { ArgMinMaxInt8CPUKernel::~ArgMinMaxInt8CPUKernel() { if (in_quant_arg_ != nullptr) { free(in_quant_arg_); @@ -159,4 +159,4 @@ int ArgMinMaxInt8CPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_ArgMaxFusion, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_ArgMinFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/argminmax_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/argminmax_int8.h index 4eb95ab0272bdb51f3b4f6fcf501751a27960ab9..202035e87afc7c29ce8f041ff45e8fa3e6659120 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/argminmax_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/argminmax_int8.h @@ -24,7 +24,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/kernel/arg_min_max.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArgMinMaxInt8CPUKernel : public LiteKernel { public: ArgMinMaxInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -42,6 +42,6 @@ class ArgMinMaxInt8CPUKernel : public LiteKernel { QuantArg *out_quant_arg_ = nullptr; ArgMinMaxComputeParam *compute_param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_ARGMINMAX_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_int8.cc index ed066209f9cb8bd59361a4098df2f34917a0cfae..368af83552dde39c344ec65ddf20c6ec377aa5d7 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_int8.cc @@ -38,7 +38,7 @@ using mindspore::schema::PrimitiveType_LessEqual; using mindspore::schema::PrimitiveType_MulFusion; using mindspore::schema::PrimitiveType_NotEqual; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int ArithmeticsInt8Launch(void *cdata, int task_id, float, float) { auto arithmetic_kernel = reinterpret_cast(cdata); @@ -219,4 +219,4 @@ REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_LessEqual, CpuArithmeticInt8Kern REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Greater, CpuArithmeticInt8KernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_GreaterEqual, CpuArithmeticInt8KernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Eltwise, CpuArithmeticInt8KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_int8.h index 3c60c6fd2959ad7dc8d2d807fc2f1708ade75946..c6964e32876277fe4e07927d6989fb78f03057eb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_int8.h @@ -22,7 +22,7 @@ #include "schema/model_generated.h" #include "nnacl_c/int8/arithmetic_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArithmeticInt8CPUKernel : public LiteKernel { typedef int (*ArithmeticRunInt8)(int8_t *input0, int8_t *input1, uint8_t *output, int element_size, ArithmeticQuantArg *quant_arg); @@ -44,5 +44,5 @@ class ArithmeticInt8CPUKernel : public LiteKernel { ArithmeticRunInt8 arithmetic_run_{nullptr}; ArithmeticQuantArg quant_args_ = {}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_ARITHMETIC_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_self_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_self_int8.cc index 3697b6e041f48fd76d9902d8d36c510910497b5a..21988286287d45e0f45c88ac6627333238ad6fda 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_self_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_self_int8.cc @@ -25,7 +25,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ArithmeticSelfInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -136,4 +136,4 @@ REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Rsqrt, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_LogicalNot, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Reciprocal, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_self_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_self_int8.h index 8930fe32e254e50e6273801164dd77c366a8e87c..b0a8493049f6443468c9281d85d88de18e58b1f7 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_self_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/arithmetic_self_int8.h @@ -37,7 +37,7 @@ using mindspore::schema::PrimitiveType_Sin; using mindspore::schema::PrimitiveType_Sqrt; using mindspore::schema::PrimitiveType_Square; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArithmeticSelfInt8CPUKernel : public LiteKernel { typedef int (*ArithmeticSelfInt8Run)(const int8_t *input, int8_t *output, int element_size, ArithSelfQuantArg para); @@ -104,6 +104,6 @@ class ArithmeticSelfInt8CPUKernel : public LiteKernel { int8_t *in_ptr_{nullptr}; int8_t *out_ptr_{nullptr}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_ARITHMETIC_SELF_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/batch_to_space_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/batch_to_space_int8.cc index b6560a89cf09c4a7721a782f238cde22a9669d6d..8897b3c5935580bfe1fb1981907068199625746f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/batch_to_space_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/batch_to_space_int8.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BatchToSpace; using mindspore::schema::PrimitiveType_BatchToSpaceND; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { BatchToSpaceInt8CPUKernel::~BatchToSpaceInt8CPUKernel() { if (in_quant_arg_ != nullptr) { free(in_quant_arg_); @@ -159,4 +159,4 @@ int BatchToSpaceInt8CPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_BatchToSpace, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_BatchToSpaceND, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/batch_to_space_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/batch_to_space_int8.h index 9cd263d80b556c9ab68cfe9781e190715421c46e..c48e0ea269974bcdcae7127449af86e3221ad4be 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/batch_to_space_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/batch_to_space_int8.h @@ -23,7 +23,7 @@ #include "nnacl_c/int8/batch_to_space_int8.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BatchToSpaceInt8CPUKernel : public LiteKernel { public: BatchToSpaceInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -44,6 +44,6 @@ class BatchToSpaceInt8CPUKernel : public LiteKernel { int32_t crops_[COMM_SHAPE_SIZE] = {0}; bool no_crop_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_BATCH_TO_SPACE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/batchnorm_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/batchnorm_int8.cc index 10ed8e28004fca74492b2baf9a44e8b7aa4bdb6b..fc86917ae1015357b442d99f2a2aab4bb9512519 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/batchnorm_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/batchnorm_int8.cc @@ -35,7 +35,7 @@ constexpr int kNumInput2 = 2; constexpr int kNumInput3 = 3; constexpr int kNumInput4 = 4; } // namespace -namespace mindspore::kernel { +namespace mindspore::lite::kernel { BatchnormInt8CPUKernel::~BatchnormInt8CPUKernel() { if (alpha_addr_ != nullptr) { free(alpha_addr_); @@ -260,4 +260,4 @@ int BatchnormInt8CPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_BatchNorm, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_FusedBatchNorm, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/batchnorm_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/batchnorm_int8.h index 3312cd0f4f04125d5a63362bcdede03c81c5337a..fcf9c98ae2bd1d8d3a0892ac3c2758c373ecca15 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/batchnorm_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/batchnorm_int8.h @@ -24,7 +24,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BatchnormInt8CPUKernel : public LiteKernel { public: BatchnormInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -48,6 +48,6 @@ class BatchnormInt8CPUKernel : public LiteKernel { int unit_ = 0; int units_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_BATCHNORM_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/concat_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/concat_int8.cc index 77be922003e611dae2b32f3bef5bfe9d1e901e15..96341053454ffd6d1320264a6f66e3c5ca80ada4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/concat_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/concat_int8.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Concat; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ConcatInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_NULL_RETURN(in_tensors_.front()); @@ -144,4 +144,4 @@ void ConcatInt8CPUKernel::DoExecute(int task_id) { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Concat, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/concat_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/concat_int8.h index 89d691d9db991ca9c52f46d4af0a58688ba88406..aa74294e26b28ecedd566e16bd63d817a3321530 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/concat_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/concat_int8.h @@ -24,7 +24,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/kernel/concat.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConcatInt8CPUKernel : public LiteKernel { public: ConcatInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -65,6 +65,6 @@ class ConcatInt8CPUKernel : public LiteKernel { }; int ConcatInt8Run(void *cdata, int task_id, float lhs_scale, float rhs_scale); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_CONCAT_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_1x1_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_1x1_int8.cc index c651510dfbe73203c0929b6b753b607128694701..21d7aea097616ac2ddc8ff83a6294017224574db 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_1x1_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_1x1_int8.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { Convolution1x1Int8CPUKernel::~Convolution1x1Int8CPUKernel() { if (matmul_param_ != nullptr) { delete matmul_param_; @@ -619,4 +619,4 @@ int Convolution1x1Int8CPUKernel::Run() { FreeRunBuf(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_1x1_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_1x1_int8.h index 0d009cbf701cffa498a7213c8e735fff8e45d892..c880fcbcd8b5ac0fce847241d61125a3c8565bfa 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_1x1_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_1x1_int8.h @@ -28,7 +28,7 @@ #include "nnacl_c/matmul_parameter.h" #include "src/common/utils.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class Convolution1x1Int8CPUKernel : public ConvolutionBaseCPUKernel { public: Convolution1x1Int8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -86,6 +86,6 @@ class Convolution1x1Int8CPUKernel : public ConvolutionBaseCPUKernel { bool support_optimize_ = false; bool filter_peroc_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_CONVOLUTION_1X1_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_3x3_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_3x3_int8.cc index e408695f3ac9729600b53ce5dd1265dc70d42a60..9a4c0cbf7ecb8c53308cc3290fcccb63e8fcddf0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_3x3_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_3x3_int8.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kUnitBufferMultipler = 4 * 4; } // namespace @@ -273,4 +273,4 @@ int Convolution3x3Int8CPUKernel::Run() { FreeTmpBuffer(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_3x3_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_3x3_int8.h index dd9621bdfbfbbc6c3bc212fb9b7ba0193f49f937..65f7d3a812d64d598fa90b3a8bac16c50c3bd06f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_3x3_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_3x3_int8.h @@ -22,7 +22,7 @@ #include "nnacl_c/fp32/winograd_transform.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class Convolution3x3Int8CPUKernel : public ConvolutionBaseCPUKernel { public: Convolution3x3Int8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class Convolution3x3Int8CPUKernel : public ConvolutionBaseCPUKernel { int8_t *tmp_out_ = nullptr; }; int ProcessFilterUint8(const int8_t *origin_weight, int16_t *dst_weight, const ConvParameter *conv_param); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_CONVOLUTION_3X3_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_3x3_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_3x3_int8.cc index 66229b091eb47d450d350135f3c17f27fd25ed26..48356c189c934eefbcf0891d00f505e27a5f4392 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_3x3_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_3x3_int8.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kConvDepthwise3x3BufferSize = 64 * 10 * 10; constexpr int kChannelUnit = 8; @@ -218,4 +218,4 @@ int ConvolutionDepthwise3x3Int8CPUKernel::Run() { ms_context_->allocator->Free(buffer_); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_3x3_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_3x3_int8.h index 12a8f3f9f417845349b629560ecb63b39389cd97..91c1fdc1e4efdd811ebd154f7285b194945dce14 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_3x3_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_3x3_int8.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwise3x3Int8CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwise3x3Int8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -45,6 +45,6 @@ class ConvolutionDepthwise3x3Int8CPUKernel : public ConvolutionBaseCPUKernel { int8_t *output_ptr_ = nullptr; int8_t *buffer_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_CONVOLUTION_DEPTHWISE_3X3_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_int8.cc index 473853923dc918da3c0171953d3d65ebd6084ccd..f044cd92a3ea2c39acd825e0ce1cd3b518dc155f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_int8.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { ConvolutionDepthwiseInt8CPUKernel::~ConvolutionDepthwiseInt8CPUKernel() { if (packed_weight_sub_ != nullptr) { free(packed_weight_sub_); @@ -194,4 +194,4 @@ int ConvolutionDepthwiseInt8CPUKernel::Run() { row_buffer_ = nullptr; return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_int8.h index 0164c0f240455d3f1b1d6342ff3f41226bf479e5..d18e3facfdf58fd887eee3f3832d18ea6d881bbb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_int8.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwiseInt8CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwiseInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -44,6 +44,6 @@ class ConvolutionDepthwiseInt8CPUKernel : public ConvolutionBaseCPUKernel { int8_t *output_ptr_ = nullptr; int32_t *row_buffer_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_CONVOLUTION_DEPTHWISE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_slidewindow_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_slidewindow_int8.cc index d1b772d56031ad8e06943c233d703fbb47ee7f21..a6963bcb199a45aa977e7f5b57139b882095a663 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_slidewindow_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_slidewindow_int8.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { ConvolutionDepthwiseSWInt8CPUKernel::~ConvolutionDepthwiseSWInt8CPUKernel() { if (sliding_ != nullptr) { delete sliding_; @@ -368,4 +368,4 @@ void ConvolutionDepthwiseSWInt8CPUKernel::FreePackedInputOutput() { packed_output_ = nullptr; } } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_slidewindow_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_slidewindow_int8.h index 61d27ac7cdd64ddf407625968ba1a1c5bfdbee21..c94d505bd5a0581d82d40553b1e7d017e9a9d8a0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_slidewindow_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_depthwise_slidewindow_int8.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionDepthwiseSWInt8CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionDepthwiseSWInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -57,6 +57,6 @@ class ConvolutionDepthwiseSWInt8CPUKernel : public ConvolutionBaseCPUKernel { int32_t *output_zp_ = nullptr; float *output_scale_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_CONVOLUTION_DEPTHWISE_SLIDEWINDOW_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8.cc index 2d6b7fe278617848a77bc9e834f397e0fbc913c5..a9d14a89c72e1e708b1be3393ac1f111b34f0265 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void ConvolutionInt8CPUKernel::CheckSupportOptimize() { tile_num_ = 8; #ifdef ENABLE_ARM32 @@ -261,4 +261,4 @@ int ConvolutionInt8CPUKernel::Run() { FreeTmpBuffer(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8.h index 32d771fdd696db1c13a42882550ca0f1967d7d93..8f4a527ada133f7fa8d6c9399811fedddb10346b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8.h @@ -23,7 +23,7 @@ #include "src/common/utils.h" #include "nnacl_c/int8/conv_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ConvolutionInt8CPUKernel : public ConvolutionBaseCPUKernel { public: ConvolutionInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -82,6 +82,6 @@ class ConvolutionInt8CPUKernel : public ConvolutionBaseCPUKernel { int8_t *tmp_out_ = nullptr; MATMUL_OPT_R_FUNC matmul_func_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_CONVOLUTION_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8_creator.cc b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8_creator.cc index 313e37b7d4e784fa16cd207313db0f973e0d890c..14e36e14c080461eec49b9d94b71eb13187fbb80 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8_creator.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8_creator.cc @@ -33,7 +33,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2DFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kWinogradConvHW = 3; } // namespace @@ -140,4 +140,4 @@ kernel::LiteKernel *CpuConvInt8KernelCreator(const std::vector & } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Conv2DFusion, CpuConvInt8KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8_creator.h b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8_creator.h index f3f7916b79520d65711e5899d1b9b33a68c5ce4f..f03b2a51cb4dddf56d448a7c91f924c633eb6baa 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8_creator.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/convolution_int8_creator.h @@ -21,7 +21,7 @@ #include "nnacl_c/op_base.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { LiteKernel *CpuConvInt8KernelSelect(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, const lite::InnerContext *ctx); diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/crop_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/crop_int8.cc index 8cc7ef1b5b95e524a7841def1c88365e665ef655..d58dfea76f84a7d4dcaf19833a1918f1caa289e0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/crop_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/crop_int8.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Crop; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int CropInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C1NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -98,4 +98,4 @@ void CropInt8CPUKernel::DoExecute(int task_id) { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Crop, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/crop_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/crop_int8.h index a5ac9dc2c7a9a490679ea68bc951ad81b944a7a0..6835c8fcb8c653dd35eecaa52cbe106ff89b63bf 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/crop_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/crop_int8.h @@ -23,7 +23,7 @@ #include "nnacl_c/int8/crop_int8.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CropInt8CPUKernel : public LiteKernel { public: CropInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -45,6 +45,6 @@ class CropInt8CPUKernel : public LiteKernel { }; int CropInt8Run(void *cdata, int task_id, float lhs_scale, float rhs_scale); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_CROP_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_depthwise_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_depthwise_int8.cc index eea6e79e98daca8127f733ffc7fe86ff8cccc2c9..4e63bfdd63d99a6fc17fd8da49942490d39a7750 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_depthwise_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_depthwise_int8.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DeconvolutionDepthwiseInt8CPUKernel::~DeconvolutionDepthwiseInt8CPUKernel() { if (sliding_ != nullptr) { delete sliding_; @@ -265,4 +265,4 @@ int DeconvolutionDepthwiseInt8CPUKernel::Run() { output_buffer_ = nullptr; return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_depthwise_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_depthwise_int8.h index 3f5492be89139b35cb4b2d010d7ceafc26ba4238..99d8e89cd26d3cf9fea7e9dcb6b643b53809c876 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_depthwise_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_depthwise_int8.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl_c/fp32/conv_depthwise_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DeconvolutionDepthwiseInt8CPUKernel : public ConvolutionBaseCPUKernel { public: DeconvolutionDepthwiseInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class DeconvolutionDepthwiseInt8CPUKernel : public ConvolutionBaseCPUKernel { int32_t *output_buffer_ = nullptr; bool need_align_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_DECONVOLUTION_DEPTHWISE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_int8.cc index db98687133783bbaa70eed29e5c7e894a435044c..9a762bca1259f3227a24108ce50a0d395f0fd13b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_int8.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2dTransposeFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DeConvInt8CPUKernel::~DeConvInt8CPUKernel() { FreeTmpBuffer(); ConvolutionBaseCPUKernel::FreeQuantParam(); @@ -358,4 +358,4 @@ kernel::LiteKernel *CpuDeConvInt8KernelCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Conv2dTransposeFusion, CpuDeConvInt8KernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_int8.h index 55f2bf5ddd8b958db52f367ad8c38b9577f321c4..624fda59bd2bb7df45480daf00c3c581388ba578 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/deconvolution_int8.h @@ -28,7 +28,7 @@ #include "src/litert/kernel/cpu/base/layout_transform.h" #include "src/litert/kernel/cpu/base/convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DeConvInt8CPUKernel : public ConvolutionBaseCPUKernel { public: DeConvInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -65,5 +65,5 @@ class DeConvInt8CPUKernel : public ConvolutionBaseCPUKernel { MatMulParameter *matmul_param_ = nullptr; bool support_optimize_ = true; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_DECONVOLUTION_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/depth_to_space_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/depth_to_space_int8.cc index ff893b42db29f36cae439a5c8b682e0a2241adb3..c67fb2f5eb82a0d264af162055b7ee9be68f6101 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/depth_to_space_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/depth_to_space_int8.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_DepthToSpace; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DepthToSpaceInt8CPUKernel::~DepthToSpaceInt8CPUKernel() { if (in_quant_arg_ != nullptr) { free(in_quant_arg_); @@ -114,4 +114,4 @@ int DepthToSpaceInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_DepthToSpace, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/depth_to_space_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/depth_to_space_int8.h index cf01900013d112088e48a54479f05da5e2a31be0..b21e79858e33891296b62feb9869d6dc9999945c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/depth_to_space_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/depth_to_space_int8.h @@ -24,7 +24,7 @@ #include "nnacl_c/int8/quantize.h" #include "nnacl_c/kernel/depth_to_space.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DepthToSpaceInt8CPUKernel : public LiteKernel { public: DepthToSpaceInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -41,6 +41,6 @@ class DepthToSpaceInt8CPUKernel : public LiteKernel { QuantArg *out_quant_arg_ = nullptr; DepthToSpaceArgs args_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_DEPTH_TO_SPACE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/detection_post_process_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/detection_post_process_int8.cc index a4c43b57c79dc2011367edf14b7b47f2edda2d31..80e622943352068253c53d112a59ddb6a981438c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/detection_post_process_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/detection_post_process_int8.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_DetectionPostProcess; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int DetectionPostProcessInt8CPUKernel::DequantizeInt8ToFp32(const int task_id) { int num_unit_thread = MSMIN(thread_n_stride_, quant_size_ - task_id * thread_n_stride_); int thread_offset = task_id * thread_n_stride_; @@ -135,4 +135,4 @@ void DetectionPostProcessInt8CPUKernel::FreeAllocatedBuffer() { REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_DetectionPostProcess, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/detection_post_process_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/detection_post_process_int8.h index 569d1591f28ee67011d2462e485b83c0592853f1..c3ddf51b49addac7405621122321872c116f60fe 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/detection_post_process_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/detection_post_process_int8.h @@ -24,7 +24,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DetectionPostProcessInt8CPUKernel : public DetectionPostProcessBaseCPUKernel { public: DetectionPostProcessInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -45,5 +45,5 @@ class DetectionPostProcessInt8CPUKernel : public DetectionPostProcessBaseCPUKern int quant_size_ = 0; int thread_n_stride_ = 0; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_DETECTION_POST_PROCESS_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/div_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/div_int8.cc index e2c8d8686d0d8f8077600b8488b8168447c5d6e6..3754418611e4454976d7c8b492c7fad6fa8edb94 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/div_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/div_int8.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_DivFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DivInt8CPUKernel::~DivInt8CPUKernel() { if (quant_args_ != nullptr) { free(quant_args_); @@ -216,4 +216,4 @@ int DivInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_DivFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/div_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/div_int8.h index ddebb074071eb32ae335987250b66fab52cbc78a..bf4a730ab644878a04c76bb64dcd99aaa0371f37 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/div_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/div_int8.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/int8/div_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DivInt8CPUKernel : public LiteKernel { public: explicit DivInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -41,6 +41,6 @@ class DivInt8CPUKernel : public LiteKernel { bool broadcast_ = false; bool div_scalar_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_DIV_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_gather_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_gather_int8.cc index e86c84ecdb541823b3d445271e027583ed513059..81a7e45a0ce8a17d7fe672b8f38f91888cce0897 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_gather_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_gather_int8.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Gather; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { DynamicGatherInt8CPUKernel::~DynamicGatherInt8CPUKernel() { if (quant_param_ != nullptr) { if (quant_param_->zp_in_ != nullptr) { @@ -247,4 +247,4 @@ int DynamicGatherInt8CPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_gather_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_gather_int8.h index 8fe495fe1ce99755c09dc0f2e6e68799cfbae052..468c4a7c1553c517d6a26810cfdac883ba9b0ace 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_gather_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_gather_int8.h @@ -22,7 +22,7 @@ #include "nnacl_c/int8/quantize.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DynamicGatherInt8CPUKernel : public LiteKernel { public: DynamicGatherInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -49,6 +49,6 @@ class DynamicGatherInt8CPUKernel : public LiteKernel { bool enable_fp16_ = false; DynamicGatherQuantArg *quant_param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_DYNAMIC_GATHER_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_quant.cc b/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_quant.cc index daa79ff285df5481c3e05c79b505a08471f15d82..2724e9711041e747fbc778c4bd5d80c58409e3be 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_quant.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_quant.cc @@ -32,7 +32,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_DynamicQuant; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kBucketNums = 8; constexpr int k8Bit = 8; @@ -397,4 +397,4 @@ kernel::LiteKernel *DynamicQuantCPUCreator(const std::vector &in } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_DynamicQuant, DynamicQuantCPUCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_quant.h b/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_quant.h index 137e3d0f0d96378ab5e85be19fc7e2233ff26f06..89f25ace268b25998c597d99a3183758bd9a6e01 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_quant.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/dynamic_quant.h @@ -23,7 +23,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/dynamic_quant_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DynamicQuantCPUKernel : public LiteKernel { public: DynamicQuantCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -57,6 +57,6 @@ class DynamicQuantCPUKernel : public LiteKernel { int unit_segment_num_{0}; bool need_transpose_{false}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_BASE_DYNAMIC_QUANT_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/fullconnection_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/fullconnection_int8.cc index 9a949832426193bf891d6ef08c44e64f17b4d26d..aa5f29ef0c6ab8b6e06743747ab20d64fcf8fa47 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/fullconnection_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/fullconnection_int8.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_FullConnection; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int FullconnectionInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -67,4 +67,4 @@ int FullconnectionInt8CPUKernel::ReSize() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_FullConnection, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/fullconnection_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/fullconnection_int8.h index d3c54e408713366b7c44a6442a618215a88d8b45..6ddc6b3a209cbb56e305faf9b7370e680c705c01 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/fullconnection_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/fullconnection_int8.h @@ -21,7 +21,7 @@ #include "include/errorcode.h" #include "src/litert/kernel/cpu/int8/matmul_base_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class FullconnectionInt8CPUKernel : public MatmulBaseInt8CPUKernel { public: FullconnectionInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,6 +31,6 @@ class FullconnectionInt8CPUKernel : public MatmulBaseInt8CPUKernel { int Prepare() override; int ReSize() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_FULLCONNECTION_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/gatherNd_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/gatherNd_int8.cc index 40827d175cd37d230aef8f65342740ac8837b7e1..1091ba49a1d8bc0edddf6c7c9e8bf31eb3d05c95 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/gatherNd_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/gatherNd_int8.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_GatherNd; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { GatherNdInt8CPUKernel::~GatherNdInt8CPUKernel() { if (in_offset_ != nullptr) { free(in_offset_); @@ -182,4 +182,4 @@ int GatherNdInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_GatherNd, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/gatherNd_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/gatherNd_int8.h index 0d16b7dd56b1d9f96f3278c8ff079b7eb28c639a..f2d6e7fe4cb1313046f4656c43e4b2e63547ea91 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/gatherNd_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/gatherNd_int8.h @@ -21,7 +21,7 @@ #include "nnacl_c/int8/quantize.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GatherNdInt8CPUKernel : public LiteKernel { public: GatherNdInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -46,6 +46,6 @@ class GatherNdInt8CPUKernel : public LiteKernel { int8_t *out_ptr_ = nullptr; GatherQuantArg param_ = {}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_GATHERND_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/gather_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/gather_int8.cc index 3096adc98f6e3bc9ac5f8b1ec19019cf9d21d066..5d122518ff8e7f4ab0be55ae17d08c136955d949 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/gather_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/gather_int8.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Gather; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int GatherInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -184,4 +184,4 @@ kernel::LiteKernel *GatherInt8CPUKernelCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Gather, GatherInt8CPUKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/gather_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/gather_int8.h index 8f72bcd9c7927b6a76a59c24c8b63d5f5fec49bc..f08acc5454e93ff46e70c79648a1d86dc8812355 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/gather_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/gather_int8.h @@ -22,7 +22,7 @@ #include "nnacl_c/int8/quantize.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GatherInt8CPUKernel : public LiteKernel { public: GatherInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class GatherInt8CPUKernel : public LiteKernel { int axis_{0}; GatherQuantArg param_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_GATHER_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/group_convolution_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/group_convolution_int8.cc index 169439a8e906322b99dc374902374f296b71ed60..aa2c9b2f8f66bd96d5beb65feb11ab39bbd76f81 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/group_convolution_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/group_convolution_int8.cc @@ -20,7 +20,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int GroupConvolutionInt8CPUKernel::Separate(const int &task_id) const { auto plane_step = UP_DIV(in_plane_, in_thread_num_); MS_CHECK_INT_MUL_NOT_OVERFLOW(plane_step, task_id, RET_ERROR); @@ -127,4 +127,4 @@ int GroupConvolutionInt8CPUKernel::Prepare() { } return GroupConvolutionBaseCPUKernel::Prepare(); } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/group_convolution_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/group_convolution_int8.h index c3d3bd9fcd764b6b520b39175bcbac30cef0e3fd..b2a1e171143c194c871cc194c89cfdb925dbffdb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/group_convolution_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/group_convolution_int8.h @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "src/litert/kernel/cpu/base/group_convolution_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GroupConvolutionInt8CPUKernel : public GroupConvolutionBaseCPUKernel { public: GroupConvolutionInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -46,6 +46,6 @@ class GroupConvolutionInt8CPUKernel : public GroupConvolutionBaseCPUKernel { int8_t *sub_out_src_ = nullptr; int8_t *sub_out_dst_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_GROUP_CONVOLUTION_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/hswish_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/hswish_int8.cc index 6a3c9d1e4fb28e36bdc9c013db789778a214bbf7..d37a68beef9eb22ba31cfbbbe01800d6a48afe51 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/hswish_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/hswish_int8.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::ActivationType_HSWISH; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int HswishInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C1NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -111,4 +111,4 @@ int HswishInt8CPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/hswish_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/hswish_int8.h index e5448aecf0ce3037171c1fd3c11024abc1c5ac82..6d1c0c9070c8da0d7051b5df3f3ff38732b01c89 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/hswish_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/hswish_int8.h @@ -22,7 +22,7 @@ #include "nnacl_c/int8/hswish_int8.h" #include "nnacl_c/int8/quantize.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class HswishInt8CPUKernel : public LiteKernel { public: HswishInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class HswishInt8CPUKernel : public LiteKernel { HswishQuantArg quant_arg_ = {}; void MultiplierInt32ToInt16(int32_t input, int16_t *output) const; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_HSWISH_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/l2_norm_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/l2_norm_int8.cc index bf892cf30d3cc1d352e3ce2c383a2866e9d8b268..13667803cff9547cc63a9922ff177ae795bf16c7 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/l2_norm_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/l2_norm_int8.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_L2NormalizeFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { L2NormInt8CPUKernel::~L2NormInt8CPUKernel() { if (quant_param_ != nullptr) { free(quant_param_); @@ -107,4 +107,4 @@ int L2NormInt8CPUKernel::DoExecute(int task_id) { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_L2NormalizeFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/l2_norm_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/l2_norm_int8.h index 4d50c56ebbdd2ac43f0beb3cf9e48196c66ed132..013c91b70b64a4b8d0e65d0b494e8974b1f4663e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/l2_norm_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/l2_norm_int8.h @@ -20,7 +20,7 @@ #include "src/litert/kernel/cpu/fp32/l2_norm_fp32.h" #include "nnacl_c/int8/l2_norm_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class L2NormInt8CPUKernel : public L2NormCPUKernel { public: explicit L2NormInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class L2NormInt8CPUKernel : public L2NormCPUKernel { private: L2NormQuantArg *quant_param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_L2_NORM_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/layer_norm_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/layer_norm_int8.cc index b1c432839fc5a94db3f31b7ce56ab18822c0adfb..e695a2536192c6f6b68dc29c7fad9661efbd129a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/layer_norm_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/layer_norm_int8.cc @@ -21,7 +21,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LayerNormFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int min_layernorm_input = 3; constexpr int min_layernorm_output = 1; @@ -202,4 +202,4 @@ int LayerNormInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_LayerNormFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/layer_norm_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/layer_norm_int8.h index cebae25a7a9f494e7cb684ba478ff8a8c3f94e0a..ebd7f3343d8bc790e5b174e43e7d9857259302d1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/layer_norm_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/layer_norm_int8.h @@ -23,7 +23,7 @@ #include "include/errorcode.h" #include "nnacl_c/kernel/layer_norm.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LayerNormInt8CPUKernel : public LiteKernel { public: LayerNormInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -52,6 +52,6 @@ class LayerNormInt8CPUKernel : public LiteKernel { float *gamma_ptr_ = nullptr; float *beta_ptr_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_LAYER_NORM_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/leaky_relu_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/leaky_relu_int8.cc index b528b8dc9cd0243af58d1db9f51fa2c9b936ab94..1ee5c7faa843aa6df951cd9fc17183b6792b7ba9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/leaky_relu_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/leaky_relu_int8.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LeakyRelu; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int LeakyReluInt8Run(void *cdata, int task_id, float, float) { if (cdata == nullptr) { @@ -108,4 +108,4 @@ int LeakyReluInt8CPUKernel::DoExecute(int task_id) { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_LeakyRelu, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/leaky_relu_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/leaky_relu_int8.h index 1cb72ed7731633834e16851209d70baec4da6cf8..241b290b817e9fc2415071865c95837214b2627e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/leaky_relu_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/leaky_relu_int8.h @@ -24,7 +24,7 @@ #include "nnacl_c/int8/leaky_relu_int8.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LeakyReluInt8CPUKernel : public LiteKernel { public: LeakyReluInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class LeakyReluInt8CPUKernel : public LiteKernel { private: LeakyReluQuantArg quant_prelu_parm_ = {}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_LEAKY_RELU_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_base_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_base_int8.cc index 9a020da1dc99fec6000847bcc05d923082937aea..20af6cc2c9a4d5d7685804b250e119d4eb803699 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_base_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_base_int8.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int MatmulBaseInt8Run(void *cdata, int task_id, float, float) { CHECK_NULL_RETURN(cdata); auto op = reinterpret_cast(cdata); @@ -569,4 +569,4 @@ int MatmulBaseInt8CPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_base_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_base_int8.h index 06a5bf3df40066c7d0a4cb2c914d41de13d4470f..fb121148658428b39f9d25c631ea31eeeb18e735 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_base_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_base_int8.h @@ -26,7 +26,7 @@ #include "nnacl_c/int8/common_func_int8.h" #include "nnacl_c/int8/matmul_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulBaseInt8CPUKernel : public LiteKernel { typedef void (*PackFunc)(const int8_t *src, int8_t *dst, int row, int col); @@ -95,6 +95,6 @@ class MatmulBaseInt8CPUKernel : public LiteKernel { std::vector a_offset_; std::vector b_offset_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_MATMUL_BASE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.cc index ce95c450e7aa7004d2e083bbe26356d625903e16..a6b17eebfff650cec361dc9ccd77768698ae7a83 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int kHasBiasSize = 3; constexpr int kMinInputSize = 2; @@ -441,4 +441,4 @@ int MatmulDynamicBaseInt8CPUKernel::PreparePackedWeight(const lite::Tensor *tens weight_sums_tensor_ = tensor; return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.h index 42e0da55368bd1a03df42cb103b3800b7d887cd7..3c1b16f5a2d2754c10b1a1cfe6b372cda5ff53eb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.h @@ -27,7 +27,7 @@ #include "nnacl_c/int8/common_func_int8.h" #include "src/common/common.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulDynamicBaseInt8CPUKernel : public LiteKernel { public: MatmulDynamicBaseInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -97,6 +97,6 @@ class MatmulDynamicBaseInt8CPUKernel : public LiteKernel { bool weight_is_packed_ = false; const lite::Tensor *weight_sums_tensor_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_MATMUL_DYNAMIC_BASE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_int8.cc index 1c8ba2639f53187b97854693d202b8d880e5a549..c02d9e0e64aea047d6d80a95440339cc1dbc485b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_int8.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int MatmulDynamicInt8Run(void *cdata, int task_id, float, float) { CHECK_NULL_RETURN(cdata); @@ -145,4 +145,4 @@ int MatmulDynamicInt8CPUKernel::Run() { FreeMatrixABuffer(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_int8.h index e511cc52e4f6bdcbe41db6df4828e05afd5f2271..e1f6369a7157d68db6d182f96a9417cc9987189d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_int8.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulDynamicInt8CPUKernel : public MatmulDynamicBaseInt8CPUKernel { public: MatmulDynamicInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,6 +37,6 @@ class MatmulDynamicInt8CPUKernel : public MatmulDynamicBaseInt8CPUKernel { PackFunc a_pack_func_{nullptr}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_MATMUL_DYNAMIC_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_sdot_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_sdot_int8.cc index b2a6ef1bc2dda12030a40545102f2fce1372bc07..bf92673dcbf6c27be70d58c86ea66d1cf4f33673 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_sdot_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_sdot_int8.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_MEMORY_FAILED; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { int Arm64SdotPreRun(void *cdata, int task_id, float, float) { CHECK_NULL_RETURN(cdata); @@ -278,4 +278,4 @@ int MatMulDynamicSdotInt8Kernel::Run() { FreeMatrixABuffer(); return ret; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_sdot_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_sdot_int8.h index 2309dfd94fbd098cbd5586745e29062451eabe2a..ecf0e4a50ef4f66d9b113262475dae3fcbc887ea 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_sdot_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_dynamic_sdot_int8.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/cpu/int8/matmul_dynamic_base_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatMulDynamicSdotInt8Kernel : public MatmulDynamicBaseInt8CPUKernel { public: MatMulDynamicSdotInt8Kernel(OpParameter *parameter, const std::vector &inputs, @@ -53,6 +53,6 @@ class MatMulDynamicSdotInt8Kernel : public MatmulDynamicBaseInt8CPUKernel { DynamicMatmulComputer dynamic_matmul_compute_fp16{nullptr}; #endif }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_MATMUL_DYNAMIC_SDOT_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_int8.cc index fec4a8055b3696742370d7dfcc581a94ad5d5ac8..e7ff2319a66a647fb891c6b740e5f7db50943000 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_int8.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_MatMulFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int min_matmul_input = 2; constexpr int min_matmul_output = 1; @@ -113,4 +113,4 @@ kernel::LiteKernel *MatmulInt8CPUKernelCreator(const std::vector } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_MatMulFusion, MatmulInt8CPUKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_int8.h index 55bc989e670001e0e89bfcdd4e57b25af989f564..c6ffb0e53910d93c77ddbb05d667f65762794bcb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/matmul_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/matmul_int8.h @@ -23,7 +23,7 @@ #include "src/litert/lite_kernel.h" #include "src/litert/kernel/cpu/int8/matmul_base_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatmulInt8CPUKernel : public MatmulBaseInt8CPUKernel { public: MatmulInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class MatmulInt8CPUKernel : public MatmulBaseInt8CPUKernel { int Prepare() override; int ReSize() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_MATMUL_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/mul_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/mul_int8.cc index ccd0bfd70670a62e2612a63567d1c9601322a873..0d2e0088f9862d13272dd1962a6f5a29ba95c339 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/mul_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/mul_int8.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_MulFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { MulInt8CPUKernel::~MulInt8CPUKernel() { if (quant_args_ != nullptr) { free(quant_args_); @@ -240,4 +240,4 @@ void MulInt8CPUKernel::DoExecute(int task_id) { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_MulFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/mul_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/mul_int8.h index 0562a7277f456c765ce072d26124bc42268805bb..cf5be390f48fd5b196534919928bf02ebe259938 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/mul_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/mul_int8.h @@ -24,7 +24,7 @@ #include "nnacl_c/int8/mul_int8.h" #include "nnacl_c/int8/arithmetic_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MulInt8CPUKernel : public LiteKernel { public: explicit MulInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -58,6 +58,6 @@ class MulInt8CPUKernel : public LiteKernel { int MulInt8Run(void *cdata, int task_id, float lhs_scale, float rhs_scale); int FastHWBroadcastMulInt8Run(void *cdata, int task_id, float lhs_scale, float rhs_scale); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_MUL_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/pad_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/pad_int8.cc index 27c1f8f50f79d7a0f63fdb4bec945b226b094bd8..92e39102c6155f9b4ed231c2e569ec0072f86dd4 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/pad_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/pad_int8.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::KernelRegistrar; using mindspore::schema::PrimitiveType_PadFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kMirrorPadInputSize = 2; } @@ -324,4 +324,4 @@ int PadInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_PadFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/pad_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/pad_int8.h index 418d3deddcc8ff81cd892197c3090bc787c1b1f6..d1d504043131070858ab352c9689e9efde8f7fd0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/pad_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/pad_int8.h @@ -25,7 +25,7 @@ #include "nnacl_c/int8/pad_int8.h" #include "nnacl_c/int8/quantize.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PadInt8CPUKernel : public LiteKernel { public: explicit PadInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -67,5 +67,5 @@ class PadInt8CPUKernel : public LiteKernel { int mirror_offset_ = 0; PadQuantArg pad_quant_arg_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_PAD_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/pooling_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/pooling_int8.cc index 560a856197b3c5a38bd54fbb947ff24073b03e6a..26aebaf8049e23d61600543ea913a6969f8bbc11 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/pooling_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/pooling_int8.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_MEMORY_FAILED; using mindspore::schema::PrimitiveType_AvgPoolFusion; using mindspore::schema::PrimitiveType_MaxPoolFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int PoolingInt8CPUKernel::SetQuantParam() { // per tensor init pooling_quant_arg_ = reinterpret_cast(malloc(TWO_TENSOR * sizeof(QuantArg *))); @@ -201,4 +201,4 @@ int PoolingInt8CPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_AvgPoolFusion, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_MaxPoolFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/pooling_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/pooling_int8.h index 4c2f3dfaba35722e850d31fcd8219d35c5e74c2f..394bb737c769254d0425703d54b126800f5584b0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/pooling_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/pooling_int8.h @@ -23,7 +23,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PoolingInt8CPUKernel : public LiteKernel { public: PoolingInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class PoolingInt8CPUKernel : public LiteKernel { PoolingParameter *pooling_param_ = nullptr; QuantArg **pooling_quant_arg_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_POOLING_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/power_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/power_int8.cc index d7cffb4562b27aaa689e49b51a9f4db95158bacf..81003856165b8fe8d81c2863a948235000132da8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/power_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/power_int8.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_PowFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int PowerInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -117,4 +117,4 @@ int PowerInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_PowFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/power_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/power_int8.h index e5e4532af67348c00289862ece2ac1fc3eee7a62..e0eb21201b81cd73dd2e3668acd7b4568011c452 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/power_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/power_int8.h @@ -22,7 +22,7 @@ #include "nnacl_c/int8/quantize.h" #include "nnacl_c/pow_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PowerInt8CPUKernel : public LiteKernel { public: PowerInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -45,6 +45,6 @@ class PowerInt8CPUKernel : public LiteKernel { PowQuantArg quant_arg_; bool broadcast_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_POWER_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/reduce_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/reduce_int8.cc index 0ba3d0f804e32cf97b225a55aa012e68e5721b62..002df9c3531c046ce86048b43f9faafb6045fc5a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/reduce_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/reduce_int8.cc @@ -36,7 +36,7 @@ using mindspore::schema::ReduceMode_ReduceSumSquare; using mindspore::kernel::KERNEL_ARCH; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { ReduceInt8CPUKernel::~ReduceInt8CPUKernel() { FreeMultipliers(); } void ReduceInt8CPUKernel::OneAxis() { @@ -599,4 +599,4 @@ int ReduceInt8CPUKernel::CallReduceUnit(int task_id) { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_ReduceFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/reduce_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/reduce_int8.h index a1dc31900d642f8555e3ff82391c9d46bdfcf107..752c0d364a3921ee8f34def312d58c3f129abbe3 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/reduce_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/reduce_int8.h @@ -27,7 +27,7 @@ using mindspore::schema::ReduceMode; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { enum Four_DIMENSION_REDUCE_TEMPLATE { N, H, W, C, NH, NW, NC, HW, HC, WC, NHW, NHC, NWC, HWC, NHWC }; class ReduceInt8CPUKernel : public ReduceBaseCPUKernel { typedef int (*Reducer)(const int outer_size, const int inner_size, const int axis_size, const int32_t *src_data, @@ -81,6 +81,6 @@ class ReduceInt8CPUKernel : public ReduceBaseCPUKernel { std::vector prod_multipliers_; std::vector sum_square_multipliers_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_REDUCE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/relux_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/relux_int8.cc index 139752368ad0611e821a3989341d67f2f1d38d64..81e7acae6a18ea93fe6b7d4eefb38f3f2c729a2a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/relux_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/relux_int8.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::ActivationType_RELU; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ReluXInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C1NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -90,4 +90,4 @@ int ReluXInt8CPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/relux_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/relux_int8.h index bb9abb5378e24bb5e44b13935fee4091dbfb00f0..3e4a45a2a73cb5b62aa7086c50d415e380a0a2ff 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/relux_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/relux_int8.h @@ -22,7 +22,7 @@ #include "nnacl_c/fp32/activation_fp32.h" #include "nnacl_c/int8/relux_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr size_t kRelu6Min = 0; constexpr size_t kRelu6Max = 6; @@ -79,6 +79,6 @@ class Relu6Int8CPUKernel : public ReluXInt8CPUKernel { return ret; }; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_RELUX_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/reshape_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/reshape_int8.cc index 1df86f3c0d1b54b11d7dfe1606d62c008600a117..14e2a49a114f452e1143dcfabd56c5101785f797 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/reshape_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/reshape_int8.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::KernelRegistrar; using mindspore::schema::PrimitiveType_Reshape; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ReshapeInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -97,4 +97,4 @@ int ReshapeInt8CPUKernel::DoExecute(int task_id) { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Reshape, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/reshape_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/reshape_int8.h index 91f6e9bad3e8bbe40fdd446dc7ee9e01bfd1d64e..fbe4c889c75195b8ea11602a0ecd845c224e88d7 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/reshape_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/reshape_int8.h @@ -23,7 +23,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ReshapeInt8CPUKernel : public LiteKernel { public: ReshapeInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class ReshapeInt8CPUKernel : public LiteKernel { }; int ReshapeInt8Run(void *cdata, int task_id, float, float); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_RESHAPE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/resize_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/resize_int8.cc index 582cdab5df1f3d55218389bfb9f60699b5126895..9858e94d5c7d4c7f8b9fcd9788a41ed44f03d4eb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/resize_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/resize_int8.cc @@ -32,7 +32,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::KernelRegistrar; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr unsigned int OFFSET_BASE = 10; } // namespace @@ -411,4 +411,4 @@ int ResizeInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Resize, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/resize_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/resize_int8.h index 3e38c803412e5523aed7973e56aca1c18924ab24..191e040febfdfd9a71a9edcbc476547f29e3cf76 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/resize_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/resize_int8.h @@ -24,7 +24,7 @@ using mindspore::schema::PrimitiveType_Resize; using mindspore::schema::ResizeMethod; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ResizeInt8CPUKernel : public ResizeBaseCPUKernel { public: ResizeInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -55,6 +55,6 @@ class ResizeInt8CPUKernel : public ResizeBaseCPUKernel { ResizeQuantArg resize_quant_arg_ = {}; ResizeFloatScaleQuantArg resize_float_quant_arg_ = {}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_RESIZE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/scale_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/scale_int8.cc index fd5ff47ec7d1c5cda2b2678559f7160e2381bd22..f7ea3603ed5e1cc877c177052f3f8a818a55d396 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/scale_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/scale_int8.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ScaleFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr size_t kScaleInputsSize = 2; constexpr size_t kScaleBiasInputsSize = 3; @@ -350,4 +350,4 @@ int ScaleInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_ScaleFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/scale_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/scale_int8.h index 9c569e9ef87ee7c22f57fbf63128661ad1a58267..64c9ac43e437f8948f7573a842218e5dd4457851 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/scale_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/scale_int8.h @@ -25,7 +25,7 @@ #include "nnacl_c/int8/arithmetic_int8.h" #include "nnacl_c/int8/scale_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ScaleInt8CPUKernel : public LiteKernel { public: ScaleInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -62,6 +62,6 @@ class ScaleInt8CPUKernel : public LiteKernel { int InitQuantArgs(); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_SCALE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/sigmoid_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/sigmoid_int8.cc index ca4651cee4aeea0825527f90ce6c1664389a6468..89b64f93fe032a29d2c6fbc2a0e073dc41be339f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/sigmoid_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/sigmoid_int8.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::ActivationType_SIGMOID; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void CalculateTableList(int8_t *table, const float input_scale, const int32_t input_zp, const float output_scale, const int32_t output_zp) { int32_t min_value = std::numeric_limits::min(); @@ -104,4 +104,4 @@ int SigmoidInt8CPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/sigmoid_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/sigmoid_int8.h index 68fcd2cc808e5d2e61ddc5dbe628bb7e9a028906..7b9cd1ffebd808887de6b03b865c19454a02fe26 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/sigmoid_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/sigmoid_int8.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/int8/sigmoid_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SigmoidInt8CPUKernel : public LiteKernel { public: SigmoidInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -37,6 +37,6 @@ class SigmoidInt8CPUKernel : public LiteKernel { private: int8_t table_list_[256]{0}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_SIGMOID_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/slice_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/slice_int8.cc index ab71d4b5105a7d02737cd45ceb806c6c6bf68dc7..f52eab136761820b10c9f45ac78f2c0d007542b9 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/slice_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/slice_int8.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SliceFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SliceInt8CPUKernel::ReSize() { InitSliceStruct(&slice_struct_, in_tensors_.front()->ConvertToTensorC(), in_tensors_.at(SECOND_INPUT)->ConvertToTensorC(), in_tensors_.at(THIRD_INPUT)->ConvertToTensorC()); @@ -108,4 +108,4 @@ int SliceInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_SliceFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/slice_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/slice_int8.h index 3ebc7536ef68f761add1e301b726216d7d4ddeba..18608f0e88f502b845eae4e62d4538a3fd67301f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/slice_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/slice_int8.h @@ -23,7 +23,7 @@ #include "nnacl_c/kernel/slice.h" #include "nnacl_c/slice_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SliceInt8CPUKernel : public LiteKernel { public: SliceInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class SliceInt8CPUKernel : public LiteKernel { SliceStruct slice_struct_; SliceQuantArg quant_arg_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_SLICE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/softmax_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/softmax_int8.cc index 34ea1f6f7d81f0cee11c22bd9b07ee8297a11187..64d288764e60de851392a1416677c6b6ebbee025 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/softmax_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/softmax_int8.cc @@ -28,7 +28,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_NULL_PTR; using mindspore::schema::PrimitiveType_Softmax; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { SoftmaxInt8CPUKernel::~SoftmaxInt8CPUKernel() { if (quant_param_ != nullptr) { free(quant_param_); @@ -178,4 +178,4 @@ int SoftmaxInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Softmax, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/softmax_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/softmax_int8.h index f6c0d0ace980c1e21ea224f688eefaa61534cce4..c19964b696de3315dd576d74258031e8e23fc9c3 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/softmax_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/softmax_int8.h @@ -22,7 +22,7 @@ #include "nnacl_c/softmax_parameter.h" #include "nnacl_c/int8/quantize.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SoftmaxInt8CPUKernel : public LiteKernel { public: SoftmaxInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -46,6 +46,6 @@ class SoftmaxInt8CPUKernel : public LiteKernel { SoftmaxParameter *softmax_param_; SoftmaxQuantArg *quant_param_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_SOFTMAX_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/space_to_batch_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/space_to_batch_int8.cc index 0cb03a4401d4ab75ae204232becb8f3696384a8d..03c3bb69ea2d78ba6a548182eaf8c002bd70ea47 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/space_to_batch_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/space_to_batch_int8.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SpaceToBatch; using mindspore::schema::PrimitiveType_SpaceToBatchND; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SpaceToBatchInt8CPUKernel::Run() { auto input_tensor = in_tensors_.at(0); auto output_tensor = out_tensors_.at(0); @@ -50,4 +50,4 @@ int SpaceToBatchInt8CPUKernel::Run() { REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_SpaceToBatch, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_SpaceToBatchND, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/space_to_batch_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/space_to_batch_int8.h index 6bba6e75c6a41d59c44f0f1cefea8b321c17dcf5..e1a901d2fa1d2fd54fd535426f3e8f4b062fb791 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/space_to_batch_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/space_to_batch_int8.h @@ -19,7 +19,7 @@ #include #include "src/litert/kernel/cpu/fp32/space_to_batch_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SpaceToBatchInt8CPUKernel : public SpaceToBatchCPUKernel { public: SpaceToBatchInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,6 +30,6 @@ class SpaceToBatchInt8CPUKernel : public SpaceToBatchCPUKernel { int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_SPACE_TO_BATCH_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/split_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/split_int8.cc index 87f8ae0a3fdd2c49e31a84e0e82247b51f48127c..b0991031bbab6a796e07683e7938f9340ef582e5 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/split_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/split_int8.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::KernelRegistrar; using mindspore::schema::PrimitiveType_Split; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SplitInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C1NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -123,4 +123,4 @@ int SplitInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Split, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/split_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/split_int8.h index 637fdb23f13619567c4ddec57f7a0a3cb0cbe443..9211b27dba9c46675ac0a69a2696194a9ee148b1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/split_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/split_int8.h @@ -23,7 +23,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SplitInt8CPUKernel : public SplitBaseCPUKernel { public: SplitInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class SplitInt8CPUKernel : public SplitBaseCPUKernel { int8_t *input_ptr_{nullptr}; std::vector output_ptr_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_SPLIT_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/squeeze_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/squeeze_int8.cc index 1a1b0b9ca34b97646b91abcc6a37834e6b9bafed..414caf7d834fe48d0881b0ff9af0b2cb44371c59 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/squeeze_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/squeeze_int8.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Squeeze; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { SqueezeInt8CPUKernel::~SqueezeInt8CPUKernel() { if (quant_squeeze_param_ != nullptr) { if (quant_squeeze_param_->in_quant_args_ != nullptr) { @@ -127,4 +127,4 @@ void SqueezeInt8CPUKernel::DoExecute(int task_id) { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Squeeze, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/squeeze_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/squeeze_int8.h index 28380f7874db4a6a8fd9eae2fd8f6c6441554df7..8da1412621b1465899338ab25888d5ce7d7211de 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/squeeze_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/squeeze_int8.h @@ -24,7 +24,7 @@ #include "nnacl_c/squeeze_parameter.h" using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SqueezeInt8CPUKernel : public LiteKernel { public: SqueezeInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -42,6 +42,6 @@ class SqueezeInt8CPUKernel : public LiteKernel { }; int SqueezeInt8Run(void *cdata, int task_id, float, float); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_SQUEEZE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/sub_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/sub_int8.cc index 4be0c59b3caa06661a12f73309ad6757408238dd..00b27f22dd3abe200ad74e5f1648cb26ccdcb538 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/sub_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/sub_int8.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SubFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { SubInt8CPUKernel::~SubInt8CPUKernel() { if (quant_param_ != nullptr) { free(quant_param_); @@ -197,4 +197,4 @@ int SubInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_SubFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/sub_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/sub_int8.h index 77ecd6c8e2835d8437acf8597919be6435442c4f..6c9daa9d9851562af7ad7334d7f33e2db7205d0c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/sub_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/sub_int8.h @@ -24,7 +24,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/int8/sub_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SubInt8CPUKernel : public LiteKernel { public: explicit SubInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -43,6 +43,6 @@ class SubInt8CPUKernel : public LiteKernel { int8_t *tile1_data_ = nullptr; bool broadcast_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_SUB_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/tanh_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/tanh_int8.cc index c0b58b2f04c48807221a925338f0987fd4617faa..fbfd113a387f01e4e54af643ecbcd9234f7f2d5e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/tanh_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/tanh_int8.cc @@ -19,7 +19,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TanhInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C1NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -91,4 +91,4 @@ int TanhInt8CPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/tanh_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/tanh_int8.h index f43454a049f04ca162b6ac77f9dc8833e3e1cb30..7b56f8094ab7bccdea9f2ec72591114d52d53375 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/tanh_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/tanh_int8.h @@ -25,7 +25,7 @@ #include "nnacl_c/int8/quantize.h" #include "include/errorcode.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TanhInt8CPUKernel : public LiteKernel { public: TanhInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -48,6 +48,6 @@ class TanhInt8CPUKernel : public LiteKernel { int thread_stride_{0}; TanhQuantParameter tanh_quant_ = {}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_TANH_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/topk_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/topk_int8.cc index 3179cd77e708f049af660bad4acf1b6fae5eb7b9..3cbd266952953dd79b1e6b34a6039f03cafdacdb 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/topk_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/topk_int8.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_TopKFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TopKInt8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C1NUM); CHECK_LESS_RETURN(out_tensors_.size(), C1NUM); @@ -79,4 +79,4 @@ int TopKInt8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_TopKFusion, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/topk_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/topk_int8.h index 2250ef636b3da146ac968c3d8918cf3e25b90b4d..36bcb1ebc92774f2292aad888d9bfcf08a509287 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/topk_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/topk_int8.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/int8/topk_int8.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TopKInt8CPUKernel : public LiteKernel { public: explicit TopKInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class TopKInt8CPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_TOPK_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/transpose_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/transpose_int8.cc index 6a92baab251f6cebcd92551ec7f5a7796c260de2..6622fc58c62a9bbece373465f1cf33f67e141281 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/transpose_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/transpose_int8.cc @@ -23,7 +23,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Transpose; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TransposeInt8CPUKernel::ReSize() { auto ret = TransposeBaseCPUKernel::ReSize(); if (ret != RET_OK) { @@ -54,4 +54,4 @@ int TransposeInt8CPUKernel::DoTransposeMultiThread(int task_id) { REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Transpose, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeBool, PrimitiveType_Transpose, LiteKernelCreator) REG_KERNEL(kCPU, kNumberTypeUInt8, PrimitiveType_Transpose, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/transpose_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/transpose_int8.h index 70389623593eb9bee11051e648584da5fa72ec24..3fccf71da35c50dc64a559c82bf75276e3ae759a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/transpose_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/transpose_int8.h @@ -19,7 +19,7 @@ #include #include "src/litert/kernel/cpu/base/transpose_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class TransposeInt8CPUKernel : public TransposeBaseCPUKernel { public: TransposeInt8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -33,6 +33,6 @@ class TransposeInt8CPUKernel : public TransposeBaseCPUKernel { private: int DoTransposeSingleThread() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_TRANSPOSE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/unsqueeze_int8.cc b/mindspore-lite/src/litert/kernel/cpu/int8/unsqueeze_int8.cc index e490ab0ba4abc7f5ba1a1e7141253894c682698d..947113d694a7d2c282f25353702bffe17e253289 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/unsqueeze_int8.cc +++ b/mindspore-lite/src/litert/kernel/cpu/int8/unsqueeze_int8.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Unsqueeze; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int Unsqueezeint8CPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -108,4 +108,4 @@ int Unsqueezeint8CPUKernel::Run() { } REG_KERNEL(kCPU, kNumberTypeInt8, PrimitiveType_Unsqueeze, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/int8/unsqueeze_int8.h b/mindspore-lite/src/litert/kernel/cpu/int8/unsqueeze_int8.h index 52996b428f0309761628b749f0cb467d44cd3d49..572f1d1272297e5428618e4ff0278f0e5b762bb6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/int8/unsqueeze_int8.h +++ b/mindspore-lite/src/litert/kernel/cpu/int8/unsqueeze_int8.h @@ -23,7 +23,7 @@ using mindspore::lite::InnerContext; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class Unsqueezeint8CPUKernel : public LiteKernel { public: Unsqueezeint8CPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -48,6 +48,6 @@ class Unsqueezeint8CPUKernel : public LiteKernel { float *out_ptr_{nullptr}; int thread_count_{0}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_INT8_UNSQUEEZE_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/cxx_utils.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/cxx_utils.cc index 71c551b9f4b1f699ccb85752af93f280d66bda4d..d8c8f937072ea84af47f289fd35014dc4a556dba 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/cxx_utils.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/cxx_utils.cc @@ -23,7 +23,7 @@ #include "src/common/log_util.h" #include "include/errorcode.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { void *DefaultAllocatorMalloc(void *allocator, size_t sz) { if (allocator == nullptr) { MS_LOG(ERROR) << "in param invalid"; @@ -81,4 +81,4 @@ int DefaultUpdateThreadNumPass(int32_t kernel_type, int64_t per_unit_load_num, i #endif return update_thread; } -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/cxx_utils.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/cxx_utils.h index ce8f3d578f79419a4022b31d7e915dd1eb045840..73c1744a4cc67e8b95fa4658c353b6834a7d8e83 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/cxx_utils.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/cxx_utils.h @@ -20,7 +20,7 @@ #include #include -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { void *DefaultAllocatorMalloc(void *allocator, size_t sz); void DefaultAllocatorFree(void *allocator, void *ptr); int DefaultThreadPoolParallelLunch(void *threadPool, void *task, void *param, int taskNr); @@ -28,5 +28,5 @@ void *DefaultGetSharingPackData(void *manager, const void *tensor_data, const si void DefaultFreeSharingPackData(void *manager, void *tensor_data); int DefaultUpdateThreadNumPass(int32_t kernel_type, int64_t per_unit_load_num, int64_t per_unit_store_num, int64_t unit_num, int thread_num); -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_LITERT_KERNEL_CPU_NNACL_CXX_UTILS_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_batchnorm.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_batchnorm.cc index e1f7671efc0eed8de4ce05f4912e150ac15ff080..74352ace74e670981c4ff4df39126996050cf2e6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_batchnorm.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_batchnorm.cc @@ -21,7 +21,7 @@ using mindspore::schema::PrimitiveType_BatchNorm; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int BatchNormKernel::SetupVirtualBatch(int virtual_batch_multiplier, int momentum) { CHECK_NULL_RETURN(kernel_); BatchNormSetupVirtualBatch(kernel_, virtual_batch_multiplier, momentum); @@ -30,4 +30,4 @@ int BatchNormKernel::SetupVirtualBatch(int virtual_batch_multiplier, int momentu NNACL_KERNEL(PrimitiveType_BatchNorm, kNumberTypeFloat32, NNACLOpt) NNACL_KERNEL(PrimitiveType_BatchNorm, kNumberTypeFloat16, NNACLOpt) -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_batchnorm.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_batchnorm.h index b09c79fb14f20992486b5f3ad6dab485a74d41e6..e2b81af3ca0ee07450c9a7bd7180f476cf969d1f 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_batchnorm.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_batchnorm.h @@ -20,7 +20,7 @@ #include #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class BatchNormKernel : public NNACLKernel { public: explicit BatchNormKernel(OpParameter *parameter, const std::vector &inputs, @@ -29,5 +29,5 @@ class BatchNormKernel : public NNACLKernel { ~BatchNormKernel() override = default; int SetupVirtualBatch(int virtual_batch_multiplier, int momentum) override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_BATCHNORM_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_convolution.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_convolution.cc index 17f7fb978bb20e8e2e19d9147d00970b040a1766..07806292c342bab3283d91d58752071fe399ef72 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_convolution.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_convolution.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Conv2DFusion; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int ConvolutionKernel::Prepare() { if (kernel_ == nullptr) { return RET_ERROR; @@ -64,4 +64,4 @@ NNACLKernel *NNACLConvolutionOpt(OpParameter *parameter, const std::vector #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class ConvolutionKernel : public NNACLKernel { public: explicit ConvolutionKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,5 +30,5 @@ class ConvolutionKernel : public NNACLKernel { int Prepare() override; int ReSize() override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_CONVOLUTION_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_fused_batch_norm.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_fused_batch_norm.cc index 2d9f635e10e221cff3f676f2bba8b9cbe8162998..23a92f5ef2cf49f2ab8da150b1922845c9b391a3 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_fused_batch_norm.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_fused_batch_norm.cc @@ -22,7 +22,7 @@ using mindspore::schema::PrimitiveType_FusedBatchNorm; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int FusedBatchNormKernel::Eval() { auto ret = LiteKernel::Eval(); if (ret != RET_OK) { @@ -39,4 +39,4 @@ int FusedBatchNormKernel::Run() { NNACL_KERNEL(PrimitiveType_FusedBatchNorm, kNumberTypeFloat32, NNACLOpt) NNACL_KERNEL(PrimitiveType_FusedBatchNorm, kNumberTypeFloat16, NNACLOpt) -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_fused_batch_norm.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_fused_batch_norm.h index 943a5550b1c464de3e13a5619a30eb27e16a3a23..8cf358eb91b6c85ccdb358a454e687ae102f552b 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_fused_batch_norm.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_fused_batch_norm.h @@ -20,7 +20,7 @@ #include #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class FusedBatchNormKernel : public NNACLKernel { public: explicit FusedBatchNormKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,5 +30,5 @@ class FusedBatchNormKernel : public NNACLKernel { int Eval() override; int Run() override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_FUSED_BATCHNORM_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.cc index e467a35130e90b17c23b7029d40087c955c4241b..9f02361531be257ab7503b4467f1550430cff77a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.cc @@ -22,7 +22,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { NNACLKernel::~NNACLKernel() { if (in_ != nullptr) { free(in_); @@ -179,4 +179,4 @@ int NNACLKernel::InitKernel(const TypeId &data_type, const lite::InnerContext *c kernel_->UpdateThread = DefaultUpdateThreadNumPass; return RET_OK; } -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.h index 232036860e35471ce533a4338ac74937aaf74c1b..b78fb087c808765acaef81d4482522a5e0c3fe81 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.h @@ -22,7 +22,7 @@ #include "src/executor/kernel_exec.h" #include "src/litert/lite_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class NNACLKernel : public kernel::LiteKernel { public: explicit NNACLKernel(OpParameter *parameter, const std::vector &inputs, @@ -55,6 +55,6 @@ class NNACLKernel : public kernel::LiteKernel { size_t in_size_ = 0; size_t out_size_ = 0; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_KERNEL_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_manager.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_manager.cc index 292ef37b8aa79054150a498b0f7290b234c14c51..829fd88d340996296054fb7ebdfa7b6d37883551 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_manager.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_manager.cc @@ -16,7 +16,7 @@ #include "nnacl/nnacl_manager.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { bool NNACLSupportKernel(int op_type, TypeId data_type) { auto creator = KernelRegistry::GetInstance()->Creator({op_type, data_type}); if (creator != nullptr) { @@ -51,4 +51,4 @@ NNACLKernel *NNACLKernelRegistry(OpParameter *parameter, const std::vector #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { struct KeyDesc { int op_; TypeId dt_; @@ -73,5 +73,5 @@ bool NNACLSupportKernel(int op_type, TypeId data_type); NNACLKernel *NNACLKernelRegistry(OpParameter *parameter, const std::vector &inputs, const std::vector &outputs, const lite::InnerContext *ctx, const kernel::KernelKey &key); -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_KERNEL_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.cc index 913611c5147538d36e4521eff5476634a4356bc6..5524acb609bfd2a50460bd6b40e4af1151bdd8a0 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_FullConnection; using mindspore::schema::PrimitiveType_MatMulFusion; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int MatmulKernel::Prepare() { if (kernel_ == nullptr) { return RET_ERROR; @@ -84,4 +84,4 @@ int MatmulKernel::PreparePackedWeight(const lite::Tensor *tensor) { NNACL_KERNEL(PrimitiveType_MatMulFusion, kNumberTypeFloat32, NNACLOpt) NNACL_KERNEL(PrimitiveType_FullConnection, kNumberTypeFloat32, NNACLOpt) -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.h index 7e10fc2078efaaecd1247217176617020d2c54d7..34854c16735c6522395d227263127f87feaae8db 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.h @@ -21,7 +21,7 @@ #include "nnacl/nnacl_kernel.h" #include "nnacl_c/matmul_parameter.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class MatmulKernel : public NNACLKernel { public: explicit MatmulKernel(OpParameter *parameter, const std::vector &inputs, @@ -32,5 +32,5 @@ class MatmulKernel : public NNACLKernel { int Prepare() override; int PreparePackedWeight(const lite::Tensor *tensor) override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_MATMUL_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_non_max_suppression.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_non_max_suppression.cc index 30b1dd436aba59dd72750c330edde0813ecdb5f9..40be12742f649ea10f891eea76bc1a3d1f2f5376 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_non_max_suppression.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_non_max_suppression.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_NonMaxSuppression; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int NonMaxSuppressionKernel::PreProcess() { return RET_OK; } @@ -37,4 +37,4 @@ int NonMaxSuppressionKernel::Run() { } NNACL_KERNEL(PrimitiveType_NonMaxSuppression, kNumberTypeFloat32, NNACLOpt) -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_non_max_suppression.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_non_max_suppression.h index fa21976591223217a85a756a35201a6859976df7..e3924e1874de79ef1d7e65e980ab258f7f92c8e5 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_non_max_suppression.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_non_max_suppression.h @@ -20,7 +20,7 @@ #include #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class NonMaxSuppressionKernel : public NNACLKernel { public: explicit NonMaxSuppressionKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,6 +30,6 @@ class NonMaxSuppressionKernel : public NNACLKernel { int Run() override; int PreProcess() override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_NON_MAX_SUPPRESSION_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reduce.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reduce.cc index a1d2f3d308787ad950908ff2a61e85e17b3d05e6..7efd2cf2c5d32a8b6fe7648f7cabee5fe6a5b153 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reduce.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reduce.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ReduceFusion; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int ReduceKernel::Run() { ReduceStruct *reduce = reinterpret_cast(kernel_); CHECK_NULL_RETURN(reduce); @@ -40,4 +40,4 @@ int ReduceKernel::Run() { NNACL_KERNEL(PrimitiveType_ReduceFusion, kNumberTypeFloat32, NNACLOpt) NNACL_KERNEL(PrimitiveType_ReduceFusion, kNumberTypeInt32, NNACLOpt) NNACL_KERNEL(PrimitiveType_ReduceFusion, kNumberTypeBool, NNACLOpt) -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reduce.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reduce.h index e6be2f5b5d7f2db38e02b2a0ce01915266295e01..ec4033fe55213c78f4d33bd426e37f1f94eaf4d3 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reduce.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reduce.h @@ -20,7 +20,7 @@ #include #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class ReduceKernel : public NNACLKernel { public: explicit ReduceKernel(OpParameter *parameter, const std::vector &inputs, @@ -29,6 +29,6 @@ class ReduceKernel : public NNACLKernel { ~ReduceKernel() override = default; int Run() override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_REDUCE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reshape.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reshape.cc index fb45565ff4b9237eea80935a402f076115392d7c..f5aa03718220ad5bee37a16c6b959cffeb9bd2fa 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reshape.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reshape.cc @@ -29,7 +29,7 @@ using mindspore::schema::PrimitiveType_Reshape; using mindspore::schema::PrimitiveType_Squeeze; using mindspore::schema::PrimitiveType_Unsqueeze; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int ReshapeKernel::Run() { auto in_tensor = in_tensors().front(); CHECK_NULL_RETURN(in_tensor); @@ -77,4 +77,4 @@ NNACL_KERNEL(PrimitiveType_Unsqueeze, kNumberTypeInt32, NNACLOpt) NNACL_KERNEL(PrimitiveType_Unsqueeze, kNumberTypeInt64, NNACLOpt) NNACL_KERNEL(PrimitiveType_Unsqueeze, kNumberTypeBool, NNACLOpt) NNACL_KERNEL(PrimitiveType_Unsqueeze, kNumberTypeUInt8, NNACLOpt) -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reshape.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reshape.h index b75fb960c0d50f9ab2b36870a3f994687a9f5c2d..11f10c8bbcba2aa98f604f8032305cc6d6c0de5c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reshape.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_reshape.h @@ -20,7 +20,7 @@ #include #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class ReshapeKernel : public NNACLKernel { public: explicit ReshapeKernel(OpParameter *parameter, const std::vector &inputs, @@ -29,6 +29,6 @@ class ReshapeKernel : public NNACLKernel { ~ReshapeKernel() override = default; int Run() override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_RESHAPE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_strided_slice.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_strided_slice.cc index fb86fdc4ff2304e7f0673fceb67c090db6292a20..647275e5e2df87635c9a2676415ae4e6ac73c039 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_strided_slice.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_strided_slice.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_StridedSlice; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int StridedSliceKernel::Run() { StridedSliceStruct *strided_slice = reinterpret_cast(kernel_); CHECK_NULL_RETURN(strided_slice); @@ -42,4 +42,4 @@ NNACL_KERNEL(PrimitiveType_StridedSlice, kNumberTypeFloat16, NNACLOpt) NNACL_KERNEL(PrimitiveType_StridedSlice, kNumberTypeInt32, NNACLOpt) NNACL_KERNEL(PrimitiveType_StridedSlice, kNumberTypeInt8, NNACLOpt) -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_strided_slice.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_strided_slice.h index 2659752a439a2eab17e2222d1e61604771462db8..203782ef1e3ed1fdfec070ca2773a9a237bbe7c6 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_strided_slice.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_strided_slice.h @@ -20,7 +20,7 @@ #include #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class StridedSliceKernel : public NNACLKernel { public: explicit StridedSliceKernel(OpParameter *parameter, const std::vector &inputs, @@ -29,6 +29,6 @@ class StridedSliceKernel : public NNACLKernel { ~StridedSliceKernel() override = default; int Run() override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_STRIDED_SLICE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_where.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_where.cc index 985ba206cfe4b773d60ea758c3deb710a53daef7..6134435342b26e3746d4a202994d8dddaa59f79a 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_where.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_where.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Where; -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { int WhereKernel::PreProcess() { if (in_tensors_.size() == Num3) { return LiteKernel::PreProcess(); @@ -48,4 +48,4 @@ NNACL_KERNEL(PrimitiveType_Where, kNumberTypeBool, NNACLOpt) NNACL_KERNEL(PrimitiveType_Where, kNumberTypeInt32, NNACLOpt) NNACL_KERNEL(PrimitiveType_Where, kNumberTypeFloat16, NNACLOpt) NNACL_KERNEL(PrimitiveType_Where, kNumberTypeFloat32, NNACLOpt) -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_where.h b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_where.h index 8a4709a6b9c7588c134bd8f6ec126e5e8d334639..3f039c8f71d271a06c075ae652e12e2e33f40e74 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_where.h +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_where.h @@ -20,7 +20,7 @@ #include #include "nnacl/nnacl_kernel.h" -namespace mindspore::nnacl { +namespace mindspore::lite::nnacl { class WhereKernel : public NNACLKernel { public: explicit WhereKernel(OpParameter *parameter, const std::vector &inputs, @@ -30,6 +30,6 @@ class WhereKernel : public NNACLKernel { int PreProcess() override; int Run() override; }; -} // namespace mindspore::nnacl +} // namespace mindspore::lite::nnacl #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_NNACL_WHERE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/string/extract_feature.cc b/mindspore-lite/src/litert/kernel/cpu/string/extract_feature.cc index ac2321138d2f2ac1f1086fb76c00ea77f166145e..919e62e20f29ff5cb5e82ad25798247b858ed0d8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/extract_feature.cc +++ b/mindspore-lite/src/litert/kernel/cpu/string/extract_feature.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_CustomExtractFeatures; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ExtractFeatureCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), C2NUM); @@ -97,4 +97,4 @@ kernel::LiteKernel *CpuExtractFeatureKernelCreator(const std::vector &inputs, @@ -35,6 +35,6 @@ class ExtractFeatureCPUKernel : public LiteKernel { private: bool IsInBlacklist(const lite::StringPack &str); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_STRING_EXTRACT_FEATURE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/string/hashtable_lookup.cc b/mindspore-lite/src/litert/kernel/cpu/string/hashtable_lookup.cc index 890f37c7b7c253597f2a812dba4f244ed8ea66ba..98c913c3a1673f4d75cd58c98af2ae179fe417ca 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/hashtable_lookup.cc +++ b/mindspore-lite/src/litert/kernel/cpu/string/hashtable_lookup.cc @@ -24,7 +24,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_HashtableLookup; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int HashtableLookupCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C3NUM); CHECK_LESS_RETURN(out_tensors_.size(), C2NUM); @@ -99,4 +99,4 @@ kernel::LiteKernel *CpuHashtableLookupKernelCreator(const std::vector #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class HashtableLookupCPUKernel : public LiteKernel { public: HashtableLookupCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -31,6 +31,6 @@ class HashtableLookupCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_STRING_HASHTABLE_LOOKUP_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/string/lsh_projection.cc b/mindspore-lite/src/litert/kernel/cpu/string/lsh_projection.cc index f3be2e3fbb4fa2d41e0caab9fb07dcdc22fc7503..bea40801d9c9fdbb6e2ed426363be39bd1f3b30d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/lsh_projection.cc +++ b/mindspore-lite/src/litert/kernel/cpu/string/lsh_projection.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LshProjection; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int LshProjectionCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), C2NUM); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -203,4 +203,4 @@ void LshProjectionCPUKernel::LshProjectionDense(const float *hashSeed, const int } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_LshProjection, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/string/lsh_projection.h b/mindspore-lite/src/litert/kernel/cpu/string/lsh_projection.h index 7f55b28191ee09cfbe6aa9452e811c897f8f441d..7f7e4df9b0ae4956db7b892a4af6f07c06dfd26e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/lsh_projection.h +++ b/mindspore-lite/src/litert/kernel/cpu/string/lsh_projection.h @@ -22,7 +22,7 @@ #include "nnacl_c/lsh_projection_parameter.h" #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LshProjectionCPUKernel : public LiteKernel { public: LshProjectionCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -52,6 +52,6 @@ class LshProjectionCPUKernel : public LiteKernel { float *weight_ = nullptr; int32_t *output_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_STRING_LSH_PROJECTION_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/string/normalize.cc b/mindspore-lite/src/litert/kernel/cpu/string/normalize.cc index 38bc2c20fbe71c2513661adc3e5321ed36283b37..13f087f6346a0ef472ea610be80dbb1e91c02e17 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/normalize.cc +++ b/mindspore-lite/src/litert/kernel/cpu/string/normalize.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_CustomNormalize; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const char kPunctuationsRegex[] = "[.*()\"]"; const std::map kRegexTransforms = { @@ -150,4 +150,4 @@ kernel::LiteKernel *CpuNormalizeKernelCreator(const std::vector } REG_KERNEL(kCPU, kObjectTypeString, PrimitiveType_CustomNormalize, CpuNormalizeKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/string/normalize.h b/mindspore-lite/src/litert/kernel/cpu/string/normalize.h index ff7d473e051c29463fe0e6e99ff31210cdbaeea0..dce7cb956d714a4afcc02f29a1291b1c364fb62c 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/normalize.h +++ b/mindspore-lite/src/litert/kernel/cpu/string/normalize.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "src/common/string_utils.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class NormalizeCPUKernel : public LiteKernel { public: NormalizeCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -40,6 +40,6 @@ class NormalizeCPUKernel : public LiteKernel { std::vector normalized_strs; void FreeBuffer(); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_STRING_NORMALIZE_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/string/predict.cc b/mindspore-lite/src/litert/kernel/cpu/string/predict.cc index a4b517d24297ff572c174561524ca6f051b5bbd6..7bce39371ebb62904d87a47f06655a0a17b16b66 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/predict.cc +++ b/mindspore-lite/src/litert/kernel/cpu/string/predict.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_CustomPredict; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { constexpr int INPUT_INDEX = 0; constexpr int KEY_INDEX = 1; @@ -146,4 +146,4 @@ kernel::LiteKernel *CpuPredictKernelCreator(const std::vector &i } REG_KERNEL(kCPU, kNumberTypeInt32, PrimitiveType_CustomPredict, CpuPredictKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/string/predict.h b/mindspore-lite/src/litert/kernel/cpu/string/predict.h index 9f5f6fa4e94ef5543827fcf9b879854e5c040faa..9f55dcd08a14f800790b7f762d97ede6a06a035d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/predict.h +++ b/mindspore-lite/src/litert/kernel/cpu/string/predict.h @@ -20,7 +20,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl_c/predict_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PredictCPUKernel : public LiteKernel { public: PredictCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -35,6 +35,6 @@ class PredictCPUKernel : public LiteKernel { private: std::vector GetLabelInfo(); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_STRING_PREDICT_H_ diff --git a/mindspore-lite/src/litert/kernel/cpu/string/skip_gram.cc b/mindspore-lite/src/litert/kernel/cpu/string/skip_gram.cc index 54e62ee00f233f9af3fc4a2b54b91012814a37f4..a86711cd1e2a3f86c006eb9704a18dd5db347ea8 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/skip_gram.cc +++ b/mindspore-lite/src/litert/kernel/cpu/string/skip_gram.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::StringPack; using mindspore::schema::PrimitiveType_SkipGram; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SkipGramCPUKernel::Prepare() { CHECK_LESS_RETURN(in_tensors_.size(), 1); CHECK_LESS_RETURN(out_tensors_.size(), 1); @@ -113,4 +113,4 @@ int SkipGramCPUKernel::Run() { } REG_KERNEL(kCPU, kObjectTypeString, PrimitiveType_SkipGram, LiteKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/cpu/string/skip_gram.h b/mindspore-lite/src/litert/kernel/cpu/string/skip_gram.h index 9b32619bc1dfb1f4beead8007c7948e65e39c8b1..7bb676d8e573cdfed42cf7ebaa635fece5ac4d8e 100644 --- a/mindspore-lite/src/litert/kernel/cpu/string/skip_gram.h +++ b/mindspore-lite/src/litert/kernel/cpu/string/skip_gram.h @@ -22,7 +22,7 @@ #include "nnacl_c/skip_gram_parameter.h" #include "src/common/string_utils.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SkipGramCPUKernel : public LiteKernel { public: @@ -42,6 +42,6 @@ class SkipGramCPUKernel : public LiteKernel { SkipGramParameter *skip_gram_parameter_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_CPU_STRING_SKIP_GRAM_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/activation.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/activation.cc index 1ad3e7afe33a7871ddc2f474720b3438b4037660..b094b7d1a9aaa1cacbcf020b520b41de07481586 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/activation.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/activation.cc @@ -37,7 +37,7 @@ using mindspore::schema::ActivationType_SWISH; using mindspore::schema::ActivationType_TANH; using mindspore::schema::PrimitiveType_Activation; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { std::string ActivationOpenCLKernel::GetActTypeString(int act_type) { static std::map supported_act_type = { {ActivationType_LEAKY_RELU, "LeakyRelu"}, {ActivationType_RELU, "Relu"}, {ActivationType_SIGMOID, "Sigmoid"}, @@ -149,4 +149,4 @@ int ActivationOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Activation, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Activation, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/activation.h b/mindspore-lite/src/litert/kernel/opencl/kernel/activation.h index dcec9c9b3b182e17748d4f2c617933f33d385dbd..40184e2627f567f0c433bbc451708fa8bad8e9c0 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/activation.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/activation.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/fp32/activation_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ActivationOpenCLKernel : public OpenCLKernel { public: ActivationOpenCLKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,5 +47,5 @@ class ActivationOpenCLKernel : public OpenCLKernel { std::unique_ptr out_shape_ = nullptr; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_ACTIVATION_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/argminmax.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/argminmax.cc index da62eac012916bf0844173e796904902f8a46b09..ce898b3f0e0b864462881c35799949f6b36cf31a 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/argminmax.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/argminmax.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_ArgMaxFusion; using mindspore::schema::PrimitiveType_ArgMinFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ArgMinMaxOpenCLKernel::CheckSpecs() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_1 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { MS_LOG(WARNING) << "in size: " << in_tensors_.size() << ", out size: " << out_tensors_.size(); @@ -245,4 +245,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_ArgMinFusion, OpenCLKernelCre REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_ArgMinFusion, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_ArgMaxFusion, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_ArgMaxFusion, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/argminmax.h b/mindspore-lite/src/litert/kernel/opencl/kernel/argminmax.h index 0fdfe87ca678b4d8b3a40f29bf7548b1ac9f8f5f..cb63130ae1577b9988b49a052e0f4d49a84ff438 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/argminmax.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/argminmax.h @@ -22,7 +22,7 @@ #include "nnacl_c/arg_min_max_parameter.h" #include "nnacl_c/kernel/arg_min_max.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArgMinMaxOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -50,5 +50,5 @@ class ArgMinMaxOpenCLKernel : public OpenCLKernel { cl_int4 strides_; ArgMinMaxComputeParam compute_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic.cc index 5ffc86b040e1a1f60567040c6a54e358a9bc5c73..95cd800e7b1cc17e783c51d94f8e4a8fe11716f0 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic.cc @@ -55,7 +55,7 @@ using mindspore::schema::PrimitiveType_NotEqual; using mindspore::schema::PrimitiveType_SquaredDifference; using mindspore::schema::PrimitiveType_SubFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ArithmeticOpenCLKernel::CheckSpecsWithoutShape() { for (auto &tensor : in_tensors_) { if (tensor->data_type() != kNumberTypeFloat32 && tensor->data_type() != kNumberTypeFloat16) { @@ -365,4 +365,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Greater, OpenCLKernelCreator< REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_GreaterEqual, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Eltwise, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_BiasAdd, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic.h b/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic.h index cccd9ebdfc5413a5b5acd50c38daa363bdd70d8e..3a5c6152cbec4a77a8045a760e1a2ab00d595745 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic.h @@ -24,7 +24,7 @@ #include #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { extern std::set SupportedOpenCLArithmetics; class ArithmeticOpenCLKernel : public OpenCLKernel { @@ -52,6 +52,6 @@ class ArithmeticOpenCLKernel : public OpenCLKernel { std::vector weight_ptrs_; std::string kernel_name_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_ARITHMETIC_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic_self.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic_self.cc index d49e61c59d16f547dc831c99821e8f7357ac533c..d8810c0074dca3fe7a8d3acf8536d256acc9df7c 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic_self.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic_self.cc @@ -26,7 +26,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ArithmeticSelfOpenCLKernel::CheckSpecsWithoutShape() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_1 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { MS_LOG(WARNING) << "in size: " << in_tensors_.size() << ", out size: " << out_tensors_.size(); @@ -160,4 +160,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Sin, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Sqrt, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Square, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic_self.h b/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic_self.h index 68c284682c944c551e8d5b7dd3978e75fc7c0701..f1ea0ced198f6157b8baf78439155acbfb284509 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic_self.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/arithmetic_self.h @@ -37,7 +37,7 @@ using mindspore::schema::PrimitiveType_Sin; using mindspore::schema::PrimitiveType_Sqrt; using mindspore::schema::PrimitiveType_Square; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArithmeticSelfOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -63,5 +63,5 @@ class ArithmeticSelfOpenCLKernel : public OpenCLKernel { cl_int4 output_shape_ = {}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/batch_to_space_nd.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/batch_to_space_nd.cc index 88a86ef87d4441b1502a48a1669e5825647f2667..01404fd20a13073c96c0576199ce4d8ee3a8d2e7 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/batch_to_space_nd.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/batch_to_space_nd.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_BatchToSpace; using mindspore::schema::PrimitiveType_BatchToSpaceND; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int BatchToSpaceNDOpenCLKernel::CheckSpecs() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_1 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { MS_LOG(WARNING) << "in size: " << in_tensors_.size() << ", out size: " << out_tensors_.size(); @@ -140,4 +140,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_BatchToSpaceND, OpenCLKernelC REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_BatchToSpaceND, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_BatchToSpace, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_BatchToSpace, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/batch_to_space_nd.h b/mindspore-lite/src/litert/kernel/opencl/kernel/batch_to_space_nd.h index a8e6049fefdfa5038d917058e61d2d0bcee1bef9..18ef7cedbbed74d3f6fb1fd851db58b8b74b77ab 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/batch_to_space_nd.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/batch_to_space_nd.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/batch_to_space_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BatchToSpaceNDOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -38,5 +38,5 @@ class BatchToSpaceNDOpenCLKernel : public OpenCLKernel { private: }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/batchnorm.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/batchnorm.cc index 6f240aebfa692116ac1d4d3d1ed69dc36879a1e9..83de5a877204dc54fe11ea4262a09e4e4149c1d8 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/batchnorm.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/batchnorm.cc @@ -35,7 +35,7 @@ constexpr int kNumInput2 = 2; constexpr int kNumInput3 = 3; constexpr int kNumInput4 = 4; } // namespace -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int BatchNormOpenCLKernel::CheckSpecs() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_5 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { MS_LOG(WARNING) << "in size: " << in_tensors_.size() << ", out size: " << out_tensors_.size(); @@ -402,4 +402,4 @@ int BatchNormOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_BatchNorm, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_BatchNorm, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/batchnorm.h b/mindspore-lite/src/litert/kernel/opencl/kernel/batchnorm.h index 94f384046b0a95fc57969b663ea8910cd22c9fc6..930d57ea785f51cc5046bcecf033a08bf4e7d052 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/batchnorm.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/batchnorm.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/fp32/batchnorm_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class BatchNormOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -49,5 +49,5 @@ class BatchNormOpenCLKernel : public OpenCLKernel { cl::Kernel kernel_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/cast.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/cast.cc index 77ddafd4fa5336d05eea1423f1fc926b55ff1a0d..8f5dddf895c5b5fc6359574e3131580f6bacb1a9 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/cast.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/cast.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Cast; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const std::map dtype_names = { {kNumberTypeFloat32, "fp32"}, @@ -119,4 +119,4 @@ int CastOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Cast, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Cast, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/cast.h b/mindspore-lite/src/litert/kernel/opencl/kernel/cast.h index 094f067c82b27dca230751c83f20076710c1410c..84a10838f074c9486a91e28f710997091090802c 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/cast.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/cast.h @@ -21,7 +21,7 @@ #include #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CastOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -38,5 +38,5 @@ class CastOpenCLKernel : public OpenCLKernel { private: GpuTensorInfo shape_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/concat.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/concat.cc index bc9dcc62cacbdfa9e52ed465d6009f6f6bc40954..5ee0452bd553eb82d489396b9172d75c10cacc18 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/concat.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/concat.cc @@ -31,7 +31,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::opencl::ImageSize; using mindspore::schema::PrimitiveType_Concat; -namespace mindspore { +namespace mindspore::lite { namespace kernel { int ConcatOpenCLKernel::RunAxis0() { auto allocator_ = ocl_runtime_->GetAllocator(); @@ -403,4 +403,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Concat, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeInt32, PrimitiveType_Concat, OpenCLKernelCreator) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/concat.h b/mindspore-lite/src/litert/kernel/opencl/kernel/concat.h index 15094387326ba3919f9095c46d1444e33e267a7c..a3c6df9206e6015607ac623a4500f0934ad96f59 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/concat.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/concat.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/concat_parameter.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class ConcatOpenCLKernel : public OpenCLKernel { public: @@ -62,5 +62,5 @@ class ConcatOpenCLKernel : public OpenCLKernel { }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d.cc index 4b66a49489439c716c2aecb05a7cea5728b40b18..f1de812cbdbb8523373f633ea6f8c304134c303a 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d.cc @@ -40,7 +40,7 @@ using mindspore::schema::ActivationType_TANH; using mindspore::schema::PrimitiveType_Conv2DFusion; using mindspore::schema::PrimitiveType_FullConnection; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int Conv2DOpenCLKernel::CheckSpecsWithoutShape() { if (!IsFilterConst()) { MS_LOG(WARNING) << "Conv2D doesn't support non-constant filter yet"; @@ -810,4 +810,4 @@ kernel::LiteKernel *OpenCLConv2DCreator(const std::vector &input REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Conv2DFusion, OpenCLConv2DCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Conv2DFusion, OpenCLConv2DCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d.h b/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d.h index 4ad08678e501dde335f715cb8ad08d4a4e48eddf..50961e687327fd3fa9c1189573ab2ea6613a0e99 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d.h @@ -25,7 +25,7 @@ #include "nnacl_c/conv_parameter.h" #include "schema/ops_generated.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using lite::opencl::MemType; constexpr size_t CI_TILE = C4NUM; @@ -118,6 +118,6 @@ class Conv2DOpenCLKernel : public OpenCLKernel { } block_size_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_CONV2D_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d_transpose.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d_transpose.cc index e8efae25a3fa348c7ce3642b68e3c0109e80b70a..f7d07c0cf6bb9cec9e17c8b1521e9fdc24707f2b 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d_transpose.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/conv2d_transpose.cc @@ -31,7 +31,7 @@ using mindspore::schema::ActivationType_RELU; using mindspore::schema::ActivationType_RELU6; using mindspore::schema::PrimitiveType_Conv2dTransposeFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int Conv2dTransposeOpenCLKernel::CheckSpecs() { if ((in_tensors_.size() != INPUT_TENSOR_SIZE_2 && in_tensors_.size() != INPUT_TENSOR_SIZE_3) || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { @@ -366,4 +366,4 @@ kernel::LiteKernel *OpenCLConv2dTransposeCreator(const std::vector CROP_SUPPORT_DTYPES = { {kNumberTypeFloat32, "fp32"}, @@ -157,4 +157,4 @@ int CropOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Crop, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Crop, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeInt32, PrimitiveType_Crop, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/crop.h b/mindspore-lite/src/litert/kernel/opencl/kernel/crop.h index 117ee024406eec7df1b049f10d1f6e86e99f32df..3f8f9dc3203bef2037980dc479c303afd2a18d8b 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/crop.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/crop.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/crop_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class CropOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -45,5 +45,5 @@ class CropOpenCLKernel : public OpenCLKernel { GpuTensorInfo out_gpu_info_ = {}; int offset_[COMM_SHAPE_SIZE] = {0}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/depthwise_conv2d.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/depthwise_conv2d.cc index 6b923fb79708a9de96e1354f9d8e02c34adb621d..aeb4b97b108a4b6ba9412277e1e8b6ca0ac386b7 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/depthwise_conv2d.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/depthwise_conv2d.cc @@ -34,7 +34,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::opencl::ImageSize; using mindspore::lite::opencl::MemType; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int DepthwiseConv2dOpenCLKernel::CheckSpecs() { auto ret = InputOutputCheckSpecs(); if (ret != RET_OK) { @@ -461,4 +461,4 @@ int DepthwiseConv2dOpenCLKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/depthwise_conv2d.h b/mindspore-lite/src/litert/kernel/opencl/kernel/depthwise_conv2d.h index 909f61d81a5c1d8ac898f213d256462735f23127..1d8d05f6dc3cfaccaa696f6c538310c48b2d7eaa 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/depthwise_conv2d.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/depthwise_conv2d.h @@ -23,7 +23,7 @@ using mindspore::lite::opencl::MemType; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class DepthwiseConv2dOpenCLKernel : public OpenCLKernel { public: DepthwiseConv2dOpenCLKernel(OpParameter *parameter, const std::vector &inputs, @@ -60,6 +60,6 @@ class DepthwiseConv2dOpenCLKernel : public OpenCLKernel { } block_size_; MemType filter_type_{MemType::BUF}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_DEPTHWISE_CONV2D_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/fill.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/fill.cc index 28229d3ddb7bdcd608a5c2b1ee9762bad8c994d9..6ac0c85cba7474e3aa9528383f15f59497db1b96 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/fill.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/fill.cc @@ -26,7 +26,7 @@ using mindspore::lite::opencl::ImageSize; using mindspore::schema::PrimitiveType_Fill; using mindspore::schema::PrimitiveType_Shape; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int FillOpenCLKernel::RunFill() { auto allocator_ = ocl_runtime_->GetAllocator(); ImageSize img_size; @@ -116,4 +116,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Fill, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Fill, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Shape, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/fill.h b/mindspore-lite/src/litert/kernel/opencl/kernel/fill.h index f81873a64dc0d3b21bae042706799199a7555dd6..710b56108fa92c8ce5fa215a382e4dd4a8fa365c 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/fill.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/fill.h @@ -21,7 +21,7 @@ #include "nnacl_c/base/fill_base.h" #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class FillOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -42,5 +42,5 @@ class FillOpenCLKernel : public OpenCLKernel { int default_{0}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/fullconnection.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/fullconnection.cc index 9f61a96633f82402f26c6ec5c2b75344bc0b27d4..384adc4166e62bb01ed7558756a8a0f74b20486a 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/fullconnection.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/fullconnection.cc @@ -33,7 +33,7 @@ using mindspore::schema::ActivationType_RELU6; using mindspore::schema::ActivationType_TANH; using mindspore::schema::PrimitiveType_FullConnection; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int FullConnectionOpenCLKernel::CheckSpecs() { if ((in_tensors_.size() != INPUT_TENSOR_SIZE_2 && in_tensors_.size() != INPUT_TENSOR_SIZE_3) || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { @@ -440,4 +440,4 @@ int FullConnectionOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_FullConnection, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_FullConnection, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/fullconnection.h b/mindspore-lite/src/litert/kernel/opencl/kernel/fullconnection.h index da851b055dc275f6ce6b6737acb0b037d4cbae66..4d436acd030e7feae268645621840dca6b900058 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/fullconnection.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/fullconnection.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/matmul_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class FullConnectionOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -51,6 +51,6 @@ class FullConnectionOpenCLKernel : public OpenCLKernel { int CI_remainder_{1}; int CO_{1}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_FULLCONNECTION_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/fusion_eltwise.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/fusion_eltwise.cc index 386796c74fd6d587053a19454d7c8ce3b4839132..a3b3c678f8f297ee93f6d5e2facd38c0f5ac782e 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/fusion_eltwise.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/fusion_eltwise.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr int LOG_PREFIX_SCALE = 2; static std::set SupportedOperators = { // Arithmetic Primitive @@ -622,4 +622,4 @@ int FusionEltwiseOpenCLKernel::GetTensorIdx(lite::Tensor *in_tensor) { } return 0; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/fusion_eltwise.h b/mindspore-lite/src/litert/kernel/opencl/kernel/fusion_eltwise.h index 549004016640d98c81e122b030bd5d43f2620bb6..a241c8f61d1017ea0da834e146b5a433bb459379 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/fusion_eltwise.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/fusion_eltwise.h @@ -33,7 +33,7 @@ using mindspore::schema::ActivationType; using mindspore::schema::PrimitiveType; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr schema::PrimitiveType PrimitiveType_FusionEltwise = static_cast(-100); enum EltwiseOperator { @@ -209,6 +209,6 @@ class FusionEltwiseOpenCLKernel : public OpenCLKernel { std::vector buffer_weights_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_FUSION_ELTWISE_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/gather.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/gather.cc index 67e8a7eeb8ab76a6a01bb0b6ff829cd01ef87d30..80b1ce8b689be596794d68421b72d3b1307e1e3b 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/gather.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/gather.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::opencl::ImageSize; using mindspore::schema::PrimitiveType_Gather; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int GatherOpenCLKernel::CheckSpecs() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_3) { MS_LOG(WARNING) << "GatherOpenCLKernel only supports 3 input Tensor but get " << in_tensors_.size(); @@ -364,4 +364,4 @@ int GatherOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Gather, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Gather, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeInt32, PrimitiveType_Gather, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/gather.h b/mindspore-lite/src/litert/kernel/opencl/kernel/gather.h index 98da3725d17b2aeab63db2c08f7966785b1d467a..d8a90eea0b9311f4983ae1daea599d91bc9ab365 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/gather.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/gather.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/gather_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GatherOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -49,5 +49,5 @@ class GatherOpenCLKernel : public OpenCLKernel { bool is_indices_tensor_const_{true}; bool is_fp16_enabled_{false}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/gl_to_cl.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/gl_to_cl.cc index fc260f404fdafbc3b7429c3dc0cedfee7526939e..960e9fff75b9eba83a6e59ed0e183d41c2dbeec7 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/gl_to_cl.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/gl_to_cl.cc @@ -20,7 +20,7 @@ #include "src/litert/kernel_registry.h" #include "src/litert/kernel/opencl/cl/gl_to_cl.cl.inc" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { const cl_GLenum kGlTexture2D = 0x0DE1; int GLToCLOpenCLKernel::CheckSpecs() { return RET_OK; } @@ -149,4 +149,4 @@ int GLToCLOpenCLKernel::InferShape() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/gl_to_cl.h b/mindspore-lite/src/litert/kernel/opencl/kernel/gl_to_cl.h index 27fe4a4272a95f3343cfd260863c60766610cf2f..bbbb39625c735fa3f32b1887943ae1a415bbf39c 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/gl_to_cl.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/gl_to_cl.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class GLToCLOpenCLKernel : public OpenCLKernel { public: GLToCLOpenCLKernel(OpParameter *parameter, const std::vector &inputs, @@ -48,6 +48,6 @@ class GLToCLOpenCLKernel : public OpenCLKernel { size_t W_{1}; size_t C_{1}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_GL_TO_CL_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/int8/arithmetic_int8.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/int8/arithmetic_int8.cc index 48cc00eff76abf6c4f17ae197dccc24de7628118..d9345d22ae8dd975a003fee9847f87e34dedaaf7 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/int8/arithmetic_int8.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/int8/arithmetic_int8.cc @@ -42,7 +42,7 @@ using mindspore::schema::PrimitiveType_Eltwise; using mindspore::schema::PrimitiveType_MulFusion; using mindspore::schema::PrimitiveType_SubFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ArithmeticInt8OpenCLKernel::CheckSpecs() { for (auto &tensor : in_tensors_) { if (tensor->data_type() != kNumberTypeInt8) { @@ -282,4 +282,4 @@ int ArithmeticInt8OpenCLKernel::Run() { } REG_KERNEL(kGPU, kNumberTypeInt8, PrimitiveType_AddFusion, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/int8/arithmetic_int8.h b/mindspore-lite/src/litert/kernel/opencl/kernel/int8/arithmetic_int8.h index 488be367f18c5cca27f37b4aa3f6ed2823e8a324..fee65e73c738cb6806893b7857c4f85364acf7e1 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/int8/arithmetic_int8.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/int8/arithmetic_int8.h @@ -22,7 +22,7 @@ #include #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ArithmeticInt8OpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -45,6 +45,6 @@ class ArithmeticInt8OpenCLKernel : public OpenCLKernel { std::vector weight_ptrs_; std::string kernel_name_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_INT8_ARITHMETIC_INT8_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/layer_norm.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/layer_norm.cc index c7f4cfd491d97bcfe19d1e064388f757920a5c49..9baf440f444251a8c78199ec367ccd4f8c5f12dc 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/layer_norm.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/layer_norm.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_LayerNormFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int LayerNormOpenCLKernel::CheckSpecs() { auto param = reinterpret_cast(this->op_parameter_); CHECK_NULL_RETURN(param); @@ -371,4 +371,4 @@ int LayerNormOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_LayerNormFusion, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_LayerNormFusion, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/layer_norm.h b/mindspore-lite/src/litert/kernel/opencl/kernel/layer_norm.h index 98839e563df6315163edda46f5b3b1e2226118a3..3a7d43eec1dde8018fdc2e1ccedecb4c9d9600b1 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/layer_norm.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/layer_norm.h @@ -20,7 +20,7 @@ #include #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LayerNormOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -53,5 +53,5 @@ class LayerNormOpenCLKernel : public OpenCLKernel { cl::Kernel kernel_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/matmul.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/matmul.cc index 7f2e7a39d9ee80fa4d404478ccb75ce6efcbcc7d..24abf2407b59e73b5eaaaf4e7599c9a7d4cb9cd1 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/matmul.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/matmul.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_MatMulFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { bool IsUseStrassenMatmul(const std::vector &in_tensors_) { if (in_tensors_.at(0)->shape().size() == DIMENSION_2D) { auto shape0 = in_tensors_.at(0)->shape(); @@ -470,4 +470,4 @@ kernel::LiteKernel *OpenCLMatMulKernelCreator(const std::vector REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_MatMulFusion, OpenCLMatMulKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_MatMulFusion, OpenCLMatMulKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/matmul.h b/mindspore-lite/src/litert/kernel/opencl/kernel/matmul.h index 3981a8c1cce2d6a08032c93f31f033cc965624d7..f60acd66f1c4a9fc0125e880ce0ba0fa9625e1db 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/matmul.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/matmul.h @@ -22,7 +22,7 @@ #include "src/common/utils.h" #include "nnacl_c/matmul_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MatMulOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -56,6 +56,6 @@ class MatMulOpenCLKernel : public OpenCLKernel { private: int PadWeight(std::vector weight_shape_4d, int ci, int co); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_MATMUL_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/one_hot.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/one_hot.cc index 561ccba9dad577a3e845ce8ac49acaf662299ffb..cb376991f66af8e0e1524218621be3d1cf7a17ca 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/one_hot.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/one_hot.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_OneHot; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int OneHotOpenCLKernel::CheckSpecs() { if ((in_tensors_.size() < INPUT_TENSOR_SIZE_2 || in_tensors_.size() > INPUT_TENSOR_SIZE_4) || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { @@ -153,4 +153,4 @@ int OneHotOpenCLKernel::Run() { } REG_KERNEL(kGPU, kNumberTypeInt32, PrimitiveType_OneHot, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/one_hot.h b/mindspore-lite/src/litert/kernel/opencl/kernel/one_hot.h index dcec9932ffaca4be4d42159aa5d86ded1e53f831..bea319b577a1de7c0ba2e3df628f4f5a74f9e19b 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/one_hot.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/one_hot.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/fp32/one_hot_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class OneHotOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -46,6 +46,6 @@ class OneHotOpenCLKernel : public OpenCLKernel { GpuTensorInfo out_shape_; OneHotParameter *param_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_ONE_HOT_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/pad.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/pad.cc index 35478115f7a097bb0f5f3452ba161356db0091b1..8f7799d96893487d0a9c8c28addc92bf68a6c389 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/pad.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/pad.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PaddingMode_CONSTANT; using mindspore::schema::PrimitiveType_PadFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int PadOpenCLKernel::CheckSpecs() { auto param = reinterpret_cast(op_parameter_); MS_ASSERT(param); @@ -156,4 +156,4 @@ int PadOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_PadFusion, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_PadFusion, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/pad.h b/mindspore-lite/src/litert/kernel/opencl/kernel/pad.h index 253a9adf818573bdcf9c75c88f30ed9016f03427..7533654b3497db3a0028cd66fd546b93cfaf17db 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/pad.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/pad.h @@ -24,7 +24,7 @@ #include "schema/model_generated.h" #include "nnacl_c/pad_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PadOpenCLKernel : public OpenCLKernel { public: PadOpenCLKernel(OpParameter *parameter, const std::vector &inputs, @@ -42,6 +42,6 @@ class PadOpenCLKernel : public OpenCLKernel { private: PadParameter *param_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_PAD_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/pooling2d.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/pooling2d.cc index e56858b487bf4ab917426cb0e2e332f4750dcb7d..48f6df9a9067f94a929170f79c913362abd84546 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/pooling2d.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/pooling2d.cc @@ -31,7 +31,7 @@ using mindspore::lite::opencl::MemType; using mindspore::schema::PrimitiveType_AvgPoolFusion; using mindspore::schema::PrimitiveType_MaxPoolFusion; -namespace mindspore { +namespace mindspore::lite { namespace kernel { int PoolingOpenCLKernel::CheckSpecs() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_1 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { @@ -208,4 +208,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_MaxPoolFusion, OpenCLKernelCr REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_AvgPoolFusion, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_MaxPoolFusion, OpenCLKernelCreator) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/pooling2d.h b/mindspore-lite/src/litert/kernel/opencl/kernel/pooling2d.h index 5e6ef777b096bf4a7856c06c306ed6b98f6c9923..4a8c813280c70c298ce978f18b36549f46f22b49 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/pooling2d.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/pooling2d.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/fp32/pooling_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PoolingOpenCLKernel : public OpenCLKernel { public: PoolingOpenCLKernel(OpParameter *parameter, const std::vector &inputs, @@ -48,6 +48,6 @@ class PoolingOpenCLKernel : public OpenCLKernel { GpuTensorInfo input_tensor_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_POOLING2D_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/power.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/power.cc index 6e9255028f923b4f82f65be5c891e7669993c0c7..21f60655df099b03876e0c0ed4eb491470cac502 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/power.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/power.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_PowFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int PowerOpenCLKernel::CheckSpecs() { if ((in_tensors_.size() != INPUT_TENSOR_SIZE_1 && in_tensors_.size() != INPUT_TENSOR_SIZE_2) || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { @@ -192,4 +192,4 @@ int PowerOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_PowFusion, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_PowFusion, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/power.h b/mindspore-lite/src/litert/kernel/opencl/kernel/power.h index 33f02aac26b6ea23d6ac2c6352545aeb44fbb154..fd196424e969cec441601e3bd322d0bd1f488e1e 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/power.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/power.h @@ -21,7 +21,7 @@ #include "nnacl_c/fp32/power_fp32.h" #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PowerOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -43,5 +43,5 @@ class PowerOpenCLKernel : public OpenCLKernel { float shift_{1.0}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/prelu.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/prelu.cc index 8c31914032ac8598c148ad46bfc5982b0bd42d05..c1ff2e193664ee3ef62d4077920a7e9e08509c52 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/prelu.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/prelu.cc @@ -31,7 +31,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_PReLUFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { #ifdef ENABLE_FP16 int PReluOpenCLKernel::InitWeights() { auto allocator = ocl_runtime_->GetAllocator(); @@ -232,4 +232,4 @@ int PReluOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_PReLUFusion, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_PReLUFusion, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/prelu.h b/mindspore-lite/src/litert/kernel/opencl/kernel/prelu.h index 420fde9c8f89dad0ddfc14a8d466e9d6c358d5a3..aaaacbf8435fa2ed1d0e371cd2dd8b5513f23540 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/prelu.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/prelu.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "schema/model_generated.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class PReluOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -48,6 +48,6 @@ class PReluOpenCLKernel : public OpenCLKernel { bool weight_is_scalar{false}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_PRELU_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/reduce.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/reduce.cc index 9943a64e2a1bde6c5cc141d53cd835b8411f0734..27b46e8dc40ba431550d54def03a3588efd160cf 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/reduce.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/reduce.cc @@ -39,7 +39,7 @@ using mindspore::schema::ReduceMode_ReduceProd; using mindspore::schema::ReduceMode_ReduceSum; using mindspore::schema::ReduceMode_ReduceSumSquare; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { std::string ReduceOpenCLKernel::GetReduceTypeStr(int type) { static const std::map reduce_type2str{ {ReduceMode_ReduceMean, "Mean"}, {ReduceMode_ReduceSum, "Sum"}, {ReduceMode_ReduceMin, "Min"}, @@ -340,4 +340,4 @@ int ReduceOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_ReduceFusion, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_ReduceFusion, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/reduce.h b/mindspore-lite/src/litert/kernel/opencl/kernel/reduce.h index f66d28b0abf627f8eb8f8667e72ce930d54d9821..3e26057bdca3536bf295db00a6c4cb602d898a8c 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/reduce.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/reduce.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/reduce_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ReduceOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -57,6 +57,6 @@ class ReduceOpenCLKernel : public OpenCLKernel { static const size_t LOCAL_CACHE_THREAD{16}; int axes_[MAX_SHAPE_SIZE]; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_REDUCE_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/reshape.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/reshape.cc index bf91e608331ff654c0718b6b2f68fcca161e426d..a20fd14f9c3dac24989cad2f23a363ec0c2b9923 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/reshape.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/reshape.cc @@ -30,7 +30,7 @@ using mindspore::schema::PrimitiveType_Reshape; using mindspore::schema::PrimitiveType_Squeeze; using mindspore::schema::PrimitiveType_Unsqueeze; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ReshapeOpenCLKernel::CheckSpecs() { if ((in_tensors_.size() != INPUT_TENSOR_SIZE_1 && in_tensors_.size() != INPUT_TENSOR_SIZE_2) || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { @@ -150,4 +150,4 @@ REG_KERNEL(kGPU, kNumberTypeInt32, PrimitiveType_Unsqueeze, OpenCLKernelCreator< REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_ExpandDims, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_ExpandDims, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeInt32, PrimitiveType_ExpandDims, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/reshape.h b/mindspore-lite/src/litert/kernel/opencl/kernel/reshape.h index 7690af40aeb49ea05bd6af52606627790d6454f2..a9752a974a4c515fd1501610506d4ea072296960 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/reshape.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/reshape.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ReshapeOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -34,6 +34,6 @@ class ReshapeOpenCLKernel : public OpenCLKernel { int SetGlobalLocal() override; int PreProcess() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_RESHAPE_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/resize.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/resize.cc index 9315729b7125cb86d59653a83ae020bee42aafe0..dfa8dcd01e2b0cd985a374eb3a564e3f88498e29 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/resize.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/resize.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_Resize; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ResizeOpenCLKernel::CheckSpecs() { if (!(in_tensors_.size() == INPUT_TENSOR_SIZE_1 || in_tensors_.size() == INPUT_TENSOR_SIZE_2) || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { @@ -164,4 +164,4 @@ int ResizeOpenCLKernel::PreProcess() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Resize, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Resize, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/resize.h b/mindspore-lite/src/litert/kernel/opencl/kernel/resize.h index 8f7d9143c49552c5fa77975b4d57acad4073bf22..e4d69d4932b01529dd473510c4d0120be3d8d7bb 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/resize.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/resize.h @@ -22,7 +22,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/resize_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ResizeOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -41,6 +41,6 @@ class ResizeOpenCLKernel : public OpenCLKernel { bool alignCorner{false}; bool preserveAspectRatio{false}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_RESIZE_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/scale.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/scale.cc index 9fdfa3f782d536407c06b38197b25017cb15923d..1678131cdb7ff13cd5866a55c224295d0812b882 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/scale.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/scale.cc @@ -32,7 +32,7 @@ using mindspore::lite::opencl::ImageSize; using mindspore::lite::opencl::MemType; using mindspore::schema::PrimitiveType_ScaleFusion; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const int INPUT_DATA = 0; const int INPUT_SCALE = 1; @@ -321,4 +321,4 @@ int ScaleOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_ScaleFusion, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_ScaleFusion, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/scale.h b/mindspore-lite/src/litert/kernel/opencl/kernel/scale.h index 09a70acfae1807612a73594cf9384eef84a48bc7..304911573f7536e1d473bfce8f9b3265735a8cd5 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/scale.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/scale.h @@ -21,7 +21,7 @@ #include "nnacl_c/scale_parameter.h" #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ScaleOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -45,6 +45,6 @@ class ScaleOpenCLKernel : public OpenCLKernel { std::vector local_size_; std::vector global_size_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_SCALE_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/softmax.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/softmax.cc index e15effb79da1191c5170d15748f05b6cf5e1700e..09c4dbc53621a325e96010d52646cc4c1d109caa 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/softmax.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/softmax.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Softmax; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const int SOFTMAX1x1_32_MAX_C4_NUM = 8; } @@ -187,4 +187,4 @@ int SoftmaxOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Softmax, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Softmax, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/softmax.h b/mindspore-lite/src/litert/kernel/opencl/kernel/softmax.h index 22f598da0733887c531171928f6a5e8ef3cf9a72..19ddb69d2109f761b1db511b21b743e028f37975 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/softmax.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/softmax.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/fp32/softmax_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SoftmaxOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -44,6 +44,6 @@ class SoftmaxOpenCLKernel : public OpenCLKernel { GpuTensorInfo out_shape_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_SOFTMAX_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_batch_nd.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_batch_nd.cc index 73874e77c47ec0022cf6bbed19c8345571a0c4cf..95096779e7c6cf888357bdd64c24b4bd2bb06f5d 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_batch_nd.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_batch_nd.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SpaceToBatch; using mindspore::schema::PrimitiveType_SpaceToBatchND; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SpaceToBatchNDOpenCLKernel::CheckSpecs() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_1 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { MS_LOG(WARNING) << "in size: " << in_tensors_.size() << ", out size: " << out_tensors_.size(); @@ -147,4 +147,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_SpaceToBatchND, OpenCLKernelC REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_SpaceToBatchND, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_SpaceToBatch, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_SpaceToBatch, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_batch_nd.h b/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_batch_nd.h index bde3a88bb883fdd2cf16af9d8c489aabb253a3b2..69e62976e3b3b31dd191666394b146a0f5df9535 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_batch_nd.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_batch_nd.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/fp32/space_to_batch_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SpaceToBatchNDOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -37,5 +37,5 @@ class SpaceToBatchNDOpenCLKernel : public OpenCLKernel { private: }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_depth.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_depth.cc index ebfc9742c85d37f2db352f44652e179c80a355ea..d8d04a573793673dddd206114547e6f909aafcdc 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_depth.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_depth.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_PARAM_INVALID; using mindspore::schema::PrimitiveType_DepthToSpace; using mindspore::schema::PrimitiveType_SpaceToDepth; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SpaceToDepthOpenCLKernel::CheckSpecs() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_1 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { MS_LOG(WARNING) << "in size: " << in_tensors_.size() << ", out size: " << out_tensors_.size(); @@ -135,4 +135,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_SpaceToDepth, OpenCLKernelCre REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_SpaceToDepth, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_DepthToSpace, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_DepthToSpace, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_depth.h b/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_depth.h index e00c5177f146f353afa74a1637df5c80460ebb1f..f32d3d176a6daed34bc68f17f922ac13714d1781 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_depth.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/space_to_depth.h @@ -23,7 +23,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/space_to_depth_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SpaceToDepthOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -39,6 +39,6 @@ class SpaceToDepthOpenCLKernel : public OpenCLKernel { GpuTensorInfo in_shape_; GpuTensorInfo out_shape_; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_SPACE_TO_DEPTH_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/sparse_to_dense.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/sparse_to_dense.cc index 9e7908664e4a6e6b645f115b4b72a381a66e812a..f426933badbd98ab3f959df56ac6ef587863fbbe 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/sparse_to_dense.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/sparse_to_dense.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::opencl::ImageSize; using mindspore::schema::PrimitiveType_SparseToDense; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SparseToDenseOpenCLKernel::InitOutputToDefault() { auto allocator_ = ocl_runtime_->GetAllocator(); ImageSize img_size; @@ -331,4 +331,4 @@ int SparseToDenseOpenCLKernel::Run() { } REG_KERNEL(kGPU, kNumberTypeInt32, PrimitiveType_SparseToDense, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/sparse_to_dense.h b/mindspore-lite/src/litert/kernel/opencl/kernel/sparse_to_dense.h index 306411b7334050b2c06660a35a8284c4b3cb8f83..8de44529b0347f8ed423ff4280d7783501ada16f 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/sparse_to_dense.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/sparse_to_dense.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/fp32/sparse_to_dense_fp32.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SparseToDenseOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -59,5 +59,5 @@ class SparseToDenseOpenCLKernel : public OpenCLKernel { cl_int out_w_{1}; cl_int out_c_{1}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/split.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/split.cc index c92c48690cd7262d3a66a6ca8f1efcb6faca28d5..47b9a43c20eca0c771c1cb5c7495a80887f5eda0 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/split.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/split.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::opencl::ImageSize; using mindspore::schema::PrimitiveType_Split; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int SplitOpenCLKernel::RunAxis0() { auto allocator_ = ocl_runtime_->GetAllocator(); auto src_data = in_tensors_[0]->data(); @@ -276,4 +276,4 @@ int SplitOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Split, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Split, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/split.h b/mindspore-lite/src/litert/kernel/opencl/kernel/split.h index 80ebb4e1b4eb97b5c1b086c5e3a19289c80382cd..0ef4f06908a6ae208b5b38ff4c4d38855037d1ed 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/split.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/split.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/split_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class SplitOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -53,5 +53,5 @@ class SplitOpenCLKernel : public OpenCLKernel { uint32_t OC = {1}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/stack.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/stack.cc index f7d35f29c6bca7e16d1233367eec706996cf18ee..7e865c0e8104054d6a56a4c0ea5837c27a9e64cb 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/stack.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/stack.cc @@ -27,7 +27,7 @@ using mindspore::lite::KernelRegistrar; using mindspore::lite::opencl::ImageSize; using mindspore::schema::PrimitiveType_Stack; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int StackOpenCLKernel::RunAxis0() { auto allocator_ = ocl_runtime_->GetAllocator(); ImageSize img_size; @@ -242,4 +242,4 @@ int StackOpenCLKernel::Run() { } REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Stack, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Stack, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/stack.h b/mindspore-lite/src/litert/kernel/opencl/kernel/stack.h index 9e7f1be4d2c22866b1511e36786ecd832a538aa5..23a8633108bf3f9ad9f9c3dc581666092a4e025c 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/stack.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/stack.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/stack_parameter.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class StackOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -50,5 +50,5 @@ class StackOpenCLKernel : public OpenCLKernel { cl_int4 out_shape_ = {}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/strassen.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/strassen.cc index aca2cbb5b5fbadcb9fb544f9ec0081794a38525a..2b9eca3c8d4497881856607d13efe7757ce2910c 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/strassen.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/strassen.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_OK; using mindspore::lite::opencl::ImageSize; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const int half = 2; } @@ -518,4 +518,4 @@ int StrassenOpenCLKernel::Run() { threshold); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/strassen.h b/mindspore-lite/src/litert/kernel/opencl/kernel/strassen.h index e0282af827902155ac367d307ad60aac3dce60ab..47ce3a7f3079f8c9fc95c0a3eb334278190c5bbc 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/strassen.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/strassen.h @@ -23,7 +23,7 @@ #define MAXDEPTH 5 -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class StrassenOpenCLKernel : public MatMulOpenCLKernel { public: using MatMulOpenCLKernel::MatMulOpenCLKernel; @@ -70,6 +70,6 @@ class StrassenOpenCLKernel : public MatMulOpenCLKernel { void *B_temp[MAXDEPTH] = {nullptr}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_WINOGRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/strided_slice.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/strided_slice.cc index d9d04dd95e6c0ba3d51a198417179e9b75f1d7a1..007f3ba1bff555eec8e2e5caa8f1c4c5cf5b09d6 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/strided_slice.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/strided_slice.cc @@ -29,7 +29,7 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_SliceFusion; using mindspore::schema::PrimitiveType_StridedSlice; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { const int INPUT_BEGIN = 1; const int INPUT_END = 2; @@ -276,4 +276,4 @@ REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_SliceFusion, OpenCLKernelCrea REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_SliceFusion, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_StridedSlice, OpenCLKernelCreator); REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_StridedSlice, OpenCLKernelCreator); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/strided_slice.h b/mindspore-lite/src/litert/kernel/opencl/kernel/strided_slice.h index 129de4fa2a29edfad391257fc819321943a28c9b..f9990806fb929a17f236ee43afc0c4ac82964906 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/strided_slice.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/strided_slice.h @@ -21,7 +21,7 @@ #include "src/litert/kernel/opencl/opencl_kernel.h" #include "nnacl_c/base/slice_base.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class StridedSliceOpenCLKernel : public OpenCLKernel { public: using OpenCLKernel::OpenCLKernel; @@ -47,5 +47,5 @@ class StridedSliceOpenCLKernel : public OpenCLKernel { cl_int4 stride_{{1, 1, 1, 1}}; cl_int4 size_{}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/to_format.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/to_format.cc index 5173cb38e0af2922ede28057b29a6a270f5b35d1..b0d0e6485c447be4fdc87bad07d95f5345ed5090 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/to_format.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/to_format.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::opencl::MemType; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int ToFormatOpenCLKernel::CheckSpecsWithoutShape() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_1 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { MS_LOG(WARNING) << "in size: " << in_tensors_.size() << ", out size: " << out_tensors_.size(); @@ -140,4 +140,4 @@ int ToFormatOpenCLKernel::InferShape() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/to_format.h b/mindspore-lite/src/litert/kernel/opencl/kernel/to_format.h index e1020ede966649f9e1ebef103c1c0815aa9a2c3c..04ff147f128cc166b9884757d05c7322d3633fbb 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/to_format.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/to_format.h @@ -21,7 +21,7 @@ #include "src/litert/lite_kernel.h" #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class ToFormatOpenCLKernel : public OpenCLKernel { public: ToFormatOpenCLKernel(OpParameter *parameter, const std::vector &inputs, @@ -47,6 +47,6 @@ class ToFormatOpenCLKernel : public OpenCLKernel { size_t W_{1}; size_t C_{1}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_RESHAPE_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/transpose.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/transpose.cc index 634cae92f640d48292b2005100b9ed696a0ff597..67d7683fba9332cf93ed501015a17d3125ee25f9 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/transpose.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/transpose.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Transpose; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int TransposeOpenCLKernel::CheckSpecs() { if (in_tensors_.size() != INPUT_TENSOR_SIZE_2 || out_tensors_.size() != OUTPUT_TENSOR_SIZE_1) { MS_LOG(WARNING) << "Transpose input output size unsupported."; @@ -200,4 +200,4 @@ int TransposeOpenCLKernel::Run() { REG_KERNEL(kGPU, kNumberTypeFloat32, PrimitiveType_Transpose, OpenCLKernelCreator) REG_KERNEL(kGPU, kNumberTypeFloat16, PrimitiveType_Transpose, OpenCLKernelCreator) -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/transpose.h b/mindspore-lite/src/litert/kernel/opencl/kernel/transpose.h index f7cc7c06bcbbf73eb5ee24dbb80e1c52705e60c5..d53d9e1db6a3969b06f8c1a3b838cf3ffde6bf5a 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/transpose.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/transpose.h @@ -22,7 +22,7 @@ #include "nnacl_c/transpose_parameter.h" #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { enum class TransposeType { AXIS0312, AXIS0231, GENERAL }; class TransposeOpenCLKernel : public OpenCLKernel { @@ -42,6 +42,6 @@ class TransposeOpenCLKernel : public OpenCLKernel { GpuTensorInfo tensor_size_; int perm_4d_[4]; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_TRANSPOSE_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/winograd.cc b/mindspore-lite/src/litert/kernel/opencl/kernel/winograd.cc index b947c2c61e972741e5abdb0990fbb7625c3de100..a2e49b30ff551d556d540eb679d901dd33fc83fe 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/winograd.cc +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/winograd.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { void Align(const std::vector &global, const std::vector &local, cl::NDRange *global_range, cl::NDRange *local_range) { @@ -366,4 +366,4 @@ double WinogradOpenCLKernel::GetProfilingTimeMs() { time_ns += time_end - time_start; return static_cast(time_ns) * 1e-6; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/kernel/winograd.h b/mindspore-lite/src/litert/kernel/opencl/kernel/winograd.h index bcceb63ffb169a6b9cc1ed2b53964d16089d3f74..ea645de7cc776970ddafaed96810c2ebf9a28cc0 100644 --- a/mindspore-lite/src/litert/kernel/opencl/kernel/winograd.h +++ b/mindspore-lite/src/litert/kernel/opencl/kernel/winograd.h @@ -21,7 +21,7 @@ #include #include "src/litert/kernel/opencl/kernel/conv2d.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class WinogradOpenCLKernel : public Conv2DOpenCLKernel { public: WinogradOpenCLKernel(OpParameter *parameter, const std::vector &inputs, @@ -55,6 +55,6 @@ class WinogradOpenCLKernel : public Conv2DOpenCLKernel { void *winograd_mem1_{nullptr}; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_KERNEL_WINOGRAD_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/opencl_fusion.cc b/mindspore-lite/src/litert/kernel/opencl/opencl_fusion.cc index b4e3ae209ea7a9010fa4708d1b3082bdb6b6a9af..f465d9d02f43d94d15cdcdbced5f5c03e03a08e4 100644 --- a/mindspore-lite/src/litert/kernel/opencl/opencl_fusion.cc +++ b/mindspore-lite/src/litert/kernel/opencl/opencl_fusion.cc @@ -47,7 +47,7 @@ using mindspore::schema::PrimitiveType_Activation; using mindspore::schema::PrimitiveType_Eltwise; using mindspore::schema::PrimitiveType_NONE; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { namespace { template inline bool AIsInB(const T0 *a, const T1 *b) { @@ -742,4 +742,4 @@ int OpenCLSubGraph::FusionPass() { MS_LOG(DEBUG) << "number of kernels(after fusion) : " << nodes_.size(); return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/opencl_kernel.cc b/mindspore-lite/src/litert/kernel/opencl/opencl_kernel.cc index 578d730e9ce8cea6069b477a6dd6f9a6122b5595..6006b27677e6e5431005eefa00f83ea9e683e91d 100644 --- a/mindspore-lite/src/litert/kernel/opencl/opencl_kernel.cc +++ b/mindspore-lite/src/litert/kernel/opencl/opencl_kernel.cc @@ -23,7 +23,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::opencl::ImageSize; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int CpuAxis2GpuAxis(size_t ndim, int cpu_axis, int *gpu_axis) { static const std::vector> kCpuAxis2GpuAxisMapTable = { // For 1D tensor, map the cpu axis [0] to gpu axis [kNHWC_C]. @@ -456,4 +456,4 @@ int OpenCLKernel::CheckSpecs() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/opencl_kernel.h b/mindspore-lite/src/litert/kernel/opencl/opencl_kernel.h index 86d07453d4a8ecc522558641b6d41d9e11093bc5..cd5ab60c1ed0fa4f955eda77d03e1300503cb63b 100644 --- a/mindspore-lite/src/litert/kernel/opencl/opencl_kernel.h +++ b/mindspore-lite/src/litert/kernel/opencl/opencl_kernel.h @@ -34,7 +34,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr int INPUT_TENSOR_SIZE_1 = 1; constexpr int INPUT_TENSOR_SIZE_2 = 2; constexpr int INPUT_TENSOR_SIZE_3 = 3; @@ -395,6 +395,6 @@ kernel::LiteKernel *OpenCLKernelCreator(const std::vector &input } return kernel; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_OPENCL_KERNEL_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/opencl_subgraph.cc b/mindspore-lite/src/litert/kernel/opencl/opencl_subgraph.cc index 8a86e4b5428b85fe797b2bf5d9e49fa74e84c22e..61f09dab80c30aab1fdd34dbc2ba994d8a1f7359 100644 --- a/mindspore-lite/src/litert/kernel/opencl/opencl_subgraph.cc +++ b/mindspore-lite/src/litert/kernel/opencl/opencl_subgraph.cc @@ -27,7 +27,7 @@ #include "include/errorcode.h" #include "src/common/utils.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::opencl::MemType; @@ -565,4 +565,4 @@ int OpenCLSubGraph::Execute(const KernelCallBack &before, const KernelCallBack & } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/opencl_subgraph.h b/mindspore-lite/src/litert/kernel/opencl/opencl_subgraph.h index 4651f0568efdf78612352993024ef64eed09ef7c..c0f63e390c98637bc9fdc50d26508ce60144888b 100644 --- a/mindspore-lite/src/litert/kernel/opencl/opencl_subgraph.h +++ b/mindspore-lite/src/litert/kernel/opencl/opencl_subgraph.h @@ -25,7 +25,7 @@ #include "src/litert/kernel/gpu/opencl/opencl_executor.h" #include "src/executor/sub_graph_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class OpenCLSubGraph : public SubGraphKernel { public: OpenCLSubGraph(const std::vector &inKernels, @@ -97,6 +97,6 @@ class OpenCLSubGraph : public SubGraphKernel { lite::opencl::OpenCLRuntime *ocl_runtime_{nullptr}; bool all_kernels_infer_done_ = false; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_OPENCL_SUBGRAPH_H_ diff --git a/mindspore-lite/src/litert/kernel/opencl/utils.cc b/mindspore-lite/src/litert/kernel/opencl/utils.cc index cd495bff412a4487bb725abc4ce14f0fca25013b..e38bd2a6ad1f9dc940116643741b70f46a757278 100644 --- a/mindspore-lite/src/litert/kernel/opencl/utils.cc +++ b/mindspore-lite/src/litert/kernel/opencl/utils.cc @@ -28,7 +28,7 @@ using mindspore::schema::ActivationType_RELU6; using mindspore::schema::ActivationType_SIGMOID; using mindspore::schema::ActivationType_TANH; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { const std::set ArithmeticPrimitives = {schema::PrimitiveType_MulFusion, schema::PrimitiveType_AddFusion, schema::PrimitiveType_SubFusion, @@ -396,4 +396,4 @@ std::vector CreateBuildOptionsExtByDType(TypeId type_id) { } return build_options_ext; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel/opencl/utils.h b/mindspore-lite/src/litert/kernel/opencl/utils.h index d392c7a1aa29f300852ca2a68fce0d99cac2774f..ba883784c9de36a3e0299cffe7c634871a778d34 100644 --- a/mindspore-lite/src/litert/kernel/opencl/utils.h +++ b/mindspore-lite/src/litert/kernel/opencl/utils.h @@ -27,7 +27,7 @@ #include "src/common/utils.h" #include "src/litert/kernel/opencl/opencl_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { struct GpuTensorInfo; // for fusion @@ -103,6 +103,6 @@ std::vector MatrixMultiply(const T A[], const T B[], int M, int N, int K) { return C; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_OPENCL_UTILS_H_ diff --git a/mindspore-lite/src/litert/kernel_exec_util.cc b/mindspore-lite/src/litert/kernel_exec_util.cc index b4a885ee44081760103e7ea5a5ad09ec6d25fda9..76e47ffab916eeb1938b516dc26969065f3ea31d 100644 --- a/mindspore-lite/src/litert/kernel_exec_util.cc +++ b/mindspore-lite/src/litert/kernel_exec_util.cc @@ -28,7 +28,7 @@ #include "src/control_flow/control_subgraph_creator.h" #include "src/litert/kernel/cpu/base/partial_fusion.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; @@ -697,4 +697,4 @@ std::vector KernelExecUtil::GetCallInputPartialsCorrespondingOutpu KernelExec *KernelExecUtil::GetPartialOutputCall(const KernelExec *partial_node) { return nullptr; } #endif -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/kernel_exec_util.h b/mindspore-lite/src/litert/kernel_exec_util.h index 8c2d43b4b38bbc48f25465e2366225a6b9002c1d..e0cd964050ca9da05dcc0facee8281f0e0904fa0 100644 --- a/mindspore-lite/src/litert/kernel_exec_util.h +++ b/mindspore-lite/src/litert/kernel_exec_util.h @@ -22,7 +22,7 @@ #include "src/executor/sub_graph_kernel.h" #include "src/litert/inner_context.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MS_API KernelExecUtil { public: @@ -64,6 +64,6 @@ class MS_API KernelExecUtil { static std::set AllOutTensor(const std::vector &kernels); }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_EXEC_UTIL_H_ diff --git a/mindspore-lite/src/litert/lite_kernel.cc b/mindspore-lite/src/litert/lite_kernel.cc index b2d28d1366d9d64d2f6701f90ddcbd45d49e64ef..6f7ef2fc19b61fa355e2ea18aee01ad624a3348b 100644 --- a/mindspore-lite/src/litert/lite_kernel.cc +++ b/mindspore-lite/src/litert/lite_kernel.cc @@ -19,7 +19,7 @@ #include "src/common/utils.h" #include "src/litert/infer_manager.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; @@ -127,4 +127,4 @@ int LiteKernel::Execute() { } return lite::RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/src/litert/lite_kernel.h b/mindspore-lite/src/litert/lite_kernel.h index 501ab5d1f47b4eb12b1995669bdf0a9eed0e8759..1dd881ab539e767c6ed3d6ee7d82ef07b0b92860 100644 --- a/mindspore-lite/src/litert/lite_kernel.h +++ b/mindspore-lite/src/litert/lite_kernel.h @@ -36,7 +36,7 @@ using mindspore::infer::Abstractkernel; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class MS_API LiteKernel : public Abstractkernel { public: LiteKernel() = default; @@ -205,6 +205,6 @@ class MS_API LiteKernel : public Abstractkernel { int thread_num_ = 1; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_LITE_KERNEL_H_ diff --git a/mindspore-lite/src/litert/model_manager.cc b/mindspore-lite/src/litert/model_manager.cc index cb4757784125883d8a7be7daa6e461da3b830793..ea019e40b482c0efb29c3a4380b0f3294bd51986 100644 --- a/mindspore-lite/src/litert/model_manager.cc +++ b/mindspore-lite/src/litert/model_manager.cc @@ -20,7 +20,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { void ModelManager::AddModel(const std::string model_path) { (void)model_path_set_.insert(model_path); } void ModelManager::AddModel(const std::pair model_buff) { @@ -36,4 +36,4 @@ ModelManager::~ModelManager() { model_path_set_.clear(); model_buff_set_.clear(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/model_manager.h b/mindspore-lite/src/litert/model_manager.h index 4760f9877380c322d66cb25c0c6d6462dab731ea..7b93259e24fd08d6c125a7d2d8b50d930b669500 100644 --- a/mindspore-lite/src/litert/model_manager.h +++ b/mindspore-lite/src/litert/model_manager.h @@ -24,7 +24,7 @@ #include #include "src/litert/lite_session.h" -namespace mindspore { +namespace mindspore::lite { class ModelManager { public: ModelManager() {} @@ -48,6 +48,6 @@ class ModelManager { std::set model_path_set_; std::set> model_buff_set_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_MODEL_MANAGER_H_ diff --git a/mindspore-lite/src/litert/runtime_allocator.cc b/mindspore-lite/src/litert/runtime_allocator.cc index 06c85c69001645f1128aeae419dfc961b42b0511..62af6daac7c7aa7aefceb582e5f3ecfe3543692e 100644 --- a/mindspore-lite/src/litert/runtime_allocator.cc +++ b/mindspore-lite/src/litert/runtime_allocator.cc @@ -16,7 +16,7 @@ #include "src/litert/runtime_allocator.h" -namespace mindspore { +namespace mindspore::lite { RuntimeAllocator::RuntimeAllocator(size_t aligned_size) { aligned_size_ = aligned_size; return; @@ -120,4 +120,4 @@ void RuntimeAllocator::MallocTensorData(lite::Tensor *tensor) { used_list_[offset] = size; offset_map_[tensor] = offset; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/litert/runtime_allocator.h b/mindspore-lite/src/litert/runtime_allocator.h index 67ef7022286fe9736aa345498d9923433a69f80d..59768d618151607fc1eb6811ca1d817072b3d5ca 100644 --- a/mindspore-lite/src/litert/runtime_allocator.h +++ b/mindspore-lite/src/litert/runtime_allocator.h @@ -24,7 +24,7 @@ #include "include/errorcode.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class RuntimeAllocator : public Allocator { public: explicit RuntimeAllocator(size_t aligned_size = 32); @@ -58,6 +58,6 @@ class RuntimeAllocator : public Allocator { }; using RuntimeAllocatorPtr = std::shared_ptr; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_RUNTIME_RUNTIME_ALLOCATOR_H_ diff --git a/mindspore-lite/src/registry/kernel_interface_registry.cc b/mindspore-lite/src/registry/kernel_interface_registry.cc index eebec6560abb81ec69ae6b3d8abc54a9c12cce41..96d0704e139bc8c2b7389fc625155122cca757bf 100644 --- a/mindspore-lite/src/registry/kernel_interface_registry.cc +++ b/mindspore-lite/src/registry/kernel_interface_registry.cc @@ -25,7 +25,7 @@ using mindspore::registry::KernelInterfaceCreator; using mindspore::schema::PrimitiveType_MAX; using mindspore::schema::PrimitiveType_MIN; -namespace mindspore { +namespace mindspore::lite { namespace registry { namespace { static constexpr auto kMaxProviderNum = 10; @@ -206,4 +206,4 @@ KernelInterfaceRegistry::~KernelInterfaceRegistry() { } } } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/registry/kernel_interface_registry.h b/mindspore-lite/src/registry/kernel_interface_registry.h index 17bf00dc04a744a9a3bed9384180fbca6ef1c7e6..eb3c9dc3d8b0bccdd420bda32ddcfe9ba4824cb8 100644 --- a/mindspore-lite/src/registry/kernel_interface_registry.h +++ b/mindspore-lite/src/registry/kernel_interface_registry.h @@ -25,7 +25,7 @@ #include "include/registry/register_kernel_interface.h" #include "include/model.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { class KernelInterfaceRegistry { public: @@ -59,6 +59,6 @@ class KernelInterfaceRegistry { std::map>> custom_kernels_; }; } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_REGISTRY_KERNEL_INTERFACE_REGISTRY_H_ diff --git a/mindspore-lite/src/registry/register_kernel.cc b/mindspore-lite/src/registry/register_kernel.cc index 50e853b4c6fbc68749e61b5b64338623e31c92a8..12f5d0c534d7a506e3ea04760de00abc9dd4b805 100644 --- a/mindspore-lite/src/registry/register_kernel.cc +++ b/mindspore-lite/src/registry/register_kernel.cc @@ -20,7 +20,7 @@ #include "src/common/log_adapter.h" #include "src/registry/register_kernel_impl.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { Status RegisterKernel::RegCustomKernel(const std::vector &arch, const std::vector &provider, DataType data_type, const std::vector &type, const CreateKernel creator) { @@ -44,4 +44,4 @@ CreateKernel RegisterKernel::GetCreator(const schema::Primitive *primitive, Kern return ret; } } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/registry/register_kernel_impl.cc b/mindspore-lite/src/registry/register_kernel_impl.cc index 68917ea585f155d7e9c252243710ff77f80c9c77..8e228c1301b27b0f6e12608c9db24808ae13c577 100644 --- a/mindspore-lite/src/registry/register_kernel_impl.cc +++ b/mindspore-lite/src/registry/register_kernel_impl.cc @@ -23,7 +23,7 @@ using mindspore::registry::CreateKernel; using mindspore::registry::KernelDesc; using mindspore::schema::PrimitiveType_MAX; using mindspore::schema::PrimitiveType_MIN; -namespace mindspore::registry { +namespace mindspore::lite::registry { namespace { static const auto kOpTypeLen = PrimitiveType_MAX - PrimitiveType_MIN + 1; static const auto kDataTypeLen = @@ -212,4 +212,4 @@ RegistryKernelImpl::~RegistryKernelImpl() { } } } -} // namespace mindspore::registry +} // namespace mindspore::lite::registry diff --git a/mindspore-lite/src/registry/register_kernel_impl.h b/mindspore-lite/src/registry/register_kernel_impl.h index 4041b85ac504cc36a1d235829f965031f098469a..8fcacd56e3b1dfdfc8b156ccf6149fbe42707c06 100644 --- a/mindspore-lite/src/registry/register_kernel_impl.h +++ b/mindspore-lite/src/registry/register_kernel_impl.h @@ -25,7 +25,7 @@ #include #include "include/registry/register_kernel.h" -namespace mindspore::registry { +namespace mindspore::lite::registry { class RegistryKernelImpl { public: RegistryKernelImpl() = default; @@ -66,6 +66,6 @@ class RegistryKernelImpl { registry::CreateKernel GetCustomKernelCreator(const schema::Primitive *primitive, registry::KernelDesc *desc); }; -} // namespace mindspore::registry +} // namespace mindspore::lite::registry #endif // MINDSPORE_LITE_SRC_REGISTRY_REGISTER_KERNEL_IMPL_H_ diff --git a/mindspore-lite/src/registry/register_kernel_interface.cc b/mindspore-lite/src/registry/register_kernel_interface.cc index 274ba3d94b7b0d9c0c762f0902fbf24e75a75a39..749531cd72707addd71bf1cb0d4b5c073e82c28d 100644 --- a/mindspore-lite/src/registry/register_kernel_interface.cc +++ b/mindspore-lite/src/registry/register_kernel_interface.cc @@ -20,7 +20,7 @@ #include "src/common/log_adapter.h" #include "src/registry/kernel_interface_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { Status RegisterKernelInterface::Reg(const std::vector &provider, int op_type, const KernelInterfaceCreator creator) { @@ -38,4 +38,4 @@ std::shared_ptr RegisterKernelInterface::GetKernelInter return KernelInterfaceRegistry::Instance()->GetKernelInterface(CharToString(provider), primitive, kernel); } } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/train/loss_kernel.h b/mindspore-lite/src/train/loss_kernel.h index f13b2fc8051cc9e6487f17b021b53df371af7ee8..0de6575f16a89d729da5ec4ee92f10a90490eb2e 100644 --- a/mindspore-lite/src/train/loss_kernel.h +++ b/mindspore-lite/src/train/loss_kernel.h @@ -17,7 +17,7 @@ #define MINDSPORE_LITE_SRC_TRAIN_LOSS_KERNEL_H_ #include #include "src/executor/kernel_exec.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class LossKernel : public LiteKernel { public: @@ -28,5 +28,5 @@ class LossKernel : public LiteKernel { ~LossKernel() override = default; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_TRAIN_LOSS_KERNEL_H_ diff --git a/mindspore-lite/src/train/opt_allocator.cc b/mindspore-lite/src/train/opt_allocator.cc index 485e4b9742411209a7171a3aa2e8bdd1da2f6e4a..dc832a3fcb7e6ab57a510f366b753f11b17b07db 100644 --- a/mindspore-lite/src/train/opt_allocator.cc +++ b/mindspore-lite/src/train/opt_allocator.cc @@ -17,7 +17,7 @@ #include #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { size_t OptAllocator::FindFree(size_t size) { size_t min_size = std::numeric_limits::max(); size_t min_addr = std::numeric_limits::max(); @@ -86,4 +86,4 @@ void OptAllocator::Free(size_t addr) { alloc_.erase(addr); Reorder(addr); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/train/opt_allocator.h b/mindspore-lite/src/train/opt_allocator.h index 142165c33aa151d4b2680741102438ded068a30f..e655e143c91182b29bad54a1372a1f688f057149 100644 --- a/mindspore-lite/src/train/opt_allocator.h +++ b/mindspore-lite/src/train/opt_allocator.h @@ -20,7 +20,7 @@ #include #include "include/api/allocator.h" -namespace mindspore { +namespace mindspore::lite { class OptAllocator { public: explicit OptAllocator(size_t aligned_size = 32) : align_size_(aligned_size) {} @@ -37,5 +37,5 @@ class OptAllocator { size_t heap_ = 0; size_t align_size_; }; -}; // namespace mindspore +}; // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_TRAIN_OPT_ALLOCATOR_H_ diff --git a/mindspore-lite/src/train/optimizer/common/fusion_utils.cc b/mindspore-lite/src/train/optimizer/common/fusion_utils.cc index 4da01b8c6fd92055b4e027d30bf7d80ef9cca1f2..b6d676b31b008c96249192a164c80ca652a8293d 100644 --- a/mindspore-lite/src/train/optimizer/common/fusion_utils.cc +++ b/mindspore-lite/src/train/optimizer/common/fusion_utils.cc @@ -20,7 +20,7 @@ #include "src/common/log_util.h" #include "src/train/optimizer/common/fusion_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { STATUS GetMatchNodeIndex(schema::MetaGraphT *graph, const std::unordered_map> &matched_path, @@ -47,4 +47,4 @@ bool IsMultiOutputNode(schema::MetaGraphT *graph, size_t out_node_index) { return false; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/train/optimizer/common/fusion_utils.h b/mindspore-lite/src/train/optimizer/common/fusion_utils.h index 604472b50d744decedaa65cb76432a1493f74da7..d2f74f1c87dcce89352948d6c54085fad8568272 100644 --- a/mindspore-lite/src/train/optimizer/common/fusion_utils.h +++ b/mindspore-lite/src/train/optimizer/common/fusion_utils.h @@ -29,7 +29,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace opt { inline constexpr int kInputIndexZero = 0; inline constexpr int kInputIndexOne = 1; @@ -48,5 +48,5 @@ STATUS GetMatchNodeIndex(schema::MetaGraphT *graph, bool IsMultiOutputNode(schema::MetaGraphT *graph, size_t out_node_index); } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_TRAIN_OPTIMIZER_COMMON_FUSION_UTILS_H_ diff --git a/mindspore-lite/src/train/optimizer_kernel.h b/mindspore-lite/src/train/optimizer_kernel.h index a4ec60efe555a125a0588de0f8556febd327a576..1890fa98b09189064b20451036d2db314f945365 100644 --- a/mindspore-lite/src/train/optimizer_kernel.h +++ b/mindspore-lite/src/train/optimizer_kernel.h @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::RET_OUT_OF_TENSOR_RANGE; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { constexpr static int kWeightIdx = 0; constexpr static int kMomentVector1stIdx = 1; constexpr static int kMomentVector2stIdx = 2; @@ -246,5 +246,5 @@ class OptimizerKernel : public LiteKernel { WeightUpdateMode weight_update_mod_ = WeightUpdateMode::NORMAL; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_TRAIN_OPTIMIZER_KERNEL_H_ diff --git a/mindspore-lite/src/train/static_allocator.h b/mindspore-lite/src/train/static_allocator.h index 833fd832537dd1377262b621171b4c2102cc25d3..4d8092d16f04915f2d5e702d68aa94fa3b000214 100644 --- a/mindspore-lite/src/train/static_allocator.h +++ b/mindspore-lite/src/train/static_allocator.h @@ -16,7 +16,7 @@ #ifndef MINDSPORE_LITE_SRC_TRAIN_STATIC_ALLOCATOR_H_ #define MINDSPORE_LITE_SRC_TRAIN_STATIC_ALLOCATOR_H_ -namespace mindspore { +namespace mindspore::lite { class StaticAllocator : public Allocator { public: void SetContex(void *buf, size_t size) { @@ -48,5 +48,5 @@ class StaticAllocator : public Allocator { size_t size_; size_t total_size_ = 0; }; -}; // namespace mindspore +}; // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_TRAIN_STATIC_ALLOCATOR_H_ diff --git a/mindspore-lite/src/train/train_populate_parameter.cc b/mindspore-lite/src/train/train_populate_parameter.cc index 3cfdd24d62c4c35cb5537e58de328df4f06b2a9e..14c6adec6b6befdfef0294093a52192420d33b3a 100644 --- a/mindspore-lite/src/train/train_populate_parameter.cc +++ b/mindspore-lite/src/train/train_populate_parameter.cc @@ -35,7 +35,7 @@ using mindspore::lite::Registry; -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr int kInputIndexOne = 1; @@ -693,4 +693,4 @@ void PopulateTrainParameters() { lite::SCHEMA_CUR); } } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/src/train/train_populate_parameter.h b/mindspore-lite/src/train/train_populate_parameter.h index 12fa0dbd78f094acbbe9ca02fe33cb81f19ab553..7a86bddcddc01f4e24951a1011441a6c48f7439e 100644 --- a/mindspore-lite/src/train/train_populate_parameter.h +++ b/mindspore-lite/src/train/train_populate_parameter.h @@ -17,9 +17,9 @@ #ifndef MINDSPORE_LITE_SRC_TRAIN_TRAIN_POPULATE_PARAMETER_H_ #define MINDSPORE_LITE_SRC_TRAIN_TRAIN_POPULATE_PARAMETER_H_ -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void PopulateTrainParameters(); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_TRAIN_TRAIN_POPULATE_PARAMETER_H_ diff --git a/mindspore-lite/src/train/train_populate_parameter_v0.h b/mindspore-lite/src/train/train_populate_parameter_v0.h index 6a070834088a7b01d8f8ad524e5eb2e2a5c0b441..621588649a5d66ceac73681eb1ce6fb002a74e79 100644 --- a/mindspore-lite/src/train/train_populate_parameter_v0.h +++ b/mindspore-lite/src/train/train_populate_parameter_v0.h @@ -17,9 +17,9 @@ #ifndef MINDSPORE_LITE_SRC_TRAIN_TRAIN_POPULATE_PARAMETER_V0_H_ #define MINDSPORE_LITE_SRC_TRAIN_TRAIN_POPULATE_PARAMETER_V0_H_ -namespace mindspore::kernel { +namespace mindspore::lite::kernel { void PopulateTrainV0Parameters(); -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_SRC_TRAIN_TRAIN_POPULATE_PARAMETER_V0_H_ diff --git a/mindspore-lite/test/common/common_test.cc b/mindspore-lite/test/common/common_test.cc index 46535383925966afedcdb6e999e96574d7e61aa1..674516a9c04633677b70a8b6ac61f77400774426 100644 --- a/mindspore-lite/test/common/common_test.cc +++ b/mindspore-lite/test/common/common_test.cc @@ -24,7 +24,7 @@ extern "C" { #endif #endif -namespace mindspore { +namespace mindspore::lite { void CommonTest::SetUpTestCase() {} void CommonTest::TearDownTestCase() {} void CommonTest::SetUp() {} @@ -101,7 +101,7 @@ void *CommonTest::TensorMutabData(lite::Tensor *tensor) { return tensor->Mutable size_t CommonTest::TensorSize(lite::Tensor *tensor) { return tensor->Size(); } int CommonTest::TensorMallocData(lite::Tensor *tensor) { return tensor->MallocData(); } -} // namespace mindspore +} // namespace mindspore::lite #ifdef __cplusplus #if __cplusplus diff --git a/mindspore-lite/test/main.cc b/mindspore-lite/test/main.cc index de5be496856251dca9c64f65123657a2500fb13d..d3540dd1a48b9de83c941fdb2ac9e3da198c4753 100644 --- a/mindspore-lite/test/main.cc +++ b/mindspore-lite/test/main.cc @@ -17,7 +17,7 @@ #include "gtest/gtest.h" #ifdef USE_GLOG -namespace mindspore { +namespace mindspore::lite { extern void InitSubModulesLogLevel(); } #endif diff --git a/mindspore-lite/test/st/mindrt_parallel_test.cc b/mindspore-lite/test/st/mindrt_parallel_test.cc index 7e2ce2658a5e2b802209668020a15738069a54e5..87cd8e4e7b559c30a9bd0ec70fef4931224a20b5 100644 --- a/mindspore-lite/test/st/mindrt_parallel_test.cc +++ b/mindspore-lite/test/st/mindrt_parallel_test.cc @@ -26,7 +26,7 @@ #include "src/common/file_utils.h" #include "include/converter.h" -namespace mindspore { +namespace mindspore::lite { class MindrtParallelTest : public mindspore::CommonTest { public: MindrtParallelTest() {} @@ -172,4 +172,4 @@ TEST_F(MindrtParallelTest, runtime1) { delete session; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/st/mix_data_type_test.cc b/mindspore-lite/test/st/mix_data_type_test.cc index cd02e804ac44ffeca260437b1f5fa262dce9ab82..0b83d85a5c8e2ccd255fe14ea16034117b8bf3c5 100644 --- a/mindspore-lite/test/st/mix_data_type_test.cc +++ b/mindspore-lite/test/st/mix_data_type_test.cc @@ -24,7 +24,7 @@ #include "include/api/model.h" #include "src/litert/cxx_api/model/model_impl.h" -namespace mindspore { +namespace mindspore::lite { class MixDataTypeTest : public mindspore::CommonTest { public: MixDataTypeTest() {} @@ -235,4 +235,4 @@ TEST_F(MixDataTypeTest, mix1) { ASSERT_LE(fabs(fp32_data[2] - (0.934805)), 0.01); ASSERT_LE(fabs(fp32_data[3] - (0.879054)), 0.01); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/st/sub_graph_test.cc b/mindspore-lite/test/st/sub_graph_test.cc index d5f902d5cd869595f90cc224f92673d13a84c0d3..75dca651be15d25840fc956c967fecd811d08d9b 100644 --- a/mindspore-lite/test/st/sub_graph_test.cc +++ b/mindspore-lite/test/st/sub_graph_test.cc @@ -24,7 +24,7 @@ #include "src/litert/lite_session.h" #include "tools/common/meta_graph_serializer.h" -namespace mindspore { +namespace mindspore::lite { class SubGraphTest : public mindspore::CommonTest { public: SubGraphTest() = default; @@ -309,12 +309,12 @@ TEST_F(SubGraphTest, RecursiveSubGraphTest) { meta_graph->name = "graph"; meta_graph->version = Version(); // ----------------------------------------------------------------------- - lite::MetaGraphSerializer::Save( - *meta_graph, "/mnt/data/workspace/OpenAI/Huawei/mindspore-lite/my_test/models/recursive_subgraph"); + lite::MetaGraphSerializer::Save(*meta_graph, + "/mnt/data/workspace/OpenAI/Huawei/mindspore-lite/my_test/models/recursive_subgraph"); // ----------------------------------------------------------------------- size_t size = 0; - char *graph_buf = lite::ReadFile( - "/mnt/data/workspace/OpenAI/Huawei/mindspore-lite/my_test/models/recursive_subgraph.ms", &size); + char *graph_buf = + lite::ReadFile("/mnt/data/workspace/OpenAI/Huawei/mindspore-lite/my_test/models/recursive_subgraph.ms", &size); ASSERT_NE(graph_buf, nullptr); auto model = std::shared_ptr(lite::Model::Import(graph_buf, size)); @@ -335,4 +335,4 @@ TEST_F(SubGraphTest, RecursiveSubGraphTest) { ret = session->RunGraph(); ASSERT_EQ(ret, lite::RET_OK); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/adam_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/adam_infer_test.cc index 355bd16e298773956929d77beba7280c3d97a4b0..d9337afb1d2b3ea124cc0e7e04f2e065e6dfd06c 100644 --- a/mindspore-lite/test/ut/nnacl/infer/adam_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/adam_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/adam_infer.h" -namespace mindspore { +namespace mindspore::lite { class AdamInferTest : public mindspore::CommonTest { public: @@ -48,4 +48,4 @@ TEST_F(AdamInferTest, AdamInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/adam_weight_decay_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/adam_weight_decay_infer_test.cc index 62f8654c4c9b31fece0998003b179f3df9e4c60d..d4426dd8e3de55e0f9d586ce9edfdbf8caefa8ba 100644 --- a/mindspore-lite/test/ut/nnacl/infer/adam_weight_decay_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/adam_weight_decay_infer_test.cc @@ -17,7 +17,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/adam_weight_decay_infer.h" -namespace mindspore { +namespace mindspore::lite { class AdamWeightDecayInfer : public mindspore::CommonTest { public: AdamWeightDecayInfer() {} @@ -54,4 +54,4 @@ TEST_F(AdamWeightDecayInfer, OneDim) { ASSERT_EQ(outputs[0]->shape_[0], 1); AdamWeightDecayInferReleaseResources(param, inputs, outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/addn_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/addn_infer_test.cc index 6d5cd2c8188ad61391f7874fc22ee975c49cdaac..dd95d659d29dd10b861a79030113607434aa278d 100644 --- a/mindspore-lite/test/ut/nnacl/infer/addn_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/addn_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/addn_infer.h" -namespace mindspore { +namespace mindspore::lite { class AddnInferTest : public mindspore::CommonTest { public: @@ -88,4 +88,4 @@ TEST_F(AddnInferTest, AddnInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/apply_momentum_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/apply_momentum_infer_test.cc index ee3b919c7085b9bce20d30da21127763873776d2..fb098c96f8c2afc08597cea4efc65eecb915b09d 100644 --- a/mindspore-lite/test/ut/nnacl/infer/apply_momentum_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/apply_momentum_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/apply_momentum_infer.h" -namespace mindspore { +namespace mindspore::lite { class ApplyMomentumInferTest : public mindspore::CommonTest { public: @@ -48,4 +48,4 @@ TEST_F(ApplyMomentumInferTest, ApplyMomentumInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/argmax_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/argmax_infer_test.cc index 10ecad2c5e791973c5f5fb0e29330e6f481e7c76..9c3939e30a1d24460a2cb95f0a89e47f4219a1a2 100644 --- a/mindspore-lite/test/ut/nnacl/infer/argmax_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/argmax_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/argmin_max_infer.h" -namespace mindspore { +namespace mindspore::lite { class ArgmaxInferTest : public mindspore::CommonTest { public: @@ -133,4 +133,4 @@ TEST_F(ArgmaxInferTest, ArgmaxInferTestTopK2) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/argmin_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/argmin_infer_test.cc index 1c6ed96af96dd2a7750fcbaad4a4e73a4975183e..731782a44d7bff67d8e0811574661387b378de25 100644 --- a/mindspore-lite/test/ut/nnacl/infer/argmin_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/argmin_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/argmin_max_infer.h" -namespace mindspore { +namespace mindspore::lite { class ArgminInferTest : public mindspore::CommonTest { public: @@ -133,4 +133,4 @@ TEST_F(ArgminInferTest, ArgminInferTestTopK2) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/arithmetic_compare_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/arithmetic_compare_infer_test.cc index c1096310bf9719aa216d393f738e1013e3c7b4cf..3b612d29cc2da117a1ced73ae04d19124126b931 100644 --- a/mindspore-lite/test/ut/nnacl/infer/arithmetic_compare_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/arithmetic_compare_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/arithmetic_compare_infer.h" -namespace mindspore { +namespace mindspore::lite { class ArithmeticCompareInferTest : public mindspore::CommonTest { public: @@ -166,4 +166,4 @@ TEST_F(ArithmeticCompareInferTest, ArithmeticCompareInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/arithmetic_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/arithmetic_infer_test.cc index fa759509dfa77bf63df58ac6e463804717ab1730..d477580597bb0b6c1f345a3138e388b472c9ed09 100644 --- a/mindspore-lite/test/ut/nnacl/infer/arithmetic_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/arithmetic_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/arithmetic_infer.h" -namespace mindspore { +namespace mindspore::lite { class ArithmeticInferTest : public mindspore::CommonTest { public: @@ -166,4 +166,4 @@ TEST_F(ArithmeticInferTest, ArithmeticInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/assign_add_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/assign_add_infer_test.cc index b2055260ab328830c56b132c04ae94b1c22ded51..4acac28bd7a8f16284f6546ed91658fbacc60eee 100644 --- a/mindspore-lite/test/ut/nnacl/infer/assign_add_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/assign_add_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/assign_add_infer.h" -namespace mindspore { +namespace mindspore::lite { class AssignAddInferTest : public mindspore::CommonTest { public: @@ -51,4 +51,4 @@ TEST_F(AssignAddInferTest, AssignAddInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/assign_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/assign_infer_test.cc index 739c25be950fb3eea8a39b9fd1d4ff5843122b36..45e4aeeb5a576c1547997f16586d1d350056b4e3 100644 --- a/mindspore-lite/test/ut/nnacl/infer/assign_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/assign_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/assign_infer.h" -namespace mindspore { +namespace mindspore::lite { class AssignInferTest : public mindspore::CommonTest { public: @@ -53,4 +53,4 @@ TEST_F(AssignInferTest, AssignInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/audio_spectrogram_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/audio_spectrogram_infer_test.cc index 14497e7314f54a7b394f447a92fb3f933db21aa1..c1b7b553296cf58c43d1bf1dfeb7c04c0c0e9a58 100644 --- a/mindspore-lite/test/ut/nnacl/infer/audio_spectrogram_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/audio_spectrogram_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/audio_spectrogram_infer.h" -namespace mindspore { +namespace mindspore::lite { class AudioSpectrogramInferTest : public mindspore::CommonTest { public: @@ -56,4 +56,4 @@ TEST_F(AudioSpectrogramInferTest, AudioSpectrogramInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/batch_to_space_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/batch_to_space_infer_test.cc index 2985f2b706305db53fdd4fc0a63bbaebdc4f650e..16f190d25c675a23632fe7feaad2874b0af3f55e 100644 --- a/mindspore-lite/test/ut/nnacl/infer/batch_to_space_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/batch_to_space_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/batch_to_space_infer.h" -namespace mindspore { +namespace mindspore::lite { class BatchToSpaceInferTest : public mindspore::CommonTest { public: @@ -180,4 +180,4 @@ TEST_F(BatchToSpaceInferTest, BatchToSpaceInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/bias_grad_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/bias_grad_infer_test.cc index 855e0a4e71d15858067d6387f00d6e04ef7a8ecd..c7bc2741d54b57390fb07444af038bd1e8fc1b72 100644 --- a/mindspore-lite/test/ut/nnacl/infer/bias_grad_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/bias_grad_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/bias_grad_infer.h" -namespace mindspore { +namespace mindspore::lite { class BiasGradInferTest : public mindspore::CommonTest { public: @@ -56,4 +56,4 @@ TEST_F(BiasGradInferTest, BiasGradInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/binary_cross_entropy_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/binary_cross_entropy_infer_test.cc index 25c51b064fbf57ecdaa87ab1268018a4f2741abd..3edf7fe4fb0eaafef467ab9a6be16f40a87f8e0f 100644 --- a/mindspore-lite/test/ut/nnacl/infer/binary_cross_entropy_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/binary_cross_entropy_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/binary_cross_entropy_infer.h" -namespace mindspore { +namespace mindspore::lite { class BinaryCrossEntropyInferTest : public mindspore::CommonTest { public: @@ -82,4 +82,4 @@ TEST_F(BinaryCrossEntropyInferTest, BinaryCrossEntropyInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/bn_grad_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/bn_grad_infer_test.cc index 9ea08ec6a3f22d6c1be0293863f9f5b80cff6ae3..b55ec85ad858dbf030fab6684ec0204e3408fc15 100644 --- a/mindspore-lite/test/ut/nnacl/infer/bn_grad_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/bn_grad_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/bn_grad_infer.h" -namespace mindspore { +namespace mindspore::lite { class BnGradInferTest : public mindspore::CommonTest { public: @@ -79,4 +79,4 @@ TEST_F(BnGradInferTest, BnGradInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/broadcast_to_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/broadcast_to_infer_test.cc index 34f44a0434834d3764ec803e6d8dfd0f2efa249d..b470128e94d9242096db5fa3cf82f190efb0245d 100644 --- a/mindspore-lite/test/ut/nnacl/infer/broadcast_to_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/broadcast_to_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/broadcast_to_infer.h" -namespace mindspore { +namespace mindspore::lite { class BroadcastToInferTest : public mindspore::CommonTest { public: @@ -145,4 +145,4 @@ TEST_F(BroadcastToInferTest, BroadcastToInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/cast_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/cast_infer_test.cc index 18b54fce7a0f0787ddd0fba3c295e7249d7cba0c..cf28805fdf2e8a08f995b9b4f88b80fa8767b99c 100644 --- a/mindspore-lite/test/ut/nnacl/infer/cast_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/cast_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/cast_infer.h" -namespace mindspore { +namespace mindspore::lite { class CastInferTest : public mindspore::CommonTest { public: @@ -269,4 +269,4 @@ TEST_F(CastInferTest, CastInferTest5) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/concat_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/concat_infer_test.cc index a3b15dd2533ca5346d99cee5e5afc3601ce29117..ed74273f97ec3e2eaae6ae6c0280167c15bfc6d5 100644 --- a/mindspore-lite/test/ut/nnacl/infer/concat_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/concat_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/concat_infer.h" -namespace mindspore { +namespace mindspore::lite { class ConcatInferTest : public mindspore::CommonTest { public: @@ -236,4 +236,4 @@ TEST_F(ConcatInferTest, ConcatInferTest5) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/constant_of_shape_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/constant_of_shape_infer_test.cc index 7f4cbd53f8ecff7bbfc8abb13e0149a3cc4b5574..2442e110843c940d158f2456d5c8bf89f7877454 100644 --- a/mindspore-lite/test/ut/nnacl/infer/constant_of_shape_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/constant_of_shape_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/constant_of_shape_infer.h" -namespace mindspore { +namespace mindspore::lite { class ConstantOfShapeInferTest : public mindspore::CommonTest { public: @@ -59,4 +59,4 @@ TEST_F(ConstantOfShapeInferTest, ConstantOfShapeInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/conv2d_grad_filter_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/conv2d_grad_filter_infer_test.cc index 1d22281e4ccf2bcc2a82fbd8b542a90148d7829c..6f38f259ca2d6c731b0fda24c32ead2f5c303090 100644 --- a/mindspore-lite/test/ut/nnacl/infer/conv2d_grad_filter_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/conv2d_grad_filter_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/conv2d_grad_filter_infer.h" -namespace mindspore { +namespace mindspore::lite { class Conv2dGradFilterInferTest : public mindspore::CommonTest { public: @@ -58,4 +58,4 @@ TEST_F(Conv2dGradFilterInferTest, Conv2dGradFilterInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/conv2d_grad_input_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/conv2d_grad_input_infer_test.cc index cce2634dc8bd242335ce846975be257ec15bde30..c0d15ec89f024de818e7198881027f0bf75361eb 100644 --- a/mindspore-lite/test/ut/nnacl/infer/conv2d_grad_input_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/conv2d_grad_input_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/conv2d_grad_input_infer.h" -namespace mindspore { +namespace mindspore::lite { class Conv2dGradInputInferTest : public mindspore::CommonTest { public: @@ -58,4 +58,4 @@ TEST_F(Conv2dGradInputInferTest, Conv2dGradInputInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/conv2d_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/conv2d_infer_test.cc index 3f88a643e8111c69adb0089182a5e2020707358d..e97b8d365f1aef4765d207f39bc4c5f5210cbd13 100644 --- a/mindspore-lite/test/ut/nnacl/infer/conv2d_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/conv2d_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/conv2d_infer.h" -namespace mindspore { +namespace mindspore::lite { class Conv2dInferTest : public mindspore::CommonTest { public: @@ -526,4 +526,4 @@ TEST_F(Conv2dInferTest, Conv2dInferTest10) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/crop_and_resize_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/crop_and_resize_infer_test.cc index 5bee340299dc1c43df41420cdf3ad72a8805e8b9..9b9b893d35e80ea6bed263ea32c55bf98ca3e4e9 100644 --- a/mindspore-lite/test/ut/nnacl/infer/crop_and_resize_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/crop_and_resize_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/crop_and_resize_infer.h" -namespace mindspore { +namespace mindspore::lite { class CropAndResizeInferTest : public mindspore::CommonTest { public: @@ -121,4 +121,4 @@ TEST_F(CropAndResizeInferTest, CropAndResizeInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/crop_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/crop_infer_test.cc index 434d97a1a83bb2e36a9fa45d6d27226c73e197f5..29ae851b728df78757d0c82702594531bf233999 100644 --- a/mindspore-lite/test/ut/nnacl/infer/crop_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/crop_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/crop_infer.h" -namespace mindspore { +namespace mindspore::lite { class CropInferTest : public mindspore::CommonTest { public: @@ -335,4 +335,4 @@ TEST_F(CropInferTest, CropInferTest5) { } } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/cumsum_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/cumsum_infer_test.cc index 5a09a79614825c396f18dd1837cd21925faa589c..04aaf3fce1456afa9062c3b1adc3b58b6b6cb76e 100644 --- a/mindspore-lite/test/ut/nnacl/infer/cumsum_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/cumsum_infer_test.cc @@ -17,7 +17,7 @@ #include "nnacl_c/infer/cumsum_infer.h" #include "nnacl_c/cumsum_parameter.h" -namespace mindspore { +namespace mindspore::lite { class CumSumInferTest : public mindspore::CommonTest { public: @@ -59,4 +59,4 @@ TEST_F(CumSumInferTest, Test0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/custom_extract_features_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/custom_extract_features_infer_test.cc index c38148aa825dece11450e08cd6f852737f8f0600..ef4144178b7930ca669277aa0565f8c05fa70d29 100644 --- a/mindspore-lite/test/ut/nnacl/infer/custom_extract_features_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/custom_extract_features_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/string/custom_extract_features_infer.h" -namespace mindspore { +namespace mindspore::lite { class CustomExtractFeaturesInferTest : public mindspore::CommonTest { public: @@ -91,4 +91,4 @@ TEST_F(CustomExtractFeaturesInferTest, CustomExtractFeaturesInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/custom_normalize_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/custom_normalize_infer_test.cc index 081aa543df68b3edd7dd9e66dcf488c66aa32379..f13585e98ea5e6b262e04cec7b3a3206d94aa521 100644 --- a/mindspore-lite/test/ut/nnacl/infer/custom_normalize_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/custom_normalize_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/string/custom_normalize_infer.h" -namespace mindspore { +namespace mindspore::lite { class CustomNormalizeInferTest : public mindspore::CommonTest { public: @@ -81,4 +81,4 @@ TEST_F(CustomNormalizeInferTest, CustomNormalizeInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/custom_predict_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/custom_predict_infer_test.cc index 415c5c88644f3723ee9ffe71371115c348331b63..76ca2b72c1a7fc165225ed572d7fbacab362736b 100644 --- a/mindspore-lite/test/ut/nnacl/infer/custom_predict_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/custom_predict_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/string/custom_predict_infer.h" -namespace mindspore { +namespace mindspore::lite { class CustomPredictInferTest : public mindspore::CommonTest { public: @@ -54,4 +54,4 @@ TEST_F(CustomPredictInferTest, CustomPredictInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/deconv2d_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/deconv2d_infer_test.cc index 3e1f9579601568b5dc5b9cbe8d3d766d14bc8077..95d246e222f4ad6f729d1c05001bc8510b0044ef 100644 --- a/mindspore-lite/test/ut/nnacl/infer/deconv2d_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/deconv2d_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/deconv2d_infer.h" -namespace mindspore { +namespace mindspore::lite { class Deconv2dInferTest : public mindspore::CommonTest { public: @@ -166,4 +166,4 @@ TEST_F(Deconv2dInferTest, Deconv2dInferTest2) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/depth_to_space_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/depth_to_space_infer_test.cc index 2508e21248278b73cacabf2d411814fc047629b6..81f87a561fb5f43d3885f359e835375b7551a7a0 100644 --- a/mindspore-lite/test/ut/nnacl/infer/depth_to_space_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/depth_to_space_infer_test.cc @@ -17,7 +17,7 @@ #include "nnacl_c/infer/depth_to_space_infer.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class DepthToSpaceInferTest : public mindspore::CommonTest { public: @@ -172,4 +172,4 @@ TEST_F(DepthToSpaceInferTest, DepthToSpaceInferTest4) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/depthwise_conv2d_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/depthwise_conv2d_infer_test.cc index cf96e455d0f6e28d413596c35d5f9cbb8e525f7e..837cc42c3b15a544089bf0e7d9bad2ea5803c840 100644 --- a/mindspore-lite/test/ut/nnacl/infer/depthwise_conv2d_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/depthwise_conv2d_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/depthwise_conv2d_infer.h" -namespace mindspore { +namespace mindspore::lite { class DepthwiseConv2dInferTest : public mindspore::CommonTest { public: @@ -537,4 +537,4 @@ TEST_F(DepthwiseConv2dInferTest, DepthwiseConv2dInferTest10) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/detection_post_process_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/detection_post_process_infer_test.cc index 0321ff0c489f60e6368de526d2f0abfd0649ed44..a8caf400eb194db9ca42aa3ca88e4f38523cdda4 100644 --- a/mindspore-lite/test/ut/nnacl/infer/detection_post_process_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/detection_post_process_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/detection_post_process_infer.h" -namespace mindspore { +namespace mindspore::lite { class DetectionPostProcessInferTest : public mindspore::CommonTest { public: @@ -79,4 +79,4 @@ TEST_F(DetectionPostProcessInferTest, DetectionPostProcessInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/dropout_grad_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/dropout_grad_infer_test.cc index 9731d71e18602520090ee89f90b9fc8e65521fca..cee5e97945eba854014ed843e36395cf6d135326 100644 --- a/mindspore-lite/test/ut/nnacl/infer/dropout_grad_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/dropout_grad_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/dropout_grad_infer.h" -namespace mindspore { +namespace mindspore::lite { class DropoutGradInferTest : public mindspore::CommonTest { public: @@ -53,4 +53,4 @@ TEST_F(DropoutGradInferTest, DropoutGradInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/embedding_lookup_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/embedding_lookup_infer_test.cc index 995b129fc6af7ea4d7e7cbeae4a22a3c8b9b458c..533feca3030384d11fbb027576f6fca71a300ffa 100644 --- a/mindspore-lite/test/ut/nnacl/infer/embedding_lookup_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/embedding_lookup_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/embedding_lookup_infer.h" -namespace mindspore { +namespace mindspore::lite { class EmbeddingLookupInferTest : public mindspore::CommonTest { public: @@ -64,4 +64,4 @@ TEST_F(EmbeddingLookupInferTest, EmbeddingLookupInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/expand_dims_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/expand_dims_infer_test.cc index 039ae90ae98162dcd4d4dd56f15466fac5f12bac..d2aeef785da8ab02b41cf5021a87045a9d7e7884 100644 --- a/mindspore-lite/test/ut/nnacl/infer/expand_dims_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/expand_dims_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/expand_dims_infer.h" -namespace mindspore { +namespace mindspore::lite { class ExpandDimsInferTest : public mindspore::CommonTest { public: @@ -120,4 +120,4 @@ TEST_F(ExpandDimsInferTest, ExpandDimsInferTest2) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/fft_imag_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/fft_imag_infer_test.cc index 36390924a425368025504807ce34e87acf986a6b..fa602da1c24435d15db12a4de361fac19c18e228 100644 --- a/mindspore-lite/test/ut/nnacl/infer/fft_imag_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/fft_imag_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/fft_imag_infer.h" -namespace mindspore { +namespace mindspore::lite { class FftImagInferTest : public mindspore::CommonTest { public: @@ -55,4 +55,4 @@ TEST_F(FftImagInferTest, FftImagInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/fill_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/fill_infer_test.cc index 451462af3a1591d7ddd63ad6c0c04471caa6cfa9..443ef8d4db87c6cc5c1178953d7283b2087b6073 100644 --- a/mindspore-lite/test/ut/nnacl/infer/fill_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/fill_infer_test.cc @@ -17,7 +17,7 @@ #include "nnacl_c/infer/fill_infer.h" #include "nnacl_c/fill_parameter.h" -namespace mindspore { +namespace mindspore::lite { class FillInferTest : public mindspore::CommonTest { public: @@ -119,4 +119,4 @@ TEST_F(FillInferTest, FillInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/flatten_grad_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/flatten_grad_infer_test.cc index acad0586afc073fd2fb7b2d54af89c1b8c303a00..1a51ed41dc67ca3914e982d957b24bce2656c0b2 100644 --- a/mindspore-lite/test/ut/nnacl/infer/flatten_grad_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/flatten_grad_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/flatten_grad_infer.h" -namespace mindspore { +namespace mindspore::lite { class FlattenGradInferTest : public mindspore::CommonTest { public: @@ -55,4 +55,4 @@ TEST_F(FlattenGradInferTest, FlattenGradInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/flatten_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/flatten_infer_test.cc index 24029984237a58685a1481b74e9f7b07bc119ae0..64910307747225816b87c129e0199f3074166a64 100644 --- a/mindspore-lite/test/ut/nnacl/infer/flatten_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/flatten_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/flatten_infer.h" -namespace mindspore { +namespace mindspore::lite { class FlattenInferTest : public mindspore::CommonTest { public: @@ -121,4 +121,4 @@ TEST_F(FlattenInferTest, FlattenInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/full_connection_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/full_connection_infer_test.cc index 33f147462b9224544e2d7dfd33faf16765353f5a..3bd28f708da4e37992253f0af3dbe58a363f667d 100644 --- a/mindspore-lite/test/ut/nnacl/infer/full_connection_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/full_connection_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/full_connection_infer.h" -namespace mindspore { +namespace mindspore::lite { class FullConnectionInferTest : public mindspore::CommonTest { public: @@ -119,4 +119,4 @@ TEST_F(FullConnectionInferTest, FullConnectionInferTest2) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/fused_batchnorm_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/fused_batchnorm_infer_test.cc index b5bdd02790332d26a6c39f8b5080039384680792..e70dccae20aa918b4cfd6eec413e3c9e973965e6 100644 --- a/mindspore-lite/test/ut/nnacl/infer/fused_batchnorm_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/fused_batchnorm_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/fused_batchnorm_infer.h" -namespace mindspore { +namespace mindspore::lite { class FusedBatchNormInferTest : public mindspore::CommonTest { public: @@ -60,4 +60,4 @@ TEST_F(FusedBatchNormInferTest, FusedBatchNormInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/gather_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/gather_infer_test.cc index 5d35f7a86fa0b332a26d5d0d615e96e3c8493d1a..3a3fb8f2d2386171760195a806fd1578f2c50c52 100644 --- a/mindspore-lite/test/ut/nnacl/infer/gather_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/gather_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/gather_infer.h" -namespace mindspore { +namespace mindspore::lite { class GatherInferTest : public mindspore::CommonTest { public: @@ -186,4 +186,4 @@ TEST_F(GatherInferTest, GatherInferTest4) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/gather_nd_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/gather_nd_infer_test.cc index 5c203271acff3e4b2a8dcc35e7c2c150ec57dc7d..ccf070f0cfb44d5766a5a1e6e65499884fa41845 100644 --- a/mindspore-lite/test/ut/nnacl/infer/gather_nd_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/gather_nd_infer_test.cc @@ -17,7 +17,7 @@ #include "nnacl_c/infer/gather_nd_infer.h" #include "nnacl_c/gather_nd_parameter.h" -namespace mindspore { +namespace mindspore::lite { class GatherNdInferTest : public mindspore::CommonTest { public: @@ -180,4 +180,4 @@ TEST_F(GatherNdInferTest, GatherNdInferTest4) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/group_conv2d_grad_input_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/group_conv2d_grad_input_infer_test.cc index d2b9b3a76b087dba0a785c76931020413a989a06..9bba9c099bca75c6b1b7bbaf0825a64fdc77d453 100644 --- a/mindspore-lite/test/ut/nnacl/infer/group_conv2d_grad_input_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/group_conv2d_grad_input_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/group_conv2d_grad_input_infer.h" -namespace mindspore { +namespace mindspore::lite { class GroupConv2dGradInputInferTest : public mindspore::CommonTest { public: @@ -53,4 +53,4 @@ TEST_F(GroupConv2dGradInputInferTest, GroupConv2dGradInputInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/gru_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/gru_infer_test.cc index dde9f8a7b51156ffeeb57d87c60c70cae9193daa..bf395ce374cc4babb7d539c11803d66093ab33c4 100644 --- a/mindspore-lite/test/ut/nnacl/infer/gru_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/gru_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/gru_infer.h" -namespace mindspore { +namespace mindspore::lite { class GruInferTest : public mindspore::CommonTest { public: @@ -129,4 +129,4 @@ TEST_F(GruInferTest, GruInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/hashtable_lookup_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/hashtable_lookup_infer_test.cc index 37eb81144a2c90aa839636b1f63968cbc7a9707b..f851eb402d8d1c9734e5b3994a90343750deb88c 100644 --- a/mindspore-lite/test/ut/nnacl/infer/hashtable_lookup_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/hashtable_lookup_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/string/hashtable_lookup_infer.h" -namespace mindspore { +namespace mindspore::lite { class HashtableLookupInferTest : public mindspore::CommonTest { public: @@ -58,4 +58,4 @@ TEST_F(HashtableLookupInferTest, HashtableLookupInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/invert_permutation_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/invert_permutation_infer_test.cc index 07467648b33d69ff3c9dcb651eb6c3c804c562f7..9b0e8d5d0ba108780b0cc5c1b1cba7f176661014 100644 --- a/mindspore-lite/test/ut/nnacl/infer/invert_permutation_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/invert_permutation_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/invert_permutation_infer.h" -namespace mindspore { +namespace mindspore::lite { class InvertPermutationInferTest : public mindspore::CommonTest { public: @@ -50,4 +50,4 @@ TEST_F(InvertPermutationInferTest, InvertPermutationInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/layer_norm_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/layer_norm_infer_test.cc index 6849818793fb91640e95f78cc4df5a3e2d2f3921..8743fedd838117b3623feba2adffd8cadbdf4980 100644 --- a/mindspore-lite/test/ut/nnacl/infer/layer_norm_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/layer_norm_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/layer_norm_infer.h" -namespace mindspore { +namespace mindspore::lite { class LayerNormInferTest : public mindspore::CommonTest { public: @@ -95,4 +95,4 @@ TEST_F(LayerNormInferTest, LayerNormInferTest2) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/lsh_projection_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/lsh_projection_infer_test.cc index 72a19e046e2f17177d046aac9e573d33730ea88f..991ee3c44384519699ea11add3639a25e350da5f 100644 --- a/mindspore-lite/test/ut/nnacl/infer/lsh_projection_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/lsh_projection_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/string/lsh_projection_infer.h" -namespace mindspore { +namespace mindspore::lite { class LshProjectionInferTest : public mindspore::CommonTest { public: @@ -120,4 +120,4 @@ TEST_F(LshProjectionInferTest, LshProjectionInferTest2) { } } // note: may be error -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/lstm_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/lstm_infer_test.cc index 5c3434ebf3f9d3df270533e7e06e1ac5a2cb8046..35bca32731c6d39baced8f0d99ad3a56c3d55567 100644 --- a/mindspore-lite/test/ut/nnacl/infer/lstm_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/lstm_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/lstm_infer.h" -namespace mindspore { +namespace mindspore::lite { class LstmInferTest : public mindspore::CommonTest { public: @@ -75,4 +75,4 @@ TEST_F(LstmInferTest, LstmInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/matmul_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/matmul_infer_test.cc index e5e966dc10a98b3f0c69d41e5b40340ae4f17ed9..503fd8d1f9fb87b007cb34dcd67b930272191f2a 100644 --- a/mindspore-lite/test/ut/nnacl/infer/matmul_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/matmul_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/matmul_infer.h" -namespace mindspore { +namespace mindspore::lite { class MatmulInferTest : public mindspore::CommonTest { public: @@ -154,4 +154,4 @@ TEST_F(MatmulInferTest, MatmulInferTest3) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/max_min_grad_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/max_min_grad_infer_test.cc index 740a727878a7665d72de59d082699f99c93e62f8..0af093281edc5fce22c6b69687ea7842ccf08a74 100644 --- a/mindspore-lite/test/ut/nnacl/infer/max_min_grad_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/max_min_grad_infer_test.cc @@ -17,7 +17,7 @@ #include "nnacl_c/infer/max_min_grad_infer.h" #include "nnacl_c/arithmetic_parameter.h" -namespace mindspore { +namespace mindspore::lite { class MaxMinGradInferTest : public mindspore::CommonTest { public: @@ -81,4 +81,4 @@ TEST_F(MaxMinGradInferTest, MaxMinGradInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/mfcc_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/mfcc_infer_test.cc index 7efce63be785ec1729f6a0c82f64d07131560b01..4ae44c39b48473c274a0f6d02548163a12b889f0 100644 --- a/mindspore-lite/test/ut/nnacl/infer/mfcc_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/mfcc_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/mfcc_infer.h" -namespace mindspore { +namespace mindspore::lite { class MfccInferTest : public mindspore::CommonTest { public: @@ -58,4 +58,4 @@ TEST_F(MfccInferTest, MfccInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/nllloss_grad_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/nllloss_grad_infer_test.cc index 0c0480b8ef581cb89854dded1b336317719445fa..6ff038198b38d5aa82ff53a7dd33d3d5c0089e67 100644 --- a/mindspore-lite/test/ut/nnacl/infer/nllloss_grad_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/nllloss_grad_infer_test.cc @@ -17,7 +17,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/nllloss_grad_infer.h" -namespace mindspore { +namespace mindspore::lite { class TestNLLLossGradInfer : public mindspore::CommonTest { public: TestNLLLossGradInfer() {} @@ -107,4 +107,4 @@ TEST_F(TestNLLLossGradInfer, ReductionMean) { CheckResults(ret, param, outputs); NLLLossGradInferReleaseResources(param, inputs, outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/nllloss_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/nllloss_infer_test.cc index 416d2299dede04be6a33026601bfa8ae6ee1f84e..2023ed4870acac65b45de93c34aacad84a759e6f 100644 --- a/mindspore-lite/test/ut/nnacl/infer/nllloss_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/nllloss_infer_test.cc @@ -17,7 +17,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/nllloss_infer.h" -namespace mindspore { +namespace mindspore::lite { class TestNLLLossInfer : public mindspore::CommonTest { public: TestNLLLossInfer() {} @@ -95,4 +95,4 @@ TEST_F(TestNLLLossInfer, ReductionMean) { ASSERT_EQ(outputs[1]->shape_size_, 0); NLLLossInferReleaseResources(param, inputs, outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/one_hot_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/one_hot_infer_test.cc index 0752eafd6e64743338a62f2ad2c0da0cf417cc84..3d38918119a910af4aa271eb2d83e0c6b8505222 100644 --- a/mindspore-lite/test/ut/nnacl/infer/one_hot_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/one_hot_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/one_hot_infer.h" -namespace mindspore { +namespace mindspore::lite { class OneHotInferTest : public mindspore::CommonTest { public: @@ -57,4 +57,4 @@ TEST_F(OneHotInferTest, OneHotInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/pad_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/pad_infer_test.cc index b66b40a55e1e736acaeef00fdfeaaf5f71e6fb19..e130498921162f76066e84350fbbc2c168e34924 100644 --- a/mindspore-lite/test/ut/nnacl/infer/pad_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/pad_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/pad_infer.h" -namespace mindspore { +namespace mindspore::lite { class PadInferTest : public mindspore::CommonTest { public: @@ -185,4 +185,4 @@ TEST_F(PadInferTest, PadInferTest4) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/pooling_grad_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/pooling_grad_infer_test.cc index bb776ea3046b4b28754b0bf8b71041d5b0c6578b..c7817bc7ad47d3666ea62c41ce0f49143ecc7cf8 100644 --- a/mindspore-lite/test/ut/nnacl/infer/pooling_grad_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/pooling_grad_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/pooling_grad_infer.h" -namespace mindspore { +namespace mindspore::lite { class PoolingGradInferTest : public mindspore::CommonTest { public: @@ -65,4 +65,4 @@ TEST_F(PoolingGradInferTest, PoolingGradInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/pooling_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/pooling_infer_test.cc index 9f4d72d58d732f04d08611c00a3a07006b75f01b..481b9e7b38b6ae038dabe82f549620f499fc310d 100644 --- a/mindspore-lite/test/ut/nnacl/infer/pooling_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/pooling_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/pooling_infer.h" -namespace mindspore { +namespace mindspore::lite { class PoolingInferTest : public mindspore::CommonTest { public: @@ -267,4 +267,4 @@ TEST_F(PoolingInferTest, PoolingInferTest5) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/power_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/power_infer_test.cc index 0047b71d0f0d0af0ececa3c0a80296a9d56b756e..0fb07a1d303996152833a33972147b6b8e24b444 100644 --- a/mindspore-lite/test/ut/nnacl/infer/power_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/power_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/power_infer.h" -namespace mindspore { +namespace mindspore::lite { class PowerInferTest : public mindspore::CommonTest { public: @@ -109,4 +109,4 @@ TEST_F(PowerInferTest, PowerInferTest2) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/quant_dtype_cast_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/quant_dtype_cast_infer_test.cc index 7c99fb158538c84d58d2e0e0e3422f1163a196bc..e7f356417c1b33a000eb3cdada9c2d66450ea10d 100644 --- a/mindspore-lite/test/ut/nnacl/infer/quant_dtype_cast_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/quant_dtype_cast_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/quant_dtype_cast_infer.h" -namespace mindspore { +namespace mindspore::lite { class QuantDtypeCastInferTest : public mindspore::CommonTest { public: @@ -52,4 +52,4 @@ TEST_F(QuantDtypeCastInferTest, QuantDtypeCastInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/random_standard_normal_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/random_standard_normal_infer_test.cc index c1c6e56ec247f7fd63cb1c2e7f740d4e38973b2f..d05328b051cbdcca806ba5a5cb144fd5e21ebdaa 100644 --- a/mindspore-lite/test/ut/nnacl/infer/random_standard_normal_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/random_standard_normal_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/random_standard_normal_infer.h" -namespace mindspore { +namespace mindspore::lite { class RandomStandardNormalInferTest : public mindspore::CommonTest { public: @@ -55,4 +55,4 @@ TEST_F(RandomStandardNormalInferTest, RandomStandardNormalInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/range_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/range_infer_test.cc index 8f40763d160de830782800989f36f8c6325f5432..4d24aab4f76906314125cc35a2b7e0eb09c11b66 100644 --- a/mindspore-lite/test/ut/nnacl/infer/range_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/range_infer_test.cc @@ -17,7 +17,7 @@ #include "nnacl_c/infer/range_infer.h" #include "nnacl_c/range_parameter.h" -namespace mindspore { +namespace mindspore::lite { class RangeInferTest : public mindspore::CommonTest { public: @@ -134,4 +134,4 @@ TEST_F(RangeInferTest, RangeInferTest2) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/rank_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/rank_infer_test.cc index c2c99e47d9bf4203081c41bc1488079422a8cf38..0fac0d86b2b82492101a74d2be5f7ef404847fce 100644 --- a/mindspore-lite/test/ut/nnacl/infer/rank_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/rank_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/rank_infer.h" -namespace mindspore { +namespace mindspore::lite { class RankInferTest : public mindspore::CommonTest { public: @@ -49,4 +49,4 @@ TEST_F(RankInferTest, RankInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/reduce_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/reduce_infer_test.cc index a5bf6ed76d3a96fd29345ae7e04117fc957a1607..ec67d9d8af2ffaee965206fee99ab478974eb74b 100644 --- a/mindspore-lite/test/ut/nnacl/infer/reduce_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/reduce_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/reduce_infer.h" -namespace mindspore { +namespace mindspore::lite { class ReduceInferTest : public mindspore::CommonTest { public: @@ -189,4 +189,4 @@ TEST_F(ReduceInferTest, ReduceInferTest4) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/reshape_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/reshape_infer_test.cc index 47b4be80992d6fb067cce548c28946898630c192..6d8cf813328866ccbbed1f1f36902cbfe6a1c866 100644 --- a/mindspore-lite/test/ut/nnacl/infer/reshape_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/reshape_infer_test.cc @@ -17,7 +17,7 @@ #include "nnacl_c/infer/reshape_infer.h" #include "nnacl_c/reshape_parameter.h" -namespace mindspore { +namespace mindspore::lite { class ReshapeInferTest : public mindspore::CommonTest { public: @@ -330,4 +330,4 @@ TEST_F(ReshapeInferTest, ReshapeInferTest9) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/resize_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/resize_infer_test.cc index 4aaf0a75c7a779db8fe86cbe6d17e4cac861c55b..9f8260e9ecb9efa81326d00726d856e5d9622b92 100644 --- a/mindspore-lite/test/ut/nnacl/infer/resize_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/resize_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/resize_infer.h" -namespace mindspore { +namespace mindspore::lite { class ResizeInferTest : public mindspore::CommonTest { public: @@ -166,4 +166,4 @@ TEST_F(ResizeInferTest, ResizeInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/rfft_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/rfft_infer_test.cc index ce630250a77e9772c66fbd133206db02c758e3d6..e86097fd34ae935c290dbc53b9f448752da6bf58 100644 --- a/mindspore-lite/test/ut/nnacl/infer/rfft_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/rfft_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/rfft_infer.h" -namespace mindspore { +namespace mindspore::lite { class RfftInferTest : public mindspore::CommonTest { public: @@ -51,4 +51,4 @@ TEST_F(RfftInferTest, RfftInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/roi_pooling_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/roi_pooling_infer_test.cc index ee8cc2a7caf42f75928210cb08e3a68141c9f118..01bcd26a462fa31428d26d016c09f7e27cf3c5b1 100644 --- a/mindspore-lite/test/ut/nnacl/infer/roi_pooling_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/roi_pooling_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/roi_pooling_infer.h" -namespace mindspore { +namespace mindspore::lite { class ROIPoolingInferTest : public mindspore::CommonTest { public: @@ -58,4 +58,4 @@ TEST_F(ROIPoolingInferTest, ROIPoolingInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/scatter_nd_add_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/scatter_nd_add_infer_test.cc index 5d3813c8f5db33e809a88feb7876feed7bdb6d40..cd3ee3a8a1d35a18e816332f194c549caa6264d4 100644 --- a/mindspore-lite/test/ut/nnacl/infer/scatter_nd_add_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/scatter_nd_add_infer_test.cc @@ -18,7 +18,7 @@ #include "nnacl_c/scatter_nd_parameter.h" #include "nnacl_c/infer/scatter_nd_update_infer.h" -namespace mindspore { +namespace mindspore::lite { class TestScatterNdAddInfer : public mindspore::CommonTest { public: TestScatterNdAddInfer() {} @@ -77,4 +77,4 @@ TEST_F(TestScatterNdAddInfer, FourDims) { ASSERT_EQ(outputs[0]->shape_[3], 6); ScatterNdAddInferReleaseResources(param, inputs, outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/scatter_nd_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/scatter_nd_infer_test.cc index 3600d37ddb2746d74226bc6ead5943aa9686a4a0..af42a537e286a56ed1305ea9008709bdf164c364 100644 --- a/mindspore-lite/test/ut/nnacl/infer/scatter_nd_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/scatter_nd_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/scatter_nd_infer.h" -namespace mindspore { +namespace mindspore::lite { class ScatterNdInferTest : public mindspore::CommonTest { public: @@ -57,4 +57,4 @@ TEST_F(ScatterNdInferTest, ScatterNdInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/select_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/select_infer_test.cc index 67f74a02d096e5eee3c8a6036f7d54e236282d87..3507fc5588fba920756e2007cc820a7c8f58238f 100644 --- a/mindspore-lite/test/ut/nnacl/infer/select_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/select_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/select_infer.h" -namespace mindspore { +namespace mindspore::lite { class SelectInferTest : public mindspore::CommonTest { public: @@ -234,4 +234,4 @@ TEST_F(SelectInferTest, SelectInferTest3) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/sgd_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/sgd_infer_test.cc index 340bc8bfa7c1493c3030dbba895b73dbf0fd2f71..810c21d288630e9fe89982c0e8f29b4e3b071748 100644 --- a/mindspore-lite/test/ut/nnacl/infer/sgd_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/sgd_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/sgd_infer.h" -namespace mindspore { +namespace mindspore::lite { class SgdInferTest : public mindspore::CommonTest { public: @@ -62,4 +62,4 @@ TEST_F(SgdInferTest, SgdInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/shape_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/shape_infer_test.cc index 920f589daa967c307d5360cf4e6bdb9d61e8f85e..106d2cb75c2d110c706f4e98b585f28c98e9ff66 100644 --- a/mindspore-lite/test/ut/nnacl/infer/shape_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/shape_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/shape_infer.h" -namespace mindspore { +namespace mindspore::lite { class ShapeInferTest : public mindspore::CommonTest { public: @@ -47,4 +47,4 @@ TEST_F(ShapeInferTest, ShapeInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/size_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/size_infer_test.cc index 2325f9f8c7b0f5c2287fa17dfd71f4860881e8ec..1b23209d045f04a3304ccc5bd0eb57bd94323c54 100644 --- a/mindspore-lite/test/ut/nnacl/infer/size_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/size_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/size_infer.h" -namespace mindspore { +namespace mindspore::lite { class SizeInferTest : public mindspore::CommonTest { public: @@ -51,4 +51,4 @@ TEST_F(SizeInferTest, SizeInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/skip_gram_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/skip_gram_infer_test.cc index 9669e06043e0e54e3d2550d22f6a5e7a0b781832..503568914bb819a7127676b1ec1b509ed7d5a6fd 100644 --- a/mindspore-lite/test/ut/nnacl/infer/skip_gram_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/skip_gram_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/string/skip_gram_infer.h" -namespace mindspore { +namespace mindspore::lite { class SkipGramInferTest : public mindspore::CommonTest { public: @@ -47,4 +47,4 @@ TEST_F(SkipGramInferTest, SkipGramInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/slice_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/slice_infer_test.cc index 087afc9ccf45cb889b21d1beb843bebd9ec58e45..87816a1d3903387660df1217eed1ba7dff316e63 100644 --- a/mindspore-lite/test/ut/nnacl/infer/slice_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/slice_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/slice_infer.h" -namespace mindspore { +namespace mindspore::lite { class SliceInferTest : public mindspore::CommonTest { public: @@ -202,4 +202,4 @@ TEST_F(SliceInferTest, SliceInferTest3) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/softmax_cross_entropy_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/softmax_cross_entropy_infer_test.cc index b1cb21708446ce643812906e27ca749f59bb44dd..2b37921e3dbe952aa0a6447be8f2dab120c02056 100644 --- a/mindspore-lite/test/ut/nnacl/infer/softmax_cross_entropy_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/softmax_cross_entropy_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/softmax_cross_entropy_infer.h" -namespace mindspore { +namespace mindspore::lite { class SoftmaxCrossEntropyInferTest : public mindspore::CommonTest { public: @@ -58,4 +58,4 @@ TEST_F(SoftmaxCrossEntropyInferTest, SoftmaxCrossEntropyInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/softmax_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/softmax_infer_test.cc index 0b440079e804510b18f0d268dbb27f34e5ad1dce..248742eb2e44785a1c58a1bc637848169d83720c 100644 --- a/mindspore-lite/test/ut/nnacl/infer/softmax_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/softmax_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/softmax_infer.h" -namespace mindspore { +namespace mindspore::lite { class SoftmaxInferTest : public mindspore::CommonTest { public: @@ -52,4 +52,4 @@ TEST_F(SoftmaxInferTest, SoftmaxInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/space_to_batch_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/space_to_batch_infer_test.cc index 4786e258b551d835f93ae6208032e3a238ebfd10..622f341fc8faa48b3bf3f333e8e42d38c20063e2 100644 --- a/mindspore-lite/test/ut/nnacl/infer/space_to_batch_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/space_to_batch_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/space_to_batch_infer.h" -namespace mindspore { +namespace mindspore::lite { class SpaceToBatchInferTest : public mindspore::CommonTest { public: @@ -171,4 +171,4 @@ TEST_F(SpaceToBatchInferTest, SpaceToBatchInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/space_to_batch_nd_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/space_to_batch_nd_infer_test.cc index 0a160e43e8ab165376a3ab6364d47c0605187327..5f84daa2bd85a18f610ff518361a892f60eb0786 100644 --- a/mindspore-lite/test/ut/nnacl/infer/space_to_batch_nd_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/space_to_batch_nd_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/space_to_batch_nd_infer.h" -namespace mindspore { +namespace mindspore::lite { class SpaceToBatchNdInferTest : public mindspore::CommonTest { public: @@ -172,4 +172,4 @@ TEST_F(SpaceToBatchNdInferTest, SpaceToBatchNdInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/space_to_depth_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/space_to_depth_infer_test.cc index ea69414ff0952155e952cbb8e27f5b065fbe864c..669400c31119bacf35e2b08f45b945040323186d 100644 --- a/mindspore-lite/test/ut/nnacl/infer/space_to_depth_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/space_to_depth_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/space_to_depth_infer.h" -namespace mindspore { +namespace mindspore::lite { class SpaceToDepthInferTest : public mindspore::CommonTest { public: @@ -85,4 +85,4 @@ TEST_F(SpaceToDepthInferTest, SpaceToDepthInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/sparse_to_dense_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/sparse_to_dense_infer_test.cc index 76bf4f9012e0eafd12e75756ee1831dcbd02928f..4bbebeee995c421b9b998c920a790b2ebb0ee9c8 100644 --- a/mindspore-lite/test/ut/nnacl/infer/sparse_to_dense_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/sparse_to_dense_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/sparse_to_dense_infer.h" -namespace mindspore { +namespace mindspore::lite { class SparseToDenseInferTest : public mindspore::CommonTest { public: @@ -55,4 +55,4 @@ TEST_F(SparseToDenseInferTest, SparseToDenseInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/split_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/split_infer_test.cc index f755188d85b3574a4a212e200857cc575c699a22..add3a37684bc7951ed3d4dca305dc6246f18987c 100644 --- a/mindspore-lite/test/ut/nnacl/infer/split_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/split_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/split_infer.h" -namespace mindspore { +namespace mindspore::lite { class SplitInferTest : public mindspore::CommonTest { public: @@ -216,4 +216,4 @@ TEST_F(SplitInferTest, SplitInferTest4) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/squeeze_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/squeeze_infer_test.cc index 5b18156324266697ec2f9775e1fe0ed7a80b1626..770ae9e189668171401a0e9b34683621d0a0fb49 100644 --- a/mindspore-lite/test/ut/nnacl/infer/squeeze_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/squeeze_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/squeeze_infer.h" -namespace mindspore { +namespace mindspore::lite { class SqueezeInferTest : public mindspore::CommonTest { public: @@ -144,4 +144,4 @@ TEST_F(SqueezeInferTest, SqueezeInferTest3) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/stack_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/stack_infer_test.cc index 654355384a86aa11f7c0660ef11655b77e7b2e13..393c998c21cbb3e58465a83b57497e35963fbe7b 100644 --- a/mindspore-lite/test/ut/nnacl/infer/stack_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/stack_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/stack_infer.h" -namespace mindspore { +namespace mindspore::lite { class StackInferTest : public mindspore::CommonTest { public: @@ -89,4 +89,4 @@ TEST_F(StackInferTest, StackInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/strided_slice_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/strided_slice_infer_test.cc index 6a4ab89c74237b0ba7712e5576e4a5177c975bbe..6c13f02cdae0fd56e56ae642b91a06253e350871 100644 --- a/mindspore-lite/test/ut/nnacl/infer/strided_slice_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/strided_slice_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/strided_slice_infer.h" -namespace mindspore { +namespace mindspore::lite { class StridedSliceInferTest : public mindspore::CommonTest { public: @@ -304,4 +304,4 @@ TEST_F(StridedSliceInferTest, StridedSliceInferTest6) { delete parameter; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/tensorlist_fromtensor_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/tensorlist_fromtensor_infer_test.cc index eafde94158f7d4828b368234b66215e90959b676..ddfff364d649109f9d3d3d26a8d89aa46353d120 100644 --- a/mindspore-lite/test/ut/nnacl/infer/tensorlist_fromtensor_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/tensorlist_fromtensor_infer_test.cc @@ -17,7 +17,7 @@ #include "src/common/tensor_util.h" #include "nnacl_c/infer/control/tensorlist_fromtensor_infer.h" -namespace mindspore { +namespace mindspore::lite { class TensorlistFromtensorInferTest : public mindspore::CommonTest { public: @@ -69,4 +69,4 @@ TEST_F(TensorlistFromtensorInferTest, TensorlistFromtensorInferTest0) { free(out); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/tensorlist_getitem_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/tensorlist_getitem_infer_test.cc index 2a235823dc47418dd911b6dbcdb645e25e1a7df5..77474e48254be4a7f9d9eacb315916e60b152230 100644 --- a/mindspore-lite/test/ut/nnacl/infer/tensorlist_getitem_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/tensorlist_getitem_infer_test.cc @@ -17,7 +17,7 @@ #include "src/common/tensor_util.h" #include "nnacl_c/infer/control/tensorlist_getitem_infer.h" -namespace mindspore { +namespace mindspore::lite { class TensorlistGetItemInferTest : public mindspore::CommonTest { public: @@ -86,4 +86,4 @@ TEST_F(TensorlistGetItemInferTest, TensorlistGetItemInferTest0) { // retest mergeshape -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/tensorlist_reserve_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/tensorlist_reserve_infer_test.cc index fe8262382c94d067295ef7d63554d2e1aa604cab..62dd6292039181be08c5ac034e41a4c8c24ebbcc 100644 --- a/mindspore-lite/test/ut/nnacl/infer/tensorlist_reserve_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/tensorlist_reserve_infer_test.cc @@ -17,7 +17,7 @@ #include "src/common/tensor_util.h" #include "nnacl_c/infer/control/tensorlist_reserve_infer.h" -namespace mindspore { +namespace mindspore::lite { class TensorlistReserveInferTest : public mindspore::CommonTest { public: @@ -66,4 +66,4 @@ TEST_F(TensorlistReserveInferTest, TensorlistReserveInferTest0) { free(out); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/tensorlist_setitem_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/tensorlist_setitem_infer_test.cc index 80a600d2dc7f3870d0ac52e484577bd145854ad6..63dc785de6db7c76b87bed462672a790fe99a814 100644 --- a/mindspore-lite/test/ut/nnacl/infer/tensorlist_setitem_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/tensorlist_setitem_infer_test.cc @@ -17,7 +17,7 @@ #include "src/common/tensor_util.h" #include "nnacl_c/infer/control/tensorlist_setitem_infer.h" -namespace mindspore { +namespace mindspore::lite { class TensorlistSetItemInferTest : public mindspore::CommonTest { public: @@ -108,4 +108,4 @@ TEST_F(TensorlistSetItemInferTest, TensorlistSetItemInferTest0) { // retest mergeshape -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/tensorlist_stack_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/tensorlist_stack_infer_test.cc index 8095670e70f7be58bd336c3ce343d236d847d244..9fe138935f4fde7303a3c18509aa8a1614463425 100644 --- a/mindspore-lite/test/ut/nnacl/infer/tensorlist_stack_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/tensorlist_stack_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/control/tensorlist_stack_infer.h" -namespace mindspore { +namespace mindspore::lite { class TensorlistStackInferTest : public mindspore::CommonTest { public: @@ -86,4 +86,4 @@ TEST_F(TensorlistStackInferTest, TensorlistStackInferTest0) { // retest mergeshape -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/tile_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/tile_infer_test.cc index 316c9f3fffc6a3ff49c14b7345dc7a0e9cbaeb26..49c1c01aad6db5b295803f2172b26d0e0d40edf8 100644 --- a/mindspore-lite/test/ut/nnacl/infer/tile_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/tile_infer_test.cc @@ -18,7 +18,7 @@ #include "nnacl_c/base/tile_base.h" #include "nnacl_c/tile_parameter.h" -namespace mindspore { +namespace mindspore::lite { class TileInferTest : public mindspore::CommonTest { public: @@ -98,4 +98,4 @@ TEST_F(TileInferTest, TileInferTest1) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/topk_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/topk_infer_test.cc index 55e98524a89e12707a92955b64c6dcf253fdcd0e..452974240ee63fcf7a73b82572035fbb706304af 100644 --- a/mindspore-lite/test/ut/nnacl/infer/topk_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/topk_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/topk_infer.h" -namespace mindspore { +namespace mindspore::lite { class TopKInferTest : public mindspore::CommonTest { public: @@ -95,4 +95,4 @@ TEST_F(TopKInferTest, TopKInferInputsSize2) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/transpose_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/transpose_infer_test.cc index 4096d1cd50e7c093483da576468ab8a02eefd2b1..932a8617989f3d10a5d4b11647c945161c87e559 100644 --- a/mindspore-lite/test/ut/nnacl/infer/transpose_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/transpose_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/transpose_infer.h" -namespace mindspore { +namespace mindspore::lite { class TransposeInferTest : public mindspore::CommonTest { public: @@ -57,4 +57,4 @@ TEST_F(TransposeInferTest, TransposeInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/unique_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/unique_infer_test.cc index 534921c91eff093c341d1e6f826b4d77ad1c39ec..9a73d3ab39e381c5f2c3df5aa1a9b5193e71e0e7 100644 --- a/mindspore-lite/test/ut/nnacl/infer/unique_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/unique_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/unique_infer.h" -namespace mindspore { +namespace mindspore::lite { class UniqueInferTest : public mindspore::CommonTest { public: @@ -52,4 +52,4 @@ TEST_F(UniqueInferTest, UniqueInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/unsorted_segment_sum_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/unsorted_segment_sum_infer_test.cc index 4f14be0f6e7476a983ab30df97db7ad1c26f76f2..9020441a6329a3bf749f069a9d5d6654c7abf8cf 100644 --- a/mindspore-lite/test/ut/nnacl/infer/unsorted_segment_sum_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/unsorted_segment_sum_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/unsorted_segment_sum_infer.h" -namespace mindspore { +namespace mindspore::lite { class UnsortedSegmentSumInferTest : public mindspore::CommonTest { public: @@ -57,4 +57,4 @@ TEST_F(UnsortedSegmentSumInferTest, UnsortedSegmentSumInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/unsqueeze_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/unsqueeze_infer_test.cc index bcf3bd196dbd46663fefd9e038db07e8318ebe88..10f75e03cd6a2d858b165a77fdaef0306faf2090 100644 --- a/mindspore-lite/test/ut/nnacl/infer/unsqueeze_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/unsqueeze_infer_test.cc @@ -17,7 +17,7 @@ #include "nnacl_c/infer/unsqueeze_infer.h" #include "nnacl_c/unsqueeze_parameter.h" -namespace mindspore { +namespace mindspore::lite { class UnsqueezeInferTest : public mindspore::CommonTest { public: @@ -196,4 +196,4 @@ TEST_F(UnsqueezeInferTest, UnsqueezeInferTest5) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/unstack_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/unstack_infer_test.cc index c5bcb70c193af53c90b52a787b7eb32ae7c75c2d..2a61f0737f5c67e937333f478bc0b76b3715267e 100644 --- a/mindspore-lite/test/ut/nnacl/infer/unstack_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/unstack_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/unstack_infer.h" -namespace mindspore { +namespace mindspore::lite { class UnstackInferTest : public mindspore::CommonTest { public: @@ -54,4 +54,4 @@ TEST_F(UnstackInferTest, UnstackInferTest0) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/infer/where_infer_test.cc b/mindspore-lite/test/ut/nnacl/infer/where_infer_test.cc index f24572b8f7dff89e4371d02da73fbf628a3177da..0f03d20e924f23b6e3b50fbb3087e4c3db1d326e 100644 --- a/mindspore-lite/test/ut/nnacl/infer/where_infer_test.cc +++ b/mindspore-lite/test/ut/nnacl/infer/where_infer_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/infer/where_infer.h" -namespace mindspore { +namespace mindspore::lite { class WhereInferTest : public mindspore::CommonTest { public: @@ -84,4 +84,4 @@ TEST_F(WhereInferTest, WhereInferTest1) { delete outputs[i]; } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/int8/quant_dtype_cast_int8_test.cc b/mindspore-lite/test/ut/nnacl/int8/quant_dtype_cast_int8_test.cc index 18c2074e20e31bc2ed7a6b3aa82f43b511eafc00..35dfd89afb57493b6035d7bd722f2fc7b8763865 100644 --- a/mindspore-lite/test/ut/nnacl/int8/quant_dtype_cast_int8_test.cc +++ b/mindspore-lite/test/ut/nnacl/int8/quant_dtype_cast_int8_test.cc @@ -21,7 +21,7 @@ #include "nnacl_c/fp16/quant_dtype_cast_fp16.h" #endif -namespace mindspore { +namespace mindspore::lite { class QuantCastInt8Test : public mindspore::CommonTest { public: @@ -355,4 +355,4 @@ TEST_F(QuantCastInt8Test, Fp32Int8Inf) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/nnacl/kernel/cast_test.cc b/mindspore-lite/test/ut/nnacl/kernel/cast_test.cc index ef8db4b3627561d77161f40527aebd419e65dfa0..7ebf7490a53830a41a0e22ecd020cd083889e4d5 100644 --- a/mindspore-lite/test/ut/nnacl/kernel/cast_test.cc +++ b/mindspore-lite/test/ut/nnacl/kernel/cast_test.cc @@ -20,7 +20,7 @@ #include "nnacl_c/base/cast_base.h" #include "nnacl_c/kernel/cast.h" -namespace mindspore { +namespace mindspore::lite { class CastTest : public mindspore::CommonTest { public: CastTest() {} @@ -248,4 +248,4 @@ TEST_F(CastTest, Int32ToFp16Test) { } } #endif -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/api/context_c_test.cc b/mindspore-lite/test/ut/src/api/context_c_test.cc index 18ee04e43a465eecfd83228c39adf48c57679691..3b744d7f39f2cd7d6b04b3fd8f4a1d1d32f9fb3d 100644 --- a/mindspore-lite/test/ut/src/api/context_c_test.cc +++ b/mindspore-lite/test/ut/src/api/context_c_test.cc @@ -16,7 +16,7 @@ #include "include/c_api/context_c.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class ContextCTest : public mindspore::CommonTest { public: ContextCTest() {} @@ -70,4 +70,4 @@ TEST_F(ContextCTest, common_test) { MSContextAddDeviceInfo(context, npu_device_info); MSContextDestroy(&context); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/api/generic_api_test.cc b/mindspore-lite/test/ut/src/api/generic_api_test.cc index 4c52f85170511f5701c9d88f18d8e90f31116ed9..78239387f041dd48600e31d1caeb58a690c5ca0d 100644 --- a/mindspore-lite/test/ut/src/api/generic_api_test.cc +++ b/mindspore-lite/test/ut/src/api/generic_api_test.cc @@ -20,7 +20,7 @@ #include "src/runtime/cxx_api/converters.h" #include "src/common/context_util.h" -namespace mindspore { +namespace mindspore::lite { class GenericApiTest : public mindspore::CommonTest { public: GenericApiTest() {} @@ -67,4 +67,4 @@ TEST_F(GenericApiTest, TestConvertInnerContextToContext) { delete inner_ctx; delete ctx; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/api/model_c_test.cc b/mindspore-lite/test/ut/src/api/model_c_test.cc index 47f30e86142d26927ad49987c4985a5a843776d8..e6911776ed8425ae3bdb22e70f4fd96b3103a0db 100644 --- a/mindspore-lite/test/ut/src/api/model_c_test.cc +++ b/mindspore-lite/test/ut/src/api/model_c_test.cc @@ -21,7 +21,7 @@ #include "src/common/file_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class ModelCApiTest : public mindspore::CommonTest { public: ModelCApiTest() {} @@ -518,4 +518,4 @@ TEST(ModelCApiTest, TrainExportWeightsMicro) { ASSERT_EQ(status, kMSStatusSuccess); MSModelDestroy(&model); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/api/model_group_test.cc b/mindspore-lite/test/ut/src/api/model_group_test.cc index e2364da98f355d529ea09f06f275620e15a2af0c..9dd29c7eca4818a403db1dbc95788e5d74a3b4f9 100644 --- a/mindspore-lite/test/ut/src/api/model_group_test.cc +++ b/mindspore-lite/test/ut/src/api/model_group_test.cc @@ -19,7 +19,7 @@ #include "include/api/model_group.h" #include "src/common/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { const char in_data_path[] = "./mobilenetv2.ms.bin"; const char model_path_1[] = "./mobilenetv2.ms"; @@ -221,4 +221,4 @@ TEST_F(ModelGroupTest, ModelGroupPredict) { status = model_2->Predict(inputs_2, &outputs_2); ASSERT_EQ(status, kSuccess); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/api/model_parallel_runner_test.cc b/mindspore-lite/test/ut/src/api/model_parallel_runner_test.cc index 5c2954bc8f88521253a0d8d7e5788fb09fef0abe..0cba01142e7d33ceca8aec78db8f8f8c18bd2253 100644 --- a/mindspore-lite/test/ut/src/api/model_parallel_runner_test.cc +++ b/mindspore-lite/test/ut/src/api/model_parallel_runner_test.cc @@ -18,7 +18,7 @@ #include "common/common_test.h" #include "src/common/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { const char in_data_path[] = "./mobilenetv2.ms.bin"; const char model_path[] = "./mobilenetv2.ms"; @@ -240,4 +240,4 @@ TEST_F(ModelParallelRunnerTest, RunnerInitByBuf) { tensor.SetData(nullptr); } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/api/tensor_c_test.cc b/mindspore-lite/test/ut/src/api/tensor_c_test.cc index 4b58abaa0d62beaa5f6aba022b117a5441fcfe3b..ed177da616f1032813626fb3e8a0b81b823e2b2e 100644 --- a/mindspore-lite/test/ut/src/api/tensor_c_test.cc +++ b/mindspore-lite/test/ut/src/api/tensor_c_test.cc @@ -16,7 +16,7 @@ #include "include/c_api/tensor_c.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TensorCTest : public mindspore::CommonTest { public: TensorCTest() {} @@ -88,4 +88,4 @@ TEST_F(TensorCTest, common_test) { MSTensorDestroy(&tensor); MSTensorDestroy(&clone); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/dynamic_library_loader_test.cc b/mindspore-lite/test/ut/src/dynamic_library_loader_test.cc index f9e7c2e2c2843574b621bd5358bbed15d062353d..b8e4b3f0131c7cd36965e9b6d1fc60991f7a9913 100644 --- a/mindspore-lite/test/ut/src/dynamic_library_loader_test.cc +++ b/mindspore-lite/test/ut/src/dynamic_library_loader_test.cc @@ -1,43 +1,43 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "src/common/dynamic_library_loader.h" -#include "common/common_test.h" - -namespace mindspore { -class LoaderUtilTest : public mindspore::CommonTest { - public: - LoaderUtilTest() {} -}; - -/* - in file add.c, the code is: - int add(int a, int b) {return a + b;} - use this command to generate so file: - gcc add.cc -fPIC -shared -o libadd.so - use this command to see the symbol table: - nm -D libadd.so -*/ -TEST_F(LoaderUtilTest, TestAdd) { - lite::DynamicLibraryLoader loader; - loader.Open("./libadd.so"); - int (*add)(int a, int b); - add = (int (*)(int, int))loader.GetFunc("add"); - int res = add(7, 8); - loader.Close(); - ASSERT_EQ(15, res); -} -} // namespace mindspore +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "src/common/dynamic_library_loader.h" +#include "common/common_test.h" + +namespace mindspore::lite { +class LoaderUtilTest : public mindspore::CommonTest { + public: + LoaderUtilTest() {} +}; + +/* + in file add.c, the code is: + int add(int a, int b) {return a + b;} + use this command to generate so file: + gcc add.cc -fPIC -shared -o libadd.so + use this command to see the symbol table: + nm -D libadd.so +*/ +TEST_F(LoaderUtilTest, TestAdd) { + lite::DynamicLibraryLoader loader; + loader.Open("./libadd.so"); + int (*add)(int a, int b); + add = (int (*)(int, int))loader.GetFunc("add"); + int res = add(7, 8); + loader.Close(); + ASSERT_EQ(15, res); +} +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/graph_test.cc b/mindspore-lite/test/ut/src/graph_test.cc index 20b8f7920820d8f579c535f21872c8171093533f..dfba2dd4fd7cc25d8e9bd579e75dfc417882d493 100644 --- a/mindspore-lite/test/ut/src/graph_test.cc +++ b/mindspore-lite/test/ut/src/graph_test.cc @@ -26,7 +26,7 @@ #include "src/litert/executor.h" #include "schema/inner/anf_ir_generated.h" -namespace mindspore { +namespace mindspore::lite { class TestLiteInference : public mindspore::CommonTest { public: TestLiteInference() {} @@ -80,4 +80,4 @@ char *ReadModelFile(const char *file, size_t *size) { return buf.release(); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/infer_test.cc b/mindspore-lite/test/ut/src/infer_test.cc index e19ff5cfaaaf83bbe583a7417c6282d8d54e67fc..aad732a3858c4115d0df3b6058af34a53e095bd2 100644 --- a/mindspore-lite/test/ut/src/infer_test.cc +++ b/mindspore-lite/test/ut/src/infer_test.cc @@ -23,7 +23,7 @@ #include "src/litert/lite_session.h" #include "src/common/file_utils.h" -namespace mindspore { +namespace mindspore::lite { class InferTest : public mindspore::CommonTest { public: InferTest() {} @@ -248,4 +248,4 @@ TEST_F(InferTest, TestModel) { MS_LOG(INFO) << "Passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/lite_mindrt_test.cc b/mindspore-lite/test/ut/src/lite_mindrt_test.cc index e7dbf6dbec7995fc64ab3c0757382d806208c04a..23878ad8d91895145cbb9c11e215e97589fd52a8 100644 --- a/mindspore-lite/test/ut/src/lite_mindrt_test.cc +++ b/mindspore-lite/test/ut/src/lite_mindrt_test.cc @@ -23,7 +23,7 @@ #include "common/common_test.h" #include "schema/model_generated.h" -namespace mindspore { +namespace mindspore::lite { class LiteMindRtTest : public mindspore::CommonTest { public: LiteMindRtTest() {} @@ -82,4 +82,4 @@ TEST_F(LiteMindRtTest, ActorThreadPoolTest) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/registry/registry_custom_op_test.cc b/mindspore-lite/test/ut/src/registry/registry_custom_op_test.cc index 81b13063e7b27095e1c4af6a9d053686d5f3afd9..8d408c3f8d4a474400b089142bc0b5a368864051 100644 --- a/mindspore-lite/test/ut/src/registry/registry_custom_op_test.cc +++ b/mindspore-lite/test/ut/src/registry/registry_custom_op_test.cc @@ -29,7 +29,7 @@ using mindspore::kernel::Kernel; using mindspore::kernel::KernelInterface; using mindspore::schema::PrimitiveType_AddFusion; -namespace mindspore { +namespace mindspore::lite { namespace { const char *const kKeyName = "test_key"; const char *const kTestData = "test_data"; @@ -228,4 +228,4 @@ TEST_F(TestRegistryCustomOp, TestCustomAdd) { ASSERT_EQ(TestData::GetInstance()->data_, kTestData); MS_LOG(INFO) << "Register add op test pass."; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/registry/registry_gpu_custom_op_test.cc b/mindspore-lite/test/ut/src/registry/registry_gpu_custom_op_test.cc index 18d308d79b4b52c87aebe47fc359c6cd479a3fe4..bff06c06b37432f6fff286f4d51af0be62ca93e8 100644 --- a/mindspore-lite/test/ut/src/registry/registry_gpu_custom_op_test.cc +++ b/mindspore-lite/test/ut/src/registry/registry_gpu_custom_op_test.cc @@ -34,7 +34,7 @@ using mindspore::schema::PrimitiveType_AddFusion; #define UP_ROUND(x, y) (((x) + (y) - (1)) / (y) * (y)) #define UP_DIV(x, y) (((x) + (y) - (1)) / (y)) -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kDimIndex2 = 2; constexpr int kDimIndex3 = 3; @@ -538,4 +538,4 @@ TEST_F(TestGPURegistryCustomOp, TestGPUCustomAdd) { ASSERT_EQ(30.0f, outData[0]); MS_LOG(INFO) << "Register add op test pass."; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/registry/registry_test.cc b/mindspore-lite/test/ut/src/registry/registry_test.cc index e6e2cdc8034998fe27d033d68eb797e7205be2d2..18fff55e04035c8e141bc12f8c3bb7cbf5bd23ad 100644 --- a/mindspore-lite/test/ut/src/registry/registry_test.cc +++ b/mindspore-lite/test/ut/src/registry/registry_test.cc @@ -28,7 +28,7 @@ using mindspore::kernel::Kernel; using mindspore::kernel::KernelInterface; using mindspore::schema::PrimitiveType_AddFusion; -namespace mindspore { +namespace mindspore::lite { class TestCustomAdd : public Kernel { public: TestCustomAdd(const std::vector &inputs, const std::vector &outputs, @@ -187,4 +187,4 @@ TEST_F(TestRegistry, TestAdd) { MS_LOG(INFO) << "Register add op test pass."; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/dynamic_mem_manager_test.cc b/mindspore-lite/test/ut/src/runtime/dynamic_mem_manager_test.cc index 5128c833376eab122c16ba15677186b611e94300..90c6809aa2a573f2f3bf4f0fc2c64f1520cee3cf 100644 --- a/mindspore-lite/test/ut/src/runtime/dynamic_mem_manager_test.cc +++ b/mindspore-lite/test/ut/src/runtime/dynamic_mem_manager_test.cc @@ -21,7 +21,7 @@ #include "src/extendrt/numa_adapter.h" #undef private -namespace mindspore { +namespace mindspore::lite { namespace { constexpr size_t kAllocUnitSize = 256 * 1024 * 1024; static constexpr size_t kMinimumAllocUnitSize = 64 * 1024 * 1024; @@ -539,6 +539,6 @@ TEST_F(DynamicMemManagerTest, test_set_ref_count) { ref_count = mem->DecRefCount(data, 1); ASSERT_EQ(ref_count, 2); } -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/common/pack_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/common/pack_tests.cc index 9c2fd933f47aed464d9eeb328d19201e18dff56a..1d4229b83adc762be82b40e66f0cdbb37ae2c301 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/common/pack_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/common/pack_tests.cc @@ -26,7 +26,7 @@ #include "nnacl_c/fp16/conv_fp16.h" #endif -namespace mindspore { +namespace mindspore::lite { class TestPack : public mindspore::CommonTest { public: TestPack() {} @@ -174,4 +174,4 @@ TEST_F(TestPack, PackInputFp16) { } #endif -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc index c51aa18c81441e0476e441e0e82f57a3f5496e57..872b8b6f9787cef631f0f142fe099e62b41be017 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc @@ -19,7 +19,7 @@ #include "nnacl_c/strided_slice_parameter.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestStridedSlice : public mindspore::CommonTest { public: TestStridedSlice() {} @@ -317,4 +317,4 @@ TEST_F(TestStridedSlice, StridedSliceInt8) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/cxx_api/model_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/cxx_api/model_test.cc index 373402f86837f51fa82e6cfac1db2d61cbb8bcbe..4f70b0cc577b899a9da5cdce46e2dcee3d1f01e0 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/cxx_api/model_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/cxx_api/model_test.cc @@ -20,7 +20,7 @@ #include "include/api/serialization.h" #include "include/api/metrics/accuracy.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int32_t kNumThreads = 2; constexpr int NUM_OF_CLASSES = 10; @@ -250,4 +250,4 @@ TEST_F(TestCxxApiLiteModel, set_weights_FAILURE) { delete (tensor); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/cxx_api/serialization_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/cxx_api/serialization_test.cc index fa64020d379aee07affd146a4adc7e4c08ce42f3..0b14f485ab411228748b67183288a2d321d33de1 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/cxx_api/serialization_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/cxx_api/serialization_test.cc @@ -19,7 +19,7 @@ #include "common/common_test.h" #include "include/api/serialization.h" -namespace mindspore { +namespace mindspore::lite { class TestCxxApiLiteSerialization : public mindspore::CommonTest { public: TestCxxApiLiteSerialization() = default; @@ -83,4 +83,4 @@ TEST_F(TestCxxApiLiteSerialization, test_export_to_buffer) { ASSERT_EQ(result, 0); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp16_grad/activation_grad_fp16_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp16_grad/activation_grad_fp16_test.cc index 75f20b1694f6b6eea05bd45a3e359c360a14a31c..d2dd17a416f06209b7654a2f3e34cbc2f4e6426b 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp16_grad/activation_grad_fp16_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp16_grad/activation_grad_fp16_test.cc @@ -23,7 +23,7 @@ #include "src/common/file_utils.h" #include "nnacl_c/fp16_grad/activation_grad_fp16.h" -namespace mindspore { +namespace mindspore::lite { class TestActGradFp16 : public mindspore::CommonTest { public: TestActGradFp16() {} @@ -142,4 +142,4 @@ TEST_F(TestActGradFp16, SigmoidGradFp16) { MS_LOG(INFO) << "SigmoidGradFp16 passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp16_grad/arithmetic_fp16_self_grad_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp16_grad/arithmetic_fp16_self_grad_tests.cc index 3d5a767d90b03a0c432f4b7934a294a7ba7fe899..dff7ea3ca9824b494d3976151c2ad2d64ed3af2a 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp16_grad/arithmetic_fp16_self_grad_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp16_grad/arithmetic_fp16_self_grad_tests.cc @@ -23,7 +23,7 @@ #include "src/common/file_utils.h" #include "nnacl_c/fp16_grad/arithmetic_self_grad.h" -namespace mindspore { +namespace mindspore::lite { class TestArithmeticSelfGradFp16 : public mindspore::CommonTest { public: TestArithmeticSelfGradFp16() {} @@ -84,4 +84,4 @@ TEST_F(TestArithmeticSelfGradFp16, LogGradFp16) { MS_LOG(INFO) << "LogGradFp16 passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32-sparsity/matmul_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32-sparsity/matmul_fp32_tests.cc index a19d152cb72c8e174f767129d0dfbe08c1719424..c9cfe7a4c27ec8a518bb34990a25cbbf909cdc7b 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32-sparsity/matmul_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32-sparsity/matmul_fp32_tests.cc @@ -27,7 +27,7 @@ #include "src/litert/kernel/cpu/fp32/matmul_fp32.h" #include "src/litert/kernel/cpu/fp32_sparse/matmul_sparse_fp32.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::Tensor; class TestSPMMFp32 : public mindspore::CommonTest { @@ -427,4 +427,4 @@ TEST_F(TestSPMMFp32Performance, SparsityMatmul) { ret = this->TestSparseMVM(); EXPECT_EQ(ret, true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/activation_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/activation_fp32_test.cc index 2cab22921e6fb05388fa8c81c9b356be490bf797..5942f28ef9c60de6bdcf318f45c9a3f5291ac89a 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/activation_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/activation_fp32_test.cc @@ -20,7 +20,7 @@ #include "src/executor/kernel_exec.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestActivationFp32 : public mindspore::CommonTest { public: @@ -292,4 +292,4 @@ TEST_F(TestActivationFp32, Softplus) { output0_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/batch_to_space_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/batch_to_space_fp32_test.cc index a89a7338e5b319e3c91cb3044058d6a0a8fc6e09..ec5bbd67ca35aa7b587fd273d8c711d0f7579d9d 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/batch_to_space_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/batch_to_space_fp32_test.cc @@ -19,7 +19,7 @@ #include "nnacl_c/batch_to_space_parameter.h" #include "nnacl_c/common_func.h" -namespace mindspore { +namespace mindspore::lite { class TestBatchToSpaceFp32 : public mindspore::CommonTest { public: @@ -191,4 +191,4 @@ TEST_F(TestBatchToSpaceFp32, BatchToSpaceTest_crop_4) { ASSERT_EQ(0, CompareOutputData(output, expect_out, kOutSize, 0.000001)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/batchnorm_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/batchnorm_fp32_tests.cc index 2943341be97ec5de54530cd0a7e641fc343d3345..e0b183bc5ad25351c06c7504718160ed98fb0281 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/batchnorm_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/batchnorm_fp32_tests.cc @@ -19,7 +19,7 @@ #include "nnacl_c/batchnorm_parameter.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestBatchnormFp32 : public mindspore::CommonTest { public: TestBatchnormFp32() {} @@ -154,4 +154,4 @@ TEST_F(TestBatchnormFp32, easyTest) { kernel->set_parameter(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/constant_of_shape_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/constant_of_shape_fp32_test.cc index 2ad43dfec7d343916fa3bc9bcde0713d699b016b..f38ff42657156a9c4c1bd911f849785bdcd0a09d 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/constant_of_shape_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/constant_of_shape_fp32_test.cc @@ -19,7 +19,7 @@ #include "src/litert/tensor_category.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestConstantOfShapeFp32 : public mindspore::CommonTest { public: TestConstantOfShapeFp32() {} @@ -70,4 +70,4 @@ TEST_F(TestConstantOfShapeFp32, Simple) { for (auto t : inputs_) delete t; for (auto t : outputs_) delete t; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/conv1x1_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/conv1x1_fp32_tests.cc index 6c6420dfbcc040feda35e4f1268c1a999635ad72..27d8a9b2d52dc1177203318b291ccb9eb9178d8a 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/conv1x1_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/conv1x1_fp32_tests.cc @@ -18,7 +18,7 @@ #include "nnacl_c/matmul_parameter.h" #include "src/litert/kernel/cpu/fp32/convolution_1x1_fp32.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::Tensor; class TestConv1x1Fp32 : public mindspore::CommonTest { @@ -135,4 +135,4 @@ TEST_F(TestConv1x1Fp32, Input1x1PrePack4) { EXPECT_EQ(0, CompareOutputData(out, correct, 54)); delete conv_param; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32_tests.cc index 655b8a38db7548faabf0f4b36261e4cc5e672c46..79e0602b7abe7eb615f93153ae5b8ac76ce6f089 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestConvolutionDwFp32 : public mindspore::CommonTest { public: TestConvolutionDwFp32() {} @@ -154,4 +154,4 @@ TEST_F(TestConvolutionDwFp32, ConvDwFp32Accuracy) { delete ctx; MS_LOG(INFO) << "TestConvolutionDwFp32 accuracy passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/convolution_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/convolution_fp32_tests.cc index 934f7d7bdca73b1f6b8c6a8718c8245b74757778..686a350d977e005fde9f69750ca83d79f451ae9b 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/convolution_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/convolution_fp32_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/base/convolution_base.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestConvolutionFp32 : public mindspore::CommonTest { public: TestConvolutionFp32() {} @@ -139,4 +139,4 @@ TEST_F(TestConvolutionFp32, conv1) { delete kernel; delete ctx; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/crop_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/crop_fp32_test.cc index 83d510c4d30d944f45af893e68c4bfb80aeea17a..35a13855f0ddb3f9a46e0f6adebd99483a500442 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/crop_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/crop_fp32_test.cc @@ -19,7 +19,7 @@ #include "src/litert/lite_kernel.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class CropTestFp32 : public mindspore::CommonTest { public: CropTestFp32() = default; @@ -305,4 +305,4 @@ TEST_F(CropTestFp32, CropTest11) { kernel->set_parameter(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/cumsum_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/cumsum_tests.cc index 0fa934716a14184c2fe2e54680345e72e4c5badb..1384223c800b096fa9a380eafc0c9d3db8ede2e0 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/cumsum_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/cumsum_tests.cc @@ -19,7 +19,7 @@ #include "nnacl_c/cumsum_parameter.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestCumsum : public mindspore::CommonTest { public: TestCumsum() {} @@ -388,4 +388,4 @@ TEST_F(TestCumsum, TestIntRank2Thread4) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/deconvolution_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/deconvolution_fp32_tests.cc index 16a9c5983dfc6e4b145f96419b1461ec2277704b..f525e45f8bbca838bf8fc028c935c5d24d7ae3b1 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/deconvolution_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/deconvolution_fp32_tests.cc @@ -23,7 +23,7 @@ #include "src/litert/tensor_category.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestDeConvolutionFp32 : public mindspore::CommonTest { public: TestDeConvolutionFp32() = default; @@ -673,4 +673,4 @@ TEST_F(TestDeConvolutionFp32, DeConvTest3) { for (auto t : outputs_) delete t; free(correct); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/depth_to_space_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/depth_to_space_fp32_test.cc index 901dcd0626b143223920ab1b14f225509336c670..e2c1fde6cb38daf7676867d2fbd9d08c2ac66e21 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/depth_to_space_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/depth_to_space_fp32_test.cc @@ -20,7 +20,7 @@ #include "nnacl_c/depth_to_space_parameter.h" #include "nnacl_c/kernel/depth_to_space.h" -namespace mindspore { +namespace mindspore::lite { class DepthToSpaceTestFp32 : public mindspore::CommonTest { public: @@ -84,4 +84,4 @@ TEST_F(DepthToSpaceTestFp32, DepthToSpaceTest3) { std::cout << "\n"; ASSERT_EQ(0, CompareOutputData(output, expect_out, kOutSize, 0.000001)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/detection_post_process_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/detection_post_process_test.cc index 891bb93752281d10db2eaec9bd157b4eec8a0dbd..c9dc975a17c640be2430f9e7b0f07e76bb83477f 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/detection_post_process_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/detection_post_process_test.cc @@ -21,7 +21,7 @@ #include "src/executor/kernel_exec.h" #include "src/common/file_utils.h" -namespace mindspore { +namespace mindspore::lite { class TestDetectionPostProcessFp32 : public mindspore::CommonTest { public: TestDetectionPostProcessFp32() {} @@ -162,4 +162,4 @@ TEST_F(TestDetectionPostProcessFp32, Fast) { for (auto t : inputs_) delete t; for (auto t : outputs_) delete t; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/embedding_lookup_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/embedding_lookup_fp32_test.cc index 92fc83cadc0b1758eafc3742f82f3e12d9756d50..741c8d3afb314600dacefd12c92abe192a2c6c20 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/embedding_lookup_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/embedding_lookup_fp32_test.cc @@ -22,7 +22,7 @@ #include "src/common/log_adapter.h" #include "src/litert/tensor_category.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::Tensor; class TestEmbeddingLookupFp32 : public mindspore::CommonTest { @@ -92,4 +92,4 @@ TEST_F(TestEmbeddingLookupFp32, ElTest) { delete ctx; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc index 1c9308f566f8dee8858c6d5f5e05bd164851b439..c4ecdbf7841eafa84a23c585ba32092b28263a47 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc @@ -25,7 +25,7 @@ #include "src/litert/kernel_registry.h" #include "src/litert/kernel/cpu/nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::Tensor; class TestFcFp32 : public mindspore::CommonTest { @@ -265,4 +265,4 @@ TEST_F(TestFcFp32, FcTest4_Vec2Batch) { DestroyTensors(inputs); DestroyTensors(outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/l2norm_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/l2norm_fp32_test.cc index bca1f67224c0124d1c0c81b26aa6b124323f0ee4..548245f2ba7d545587c57b090522afa050a8869f 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/l2norm_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/l2norm_fp32_test.cc @@ -19,7 +19,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestL2NormFp32 : public mindspore::CommonTest { public: TestL2NormFp32() = default; @@ -159,4 +159,4 @@ TEST_F(TestL2NormFp32, Test4) { ASSERT_EQ(0, CompareOutputData(output_data, expect.data(), output_size, err_tol_)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/logicalor_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/logicalor_fp32_test.cc index 58cbcc248a729170f046386a417747641c759fac..72040294e915baac4c9095a1450022cac504f8a2 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/logicalor_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/logicalor_fp32_test.cc @@ -20,7 +20,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestLogicalOrFp32 : public mindspore::CommonTest { public: @@ -37,4 +37,4 @@ TEST_F(TestLogicalOrFp32, LogicalOrFp32) { ASSERT_EQ(output[i], expect[i]); } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/lsh_projection_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/lsh_projection_fp32_tests.cc index deca358511ad4826d7dc14dbbf3ea0e56ec8fca4..9eb6db1a0559f9baa5d16b84c8193c1aa0100c85 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/lsh_projection_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/lsh_projection_fp32_tests.cc @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kSparseType = 1; @@ -170,4 +170,4 @@ TEST_F(TestLshProjectionFp32, Sparse3DInputs) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/lstm_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/lstm_fp32_tests.cc index 9441e03ba976122d9f4b2349bc4ce6e661c4f6a5..097b5f98f2498ad679759c60bd40c61e5c2235c9 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/lstm_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/lstm_fp32_tests.cc @@ -20,7 +20,7 @@ #include "nnacl_c/fp32/lstm_fp32.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class LstmFp32 : public mindspore::CommonTest { public: LstmFp32() = default; @@ -337,4 +337,4 @@ TEST_F(LstmFp32, LstmBackwardFp32Accuracy) { MS_LOG(INFO) << "LstmFp32 backward accuracy passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/matmul_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/matmul_fp32_tests.cc index b7dcc7121fd743be5ffcf85e6527e98fa2704a73..f60f646a7cc6532f0ae278cfc01c92f4cb003f8d 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/matmul_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/matmul_fp32_tests.cc @@ -23,7 +23,7 @@ #include "src/litert/tensor_category.h" #include "src/litert/kernel/cpu/nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestMatMulFp32 : public mindspore::CommonTest { public: TestMatMulFp32() {} @@ -373,4 +373,4 @@ TEST_F(TestMatMulFp32, batch) { for (auto t : inputs_) delete t; for (auto t : outputs_) delete t; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/nllloss_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/nllloss_fp32_test.cc index 6fdbba8fd41fa5cebbb17166b7a2777e7535fc7d..b8c109f65adf7256488413438adf58072ab4fdce 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/nllloss_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/nllloss_fp32_test.cc @@ -21,7 +21,7 @@ #include "nnacl_c/nllloss_parameter.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestNLLLossFp32 : public mindspore::CommonTest { public: TestNLLLossFp32() {} @@ -161,4 +161,4 @@ TEST_F(TestNLLLossFp32, ReductionMean) { ASSERT_EQ(0, CompareOutputData(reinterpret_cast(outputs[1]->MutableData()), expect_total_weight, 1, 0.0001)); NLLLossReleaseResources(ctx, kernel, inputs, outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/non_max_suppression_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/non_max_suppression_fp32_tests.cc index 6edf25e5d01f7c26a911aec3d0a732f6b1aca78a..9d7eba329542358d832555579e092a9380bf170f 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/non_max_suppression_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/non_max_suppression_fp32_tests.cc @@ -20,7 +20,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestNMSFp32 : public mindspore::CommonTest { public: TestNMSFp32() = default; @@ -117,4 +117,4 @@ TEST_F(TestNMSFp32, TestCase1) { CompareOutputData(reinterpret_cast(out_tensor_.data()), expect.data(), output_size, err_tol_)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/one_hot_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/one_hot_fp32_test.cc index cb9ec5c8f93ec3e18568018457ef5ac7094d53ff..8458f0840f8e31c22fdb95cfee56de3d97bf59b1 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/one_hot_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/one_hot_fp32_test.cc @@ -22,7 +22,7 @@ #include "schema/ops_generated.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestOneHotFp32 : public mindspore::CommonTest { public: @@ -144,4 +144,4 @@ TEST_F(TestOneHotFp32, Test3) { ASSERT_EQ(0, CompareOutputData(out_data, expect.data(), 36, err_tol)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/power_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/power_fp32_tests.cc index 7a942a1424ced78041a78cfbc9ec2c2f36d95ca2..4fcb23fadaad5e20ed9e69da140b7ec105231149 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/power_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/power_fp32_tests.cc @@ -21,7 +21,7 @@ #include "nnacl/nnacl_manager.h" #include "nnacl_c/pow_parameter.h" -namespace mindspore { +namespace mindspore::lite { class TestPowerFp32 : public mindspore::CommonTest { public: TestPowerFp32() {} @@ -105,4 +105,4 @@ TEST_F(TestPowerFp32, Broadcast) { delete kernel; delete ctx; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/ragged_range_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/ragged_range_fp32_tests.cc index 2d5360759c79273672a7825b91c0d5de7ac63963..3dd1849d8cf6e22935150dbf4c342aa06a55876d 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/ragged_range_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/ragged_range_fp32_tests.cc @@ -21,7 +21,7 @@ #include "src/executor/kernel_exec.h" #include "nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestRaggedRangeFp32 : public mindspore::CommonTest { public: TestRaggedRangeFp32() {} @@ -133,4 +133,4 @@ TEST_F(TestRaggedRangeFp32, 002) { kernel->set_parameter(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/reduce_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/reduce_fp32_tests.cc index ca6857e45ae5ffeab9589cd4a9fc1bf0383ba229..06ce111f8517fd6809490aa168d0b3c226cc5dc1 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/reduce_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/reduce_fp32_tests.cc @@ -31,7 +31,7 @@ using mindspore::schema::ReduceMode_ReduceProd; using mindspore::schema::ReduceMode_ReduceSum; using mindspore::schema::ReduceMode_ReduceSumSquare; -namespace mindspore { +namespace mindspore::lite { class TestReduceFp32 : public mindspore::CommonTest { public: @@ -481,4 +481,4 @@ TEST_F(TestReduceFp32, ASum) { int output_size = 32; ASSERT_EQ(0, CompareOutputData(out, correct, output_size, err_tol)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/resize_bilinear_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/resize_bilinear_fp32_tests.cc index 0250d9fb3cab053468812911407742f515816bd2..8a07d69cda472c663b6e119b0db36174edff1bd6 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/resize_bilinear_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/resize_bilinear_fp32_tests.cc @@ -21,7 +21,7 @@ #include "nnacl_c/resize_parameter.h" #include "schema/ops_generated.h" -namespace mindspore { +namespace mindspore::lite { class TestResizeBilinearFp32 : public mindspore::CommonTest { public: @@ -409,4 +409,4 @@ TEST_F(TestResizeBilinearFp32, ResizeBilinearTest16) { ASSERT_EQ(0, CompareOutputData(output_data, expect.data(), output_size, err_tol)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/resize_nearest_neighbor_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/resize_nearest_neighbor_fp32_tests.cc index 800a586e278f76304e5593e61e468de5995d4dbf..a0ed0c6a82fb86fcda41eace6900efc465813243 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/resize_nearest_neighbor_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/resize_nearest_neighbor_fp32_tests.cc @@ -18,7 +18,7 @@ #include "nnacl_c/resize_parameter.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestResizeNearestNeighborFp32 : public mindspore::CommonTest { public: @@ -551,4 +551,4 @@ TEST_F(TestResizeNearestNeighborFp32, ResizeNearestNeighborTest16) { ASSERT_EQ(0, CompareOutputData(output_data, expect.data(), output_size, err_tol)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/reverse_sequence_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/reverse_sequence_fp32_tests.cc index 0a1f041a1e56fcbf934d7baa47e2f8211a039900..33a03e569f8e85b1dd396c70768851ed74e307f1 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/reverse_sequence_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/reverse_sequence_fp32_tests.cc @@ -20,7 +20,7 @@ #include "nnacl_c/fp32/reverse_sequence_fp32.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestReverseSequenceFp32 : public mindspore::CommonTest { public: TestReverseSequenceFp32() {} @@ -166,4 +166,4 @@ TEST_F(TestReverseSequenceFp32, BatchSeqNotAdjacent) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/roi_pooling_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/roi_pooling_fp32_tests.cc index 2acb64a31317d04ae55faf525eb474b20e4d92ee..ba14f7c8d167b8a98aba6c2265911f9336c172d9 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/roi_pooling_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/roi_pooling_fp32_tests.cc @@ -19,7 +19,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestROIPoolingFp32 : public mindspore::CommonTest { public: TestROIPoolingFp32() {} @@ -75,4 +75,4 @@ TEST_F(TestROIPoolingFp32, Simple) { for (auto t : inputs_) delete t; for (auto t : outputs_) delete t; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scale_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scale_fp32_tests.cc index 5b16bb68fbcb5b5585b64e896e5b23c35c06de7c..8233db6e6aba1fdd50e617e65cc4454d7abb0785 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scale_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scale_fp32_tests.cc @@ -27,7 +27,7 @@ using mindspore::schema::ActivationType; using mindspore::schema::ActivationType_NO_ACTIVATION; using mindspore::schema::ActivationType_RELU; using mindspore::schema::ActivationType_RELU6; -namespace mindspore { +namespace mindspore::lite { class TestScaleFp32 : public mindspore::CommonTest { public: @@ -164,4 +164,4 @@ TEST_F(TestScaleFp32, ScaleRelu6) { ASSERT_EQ(0, CompareOutputData(out_data, expect.data(), 12, err_tol)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scatter_nd_add_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scatter_nd_add_fp32_test.cc index 47cf6f3e9f2b6d5b83b9a847ff6ae6c6f95c31c4..03a50a73fe3b13dae8547e02e9fb208c9452f7ff 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scatter_nd_add_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scatter_nd_add_fp32_test.cc @@ -18,7 +18,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/scatter_nd_parameter.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::Tensor; class TestScatterNdAdd : public mindspore::CommonTest { @@ -136,4 +136,4 @@ TEST_F(TestScatterNdAdd, Fp32ThreeDims) { DestroyTensors(inputs); DestroyTensors(outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scatter_nd_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scatter_nd_fp32_tests.cc index b171b5b59286e1a07cbafc7b077eeb0550ed85b2..fb7b3e7a34288e9b490bb4aec1b0189ade6bab5d 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scatter_nd_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/scatter_nd_fp32_tests.cc @@ -17,7 +17,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/scatter_nd_parameter.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::Tensor; class TestScatterNdFp32 : public mindspore::CommonTest { @@ -90,4 +90,4 @@ TEST_F(TestScatterNdFp32, ScatterNdUpdate) { DestroyTensors(inputs); DestroyTensors(outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc index aaa12c6e1077438e2e067351bfad825325556be8..58dede0ba13d51f248894ffba2f33677e96dc9b9 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc @@ -23,7 +23,7 @@ #include "src/common/log_adapter.h" #include "src/common/string_utils.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::StringPack; using mindspore::lite::Tensor; @@ -84,4 +84,4 @@ TEST_F(TestSkipGramFp32, ElTest) { delete ctx; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/softmax_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/softmax_tests.cc index 57a287d4612d90dec9f604ca44d1a336890e3c73..cdffca197af38b191ffa6752c69d74a1f2535517 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/softmax_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/softmax_tests.cc @@ -19,7 +19,7 @@ #include "nnacl_c/softmax_parameter.h" #include "src/litert/kernel/cpu/nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestSoftmaxFp32 : public mindspore::CommonTest { public: TestSoftmaxFp32() {} @@ -59,4 +59,4 @@ TEST_F(TestSoftmaxFp32, 001) { kernel->set_parameter(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc index 88e177b03cd3d4767ca934c9d30e491920a8b1fd..aa78d4297a21c6f67eda71f166d8196fb8c54fa2 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class SpaceToBatchTestFp32 : public mindspore::CommonTest { public: @@ -86,4 +86,4 @@ TEST_F(SpaceToBatchTestFp32, SpaceToBatchTest6) { DoSpaceToBatch(input.data(), out, ¶m, 0); ASSERT_EQ(0, CompareOutputData(out, expect_out.data(), kOutSize, 0.000001)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/space_to_depth_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/space_to_depth_fp32_tests.cc index 1ebbe4f872c264079e9858708fc9a17ad0f4742f..6376681a2df31453e450dbb52208d2f17039f5b5 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/space_to_depth_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/space_to_depth_fp32_tests.cc @@ -23,7 +23,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class SpaceToDepthTestFp32 : public mindspore::CommonTest { public: @@ -103,4 +103,4 @@ TEST_F(SpaceToDepthTestFp32, SpaceToDepthTest2) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32_tests.cc index 08704f9963a5ca0f677dde129ebdd299e955da45..db0b7b2299331e34fdfdda3223ef374eee0d8e05 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32_tests.cc @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestSparseToDenseFp32 : public mindspore::CommonTest { public: @@ -217,4 +217,4 @@ TEST_F(TestSparseToDenseFp32, SparseToDense_test5) { DestroyTensors(inputs); DestroyTensors(outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/stack_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/stack_fp32_test.cc index 758e7f3f5ed0bdedb3e78cadaace409ef584a4f5..b93a2e8b0669a9b05e7b343819ba810bc4ea3017 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/stack_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/stack_fp32_test.cc @@ -16,7 +16,7 @@ #include "common/common_test.h" #include "nnacl_c/base/stack_base.h" -namespace mindspore { +namespace mindspore::lite { class StackTestFp32 : public mindspore::CommonTest { public: StackTestFp32() = default; @@ -42,4 +42,4 @@ TEST_F(StackTestFp32, StackTest1) { ASSERT_EQ(0, CompareOutputData(output, expect_out, kOutSize, 0.000001)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/tile_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/tile_fp32_tests.cc index fde4a2bf0158e61071fcd736b220bb48162a429d..50a271e29f2b6c472704197bbc3312b4579dbc0f 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/tile_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/tile_fp32_tests.cc @@ -20,7 +20,7 @@ #include "src/litert/kernel_registry.h" #include "src/litert/kernel/cpu/nnacl/nnacl_manager.h" -namespace mindspore { +namespace mindspore::lite { class TestTileFp32 : public mindspore::CommonTest { public: TestTileFp32() {} @@ -157,4 +157,4 @@ TEST_F(TestTileFp32, SimpleTile2) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/topk_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/topk_fp32_tests.cc index f6852855a123391c5cbcf07d89fabf6d9100e6b2..01c49f935c49743c422877c65332be9b575107fb 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/topk_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/topk_fp32_tests.cc @@ -20,7 +20,7 @@ #include "nnacl_c/fp32/topk_fp32.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestTopKFp32 : public mindspore::CommonTest { public: TestTopKFp32() {} @@ -68,4 +68,4 @@ TEST_F(TestTopKFp32, TopK) { out_tensor1.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/transpose_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/transpose_fp32_tests.cc index 87210921803ff0c5c67a3f89367ca0e8d8c76c4a..543f405e4b99e8459d0bb39c624b49b9360792e4 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/transpose_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/transpose_fp32_tests.cc @@ -23,7 +23,7 @@ #include "nnacl/nnacl_manager.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestTransposeFp32 : public mindspore::CommonTest { public: @@ -271,4 +271,4 @@ TEST_F(TestTransposeFp32, TransposeFp32_test5) { /* 1x2x3x2x2 */ delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/uniform_real_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/uniform_real_fp32_test.cc index be300dea62eb2c95af34d8aa1a00c8b7f883b2f3..a865e0522bf8dea46fc139f704b392a2f8d9fadf 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/uniform_real_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/uniform_real_fp32_test.cc @@ -19,7 +19,7 @@ #include "nnacl_c/random_parameter.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestUniformRealFp32 : public mindspore::CommonTest { public: TestUniformRealFp32() {} @@ -67,4 +67,4 @@ TEST_F(TestUniformRealFp32, UniformReal) { out_tensor0.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/unique_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/unique_fp32_tests.cc index 047d16acca669b56fe947479c4d636a8482641f9..bf581affc69c6016c5e44cf9b9b83c51da90a7b6 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/unique_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/unique_fp32_tests.cc @@ -20,7 +20,7 @@ #include "nnacl_c/fp32/unique_fp32.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestUniqueFp32 : public mindspore::CommonTest { public: TestUniqueFp32() {} @@ -71,4 +71,4 @@ TEST_F(TestUniqueFp32, Unique) { out_tensor1.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/unstack_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/unstack_fp32_tests.cc index 4b57c33c19abececa87468928f66d0b74589bca5..5d65a6bee1d410ca81c15dde60fa8296b994ed10 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/unstack_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32/unstack_fp32_tests.cc @@ -20,7 +20,7 @@ #include "nnacl_c/base/unstack_base.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestUnstackFp32 : public mindspore::CommonTest { public: TestUnstackFp32() {} @@ -127,4 +127,4 @@ TEST_F(TestUnstackFp32, Unstack2) { out_tensor2.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/activation_grad_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/activation_grad_fp32_tests.cc index 1d0ef614605a42d9638011e5dbbe79d64958b495..60fc2dc6fde23c6cc09454a325aafb71d360f878 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/activation_grad_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/activation_grad_fp32_tests.cc @@ -27,7 +27,7 @@ #include "src/litert/kernel/cpu/fp32_grad/activation_grad.h" #include "nnacl_c/fp32_grad/activation_grad_fp32.h" -namespace mindspore { +namespace mindspore::lite { class TestActGradFp32 : public mindspore::CommonTest { public: TestActGradFp32() {} @@ -397,4 +397,4 @@ TEST_F(TestActGradFp32, hsigmoidGradFp32) { MS_LOG(INFO) << "hsigmoidGradFp32 passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/arithmetic_grad_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/arithmetic_grad_fp32_tests.cc index 72265769f25a52f645f92acaae0454f9f7f109b7..24730b2881924c44671d78965e8dcc2fbb31003b 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/arithmetic_grad_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/arithmetic_grad_fp32_tests.cc @@ -25,7 +25,7 @@ #include "src/litert/kernel/cpu/fp32_grad/arithmetic_grad.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { #ifdef PRIMITIVE_WRITEABLE ArithmeticParameter *PopulateArithmeticParameter(mindspore::schema::PrimitiveType type, @@ -887,4 +887,4 @@ TEST_F(TestArithmeticGradFp32, TestMaximumGradBroadcastFp32) { MS_LOG(INFO) << "TestMaximumGradBroadcastFp32 passed"; } #endif -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/bias_grad_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/bias_grad_fp32_tests.cc index f4b3ff7e5b2f81dc7c6274be5efe5b8a1fbb3910..bc6a367264deb4a5dbb40bf787ea468639f0e4e0 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/bias_grad_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/bias_grad_fp32_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/fp32_grad/bias_grad.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestBiasGradFp32 : public mindspore::CommonTest { public: @@ -136,4 +136,4 @@ TEST_F(TestBiasGradFp32, BiasGrad2DFp32) { MS_LOG(INFO) << "BiasGradFp32 passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/bn_grad_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/bn_grad_fp32_test.cc index 642f5e204be9e29a227f86441fdfac2f39181435..d0a8307a46f33d4a901ae81efd26c80f493633d9 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/bn_grad_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/bn_grad_fp32_test.cc @@ -24,7 +24,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/batchnorm_parameter.h" -namespace mindspore { +namespace mindspore::lite { constexpr int kSize3 = 3; constexpr int kSize7 = 7; class TestBNGradFp32 : public mindspore::CommonTest { @@ -224,4 +224,4 @@ TEST_F(TestBNGradFp32, BNTtrainFp32) { delete x_tensor; delete kernel_obj; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/convolution_grad_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/convolution_grad_fp32_tests.cc index 669032a9fe4243d6f44a0f2bbe44a907cb3f17b1..02b348ec0b0bb4bbe20c4293c87aa7570df444b9 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/convolution_grad_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/convolution_grad_fp32_tests.cc @@ -26,7 +26,7 @@ #include "nnacl_c/conv_parameter.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestConvolutionGradFp32 : public mindspore::CommonTest { public: TestConvolutionGradFp32() {} @@ -822,4 +822,4 @@ TEST_F(TestConvolutionGradFp32, ConvGroup2Dilation2Stride2) { MS_LOG(INFO) << "TestConvolutionGradFp32 Filter Grad passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/deconvolution_grad_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/deconvolution_grad_fp32_tests.cc index cd1ae7e598321172b77a407ea424c0204602a9bf..0c581e1d64fec98467b2a8258adf759d2c398dc8 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/deconvolution_grad_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/deconvolution_grad_fp32_tests.cc @@ -23,7 +23,7 @@ #include "nnacl_c/conv_parameter.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestDeConvolutionGradFp32 : public mindspore::CommonTest { public: TestDeConvolutionGradFp32() {} @@ -667,4 +667,4 @@ TEST_F(TestDeConvolutionGradFp32, DeConvFp32Dilation2Group12Stride2FilterGrad) { MS_LOG(INFO) << "TestDeConvolutionGradFp32 Filter Grad passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/network_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/network_test.cc index c07dbb46e59e0a4857c0ccc5fe12866f8b2402f0..5d25266574d7286cf5506aab03187563a93e27ae 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/network_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/network_test.cc @@ -33,7 +33,7 @@ #include "src/litert/kernel/cpu/fp32_grad/convolution.h" using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { class NetworkTest : public mindspore::CommonTest { public: NetworkTest() {} @@ -118,4 +118,4 @@ TEST_F(NetworkTest, mobileface_net) { delete model; delete session; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/nllloss_grad_fp32_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/nllloss_grad_fp32_test.cc index 3985c94aadb0508b5c8cb85e276cf54a87ecf3b5..3f4303ffb308d44d39233f7a3297776daefc6bb8 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/nllloss_grad_fp32_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/nllloss_grad_fp32_test.cc @@ -21,7 +21,7 @@ #include "src/executor/kernel_exec.h" #include "src/litert/tensor_category.h" -namespace mindspore { +namespace mindspore::lite { class TestNLLLossGradFp32 : public mindspore::CommonTest { public: TestNLLLossGradFp32() {} @@ -144,4 +144,4 @@ TEST_F(TestNLLLossGradFp32, ReductionMean) { ASSERT_EQ(0, CompareOutputData(reinterpret_cast(outputs[0]->MutableData()), expect_loss, 15, 0.0001)); NLLLossGradReleaseResources(ctx, kernel, param, inputs, outputs); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/pooling_grad_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/pooling_grad_fp32_tests.cc index 473caf06d37d6ba3d264693883dee97f7c180c0c..ea88b5b1478b963a434574801b43fa663948d316 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/pooling_grad_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/pooling_grad_fp32_tests.cc @@ -25,7 +25,7 @@ #include "src/litert/kernel/cpu/fp32_grad/pooling_grad.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestPoolingGradFp32 : public mindspore::CommonTest { public: TestPoolingGradFp32() {} @@ -687,4 +687,4 @@ TEST_F(TestPoolingGradFp32, MaxPoolGradStride3Fp32) { delete kernel; MS_LOG(INFO) << "MaxPoolGradStride3Fp32 Filter Grad passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/softmax_crossentropy_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/softmax_crossentropy_fp32_tests.cc index 13b32ff85865b70762b0bad9e854111bf4084d48..2b7ad7df4f4592abfad22ee528b88b4fb3970332 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/softmax_crossentropy_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/softmax_crossentropy_fp32_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/fp32_grad/sparse_softmax_cross_entropy_with_logits.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestSoftmaxCrossEntropyFp32 : public mindspore::CommonTest { public: @@ -117,4 +117,4 @@ TEST_F(TestSoftmaxCrossEntropyFp32, SoftmaxCrossEntropyFp32) { MS_LOG(INFO) << "SoftmaxCrossEntropyFp32 passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/softmax_grad_fp32_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/softmax_grad_fp32_tests.cc index b04e75c25b47bbf932dad12db4468a1282e16337..dd1a4556deeb2dc0a0ad48af84946c289d030e65 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/softmax_grad_fp32_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/fp32_grad/softmax_grad_fp32_tests.cc @@ -25,7 +25,7 @@ #include "nnacl_c/fp32_grad/softmax_grad.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestSoftmaxGradFp32 : public mindspore::CommonTest { public: TestSoftmaxGradFp32() {} @@ -373,4 +373,4 @@ TEST_F(TestSoftmaxGradFp32, SoftmaxGradAxisMinus1) { MS_LOG(INFO) << "SoftmaxGradAxisMinus1 passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/add_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/add_int8_tests.cc index 9d255de0bd9de5f9b126ab85cb2b7ab180fad47d..92f5d6bd7f1969a8409a928a1931aeaf4f4ed180 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/add_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/add_int8_tests.cc @@ -20,7 +20,7 @@ #include "common/common_test.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestQuantizedAdd : public mindspore::CommonTest { public: TestQuantizedAdd() {} @@ -74,4 +74,4 @@ TEST_F(TestQuantizedAdd, Add) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/arithmetic_self_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/arithmetic_self_int8_tests.cc index 8eb3c104a199a1a51c05b102c752932da10612da..59864ba4e0712bbd66827fa6033e1904b6d8c10b 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/arithmetic_self_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/arithmetic_self_int8_tests.cc @@ -22,7 +22,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestArithmeticSelfInt8 : public mindspore::CommonTest { public: @@ -1037,4 +1037,4 @@ TEST_F(TestArithmeticSelfInt8, logical_not_quant0_thread2) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/batchnorm_int8_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/batchnorm_int8_test.cc index 72abe37c287ab054fcd53e8be144a2817fe16a34..534d087aa3face46b479fb90fac12c2d44fa192c 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/batchnorm_int8_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/batchnorm_int8_test.cc @@ -22,7 +22,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestBatchnormInt8 : public mindspore::CommonTest { public: TestBatchnormInt8() {} @@ -167,4 +167,4 @@ TEST_F(TestBatchnormInt8, BNTest) { kernel->set_parameter(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/concat_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/concat_int8_tests.cc index ca25ffd238f52634fa7e08e70f1be689f5cf1279..db7104e9d51018fc2449d0bea6f4c7a86113dd20 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/concat_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/concat_int8_tests.cc @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestConcatInt8 : public mindspore::CommonTest { public: @@ -257,4 +257,4 @@ TEST_F(TestConcatInt8, Concat1_axis1_thread2_quant1) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/conv_1x1_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/conv_1x1_int8_tests.cc index 0ba9e2a7465fccce9bf44f0e7fbc3a57e9c6815b..bf1eace00c807950a97388b15b9ad94ca65b8a1f 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/conv_1x1_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/conv_1x1_int8_tests.cc @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/int8/convolution_1x1_int8.h" #include "src/litert/tensor_category.h" -namespace mindspore { +namespace mindspore::lite { using lite::Tensor; class TestConv1x1Int8 : public mindspore::CommonTest { public: @@ -284,4 +284,4 @@ TEST_F(TestConv1x1Int8, Conv1x1Int8Test2) { for (auto t : outputs_) delete t; free(correct); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/crop_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/crop_int8_tests.cc index a301fba65257a42817c4395c0bbddfda6ffc7ceb..9c28587fa3531750d62c5a461e8f5458204dadc2 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/crop_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/crop_int8_tests.cc @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestCropInt8 : public mindspore::CommonTest { public: @@ -710,4 +710,4 @@ TEST_F(TestCropInt8, crop_4d_axis0_offset0_quant0_thread3) { delete ctx; delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/deconv_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/deconv_int8_tests.cc index 80c3d256ab288bcf959dffbf1a1e481438599389..5283e4ff1bf5eaab5c23603cd497317a29348cb1 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/deconv_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/deconv_int8_tests.cc @@ -27,7 +27,7 @@ using mindspore::lite::DeviceType; -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::LiteQuantParam; using mindspore::lite::Tensor; class TestDeconvInt8 : public mindspore::CommonTest { @@ -339,4 +339,4 @@ TEST_F(TestDeconvInt8, DeConvInt8Test1) { for (auto t : outputs_) delete t; free(correct); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/fullconnection_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/fullconnection_int8_tests.cc index 21e9c732ed518e29140480de57c4f18472ecfd2e..3ee560784643ab91c4e4d899b155783152a4031b 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/fullconnection_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/fullconnection_int8_tests.cc @@ -22,7 +22,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { using lite::Tensor; class TestFcInt8 : public mindspore::CommonTest { public: @@ -153,4 +153,4 @@ TEST_F(TestFcInt8, fctest1) { for (auto t : outputs) delete t; delete[] out; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/gatherNd_int8_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/gatherNd_int8_test.cc index c3bbcf72f266741b9a6427778c46ee6a08ec4cf0..8c1ad210dd3b1d6b57a4bd738aa4cd77c5a9d72c 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/gatherNd_int8_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/gatherNd_int8_test.cc @@ -22,7 +22,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestGatherNdInt8 : public mindspore::CommonTest { public: TestGatherNdInt8() {} @@ -102,4 +102,4 @@ TEST_F(TestGatherNdInt8, GatherNdTest) { delete kernel; MS_LOG(INFO) << "TestGatherNd accuracy passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/gather_int8_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/gather_int8_test.cc index f21710645f87d7b9e2858676967c0759f91a9ac8..847bf3ba846fc0b3d23c3200a9220039319eac8c 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/gather_int8_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/gather_int8_test.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestGatherInt8 : public mindspore::CommonTest { public: TestGatherInt8() {} @@ -99,4 +99,4 @@ TEST_F(TestGatherInt8, GatherTest) { delete kernel; MS_LOG(INFO) << "TestGather_int8 accuracy passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/hswish_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/hswish_int8_tests.cc index ef03b3f52b029a9a51bdec3d0853f9c2440d89e3..53b7c009bb696548304834df675f377a68478b81 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/hswish_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/hswish_int8_tests.cc @@ -22,7 +22,7 @@ #include "src/litert/kernel/cpu/int8/hswish_int8.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestHSwishInt8 : public mindspore::CommonTest { public: TestHSwishInt8() {} @@ -73,4 +73,4 @@ TEST_F(TestHSwishInt8, HSwish) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/l2_norm_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/l2_norm_int8_tests.cc index b8ea47a507b0198c94530867f490c35b543fb7f7..5acbd1703d22880b146ca910623892b20fb6b315 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/l2_norm_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/l2_norm_int8_tests.cc @@ -20,7 +20,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/l2_norm_parameter.h" -namespace mindspore { +namespace mindspore::lite { class TestL2NormInt8 : public mindspore::CommonTest { public: TestL2NormInt8() {} @@ -116,4 +116,4 @@ TEST_F(TestL2NormInt8, norm2) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/matmul_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/matmul_int8_tests.cc index fde391e557101e2175962491fe9faa43779521fd..61a65295e727848bec71a02823f2221aa917b2d5 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/matmul_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/matmul_int8_tests.cc @@ -24,7 +24,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class TestMatmulInt8 : public mindspore::CommonTest { public: TestMatmulInt8() {} @@ -260,4 +260,4 @@ TEST_F(TestMatmulInt8, mmtest2) { delete[] out; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/mul_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/mul_int8_tests.cc index e42c11226545891d6d749a519b088767242b605a..c35129ade161d68ce6ded30da8a4ecc23f6aab21 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/mul_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/mul_int8_tests.cc @@ -24,7 +24,7 @@ #include "src/tensor.h" #include "nnacl_c/arithmetic_parameter.h" -namespace mindspore { +namespace mindspore::lite { class TestMulInt8 : public mindspore::CommonTest { public: @@ -401,4 +401,4 @@ TEST_F(TestMulInt8, test) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/pad_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/pad_int8_tests.cc index 1d94b775e17672837f33717731226e6d30a3310b..081e84929ff1d5eb13dbd0fad057a9290e178616 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/pad_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/pad_int8_tests.cc @@ -23,7 +23,7 @@ #include "nnacl_c/pad_parameter.h" #include "src/litert/kernel/cpu/int8/pad_int8.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::LiteQuantParam; using mindspore::lite::Tensor; class TestPadInt8 : public mindspore::CommonTest { @@ -243,4 +243,4 @@ TEST_F(TestPadInt8, PadInt8TestInit4) { delete ctx; free(correct); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/power_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/power_int8_tests.cc index 3899c22acd346bf23a7282f673bd1b5978437bad..fb1aeb412b53d05a2494b9e9c654d61d4f694374 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/power_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/power_int8_tests.cc @@ -22,7 +22,7 @@ #include "nnacl_c/pow_parameter.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestPowerInt8 : public mindspore::CommonTest { public: @@ -83,4 +83,4 @@ TEST_F(TestPowerInt8, normal) { kernel->set_parameter(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/prelu_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/prelu_int8_tests.cc index 0e55eb45c22d911dbceaf6149b9301c7e1cf2b4e..d54c159be4a43db5d78991dc7140c8317a45f507 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/prelu_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/prelu_int8_tests.cc @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestPreluInt8 : public mindspore::CommonTest { public: @@ -94,4 +94,4 @@ TEST_F(TestPreluInt8, prelu_1) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/quant_dtype_cast_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/quant_dtype_cast_tests.cc index 576225b6ba9171e64f24dd4b77766af7439aeb68..082ad11bb5a2b126db92cc290c96e1369884e1c5 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/quant_dtype_cast_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/quant_dtype_cast_tests.cc @@ -23,7 +23,7 @@ #include "src/litert/kernel_registry.h" #include "src/executor/kernel_exec.h" -namespace mindspore { +namespace mindspore::lite { class QuantDTypeCastTestFp32 : public mindspore::CommonTest { public: @@ -132,4 +132,4 @@ TEST_F(QuantDTypeCastTestFp32, QuantDTypeCastTest2) { ASSERT_EQ(0, CompareOutputData(output.data(), expect_out, out_size, 0.000001)); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/reduce_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/reduce_int8_tests.cc index c9e038eb26df1354c32fbf9162e0215eff54d484..fbaa81c30ca9b37c49b055af7ca6def7bc76948f 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/reduce_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/reduce_int8_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/fp32/reduce_fp32.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::LiteQuantParam; using mindspore::lite::Tensor; using mindspore::schema::ReduceMode; @@ -364,4 +364,4 @@ TEST_F(TestReduceInt8, SumSquare2Axis) { CompareOutputInt8(output_data, correct, output_size, err_tol_); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/relux_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/relux_int8_tests.cc index bda47a03d0cc9a23c021a5a032e7db99f001e490..d9052b89429d9f98d671cddcb915c06e4df159de 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/relux_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/relux_int8_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/int8/relux_int8.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestReluXInt8 : public mindspore::CommonTest { public: TestReluXInt8() {} @@ -120,4 +120,4 @@ TEST_F(TestReluXInt8, Relu6) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/reshape_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/reshape_int8_tests.cc index a765e82f2a1f466cf760746e97db34489600d238..ef4282b3589530df4b7f491cf304ff96ecc6f585 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/reshape_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/reshape_int8_tests.cc @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestReshapeInt8 : public mindspore::CommonTest { public: @@ -156,4 +156,4 @@ TEST_F(TestReshapeInt8, reshape_quant1_thread2) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/resize_bilinear_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/resize_bilinear_int8_tests.cc index c79ef65b3e6f734e9a463bbe26787d36098e1bc4..8f92317e6e8a6a0919deb7e7bfc5cd7ecc4f2d5a 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/resize_bilinear_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/resize_bilinear_int8_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/int8/resize_int8.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::LiteQuantParam; using mindspore::lite::Tensor; @@ -179,4 +179,4 @@ TEST_F(TestResizeBilinearInt8, Bilinear3) { CompareOutputInt8(output_data, expect, 160, err_percent_); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/resize_nearest_neighbor_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/resize_nearest_neighbor_int8_tests.cc index c664a889d520d16959f132c7c471326c37dd8f74..84bfe5320cb2615ae154d30d59c9f94a9238e7ae 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/resize_nearest_neighbor_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/resize_nearest_neighbor_int8_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/int8/resize_int8.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::LiteQuantParam; using mindspore::lite::Tensor; @@ -210,4 +210,4 @@ TEST_F(TestResizeNearestNeighborInt8, NearestNeighbor4) { CompareOutputInt8(output_data, expect, out_element_num, err_percent_); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/scale_int8.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/scale_int8.cc index 2df0fbc276f5c6fe6143ff8ee4d82f73add4c166..47c200027e5290a8e1b0c1fd056221b27849e687 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/scale_int8.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/scale_int8.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel_registry.h" #include "nnacl_c/int8/scale_int8.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::LiteQuantParam; using mindspore::lite::Tensor; @@ -177,4 +177,4 @@ TEST_F(TestScaleInt8, scale3) { err_tol_ = 0.01; CompareOutputInt8(out_data, correct, output_size, err_tol_); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/sigmoid_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/sigmoid_int8_tests.cc index 148ea7b537bca64506d38aa5094d5062ae5e14ac..92862f4ccf6c338a826ba719f74711c634356c2b 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/sigmoid_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/sigmoid_int8_tests.cc @@ -20,7 +20,7 @@ #include "nnacl_c/fp32/activation_fp32.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestSigmoidInt8 : public mindspore::CommonTest { public: TestSigmoidInt8() {} @@ -71,4 +71,4 @@ TEST_F(TestSigmoidInt8, Sigmoid) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/slice_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/slice_int8_tests.cc index ce6646c6a1b1e7ed17fc0aa16b14c634107b2cb7..bfee47e63897458431f8665c665eb2127a4028d1 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/slice_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/slice_int8_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/int8/slice_int8.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestSliceInt8 : public mindspore::CommonTest { public: TestSliceInt8() {} @@ -448,4 +448,4 @@ TEST_F(TestSliceInt8, Slice4Thread) { size_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/softmax_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/softmax_int8_tests.cc index 3893a239b480736f19eca42c43a87857213ab623..810d7f439623722a9a81578244ad8867fd43b91b 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/softmax_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/softmax_int8_tests.cc @@ -22,7 +22,7 @@ #include "nnacl_c/softmax_parameter.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestSoftmaxInt8 : public mindspore::CommonTest { public: @@ -87,4 +87,4 @@ TEST_F(TestSoftmaxInt8, SoftmaxInt8) { output0_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/space_to_batch_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/space_to_batch_int8_tests.cc index d3ad1f6b58cb303ecedf465ffecbe9aff227cc25..7b990adc66d2434aecdb8bc0c140029a90ecd12a 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/space_to_batch_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/space_to_batch_int8_tests.cc @@ -18,7 +18,7 @@ #include "nnacl_c/fp32/space_to_batch_fp32.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class SpaceToBatchTestInt8 : public mindspore::CommonTest { public: SpaceToBatchTestInt8() {} @@ -58,4 +58,4 @@ TEST_F(SpaceToBatchTestInt8, test1) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/split_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/split_int8_tests.cc index 7fe33d32137b8110fa6f56f3ea986cf6040428bc..35dea06d73054918ee4506bcf2a8e52cd843a084 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/split_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/split_int8_tests.cc @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestSplitInt8 : public mindspore::CommonTest { public: @@ -309,4 +309,4 @@ TEST_F(TestSplitInt8, Split_quant1_thread2_num) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/squeeze_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/squeeze_int8_tests.cc index 51b6102b3a2f39a26c6e46bef2ab6f14fecf1f03..0e8409cba0d9fc1231fdd036bf0477bf4085c786 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/squeeze_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/squeeze_int8_tests.cc @@ -23,7 +23,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestSqueezeInt8 : public mindspore::CommonTest { public: @@ -92,4 +92,4 @@ TEST_F(TestSqueezeInt8, Squeeze_1d_axis0_offset0_quant0_thread2) { delete ctx; delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/sub_int_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/sub_int_tests.cc index 0b6808627e4266b955826e63331667432ee457ce..89379e81d1c894cc790db05cb3671fe102a17e79 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/sub_int_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/sub_int_tests.cc @@ -21,7 +21,7 @@ #include "src/litert/kernel/cpu/int8/sub_int8.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestSubInt8 : public mindspore::CommonTest { public: TestSubInt8() {} @@ -127,4 +127,4 @@ TEST_F(TestSubInt8, SubInt8T2) { out_tensor.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/topk_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/topk_int8_tests.cc index 173e01368c957d10d0e72fab11ea5cbe43812d64..a7b9b1b87f35c4193cde4971040b9689e1b7a081 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/topk_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/topk_int8_tests.cc @@ -21,7 +21,7 @@ #include "nnacl_c/fp32/topk_fp32.h" #include "src/litert/kernel_registry.h" -namespace mindspore { +namespace mindspore::lite { class TestTopKInt8 : public mindspore::CommonTest { public: TestTopKInt8() {} @@ -66,4 +66,4 @@ TEST_F(TestTopKInt8, TopK) { out_tensor1.set_data(nullptr); delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/unsqueeze_int8_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/unsqueeze_int8_tests.cc index d509b258bd3aa3f7ad5c7170a422a3666b2b55b4..9c3b99e421e5cb95b4d7f9573b26c5a007b8b659 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/unsqueeze_int8_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/int8/unsqueeze_int8_tests.cc @@ -22,7 +22,7 @@ #include "src/executor/kernel_exec.h" #include "src/tensor.h" -namespace mindspore { +namespace mindspore::lite { class TestUnsqueezeInt8 : public mindspore::CommonTest { public: @@ -95,4 +95,4 @@ TEST_F(TestUnsqueezeInt8, Unsqueeze_1) { delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/arm/string/normalize.cc b/mindspore-lite/test/ut/src/runtime/kernel/arm/string/normalize.cc index 6644e069fb8c8c388e52303daf2643f2ea559929..7a88931f8eabc6bbfd3ea3db7d5000cabcad4ccf 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/arm/string/normalize.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/arm/string/normalize.cc @@ -24,7 +24,7 @@ #include "src/common/log_adapter.h" #include "src/common/string_utils.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::lite::StringPack; using mindspore::lite::Tensor; @@ -89,4 +89,4 @@ TEST_F(TestNormalize, TestSentence) { } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/common_utils_test.cc b/mindspore-lite/test/ut/src/runtime/kernel/common_utils_test.cc index d974dcbedc53e0b227fe84b2b5b2f180ab08bffc..7119ba6a1507b0c73248518a4c458814407d1f34 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/common_utils_test.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/common_utils_test.cc @@ -18,7 +18,7 @@ #include "common/common_test.h" #include "common/common_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class CommonUtilTest : public mindspore::CommonTest { public: @@ -131,4 +131,4 @@ TEST_F(CommonUtilTest, BucketReduceSparseGradient2) { } } } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel/cuda/batchtospace_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel/cuda/batchtospace_tests.cc index a3d61223ab50ed844b9f8030f9cb0b4865e9368d..7b383845ba88378c40336875b1e627a0addfdee6 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel/cuda/batchtospace_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel/cuda/batchtospace_tests.cc @@ -20,7 +20,7 @@ #include "ut/src/extendrt/kernel/cuda/common.h" #include "nnacl_c/batch_to_space_parameter.h" -namespace mindspore { +namespace mindspore::lite { class CudaTest_BatchToSpace : public CommonTest { public: CudaTest_BatchToSpace() {} @@ -81,4 +81,4 @@ TEST_F(CudaTest_BatchToSpace, basic) { delete out_tensor; delete kernel; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/kernel_executor_tests.cc b/mindspore-lite/test/ut/src/runtime/kernel_executor_tests.cc index bac21f374d13842c8411f9095319412cf2c13b8d..421d6620d2e962c619cce81c7f6023870126a291 100644 --- a/mindspore-lite/test/ut/src/runtime/kernel_executor_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/kernel_executor_tests.cc @@ -26,7 +26,7 @@ #include "infer/pad.h" #include "ops/base_operator.h" -namespace mindspore { +namespace mindspore::lite { class KernelExecutorTest : public mindspore::CommonTest { public: KernelExecutorTest(); @@ -771,4 +771,4 @@ TEST_F(KernelExecutorTest, TestTranspose) { ASSERT_EQ(0, CompareOutputData(reinterpret_cast(outputs[0].MutableData()), correct, outputs[0].ElementNum(), 0.0001)); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/runtime/runtime_convert_tests.cc b/mindspore-lite/test/ut/src/runtime/runtime_convert_tests.cc index 08bfde654ca080780c9734465355814b8e85c2f3..60e883fc2da9d6317e2a934cd67caa22ab73ff4b 100644 --- a/mindspore-lite/test/ut/src/runtime/runtime_convert_tests.cc +++ b/mindspore-lite/test/ut/src/runtime/runtime_convert_tests.cc @@ -17,7 +17,7 @@ #include "include/api/model.h" #include "include/api/status.h" -namespace mindspore { +namespace mindspore::lite { class RuntimeConvert : public mindspore::CommonTest { public: RuntimeConvert() = default; @@ -86,4 +86,4 @@ TEST_F(RuntimeConvert, relu3) { ASSERT_LE(fp32_data[2], 3.0); ASSERT_LE(fp32_data[3], 4.0); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/src/utils_test.cc b/mindspore-lite/test/ut/src/utils_test.cc index aca672528685a352689d6b7b1f38d10d2d4ed66e..b23cc15bef8b9fea1ad1b13f9847f36d82561b38 100644 --- a/mindspore-lite/test/ut/src/utils_test.cc +++ b/mindspore-lite/test/ut/src/utils_test.cc @@ -1,66 +1,66 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include "schema/inner/model_generated.h" -#include "common/common_test.h" -#include "include/errorcode.h" -#include "src/common/log_adapter.h" -#include "src/executor/kernel_exec.h" -#include "src/litert/kernel_exec_util.h" - -namespace mindspore { -class UtilsTest : public mindspore::CommonTest { - public: - UtilsTest() {} -}; - -TEST_F(UtilsTest, TestSubgraph) { - auto kernel0 = std::make_shared(); - auto kernel1 = std::make_shared(); - auto kernel2 = std::make_shared(); - - auto tensor0 = std::make_shared(); - auto tensor1 = std::make_shared(); - auto tensor2 = std::make_shared(); - auto tensor3 = std::make_shared(); - auto tensor4 = std::make_shared(); - - kernel0->AddOutKernel(kernel1.get()); - kernel1->AddInKernel(kernel0.get()); - kernel1->AddOutKernel(kernel2.get()); - kernel2->AddInKernel(kernel1.get()); - - kernel0->set_in_tensors({tensor0.get(), tensor1.get()}); - kernel0->set_out_tensors({tensor2.get()}); - kernel1->set_in_tensors({tensor2.get()}); - kernel1->set_out_tensors({tensor3.get()}); - kernel2->set_in_tensors({tensor3.get()}); - kernel2->set_out_tensors({tensor4.get()}); - - std::vector kernels = {kernel0.get(), kernel1.get(), kernel2.get()}; - - auto input_kernels = kernel::KernelExecUtil::SubgraphInputNodes(kernels); - ASSERT_EQ(input_kernels.size(), 1); - auto output_kernels = kernel::KernelExecUtil::SubgraphOutputNodes(kernels); - ASSERT_EQ(output_kernels.size(), 1); - auto input_tensors = kernel::KernelExecUtil::SubgraphInputTensors(kernels); - ASSERT_EQ(input_tensors.size(), 2); - auto output_tensors = kernel::KernelExecUtil::SubgraphOutputTensors(kernels); - ASSERT_EQ(output_tensors.size(), 1); -} -} // namespace mindspore +/** + * Copyright 2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "schema/inner/model_generated.h" +#include "common/common_test.h" +#include "include/errorcode.h" +#include "src/common/log_adapter.h" +#include "src/executor/kernel_exec.h" +#include "src/litert/kernel_exec_util.h" + +namespace mindspore::lite { +class UtilsTest : public mindspore::CommonTest { + public: + UtilsTest() {} +}; + +TEST_F(UtilsTest, TestSubgraph) { + auto kernel0 = std::make_shared(); + auto kernel1 = std::make_shared(); + auto kernel2 = std::make_shared(); + + auto tensor0 = std::make_shared(); + auto tensor1 = std::make_shared(); + auto tensor2 = std::make_shared(); + auto tensor3 = std::make_shared(); + auto tensor4 = std::make_shared(); + + kernel0->AddOutKernel(kernel1.get()); + kernel1->AddInKernel(kernel0.get()); + kernel1->AddOutKernel(kernel2.get()); + kernel2->AddInKernel(kernel1.get()); + + kernel0->set_in_tensors({tensor0.get(), tensor1.get()}); + kernel0->set_out_tensors({tensor2.get()}); + kernel1->set_in_tensors({tensor2.get()}); + kernel1->set_out_tensors({tensor3.get()}); + kernel2->set_in_tensors({tensor3.get()}); + kernel2->set_out_tensors({tensor4.get()}); + + std::vector kernels = {kernel0.get(), kernel1.get(), kernel2.get()}; + + auto input_kernels = kernel::KernelExecUtil::SubgraphInputNodes(kernels); + ASSERT_EQ(input_kernels.size(), 1); + auto output_kernels = kernel::KernelExecUtil::SubgraphOutputNodes(kernels); + ASSERT_EQ(output_kernels.size(), 1); + auto input_tensors = kernel::KernelExecUtil::SubgraphInputTensors(kernels); + ASSERT_EQ(input_tensors.size(), 2); + auto output_tensors = kernel::KernelExecUtil::SubgraphOutputTensors(kernels); + ASSERT_EQ(output_tensors.size(), 1); +} +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/activation_mapper_test.cc b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/activation_mapper_test.cc index f474d0734dcbe1526d8244ffb5c19e387ec1be56..dd53bce6d653f93388abb5ea9e7a6881d6056f6b 100644 --- a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/activation_mapper_test.cc +++ b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/activation_mapper_test.cc @@ -42,7 +42,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kNumInputIndex0 = 0; constexpr int kNumInputIndex1 = 1; @@ -503,4 +503,4 @@ TEST_F(ActivationMapperTest, TANHNodeMapperTest) { auto attr_size = new_prim->attrs().size(); ASSERT_EQ(attr_size, 1); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/argmax_fusion_mapper_test.cc b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/argmax_fusion_mapper_test.cc index 8d274ed6d5d63d6afe784a4e308fbe2124443ad5..946153d70ebe201aed40f701f7dde32ea032d031 100644 --- a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/argmax_fusion_mapper_test.cc +++ b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/argmax_fusion_mapper_test.cc @@ -32,7 +32,7 @@ #include "mindspore/core/include/ir/dtype/number.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kNumInputNum1 = 1; constexpr int kNumInputNum2 = 2; @@ -385,4 +385,4 @@ TEST_F(ArgmaxFusionMapperTest, InitArgmaxFusionNodeWithoutKeepDims) { MS_LOG(INFO) << "PASS"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/argmin_fusion_mapper_test.cc b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/argmin_fusion_mapper_test.cc index 151240e8d4d0778033efe2c051614c6d8f991603..eb5a4b62aac04a278043a97476efc10415a50e8c 100644 --- a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/argmin_fusion_mapper_test.cc +++ b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/argmin_fusion_mapper_test.cc @@ -32,7 +32,7 @@ #include "mindspore/core/include/ir/dtype/number.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kNumInputNum1 = 1; constexpr int kNumInputNum2 = 2; @@ -308,4 +308,4 @@ TEST_F(ArgminFusionMapperTest, ArgminFusionNodeMapperWithInputSize3) { ASSERT_EQ(cnode->inputs().size(), kNumInputNum3); MS_LOG(INFO) << "PASS"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/arithmetic_mapper_test.cc b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/arithmetic_mapper_test.cc index 9c91822a46a2875b66e2a3f34a9ca274280f3ca3..d3c9ccde57010a442cf1db141c2abd471c066384 100644 --- a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/arithmetic_mapper_test.cc +++ b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/arithmetic_mapper_test.cc @@ -39,7 +39,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kNumInputSize = 3; } // namespace @@ -500,4 +500,4 @@ TEST_F(ArithmeticMapperTest, TestExpFusion) { auto prim_name = new_prim->name(); ASSERT_EQ(prim_name, "Exp"); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/clip_mapper_test.cc b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/clip_mapper_test.cc index 1972c8ecfbc35c71485e68067c702ffb1d0ccfaa..5cf660111c93d4dda7d312d16550debe109f9ef8 100644 --- a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/clip_mapper_test.cc +++ b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/clip_mapper_test.cc @@ -27,7 +27,7 @@ #include "mindapi/ir/tensor.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" -namespace mindspore { +namespace mindspore::lite { constexpr float kNumClipFloatMinValue = -1.0; constexpr float kNumClipFloatMaxValue = 1.0; constexpr int kNumInputMinIndex = 1; @@ -381,4 +381,4 @@ TEST_F(ClipMapperTest, FloatClipNodeWithAttr) { ASSERT_EQ(input3_is_param, true); MS_LOG(INFO) << "PASS"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/fused_batchnorm_mapper_test.cc b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/fused_batchnorm_mapper_test.cc index 23cba9abaabec9d0926405630e8a05d2e7b4774a..9f433bcb345957fb02539d3cbab2c130fd707236 100644 --- a/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/fused_batchnorm_mapper_test.cc +++ b/mindspore-lite/test/ut/tools/converter/adapter/acl/mapper/fused_batchnorm_mapper_test.cc @@ -32,7 +32,7 @@ #include "mindspore/core/include/ir/dtype/number.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" -namespace mindspore { +namespace mindspore::lite { class FusedBatchNormMapperTest : public mindspore::CommonTest { public: FusedBatchNormMapperTest() = default; @@ -161,4 +161,4 @@ TEST_F(FusedBatchNormMapperTest, InitFusedBatchNormNodeWithInput) { ASSERT_EQ(attr_size, 5); MS_LOG(INFO) << "PASS"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/onnx/onnx_layer_norm_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/onnx/onnx_layer_norm_parser_test.cc index fc8325066dc6c551aa8ec1d2771eca5366fea07f..01b4d3905250436f8d624eff1c470c5116c6276c 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/onnx/onnx_layer_norm_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/onnx/onnx_layer_norm_parser_test.cc @@ -22,7 +22,7 @@ #include "include/registry/converter_context.h" #include "include/registry/node_parser_registry.h" #include "tools/converter/parser/onnx/onnx_node_parser_registry.h" -namespace mindspore { +namespace mindspore::lite { class OnnxLayerNormParserTest : public mindspore::CommonTest { public: OnnxLayerNormParserTest() = default; @@ -127,4 +127,4 @@ TEST_F(OnnxLayerNormParserTest, OnnxLayerNormParserTest2) { auto ret = TestOnnxLayerNormNode2(); ASSERT_EQ(ret, true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_activation_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_activation_parser_test.cc index 61d2ee8bb2bf7d9a6722087df4adfdafc65acd30..5abda3ef3c4881b46b87ef77f3950e4e6c9ff66c 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_activation_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_activation_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserRelu : public TestTfliteParser { public: @@ -138,4 +138,4 @@ TEST_F(TestTfliteParserLeakyRelu, AttrValue) { ASSERT_EQ(val.type, schema::PrimitiveType_LeakyRelu); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_addn_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_addn_parser_test.cc index 13f4396cda7ec3e89b936328363a384e99248e43..0a2eebb2caa5cfc985515934f9f2e16bbf8f3044 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_addn_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_addn_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserAddN : public TestTfliteParser { public: TestTfliteParserAddN() = default; @@ -31,4 +31,4 @@ TEST_F(TestTfliteParserAddN, OpType) { ASSERT_NE(meta_graph->nodes.front()->primitive.get(), nullptr); ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_AddN) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_argmax_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_argmax_parser_test.cc index dd2f8c1526ed0e2af6e37d5b58aba92070ddf008..6e02d8f8d2e36f7d290b9c1bc0f4d4092f844ccc 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_argmax_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_argmax_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserArgmax : public TestTfliteParser { public: TestTfliteParserArgmax() = default; @@ -40,4 +40,4 @@ TEST_F(TestTfliteParserArgmax, AttrValue) { ASSERT_EQ(val->out_max_value, false); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_argmin_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_argmin_parser_test.cc index e0ac4bed67d9e815588864e8584e9bd96df2140a..13818cc721721ca84e5d59eb6ff646f0f3ee2f61 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_argmin_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_argmin_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserArgmin : public TestTfliteParser { public: TestTfliteParserArgmin() = default; @@ -40,4 +40,4 @@ TEST_F(TestTfliteParserArgmin, AttrValue) { ASSERT_EQ(val->out_max_value, false); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_arithmetic_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_arithmetic_parser_test.cc index b2082a7e24479685432efbda25e406de050d1608..a0fba778620786cb9d71ab583cbd00f40ff1e9b6 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_arithmetic_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_arithmetic_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { // doubleInputOp class TestTfliteParserAdd : public TestTfliteParser { public: @@ -391,4 +391,4 @@ TEST_F(TestTfliteParserLessEqual, OpType) { ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_LessEqual) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_batch_to_space_nd_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_batch_to_space_nd_parser_test.cc index 3be3b051f79f8cc6e60a5e8012bec7dcc576efbc..93d9d5382576057dad6ba3582f982c5087fdbae5 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_batch_to_space_nd_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_batch_to_space_nd_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserBatchToSpaceNd : public TestTfliteParser { public: TestTfliteParserBatchToSpaceNd() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserBatchToSpaceNd, AttrValue) { ASSERT_EQ(val->block_size, blockShape); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_cast_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_cast_parser_test.cc index 22f4694d46b4d46fdaf73aab2cafba480d223baa..a60b16236c841a46cf8b606de28cd5a25515e379 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_cast_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_cast_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserCast : public TestTfliteParser { public: TestTfliteParserCast() = default; @@ -31,4 +31,4 @@ TEST_F(TestTfliteParserCast, OpType) { ASSERT_NE(meta_graph->nodes.front()->primitive.get(), nullptr); ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_Cast) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_concat_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_concat_parser_test.cc index 9bc99104117cda6f6df860f70b1022316e67e3fb..50b023fbf3844d7dc7c5d2a5276f9f43563d6da3 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_concat_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_concat_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserConcat : public TestTfliteParser { public: TestTfliteParserConcat() = default; @@ -37,4 +37,4 @@ TEST_F(TestTfliteParserConcat, AttrValue) { ASSERT_EQ(val->axis, 1); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_conv_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_conv_parser_test.cc index ca1561c61a75d38ae1a8497b6f432082c9c4b897..e135ac86367d695f3f954a8f9b428c4f282d4bb8 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_conv_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_conv_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserConv : public TestTfliteParser { public: TestTfliteParserConv() = default; @@ -46,4 +46,4 @@ TEST_F(TestTfliteParserConv, AttrValue) { ASSERT_EQ(val->pad_list, (std::vector{1, 1, 1, 1})); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_deconv_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_deconv_parser_test.cc index 5344644a476c6a134203ba527cbe1549efb83168..73e1105f7b2eede70e2341d505986b366681ede4 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_deconv_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_deconv_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserDeConv : public TestTfliteParser { public: TestTfliteParserDeConv() = default; @@ -48,4 +48,4 @@ TEST_F(TestTfliteParserDeConv, AttrValue) { ASSERT_EQ(val->pad_list, (std::vector{1, 1, 1, 1})); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_depth_to_space_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_depth_to_space_parser_test.cc index 490617ca2075ddc85b7418f7b28f9b29417341b3..71fdb7bb3871135037682351907709f58003e270 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_depth_to_space_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_depth_to_space_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserDepthToSpace : public TestTfliteParser { public: TestTfliteParserDepthToSpace() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserDepthToSpace, AttrValue) { ASSERT_EQ(val->block_size, 4); ASSERT_EQ(val->format, schema::Format_NHWC); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_depthwise_conv_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_depthwise_conv_parser_test.cc index db9d8eeefb18efb27ce343ae9c87a8461fd61cea..6b2d321e0c9591626cfb889c012f3db15b13bcbc 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_depthwise_conv_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_depthwise_conv_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserDepthwiseConv1 : public TestTfliteParser { public: TestTfliteParserDepthwiseConv1() = default; @@ -72,4 +72,4 @@ TEST_F(TestTfliteParserDepthwiseConv2, AttrValue) { ASSERT_EQ(val->pad_list, (std::vector{1, 1, 1, 1})); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_fill_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_fill_parser_test.cc index 2b322e92a0285b5c84c661701b7dbf7ac1dfcdb5..f1b268aa2551902acb5327c5cf6fb667439830fb 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_fill_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_fill_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserFill : public TestTfliteParser { public: TestTfliteParserFill() = default; @@ -30,4 +30,4 @@ TEST_F(TestTfliteParserFill, OpType) { ASSERT_NE(meta_graph->nodes.front()->primitive.get(), nullptr); ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_Fill) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_gather_nd_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_gather_nd_parser_test.cc index b70751d01a329146eb631bd741326ea27d07f445..aa5b791e7830d2658cf5c09c408222d0bfca465f 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_gather_nd_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_gather_nd_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserGatherNd : public TestTfliteParser { public: TestTfliteParserGatherNd() = default; @@ -35,4 +35,4 @@ TEST_F(TestTfliteParserGatherNd, AttrValue) { ASSERT_NE(meta_graph->nodes.front()->primitive->value.AsGatherNd(), nullptr); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_gather_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_gather_parser_test.cc index fb6f5d5aee2334e23a7e68e5b831c9ff98ca8b75..1596123bf03eea9e3ce47f225d992ff6b4e8fd98 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_gather_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_gather_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserGather : public TestTfliteParser { public: TestTfliteParserGather() = default; @@ -30,4 +30,4 @@ TEST_F(TestTfliteParserGather, OpType) { ASSERT_NE(meta_graph->nodes.front()->primitive.get(), nullptr); ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_Gather) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_l2norm_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_l2norm_parser_test.cc index 1cf02148880326db1cae6fb212e1226132d281de..1e469265fcb67a637913e5c934933c789291f7df 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_l2norm_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_l2norm_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserL2Norm : public TestTfliteParser { public: TestTfliteParserL2Norm() = default; @@ -40,4 +40,4 @@ TEST_F(TestTfliteParserL2Norm, AttrValue) { ASSERT_EQ(val->axis, axis); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_logical_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_logical_parser_test.cc index 6c5cc0516058cf9793d4f2dd4854d0d361b11fcb..9492420d1a5d863c7ac2d6389fae19bde078aab2 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_logical_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_logical_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteLogicalParserAnd : public TestTfliteParser { public: TestTfliteLogicalParserAnd() = default; @@ -57,4 +57,4 @@ TEST_F(TestTfliteParserLogicalOr, OpType) { ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_LogicalOr) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_lrn_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_lrn_parser_test.cc index ada5b5989f5a068a414b8db8b1a64e309a44a5e2..035b245ef0d230501e2e22c297dc267e3bb03579 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_lrn_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_lrn_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserLRN : public TestTfliteParser { public: TestTfliteParserLRN() = default; @@ -40,4 +40,4 @@ TEST_F(TestTfliteParserLRN, AttrValue) { ASSERT_EQ(val->depth_radius, 5); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_one_hot_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_one_hot_parser_test.cc index 5670b174a7b4d1108a5b55db9af0512545cc5069..9cf7e1fc2f766d11d8999de12c07c520c968d0cf 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_one_hot_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_one_hot_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserOneHot : public TestTfliteParser { public: TestTfliteParserOneHot() = default; @@ -37,4 +37,4 @@ TEST_F(TestTfliteParserOneHot, AttrValue) { ASSERT_EQ(val->axis, 2); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_pad_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_pad_parser_test.cc index 880a2d8451f7f115544d73d9dc4f08903b875bb5..a674c8a242c7824eea7de481aa3361123efa2e78 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_pad_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_pad_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserPad : public TestTfliteParser { public: TestTfliteParserPad() = default; @@ -35,4 +35,4 @@ TEST_F(TestTfliteParserPad, AttrValue) { ASSERT_NE(meta_graph->nodes.front()->primitive->value.AsPadFusion(), nullptr); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_parsers_test_utils.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_parsers_test_utils.cc index e7002674a60cc49404af78a5b11467c4904d8ded..068f8666558edf5474590183101680018cce475e 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_parsers_test_utils.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_parsers_test_utils.cc @@ -18,7 +18,7 @@ #include #include "schema/inner/model_generated.h" -namespace mindspore { +namespace mindspore::lite { schema::MetaGraphT *TestTfliteParser::LoadAndConvert(const std::string &model_path, const std::string &weight_path) { return nullptr; @@ -26,4 +26,4 @@ schema::MetaGraphT *TestTfliteParser::LoadAndConvert(const std::string &model_pa void TestTfliteParser::TearDown() { free(meta_graph); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h index 3748007cee8fc3c965798f3fee6d7b7cf1b6bb13..30b11be7e55883c75dc3a1a1b3b2964e3c6e3ddf 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h @@ -21,7 +21,7 @@ #include "common/common_test.h" #include "schema/inner/model_generated.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParser : public CommonTest { public: TestTfliteParser() = default; @@ -30,6 +30,6 @@ class TestTfliteParser : public CommonTest { schema::MetaGraphT *meta_graph = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TEST_UT_TOOLS_CONVERTER_PARSER_TFLITE_TFLITE_PARSERS_TEST_UTILS_H_ diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_pooling_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_pooling_parser_test.cc index b39e49373e92f19d8e382652cbf177eae401ea94..dcec88a1512e187e3763b1a6a4d1d031201eb76a 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_pooling_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_pooling_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserMaxPooling : public TestTfliteParser { public: TestTfliteParserMaxPooling() = default; @@ -68,4 +68,4 @@ TEST_F(TestTfliteParserAvgPooling, AttrValue) { ASSERT_EQ(val->pad_mode, schema::PadMode_SAME); ASSERT_EQ(val->round_mode, schema::RoundMode_FLOOR); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reduce_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reduce_parser_test.cc index 0ec1554e96a59a93666778b94161ae9cee3b07c5..fdcb221ccffa795da6938959a1276ab4f6f968d6 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reduce_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reduce_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserReduceMax : public TestTfliteParser { public: TestTfliteParserReduceMax() = default; @@ -122,4 +122,4 @@ TEST_F(TestTfliteParserMean, AttrValue) { // reduceAny -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reshape_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reshape_parser_test.cc index c046b11628abf9282e5c0debf869995c471c703a..78d891624f7bff9ac277fc443a9e676da6fcfdee 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reshape_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reshape_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserReshape : public TestTfliteParser { public: TestTfliteParserReshape() = default; @@ -31,4 +31,4 @@ TEST_F(TestTfliteParserReshape, OpType) { ASSERT_NE(meta_graph->nodes.front()->primitive.get(), nullptr); ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_Reshape) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_resize_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_resize_parser_test.cc index ffa2f1aa5458a24e14ad81d8ea492495f5c9261f..ffd3bef6d173bd5eac118944ab4be1cc93f89660 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_resize_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_resize_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserResizeNN : public TestTfliteParser { public: @@ -65,4 +65,4 @@ TEST_F(TestTfliteParserResizeBilinear, AttrValue) { ASSERT_EQ(val->method, schema::ResizeMethod_LINEAR); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reverse_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reverse_parser_test.cc index 80b7cd2dc33718569fd56dd2a52c8dfcad40df87..7b43bef5d693947c0435928acdf8c04a2434c50a 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reverse_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reverse_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserReverse : public TestTfliteParser { public: TestTfliteParserReverse() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserReverse, AttrValue) { ASSERT_EQ(val->axis, axis); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reverse_sequence_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reverse_sequence_parser_test.cc index 46f77c6359487c54bd9c1f1d40595a4a055e312b..6dc5dd38ab74ddfc27a871f42ac6f5333057768d 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reverse_sequence_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_reverse_sequence_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserReverseSequence : public TestTfliteParser { public: TestTfliteParserReverseSequence() = default; @@ -37,4 +37,4 @@ TEST_F(TestTfliteParserReverseSequence, AttrValue) { auto val = meta_graph->nodes.front()->primitive->value.AsReverseSequence(); ASSERT_EQ(val->seq_dim, 1); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_slice_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_slice_parser_test.cc index 4a7c0308e5886bee0bd8977d574a0980ab83e499..3e5e879169f56ab493e5a66bb78407c757230c32 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_slice_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_slice_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserSlice : public TestTfliteParser { public: TestTfliteParserSlice() = default; @@ -36,4 +36,4 @@ TEST_F(TestTfliteParserSlice, AttrValue) { ASSERT_NE(meta_graph->nodes.front()->primitive->value.AsSliceFusion(), nullptr); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_softmax_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_softmax_parser_test.cc index 368e09e8c00efaf8408997e55b45fa736a569696..aed116f73699aa399e7ff647e3901c4c443451b0 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_softmax_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_softmax_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserSoftmax : public TestTfliteParser { public: TestTfliteParserSoftmax() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserSoftmax, AttrValue) { ASSERT_EQ(val->axis[0], -1); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser_test.cc index 25feb24b127b8b076ce3a2b8a306e7a30d8a4541..bb71563018ec2f8fd6fab8b925b4bd8791e9aad8 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_space_to_batch_nd_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserSpaceToBatchND : public TestTfliteParser { public: TestTfliteParserSpaceToBatchND() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserSpaceToBatchND, AttrValue) { std::vector blockshape = {2, 2}; ASSERT_EQ(val->block_shape, blockshape); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_space_to_depth_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_space_to_depth_parser_test.cc index ba6f911119dea5f397ee53a086110cde7eef81c0..fee63a88c75c24099295f2bbd9a0a5a19fdfc4b7 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_space_to_depth_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_space_to_depth_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserSpaceToDepth : public TestTfliteParser { public: TestTfliteParserSpaceToDepth() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserSpaceToDepth, AttrValue) { ASSERT_EQ(val->block_size, 2); ASSERT_EQ(val->format, schema::Format_NHWC); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_sparse_to_dense_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_sparse_to_dense_parser_test.cc index 0c9fe1b4bcb9de45f9acd5e978f83a6b5e68ac4f..eb5190e1a44e45804298d49f50c34307efbe5e5f 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_sparse_to_dense_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_sparse_to_dense_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserSparseToDense : public TestTfliteParser { public: TestTfliteParserSparseToDense() = default; @@ -31,4 +31,4 @@ TEST_F(TestTfliteParserSparseToDense, OpType) { ASSERT_NE(meta_graph->nodes.front()->primitive.get(), nullptr); ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_SparseToDense) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_split_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_split_parser_test.cc index d4575caa849f1bb7d26c57d027de6897504dbcf0..3b5cae9bb632ed9acb75b6ecdeff8cdd7526a6e9 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_split_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_split_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserSplit : public TestTfliteParser { public: TestTfliteParserSplit() = default; @@ -41,4 +41,4 @@ TEST_F(TestTfliteParserSplit, AttrValue) { ASSERT_EQ(val->size_splits, sizeSplits); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_split_v_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_split_v_parser_test.cc index 45147f0a374b3dca47d46b5771e2e11bc162cc94..82cd250baaab6988cdd9016bfb834719beb2b9a1 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_split_v_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_split_v_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserSplitV : public TestTfliteParser { public: TestTfliteParserSplitV() = default; @@ -41,4 +41,4 @@ TEST_F(TestTfliteParserSplitV, AttrValue) { ASSERT_EQ(val->size_splits, sizeSplits); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_stack_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_stack_parser_test.cc index 750c03e15e1c7fee158f63016d003abbca460cc0..dd196eadef0a2bc0022e6670c7880d27b3166894 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_stack_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_stack_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserStack : public TestTfliteParser { public: TestTfliteParserStack() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserStack, AttrValue) { ASSERT_EQ(val->axis, 1); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_strided_slice_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_strided_slice_parser_test.cc index adff97706b74cc17cc57e0922a92dc5eb3f1c4fe..eb04e969fde37516f4f2ba588c4a32e1a7bebd92 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_strided_slice_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_strided_slice_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserStridedSlice : public TestTfliteParser { public: TestTfliteParserStridedSlice() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserStridedSlice, AttrValue) { ASSERT_EQ(val->end_mask, 0); ASSERT_EQ(val->begin_mask, 0); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_tile_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_tile_parser_test.cc index c32603d38a8b5af07d35e92dabb5786dc2843dc9..89e68633365e29b067763e57174fe58f2e0595f3 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_tile_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_tile_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserTile : public TestTfliteParser { public: TestTfliteParserTile() = default; @@ -38,4 +38,4 @@ TEST_F(TestTfliteParserTile, AttrValue) { std::vector dims = {2, 3, 4}; ASSERT_EQ(val->dims, dims); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_topk_v2_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_topk_v2_parser_test.cc index a41db8321d0156a17fde9252012ac177ed81f789..c6eea16978ce3fc75a2126c1c2e0fd4bb8a4ce48 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_topk_v2_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_topk_v2_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserTopKV2 : public TestTfliteParser { public: TestTfliteParserTopKV2() = default; @@ -37,4 +37,4 @@ TEST_F(TestTfliteParserTopKV2, AttrValue) { auto val = meta_graph->nodes.front()->primitive->value.AsTopKFusion(); ASSERT_EQ(val->sorted, true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_transpose_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_transpose_parser_test.cc index 4dde04af5961bb228cd04b7b34f469a09c917ab1..4dc500b49aca4f730bf3cc01bb5fc5adca92ed3f 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_transpose_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_transpose_parser_test.cc @@ -17,7 +17,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserTranspose : public TestTfliteParser { public: TestTfliteParserTranspose() = default; @@ -32,4 +32,4 @@ TEST_F(TestTfliteParserTranspose, OpType) { ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_Transpose) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_unique_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_unique_parser_test.cc index 444a2cd1a0fd2df031d9929ac0105d8e03a29f74..c3e5f103f8d113a03a59be5f8222d922040b40b4 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_unique_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_unique_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserUnique : public TestTfliteParser { public: TestTfliteParserUnique() = default; @@ -31,4 +31,4 @@ TEST_F(TestTfliteParserUnique, OpType) { ASSERT_NE(meta_graph->nodes.front()->primitive.get(), nullptr); ASSERT_EQ(meta_graph->nodes.front()->primitive->value.type, schema::PrimitiveType_Unique) << "wrong Op Type"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_unstack_parser_test.cc b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_unstack_parser_test.cc index 330d00d1921f587739d41e22f8427d526b82cbad..cd97d2c93d25da25a9823e4577383c373c5b06cb 100644 --- a/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_unstack_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/parser/tflite/tflite_unstack_parser_test.cc @@ -18,7 +18,7 @@ #include "ut/tools/converter/parser/tflite/tflite_parsers_test_utils.h" #include "common/common_test.h" -namespace mindspore { +namespace mindspore::lite { class TestTfliteParserUnstack : public TestTfliteParser { public: TestTfliteParserUnstack() = default; @@ -37,4 +37,4 @@ TEST_F(TestTfliteParserUnstack, AttrValue) { auto val = meta_graph->nodes.front()->primitive->value.AsUnstack(); ASSERT_EQ(val->axis, 1); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/registry/model_parser_registry_test.cc b/mindspore-lite/test/ut/tools/converter/registry/model_parser_registry_test.cc index 9f57da024b487116e5aebeca0edf254c3bb349f0..0b197dc7b3f969002113e887f7e63b3d61eab768 100644 --- a/mindspore-lite/test/ut/tools/converter/registry/model_parser_registry_test.cc +++ b/mindspore-lite/test/ut/tools/converter/registry/model_parser_registry_test.cc @@ -28,7 +28,7 @@ using mindspore::converter::ConverterParameters; using mindspore::converter::kFmkTypeCaffe; -namespace mindspore { +namespace mindspore::lite { namespace { FuncGraphPtr ConvertGraph(api::FuncGraphPtr func_graph) { auto impl = func_graph->impl(); @@ -74,4 +74,4 @@ TEST_F(ModelParserRegistryTest, TestRegistry) { ASSERT_EQ(is_return, true); delete model_parser; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/registry/node_parser_registry_test.cc b/mindspore-lite/test/ut/tools/converter/registry/node_parser_registry_test.cc index d23e401b19e763344c20e6b2b68f324222a60dc2..0636f5a617f50a3bcce87339ae847f02d09b5ff7 100644 --- a/mindspore-lite/test/ut/tools/converter/registry/node_parser_registry_test.cc +++ b/mindspore-lite/test/ut/tools/converter/registry/node_parser_registry_test.cc @@ -27,7 +27,7 @@ #include "mindspore/core/include/ir/graph_utils.h" using mindspore::converter::kFmkTypeTf; -namespace mindspore { +namespace mindspore::lite { namespace converter { class AddNodeParser : public NodeParser { public: @@ -81,4 +81,4 @@ TEST_F(NodeParserRegistryTest, TestRegistry) { auto prim = api::GetValueNode(cnode->input(0)); ASSERT_NE(prim, nullptr); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/registry/parser/model_parser_test.cc b/mindspore-lite/test/ut/tools/converter/registry/parser/model_parser_test.cc index f15f60ffb9a9bb8e25b80a584848c0ced3d72f10..7746a025d38a4844c72df7dc2d5369ea2b7ff406 100644 --- a/mindspore-lite/test/ut/tools/converter/registry/parser/model_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/registry/parser/model_parser_test.cc @@ -25,7 +25,7 @@ #include "mindapi/ir/tensor.h" #include "infer/return.h" -namespace mindspore { +namespace mindspore::lite { api::FuncGraphPtr ModelParserTest::Parse(const converter::ConverterParameters &flag) { // construct funcgraph res_graph_ = api::FuncGraph::Create(); @@ -173,4 +173,4 @@ converter::ModelParser *TestModelParserCreator() { } return model_parser; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/registry/parser/model_parser_test.h b/mindspore-lite/test/ut/tools/converter/registry/parser/model_parser_test.h index d7162984c7d1b32171e41800d9f382141f685ae1..5a5dffb6c50af88c8373b251f625935aa142c4ba 100644 --- a/mindspore-lite/test/ut/tools/converter/registry/parser/model_parser_test.h +++ b/mindspore-lite/test/ut/tools/converter/registry/parser/model_parser_test.h @@ -25,7 +25,7 @@ #include "mindapi/ir/anf.h" #include "ut/tools/converter/registry/parser/node_parser_test.h" -namespace mindspore { +namespace mindspore::lite { class ModelParserTest : public converter::ModelParser { public: ModelParserTest() = default; @@ -42,6 +42,6 @@ class ModelParserTest : public converter::ModelParser { }; converter::ModelParser *TestModelParserCreator(); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TEST_UT_TOOLS_CONVERTER_REGISTRY_PARSER_MODEL_PARSER_TEST_H_ diff --git a/mindspore-lite/test/ut/tools/converter/registry/parser/node_parser_test.cc b/mindspore-lite/test/ut/tools/converter/registry/parser/node_parser_test.cc index bfc1e0c0fc0556c41fb2c079791a8c6087d9190b..0d94a8873162dcafb10c0d77887098933c4a050b 100644 --- a/mindspore-lite/test/ut/tools/converter/registry/parser/node_parser_test.cc +++ b/mindspore-lite/test/ut/tools/converter/registry/parser/node_parser_test.cc @@ -25,7 +25,7 @@ #include "infer/cxx_api/add_fusion.h" #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" -namespace mindspore { +namespace mindspore::lite { class AddNodeParserTest : public NodeParserTest { public: AddNodeParserTest() = default; @@ -87,4 +87,4 @@ REGISTER_NODE_PARSER_TEST(kAdd, std::make_shared()) REGISTER_NODE_PARSER_TEST(kSplit, std::make_shared()) REGISTER_NODE_PARSER_TEST(kConcat, std::make_shared()) REGISTER_NODE_PARSER_TEST(kProposal, std::make_shared()) -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/registry/parser/node_parser_test.h b/mindspore-lite/test/ut/tools/converter/registry/parser/node_parser_test.h index c102a100a86e840dde53d9f85a3fa457f7a13499..6aa17607ffb7cfd974ba224f3d17c7116ddbd162 100644 --- a/mindspore-lite/test/ut/tools/converter/registry/parser/node_parser_test.h +++ b/mindspore-lite/test/ut/tools/converter/registry/parser/node_parser_test.h @@ -24,7 +24,7 @@ #include "mindapi/base/shared_ptr.h" #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { using BaseOperatorPtr = api::SharedPtr; class NodeParserTest { public: @@ -68,5 +68,5 @@ class RegisterNodeParserTest { #define REGISTER_NODE_PARSER_TEST(name, node_parser) \ static RegisterNodeParserTest g_##name##_node_parser(name, node_parser); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TEST_UT_TOOLS_CONVERTER_REGISTRY_PARSER_NODE_PARSER_TEST_H_ diff --git a/mindspore-lite/test/ut/tools/converter/registry/pass_registry_position_ascend.cc b/mindspore-lite/test/ut/tools/converter/registry/pass_registry_position_ascend.cc index 8c5863fcceaecefeb33a76c7adf63adbddd4774e..909da4e73e6cb0580e74fc7e6f56117e70169029 100644 --- a/mindspore-lite/test/ut/tools/converter/registry/pass_registry_position_ascend.cc +++ b/mindspore-lite/test/ut/tools/converter/registry/pass_registry_position_ascend.cc @@ -24,7 +24,7 @@ #include "src/common/log_adapter.h" using mindspore::registry::POSITION_ASCEND; -namespace mindspore { +namespace mindspore::lite { class PassRegistryPositionAscendTest : public mindspore::CommonTest { public: PassRegistryPositionAscendTest() = default; @@ -55,4 +55,4 @@ TEST_F(PassRegistryPositionAscendTest, RunPassAtPositionAscend) { ASSERT_EQ(ret, true); MS_LOG(INFO) << "PASS"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/converter/registry/pass_registry_test.cc b/mindspore-lite/test/ut/tools/converter/registry/pass_registry_test.cc index 10aa1d1a24458f62bd082f56fa15484e19fd6167..6d6a31bc84e243aef0714dd6fe1715a5414287a5 100644 --- a/mindspore-lite/test/ut/tools/converter/registry/pass_registry_test.cc +++ b/mindspore-lite/test/ut/tools/converter/registry/pass_registry_test.cc @@ -40,7 +40,7 @@ using mindspore::converter::ConverterParameters; using mindspore::converter::kFmkTypeCaffe; using mindspore::registry::POSITION_BEGIN; -namespace mindspore { +namespace mindspore::lite { namespace { FuncGraphPtr ConvertGraph(api::FuncGraphPtr func_graph) { auto impl = func_graph->impl(); @@ -245,4 +245,4 @@ TEST_F(PassRegistryTest, TestRegistry) { bool is_return = opt::CheckPrimitiveType(cnode_list.back(), prim::kPrimReturn); ASSERT_EQ(is_return, true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/activation_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/activation_fusion_test.cc index f0ffb008738bea6874362cfdaf0bc64cda264658..59c7bcb595896ac137ded04ed8f79f3e0ff69552 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/activation_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/activation_fusion_test.cc @@ -24,7 +24,7 @@ #include "tools/lite_exporter/anf_exporter.h" #include "test/common/import_from_meta_graphT.h" -namespace mindspore { +namespace mindspore::lite { class ActivationFusionTest : public mindspore::CommonTest { public: ActivationFusionTest() = default; @@ -148,4 +148,4 @@ TEST_F(ActivationFusionTest, TestBadCase_ReluSigmoid) { ASSERT_EQ(first_node->primitive->value.AsActivation()->activation_type, schema::ActivationType_RELU); ASSERT_EQ(second_node->primitive->value.AsActivation()->activation_type, schema::ActivationType_SIGMOID); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/add_concat_act_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/add_concat_act_fusion_test.cc index ba3955782c978245d5fa88d829b4de34022c0397..d98caaffa099565212f9087198cb38283e78d2ef 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/add_concat_act_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/add_concat_act_fusion_test.cc @@ -25,7 +25,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "test/common/import_from_meta_graphT.h" -namespace mindspore { +namespace mindspore::lite { constexpr size_t kAddInputTensorWSize = 128; constexpr size_t kConcatInputTensorWDims = 256; constexpr size_t kGraphNodeSize = 3; @@ -166,4 +166,4 @@ TEST_F(AddConcatActivationFusionTest, TestAddConcatReluNode) { } } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/constant_folding_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/constant_folding_fusion_test.cc index 41f62eb74b4fb2382a71738452e3dd7efc049daf..b0d04c3905fef157a5636e73b5af6823b403bd11 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/constant_folding_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/constant_folding_fusion_test.cc @@ -25,7 +25,7 @@ #include "tools/lite_exporter/anf_exporter.h" #include "test/common/import_from_meta_graphT.h" -namespace mindspore { +namespace mindspore::lite { class ConstantFoldingFusionTest : public mindspore::CommonTest { public: ConstantFoldingFusionTest() = default; @@ -590,4 +590,4 @@ TEST_F(ConstantFoldingFusionTest, TestSplitConstantFold) { auto new_meta_graph = lite::Export(new_graph); ASSERT_EQ(new_meta_graph->nodes.size(), 0); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/conv_activation_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/conv_activation_fusion_test.cc index cd6c5b84ad82aace02913cbbec8ea026da9d2f87..dab6e7e49632fe08193f6fd1358c85e23c445cff 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/conv_activation_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/conv_activation_fusion_test.cc @@ -24,7 +24,7 @@ #include "tools/lite_exporter/anf_exporter.h" #include "test/common/import_from_meta_graphT.h" -namespace mindspore { +namespace mindspore::lite { class ConvActivationFusionTest : public mindspore::CommonTest { public: ConvActivationFusionTest() = default; @@ -171,4 +171,4 @@ TEST_F(ConvActivationFusionTest, TestBadCase_ConvRelu) { } } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/conv_biasadd_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/conv_biasadd_fusion_test.cc index 4b3a5a308083dd835d48844314f8c3c234cd7eff..6e249baee8399528e0e597190b95d4103de50c8b 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/conv_biasadd_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/conv_biasadd_fusion_test.cc @@ -24,7 +24,7 @@ #include "tools/lite_exporter/anf_exporter.h" #include "test/common/import_from_meta_graphT.h" -namespace mindspore { +namespace mindspore::lite { class ConvBiasAddFusionTest : public mindspore::CommonTest { public: ConvBiasAddFusionTest() = default; @@ -170,4 +170,4 @@ TEST_F(ConvBiasAddFusionTest, TestBadCase_ConvAdd) { auto new_meta_graph = lite::Export(func_graph); ASSERT_EQ(new_meta_graph->nodes.size(), 2); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/conv_bn_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/conv_bn_fusion_test.cc index fec41e88edd611f5d0836e786523bff8f4fe3cc5..800a4a9bf6893005e2bb14cf79ec0f473f73185e 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/conv_bn_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/conv_bn_fusion_test.cc @@ -24,7 +24,7 @@ #include "tools/lite_exporter/anf_exporter.h" #include "test/common/import_from_meta_graphT.h" -namespace mindspore { +namespace mindspore::lite { class ConvBNFusionTest : public mindspore::CommonTest { public: ConvBNFusionTest() = default; @@ -276,4 +276,4 @@ TEST_F(ConvBNFusionTest, TestDeptiwiseConvAddNode) { auto new_meta_graph = lite::Export(func_graph); ASSERT_EQ(new_meta_graph->nodes.size(), 1); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/conv_scale_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/conv_scale_fusion_test.cc index af346fb1d53e5f8f11cd676619444e5b2c96c7d0..04786ae1f76c5f02840414c20a93377e78ad9af1 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/conv_scale_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/conv_scale_fusion_test.cc @@ -24,7 +24,7 @@ #include "tools/lite_exporter/anf_exporter.h" #include "test/common/import_from_meta_graphT.h" -namespace mindspore { +namespace mindspore::lite { class ConvScaleFusionTest : public mindspore::CommonTest { public: ConvScaleFusionTest() = default; @@ -206,4 +206,4 @@ TEST_F(ConvScaleFusionTest, TestDeptiwiseConvScaleNode) { } delete anf_transform; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/activation_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/activation_fusion_inout_test.cc index de4ee5bd2b0095952e8cc5a03270d3ff548504fa..30420fe5951dddef3535735eb6291cee7f680b99 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/activation_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/activation_fusion_inout_test.cc @@ -21,7 +21,7 @@ #include "nnacl_c/op_base.h" #include "infer/cxx_api/activation.h" -namespace mindspore { +namespace mindspore::lite { namespace { inline const int kActMinVal = -20; inline const int kActMaxVal = 6; @@ -81,4 +81,4 @@ class ActivationFusionInoutTest : public FusionInoutTest { }; TEST_F(ActivationFusionInoutTest, test) { ASSERT_EQ(DoTest(), true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/add_concat_act_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/add_concat_act_fusion_inout_test.cc index 5f304d4901d61c01d63670f762f46c3a074e8fb6..99bd022722eaf266c255af90a0c2e18e7d809a8d 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/add_concat_act_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/add_concat_act_fusion_inout_test.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "infer/cxx_api/add_fusion.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr size_t kAddInputTensorWSize = 128; } // namespace @@ -124,4 +124,4 @@ class ConcatActFusionInoutTest : public FusionInoutTest { }; TEST_F(ConcatActFusionInoutTest, test) { ASSERT_EQ(DoTest(), true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_act_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_act_fusion_inout_test.cc index c53b7eaf78066e9125bd1c513a9d608f6f783fe4..b04b521e32e1d0212c022777a9eaba04de1aaffd 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_act_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_act_fusion_inout_test.cc @@ -21,7 +21,7 @@ #include "nnacl_c/op_base.h" #include "infer/cxx_api/activation.h" -namespace mindspore { +namespace mindspore::lite { class ConvActFusionInoutTest : public ConvFusionInoutTest { public: ConvActFusionInoutTest() = default; @@ -72,4 +72,4 @@ class ConvActFusionInoutTest : public ConvFusionInoutTest { }; TEST_F(ConvActFusionInoutTest, test) { ASSERT_EQ(DoTest(), true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_bias_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_bias_fusion_inout_test.cc index be04c79d792de5c4d9496c60bc3654dd0fa17a18..ab5ba1040f05a34ad58bf101d50cafb357754121 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_bias_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_bias_fusion_inout_test.cc @@ -21,7 +21,7 @@ #include "nnacl_c/op_base.h" #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" -namespace mindspore { +namespace mindspore::lite { class ConvBiasFusionInoutTest : public ConvFusionInoutTest { public: ConvBiasFusionInoutTest() = default; @@ -72,4 +72,4 @@ class ConvBiasFusionInoutTest : public ConvFusionInoutTest { }; TEST_F(ConvBiasFusionInoutTest, test) { ASSERT_EQ(DoTest(), true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_fusion_inout_test.cc index ac5766cfa7572f77aa9b79aad384ccc1f43823f8..822ec797f15f0f8de464440890a4c58d5626056e 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_fusion_inout_test.cc @@ -22,7 +22,7 @@ #include "infer/cxx_api/conv2d_fusion.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { ValueNodePtr ConvFusionInoutTest::CreateConvPrimitiveValue() { auto prim = std::make_unique(); MS_CHECK_TRUE_MSG(prim != nullptr, nullptr, "create Conv2d primitivec failed"); @@ -44,4 +44,4 @@ CNodePtr ConvFusionInoutTest::AddConv(const FuncGraphPtr &graph, const AnfNodePt conv->set_fullname_with_scope(name); return conv; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_fusion_inout_test.h b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_fusion_inout_test.h index dc2bc7851b4c638e480840f25c6e3b7f513adc97..3cbe235c5237773b26b8108860b0b917fd7b385b 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_fusion_inout_test.h +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/conv_fusion_inout_test.h @@ -24,7 +24,7 @@ #include "include/backend/optimizer/optimizer.h" #include "include/backend/optimizer/pass_manager.h" -namespace mindspore { +namespace mindspore::lite { class ConvFusionInoutTest : public FusionInoutTest { public: ConvFusionInoutTest() = default; @@ -42,5 +42,5 @@ class ConvFusionInoutTest : public FusionInoutTest { static const int ih_ = 16; static const int iw_ = 16; }; -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/fusion_inout_test.cc index e3fb942e4ca9e341ca8460ba65c6c8afd08eb9b9..c002e15543a1e6ec100ef183ab19e733f2c83b0d 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/fusion_inout_test.cc @@ -28,7 +28,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore { +namespace mindspore::lite { FuncGraphPtr FusionInoutTest::Fuse() { if (graph_ == nullptr) { MS_LOG(WARNING) << "Graph not inited"; @@ -169,4 +169,4 @@ bool FusionInoutTest::DoTest() { auto new_outputs_num = GetOutputNumber(); return old_inputs == new_inputs && old_outputs_num == new_outputs_num; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/fusion_inout_test.h b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/fusion_inout_test.h index 42d3f3515b4757cd68a7a159a758c8c0a1a23b2d..bdae8bdef3c0308fd5ae7ac490916344105bd698 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/fusion_inout_test.h +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/fusion_inout_test.h @@ -26,7 +26,7 @@ #include "include/backend/optimizer/pass_manager.h" #include "src/common/log_util.h" -namespace mindspore { +namespace mindspore::lite { class FusionInoutTest : public mindspore::CommonTest { public: FusionInoutTest() = default; @@ -53,5 +53,5 @@ class FusionInoutTest : public mindspore::CommonTest { opt::PassPtr pass_ = nullptr; FuncGraphPtr graph_ = nullptr; }; -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_act_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_act_fusion_inout_test.cc index e6ea162de504f70e3ab216e0a4c7cace6e6621f0..8b3e1ebd22261f842975d5cedd09ba7e7ad9bba2 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_act_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_act_fusion_inout_test.cc @@ -22,7 +22,7 @@ #include "infer/cxx_api/mat_mul_fusion.h" #include "infer/cxx_api/activation.h" -namespace mindspore { +namespace mindspore::lite { class MatMulActivationFusionInoutTest : public FusionInoutTest { public: MatMulActivationFusionInoutTest() = default; @@ -90,4 +90,4 @@ class MatMulActivationFusionInoutTest : public FusionInoutTest { }; TEST_F(MatMulActivationFusionInoutTest, test) { ASSERT_EQ(DoTest(), true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_fusion_inout_test.cc index fefb608d9d06a76e0dfce18ebb5822a4119c8dc4..055cf89083e1abc7d37231d54f30ab99ed41face 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_fusion_inout_test.cc @@ -22,7 +22,7 @@ #include "infer/cxx_api/mat_mul_fusion.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { CNodePtr MatMulFusionInoutTest::AddMatMul(const FuncGraphPtr &graph, const AnfNodePtr &input1, const AnfNodePtr &input2, const ActivationType &act_type, const std::string &name) { auto prim = std::make_unique(); @@ -36,4 +36,4 @@ CNodePtr MatMulFusionInoutTest::AddMatMul(const FuncGraphPtr &graph, const AnfNo matmul->set_fullname_with_scope(name); return matmul; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_fusion_inout_test.h b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_fusion_inout_test.h index 578652883232083ede3c1fd1e9508d7a4ec0ff8e..cda33e78a835dcc34e740f171d04e9052e3f87ed 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_fusion_inout_test.h +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_fusion_inout_test.h @@ -26,7 +26,7 @@ #include "include/backend/optimizer/pass_manager.h" #include "infer/cxx_api/activation.h" -namespace mindspore { +namespace mindspore::lite { class MatMulFusionInoutTest : public FusionInoutTest { public: MatMulFusionInoutTest() = default; @@ -35,5 +35,5 @@ class MatMulFusionInoutTest : public FusionInoutTest { CNodePtr AddMatMul(const FuncGraphPtr &graph, const AnfNodePtr &input1, const AnfNodePtr &input2, const ActivationType &act_type, const std::string &name); }; -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_mul_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_mul_fusion_inout_test.cc index 5e6ac368d320b84595dc07efa428060fbce7cd3e..168dab2449148766f2be7520d5e8324db2ef8523 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_mul_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/matmul_mul_fusion_inout_test.cc @@ -22,7 +22,7 @@ #include "infer/cxx_api/mul_fusion.h" #include "infer/cxx_api/mat_mul_fusion.h" -namespace mindspore { +namespace mindspore::lite { class MatmulMulFusionInoutTest : public FusionInoutTest { public: MatmulMulFusionInoutTest() = default; @@ -90,4 +90,4 @@ class MatmulMulFusionInoutTest : public FusionInoutTest { }; TEST_F(MatmulMulFusionInoutTest, test) { ASSERT_EQ(DoTest(), true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/trans_matmul_fusion_inout_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/trans_matmul_fusion_inout_test.cc index 1d40ce2cf91395d41b52b85e169a0ba1b129ba55..60e53fe1526bc841de63b4f13df113baafbb809b 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/trans_matmul_fusion_inout_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/fusion_inout_test/trans_matmul_fusion_inout_test.cc @@ -22,7 +22,7 @@ #include "nnacl_c/op_base.h" #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" -namespace mindspore { +namespace mindspore::lite { namespace { inline const int kHeight = 5; inline const int kChannel = 3; @@ -88,4 +88,4 @@ class TransMatMulFusionInoutTest : public MatMulFusionInoutTest { }; TEST_F(TransMatMulFusionInoutTest, test) { ASSERT_EQ(DoTest(), true); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/matmul_mul_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/matmul_mul_fusion_test.cc index ec6818d84772f4a29624f4820b6e677d7f914257..3172baab69c153ee0dc8c07a8b6caf56006a0048 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/matmul_mul_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/matmul_mul_fusion_test.cc @@ -25,7 +25,7 @@ #include "test/common/import_from_meta_graphT.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kMatMulInputDimsM = 128; constexpr int kMatMulInputDimsK = 225; @@ -141,4 +141,4 @@ TEST_F(MatMulAddFusionTest, TestMatMulMulNode) { ASSERT_EQ(new_meta_graph->nodes.size(), 1); MS_LOG(INFO) << "Passed"; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/test/ut/tools/optimizer/fusion/trans_matmul_fusion_test.cc b/mindspore-lite/test/ut/tools/optimizer/fusion/trans_matmul_fusion_test.cc index be87aa062b32b741b9655f72968620f1b4c86d78..a1d54ee6f8c280cb3315f69d48454c8c2663d2b6 100644 --- a/mindspore-lite/test/ut/tools/optimizer/fusion/trans_matmul_fusion_test.cc +++ b/mindspore-lite/test/ut/tools/optimizer/fusion/trans_matmul_fusion_test.cc @@ -25,7 +25,7 @@ #include "tools/lite_exporter/anf_exporter.h" #include "test/common/import_from_meta_graphT.h" -namespace mindspore { +namespace mindspore::lite { class TransMatMulFusionTest : public mindspore::CommonTest { public: TransMatMulFusionTest() = default; @@ -209,4 +209,4 @@ TEST_F(TransMatMulFusionTest, TestBadCase_TransMatMul) { ASSERT_EQ(cnode->primitive->value.AsMatMulFusion()->transpose_a, false); ASSERT_EQ(cnode->primitive->value.AsMatMulFusion()->transpose_b, false); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/benchmark/benchmark_c_api.cc b/mindspore-lite/tools/benchmark/benchmark_c_api.cc index d66c65f6feab84e983c5658565d123abf71969b9..065f93aad9558b7424ab153f9e46327198da884e 100644 --- a/mindspore-lite/tools/benchmark/benchmark_c_api.cc +++ b/mindspore-lite/tools/benchmark/benchmark_c_api.cc @@ -24,7 +24,7 @@ using mindspore::lite::kFloatMSEC; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace tools { int BenchmarkCApi::LoadInput() { if (flags_->in_data_file_.empty()) { @@ -416,7 +416,7 @@ int BenchmarkCApi::InitDumpTensorDataCallbackParameter() { return RET_ERROR; } } // namespace tools -} // namespace mindspore +} // namespace mindspore::lite uint64_t g_op_begin_ = 0; int g_op_call_times_total_ = 0; diff --git a/mindspore-lite/tools/benchmark/benchmark_c_api.h b/mindspore-lite/tools/benchmark/benchmark_c_api.h index 4ba9649a1960247b2b67ee4afaf64462c593f65d..2a9073bd54cfc18c864415646e3af097448ae646 100644 --- a/mindspore-lite/tools/benchmark/benchmark_c_api.h +++ b/mindspore-lite/tools/benchmark/benchmark_c_api.h @@ -36,7 +36,7 @@ bool TimeAfterCallback(const MSTensorHandleArray inputs, const MSTensorHandleArr using mindspore::lite::BenchmarkBase; using mindspore::lite::BenchmarkFlags; -namespace mindspore::tools { +namespace mindspore::lite::tools { class MS_API BenchmarkCApi : public BenchmarkBase { public: explicit BenchmarkCApi(BenchmarkFlags *flags) : BenchmarkBase(flags) {} @@ -74,5 +74,5 @@ class MS_API BenchmarkCApi : public BenchmarkBase { MSKernelCallBackC before_call_back_ = nullptr; MSKernelCallBackC after_call_back_ = nullptr; }; -} // namespace mindspore::tools +} // namespace mindspore::lite::tools #endif // MINDSPORE_LITE_TOOLS_BENCHMARK_BENCHMARK_C_API_H_ diff --git a/mindspore-lite/tools/common/custom_ascend_utils.cc b/mindspore-lite/tools/common/custom_ascend_utils.cc index a3b466943140ee6d39156e7f44955bafe8271d50..ac970f7c545b0f72407d1ef2a7d158fdaaab7bb4 100644 --- a/mindspore-lite/tools/common/custom_ascend_utils.cc +++ b/mindspore-lite/tools/common/custom_ascend_utils.cc @@ -24,7 +24,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr auto kCustomPrimTypeACL = "ACL"; constexpr auto kCustomNodeName = "custom_0"; @@ -536,4 +536,4 @@ bool CustomAscendUtils::ParseCustomFuncGraph(const FuncGraphPtr &func_graph, ten *graph_name = input_last->fullname_with_scope(); return true; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/common/custom_ascend_utils.h b/mindspore-lite/tools/common/custom_ascend_utils.h index bec6d2db99a347962f9859f2b095c6eec3883080..d05814929d432774e9e17fa0b6424631da369819 100644 --- a/mindspore-lite/tools/common/custom_ascend_utils.h +++ b/mindspore-lite/tools/common/custom_ascend_utils.h @@ -34,7 +34,7 @@ #include "mindspore/ops/infer/custom.h" #include "src/common/common.h" -namespace mindspore { +namespace mindspore::lite { struct DynKVCacheSaveInfo { bool batch_size_dyn = false; bool seq_length_dyn = false; @@ -102,5 +102,5 @@ class MS_API CustomAscendUtils { static bool GetZeroValueRefDatas(const ops::PrimitiveCPtr &primc, std::vector> *ref_infos); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_EXTENDRT_UTILS_CUSTOM_ASCEND_UTILS_H_ diff --git a/mindspore-lite/tools/common/func_graph_utils.cc b/mindspore-lite/tools/common/func_graph_utils.cc index 73f7ec2a97ad1d2ba7f11e7983d7a3209639e134..14d49a482a92e92138ed73cd876337224ff076dc 100644 --- a/mindspore-lite/tools/common/func_graph_utils.cc +++ b/mindspore-lite/tools/common/func_graph_utils.cc @@ -19,7 +19,7 @@ #include #include "tools/common/graph_util.h" #include "tools/converter/converter_context.h" -namespace mindspore { +namespace mindspore::lite { AbstractBasePtr FuncGraphUtils::GetAbstractFromNode(const std::pair &node) { auto anfnode = node.first; MS_EXCEPTION_IF_NULL(anfnode); @@ -134,4 +134,4 @@ tensor::TensorPtr FuncGraphUtils::GetParameterConstValue(const AnfNodePtr &anf_n } return tensor; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/common/func_graph_utils.h b/mindspore-lite/tools/common/func_graph_utils.h index df2b3185b3580d6d18b591acfad74b2b1521e042..9175dfa5577d1b246a289a06bc4779aff0db9029 100644 --- a/mindspore-lite/tools/common/func_graph_utils.h +++ b/mindspore-lite/tools/common/func_graph_utils.h @@ -24,7 +24,7 @@ #include #include "ir/func_graph.h" -namespace mindspore { +namespace mindspore::lite { class FuncGraphUtils { public: static std::vector GetFuncGraphOutputNames(const FuncGraphPtr &func_graph); @@ -34,6 +34,6 @@ class FuncGraphUtils { static std::string GetOutputName(const std::pair &node_index); static tensor::TensorPtr GetParameterConstValue(const AnfNodePtr &anf_node); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOL_COMMON_FUNC_GRAPH_UTILS_H_ diff --git a/mindspore-lite/tools/common/opengl_util.cc b/mindspore-lite/tools/common/opengl_util.cc index dfa7537ca154fef93dd8f49d9588deed6771a4bc..c47256f13b31c901b3149ab643abbe283c266924 100644 --- a/mindspore-lite/tools/common/opengl_util.cc +++ b/mindspore-lite/tools/common/opengl_util.cc @@ -18,7 +18,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace OpenGL { #if defined(GPU_OPENCL) && defined(__ANDROID__) && defined(ENABLE_ARM64) const char *g_glsl_host_to_device_2d = @@ -494,4 +494,4 @@ GLuint OpenGLRuntime::CopyHostToDeviceTexture(void *hostData, int width, int hei void OpenGLRuntime::PrintImage2DData(float *data, int w, int h, int c) {} #endif } // namespace OpenGL -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/common/opengl_util.h b/mindspore-lite/tools/common/opengl_util.h index 9d13fae8954a5646a7bc30a2d3f0b0daa965b67c..49cd107a33ba17cec0307c6811f941422ca6a196 100644 --- a/mindspore-lite/tools/common/opengl_util.h +++ b/mindspore-lite/tools/common/opengl_util.h @@ -61,7 +61,7 @@ inline EGLContext eglGetCurrentDisplay(void) { return nullptr; } #define OPENGL_CHECK_ERROR #endif -namespace mindspore { +namespace mindspore::lite { namespace OpenGL { #define BIND_INDEX_0 0 #define BIND_INDEX_1 1 @@ -100,6 +100,6 @@ class OpenGLRuntime { EGLSurface m_surface_ = nullptr; }; } // namespace OpenGL -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_COMMON_OPENGL_UTIL_H_ diff --git a/mindspore-lite/tools/converter/adapter/acl/acl_pass.cc b/mindspore-lite/tools/converter/adapter/acl/acl_pass.cc index abb42f94b56e2d4c9e4d33e10a6ba6bdfe20a14d..cf8efb67fe36ebb3c39777b05292d8239e7ab7e0 100644 --- a/mindspore-lite/tools/converter/adapter/acl/acl_pass.cc +++ b/mindspore-lite/tools/converter/adapter/acl/acl_pass.cc @@ -20,7 +20,7 @@ #include "tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace opt { AclPass::AclPass(const std::shared_ptr ¶m) : Pass("ACL") { #ifdef ENABLE_LITE_ACL @@ -49,4 +49,4 @@ bool AclPass::Run(const FuncGraphPtr &func_graph) { #endif } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/acl_pass.h b/mindspore-lite/tools/converter/adapter/acl/acl_pass.h index 24cb5da5737d9826020d2a4d493e4c71abe25e94..b7db321f46e61e35ccdffc612da35ebf3282f90a 100644 --- a/mindspore-lite/tools/converter/adapter/acl/acl_pass.h +++ b/mindspore-lite/tools/converter/adapter/acl/acl_pass.h @@ -22,7 +22,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/converter/cxx_api/converter_para.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AclPassImpl; using AclPassImplPtr = std::shared_ptr; @@ -38,5 +38,5 @@ class AclPass : public Pass { AclPassImplPtr impl_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_ACL_ACL_PASS_H_ diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/acl_utils.h b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/acl_utils.h index 34cd7b323c0e8db37dd13d8a265ba18ae9e891d1..31392d392570e46dea58b980d7f433051309f05e 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/acl_utils.h +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/acl_utils.h @@ -22,7 +22,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_base_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { static inline bool IsAscend910Soc() { const char *soc_name_c = CALL_ASCEND_API(aclrtGetSocName); if (soc_name_c == nullptr) { @@ -56,6 +56,6 @@ static inline std::string TransforPrecisionToAcl(const std::string &precision_mo {"preferred_optimal", "allow_mix_precision"}}; return precision_map.find(precision_mode) != precision_map.end() ? precision_map.at(precision_mode) : precision_mode; } -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_CXX_API_ACL_UTILS_H diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/any_utils.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/any_utils.cc index bf44c7a9197ae00326538b6b4ee50aebdb41534e..ef0a80bdd37efb2ca5b5a90f7a0bc0b1dcad4947 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/any_utils.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/any_utils.cc @@ -16,7 +16,7 @@ #include "cxx_api/any_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { template >> static U GetValue(const std::map &any_map, const std::string &key) { @@ -94,4 +94,4 @@ std::map> GetAnyValueInputShape(const std::map>>(any_map, name); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/any_utils.h b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/any_utils.h index 9ec0bf805077178757483592873bb7e279b0a232..c36ed8e8c7408da0b279e089976596132b54e0a3 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/any_utils.h +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/any_utils.h @@ -24,7 +24,7 @@ #include "include/api/visible.h" #include "include/api/data_type.h" -namespace mindspore { +namespace mindspore::lite { // std::any is not support to access across shared libraries, so add an adapter to access std::any MS_API void SetAnyValue(std::any *any, bool value); MS_API void SetAnyValue(std::any *any, int value); @@ -40,5 +40,5 @@ MS_API DataType GetAnyValueDataType(const std::map &any_m MS_API std::string GetAnyValueStr(const std::map &any_map, const std::string &name); MS_API std::map> GetAnyValueInputShape(const std::map &any_map, const std::string &name); -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_CXX_API_ANY_UTILS_H_ diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/context.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/context.cc index 7bdb4a39e3eb2d71b3c88573d21cc1dc0cd71046..40036b67c3ff978fb6ccfec6675925314a9b00c0 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/context.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/context.cc @@ -39,7 +39,7 @@ constexpr auto KModelOptionAscend310FusionSwitchCfgPath = "mindspore.option.asce constexpr auto kModelOptionAscend310DynamicBatchSize = "mindspore.option.ascend310.dynamic_batch_size"; constexpr auto kModelOptionAscend310BufferOptimize = "mindspore.option.ascend310.buffer_optimize"; -namespace mindspore { +namespace mindspore::lite { class Allocator {}; struct Context::Data { @@ -308,4 +308,4 @@ std::vector AscendDeviceInfo::GetBufferOptimizeModeChar() const { const std::string &ref = GetAnyValueStr(data_->params, kModelOptionAscend310BufferOptimize); return StringToChar(ref); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/dlutils.h b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/dlutils.h index d4cb56172c29734b7a83e2173a66d96bb75b197c..c83ac93cd97116ebeded1a4f0df6af611a72aee4 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/dlutils.h +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/dlutils.h @@ -24,7 +24,7 @@ #include "include/api/status.h" #include "utils/file_utils.h" -namespace mindspore { +namespace mindspore::lite { inline Status DLSoPath(std::string *so_path) { if (so_path == nullptr) { return Status(kMEFailed, "Input so_path can not be nullptr."); @@ -102,6 +102,6 @@ inline void DLSoClose(void *handle) { } \ } while (false) -} // namespace mindspore +} // namespace mindspore::lite #endif #endif // MINDSPORE_CCSRC_CXX_API_DLUTILS_H_ diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/acl/acl_convert_init_adapter.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/acl/acl_convert_init_adapter.cc index d46c8de981724570bef21257bf77e9219cd90424..757326416d626c5f05835474dc07b2db2ad75d2e 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/acl/acl_convert_init_adapter.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/acl/acl_convert_init_adapter.cc @@ -21,7 +21,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { AclConvertInitAdapter &AclConvertInitAdapter::GetInstance() { static AclConvertInitAdapter instance = {}; return instance; @@ -73,4 +73,4 @@ void AclConvertInitAdapter::AclBuildFinalize() { ge::aclgrphBuildFinalize(); } } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/acl/acl_convert_init_adapter.h b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/acl/acl_convert_init_adapter.h index 81ccfbca83e553b9e6b0863ae0b0bdfe9fd4733a..ecbf02660bc4113f55e7bdff52e6e296459585b7 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/acl/acl_convert_init_adapter.h +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/acl/acl_convert_init_adapter.h @@ -24,7 +24,7 @@ #include "ge/ge_ir_build.h" #include "include/api/visible.h" -namespace mindspore { +namespace mindspore::lite { class MS_API AclConvertInitAdapter { public: static AclConvertInitAdapter &GetInstance(); @@ -43,5 +43,5 @@ class MS_API AclConvertInitAdapter { std::mutex flag_mutex_; std::mutex build_flag_mutex_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_CXX_API_GRAPH_ACL_ACL_ACL_CONVERT_INIT_ADAPTER_H diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/graph_data.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/graph_data.cc index 2781f9ec6b72f51ac6e9ec40c71cc11fe97d052f..dd83793e3c33dd987973c34999a0bbdafb3434f3 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/graph_data.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/graph_data.cc @@ -18,7 +18,7 @@ #include "utils/ms_context.h" #include "runtime/hardware_abstract/device_context/device_context_manager.h" -namespace mindspore { +namespace mindspore::lite { Graph::GraphData::GraphData(const FuncGraphPtr &func_graph, enum ModelType model_type) : func_graph_(nullptr), om_data_(), model_type_(ModelType::kUnknownType), data_graph_({}) { if (model_type != ModelType::kMindIR) { @@ -58,4 +58,4 @@ Buffer Graph::GraphData::GetOMData() const { void Graph::GraphData::SetPreprocess(const std::vector> &data_graph) { data_graph_ = data_graph; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/graph_data.h b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/graph_data.h index 168eeb531aeaebf97b4c7ae6704e772cec65e7ae..ec38f0e3f9f811e1a04e8bd5c5b18db696cfe03f 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/graph_data.h +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/graph/graph_data.h @@ -25,7 +25,7 @@ #include "include/dataset/execute.h" #include "ir/func_graph.h" -namespace mindspore { +namespace mindspore::lite { class Graph::GraphData { public: GraphData(); @@ -52,5 +52,5 @@ class Graph::GraphData { enum ModelType model_type_; std::vector> data_graph_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_CXX_API_GRAPH_GRAPH_DATA_H diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.cc index ca0ff14db3148fa484b5b4f410d41f79f43c3516..09d0f8e976fab14c902debdc4e5c2cdef0c703a9 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.cc @@ -22,7 +22,7 @@ #include "plugin/ascend/res_manager/symbol_interface/acl_base_symbol.h" #include "plugin/ascend/res_manager/symbol_interface/symbol_utils.h" -namespace mindspore { +namespace mindspore::lite { static const std::map kSupportedDtypeOptionMap = {{DataType::kNumberTypeFloat16, "FP16"}, {DataType::kNumberTypeFloat32, "FP32"}, {DataType::kNumberTypeUInt8, "UINT8"}}; @@ -223,4 +223,4 @@ std::string AclModelOptions::GenAclOptionsKey() const { } return key_str; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.h b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.h index b80fc24dfe85b86d39af2f1c2fcfa3b33d6a96d3..6cf65732059580a541b10ae7799c584a159fb2cb 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.h +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.h @@ -26,7 +26,7 @@ #include "include/api/status.h" #include "include/api/context.h" -namespace mindspore { +namespace mindspore::lite { class MS_API AclModelOptions { public: explicit AclModelOptions(const std::shared_ptr &context); @@ -90,6 +90,6 @@ class MS_API AclModelOptions { std::vector const_names_; bool is_last_model_ = false; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_CXXAPI_SESSION_ACL_OPTION_PARSER_H diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/model_converter.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/model_converter.cc index 235bea7a5dcd3476bf73176d09e5b478917eb760..1f8dbc4eeeaf2841de0e267242ad3641e98b7a01 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/model_converter.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/model_converter.cc @@ -29,7 +29,7 @@ #include "src/common/file_utils.h" #include "cxx_api/graph/acl/acl_convert_init_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace { // some config is not supported in the update subgraph, do not add to the update_options. e.g. lora weight update. const std::set update_options_blacklist = { @@ -249,4 +249,4 @@ Buffer ModelConverter::LoadAscendIRInner(const Buffer &model_data) { #endif return BuildAirModel(df_graph, init_options, build_options); } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/model_converter.h b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/model_converter.h index d64117a4a30547199320566414cb6817b0f31aab..52e509aa35bce34afe60f476e1b261e147a69a37 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/model_converter.h +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/model_converter.h @@ -26,7 +26,7 @@ #include "ge/ge_ir_build.h" #include "cxx_api/model/acl/acl_model_options.h" -namespace mindspore { +namespace mindspore::lite { class MS_API ModelConverter { public: ModelConverter() : options_() {} @@ -46,5 +46,5 @@ class MS_API ModelConverter { std::weak_ptr options_; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_CXXAPI_SESSION_ACL_MODEL_CONVERTER_H diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/aoe/auto_tune_process.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/aoe/auto_tune_process.cc index 316f81cfd5a9f76d1b31647e4ab807196812c3b6..772e6fb4da4717dd9ff58dfbfa5a3d86036bc7c6 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/aoe/auto_tune_process.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/aoe/auto_tune_process.cc @@ -23,7 +23,7 @@ #include #include "src/common/file_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr int kBuffSize = 1024; const std::map kTuneModeMap = {{"1", "subgraph tuning"}, {"2", "operator tuning"}}; @@ -155,4 +155,4 @@ Status AutoTuneProcess::AoeOfflineTurningGraph(const std::weak_ptr &options, const backend::ge_backend::DfGraphPtr &graph); }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_CCSRC_CXXAPI_MODEL_AOE_AUTO_TUNE_PROCESS_H diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/serialization.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/serialization.cc index 55a3dc26fb337a10d17c0acf96f575f8db24c60a..b6d73da20dc61b92d03437379da5da55c92d38c1 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/serialization.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/serialization.cc @@ -25,7 +25,7 @@ #endif #include "utils/crypto.h" -namespace mindspore { +namespace mindspore::lite { static Status RealPath(const std::string &file, std::string *realpath_str) { MS_EXCEPTION_IF_NULL(realpath_str); char real_path_mem[PATH_MAX] = {0}; @@ -350,4 +350,4 @@ Status Serialization::ExportWeightsCollaborateWithMicro(const Model &, ModelType MS_LOG(ERROR) << "Unsupported feature."; return kMEFailed; } -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/infer/flash_attention_infer.cc b/mindspore-lite/tools/converter/adapter/acl/infer/flash_attention_infer.cc index 3b738d7fcf7cb09dc2ae06f5f700582c3f595f19..3fa45543c98d6538cd67d5d0fa2cd917345dea23 100644 --- a/mindspore-lite/tools/converter/adapter/acl/infer/flash_attention_infer.cc +++ b/mindspore-lite/tools/converter/adapter/acl/infer/flash_attention_infer.cc @@ -21,7 +21,7 @@ #include "tools/converter/adapter/acl/common/acl_types.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr int kNumInputSize = 3; @@ -63,9 +63,9 @@ Status FlashAttentionInfer::Infer(std::vector *inputs, std: return kSuccess; } } // namespace kernel -} // namespace mindspore -namespace mindspore { +} // namespace mindspore::lite +namespace mindspore::lite { namespace kernel { REGISTER_CUSTOM_KERNEL_INTERFACE(ACL, FlashAttention, FlashAttentionInferCreater); } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/infer/flash_attention_infer.h b/mindspore-lite/tools/converter/adapter/acl/infer/flash_attention_infer.h index bac9f6698dda105a9f8948352fffff48eb61d664..4e5140f030e026559b2c948c92ac5d9310ce19d9 100644 --- a/mindspore-lite/tools/converter/adapter/acl/infer/flash_attention_infer.h +++ b/mindspore-lite/tools/converter/adapter/acl/infer/flash_attention_infer.h @@ -21,7 +21,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class FlashAttentionInfer : public mindspore::kernel::KernelInterface { public: @@ -33,5 +33,5 @@ class FlashAttentionInfer : public mindspore::kernel::KernelInterface { const mindspore::schema::Primitive *primitive) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_ACL_INFER_FLASHATTENTIONINFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/acl/infer/forward_rasterize_infer.cc b/mindspore-lite/tools/converter/adapter/acl/infer/forward_rasterize_infer.cc index b85d4eb42880319b13382b7230c3fc8afe047764..0c658ea2c010fbef45b1a976ca1a796332f2b39f 100644 --- a/mindspore-lite/tools/converter/adapter/acl/infer/forward_rasterize_infer.cc +++ b/mindspore-lite/tools/converter/adapter/acl/infer/forward_rasterize_infer.cc @@ -21,7 +21,7 @@ #include "tools/converter/adapter/acl/common/acl_types.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr uint32_t kNumOutputShape0 = 1; @@ -81,9 +81,9 @@ Status ForwardRasterizeInfer::Infer(std::vector *inputs, st return kSuccess; } } // namespace kernel -} // namespace mindspore -namespace mindspore { +} // namespace mindspore::lite +namespace mindspore::lite { namespace kernel { REGISTER_CUSTOM_KERNEL_INTERFACE(ACL, ForwardRasterize, ForwardRasterizeInferCreater); } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/infer/forward_rasterize_infer.h b/mindspore-lite/tools/converter/adapter/acl/infer/forward_rasterize_infer.h index 8630faa2b972f8dbb38d060c3ec18a459a402875..c8cb6754d87b7c890fa67be86e1a0fbb2661bef8 100644 --- a/mindspore-lite/tools/converter/adapter/acl/infer/forward_rasterize_infer.h +++ b/mindspore-lite/tools/converter/adapter/acl/infer/forward_rasterize_infer.h @@ -21,7 +21,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class ForwardRasterizeInfer : public mindspore::kernel::KernelInterface { public: @@ -33,5 +33,5 @@ class ForwardRasterizeInfer : public mindspore::kernel::KernelInterface { const mindspore::schema::Primitive *primitive) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_ACL_INFER_FORWARDRASTERIZE_H_ diff --git a/mindspore-lite/tools/converter/adapter/acl/plugin/acl_pass_plugin.cc b/mindspore-lite/tools/converter/adapter/acl/plugin/acl_pass_plugin.cc index ec9a7b3c57cf2c5c3bab1954bcd022fed0648232..2ae44e866800ca22c927f8e3d025f3415c3a5753 100644 --- a/mindspore-lite/tools/converter/adapter/acl/plugin/acl_pass_plugin.cc +++ b/mindspore-lite/tools/converter/adapter/acl/plugin/acl_pass_plugin.cc @@ -23,7 +23,7 @@ #include "extendrt/cxx_api/dlutils.h" #endif -namespace mindspore { +namespace mindspore::lite { namespace opt { std::mutex AclPassPlugin::mutex_; @@ -104,4 +104,4 @@ std::shared_ptr AclPassPlugin::CreateAclPassInner(const std::shared_ptr -namespace mindspore { +namespace mindspore::lite { namespace opt { class AclCustomOppInstaller { public: static bool InstallCustomOpp(const std::string &custom_opp_path, const std::string &cann_opp_path); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_ACL_SRC_ACL_CUSTOM_OPP_INSTALLER_H_ diff --git a/mindspore-lite/tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.cc b/mindspore-lite/tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.cc index 6471a73fc238cf4d3d7c94de267eff87b7d8cf12..3b7d91c290da6740770a3ea7a51fb5958f5e43c4 100644 --- a/mindspore-lite/tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.cc +++ b/mindspore-lite/tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.cc @@ -28,7 +28,7 @@ constexpr auto kCustomPrimTypeACL = "ACL"; constexpr auto kFuncType = "func_type"; constexpr auto kUniqueName = "uniq_name"; } // namespace -namespace mindspore { +namespace mindspore::lite { namespace opt { std::shared_ptr AclMemoryOffloadPassImpl::CreateCustomPrim() { auto custom_prim = std::make_shared(); @@ -130,4 +130,4 @@ bool AclMemoryOffloadPassImpl::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.h b/mindspore-lite/tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.h index b9b0c2073294566fcd6cb4375c036307d88d3204..ce9c97ffe12713b0f17452b815e30c1b030d4867 100644 --- a/mindspore-lite/tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.h +++ b/mindspore-lite/tools/converter/adapter/acl/src/acl_memory_offload_pass_impl.h @@ -20,7 +20,7 @@ #include #include "tools/converter/adapter/acl/src/acl_pass_impl.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AclMemoryOffloadPassImpl : public AclPassImpl { public: @@ -38,5 +38,5 @@ class AclMemoryOffloadPassImpl : public AclPassImpl { FuncGraphPtr CreateSingleOpFuncGraph(const CNodePtr &cnode); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_ACL_SRC_ACL_MEM_OFFLOAD_PASS_IMPL_H_ diff --git a/mindspore-lite/tools/converter/adapter/acl/src/acl_pass_impl.cc b/mindspore-lite/tools/converter/adapter/acl/src/acl_pass_impl.cc index 1f5a5eb52a39e35c8a12804b9eec2d3c3628b9b8..e6d8aa3efb90f6b62121db4c22707b85819a6504 100644 --- a/mindspore-lite/tools/converter/adapter/acl/src/acl_pass_impl.cc +++ b/mindspore-lite/tools/converter/adapter/acl/src/acl_pass_impl.cc @@ -105,7 +105,7 @@ #include "cxx_api/graph/acl/acl_convert_init_adapter.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { static const std::set kAdjustCnodeName = {"Resize", "Conv2dTransposeFusion", "Concat"}; static const std::map kEnumFormatToStrMap = {{Format::NCHW, "NCHW"}, {Format::NHWC, "NHWC"}}; @@ -1466,4 +1466,4 @@ bool AclPassImpl::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/acl/src/acl_pass_impl.h b/mindspore-lite/tools/converter/adapter/acl/src/acl_pass_impl.h index 74b72e38f036d67dc84f5ce14d4da98a390e75ee..bdc0709b8fc63ea86a57da59809c9376e4e8f02f 100644 --- a/mindspore-lite/tools/converter/adapter/acl/src/acl_pass_impl.h +++ b/mindspore-lite/tools/converter/adapter/acl/src/acl_pass_impl.h @@ -30,7 +30,7 @@ #include "infer/custom.h" #include "tools/converter/cxx_api/converter_para.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { using mindspore::converter::FmkType; using mindspore::lite::STATUS; @@ -94,5 +94,5 @@ class AclPassImpl { bool is_ptq_quant_ = false; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_ACL_SRC_ACL_PASS_IMPL_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/activation_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/activation_checker.cc index affa9c2697c8207a61dd9c626d385fa1e9ff2723..f91fbc8f6ba3941a60fd568e43f2b2f1facb0845 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/activation_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/activation_checker.cc @@ -20,7 +20,7 @@ #include "mindapi/base/types.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { const std::unordered_set kSupportedActivationTypes = { @@ -53,4 +53,4 @@ bool ActivationChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::F OpCheckerRegistrar g_ActivationChecker("Activation", new ActivationChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/activation_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/activation_checker.h index aac5a3d00be7fea62f9f862478a56b601ceca1fe..c6b508ca89f272de91cbed8a606e7c78ce593132 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/activation_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/activation_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ActivationChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ActivationChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_ACTIVATION_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/argmax_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/argmax_checker.cc index f4b573fcb1e1c235df1246b797fa7be2bdb9401b..beeba7f9f2c07145f47f357093bee08e54f490b0 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/argmax_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/argmax_checker.cc @@ -21,7 +21,7 @@ #include "common/op_attr.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool ArgMaxChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, 1, format, kMaxInputWOf4Dims)) { @@ -61,4 +61,4 @@ bool ArgMaxChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Forma OpCheckerRegistrar g_ArgMaxChecker("ArgMaxFusion", new ArgMaxChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/argmax_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/argmax_checker.h index 4ab803edced118011548cc9e7031679c4f3f3623..ce275502f2cfc9d1e8a4bdfd66a0c271155711ed 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/argmax_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/argmax_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ArgMaxChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ArgMaxChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_ARGMAX_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/arithmetic_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/arithmetic_checker.cc index 364b623405296dbd172f22a2603451344cfe9087..2d48f9176af6bbe96055977b46dcbff7dc159a52 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/arithmetic_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/arithmetic_checker.cc @@ -22,7 +22,7 @@ #include "common/check_base.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool ArithmeticChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, 1, format, kMaxInputWOf4Dims)) { @@ -94,4 +94,4 @@ OpCheckerRegistrar g_X_DIV_YChecker("X_DIV_Y", new ArithmeticChecker()); OpCheckerRegistrar g_X_LOG_YChecker("X_LOG_Y", new ArithmeticChecker()); OpCheckerRegistrar g_BiasAddChecker("BiasAdd", new ArithmeticChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/arithmetic_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/arithmetic_checker.h index eaae85195e945032ddea1300ac9a90390c572bc7..248c2870c4d2d44a4a7c4b3fdcfae1b86bc3f4ff 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/arithmetic_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/arithmetic_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ArithmeticChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ArithmeticChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_ARITHMETIC_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/batchnorm_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/batchnorm_checker.cc index 3fd49e1219277b384fc77314feb78dd7f60c7fe0..a8e2322d67d0c67a8b5c6745e42574f316ad6704 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/batchnorm_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/batchnorm_checker.cc @@ -20,7 +20,7 @@ #include "common/op_enum.h" #include "checker/batchnorm_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool BatchNormChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, 1, format, kMaxInputWOf4Dims)) { @@ -46,4 +46,4 @@ bool BatchNormChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Fo OpCheckerRegistrar g_BatchNormChecker("BatchNorm", new BatchNormChecker()); OpCheckerRegistrar g_FusedBatchNormChecker("FusedBatchNorm", new BatchNormChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/batchnorm_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/batchnorm_checker.h index b7b9f798acd71e00911d76209eb3ab4b2a5c7687..d4159e51a8edf09456f34302c7df55eb4248bc3f 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/batchnorm_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/batchnorm_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class BatchNormChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class BatchNormChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_BATCHNORM_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/common_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/common_checker.cc index de1c226fc5e728b3b60677695e1d1b11ffdd2525..9b77c4650a7b97bd734c7f93127bb39247e0f044 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/common_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/common_checker.cc @@ -19,7 +19,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool CommonChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, 1, format, kMaxInputWOf4Dims)) { @@ -68,4 +68,4 @@ OpCheckerRegistrar g_MaxUnPoolChecker("MaxUnpool", new CommonChecker()); OpCheckerRegistrar g_CustomChecker("Custom", new CommonChecker()); OpCheckerRegistrar g_LSTMChecker("LSTM", new CommonChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/common_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/common_checker.h index 5a11b94ec1f08823c89204802737ad645e2b14f3..d55c6580f9135eda2c2588fcc87809630368fa9e 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/common_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/common_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class CommonChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class CommonChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_COMMON_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/concat_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/concat_checker.cc index b82bf508a469031cdee996421654c95fca64a13a..08ba9b682e6c66a3e4f10aca598745975e020c76 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/concat_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/concat_checker.cc @@ -21,7 +21,7 @@ #include "common/anf_util.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { bool CheckConcatInputW(const ShapeVector &input_shape, int64_t axis, int64_t input_w) { @@ -86,4 +86,4 @@ bool ConcatChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Forma OpCheckerRegistrar g_ConcatChecker("Concat", new ConcatChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/concat_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/concat_checker.h index d63695ecd6a64fbe2e4d4e5b215838421689f03e..caa23af925c2dfa1fe64724a77fbb67a2d231d88 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/concat_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/concat_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ConcatChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ConcatChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_CONCAT_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/conv2d_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/conv2d_checker.cc index e60845cae83acc0df2416e138113d8ff2ba1c4a5..587978f545763fee9bf5ac378f5afc96669332f0 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/conv2d_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/conv2d_checker.cc @@ -23,7 +23,7 @@ #include "infer/cxx_api/conv2d_fusion.h" #include "infer/cxx_api/conv2d_transpose_fusion.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kMaxGroupNum = 2048; @@ -197,4 +197,4 @@ bool Conv2DFusionChecker::Check(api::CNodePtr op, int32_t output_num, mindspore: OpCheckerRegistrar g_Conv2DFusionChecker("Conv2DFusion", new Conv2DFusionChecker()); OpCheckerRegistrar g_Conv2dTransposeFusionChecker("Conv2dTransposeFusion", new Conv2DFusionChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/conv2d_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/conv2d_checker.h index beb057ad2e5d04e132679bd9f76267769b150c56..fd47ab24f4663c1251022e344656c22357df99ac 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/conv2d_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/conv2d_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class Conv2DFusionChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class Conv2DFusionChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_CONV2D_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/custom_op_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/custom_op_checker.cc index cc025c9e37284de6c5ff162ab8e1468f1c553b6d..d2761fcfd4199c32edff413790ef6a6392d286cf 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/custom_op_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/custom_op_checker.cc @@ -18,7 +18,7 @@ #include #include -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool CustomOpChecker::Check(api::CNodePtr, int32_t output_num, mindspore::Format) { return true; } OpCheckerRegistrar g_DecBboxChecker("DecBBox", new CustomOpChecker()); @@ -34,4 +34,4 @@ OpCheckerRegistrar g_BiLstmChecker("BiLstm", new CustomOpChecker()); OpCheckerRegistrar g_GruChecker("Gru", new CustomOpChecker()); OpCheckerRegistrar g_NopChecker("Nop", new CustomOpChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/custom_op_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/custom_op_checker.h index d2609c1ec3a4dcae81b5b95ad8a52d278b055815..6d5a5aaf0d5aa7e621158be94bf3e6df39d90a7a 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/custom_op_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/custom_op_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class CustomOpChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class CustomOpChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_CUSTOM_OP_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/eltwise_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/eltwise_checker.cc index 86f6d239513f009d2bf1d212f1b40f5ff4e776be..9b5a3233c3642dbb99261ed72230123e79d12b8b 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/eltwise_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/eltwise_checker.cc @@ -19,7 +19,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kModeSize = 3; @@ -58,4 +58,4 @@ bool EltwiseChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Form OpCheckerRegistrar g_EltwiseChecker("Eltwise", new EltwiseChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/eltwise_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/eltwise_checker.h index c59ccbbea2ab6e306108d57d658b89fc24f7e103..015176f40ebb626ad2680f9bf6b911ef675d5491 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/eltwise_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/eltwise_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class EltwiseChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class EltwiseChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_ELTWISE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/exp_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/exp_checker.cc index b925894a0a530175e863ee3b168b48ff37f0fe77..e2a7a63962c3c02287bf59bbb67d499a77ad3b6c 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/exp_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/exp_checker.cc @@ -20,7 +20,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool ExpFusionChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, kInputIndex1, format, kMaxInputWOf4Dims)) { @@ -46,4 +46,4 @@ bool ExpFusionChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Fo OpCheckerRegistrar g_ExpFusionChecker("ExpFusion", new ExpFusionChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/exp_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/exp_checker.h index 101730e34d07b808435b7ed0e7fdae435533550f..c42b4ec3fdab3ccfbc83c2d27b6231f9c3c1b875 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/exp_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/exp_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ExpFusionChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ExpFusionChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_EXP_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/flatten_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/flatten_checker.cc index 5471ccf698d16fda8ed056a3d177492be61b3ce9..61bfe531aa85081741b387623198db49f5d24be0 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/flatten_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/flatten_checker.cc @@ -20,7 +20,7 @@ #include "common/op_attr.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kMaxFlattenInputW = 65536; @@ -54,4 +54,4 @@ bool FlattenChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Form } OpCheckerRegistrar g_FlattenChecker("Flatten", new FlattenChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/flatten_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/flatten_checker.h index f21354674cfc7a1b28e0ac4ea46f29ccf6dcb1b4..8798f624ec23a4aff34d6ab2a9f46f555e292b91 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/flatten_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/flatten_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class FlattenChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class FlattenChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_FLATTEN_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/full_connection_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/full_connection_checker.cc index 9fdadf286c6ff7abe16ddd4219983eaefc2bdbcc..cc21bf5340eb3c2c6e47c8ebf7c10773a74098e7 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/full_connection_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/full_connection_checker.cc @@ -21,7 +21,7 @@ #include "common/op_attr.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool FullConnectionChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, 1, format, kMaxInputWOf4Dims)) { @@ -62,4 +62,4 @@ bool FullConnectionChecker::Check(api::CNodePtr op, int32_t output_num, mindspor OpCheckerRegistrar g_FullConnectionChecker("FullConnection", new FullConnectionChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/full_connection_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/full_connection_checker.h index 23394162d85d60ea65749e2d529193a0a04805f7..412b4beec039fbebb9da0bd3f9e141217a9760bf 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/full_connection_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/full_connection_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class FullConnectionChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class FullConnectionChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_FULL_CONNECTION_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/log_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/log_checker.cc index 09eb4ba076d8d19c88a0b4a2beb36e7289190d3f..6314fbc23d405a22bcd987e9fbaa9e99694e9b67 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/log_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/log_checker.cc @@ -20,7 +20,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool LogChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, kInputIndex1, format, kMaxInputWOf4Dims)) { @@ -48,4 +48,4 @@ bool LogChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format f } OpCheckerRegistrar g_LogChecker("Log", new LogChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/log_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/log_checker.h index 3d591e308d0f6e3947a5c6086e4323c04c27c2de..126f0f9fadda336fee559dd852e56e78008216e8 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/log_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/log_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class LogChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class LogChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_LOG_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/lrn_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/lrn_checker.cc index 2e139c2e36091fb6a5b231e0b1d5169ae3f4e7dd..c90caf9d4207c75ae66ad25a36ef785dff90011d 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/lrn_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/lrn_checker.cc @@ -19,7 +19,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int local_size_3 = 3; @@ -58,4 +58,4 @@ bool LRNChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format f OpCheckerRegistrar g_LRNChecker("LRN", new LRNChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/lrn_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/lrn_checker.h index 7ff17df654492f90062becf3e33c9f43a67b35a9..a25e707107bdf8c3e4a826fc1a8ed8fb1fc42328 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/lrn_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/lrn_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class LRNChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class LRNChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_LRN_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/lstm_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/lstm_checker.cc index 3ee423ab26e30deb8c20934ce053a1e449b976b0..63c2840859d9e5235874f0d380548c45cdc18888 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/lstm_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/lstm_checker.cc @@ -18,7 +18,7 @@ #include #include "common/op_attr.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr uint32_t kLstmMaxNumOutput = 5456; @@ -43,4 +43,4 @@ bool LstmChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format) OpCheckerRegistrar g_LstmChecker("Lstm", new LstmChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/lstm_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/lstm_checker.h index 7a59deb3a495f24712e97570545224709432d22c..1b2b6ff41f350789e0d5b68afb8d78687a7ab4c3 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/lstm_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/lstm_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class LstmChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class LstmChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_LSTM_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/mat_mul_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/mat_mul_checker.cc index 569326f78c145ee09e24f0ccd2ae3d745df98dbe..706ec2bada7837234a8427f47789a977f8beb25e 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/mat_mul_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/mat_mul_checker.cc @@ -21,7 +21,7 @@ #include "common/op_attr.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { bool CheckInputShapeForMatrix(const api::CNodePtr &cnode, const api::PrimitivePtr &primitive) { @@ -110,4 +110,4 @@ bool MatMulChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Forma OpCheckerRegistrar g_GemmChecker("Gemm", new MatMulChecker()); OpCheckerRegistrar g_MatMulChecker("MatMulFusion", new MatMulChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/mat_mul_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/mat_mul_checker.h index 1d807795e295b5c238d04d32f16d10e666149d7a..bb03abb3bb5276da20828fa98653e49bf9cbdb01 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/mat_mul_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/mat_mul_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class MatMulChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class MatMulChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_MAT_MUL_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/mvn_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/mvn_checker.cc index 3743810186e50aca06ff40eb279444c7258902e5..1213fbeb7702a3d6711eb76b027def04a11a3f52 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/mvn_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/mvn_checker.cc @@ -21,7 +21,7 @@ #include "common/op_enum.h" #include "common/fetch_content.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool MvnChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, kInputIndex1, format, kMaxInputWOf4Dims)) { @@ -47,4 +47,4 @@ bool MvnChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format f OpCheckerRegistrar g_MvnChecker("Mvn", new MvnChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/mvn_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/mvn_checker.h index f2d0cb8ac2864d58cfc6dd4e7a109be9f3d7c8b6..84e6e71e36eefa3c7ae21e3230d908a58cb60023 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/mvn_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/mvn_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class MvnChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class MvnChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_MVN_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/op_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/op_checker.cc index ce337f32b6a44294bfbee626a43583e4b23f8b2c..e2f16d8ef029ac130a8045b32719dab903de6b1a 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/op_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/op_checker.cc @@ -21,7 +21,7 @@ #include "common/op_enum.h" #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { OpCheckerRegistry::~OpCheckerRegistry() { for (auto ite : checkers) { @@ -130,4 +130,4 @@ bool CheckInputW(const api::CNodePtr &op, size_t index, mindspore::Format format return true; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/op_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/op_checker.h index 56815a0d1f2350f30b3f300810202e9b35f14ef4..a3eb2c09a63c4786269b9004d7229843ffe37963 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/op_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/op_checker.h @@ -32,7 +32,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace dpico { class OpChecker { public: @@ -70,6 +70,6 @@ class OpCheckerRegistrar { ~OpCheckerRegistrar() = default; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_OP_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/pooling_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/pooling_checker.cc index 1b9a5f185b4989b9588b250367a3300a2799caba..bdbe0cd60c9033761219edbb5409cb574b81050f 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/pooling_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/pooling_checker.cc @@ -21,7 +21,7 @@ #include "common/anf_util.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kMaxGroupNum = 2048; @@ -135,4 +135,4 @@ bool PoolingChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Form OpCheckerRegistrar g_AvgPoolFusionChecker("AvgPoolFusion", new PoolingChecker()); OpCheckerRegistrar g_MaxPoolFusionChecker("MaxPoolFusion", new PoolingChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/pooling_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/pooling_checker.h index a28a9c5e8ac661bb62644acfa619b9dc7d9fe380..066442a848dd67be6d12d0e3f82f5e1882f9970a 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/pooling_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/pooling_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class PoolingChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class PoolingChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_POOLING_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/pow_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/pow_checker.cc index 2e71333520098a6685d2bf2ef4d86fcf4ec613bb..c75733bcda052584f0d03adc669f22a0dd22c503 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/pow_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/pow_checker.cc @@ -21,7 +21,7 @@ #include "common/fetch_content.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool PowFusionChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, kInputIndex1, format, kMaxInputWOf4Dims)) { @@ -63,4 +63,4 @@ bool PowFusionChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Fo OpCheckerRegistrar g_PowFusionChecker("PowFusion", new PowFusionChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/pow_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/pow_checker.h index 1fa9cac37e951a71ab218cb3e198268149eeeb86..a5a10b5c4e4f785704ac6584155a704f03aafe3d 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/pow_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/pow_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class PowFusionChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class PowFusionChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_POW_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/reduce_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/reduce_checker.cc index a68a7da1c213c70cec1de72058964cbb2d28ed54..4a368bc38e192a463d95a917ef5ad475b210976f 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/reduce_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/reduce_checker.cc @@ -24,7 +24,7 @@ #include "common/anf_util.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { STATUS GetAxesSet(const api::CNodePtr &op, const ShapeVector &input_shape, const api::PrimitivePtr &primitive, @@ -130,4 +130,4 @@ bool ReduceChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Forma OpCheckerRegistrar g_ReduceChecker("ReduceFusion", new ReduceChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/reduce_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/reduce_checker.h index ae001b34223d7c5181385f0dc3166963b31eccb0..78537407b4dfc178d0ac7aa11ee7984a9d8f122e 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/reduce_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/reduce_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ReduceChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ReduceChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_REDUCE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/reshape_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/reshape_checker.cc index 55d95d050e2ffe1f76511c681a5864afc5d26c35..3088fbbebe01fdf07f7b07766ee4108cc4247530 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/reshape_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/reshape_checker.cc @@ -22,7 +22,7 @@ #include "common/op_enum.h" #include "common/fetch_content.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kMaxReshapeInputW = 65536; @@ -95,4 +95,4 @@ bool ReshapeChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Form OpCheckerRegistrar g_ReshapeChecker("Reshape", new ReshapeChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/reshape_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/reshape_checker.h index 38e3a1c2c39d2ea560ec11570fc1677ef548a3f4..6f69d327ee0e2b5ba0389460672d90a10238ee97 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/reshape_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/reshape_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ReshapeChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ReshapeChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_RESHAPE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/resize_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/resize_checker.cc index 53dab666b08698bb1884ab2546612d18bc9de9a7..dda393219bf20b8f55781515cc1a889c313476dc 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/resize_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/resize_checker.cc @@ -24,7 +24,7 @@ #include "mindapi/base/types.h" #include "include/registry/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kMaxOutputWOf4Dims = 2048; @@ -175,4 +175,4 @@ bool ResizeChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Forma OpCheckerRegistrar g_ResizeChecker("Resize", new ResizeChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/resize_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/resize_checker.h index 21cca6f21e4b002826cddece0dd55163060fff8f..8b24c0ad83c1c5b7b4f63e25ee7db7a114c7b083 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/resize_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/resize_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ResizeChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ResizeChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_RESIZE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/reverse_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/reverse_checker.cc index ff720f75233add8c0ffd749cbb67f5ecd50a1aaf..8ab2b63e72dd41e62bccb8eda740a83c50dd3f0c 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/reverse_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/reverse_checker.cc @@ -20,7 +20,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool ReverseChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, kInputIndex1, format, kMaxInputWOf4Dims)) { @@ -45,4 +45,4 @@ bool ReverseChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Form OpCheckerRegistrar g_ReverseChecker("ReverseV2", new ReverseChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/reverse_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/reverse_checker.h index e5fcf17d399560bc2f3f6d9b7423129440018221..f0cc0cd69fd1ffb28970e39cbe43e7e2a15cf3b6 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/reverse_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/reverse_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ReverseChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ReverseChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_REVERSE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/scale_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/scale_checker.cc index 9d6da8b4d968dbaddef337cff9d8057266196a6f..98af9d283c04ddb2f0cce196745d63c09e87c8cc 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/scale_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/scale_checker.cc @@ -20,7 +20,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kNegativeAxisCorrespondZero = -4; @@ -51,4 +51,4 @@ bool ScaleChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format OpCheckerRegistrar g_ScaleChecker("ScaleFusion", new ScaleChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/scale_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/scale_checker.h index 65aa51b92a8c2de771f53d121c4eef1d85202323..945536d66a34bdd88be0cf93372ed0f6cd4dfec0 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/scale_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/scale_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ScaleChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class ScaleChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_SCALE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/slice_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/slice_checker.cc index 900f4d3cdca79da3eb0eaa2e21a71771bdc13325..de990205b6c681c0339ff80ec5b7f22f51971352 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/slice_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/slice_checker.cc @@ -19,7 +19,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kMaxSplitSize = 31; @@ -57,4 +57,4 @@ bool SliceChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format OpCheckerRegistrar g_SliceChecker("SliceFusion", new SliceChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/slice_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/slice_checker.h index a72c1c694e9adddc1b27b056f2667c14cf949d71..4743f2890de05897a187fcafd80f218265438f40 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/slice_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/slice_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SliceChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class SliceChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_SLICE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/softmax_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/softmax_checker.cc index ce8c0b6e663c69d0e43fe2e6e26cb25ecf7e45fc..6e8700fae93c62ef4dcf8325360ae0b9d6788407 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/softmax_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/softmax_checker.cc @@ -21,7 +21,7 @@ #include "common/op_enum.h" #include "common/check_base.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr int kMaxVectorC = 65536; @@ -89,4 +89,4 @@ bool SoftmaxChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Form OpCheckerRegistrar g_SoftmaxChecker("Softmax", new SoftmaxChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/softmax_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/softmax_checker.h index 1386d487c809de4de3ef4f9f8ec46847d59be6b7..85a1a299dc76677174ce2a4c8a2e5b883ea8dc9a 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/softmax_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/softmax_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SoftmaxChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class SoftmaxChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_SOFTMAX_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/split_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/split_checker.cc index 55124a92d3656c40fd2163ca9921ce740a5dbe86..81c96383028841e262a7951ce3183b597f461c4d 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/split_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/split_checker.cc @@ -18,7 +18,7 @@ #include #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool SplitChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (output_num > kMaxTopNum) { @@ -34,4 +34,4 @@ bool SplitChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format OpCheckerRegistrar g_SplitChecker("Split", new SplitChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/split_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/split_checker.h index 140beec51237fdc23dfd9c919960e915c3cf86c2..12982d71cb7849ef86fd3a7952a4b0ea9f2ae475 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/split_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/split_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SplitChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class SplitChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_SPLIT_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/spp_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/spp_checker.cc index 223feedb35850937e9fc796b946d9954d1c3be46..d17f9e5e928a25910de6398084ab41acfb16f4e5 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/spp_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/spp_checker.cc @@ -18,7 +18,7 @@ #include #include "common/op_attr.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool SppChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format) { auto primitive = api::GetValueNode(op->input(0)); @@ -38,4 +38,4 @@ bool SppChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format) OpCheckerRegistrar g_SppChecker("Spp", new SppChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/spp_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/spp_checker.h index 09c9750799a73fa7912c6ddaf2da34e760e11c10..3db1eb27e0cb48b5e9f56861a2f693ab8eb6cd98 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/spp_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/spp_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SppChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class SppChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_SPP_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/squeeze_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/squeeze_checker.cc index 11a243f56cd7520c2f59d41ee883396e3aadb4da..8e38debc72ac790ad0e721c5623384fcf9481262 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/squeeze_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/squeeze_checker.cc @@ -20,7 +20,7 @@ #include "common/op_attr.h" #include "common/anf_util.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool SqueezeChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format) { std::vector output_shapes; @@ -41,4 +41,4 @@ bool SqueezeChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Form OpCheckerRegistrar g_SqueezeChecker("Squeeze", new SqueezeChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/squeeze_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/squeeze_checker.h index cc092833c40a9b7eebb0739601ece563065e08e4..4c942a6e0b34136adbfe4cb0822cb86cdf6f9244 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/squeeze_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/squeeze_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SqueezeChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class SqueezeChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_SQUEEZE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/strided_slice_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/strided_slice_checker.cc index 4090857081748c77e5394ce4505688802482cd99..a85ae93dffc83794a6ffc986689992e2674e6f65 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/strided_slice_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/strided_slice_checker.cc @@ -19,7 +19,7 @@ #include #include "include/registry/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool StridedSliceChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format) { auto primitive = api::GetValueNode(op->input(0)); @@ -39,4 +39,4 @@ bool StridedSliceChecker::Check(api::CNodePtr op, int32_t output_num, mindspore: OpCheckerRegistrar g_StridedSliceChecker("StridedSlice", new StridedSliceChecker()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/strided_slice_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/strided_slice_checker.h index 6e698aebb7b3a1420370cf37218ce8a0260289eb..d5b4d4f7b9d1b3eceba30df270caf6036d65a3c3 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/strided_slice_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/strided_slice_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class StridedSliceChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class StridedSliceChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_STRIDED_SLICE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/transpose_checker.cc b/mindspore-lite/tools/converter/adapter/dpico/checker/transpose_checker.cc index 61cef9c282afcbb9ed041b24eb8ef6e827c984db..1b7d657e07eb217038a2f1bb635c0ca808228156 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/transpose_checker.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/transpose_checker.cc @@ -23,7 +23,7 @@ #include "common/op_attr.h" #include "common/op_enum.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool TransposeChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) { if (!CheckInputW(op, kInputIndex1, format, kMaxInputWOf4Dims)) { @@ -73,4 +73,4 @@ bool TransposeChecker::Check(api::CNodePtr op, int32_t output_num, mindspore::Fo OpCheckerRegistrar g_TransposeChecker("Transpose", new TransposeChecker()); // Permute } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/checker/transpose_checker.h b/mindspore-lite/tools/converter/adapter/dpico/checker/transpose_checker.h index d62271e98e47568f8adf977c6ee7d5633c827e9b..dd57e5bac44418f3597e8869ffb60bfe41c7c31e 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/checker/transpose_checker.h +++ b/mindspore-lite/tools/converter/adapter/dpico/checker/transpose_checker.h @@ -20,7 +20,7 @@ #include #include "checker/op_checker.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class TransposeChecker : public OpChecker { public: @@ -29,6 +29,6 @@ class TransposeChecker : public OpChecker { bool Check(api::CNodePtr op, int32_t output_num, mindspore::Format format) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_CHECKER_TRANSPOSE_CHECKER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/anf_util.cc b/mindspore-lite/tools/converter/adapter/dpico/common/anf_util.cc index f9bb0c8a27a2e8db778f3b88317a2e3ceb3ac7d6..0671352d2d07cbb4cb60059561f4c2c8986b4c40 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/anf_util.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/common/anf_util.cc @@ -29,12 +29,12 @@ #include "infer/tuple_get_item.h" #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "common/check_base.h" -namespace mindspore { +namespace mindspore::lite { namespace ops { class PrimitiveC; } -} // namespace mindspore -namespace mindspore { +} // namespace mindspore::lite +namespace mindspore::lite { namespace dpico { namespace { const std::map kTypeMap = { @@ -798,4 +798,4 @@ STATUS GetShapeVectorFromStringTensor(const api::TensorPtr &tensor_info, ShapeVe return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/anf_util.h b/mindspore-lite/tools/converter/adapter/dpico/common/anf_util.h index 2651a4c0da4fa05410bb06c7e31d2d5b11dad8f5..5f290b051c2722f4d32b27b2ce2454e4c97c92f8 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/anf_util.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/anf_util.h @@ -30,7 +30,7 @@ using mindspore::lite::RET_NO_CHANGE; using mindspore::lite::RET_OK; using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace dpico { bool CheckPrimitiveType(const api::AnfNodePtr &node, const api::PrimitivePtr &primitive_type); STATUS GetPrimitiveType(const api::AnfNodePtr &node, std::string *name); @@ -75,6 +75,6 @@ inline size_t IntToSize(int u) { return static_cast(u); } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_ANF_UTIL_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/data_transpose_utils.cc b/mindspore-lite/tools/converter/adapter/dpico/common/data_transpose_utils.cc index 9b3f7c5ee902ae1103323eef25593f0a71d9ad1e..f0c5d17116a2ba6c3eec16a480c0b87ee0489d7c 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/data_transpose_utils.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/common/data_transpose_utils.cc @@ -24,7 +24,7 @@ #include "common/float16.h" #include "mindapi/base/logging.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { const std::unordered_map kTensorFormatMap{ @@ -221,4 +221,4 @@ void TransposeMatrix(float *matrix, int row, int col) { } } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/data_transpose_utils.h b/mindspore-lite/tools/converter/adapter/dpico/common/data_transpose_utils.h index ac0e956278121e816292fe945bdd7ee6d99f8923..a429f42e9e295bef41082ffd5f7a0a4b7c89f034 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/data_transpose_utils.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/data_transpose_utils.h @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NO_CHANGE; using mindspore::lite::RET_OK; using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace dpico { inline const std::vector kNH2NC = {0, 3, 1, 2}; inline const std::vector kNC2NH = {0, 2, 3, 1}; @@ -84,5 +84,5 @@ STATUS TransFilterFormat(const mindspore::api::TensorPtr &tensor, mindspore::For void TransposeMatrix(float *matrix, int row, int col); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_DATA_TRANSPOSE_UTILS_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/fetch_content.cc b/mindspore-lite/tools/converter/adapter/dpico/common/fetch_content.cc index 806285d360a09b5598d6fa6dddb3db73487a5ced..4e991e46416f07e2d9ed62053db0686459ed0cfb 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/fetch_content.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/common/fetch_content.cc @@ -21,7 +21,7 @@ #include "common/check_base.h" #include "include/securec.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr size_t kTensorListMinSize = 3 * sizeof(int32_t); @@ -106,4 +106,4 @@ int GetDataSizeFromTensor(DataInfo *data_info, int *data_size) { return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/fetch_content.h b/mindspore-lite/tools/converter/adapter/dpico/common/fetch_content.h index b1c3cba2134a2658199c750b396a0a61ac81d0cf..3ffd34151ff2899e105d6103a550fd1149d8a585 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/fetch_content.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/fetch_content.h @@ -22,7 +22,7 @@ #include "mindapi/ir/primitive.h" #include "mindapi/ir/func_graph.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { struct DataInfo { int data_type_; @@ -37,5 +37,5 @@ int FetchDataFromParameterNode(const api::CNodePtr &cnode, size_t index, DataInf int GetDataSizeFromTensor(DataInfo *data_info, int *data_size); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_FETCH_CONTENT_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/file_util.cc b/mindspore-lite/tools/converter/adapter/dpico/common/file_util.cc index 67e73354ac4983e0f84cd60314f26bd73a8d04d8..36389a8899a7e4e71ed7689dad24e96492d4e7f5 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/file_util.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/common/file_util.cc @@ -23,7 +23,7 @@ #include #include "mindapi/base/logging.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { #ifdef _WIN32 @@ -171,4 +171,4 @@ int RemoveDir(const std::string &path) { #endif } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/file_util.h b/mindspore-lite/tools/converter/adapter/dpico/common/file_util.h index e1eea461ea86168ff5b8995be3eb485259643cc7..2b834bc684539110ddd0b88a189060cb86369539 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/file_util.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/file_util.h @@ -37,7 +37,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace dpico { constexpr size_t kMaximumNumOfFolders = 1000; @@ -77,5 +77,5 @@ int CreateDir(std::string *file_path); int ReadFileToIfstream(const std::string &file_path, std::ifstream *ifstream); int RemoveDir(const std::string &path); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_FILE_UTIL_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/float16.h b/mindspore-lite/tools/converter/adapter/dpico/common/float16.h index f7b970ffe77a09e33576e4e2ba6001102c07a40b..8df4fdd0844f6e208c9bc6ef8e0e315b79599750 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/float16.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/float16.h @@ -31,7 +31,7 @@ using float16 = float16_t; #include // Implement Float16 for mindspore, inspired by Eigen::half. -namespace mindspore { +namespace mindspore::lite { class Float16 { public: static constexpr uint16_t value_mask = 0x7fff; @@ -217,7 +217,7 @@ inline bool operator>=(const Float16 &a, const Float16 &b) { return static_cast< inline std::ostream &operator<<(std::ostream &os, const Float16 &v) { return (os << static_cast(v)); } -} // namespace mindspore +} // namespace mindspore::lite using float16 = mindspore::Float16; diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/format_utils.cc b/mindspore-lite/tools/converter/adapter/dpico/common/format_utils.cc index 85acb304b819fbb3632d5e7586b46ceaa39f4e5b..15f04fc1739ddd996ca6d3c6b32351c8850aac9b 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/format_utils.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/common/format_utils.cc @@ -52,7 +52,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_name_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_name_t.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { const std::set kAssignedFormatOpSet = { @@ -87,4 +87,4 @@ std::string FormatEnumToString(mindspore::Format format) { return names[static_cast(format)]; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/format_utils.h b/mindspore-lite/tools/converter/adapter/dpico/common/format_utils.h index 9cc91b3e6ea9858d95e7f893c42afd6e569c7bce..6c7beb8ae6771ef1bf906c0c6eb30d736d3153d8 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/format_utils.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/format_utils.h @@ -23,12 +23,12 @@ #include "include/api/format.h" #include "common/anf_util.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { const std::set &GetAssignedFormatOpSet(); bool IsSpecialType(const api::CNodePtr &cnode); std::string FormatEnumToString(mindspore::Format format); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_FORMAT_UTILS_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/graph_output_name_keeper.cc b/mindspore-lite/tools/converter/adapter/dpico/common/graph_output_name_keeper.cc index fac3072f4c8be08747450c246465cdd18d692730..40a69fde6fb3c109880bf6e5a2667112fe9694a9 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/graph_output_name_keeper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/common/graph_output_name_keeper.cc @@ -25,7 +25,7 @@ #include "infer/depend.h" #include "include/registry/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { GraphOutputNameKeeper *GraphOutputNameKeeper::GetInstance() { static GraphOutputNameKeeper instance; @@ -149,4 +149,4 @@ std::string GraphOutputNameKeeper::GetAnfOutputNameFromOm(const std::string &om_ return om_out_name; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/graph_output_name_keeper.h b/mindspore-lite/tools/converter/adapter/dpico/common/graph_output_name_keeper.h old mode 100755 new mode 100644 index e36d4183cafab1f1bd838648aa57405e45f33c4e..942f45ce43b5c5bcb0550164e9312f28cdd00bfb --- a/mindspore-lite/tools/converter/adapter/dpico/common/graph_output_name_keeper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/graph_output_name_keeper.h @@ -22,7 +22,7 @@ #include #include "mindapi/ir/func_graph.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class GraphOutputNameKeeper { public: @@ -46,5 +46,5 @@ class GraphOutputNameKeeper { std::map ori_output_info_; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_DPICO_COMMON_GRAPH_OUTPUT_NAME_KEEPER_H diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/infer_util.cc b/mindspore-lite/tools/converter/adapter/dpico/common/infer_util.cc index 71b1c07d6bca46116e048659f6184212a8a4fb94..4698cc1ae3961f3b9f1d8f8562d7a9462ee916a2 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/infer_util.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/common/infer_util.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace dpico { int CheckCustomInputOutput(const std::vector *inputs, const std::vector *outputs, const schema::Primitive *primitive) { @@ -111,4 +111,4 @@ int GetOmNetType(const schema::Primitive *primitive, OmNetType *om_net_type) { return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/infer_util.h b/mindspore-lite/tools/converter/adapter/dpico/common/infer_util.h index a062994946913b734354ca3973b97edbbc92a126..f66f0b9481b9ff91f59d1fa461dfd887a013a0f1 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/infer_util.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/infer_util.h @@ -23,13 +23,13 @@ #include "schema/model_generated.h" #include "src/graph_split_info.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { int CheckCustomInputOutput(const std::vector *inputs, const std::vector *outputs, const schema::Primitive *primitive); int CheckCustomParam(const schema::Custom *param, const std::string ¶m_name); int GetOmNetType(const schema::Primitive *primitive, OmNetType *om_net_type); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_INFER_UTIL_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/op_attr.h b/mindspore-lite/tools/converter/adapter/dpico/common/op_attr.h index 5fc55c9fc4de4237ad87c20f9735034036431cca..0f6ce6c4e3f59fc6dc58b442fac6d94c43efaa73 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/op_attr.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/op_attr.h @@ -17,7 +17,7 @@ #ifndef MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_OP_ATTR_H_ #define MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_OP_ATTR_H_ -namespace mindspore { +namespace mindspore::lite { namespace dpico { constexpr auto kAcrossSpatial = "across_spatial"; constexpr auto kAcrossChannels = "across_channels"; @@ -125,5 +125,5 @@ constexpr auto kUseDefaultInitialHFlag = "use_default_initial_h_flag"; constexpr auto kUseGlobalStats = "use_global_stats"; constexpr auto kZoomFactor = "zoom_factor"; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_OP_ATTR_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/op_enum.h b/mindspore-lite/tools/converter/adapter/dpico/common/op_enum.h index 4d4e9df4f4f0cb6bf91e03673d5d79afa92420a4..8e6197ca66579043bf6cdb221eee6eeabbc1b66f 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/op_enum.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/op_enum.h @@ -17,7 +17,7 @@ #ifndef MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_OP_ENUM_H_ #define MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_OP_ENUM_H_ -namespace mindspore { +namespace mindspore::lite { namespace dpico { constexpr size_t kDims1 = 1; constexpr size_t kDims2 = 2; @@ -45,6 +45,6 @@ constexpr int kAxisLowerBound = -4; constexpr int kAxisUpperBound = 3; constexpr size_t kMaxLineCount = 9999; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_OP_ENUM_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/string_util.cc b/mindspore-lite/tools/converter/adapter/dpico/common/string_util.cc index 5d790f1db344c39b40e222a305bca709a3865e6b..61c0b749100cdd371ddfdc64e34bf07426716ad3 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/string_util.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/common/string_util.cc @@ -21,7 +21,7 @@ #include #include "mindapi/base/logging.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { int EraseBlankSpace(std::string *input_string) { if (input_string == nullptr) { @@ -97,4 +97,4 @@ bool IsValidDoubleNum(const std::string &num_str) { return iss.eof() && !iss.fail(); } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/common/string_util.h b/mindspore-lite/tools/converter/adapter/dpico/common/string_util.h index 89386a54b54261a203209a04add7960ee8f7ea6e..e34f1b97268a32db442b3bd13f16e091aad716ed 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/common/string_util.h +++ b/mindspore-lite/tools/converter/adapter/dpico/common/string_util.h @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace dpico { int EraseBlankSpace(std::string *input_string); int EraseHeadTailSpace(std::string *input_string); @@ -37,5 +37,5 @@ std::string ReplaceSpecifiedChar(const std::string &origin_str, char origin_ch, bool IsValidUnsignedNum(const std::string &num_str); bool IsValidDoubleNum(const std::string &num_str); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_COMMON_STRING_UTIL_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_common_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_common_infer.cc index 72acfc01c17206e7f91aef37b70691d39a3e902f..8564e79b2663bd87bd89958db4366b0068c729da 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_common_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_common_infer.cc @@ -25,7 +25,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { std::shared_ptr DpicoCommonInferCreater() { std::shared_ptr infer = std::make_shared(); @@ -83,4 +83,4 @@ REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Xor, DpicoCommonInferCreater) REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Mish, DpicoCommonInferCreater) REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Custom, DpicoCommonInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_common_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_common_infer.h index c79734a5eb30426861cff7cb795d14e4bda2367e..62c27eb1c9627548d403e5cd0dca0178b872f228 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_common_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_common_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoCommonInterface : public KernelInterface { public: @@ -32,6 +32,6 @@ class DpicoCommonInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_COMMON_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_custom_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_custom_infer.cc index cdabbaa9f53e47cec96c7a6001cc2d78268dcdb1..88532da9ed6542c1c05341b5285e64925cc5c11e 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_custom_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_custom_infer.cc @@ -32,7 +32,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Custom; -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr int kOmParameterNum = 1; @@ -242,4 +242,4 @@ std::shared_ptr CustomInferCreater() { } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, DPICO, CustomInferCreater); } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_custom_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_custom_infer.h index 07b176b97ebaa101508f316dc43fb9864e2a0694..c3fe29df6eb227249552451a07095073c5dec3f7 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_custom_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_custom_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class CustomInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class CustomInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_CUSTOM_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_decbbox_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_decbbox_infer.cc index 6d2e93a1c3a92c91077945886168c0c8070ef8aa..bea2c97a56d57289623b2ac0329a264714be4303 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_decbbox_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_decbbox_infer.cc @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr int kDimsOfBbox = 6; // [xmin, ymin, xmax, ymax, score class_id] @@ -97,4 +97,4 @@ Status DpicoDecBBoxInterface::Infer(std::vector *inputs, st } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, DecBBox, DpicoDecBBoxInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_decbbox_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_decbbox_infer.h index 77466fcadd2a5335e08f13f0d016275942e95ed5..0d843a9e85a566e7459f28ea3cc98119f67e2afb 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_decbbox_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_decbbox_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoDecBBoxInterface : public KernelInterface { public: @@ -32,6 +32,6 @@ class DpicoDecBBoxInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_DECBBOX_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_detection_output_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_detection_output_infer.cc index 77c90b0f461a096a7f0a6c1fded32cb405f0925e..65f528cec054c0617d23f56e11baa4477d428655 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_detection_output_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_detection_output_infer.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr int kDimensionOfBbox = 7; // [image_id, label, confidence, xmin, ymin, xmax, ymax] @@ -60,4 +60,4 @@ Status DpicoDetectionOutputInterface::Infer(std::vector *in } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, DetectionOutput, DpicoDetectionOutputInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_detection_output_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_detection_output_infer.h index c9cf41666298ced2b5108cabc2fb3f82e6a25f75..8260ab04738b18549cb4b4b6487bd5032151c05f 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_detection_output_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_detection_output_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoDetectionOutputInterface : public KernelInterface { public: @@ -32,6 +32,6 @@ class DpicoDetectionOutputInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_DETECTION_OUTPUT_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_extract_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_extract_infer.cc index 45dbc079ea225c080a365faf9ad43358a949cea8..e361100eb9cd37dc91eafe5be7d38287d5c7f943 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_extract_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_extract_infer.cc @@ -30,7 +30,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { std::shared_ptr DpicoExtractInferCreater() { std::shared_ptr infer = std::make_shared(); @@ -115,4 +115,4 @@ Status DpicoExtractInterface::Infer(std::vector *inputs, st } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Extract, DpicoExtractInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_extract_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_extract_infer.h index b18851995192e9bef00cac0c831b9b41f712ca5a..8bdb58717860259c6bc8d86812243751339e3397 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_extract_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_extract_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoExtractInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoExtractInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_EXTRACT_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_infer.cc index 15993c656caa2db716efa85c50a5381c4f6f5219..9ff458bfe451e96dde37e5eee95b87483483c199 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_infer.cc @@ -28,7 +28,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr size_t kHiddenLayerSize = 4; @@ -74,4 +74,4 @@ Status DpicoLstmInterface::Infer(std::vector *inputs, std:: } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Lstm, DpicoLstmInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_infer.h index 24d417035c194efff1df5418bc12d698eae2efaa..b57ff7bd20809f473f3e24b3cb7df78e18871576 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoLstmInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoLstmInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_LSTM_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_onnx_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_onnx_infer.cc old mode 100755 new mode 100644 index 60d4f0f037dd5521242b1fb9ccbc24bb44bb5f5e..03e74436a5d79408436c2c5075408b3c7357a91c --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_onnx_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_onnx_infer.cc @@ -31,7 +31,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { std::shared_ptr DpicoLSTMOnnxInferCreater() { std::shared_ptr infer = std::make_shared(); @@ -98,4 +98,4 @@ Status DpicoLSTMOnnxInterface::Infer(std::vector *inputs, } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, LSTM, DpicoLSTMOnnxInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_onnx_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_onnx_infer.h old mode 100755 new mode 100644 index 0f3ea3ff59fcb24ceaac1b62bb08d157800b3ee5..e621797ad59f3f581adc6f2b53e74b8ec7c45379 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_onnx_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_lstm_onnx_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoLSTMOnnxInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoLSTMOnnxInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // DPICO_INFER_DPICO_LSTMONNX_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_maxunpool_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_maxunpool_infer.cc old mode 100755 new mode 100644 index de0b3b8d23169916236c4987fe01e4ec1809d813..0ac66d70d14762658dfd466a74cf70296abe24f6 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_maxunpool_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_maxunpool_infer.cc @@ -31,7 +31,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { std::shared_ptr DpicoMaxunpoolInferCreater() { std::shared_ptr infer = std::make_shared(); @@ -121,4 +121,4 @@ Status DpicoMaxunpoolInterface::Infer(std::vector *inputs, } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, MaxUnpool, DpicoMaxunpoolInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_maxunpool_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_maxunpool_infer.h old mode 100755 new mode 100644 index f145726d7ee6391c2165b4cf5ca75743b379848e..69017a24dd9b8a6b0315e2533226286d80942fe8 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_maxunpool_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_maxunpool_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoMaxunpoolInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoMaxunpoolInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // DPICO_INFER_DPICO_MAXUNPOOL_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_passthrough_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_passthrough_infer.cc index 10fd61bc005b7db2a2a76c9c0bc4d246ca6e6ff9..385cf09f11fcc98ac70f88e0a5106ece35617a43 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_passthrough_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_passthrough_infer.cc @@ -30,7 +30,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { std::shared_ptr DpicoPassThroughInferCreater() { std::shared_ptr infer = std::make_shared(); @@ -126,4 +126,4 @@ Status DpicoPassThroughInterface::Infer(std::vector *inputs } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, PassThrough, DpicoPassThroughInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_passthrough_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_passthrough_infer.h index 99af6f14bbe515aba721f06fb130dc937b5c40c3..af3da924a1dfd13a173c944df9f8331786598ad8 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_passthrough_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_passthrough_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoPassThroughInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoPassThroughInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_PASSTHROUGH_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_psroi_pool_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_psroi_pool_infer.cc index 220c3a5619889cec33cd643e9e7c3fae03c9e97f..4c0a0021101957f0d381f0372a76ddeb7aa8ae6d 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_psroi_pool_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_psroi_pool_infer.cc @@ -30,7 +30,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { std::shared_ptr DpicoPsRoiPoolInferCreater() { std::shared_ptr infer = std::make_shared(); @@ -114,4 +114,4 @@ Status DpicoPsRoiPoolInterface::Infer(std::vector *inputs, } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, PsRoiPool, DpicoPsRoiPoolInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_psroi_pool_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_psroi_pool_infer.h index 1468d25e7bab5a5d8dc2e3d4f26ca4cc434ceb68..e8ee143443560dcfd092213be48f92a1a08c81da 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_psroi_pool_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_psroi_pool_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoPsRoiPoolInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoPsRoiPoolInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_PSROI_POOL_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_recurrent_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_recurrent_infer.cc index bfcac01e9a94794d8f5811baada04249bcf1f42b..adac60c88bb29ec7fffba513b0c102743b47a4fc 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_recurrent_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_recurrent_infer.cc @@ -27,7 +27,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr size_t kGateNum2 = 2; @@ -83,4 +83,4 @@ REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Rnn, DpicoRecurrentInferCreater) REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Gru, DpicoRecurrentInferCreater) REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, BiLstm, DpicoRecurrentInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_recurrent_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_recurrent_infer.h index 81572c0dc45cd51969ce59a8cb9383e7f13fc0bf..564cd68e30666bb87822093d3246824c421117eb 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_recurrent_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_recurrent_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoRecurrentInterface : public KernelInterface { public: @@ -32,6 +32,6 @@ class DpicoRecurrentInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_RECURRENT_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_roi_align_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_roi_align_infer.cc index 74be958a5d982e9476d4ad69250ea77b12b6ae0c..a1b635ef3d043ab99ceb6b4750a0049058e9a373 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_roi_align_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_roi_align_infer.cc @@ -31,7 +31,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { std::shared_ptr DpicoRoiAlignInferCreater() { std::shared_ptr infer = std::make_shared(); @@ -125,4 +125,4 @@ Status DpicoRoiAlignInterface::Infer(std::vector *inputs, } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, RoiAlign, DpicoRoiAlignInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_roi_align_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_roi_align_infer.h index 0f1614239825af86007334ea95592dff8017f230..3bb69e2cf63d0d7f2c14d639077d1ec7bbf61597 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_roi_align_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_roi_align_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoRoiAlignInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoRoiAlignInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_ROI_ALIGN_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_spp_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_spp_infer.cc index 2e8ae690c11e79de40e8b7b08e7c9901862600e2..d26636299f1fec1ad995a89d3ebf197eb7c1eb23 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_spp_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_spp_infer.cc @@ -30,7 +30,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { namespace { constexpr auto kSquareNum = 2; @@ -107,4 +107,4 @@ Status DpicoSppInterface::Infer(std::vector *inputs, std::v } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Spp, DpicoSppInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_spp_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_spp_infer.h index b378235acd31db94cca2d57e02a10df52d753bca..c4b2f4f855b1fed8365013aa529c7e6d69ecaeb1 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_spp_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_spp_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoSppInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoSppInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_UPSAMPLE_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_upsample_infer.cc b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_upsample_infer.cc index 9657973599b2d382aec1556430e2caca10f5db0f..3ac22a948e7a226977022bf64fba4b5b30dd54f5 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_upsample_infer.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_upsample_infer.cc @@ -31,7 +31,7 @@ using mindspore::kernel::KernelInterface; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace kernel { std::shared_ptr DpicoUpsampleInferCreater() { std::shared_ptr infer = std::make_shared(); @@ -128,4 +128,4 @@ Status DpicoUpsampleInterface::Infer(std::vector *inputs, } REGISTER_CUSTOM_KERNEL_INTERFACE(DPICO, Upsample, DpicoUpsampleInferCreater) } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_upsample_infer.h b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_upsample_infer.h index 1d56db6cb3b01becd89796a5fde340ed59bd2484..3548d25fd88edb55801f629a89691ecb317a6647 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_upsample_infer.h +++ b/mindspore-lite/tools/converter/adapter/dpico/infer/dpico_upsample_infer.h @@ -20,7 +20,7 @@ #include #include "include/kernel_interface.h" -namespace mindspore { +namespace mindspore::lite { namespace kernel { class DpicoUpsampleInterface : public KernelInterface { public: @@ -32,5 +32,5 @@ class DpicoUpsampleInterface : public KernelInterface { const schema::Primitive *primitive, const kernel::Kernel *kernel) override; }; } // namespace kernel -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_INFER_DPICO_UPSAMPLE_INFER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/bi_lstm_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/bi_lstm_mapper.cc index c4ad6330baf52125febe1c11b9444e845f834cc9..251349d5bc0ea9ad3a2079f433e787891e646851 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/bi_lstm_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/bi_lstm_mapper.cc @@ -22,7 +22,7 @@ #include "common/anf_util.h" #include "op/bi_lstm_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS BiLstmMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -61,4 +61,4 @@ STATUS BiLstmMapper::Map(const api::CNodePtr &cnode, std::vector #include "op/nop_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS NopMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -46,4 +46,4 @@ STATUS NopMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Nop, NopMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/nop_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/nop_mapper.h index 4466e38be4bec83fad83a265e584cda0232dad75..9c708f730f24976f76a76d8a9f03ea5340a45325 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/nop_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/nop_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class NopMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class NopMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_NOP_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/reverse_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/reverse_mapper.cc index 992d4c5c319bcf85649cf492650c16733413ecdc..2b3ce7f87c559ffc86e5c48c0c32d15b4efc3499 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/reverse_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/reverse_mapper.cc @@ -22,7 +22,7 @@ #include "infer/reverse_v2.h" #include "op/reverse_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS ReverseMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -58,4 +58,4 @@ STATUS ReverseMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -74,4 +74,4 @@ STATUS RoiAlignMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -64,4 +64,4 @@ STATUS SppMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Spp, SppMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/spp_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/spp_mapper.h index a2fa02d7c44df848bc77fb06f9a224d6ec34437e..b0bd1afa325de57c4695c4a7b04944afb8b58d17 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/spp_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/legacy_ops/spp_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SppMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class SppMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_SPP_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/abs_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/abs_mapper.cc index 7ef54dbcd31e80c00fdf065189935efe63c924b4..daaf612d8bbed74f48cea19b0be89f6ff7c38c72 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/abs_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/abs_mapper.cc @@ -22,7 +22,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "op/absval_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS AbsMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -52,4 +52,4 @@ STATUS AbsMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Abs, AbsMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/abs_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/abs_mapper.h index fff4d4b0fef0871116000052856976b4458e1105..e2ca7af53a5e1b38ce2b7bbf7695914e0cee20fb 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/abs_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/abs_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class AbsMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class AbsMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_ABS_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/acos_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/acos_mapper.cc index 04469952f4c245f0dc919997a81f0e94808f7305..fbc22fa88e05df56b05242754b4bb90ac9d7a4b2 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/acos_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/acos_mapper.cc @@ -23,7 +23,7 @@ #include "op/acos_operator.h" #include "parser/onnx/onnx_acos_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS AcosMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -44,4 +44,4 @@ STATUS AcosMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Acos, AcosMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/acos_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/acos_mapper.h index e831ebe5ad59617b0a388e33a122d3969524af77..e3f646ddf636c490666ce124bf6c0593a79d78a7 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/acos_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/acos_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class AcosMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class AcosMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_ACOS_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/acosh_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/acosh_mapper.cc index a1d5f91f6cc78cba70a0913e6e6eb1eafaeb59cf..90ecda9b2eddc4c94adc49ec9fd2189df74789f4 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/acosh_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/acosh_mapper.cc @@ -23,7 +23,7 @@ #include "op/acosh_operator.h" #include "parser/onnx/onnx_acosh_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS AcoshMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -44,4 +44,4 @@ STATUS AcoshMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Acosh, AcoshMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/acosh_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/acosh_mapper.h index 6c37f1411f342524c827a4bbc81a8f920a078233..a1f540a2654169172b78a13d3f02c117e3d139fd 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/acosh_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/acosh_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class AcoshMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class AcoshMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_ACOSH_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/activation_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/activation_mapper.cc index 60eaa663435251569a5c4fbc34d94df0fb9149c6..8678444ff917f942d7df1ad09e5d4739f3098f51 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/activation_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/activation_mapper.cc @@ -28,7 +28,7 @@ #include "op/clip_operator.h" #include "op/elu_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr float kNum6 = 6.0; @@ -169,4 +169,4 @@ STATUS ActivationMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -67,4 +67,4 @@ STATUS ArgMaxMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -44,4 +44,4 @@ STATUS AsinhMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Asinh, AsinhMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/asinh_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/asinh_mapper.h index 20f9282a57c6626b37feb529c767943bc42d8e88..e328cd8376af20bff0a5d0bdc3662e6121768c70 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/asinh_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/asinh_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class AsinhMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class AsinhMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_ASINH_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/atanh_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/atanh_mapper.cc index 7e75c3907ac623afdeaafd699bccea0953abba28..1608bf66760f64457fcd4abc4957b67f51826f7f 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/atanh_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/atanh_mapper.cc @@ -23,7 +23,7 @@ #include "op/atanh_operator.h" #include "parser/onnx/onnx_atanh_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS AtanhMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -44,4 +44,4 @@ STATUS AtanhMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Atanh, AtanhMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/atanh_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/atanh_mapper.h index 07b28573182f43d006a31a389ca9d23bcd055432..e6fcfa3aa7fc0bcf61b1aa2696defad35d916423 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/atanh_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/atanh_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class AtanhMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class AtanhMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_ATANH_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/batch_norm_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/batch_norm_mapper.cc index 255ab5170f0808f9fff7597e985dc70b0878d8a3..5ddccfb9d27d92497ee5e08089cca405e56b96b1 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/batch_norm_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/batch_norm_mapper.cc @@ -24,7 +24,7 @@ #include "common/op_enum.h" #include "op/batch_norm_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { // BatchNorm: {BNMeanIndex:2, BNVarIndex:3, ScaleFactorIndex:4} @@ -161,4 +161,4 @@ STATUS BatchNormMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Bias, BiasMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/bias_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/bias_mapper.h index 5dc5b65e1c2e41c7a73a748be36763e00933e059..e040f71103c9d9d3a41a60e152129a44f9391a15 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/bias_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/bias_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class BiasMapper : public OpMapper { public: @@ -32,5 +32,5 @@ class BiasMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_BIAS_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/bitshift_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/bitshift_mapper.cc index b4e8bdfe127ce8a1a3649bdd1ed1ca20192c7c1b..c6aeddd4eae9590015d742ec26f0db5f5dcacb3e 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/bitshift_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/bitshift_mapper.cc @@ -24,7 +24,7 @@ #include "op/bit_shift_operator.h" #include "parser/onnx/onnx_bitshift_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS BitShiftMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -55,4 +55,4 @@ STATUS BitShiftMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -47,4 +47,4 @@ STATUS BnllMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Bnll, BnllMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/bnll_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/bnll_mapper.h index d8f5846cfad5cd576a36edd55621104e4741e4c7..ad993997ab2b8de5f1c688a05eb3a02b7f0a1dde 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/bnll_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/bnll_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class BnllMapper : public OpMapper { public: @@ -32,5 +32,5 @@ class BnllMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_BNLL_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/cast_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/cast_mapper.cc index 749da2e200b0803d499728eff988c78026bdfb56..0d3eb6ec4182cebb0b3321eb6580a8a3adda43cc 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/cast_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/cast_mapper.cc @@ -21,7 +21,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "op/cast_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS CastMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -46,4 +46,4 @@ STATUS CastMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Cast, CastMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/cast_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/cast_mapper.h index 570835a2e3574b771f781f7d55d4bf60ae605655..09f79804508d50a17a08fecd3335962d14b62438 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/cast_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/cast_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class CastMapper : public OpMapper { public: @@ -32,5 +32,5 @@ class CastMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_CAST_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/clip_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/clip_mapper.cc index 940270a6b581fdf7a22968af3acaade6c8b95748..3f9010cbb382b5a3d0231e4b478e1a05a684d0d2 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/clip_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/clip_mapper.cc @@ -21,7 +21,7 @@ #include "infer/clip.h" #include "op/clip_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS ClipMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -58,4 +58,4 @@ STATUS ClipMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Clip, ClipMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/clip_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/clip_mapper.h index c5165e6a8fb2388384e8fe7ccba333a83d1f52dc..bbefdf274f34216a95af8ab3042f09b14358e3ea 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/clip_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/clip_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ClipMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class ClipMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_CLIP_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/concat_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/concat_mapper.cc index a0b45a17bfca255af60f5005db2d980f1114390a..0f78f85f13e43fca504efbcd3ca371787d0e3851 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/concat_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/concat_mapper.cc @@ -21,7 +21,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "op/concat_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS ConcatMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -53,4 +53,4 @@ STATUS ConcatMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Conv2DFusion, ConvMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/conv_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/conv_mapper.h index c08beace10d4530be8088eadb2c68191debfdf94..c37efa61726175fd2e919a09881b5dd7d59853fb 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/conv_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/conv_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ConvMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class ConvMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_CONV_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/cosh_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/cosh_mapper.cc index b81e40859278cab17fad5b23d6de76e620013b52..10034edd7b4fe966263e9eb449dad75f9a805da1 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/cosh_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/cosh_mapper.cc @@ -23,7 +23,7 @@ #include "op/cosh_operator.h" #include "parser/onnx/onnx_cosh_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS CoshMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -44,4 +44,4 @@ STATUS CoshMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Cosh, CoshMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/cosh_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/cosh_mapper.h index 6831feb9f7446e026d3ad9deb12df701a2544f88..bce82f76f5f5d27e8677c55f6b1b9bb9a8ff5a38 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/cosh_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/cosh_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class CoshMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class CoshMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_COSH_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/crop_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/crop_mapper.cc index dd307708179b51193880ca274a3eafeae4e561aa..f1ce0e70d8102760c3f6fd35813c6d1b70281fb9 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/crop_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/crop_mapper.cc @@ -22,7 +22,7 @@ #include "infer/crop.h" #include "op/crop_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS CropMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -61,4 +61,4 @@ STATUS CropMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Crop, CropMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/crop_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/crop_mapper.h index b43689e30873313cccc79445fc491d6beead6dda..36a199277ed7a30a1c5103ad6f13ba3f043eadaf 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/crop_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/crop_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class CropMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class CropMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_CROP_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/custom_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/custom_mapper.cc index 997975b37b174d5c7c03826eaf8ea12ef0c15d1a..3a895636bc200f691770315f626dd6a51c463779 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/custom_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/custom_mapper.cc @@ -24,7 +24,7 @@ #include "op/custom_operator.h" #include "infer/custom.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { custom::ExtendedParam GetParamFromAttrs(const api::SharedPtr &custom_prim, int index) { @@ -110,4 +110,4 @@ STATUS CustomMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -78,4 +78,4 @@ STATUS DecBBoxMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -78,4 +78,4 @@ STATUS DetectionOutputMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -73,4 +73,4 @@ STATUS EltwiseMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -64,4 +64,4 @@ STATUS ExpMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(ExpFusion, ExpMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/exp_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/exp_mapper.h index c190c8dfd56a2475a45977091196e5667e602291..fd47a1a0e56c14c5c410858b4090f418f3fd88a5 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/exp_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/exp_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ExpMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class ExpMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_EXP_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/extract_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/extract_mapper.cc index 953005ce428263339c05018daa919f4651114109..f51e45b6a38a3733e079d858971cf133a8007f94 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/extract_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/extract_mapper.cc @@ -22,7 +22,7 @@ #include "common/op_attr.h" #include "op/extract_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS ExtractMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -58,4 +58,4 @@ STATUS ExtractMapper::Map(const api::CNodePtr &cnode, std::vector *b } REG_MAPPER(FullConnection, FCMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/fc_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/fc_mapper.h index 5a028e021a3e5805af95ab015dc1bb478599a2d0..fd34e1d740bd9b4e53607f49f81e9a332e339a45 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/fc_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/fc_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class FCMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class FCMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_FC_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/flatten_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/flatten_mapper.cc index 571b77a021cf466b2accec3b999259c2abb5807a..2ec42f05b2381e307b666e5d9a595ed5d5b4bbea 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/flatten_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/flatten_mapper.cc @@ -23,7 +23,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "op/flatten_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS FlattenMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -59,4 +59,4 @@ STATUS FlattenMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -48,4 +48,4 @@ STATUS GatherElementsMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -52,4 +52,4 @@ STATUS GruMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Gru, GruMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/gru_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/gru_mapper.h index 09d5a64ff5554ceedbc76d217b5fd0a8764aab7b..1b0b230959cc8accac08fedbebab9303eeaddaeb 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/gru_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/gru_mapper.h @@ -21,7 +21,7 @@ #include #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class GruMapper : public OpMapper { public: @@ -31,6 +31,6 @@ class GruMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_GRU_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/hardmax_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/hardmax_mapper.cc index eb8a2b9fc1f779e589d3419d4dd19437abf05699..5a14549026f21ce22363951776bc4af33c68d4fe 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/hardmax_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/hardmax_mapper.cc @@ -24,7 +24,7 @@ #include "op/hardmax_operator.h" #include "parser/onnx/onnx_hardmax_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS HardmaxMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -65,4 +65,4 @@ STATUS HardmaxMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -49,4 +49,4 @@ STATUS HardSigmoidMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -70,4 +70,4 @@ STATUS InterpMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -61,4 +61,4 @@ STATUS LogMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Log, LogMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/log_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/log_mapper.h index 562788b6404f4ec6a1ee0ffb9ef950851b96f905..bc60cbd57eb76eb47a1b614e060498d23aaa8ce0 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/log_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/log_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class LogMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class LogMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_LOG_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/lrn_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/lrn_mapper.cc index 9f71a5661007c7f663e3f7080b04c7cc374bd8c9..19ce1a13acfa67adddc0899384b2efd275a6191d 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/lrn_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/lrn_mapper.cc @@ -23,7 +23,7 @@ #include "infer/lrn.h" #include "op/lrn_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS LrnMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -64,4 +64,4 @@ STATUS LrnMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(LRN, LrnMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/lrn_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/lrn_mapper.h index 15dcf4b7e9bf83f8463ef290cd1ac53d5cdfd806..0e27731dc0c5f3730af52909d56a247b557b4a24 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/lrn_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/lrn_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class LrnMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class LrnMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_LRN_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/lstm_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/lstm_mapper.cc index 31fd46d16c1046e068ae11d742855c64bf974309..d0cd7a38683ec769e32d7590117f30d8a40a4b80 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/lstm_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/lstm_mapper.cc @@ -22,7 +22,7 @@ #include "common/anf_util.h" #include "op/lstm_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { constexpr int kNums1 = 1; constexpr int kNums2 = 2; @@ -96,4 +96,4 @@ STATUS LstmMapper::Map(const api::CNodePtr &cnode, std::vector REG_MAPPER(Lstm, LstmMapper) REG_MAPPER(LSTM, LstmMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/lstm_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/lstm_mapper.h index 77f784ec87946901c2ee7443f58951e006a48c1d..2a873ad8123ebe2b593d5961beb9e578773b748a 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/lstm_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/lstm_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class LstmMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class LstmMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_LSTM_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/mat_mul_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/mat_mul_mapper.cc index 63053488f123e336282e6145ef162a6f7c3698d2..3849e8227c1d79e8df9fd76c63963792e0a4f444 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/mat_mul_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/mat_mul_mapper.cc @@ -23,7 +23,7 @@ #include "common/anf_util.h" #include "op/matrix_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { STATUS DoMaxtixOperatorMap(const api::CNodePtr &cnode, std::vector *base_operators, @@ -94,4 +94,4 @@ STATUS MatMulMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -69,4 +69,4 @@ STATUS MaxUnpoolMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -48,4 +48,4 @@ STATUS MishMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Mish, MishMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/mish_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/mish_mapper.h index f41e7950476e10074a14dc752187794a1c6e4dbc..4f78420e2768290e03dcce9d29e3a2b5f8ed8903 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/mish_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/mish_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class MishMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class MishMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_MISH_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/mod_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/mod_mapper.cc index 1be94b9e8a0da145d1acf4bc0b5c6b02d2e05f16..ebdeecb45898496466c720d5de10766e58e2707f 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/mod_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/mod_mapper.cc @@ -23,7 +23,7 @@ #include "op/mod_operator.h" #include "parser/onnx/onnx_mod_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS ModMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -50,4 +50,4 @@ STATUS ModMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Mod, ModMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/mod_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/mod_mapper.h index 83ff47b781589be000dc17cd084fb81113e637e9..7dc99b733ba32c86f1d781968c1e26b809dc7e78 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/mod_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/mod_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ModMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class ModMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_MOD_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/mvn_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/mvn_mapper.cc index 832213ac9e9fd11ce2d16ed2d7ee9158eae0aff2..81340b9fa669177d7668f77b3687fd1bb65615ae 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/mvn_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/mvn_mapper.cc @@ -22,7 +22,7 @@ #include "common/op_attr.h" #include "op/mvn_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS MvnMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -67,4 +67,4 @@ STATUS MvnMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Mvn, MvnMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/mvn_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/mvn_mapper.h index 9d4d8b3daf9519aa634066ba11ec188e8fd8e546..256af2d4b481ef23abbf737e6ce42a9d00b9a757 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/mvn_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/mvn_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class MvnMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class MvnMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_MVN_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/normalize_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/normalize_mapper.cc index 9e0dbfc73ea3d865c26346566ec6955702fa5432..09d34374cc0c5ad45d8cadabaf1372c60c57b0b5 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/normalize_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/normalize_mapper.cc @@ -22,7 +22,7 @@ #include "common/op_attr.h" #include "op/normalize_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { STATUS SetNormalizeDataInfo(const api::CNodePtr &cnode, mapper::NormalizeOperator *normalize_operator) { @@ -102,4 +102,4 @@ STATUS NormalizeMapper::Map(const api::CNodePtr &cnode, std::vector; class OpMapper { @@ -61,6 +61,6 @@ STATUS SetOnnxLstmOffLineArgs(mapper::RecurrentOperator *recurrent_operator, siz const vector &shape_vec, const float *data); STATUS PushOfflineArgs(const api::CNodePtr &cnode, mapper::BaseOperator *base_operator, size_t offline_args_size); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_OP_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/op_mapper_registry.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/op_mapper_registry.cc index 51df42ca33cb4add417ce5f8d259112fb3f34414..ff9bc94dc615f5e4526a0547b019e4ca9c16a7ec 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/op_mapper_registry.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/op_mapper_registry.cc @@ -17,7 +17,7 @@ #include "mapper/op_mapper_registry.h" #include -namespace mindspore { +namespace mindspore::lite { namespace dpico { OpMapperRegistry::OpMapperRegistry() = default; @@ -34,4 +34,4 @@ OpMapperPtr OpMapperRegistry::GetOpMapper(const std::string &name) { return nullptr; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/op_mapper_registry.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/op_mapper_registry.h index c6eead7bcbce4a8e4894fcb4a0f5bd2ac0980529..ffa09881454efbf3db436cb253d4e6408e98cc28 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/op_mapper_registry.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/op_mapper_registry.h @@ -23,7 +23,7 @@ #include #include "mapper/op_mapper.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class OpMapperRegistry { public: @@ -49,5 +49,5 @@ class OpMapperRegistrar { #define REG_MAPPER(primitive_type, mapper) \ static OpMapperRegistrar g_##primitive_type##MapperReg(#primitive_type, std::make_shared()); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_OP_MAPPER_REGISTRY_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/pad_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/pad_mapper.cc index b4ddee491074872309499ee0918642fe8f55be63..0e67354c807a71694731ebf45a5f546f38538eb2 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/pad_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/pad_mapper.cc @@ -23,7 +23,7 @@ #include "op/pad_operator.h" #include "infer/cxx_api/pad_fusion.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { STATUS SetPadDataInfo(const api::CNodePtr &cnode, mapper::PadOperator *pad_operator) { @@ -96,4 +96,4 @@ STATUS PadMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(PadFusion, PadMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/pad_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/pad_mapper.h index 863cc3a47059d5204feae8d4b26f3d4d171bcc92..58efd41bc11c5b1843bea91960fdba80eabf1201 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/pad_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/pad_mapper.h @@ -24,7 +24,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class PadMapper : public OpMapper { public: @@ -34,6 +34,6 @@ class PadMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_PAD_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/passthrough_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/passthrough_mapper.cc index 19872272bd66f7e1db8765ce0b16ec3eb0d4f110..7235d65e14fe48d2b3e988b88402ff8144ab395f 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/passthrough_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/passthrough_mapper.cc @@ -22,7 +22,7 @@ #include "common/anf_util.h" #include "op/passthrough_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS PassThroughMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -61,4 +61,4 @@ STATUS PassThroughMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -95,4 +95,4 @@ STATUS PermuteMapper::Map(const api::CNodePtr &cnode, std::vector REG_MAPPER(AvgPoolFusion, PoolMapper) REG_MAPPER(MaxPoolFusion, PoolMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/pool_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/pool_mapper.h index f40203c4747ed08e2275f1b0563960ea476eb662..162f5de71e931da8ae2d23d39c6ab6c85b17a574 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/pool_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/pool_mapper.h @@ -24,7 +24,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class PoolMapper : public OpMapper { public: @@ -34,6 +34,6 @@ class PoolMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_POOL_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/power_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/power_mapper.cc index 67823ad5dad8ae91c9b77253c5f03b4df2096e60..235b07964c2ce681d381ae1d22600268abd40fce 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/power_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/power_mapper.cc @@ -24,7 +24,7 @@ #include "infer/cxx_api/pow_fusion.h" #include "op/power_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS PowerMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -78,4 +78,4 @@ STATUS PowerMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(PowFusion, PowerMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/power_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/power_mapper.h index 7fec797ff73d02c0ed8b2774d459d629303df929..c12f6673ea4c4af37bdcf9f198242021075fb6a6 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/power_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/power_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class PowerMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class PowerMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_POWER_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/prelu_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/prelu_mapper.cc index 3fdf6e09cc038248b95296ad87da90849fdc47ac..ee8b2d069d98da5f7a71e791c31182ad00b66674 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/prelu_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/prelu_mapper.cc @@ -24,7 +24,7 @@ #include "infer/cxx_api/prelu_fusion.h" #include "op/prelu_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { STATUS SetPReluDataInfo(const api::CNodePtr &cnode, const api::PrimitivePtr &prim, @@ -87,4 +87,4 @@ STATUS PReluMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(PReLUFusion, PReluMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/prelu_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/prelu_mapper.h index 2d4dfcd239e70804dc8d18ed78ecda8e34fdd854..fcc76968ec31c38f8d7727ff15cd2bbae3eb88b0 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/prelu_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/prelu_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class PReluMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class PReluMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_PRELU_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/psroi_pool_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/psroi_pool_mapper.cc index 759e634145c3ead1e19430930106c9a3778827df..156d82a1da394c85e0ab70068cbddae025244f5a 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/psroi_pool_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/psroi_pool_mapper.cc @@ -22,7 +22,7 @@ #include "common/anf_util.h" #include "op/ps_roi_pool_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS PsRoiPoolMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -58,4 +58,4 @@ STATUS PsRoiPoolMapper::Map(const api::CNodePtr &cnode, std::vector &reduction_prim, @@ -133,4 +133,4 @@ STATUS ReductionMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -98,4 +98,4 @@ STATUS ReshapeMapper::Map(const api::CNodePtr &cnode, std::vector kCoordinateModeMap = { @@ -212,4 +212,4 @@ STATUS ResizeMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -57,4 +57,4 @@ STATUS RnnMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Rnn, RnnMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/rnn_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/rnn_mapper.h index a2da0522f95a9f5a861c81f1401589dd91879b41..5be9ab75eb98bc2b0a96ca975fcd0e1bd38387f2 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/rnn_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/rnn_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class RnnMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class RnnMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_RNN_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/roi_pool_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/roi_pool_mapper.cc index 120ff8bf69633a9fb00c02d50a78acb294862801..f4a56370558fc35f488394d8e8b302b774602681 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/roi_pool_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/roi_pool_mapper.cc @@ -21,7 +21,7 @@ #include "infer/roi_pooling.h" #include "op/roi_pool_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS RoiPoolMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -59,4 +59,4 @@ STATUS RoiPoolMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(ScaleFusion, ScaleMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/scale_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/scale_mapper.h index e6e75266ac9cdeb2cac2cc5346aa25cb4446507d..4472f5997e11f68424a391d8e908cb53e720bf6a 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/scale_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/scale_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ScaleMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class ScaleMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_SCALE_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/shape_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/shape_mapper.cc index 8c7d5b289380cfd96b565c9493e70360f04eedf5..fff5651567ce16d2a5db26b48b070cb127219c63 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/shape_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/shape_mapper.cc @@ -22,7 +22,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "op/shape_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS ShapeMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -47,4 +47,4 @@ STATUS ShapeMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Shape, ShapeMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/shape_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/shape_mapper.h index 25fdf9d87432ec7c28394afb2475cda4be1c0b6a..7df3bb9ba6260da52a5facd3286760627e725ea5 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/shape_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/shape_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class ShapeMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class ShapeMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_SHAPE_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/shrink_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/shrink_mapper.cc index 3e1c64ac140f78788cd22b64cc2ceda47a12e685..74ab07d134fdd28693062ba284176780b9417f41 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/shrink_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/shrink_mapper.cc @@ -23,7 +23,7 @@ #include "op/shrink_operator.h" #include "parser/onnx/onnx_shrink_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS ShrinkMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -50,4 +50,4 @@ STATUS ShrinkMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -52,4 +52,4 @@ STATUS ShuffleChannelMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -44,4 +44,4 @@ STATUS SinhMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Sinh, SinhMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/sinh_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/sinh_mapper.h index a51a08eab0d465350d790a5e9ecc7eabc644d43c..ae58bcc59b77c812b6b2ad2c0772441bee482c49 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/sinh_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/sinh_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SinhMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class SinhMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_SINH_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/slice_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/slice_mapper.cc index 73def63200e4fa4de35ccb499a0b41ec6b613a10..8585dc4d7ce3eee127d7c80e815127b6f8367f28 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/slice_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/slice_mapper.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "op/slice_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS SliceMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -113,4 +113,4 @@ STATUS SliceMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Split, SliceMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/slice_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/slice_mapper.h index 757774406a65624da1bb0439112d8cdc19b4dfa1..31a840b685bd4ca86c97b9e0da203c7a93d1a7fa 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/slice_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/slice_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SliceMapper : public OpMapper { public: @@ -32,5 +32,5 @@ class SliceMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_SLICE_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/softmax_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/softmax_mapper.cc index 13b6cebcab32c3115db22d92aab9920e7c3803c6..cd0970a3aaf33fb8b5fa9ab90a1c97dd30d73bfe 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/softmax_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/softmax_mapper.cc @@ -23,7 +23,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "op/softmax_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS SoftmaxMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -62,4 +62,4 @@ STATUS SoftmaxMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -47,4 +47,4 @@ STATUS SoftSignMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -47,4 +47,4 @@ STATUS SqrtMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(Sqrt, SqrtMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/sqrt_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/sqrt_mapper.h index 5690752633ad5b71a9d3d16f2b8c07922df0854b..09268824e03b170ebccef13b4369d5f89141b09d 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/sqrt_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/sqrt_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class SqrtMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class SqrtMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_SQRT_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/squeeze_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/squeeze_mapper.cc index c2ff394553baea44463aac08804a42256306703d..71e24bf680cd3adbb33b1127c0f6a4afb60982cd 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/squeeze_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/squeeze_mapper.cc @@ -22,7 +22,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" #include "op/squeeze_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS SqueezeMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -62,4 +62,4 @@ STATUS SqueezeMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -52,4 +52,4 @@ STATUS ThresholdMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -98,4 +98,4 @@ STATUS TileMapper::Map(const api::CNodePtr &cnode, std::vector } REG_MAPPER(TileFusion, TileMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/tile_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/tile_mapper.h index 6893726b1ed7c1a14e9d9e5fc7b890ed124d2070..539bef5e1783ed097da058e591b9f2b668576a46 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/tile_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/tile_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class TileMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class TileMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_TILE_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/unsqueeze_mapper.cc b/mindspore-lite/tools/converter/adapter/dpico/mapper/unsqueeze_mapper.cc index 8524880a95590d273a5eda2c01a7df1fec37913d..6b8bc45d580ee4c2bcd0de15ab5069a2f3ce2653 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/unsqueeze_mapper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/unsqueeze_mapper.cc @@ -23,7 +23,7 @@ #include "infer/unsqueeze.h" #include "op/unsqueeze_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { STATUS UnsqueezeMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -66,4 +66,4 @@ STATUS UnsqueezeMapper::Map(const api::CNodePtr &cnode, std::vector *base_operators, const api::PrimitivePtr &prim, const api::CNodePtrList &output_cnodes) { @@ -63,4 +63,4 @@ STATUS UpsampleMapper::Map(const api::CNodePtr &cnode, std::vector * } REG_MAPPER(Xor, XorMapper) } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/mapper/xor_mapper.h b/mindspore-lite/tools/converter/adapter/dpico/mapper/xor_mapper.h index 52e7f5222338f130212105e9893bed87abbe58d7..043ea8ee666fc9a1c57210c9afb29920a8d12073 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/mapper/xor_mapper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/mapper/xor_mapper.h @@ -22,7 +22,7 @@ #include "mapper/op_mapper.h" #include "mapper/op_mapper_registry.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class XorMapper : public OpMapper { public: @@ -32,6 +32,6 @@ class XorMapper : public OpMapper { const api::CNodePtrList &output_cnodes) override; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_MAPPER_XOR_MAPPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/parser/detection_output_param_helper.cc b/mindspore-lite/tools/converter/adapter/dpico/parser/detection_output_param_helper.cc index 702add48382f49e22a5aad8db2e5c8aae3fabb20..b905937278bbe848dab01b50e2d6452f252139c6 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/parser/detection_output_param_helper.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/parser/detection_output_param_helper.cc @@ -26,7 +26,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { int GetProposalParamType(mapper::ProposalParamType *proposal_param_type, @@ -261,4 +261,4 @@ int GetDetectionOutputParamFromAttrs(std::vector * return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/parser/detection_output_param_helper.h b/mindspore-lite/tools/converter/adapter/dpico/parser/detection_output_param_helper.h index 694e65fa4876c789d6b69b45b874b7d1e365705b..4c8caf283c2212604939a2755b720bf03e11dbf8 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/parser/detection_output_param_helper.h +++ b/mindspore-lite/tools/converter/adapter/dpico/parser/detection_output_param_helper.h @@ -25,12 +25,12 @@ #include "infer/custom.h" #include "./pico_caffe.pb.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { int SetAttrsByDetectionOutputParam(const std::shared_ptr &custom_prim, const caffe::LayerParameter &proto); int SetAttrsByDecBboxParam(const std::shared_ptr &custom_prim, const caffe::LayerParameter &proto); int GetDetectionOutputParamFromAttrs(std::vector *detection_params, const api::SharedPtr &custom_prim); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_PARSER_DETECTION_OUTPUT_PARAM_HELPER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/calib_data_generator.cc b/mindspore-lite/tools/converter/adapter/dpico/src/calib_data_generator.cc index 5a1f2270b6e23f9e313f5d1a523a1c104d23c7f2..618cfd7c92ae89e1e912044e35983aaba714bff5 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/calib_data_generator.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/src/calib_data_generator.cc @@ -31,7 +31,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr size_t kMaxSize = 1024; @@ -309,4 +309,4 @@ int CalibDataGenerator::Run(const api::AnfNodePtrList &graph_inputs, const api:: return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/calib_data_generator.h b/mindspore-lite/tools/converter/adapter/dpico/src/calib_data_generator.h index a1ae935831948652886ee5ed60a87a57fda4047b..e02b8505b24b554835b9bd3d48047e1d859a0bed 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/calib_data_generator.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/calib_data_generator.h @@ -32,7 +32,7 @@ #include "include/errorcode.h" #include "common/check_base.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { constexpr auto kNchw2Nhwc = "nchw2nhwc"; constexpr auto kNhwc2Nchw = "nhwc2nchw"; @@ -157,6 +157,6 @@ class CalibDataGenerator { std::map> control_flow_inputs_; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_CALIB_DATA_GENERATOR_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/custom_creator.cc b/mindspore-lite/tools/converter/adapter/dpico/src/custom_creator.cc index 35224fd7a663794bd24dd5416f37f11675f2fbf8..b0a72f27b4b6b7739d14ff0a421548e133077d72 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/custom_creator.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/src/custom_creator.cc @@ -36,7 +36,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { const int kMaxRoiFrameCnt = 300; @@ -463,4 +463,4 @@ STATUS CustomOpCreator::SetCustomMultiOutput(const api::FuncGraphPtr &func_graph return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/custom_creator.h b/mindspore-lite/tools/converter/adapter/dpico/src/custom_creator.h index 2978844eae473ec38de2f80158bb48d04734f8ec..424af4b0c690d6ab62d217e45e83cff885ceabf2 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/custom_creator.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/custom_creator.h @@ -27,7 +27,7 @@ #include "include/errorcode.h" using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace dpico { using ModelCoreInfoPtr = std::shared_ptr; class CustomOpCreator { @@ -63,5 +63,5 @@ class CustomOpCreator { bool has_unsupported_; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_CUSTOM_CREATOR_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/data_preprocessor.cc b/mindspore-lite/tools/converter/adapter/dpico/src/data_preprocessor.cc index 3b6a4cee4657e9babf05509e6efef436a06f425e..63c035b7fe93f5440f94a40e2c805e73135ea691 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/data_preprocessor.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/src/data_preprocessor.cc @@ -30,7 +30,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { const std::unordered_set kRgbInputFormats = {"BGR_PLANAR", "RGB_PLANAR", "RGB_PACKAGE", "BGR_PACKAGE"}; @@ -355,4 +355,4 @@ int DataPreprocessor::Run(const api::AnfNodePtrList &inputs) { return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/data_preprocessor.h b/mindspore-lite/tools/converter/adapter/dpico/src/data_preprocessor.h index 159c158626b68a1db3b9ea8d31f7a70dc148287e..6043b64a4d775135d794ec4c9f6fd6a1b1bd24ec 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/data_preprocessor.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/data_preprocessor.h @@ -34,7 +34,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace dpico { class DataPreprocessor { public: @@ -134,6 +134,6 @@ class DataPreprocessor { size_t batch_size_{0}; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_DATA_PREPROCESSOR_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/dpico_pass.cc b/mindspore-lite/tools/converter/adapter/dpico/src/dpico_pass.cc index a36f10250e7a399772db223882c8c395c14a8abc..507a0fbffa2b54d803c6f1837065c7d1ba47cf63 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/dpico_pass.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/src/dpico_pass.cc @@ -40,7 +40,7 @@ #include "src/custom_creator.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { const size_t kMinimumNumbOfSegments = 1; @@ -555,10 +555,10 @@ bool DpicoPass::Execute(const api::FuncGraphPtr &func_graph) { } REG_PASS(DpicoPass, dpico::DpicoPass) } // namespace dpico -} // namespace mindspore -namespace mindspore::registry { +} // namespace mindspore::lite +namespace mindspore::lite::registry { const std::vector schedule_pipe = {"ConstFoldPass", "ToNCHWFormat", "DpicoPreprocessPass", "DecreaseTransposeAlgo", "DumpGraph", "DpicoPass", "ToNHWCFormat"}; REG_SCHEDULED_PASS(POSITION_BEGIN, schedule_pipe) -} // namespace mindspore::registry +} // namespace mindspore::lite::registry diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/dpico_pass.h b/mindspore-lite/tools/converter/adapter/dpico/src/dpico_pass.h index cb262e70ca98e628e587e81f2b8f6d15fedeb5f3..b6703717f2595166ffcd51ce8596b973f73feb38 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/dpico_pass.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/dpico_pass.h @@ -30,7 +30,7 @@ #include "src/graph_split_api.h" using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace dpico { class DpicoPass : public registry::PassBase { public: @@ -57,6 +57,6 @@ class DpicoPass : public registry::PassBase { std::string dpico_config_path_{}; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_DPICO_PASS_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/dpico_preprocess_pass.cc b/mindspore-lite/tools/converter/adapter/dpico/src/dpico_preprocess_pass.cc index 45537e585a3e22f44f0573177ede3969bcdb2d99..95d906901db60594dd329e8b8a27423fe5960749 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/dpico_preprocess_pass.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/src/dpico_preprocess_pass.cc @@ -26,7 +26,7 @@ #include "common/op_attr.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { STATUS InsertTransposeBeforeBiasAdd(const api::FuncGraphPtr &func_graph, const api::CNodePtr &cnode, @@ -216,7 +216,7 @@ bool DpicoPreprocessPass::Execute(const api::FuncGraphPtr &func_graph) { return true; } } // namespace dpico -} // namespace mindspore -namespace mindspore::registry { +} // namespace mindspore::lite +namespace mindspore::lite::registry { REG_PASS(DpicoPreprocessPass, dpico::DpicoPreprocessPass) } diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/dpico_preprocess_pass.h b/mindspore-lite/tools/converter/adapter/dpico/src/dpico_preprocess_pass.h index 207513597fab97ec14e57ea87978777e9203ad06..89d50d75916730cadc8c1d30a2f4baf184ea2a1e 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/dpico_preprocess_pass.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/dpico_preprocess_pass.h @@ -28,7 +28,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace dpico { class DpicoPreprocessPass : public registry::PassBase { public: @@ -41,6 +41,6 @@ class DpicoPreprocessPass : public registry::PassBase { STATUS PreProcessBiadAdd(const api::FuncGraphPtr &func_graph, const api::CNodePtr &cnode); }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_DPICO_PREPROCESS_PASS_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_api.cc b/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_api.cc index ad99c5eae7ae8a0e57cffccb2b6baf67f63218a8..c70e9b288892d828a53513b7bc5f44cc9461f0df 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_api.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_api.cc @@ -34,7 +34,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_NULL_PTR; using mindspore::lite::RET_OK; -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr auto kFormat = "format"; @@ -392,4 +392,4 @@ int FillSubgraphOutputsFormat(Subgraph *subgraph, const api::FuncGraphPtr &func_ return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_api.h b/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_api.h index 3937aecfa0a0cf654f49cede1b81afed112df738..59046f0b68855c5cfb962317c221f765bfd15469 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_api.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_api.h @@ -22,7 +22,7 @@ #include #include "mindapi/ir/common.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { struct Subgraph; struct GraphSplitInfo; @@ -32,5 +32,5 @@ api::AnfNodePtrList GetSubgraphInputs(const Subgraph &subgraph, const api::FuncG api::AnfNodePtrList GetSubgraphOutputs(const Subgraph &subgraph, const api::FuncGraphManagerPtr &manager); int FillSubgraphOutputsFormat(Subgraph *subgraph, const api::FuncGraphPtr &func_graph); } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_GRAPH_SPLITT_API_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_info.h b/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_info.h index 0255a6a667b80c01dd62db8b7160392941c0c96f..596dc12110d3dcea14442566c22c22002e2f0d5c 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_info.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/graph_split_info.h @@ -23,7 +23,7 @@ #include "mindapi/ir/common.h" using ShapeVector = std::vector; -namespace mindspore { +namespace mindspore::lite { namespace dpico { enum OmNetType : int { kCnn = 0, kRoi = 1, kRecurrent = 2 }; @@ -46,5 +46,5 @@ struct GraphSplitInfo { std::map> subgraphs_map; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_GRAPH_SPLIT_INFO_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/mapper_config_parser.cc b/mindspore-lite/tools/converter/adapter/dpico/src/mapper_config_parser.cc index 88032deae4c1bff873f7e25f4124b2432ec2789b..62f4acb692e4d6eff8d862588276f654f05e051d 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/mapper_config_parser.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/src/mapper_config_parser.cc @@ -23,7 +23,7 @@ #include "common/file_util.h" #include "mindapi/base/logging.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { constexpr size_t kPairSize = 2; @@ -374,4 +374,4 @@ void MapperConfigParser::SetOriginConfigFilePath(const std::string &origin_confi origin_config_file_path_ = origin_config_file_path; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/mapper_config_parser.h b/mindspore-lite/tools/converter/adapter/dpico/src/mapper_config_parser.h index ca8f4f8a5e97a5f71639dfce4642c67d2ba13de7..63c53d036b6b79a5003cf23a2bcb8936e5ad34ab 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/mapper_config_parser.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/mapper_config_parser.h @@ -24,7 +24,7 @@ #include #include "ir/dtype/type_id.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { constexpr auto kInsertOpConf = "[insert_op_conf]"; constexpr auto kInstructionName = "[instruction_name]"; @@ -88,5 +88,5 @@ class MapperConfigParser { std::string internal_stride_ = "16"; }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_MAPPER_CONFIG_PARSER_H_ diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/om_generator.cc b/mindspore-lite/tools/converter/adapter/dpico/src/om_generator.cc index b2fee07016c1eae86e3e942cb4998335640d3879..096925c5fdaca8ec8c142c317a0c6dc8301b4b24 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/om_generator.cc +++ b/mindspore-lite/tools/converter/adapter/dpico/src/om_generator.cc @@ -33,7 +33,7 @@ #include "src/mapper_config_parser.h" #include "src/graph_split_api.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { namespace { const std::unordered_map kMapperSupportedTypes = { @@ -388,4 +388,4 @@ int OmGenerator::Run(const api::FuncGraphPtr &func_graph, const Subgraph &sub_gr return RET_OK; } } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/adapter/dpico/src/om_generator.h b/mindspore-lite/tools/converter/adapter/dpico/src/om_generator.h index 50d089c5b6dba1875a91fdf3438e5eb24f153016..0b377b69d06d837f50d1be11066c5ac95dad534a 100644 --- a/mindspore-lite/tools/converter/adapter/dpico/src/om_generator.h +++ b/mindspore-lite/tools/converter/adapter/dpico/src/om_generator.h @@ -27,7 +27,7 @@ #include "mapper/op_mapper.h" #include "op/base_operator.h" -namespace mindspore { +namespace mindspore::lite { namespace dpico { class OmGenerator { public: @@ -45,5 +45,5 @@ class OmGenerator { std::vector *base_operators); }; } // namespace dpico -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_ADAPTER_DPICO_SRC_OM_GENERATOR_H_ diff --git a/mindspore-lite/tools/converter/converter_context.cc b/mindspore-lite/tools/converter/converter_context.cc index b9313985eb98c9c33577ed0b17e8c7217479cdc8..eab1a76a442d263d43b80966c1e1fb4d021064d5 100644 --- a/mindspore-lite/tools/converter/converter_context.cc +++ b/mindspore-lite/tools/converter/converter_context.cc @@ -18,7 +18,7 @@ #include #include "include/registry/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace converter { constexpr int kMaxInput = 255; @@ -62,4 +62,4 @@ std::map, std::vector> ConverterContext::GetConfigInfo(c return MapStringToVectorChar(external_used_config_infos.at(CharToString(section))); } } // namespace converter -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/converter_lite/converter_flags.cc b/mindspore-lite/tools/converter/converter_lite/converter_flags.cc index 945d74d1f71314188177c2bac2390b17cf9142f8..3e0868e725d6053e48442ee4a33759d2db18261c 100644 --- a/mindspore-lite/tools/converter/converter_lite/converter_flags.cc +++ b/mindspore-lite/tools/converter/converter_lite/converter_flags.cc @@ -24,7 +24,7 @@ #include "tools/common/string_util.h" -namespace mindspore::converter { +namespace mindspore::lite::converter { using mindspore::lite::RET_INPUT_PARAM_INVALID; using mindspore::lite::RET_OK; @@ -423,4 +423,4 @@ int Flags::Init(int argc, const char **argv) { return RET_OK; } -} // namespace mindspore::converter +} // namespace mindspore::lite::converter diff --git a/mindspore-lite/tools/converter/converter_lite/converter_flags.h b/mindspore-lite/tools/converter/converter_lite/converter_flags.h index dc1c2570892c26634b7205add677ca5e69108a64..67e823c9ff10ef0e8cc528d2498b928c4a3dbc91 100644 --- a/mindspore-lite/tools/converter/converter_lite/converter_flags.h +++ b/mindspore-lite/tools/converter/converter_lite/converter_flags.h @@ -24,7 +24,7 @@ #include "include/registry/converter_context.h" #include "tools/common/flag_parser.h" -namespace mindspore { +namespace mindspore::lite { namespace converter { class Flags : public virtual mindspore::lite::FlagParser { public: @@ -93,6 +93,6 @@ class Flags : public virtual mindspore::lite::FlagParser { bool optimizeTransformer = false; }; } // namespace converter -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_CONVERTER_LITE_CONVERTER_FLAGS_H_ diff --git a/mindspore-lite/tools/converter/cxx_api/converter_para.h b/mindspore-lite/tools/converter/cxx_api/converter_para.h index 915b110986dbef3632e45351da3bf541189281f3..c6c52ca30adeb5400aa1fa48d713d5a150d2334d 100644 --- a/mindspore-lite/tools/converter/cxx_api/converter_para.h +++ b/mindspore-lite/tools/converter/cxx_api/converter_para.h @@ -28,7 +28,7 @@ #include "tools/converter/micro/coder/config.h" #include "src/common/config_infos.h" -namespace mindspore { +namespace mindspore::lite { enum ParallelSplitType { SplitNo = 0, SplitByUserRatio = 1, SplitByUserAttr = 2 }; struct ParallelSplitConfig { @@ -118,5 +118,5 @@ struct ConverterPara { ConfigInfos config_infos; std::vector const_names; }; -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_CXX_API_CONVERTER_PARA_H_ diff --git a/mindspore-lite/tools/converter/import/cast_op_adjust.cc b/mindspore-lite/tools/converter/import/cast_op_adjust.cc index 42cf75f93f6cd583b703e256d622120c693285e2..65b8252b0d9acc2f1b81e7778b23b1057d5b4f2c 100644 --- a/mindspore-lite/tools/converter/import/cast_op_adjust.cc +++ b/mindspore-lite/tools/converter/import/cast_op_adjust.cc @@ -21,7 +21,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { constexpr size_t kCastInputNum = 3; bool GetInOutDataTypeValue(const CNodePtr &cast_cnode, int *output_type_value, int *input_type_value) { @@ -158,4 +158,4 @@ bool CastOpAdjust::Run(const FuncGraphPtr &func_graph, bool strict_mode_flag) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/cast_op_adjust.h b/mindspore-lite/tools/converter/import/cast_op_adjust.h index c00fb570738b88862c743a36929f79d4b0803675..9c977d057744ccc42211087b4cc58cc8117b47a2 100644 --- a/mindspore-lite/tools/converter/import/cast_op_adjust.h +++ b/mindspore-lite/tools/converter/import/cast_op_adjust.h @@ -20,7 +20,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class CastOpAdjust : public Pass { public: @@ -30,5 +30,5 @@ class CastOpAdjust : public Pass { bool Run(const FuncGraphPtr &graph, bool strict_mode_flag); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_IMPORT_CAST_OP_ADJUST_H_ diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/convert_extend_ops_pass.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/convert_extend_ops_pass.cc index ab699104e56082875af23cc09b05025577931cff..1013097edb07de3bb8a62f4bfb55a8cd352c4f14 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/convert_extend_ops_pass.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/convert_extend_ops_pass.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_z.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_o.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr auto kNameSumExtPatternName = "SumExtPatternName"; constexpr auto kNameMatMulExtPatternName = "MatMulExtPatternName"; @@ -164,4 +164,4 @@ AnfNodePtr ConvertExtendOpsPass::Process(const std::string &pattern_name, const } return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/convert_extend_ops_pass.h b/mindspore-lite/tools/converter/import/convert_extend_ops/convert_extend_ops_pass.h index e7c5fb8026dc80161305f71aa0f62e4a5931daad..310c3beef71e03db22643549a88f5fdf9224e829 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/convert_extend_ops_pass.h +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/convert_extend_ops_pass.h @@ -21,7 +21,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /** * ConvertExtendOpsPass will take effect when some extend operations are found in mindir. @@ -58,5 +58,5 @@ AnfNodePtr ConvertOnesPass(const FuncGraphPtr &func_graph, const mindspore::AnfN AnfNodePtr ConvertZerosPass(const FuncGraphPtr &func_graph, const mindspore::AnfNodePtr &node); AnfNodePtr ConvertMulsPass(const FuncGraphPtr &func_graph, const mindspore::AnfNodePtr &node); } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_IMPORT_CONVERT_EXTEND_OPS_CONVERT_EXTEND_OPS_PASS_H_ diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/dense.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/dense.cc index 5facc5ec46e14d05eb930a9e04a0c76a8579cc04..2ab40a4d3fa61e15db305dcd0e6e1492b1859592 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/dense.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/dense.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_d.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { ShapeArray CalcDenseReshapeVector(const ShapeVector &input_shape_vec, const ShapeVector &weight_shape_vec) { ShapeVector input_reshape_vec = {-1, input_shape_vec.back()}; @@ -113,4 +113,4 @@ AnfNodePtr ConvertDensePass(const FuncGraphPtr &func_graph, const mindspore::Anf return output; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/matmul_ext.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/matmul_ext.cc index 893f5710f994d604d919851a0fcda8b9d4457dbe..8e2ea7100f4593e8c30fb9152912efe756a4a7c4 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/matmul_ext.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/matmul_ext.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_b.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kMatMulRank = 2; @@ -245,4 +245,4 @@ AnfNodePtr ConvertMatMulExtPass(const FuncGraphPtr &func_graph, const mindspore: MS_CHECK_TRUE_MSG(output != nullptr, nullptr, "Can't get Reshape output from MatMulExt."); return output; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/max_min.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/max_min.cc index bb8e34a64b760452cd28d728c8d2ac85bd4d83d5..00eafc9d6153b73ee40534d39f7b72735ddae396 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/max_min.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/max_min.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { AnfNodePtr ConvertMaxMinPass(const FuncGraphPtr &func_graph, const mindspore::AnfNodePtr &node) { auto max_min_cnode = node->cast(); MS_CHECK_TRUE_RET(max_min_cnode != nullptr, nullptr); @@ -72,4 +72,4 @@ AnfNodePtr ConvertMaxMinPass(const FuncGraphPtr &func_graph, const mindspore::An return reduce_max_min_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/muls.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/muls.cc index 64e2bcec9c31db20a816daa476dee38fbf8aa207..c867263e638e49080df03995b596f0c4d837361a 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/muls.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/muls.cc @@ -27,7 +27,7 @@ #include "mindspore/ccsrc/include/common/utils/convert_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { TypeId GetMulsPromoteType(TypeId input_type, TypeId other_type) { std::set kSet = {kNumberTypeUInt8, kNumberTypeInt8, kNumberTypeInt16, kNumberTypeInt32, kNumberTypeInt64}; @@ -95,4 +95,4 @@ AnfNodePtr ConvertMulsPass(const FuncGraphPtr &func_graph, const mindspore::AnfN return mul_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/ones.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/ones.cc index f813c8f105efdd15537ac111cc25a88d12d0b1d9..041ce7b43bb83d97cfd020a63f6b97fad3ab801f 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/ones.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/ones.cc @@ -26,7 +26,7 @@ #include "tools/converter/import/convert_extend_ops/convert_extend_ops_pass.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_o.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { AnfNodePtr OnesGetValueByDtype(const FuncGraphPtr &func_graph, const mindspore::CNodePtr &cnode) { auto dtype = cnode->input(kInputIndexTwo); @@ -69,4 +69,4 @@ AnfNodePtr ConvertOnesPass(const FuncGraphPtr &func_graph, const mindspore::AnfN return reduce_ones_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/sum_ext.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/sum_ext.cc index a9c72892c9b3b7c6c19ab10505b3e98bc339bd9d..c9311f49192d927487b07042bd4712823326dff2 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/sum_ext.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/sum_ext.cc @@ -24,7 +24,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { AnfNodePtr ReduceExtendGetCastInputByDtype(const FuncGraphPtr &func_graph, const mindspore::CNodePtr &cnode) { auto input = cnode->input(kInputIndexOne); @@ -94,4 +94,4 @@ AnfNodePtr ConvertSumExtPass(const FuncGraphPtr &func_graph, const mindspore::An return reduce_sum_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/utils.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/utils.cc index 32688adc0c43907b0c49829f3e0e82bd163bd098..3bb2198ced149d890214b22be0eadde45e33a498 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/utils.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/utils.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { TypeId GetSingleNodeOutputTypeId(const mindspore::AnfNodePtr &node) { TypePtr type = node->Type(); if (node->isa()) { @@ -110,4 +110,4 @@ AnfNodePtr GetBroadcastToNode(const FuncGraphPtr &func_graph, const mindspore::A return bst_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/utils.h b/mindspore-lite/tools/converter/import/convert_extend_ops/utils.h index 0481c3dd4af88475f8b319480fc97a5be8ab43c4..005399f251932345b61b151e200c81bea23456e0 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/utils.h +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/utils.h @@ -19,7 +19,7 @@ #include "ir/func_graph.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { TypeId GetSingleNodeOutputTypeId(const mindspore::AnfNodePtr &node); AnfNodePtr GetCastNode(const FuncGraphPtr &func_graph, const mindspore::AnfNodePtr &node, const TypeId &dst_type_id); @@ -75,5 +75,5 @@ ValueNodePtr GetCastedScalar(const T number, const TypeId &dst_type_id) { return value_node; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_IMPORT_CONVERT_EXTEND_OPS_UTILS_H_ diff --git a/mindspore-lite/tools/converter/import/convert_extend_ops/zeros.cc b/mindspore-lite/tools/converter/import/convert_extend_ops/zeros.cc index 2ac2edb517ba837d663afae51d63879aaeec875e..445c3caf17b9d30d83f7ef32a99e83e07f80c407 100644 --- a/mindspore-lite/tools/converter/import/convert_extend_ops/zeros.cc +++ b/mindspore-lite/tools/converter/import/convert_extend_ops/zeros.cc @@ -26,7 +26,7 @@ #include "tools/converter/import/convert_extend_ops/convert_extend_ops_pass.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_z.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { AnfNodePtr ZerosGetValueByDtype(const FuncGraphPtr &func_graph, const mindspore::CNodePtr &cnode) { auto dtype = cnode->input(kInputIndexTwo); @@ -70,4 +70,4 @@ AnfNodePtr ConvertZerosPass(const FuncGraphPtr &func_graph, const mindspore::Anf return reduce_zeros_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/micro/providers/nnie/nnie_interfaces.cc b/mindspore-lite/tools/converter/micro/providers/nnie/nnie_interfaces.cc index 636e06e64ef68eece7e7cdbd476762ac5fbd783b..8424ebd69b2650dd33c9c43ee1bab3d927d64fb8 100644 --- a/mindspore-lite/tools/converter/micro/providers/nnie/nnie_interfaces.cc +++ b/mindspore-lite/tools/converter/micro/providers/nnie/nnie_interfaces.cc @@ -22,7 +22,7 @@ #include "include/mpi_sys.h" #include "include/mpi_vb.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { constexpr int kNNIEMaxNameLen = 128; @@ -234,4 +234,4 @@ void NnieClose(NnieHandle *h) { h->load_model_ = 0; } } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/micro/providers/nnie/nnie_interfaces.h b/mindspore-lite/tools/converter/micro/providers/nnie/nnie_interfaces.h index 39db6d25d974fcde857eae56eb09a933d9ec55fb..2ce299e793837dae02bbf1d3f287d0e30490fdbe 100644 --- a/mindspore-lite/tools/converter/micro/providers/nnie/nnie_interfaces.h +++ b/mindspore-lite/tools/converter/micro/providers/nnie/nnie_interfaces.h @@ -18,7 +18,7 @@ #include "src/nnie_common.h" -namespace mindspore { +namespace mindspore::lite { namespace nnie { typedef struct { int load_model_; @@ -45,5 +45,5 @@ int NnieRun(NnieHandle *h, NnieTensors *outputs); void NnieClose(NnieHandle *h); HI_U32 CalcInputSize(const NnieTensors *inputs, const size_t *j); } // namespace nnie -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_MICRO_PROVIDERS_NNIE_NNIE_INTERFACES_H_ diff --git a/mindspore-lite/tools/converter/micro/providers/nnie/nnie_micro.cc b/mindspore-lite/tools/converter/micro/providers/nnie/nnie_micro.cc index bd1ff24c61a53a1c42e2c2b16a444f34cba26ba4..fbb92a610d7c745458a5d9f79843170805cbbd97 100644 --- a/mindspore-lite/tools/converter/micro/providers/nnie/nnie_micro.cc +++ b/mindspore-lite/tools/converter/micro/providers/nnie/nnie_micro.cc @@ -28,7 +28,7 @@ #include "include/ir/dtype/type_id.h" #include "include/c_api/status_c.h" -namespace mindspore { +namespace mindspore::lite { namespace { using nnie::NnieDataType; using nnie::NnieTensors; @@ -206,7 +206,7 @@ static int ProposalKernel(TensorC *inputs, int input_num, TensorC *outputs, int return 0; } } // namespace proposal -} // namespace mindspore +} // namespace mindspore::lite int CustomKernel(TensorC *inputs, int input_num, TensorC *outputs, int output_num, CustomParameter *param) { if (!strcmp(param->type, "NNIE")) { diff --git a/mindspore-lite/tools/converter/parser/lstm_adjust_pass.cc b/mindspore-lite/tools/converter/parser/lstm_adjust_pass.cc index bf7d862ece0e9788e17db62252f6cb5b5fd4d9f2..67e750825aa4322971abf9c6d28697998972bba9 100644 --- a/mindspore-lite/tools/converter/parser/lstm_adjust_pass.cc +++ b/mindspore-lite/tools/converter/parser/lstm_adjust_pass.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kMindLstmInputs = 5; @@ -305,4 +305,4 @@ bool LstmAdjustPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/parser/lstm_adjust_pass.h b/mindspore-lite/tools/converter/parser/lstm_adjust_pass.h index ceabb430d1e2379d21ab91208455b1fcf46f9e8a..4c0015ddd6cf214077bc77e2c8f3a4a17356cd15 100644 --- a/mindspore-lite/tools/converter/parser/lstm_adjust_pass.h +++ b/mindspore-lite/tools/converter/parser/lstm_adjust_pass.h @@ -25,7 +25,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/format_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class LstmAdjustPass : public Pass { public: @@ -34,5 +34,5 @@ class LstmAdjustPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_PARSER_LSTM_ADJUST_PASS_H_ diff --git a/mindspore-lite/tools/converter/parser/pytorch/pytorch_lstm_adjust.cc b/mindspore-lite/tools/converter/parser/pytorch/pytorch_lstm_adjust.cc index 287b426abc884a5b67e22a042988365cb7ec2106..ee78ae58cc757eccbff0679d6c8af250b6c03c3e 100644 --- a/mindspore-lite/tools/converter/parser/pytorch/pytorch_lstm_adjust.cc +++ b/mindspore-lite/tools/converter/parser/pytorch/pytorch_lstm_adjust.cc @@ -29,7 +29,7 @@ #include "ir/tensor_new.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kTorchLstmInputSize = 4; @@ -277,4 +277,4 @@ bool PytorchLstmAdjustPass::GetAndSetHiddenSize(const ParameterPtr &weight_input return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/parser/pytorch/pytorch_lstm_adjust.h b/mindspore-lite/tools/converter/parser/pytorch/pytorch_lstm_adjust.h index 9d54792d0245229ecaaf9cd39756f3300a86ecdf..6372e7981f6dbf7b717fdbdbc228e5aef65bd949 100644 --- a/mindspore-lite/tools/converter/parser/pytorch/pytorch_lstm_adjust.h +++ b/mindspore-lite/tools/converter/parser/pytorch/pytorch_lstm_adjust.h @@ -25,7 +25,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/format_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class PytorchLstmAdjustPass { public: @@ -44,5 +44,5 @@ class PytorchLstmAdjustPass { int64_t *hidden_size); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/tools/converter/parser/tf/functionalize_cond.cc b/mindspore-lite/tools/converter/parser/tf/functionalize_cond.cc index 35832e7bca1d1d0b1c15e1f73d3b09c95355bbbf..67e388925bc5b539c2297c60c2a00b6c32cbd5ec 100644 --- a/mindspore-lite/tools/converter/parser/tf/functionalize_cond.cc +++ b/mindspore-lite/tools/converter/parser/tf/functionalize_cond.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { STATUS FunctionalizeCond::GetSwitchBranchType(const CNodePtr &switch_cnode, const std::unordered_set &link, BranchType *branch_type) { MS_ASSERT(switch_cnode != nullptr); @@ -419,4 +419,4 @@ STATUS FunctionalizeCond::Process() { } return RET_OK; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/parser/tf/functionalize_cond.h b/mindspore-lite/tools/converter/parser/tf/functionalize_cond.h index d05214902b635c3511c5b6c6b1f75c193a59a915..885f58597e911d8baf3960fbd43c3df2e2147e49 100644 --- a/mindspore-lite/tools/converter/parser/tf/functionalize_cond.h +++ b/mindspore-lite/tools/converter/parser/tf/functionalize_cond.h @@ -26,7 +26,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "tools/converter/parser/tf/functionalize_control_op_pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { typedef enum { kThenBranch = 0, kElseBranch = 1 } BranchType; @@ -64,6 +64,6 @@ class FunctionalizeCond { std::vector input_nodes_{}; std::vector pred_nodes_{}; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_CONVERTER_PARSER_TF_FUNCTIONALIZE_COND_H_ diff --git a/mindspore-lite/tools/converter/parser/tf/functionalize_control_op_pass.cc b/mindspore-lite/tools/converter/parser/tf/functionalize_control_op_pass.cc index cbadd72498d09187f5eeee8542a631226d161bab..ef8a3dff508a079fee9f94851e195d0f541217e1 100644 --- a/mindspore-lite/tools/converter/parser/tf/functionalize_control_op_pass.cc +++ b/mindspore-lite/tools/converter/parser/tf/functionalize_control_op_pass.cc @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "src/common/log_util.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { FuncGraphPtr FunctionalizeControlOpPass::NewFuncGraph(const std::string &subgraph_name, const FmkType &fmk_type) { auto fg = std::make_shared(); @@ -199,4 +199,4 @@ CNodePtr FunctionalizeControlOpPass::BelongToWhichNode(const CNodePtr &node, con return aim_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/parser/tf/functionalize_control_op_pass.h b/mindspore-lite/tools/converter/parser/tf/functionalize_control_op_pass.h index fc601079198e5ddc4d58940eb94190a925bb06af..9b0ea30aa4e48f3a105e512544d5a36681301481 100644 --- a/mindspore-lite/tools/converter/parser/tf/functionalize_control_op_pass.h +++ b/mindspore-lite/tools/converter/parser/tf/functionalize_control_op_pass.h @@ -29,7 +29,7 @@ #include "mindspore/core/include/ir/graph_utils.h" using mindspore::converter::FmkType; -namespace mindspore::opt { +namespace mindspore::lite::opt { using AimFunc = std::function; class FunctionalizeControlOpPass : public Pass { public: @@ -73,5 +73,5 @@ class FunctionalizeControlOpPass : public Pass { std::vector>> node_clusters_{}; std::vector loop_cond_nodes_{}; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_CONVERTER_PARSER_TF_FUNCTIONALIZE_CONTROL_OP_PASS_H_ diff --git a/mindspore-lite/tools/converter/parser/tf/functionalize_while.cc b/mindspore-lite/tools/converter/parser/tf/functionalize_while.cc index 1d22f6f84ece53bae59e2cb73b2f37b1253f48de..9002a9c32581a14c127ed59b50622eb622ddd189 100644 --- a/mindspore-lite/tools/converter/parser/tf/functionalize_while.cc +++ b/mindspore-lite/tools/converter/parser/tf/functionalize_while.cc @@ -41,7 +41,7 @@ mindspore::ValueNodePtr GetWhileAnfPrim() { } } // namespace -namespace mindspore::opt { +namespace mindspore::lite::opt { using mindspore::lite::RET_NULL_PTR; @@ -664,4 +664,4 @@ STATUS FunctionalizeWhile::Process() { } return ret; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/parser/tf/functionalize_while.h b/mindspore-lite/tools/converter/parser/tf/functionalize_while.h index b7ffbd213d93b9638636bda2c044d9cea74ad03f..f460e55176903543d71201f489c54a831b69d73c 100644 --- a/mindspore-lite/tools/converter/parser/tf/functionalize_while.h +++ b/mindspore-lite/tools/converter/parser/tf/functionalize_while.h @@ -24,7 +24,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "tools/converter/parser/tf/functionalize_control_op_pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { constexpr const int POS_INVALID = -1; @@ -91,5 +91,5 @@ class FunctionalizeWhile { std::map cond_subgraph_input_map_{}; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_SRC_PASS_FUNCTIONALIZE_WHILE_PASS_H_ diff --git a/mindspore-lite/tools/converter/parser/tf_bidirection_gru_cf_fusion.cc b/mindspore-lite/tools/converter/parser/tf_bidirection_gru_cf_fusion.cc index e4cf2609d34b34fdf39c747128d4043f5d540974..c9d0a4faa93b8431acf8e9bbc3cfb6936e37aec1 100644 --- a/mindspore-lite/tools/converter/parser/tf_bidirection_gru_cf_fusion.cc +++ b/mindspore-lite/tools/converter/parser/tf_bidirection_gru_cf_fusion.cc @@ -43,7 +43,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kNumFwVars = 4; @@ -237,4 +237,4 @@ const AnfNodePtr TfBidirectionGruCfFusion::Process(const FuncGraphPtr &func_grap return output_node; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/parser/tf_bidirection_gru_cf_fusion.h b/mindspore-lite/tools/converter/parser/tf_bidirection_gru_cf_fusion.h index a7fc2505483ce43530f17f72b5c4d2971ab8b1f8..dede7b75cd9a821e8ce9e7f2f9efde8db05b8de2 100644 --- a/mindspore-lite/tools/converter/parser/tf_bidirection_gru_cf_fusion.h +++ b/mindspore-lite/tools/converter/parser/tf_bidirection_gru_cf_fusion.h @@ -25,7 +25,7 @@ #include "include/common/utils/utils.h" #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { // fuse tf 1.x bidirection_gru into MSLITE GRU class TfBidirectionGruCfFusion : public TfBidirectionGruFusion { @@ -46,6 +46,6 @@ class TfBidirectionGruCfFusion : public TfBidirectionGruFusion { const VarPtr &init_state) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_PARSER_TF_BIDIRECTION_GRU_CF_FUSION_H_ diff --git a/mindspore-lite/tools/converter/parser/unused_node_remove_pass.cc b/mindspore-lite/tools/converter/parser/unused_node_remove_pass.cc index 17b975965e3840ffe4e32b352d2ddbc4b51638cc..caf5528b07356f18767459fb2d3b6cf604fc19a3 100644 --- a/mindspore-lite/tools/converter/parser/unused_node_remove_pass.cc +++ b/mindspore-lite/tools/converter/parser/unused_node_remove_pass.cc @@ -20,7 +20,7 @@ #include #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { STATUS UnusedNodeRemovePass::ProcessGraph(const FuncGraphPtr &func_graph, std::set *has_visited) { MS_ASSERT(func_graph != nullptr && has_visited != nullptr); @@ -75,4 +75,4 @@ bool UnusedNodeRemovePass::Run(const FuncGraphPtr &func_graph) { auto status = ProcessGraph(func_graph, &has_visited); return status == RET_OK; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/converter/parser/unused_node_remove_pass.h b/mindspore-lite/tools/converter/parser/unused_node_remove_pass.h index 6746bc6b212abdb801ce4b4007159c41d49c3d90..7beaae6a6317a8fc40fd62f524d0c7f67c206349 100644 --- a/mindspore-lite/tools/converter/parser/unused_node_remove_pass.h +++ b/mindspore-lite/tools/converter/parser/unused_node_remove_pass.h @@ -22,7 +22,7 @@ #include "include/errorcode.h" using mindspore::lite::STATUS; -namespace mindspore::opt { +namespace mindspore::lite::opt { class UnusedNodeRemovePass : public Pass { public: UnusedNodeRemovePass() : Pass("remove_unused_node_pass") {} @@ -32,6 +32,6 @@ class UnusedNodeRemovePass : public Pass { private: STATUS ProcessGraph(const FuncGraphPtr &func_graph, std::set *has_visited); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_CONVERTER_PARSER_UNUSED_NODE_REMOVE_PASS_H_ diff --git a/mindspore-lite/tools/converter/quantizer/gptq_quantizer.h b/mindspore-lite/tools/converter/quantizer/gptq_quantizer.h index cf1839001f2ee809c3f20a5082d3287aebcb8349..a98b12d6d8b8c37a293172dbf59772f9ba36e164 100644 --- a/mindspore-lite/tools/converter/quantizer/gptq_quantizer.h +++ b/mindspore-lite/tools/converter/quantizer/gptq_quantizer.h @@ -31,7 +31,7 @@ #include "ir/anf.h" #include "nnacl_c/matmul_parameter.h" -namespace mindspore { +namespace mindspore::lite { namespace lite::quant { struct WeightInfo { @@ -105,5 +105,5 @@ class GptqQuantizer { Model *model_ = nullptr; }; } // namespace lite::quant -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_CONVERTER_QUANTIZER_GPTQ_QUANTIZER_H_ diff --git a/mindspore-lite/tools/converter/registry/model_parser_registry.cc b/mindspore-lite/tools/converter/registry/model_parser_registry.cc index 1421775acdfedb212098f539c6a898be237b35b4..9d0990820d8bcf230bbf3901f5518e1a71ed693e 100644 --- a/mindspore-lite/tools/converter/registry/model_parser_registry.cc +++ b/mindspore-lite/tools/converter/registry/model_parser_registry.cc @@ -19,7 +19,7 @@ #include "src/common/log_adapter.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { namespace { std::map model_parser_room; @@ -51,4 +51,4 @@ converter::ModelParser *ModelParserRegistry::GetModelParser(FmkType fmk) { return nullptr; } } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/registry/node_parser_registry.cc b/mindspore-lite/tools/converter/registry/node_parser_registry.cc index 4910f2542622210b9105a6caac021b59fef7952a..39c1c43bef15d9637b574f28c9efb88269862e08 100644 --- a/mindspore-lite/tools/converter/registry/node_parser_registry.cc +++ b/mindspore-lite/tools/converter/registry/node_parser_registry.cc @@ -20,7 +20,7 @@ #include #include "src/common/log_adapter.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { namespace { constexpr size_t kOpNumLimit = 10000; @@ -56,4 +56,4 @@ converter::NodeParserPtr NodeParserRegistry::GetNodeParser(converter::FmkType fm return iter_level2->second; } } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/converter/registry/pass_registry.cc b/mindspore-lite/tools/converter/registry/pass_registry.cc index 7bbaccb5d9ed8a16576bbbf3049d3f509a24b1ea..1ac08a415c5d1b5937f53267ad1f611ed7394653 100644 --- a/mindspore-lite/tools/converter/registry/pass_registry.cc +++ b/mindspore-lite/tools/converter/registry/pass_registry.cc @@ -22,7 +22,7 @@ #include "src/common/log_adapter.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace registry { namespace { constexpr size_t kPassNumLimit = 10000; @@ -67,4 +67,4 @@ PassBasePtr PassRegistry::GetPassFromStoreRoom(const std::vector &pass_nam return outer_pass_storage.find(pass_name) == outer_pass_storage.end() ? nullptr : outer_pass_storage[pass_name]; } } // namespace registry -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/common/format_utils.cc b/mindspore-lite/tools/optimizer/common/format_utils.cc index 1dd45fe29d90ae06f0eb044a1c277e5a915a156f..c96d309f7d4e16e12685023dd849c943c25dc658 100644 --- a/mindspore-lite/tools/optimizer/common/format_utils.cc +++ b/mindspore-lite/tools/optimizer/common/format_utils.cc @@ -83,7 +83,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "ir/tensor_new.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { // treat the weight of deformableConv2d as an input instead of a const because of the ops infershape only support nchw. static const std::unordered_map> NHWCOpMap = { @@ -417,4 +417,4 @@ int ConvertAbstractFormatShape(const AbstractBasePtr &abstract, FormatTransNodeT return RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/common/format_utils.h b/mindspore-lite/tools/optimizer/common/format_utils.h index f8a077941bbc2f88b657ad682539e7bf4a5a8afe..ab2dd55eed8f8727529db839b77c99539a9b8348 100644 --- a/mindspore-lite/tools/optimizer/common/format_utils.h +++ b/mindspore-lite/tools/optimizer/common/format_utils.h @@ -23,7 +23,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "utils/check_convert_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { constexpr auto kOutputsFormat = "outputs_format"; enum FormatTransNodeType { kNCHW2NHWC, kNHWC2NCHW, kNONE }; @@ -49,6 +49,6 @@ int SetAbstractTensorInfo(const AbstractBasePtr &abstract); STATUS GetFormatSensitiveOpInsertIndex(const CNodePtr &cnode, std::vector *insert_index); int ConvertAbstractFormatShape(const AbstractBasePtr &abstract, FormatTransNodeType perm); } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_COMMON_FORMAT_UTILS_H_ diff --git a/mindspore-lite/tools/optimizer/common/gllo_utils.cc b/mindspore-lite/tools/optimizer/common/gllo_utils.cc index 5b433bbac37f54e25c415b83665d557083286d0b..c503d6a504a062ba262566b3348568494c6a05e2 100644 --- a/mindspore-lite/tools/optimizer/common/gllo_utils.cc +++ b/mindspore-lite/tools/optimizer/common/gllo_utils.cc @@ -60,7 +60,7 @@ #include "ir/tensor_new.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr auto kAnfPrimitiveIndex = 0; @@ -2058,4 +2058,4 @@ STATUS GetPrimFromCnode(const CNodePtr &cnode, PrimitivePtr *prim_ptr) { } }; // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/common/gllo_utils.h b/mindspore-lite/tools/optimizer/common/gllo_utils.h index c75381cd378b443b62f6433a09541a8f9cb86925..e1878587a423f5ed13cf5281968d285baf4402a5 100644 --- a/mindspore-lite/tools/optimizer/common/gllo_utils.h +++ b/mindspore-lite/tools/optimizer/common/gllo_utils.h @@ -37,7 +37,7 @@ using PrimitiveCPtr = std::shared_ptr; using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; using mindspore::lite::STATUS; -namespace mindspore { +namespace mindspore::lite { namespace opt { // used for common op, which corresponding value is a boolean. constexpr auto kInferDone = "infer_done"; @@ -232,5 +232,5 @@ const float GetFloatParameterValue(const EquivPtr &equiv, const VarPtr &input); const int GetIntParameterValue(const EquivPtr &equiv, const VarPtr &input); STATUS GetPrimFromCnode(const CNodePtr &cnode, PrimitivePtr *prim_ptr); } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_COMMON_GLLO_UTILS_H_ diff --git a/mindspore-lite/tools/optimizer/common/helper.cc b/mindspore-lite/tools/optimizer/common/helper.cc index 5b511e0f2b769078c277af3694242f2528f40613..d0890bd81eadcfbefc2dfd8c48d420b4c3f9c08c 100644 --- a/mindspore-lite/tools/optimizer/common/helper.cc +++ b/mindspore-lite/tools/optimizer/common/helper.cc @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { ValueNodePtr Helper::CreateValueNodeWithSexp(const BaseRef &sexp) { if (utils::isa(sexp)) { @@ -300,4 +300,4 @@ AnfNodePtr GetAnfNodeByVar(const EquivPtr &equiv, const VarPtr &var_node) { return res; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/common/helper.h b/mindspore-lite/tools/optimizer/common/helper.h index 82fdefcab76ec37cc5eb34b28a3e51a7173ad0f5..fc92a3b30be80095ae60e35e2c70f5909c693df8 100644 --- a/mindspore-lite/tools/optimizer/common/helper.h +++ b/mindspore-lite/tools/optimizer/common/helper.h @@ -23,7 +23,7 @@ #include "include/backend/optimizer/helper.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class Helper { public: @@ -42,6 +42,6 @@ class Helper { bool multigraph); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_COMMON_HELPER_H_ diff --git a/mindspore-lite/tools/optimizer/common/multiple_pattern_process_pass.cc b/mindspore-lite/tools/optimizer/common/multiple_pattern_process_pass.cc index e809de0ed77b4f293f45fdedfde364a8c531cb3b..7eef6df96ae10eb517cf2b08ac3ca4de4bda730c 100644 --- a/mindspore-lite/tools/optimizer/common/multiple_pattern_process_pass.cc +++ b/mindspore-lite/tools/optimizer/common/multiple_pattern_process_pass.cc @@ -18,7 +18,7 @@ #include "tools/optimizer/common/helper.h" #include "nnacl_c/op_base.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { AnfNodePtr MultiplePatternProcessPass::Run(const FuncGraphPtr &func_graph, const AnfNodePtr &node) { if (patterns_.empty()) { VarPtr fg = std::make_shared("RootG"); @@ -48,4 +48,4 @@ AnfNodePtr MultiplePatternProcessPass::Run(const FuncGraphPtr &func_graph, const } return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/common/multiple_pattern_process_pass.h b/mindspore-lite/tools/optimizer/common/multiple_pattern_process_pass.h index 332b4ed8bfd2fbefd6e232e1e04f1adb71a5996a..a38dbe747e96d0e31eabab9a88be55603983e374 100644 --- a/mindspore-lite/tools/optimizer/common/multiple_pattern_process_pass.h +++ b/mindspore-lite/tools/optimizer/common/multiple_pattern_process_pass.h @@ -26,7 +26,7 @@ #include "include/backend/optimizer/helper.h" #include "tools/optimizer/common/node_pass_extends.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class MultiplePatternProcessPass : public LiteNodePass { public: @@ -44,6 +44,6 @@ class MultiplePatternProcessPass : public LiteNodePass { PatternEngine pattern_engine_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_COMMON_MULTIPLE_PATTERN_PROCESS_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/common/node_pass_extends.cc b/mindspore-lite/tools/optimizer/common/node_pass_extends.cc index 3cea9f6c6b97f46cb9a46444bc4f0ca79a731c9f..1a1db53f0b5fefbecabcb60268b42dd0e0be78b8 100644 --- a/mindspore-lite/tools/optimizer/common/node_pass_extends.cc +++ b/mindspore-lite/tools/optimizer/common/node_pass_extends.cc @@ -24,7 +24,7 @@ #include "ir/manager.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool NodePass::Run(const FuncGraphPtr &func_graph) { MS_LOG(ERROR) << "stub func"; @@ -91,4 +91,4 @@ bool LiteNodePass::Run(const FuncGraphPtr &func_graph) { return changes; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/common/node_pass_extends.h b/mindspore-lite/tools/optimizer/common/node_pass_extends.h index 492f071d9ff87db21ebb25fba6a61d3486a2b455..16597c294798de961892b869e98651189a5a46ac 100644 --- a/mindspore-lite/tools/optimizer/common/node_pass_extends.h +++ b/mindspore-lite/tools/optimizer/common/node_pass_extends.h @@ -21,7 +21,7 @@ #include #include "include/backend/optimizer/node_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class LiteNodePass : public NodePass { public: @@ -31,5 +31,5 @@ class LiteNodePass : public NodePass { virtual AnfNodePtr Run(const FuncGraphPtr &func_graph, const AnfNodePtr &node) = 0; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_COMMON_NODE_PASS_EXTENDS_H_ diff --git a/mindspore-lite/tools/optimizer/common/pass_manager_extends.cc b/mindspore-lite/tools/optimizer/common/pass_manager_extends.cc index 30b4176673a5e60710046f78b4aaa0400a9db00f..0b52987aa126b50faba1fe1d715ffbbdb2ecff95 100644 --- a/mindspore-lite/tools/optimizer/common/pass_manager_extends.cc +++ b/mindspore-lite/tools/optimizer/common/pass_manager_extends.cc @@ -23,7 +23,7 @@ #include "ir/anf.h" #include "backend/common/pass_manager/cache_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { constexpr size_t kMaxRepassTimes = 12; constexpr uint64_t kUSecondInSecond = 1000000; @@ -135,4 +135,4 @@ bool LitePassManager::Run(const FuncGraphPtr &func_graph) const { return changed; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/common/pass_manager_extends.h b/mindspore-lite/tools/optimizer/common/pass_manager_extends.h index d834972d88ce24298d40037a995586dd224a321c..43de648ec0434cb95f43f020747d25b170ebef6d 100644 --- a/mindspore-lite/tools/optimizer/common/pass_manager_extends.h +++ b/mindspore-lite/tools/optimizer/common/pass_manager_extends.h @@ -21,7 +21,7 @@ #include #include "include/backend/optimizer/pass_manager.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class LitePassManager : public PassManager { public: @@ -37,5 +37,5 @@ class LitePassManager : public PassManager { std::string GetPassFullname(size_t pass_id, const PassPtr &pass) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_COMMON_PASS_MANAGER_EXTENDS_H_ diff --git a/mindspore-lite/tools/optimizer/common/pattern_process_pass_extends.cc b/mindspore-lite/tools/optimizer/common/pattern_process_pass_extends.cc index a2fa3beea194e023142145b79df1bbdbb08d2c50..4160e8d6ecda6ec7eb81387364e21997ec4077b1 100644 --- a/mindspore-lite/tools/optimizer/common/pattern_process_pass_extends.cc +++ b/mindspore-lite/tools/optimizer/common/pattern_process_pass_extends.cc @@ -25,7 +25,7 @@ #include "ir/manager.h" #include "tools/optimizer/common/helper.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { void LitePatternProcessPass::Build() { VarPtr fg = std::make_shared("RootG"); @@ -50,4 +50,4 @@ AnfNodePtr LitePatternProcessPass::Run(const FuncGraphPtr &func_graph, const Anf return nullptr; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/common/pattern_process_pass_extends.h b/mindspore-lite/tools/optimizer/common/pattern_process_pass_extends.h index 0b383e03deab535e7d473179facadfce9f03e81e..8489dd3d726fcfa5ecccceddaf0a7d0dc5d75922 100644 --- a/mindspore-lite/tools/optimizer/common/pattern_process_pass_extends.h +++ b/mindspore-lite/tools/optimizer/common/pattern_process_pass_extends.h @@ -22,7 +22,7 @@ #include "include/backend/optimizer/pattern_engine.h" #include "tools/optimizer/common/node_pass_extends.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class LitePatternProcessPass : public LiteNodePass { public: @@ -47,5 +47,5 @@ class LitePatternProcessPass : public LiteNodePass { EquivPtr equiv_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_COMMON_PATTERN_PROCESS_PASS_EXTENDS_H_ diff --git a/mindspore-lite/tools/optimizer/const_fold/constant_folding_fusion.h b/mindspore-lite/tools/optimizer/const_fold/constant_folding_fusion.h index 6f0fba20e0f07ec6f1289e030bf30c3e42bc4013..0d060d54c0a1eca6f7f935952e51090ca23528a3 100644 --- a/mindspore-lite/tools/optimizer/const_fold/constant_folding_fusion.h +++ b/mindspore-lite/tools/optimizer/const_fold/constant_folding_fusion.h @@ -23,7 +23,7 @@ #include "tools/optimizer/const_fold/fold_with_infershape.h" #include "tools/optimizer/graph/update_conv2d_param_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConstFoldPass : public Pass { public: @@ -64,5 +64,5 @@ class ConstFoldPass : public Pass { bool train_flag_{false}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_CONST_FOLD_CONSTANT_FOLDING_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/const_fold/fold_along_infershape.cc b/mindspore-lite/tools/optimizer/const_fold/fold_along_infershape.cc index 39cd9f708467a39a2a81478aa0c9d8163b67ef0a..84217e6abe465a6f3fd82f6194c8a34f6018aa1d 100644 --- a/mindspore-lite/tools/optimizer/const_fold/fold_along_infershape.cc +++ b/mindspore-lite/tools/optimizer/const_fold/fold_along_infershape.cc @@ -22,7 +22,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { STATUS ConstFoldAlongInferShape::PostProcess(const FuncGraphPtr &func_graph, const CNodePtr &cnode) { MS_ASSERT(func_graph != nullptr && cnode != nullptr); @@ -73,4 +73,4 @@ bool ConstFoldAlongInferShape::CheckCanFold(const FuncGraphPtr &func_graph, cons return false; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/const_fold/fold_along_infershape.h b/mindspore-lite/tools/optimizer/const_fold/fold_along_infershape.h index 0b9e0e67f76454b0f54855ac4bd0cc24966cc4ea..eb7c3eac262bad065060e7713105b4369774d3a2 100644 --- a/mindspore-lite/tools/optimizer/const_fold/fold_along_infershape.h +++ b/mindspore-lite/tools/optimizer/const_fold/fold_along_infershape.h @@ -21,7 +21,7 @@ #include "tools/optimizer/graph/infershape_pass.h" #include "tools/optimizer/const_fold/fold_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConstFoldAlongInferShape : public InferShapePass { public: @@ -35,5 +35,5 @@ class ConstFoldAlongInferShape : public InferShapePass { std::shared_ptr const_fold_processor_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_CONST_FOLD_FOLD_ALONG_INFERSHAPE_H_ diff --git a/mindspore-lite/tools/optimizer/const_fold/fold_utils.cc b/mindspore-lite/tools/optimizer/const_fold/fold_utils.cc index 6a4648e711c4be13abe227530df1a8e5b15fd869..dbe3d568cf2f0a530233703717a4ca3d6125be31 100644 --- a/mindspore-lite/tools/optimizer/const_fold/fold_utils.cc +++ b/mindspore-lite/tools/optimizer/const_fold/fold_utils.cc @@ -44,7 +44,7 @@ using mindspore::lite::KernelRegistry; using mindspore::lite::Tensor; #include "ir/tensor_new.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { bool IsInferInRunning(const CNodePtr &cnode) { return CheckPrimitiveType(cnode, prim::kPrimWhere); } @@ -327,4 +327,4 @@ int ConstFoldProcessor::DoConstantFold(const FuncGraphPtr &func_graph, const CNo return status; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/const_fold/fold_utils.h b/mindspore-lite/tools/optimizer/const_fold/fold_utils.h index e60c3c9bb19ff6518b1dcfefdfd88d8030a70311..4b6d22a0d448e9e029054fec9d8f469e490cac61 100644 --- a/mindspore-lite/tools/optimizer/const_fold/fold_utils.h +++ b/mindspore-lite/tools/optimizer/const_fold/fold_utils.h @@ -24,7 +24,7 @@ #include "schema/inner/model_generated.h" #include "src/litert/inner_context.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConstFoldProcessor { public: @@ -41,5 +41,5 @@ class ConstFoldProcessor { std::shared_ptr ms_context_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_CONST_FOLD_FOLD_UTILS_H_ diff --git a/mindspore-lite/tools/optimizer/const_fold/fold_with_infershape.cc b/mindspore-lite/tools/optimizer/const_fold/fold_with_infershape.cc index 72a292f7cf873c1db9ddb4193a877f163f8ff870..9dd4d5efa4e0854e436446214d14cf242b2cdc1a 100644 --- a/mindspore-lite/tools/optimizer/const_fold/fold_with_infershape.cc +++ b/mindspore-lite/tools/optimizer/const_fold/fold_with_infershape.cc @@ -25,7 +25,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr auto kIsLinkWithControlFlow = "link_with_control_flow"; } // namespace @@ -161,4 +161,4 @@ bool ConstFoldWithInferShape::CheckCanSpecialFold(const CNodePtr &cnode) const { } return CheckCanCommonFold(cnode); } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/const_fold/fold_with_infershape.h b/mindspore-lite/tools/optimizer/const_fold/fold_with_infershape.h index 85c9df26d4ed09308d1449588c75ac59f144bbfd..6815331f211514b842813c1210fe13eeb6070feb 100644 --- a/mindspore-lite/tools/optimizer/const_fold/fold_with_infershape.h +++ b/mindspore-lite/tools/optimizer/const_fold/fold_with_infershape.h @@ -25,7 +25,7 @@ #include "tools/optimizer/graph/node_infershape.h" #include "tools/optimizer/const_fold/fold_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConstFoldWithInferShape : public Pass { public: @@ -46,5 +46,5 @@ class ConstFoldWithInferShape : public Pass { FuncGraphManagerPtr manager_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_CONST_FOLD_FOLD_WITH_INFERSHAPE_H_ diff --git a/mindspore-lite/tools/optimizer/const_fold/rsqrt_fp32.cc b/mindspore-lite/tools/optimizer/const_fold/rsqrt_fp32.cc index 6d606e13d3fad2369937d2f95360f82c275793ff..fce5080c616cb6a5ec4dced9a7592aa39f231fe1 100644 --- a/mindspore-lite/tools/optimizer/const_fold/rsqrt_fp32.cc +++ b/mindspore-lite/tools/optimizer/const_fold/rsqrt_fp32.cc @@ -17,7 +17,7 @@ using mindspore::lite::RET_ERROR; using mindspore::lite::RET_OK; -namespace mindspore::kernel { +namespace mindspore::lite::kernel { int HighAccuracyRsqrtCPUKernel::Prepare() { CHECK_NOT_EQUAL_RETURN(in_tensors_.size(), 1); CHECK_NOT_EQUAL_RETURN(out_tensors_.size(), 1); @@ -46,4 +46,4 @@ int HighAccuracyRsqrtCPUKernel::Run() { } return RET_OK; } -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel diff --git a/mindspore-lite/tools/optimizer/const_fold/rsqrt_fp32.h b/mindspore-lite/tools/optimizer/const_fold/rsqrt_fp32.h index f9ad0c221251d62d8657e56ef5ab3f65ee157365..98e0a52cb23915878da5a20448b6db84743ed3cb 100644 --- a/mindspore-lite/tools/optimizer/const_fold/rsqrt_fp32.h +++ b/mindspore-lite/tools/optimizer/const_fold/rsqrt_fp32.h @@ -22,7 +22,7 @@ #include #include "src/litert/lite_kernel.h" -namespace mindspore::kernel { +namespace mindspore::lite::kernel { class HighAccuracyRsqrtCPUKernel : public LiteKernel { public: explicit HighAccuracyRsqrtCPUKernel(OpParameter *parameter, const std::vector &inputs, @@ -34,6 +34,6 @@ class HighAccuracyRsqrtCPUKernel : public LiteKernel { int ReSize() override; int Run() override; }; -} // namespace mindspore::kernel +} // namespace mindspore::lite::kernel #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_CONST_FOLD_RSQRT_FP32_H_ diff --git a/mindspore-lite/tools/optimizer/fisson/eliminate_concat_split.cc b/mindspore-lite/tools/optimizer/fisson/eliminate_concat_split.cc index a935cecd5d739f9e25dd9f576680161284154251..e29b26cf7bdbeb09ed47918f4c33b4e282d128b6 100644 --- a/mindspore-lite/tools/optimizer/fisson/eliminate_concat_split.cc +++ b/mindspore-lite/tools/optimizer/fisson/eliminate_concat_split.cc @@ -35,7 +35,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { CNodePtr GetRealPrevCNode(const AnfNodePtr &node) { @@ -182,4 +182,4 @@ const AnfNodePtr EliminateConcatSplit::Process(const FuncGraphPtr &func_graph, c return node; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fisson/eliminate_concat_split.h b/mindspore-lite/tools/optimizer/fisson/eliminate_concat_split.h index ef1a1f44069b98f31dc01f6a59e1ce412d49e677..0b0f5b132845ced74268f2ac4c2d9d7a8fb69a89 100644 --- a/mindspore-lite/tools/optimizer/fisson/eliminate_concat_split.h +++ b/mindspore-lite/tools/optimizer/fisson/eliminate_concat_split.h @@ -20,7 +20,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "tools/optimizer/fisson/fisson_util.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class EliminateConcatSplit : public LitePatternProcessPass { public: @@ -33,5 +33,5 @@ class EliminateConcatSplit : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_ELIMINATE_CONCAT_SPLIT_H_ diff --git a/mindspore-lite/tools/optimizer/fisson/fisson_util.cc b/mindspore-lite/tools/optimizer/fisson/fisson_util.cc index c751ffd7754bd4cef0ee29fa807e0a7db8c2c071..32872f427ed930d1d5d3fa646fb72da066f88d51 100644 --- a/mindspore-lite/tools/optimizer/fisson/fisson_util.cc +++ b/mindspore-lite/tools/optimizer/fisson/fisson_util.cc @@ -34,7 +34,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { std::vector GetSplitPadList(const api::SharedPtr &ori_conv_prim, int64_t input_h, int64_t input_w) { @@ -472,4 +472,4 @@ bool UpdateRatioWithPadStride(int64_t *ratio, size_t ratio_len, size_t split_siz return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fisson/fisson_util.h b/mindspore-lite/tools/optimizer/fisson/fisson_util.h index af1ee78c9540bd6a37ff2c9444c97265918de104..e4311572f1e3371a265f93f7639b2361c4622645 100644 --- a/mindspore-lite/tools/optimizer/fisson/fisson_util.h +++ b/mindspore-lite/tools/optimizer/fisson/fisson_util.h @@ -26,7 +26,7 @@ #include "include/lite_types.h" #include "infer/cxx_api/conv2d_fusion.h" -namespace mindspore { +namespace mindspore::lite { using mindspore::schema::PrimitiveType; namespace opt { @@ -65,5 +65,5 @@ bool CreateOutputsOfSplitWithOverlap(const FuncGraphPtr &func_graph, const AnfNo const std::string &node_name); bool UpdateRatioWithPadStride(int64_t *ratio, size_t ratio_len, size_t split_size, int split_dim_size); } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_FISSON_UTIL_H_ diff --git a/mindspore-lite/tools/optimizer/fisson/iter_node_outputs.cc b/mindspore-lite/tools/optimizer/fisson/iter_node_outputs.cc index 4dc8858fab510c17fd8c71f9b906f653b895704b..787851940ab3936ccda4999d8b1eb61b20d88857 100644 --- a/mindspore-lite/tools/optimizer/fisson/iter_node_outputs.cc +++ b/mindspore-lite/tools/optimizer/fisson/iter_node_outputs.cc @@ -19,7 +19,7 @@ #include "tools/optimizer/parallel/spliter.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { AnfNodePtr IterNodeOutputs::Run(const FuncGraphPtr &func_graph, const AnfNodePtr &node) { MS_CHECK_TRUE_MSG(func_graph != nullptr, nullptr, "input func_graph is nullptr"); @@ -42,4 +42,4 @@ AnfNodePtr IterNodeOutputs::Run(const FuncGraphPtr &func_graph, const AnfNodePtr return nullptr; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fisson/iter_node_outputs.h b/mindspore-lite/tools/optimizer/fisson/iter_node_outputs.h index 48f16cefdcf5bf905b8c383cffe2000da8d8d5ca..8d1a0bac1689cdd5e14c163df5e55716843e92ad 100644 --- a/mindspore-lite/tools/optimizer/fisson/iter_node_outputs.h +++ b/mindspore-lite/tools/optimizer/fisson/iter_node_outputs.h @@ -20,7 +20,7 @@ #ifndef MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_ITER_NODE_OUTPUTS_H_ #define MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_ITER_NODE_OUTPUTS_H_ -namespace mindspore { +namespace mindspore::lite { namespace opt { class IterNodeOutputs : public opt::LiteNodePass { public: @@ -29,6 +29,6 @@ class IterNodeOutputs : public opt::LiteNodePass { AnfNodePtr Run(const FuncGraphPtr &func_graph, const AnfNodePtr &node) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_ITER_NODE_OUTPUTS_H_ diff --git a/mindspore-lite/tools/optimizer/fisson/multi_conv_split_pass.cc b/mindspore-lite/tools/optimizer/fisson/multi_conv_split_pass.cc index dd2b6036215e01d745a99f4368420d4c695ac1d7..ac01f088301928be6c3be1834f8f5acd5ffdf158 100644 --- a/mindspore-lite/tools/optimizer/fisson/multi_conv_split_pass.cc +++ b/mindspore-lite/tools/optimizer/fisson/multi_conv_split_pass.cc @@ -27,7 +27,7 @@ #include "ops_utils/op_utils.h" using mindspore::schema::PrimitiveType_Conv2dTransposeFusion; -namespace mindspore { +namespace mindspore::lite { namespace opt { std::string MultiConvSplitPass::IsMultiParallelConvNode(const AnfNodePtr &node) const { MS_ASSERT(node != nullptr); @@ -94,4 +94,4 @@ const AnfNodePtr MultiConvSplitPass::Process(const FuncGraphPtr &func_graph, con } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fisson/multi_conv_split_pass.h b/mindspore-lite/tools/optimizer/fisson/multi_conv_split_pass.h index 47de16382daef32ca1de4be3f6ccafbf7e9a5e0a..48096f4c6ba27f2b9f0e5c54a3ae063993e912e6 100644 --- a/mindspore-lite/tools/optimizer/fisson/multi_conv_split_pass.h +++ b/mindspore-lite/tools/optimizer/fisson/multi_conv_split_pass.h @@ -28,7 +28,7 @@ #include "tools/optimizer/parallel/multi_node_split.h" using mindspore::schema::PrimitiveType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class MultiConvSplitPass : public LitePatternProcessPass { @@ -52,5 +52,5 @@ class MultiConvSplitPass : public LitePatternProcessPass { int32_t num_{0}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_MULTI_CONV_SPLIT_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/fisson/node_out_shapes.cc b/mindspore-lite/tools/optimizer/fisson/node_out_shapes.cc index baf877a79e08b5ddfb1d2bcd5b66f05a77326c8f..de5c46f42bbc65c787e0919bc305353a9be5d42e 100644 --- a/mindspore-lite/tools/optimizer/fisson/node_out_shapes.cc +++ b/mindspore-lite/tools/optimizer/fisson/node_out_shapes.cc @@ -21,7 +21,7 @@ #include "tools/optimizer/parallel/spliter.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { AnfNodePtr NodeOutShapes::Run(const FuncGraphPtr &func_graph, const AnfNodePtr &node) { MS_CHECK_TRUE_MSG(func_graph != nullptr, nullptr, "input func_graph is nullptr"); @@ -75,4 +75,4 @@ AnfNodePtr NodeOutShapes::Run(const FuncGraphPtr &func_graph, const AnfNodePtr & return node; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fisson/node_out_shapes.h b/mindspore-lite/tools/optimizer/fisson/node_out_shapes.h index 9b88045fa4edbbd777887cb87ffc6a4b17a5d76b..de99207ccfceca6bb5c71c8e9c40595ce17573b6 100644 --- a/mindspore-lite/tools/optimizer/fisson/node_out_shapes.h +++ b/mindspore-lite/tools/optimizer/fisson/node_out_shapes.h @@ -20,7 +20,7 @@ #ifndef MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_NODE_OUT_SHAPES_H_ #define MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_NODE_OUT_SHAPES_H_ -namespace mindspore { +namespace mindspore::lite { namespace opt { class NodeOutShapes : public opt::LiteNodePass { public: @@ -30,6 +30,6 @@ class NodeOutShapes : public opt::LiteNodePass { }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_NODE_OUT_SHAPES_H_ diff --git a/mindspore-lite/tools/optimizer/format/delete_redundant_transpose.cc b/mindspore-lite/tools/optimizer/format/delete_redundant_transpose.cc index 40acc51968ea6eb6048198b8f81560762437bd2f..7cacca44644c590f3a049b3b354f9b9cf7c715b2 100644 --- a/mindspore-lite/tools/optimizer/format/delete_redundant_transpose.cc +++ b/mindspore-lite/tools/optimizer/format/delete_redundant_transpose.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_w.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { STATUS DeleteRedundantTranspose::DeleteControlFlowTranspose(const CNodePtr &cnode) { auto sub_func_graph = GetValueNode(cnode->input(1)); @@ -339,4 +339,4 @@ STATUS DeleteRedundantTranspose::CopyQuantParam(const CNodePtr &cnode, const CNo return RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/format/delete_redundant_transpose.h b/mindspore-lite/tools/optimizer/format/delete_redundant_transpose.h index b744dbdc8d169c8eeef65fd8c31d20439f0b1380..3b2f2c8de1dfdbea3480bb168501595f1a7d394a 100644 --- a/mindspore-lite/tools/optimizer/format/delete_redundant_transpose.h +++ b/mindspore-lite/tools/optimizer/format/delete_redundant_transpose.h @@ -20,7 +20,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class DeleteRedundantTranspose : public Pass { public: @@ -39,6 +39,6 @@ class DeleteRedundantTranspose : public Pass { FuncGraphManagerPtr manager_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FORMAT_DELETE_REDUNDANT_TRANSPOSE_H_ diff --git a/mindspore-lite/tools/optimizer/format/to_format_base.cc b/mindspore-lite/tools/optimizer/format/to_format_base.cc index cd0b69933fe50fef5fc18b4e5502a70473fd445e..7afaaabc598e914ee31bce7ff82d052885343c5e 100644 --- a/mindspore-lite/tools/optimizer/format/to_format_base.cc +++ b/mindspore-lite/tools/optimizer/format/to_format_base.cc @@ -36,7 +36,7 @@ #include "mindspore/core/include/ir/graph_utils.h" using mindspore::lite::NHWC_SHAPE; -namespace mindspore { +namespace mindspore::lite { namespace opt { STATUS ToFormatBase::GenNewInput(const FuncGraphPtr &func_graph, const CNodePtr &cnode, const std::vector &perm, bool before, size_t index) { @@ -622,4 +622,4 @@ bool ToFormatBase::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/format/to_format_base.h b/mindspore-lite/tools/optimizer/format/to_format_base.h index 6e957fe28fb2346219138ebced3bede9e620dda1..c92bb0fc48d8e702b496f659c659be07086aaec5 100644 --- a/mindspore-lite/tools/optimizer/format/to_format_base.h +++ b/mindspore-lite/tools/optimizer/format/to_format_base.h @@ -29,7 +29,7 @@ #include "tools/optimizer/graph/infershape_pass.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class ToFormatBase : public Pass { public: @@ -83,6 +83,6 @@ class ToFormatBase : public Pass { FuncGraphManagerPtr manager_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FORMAT_TO_FORMAT_BASE_H_ diff --git a/mindspore-lite/tools/optimizer/format/to_nchw_format.cc b/mindspore-lite/tools/optimizer/format/to_nchw_format.cc index 242658449af772ccefad5b92f0ba63dc784d5c0a..e336a47f2faddb5e3dff341009946e96ddd0c013 100644 --- a/mindspore-lite/tools/optimizer/format/to_nchw_format.cc +++ b/mindspore-lite/tools/optimizer/format/to_nchw_format.cc @@ -18,7 +18,7 @@ #include "tools/optimizer/format/to_nchw_format.h" #include "ops_utils/op_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { STATUS ToNCHWFormat::GetTransNodeFormatType(const CNodePtr &cnode, opt::TransTypePair *trans_info) { MS_ERROR_IF_NULL_W_RET_VAL(cnode, lite::RET_ERROR); @@ -71,4 +71,4 @@ STATUS ToNCHWFormat::DecideConvWeightSrcAndDstFormat(const CNodePtr &cnode, sche return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/format/to_nchw_format.h b/mindspore-lite/tools/optimizer/format/to_nchw_format.h index b9e52707b44b39881d9296be98d5b4b1cd5a946e..7b9eed91afc72e81f0549c79d373c5c0817d719d 100644 --- a/mindspore-lite/tools/optimizer/format/to_nchw_format.h +++ b/mindspore-lite/tools/optimizer/format/to_nchw_format.h @@ -19,7 +19,7 @@ #include "tools/optimizer/format/to_format_base.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ToNCHWFormat : public ToFormatBase { public: @@ -37,6 +37,6 @@ class ToNCHWFormat : public ToFormatBase { schema::Format *dst_format) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FORMAT_TO_NCHW_FORMAT_H_ diff --git a/mindspore-lite/tools/optimizer/format/to_nhwc_format.cc b/mindspore-lite/tools/optimizer/format/to_nhwc_format.cc index 6916b66a29d637bf7c854810baba494787f9a3a2..7a5590ae536dd9e611d9bc3b9dbbdf77952565b4 100644 --- a/mindspore-lite/tools/optimizer/format/to_nhwc_format.cc +++ b/mindspore-lite/tools/optimizer/format/to_nhwc_format.cc @@ -19,7 +19,7 @@ #include #include "ops_utils/op_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { int CheckKFormat(const PrimitivePtr &prim, const std::string &node_name) { @@ -77,4 +77,4 @@ STATUS ToNHWCFormat::DecideConvWeightSrcAndDstFormat(const CNodePtr &cnode, sche return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/format/to_nhwc_format.h b/mindspore-lite/tools/optimizer/format/to_nhwc_format.h index 01f9e9d24333ad6e1784f7bfc999047b2355d2f8..63d435b6a9bee60e54536f4b6d8f36e61ac8ad56 100644 --- a/mindspore-lite/tools/optimizer/format/to_nhwc_format.h +++ b/mindspore-lite/tools/optimizer/format/to_nhwc_format.h @@ -19,7 +19,7 @@ #include "tools/optimizer/format/to_format_base.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ToNHWCFormat : public ToFormatBase { public: @@ -35,5 +35,5 @@ class ToNHWCFormat : public ToFormatBase { schema::Format *dst_format) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FORMAT_TO_NHWC_FORMAT_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/activation_fusion.cc index 06be39487f498a578947783d499e48a484b1e5ef..2ce283c0229817540edc1b59f79a761c3488382e 100644 --- a/mindspore-lite/tools/optimizer/fusion/activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/activation_fusion.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { STATUS DoFusion(CNodePtr cur_cnode, const CNodePtr &pre_cnode) { auto cur_act_prim = ops::GetOperator(cur_cnode->input(0)); @@ -111,4 +111,4 @@ bool ActivationFusion::Run(const FuncGraphPtr &func_graph) { return false; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/activation_fusion.h index fdfd37f0d02adf5550b00a209f6a8e8a1c778810..9339ad7ff11db661e82163a6a9f131889d87320e 100644 --- a/mindspore-lite/tools/optimizer/fusion/activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/activation_fusion.h @@ -21,7 +21,7 @@ #include "tools/converter/converter_context.h" #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ActivationFusion : public Pass { public: @@ -30,5 +30,5 @@ class ActivationFusion : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/add_activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/add_activation_fusion.cc index da34ced9840da9e3f37ecef5dc760ef2dfbdcc53..af9c7ca8201114f0f0f972301b769d1363fd5e3a 100644 --- a/mindspore-lite/tools/optimizer/fusion/add_activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/add_activation_fusion.cc @@ -28,7 +28,7 @@ #include "tools/converter/quantizer/quant_param_holder.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef AddActivationFusion::DefinePattern() const { auto is_add = std::make_shared(IsSpecifiedNode<&prim::kPrimAddFusion>); auto is_act = std::make_shared(IsSpecifiedNode<&prim::kPrimActivation>); @@ -144,4 +144,4 @@ bool AddActivationFusion::CheckPattern(const FuncGraphPtr &func_graph, const CNo } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/add_activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/add_activation_fusion.h index 758d01213a743f305faf401067e00be41fb6f07a..dc65343f99d438498017979f75e9888414fc19e5 100644 --- a/mindspore-lite/tools/optimizer/fusion/add_activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/add_activation_fusion.h @@ -24,7 +24,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AddActivationFusion : public LitePatternProcessPass { public: @@ -42,5 +42,5 @@ class AddActivationFusion : public LitePatternProcessPass { const std::set support_act_types) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ADD_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/add_concat_activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/add_concat_activation_fusion.cc index 1bd9fb8facf85431f62f9ec193547034dd8223c8..fc92b36fecb9df5cbc3913ab5419181bdb3ace31 100644 --- a/mindspore-lite/tools/optimizer/fusion/add_concat_activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/add_concat_activation_fusion.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef AddConcatActivationFusion::DefinePattern() const { auto is_act = std::make_shared(IsSpecifiedNode<&prim::kPrimActivation>); MS_CHECK_TRUE_RET(is_act != nullptr, {}); @@ -107,4 +107,4 @@ const AnfNodePtr AddConcatActivationFusion::Process(const FuncGraphPtr &func_gra return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/add_concat_activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/add_concat_activation_fusion.h index fdf4c94e24b83b4dc74fc1be6a8d1db1a065983f..ff0bb96b5977fd2805d83d20b46a360d9ef9a6bc 100644 --- a/mindspore-lite/tools/optimizer/fusion/add_concat_activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/add_concat_activation_fusion.h @@ -20,7 +20,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class AddConcatActivationFusion : public LitePatternProcessPass { public: explicit AddConcatActivationFusion(bool multigraph = true, const std::string &name = "AddConcatActivationFusion") @@ -29,5 +29,5 @@ class AddConcatActivationFusion : public LitePatternProcessPass { const BaseRef DefinePattern() const override; const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ADD_CONCAT_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/add_layernorm_fusion.cc b/mindspore-lite/tools/optimizer/fusion/add_layernorm_fusion.cc index 6b50a3cf57c5eb3a5295c1f7418c7c41c23d115c..cf195d778c4ebbaa8081703a10ba0bfe5c81cb18 100644 --- a/mindspore-lite/tools/optimizer/fusion/add_layernorm_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/add_layernorm_fusion.cc @@ -41,7 +41,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int kAxis = -1; @@ -389,4 +389,4 @@ const AnfNodePtr FuseAddAndLayernorm::Process(const FuncGraphPtr &graph, const A } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/add_layernorm_fusion.h b/mindspore-lite/tools/optimizer/fusion/add_layernorm_fusion.h index a270065e992567ae4c0035fbec42d63b27a0505f..dedb534657f4e568fe7c253691a8d4c6cd6f5a7b 100644 --- a/mindspore-lite/tools/optimizer/fusion/add_layernorm_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/add_layernorm_fusion.h @@ -27,7 +27,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "mindspore/ops/op_def/nn_optimizer_ops.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class LayerNormV3Fusion : public MultiplePatternProcessPass { public: @@ -83,6 +83,6 @@ class FuseAddAndLayernorm : public opt::LitePatternProcessPass { }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ADD_LAYERNORM_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/add_stream_label_pass.cc b/mindspore-lite/tools/optimizer/fusion/add_stream_label_pass.cc index 5eb2f2fbcc82e7b406fefe737758eece271372da..0216e0e5051c16fa7bc7cb5e0ed476b8ca6b42a4 100644 --- a/mindspore-lite/tools/optimizer/fusion/add_stream_label_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/add_stream_label_pass.cc @@ -23,7 +23,7 @@ #include "common/common.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kMaxLineCount = 100; @@ -182,4 +182,4 @@ bool AddStreamLabelPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/add_stream_label_pass.h b/mindspore-lite/tools/optimizer/fusion/add_stream_label_pass.h index 0b025147109df7a3bc610f322ac58a5e3c49d856..a671bd69519edcbd8a612dee0e5eb30bce1e9ddb 100644 --- a/mindspore-lite/tools/optimizer/fusion/add_stream_label_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/add_stream_label_pass.h @@ -24,7 +24,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/converter/cxx_api/converter_para.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AddStreamLabelPass : public Pass { public: @@ -45,6 +45,6 @@ class AddStreamLabelPass : public Pass { std::set all_node_names_ = {}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ADJUST_MATMUL_PASS_H diff --git a/mindspore-lite/tools/optimizer/fusion/adjust_col2im_pass.cc b/mindspore-lite/tools/optimizer/fusion/adjust_col2im_pass.cc index 3de0ee787593d9fea5cef33e20da647761da75f2..1396c081881ee249c108a3d3233ce06a4490b0f8 100644 --- a/mindspore-lite/tools/optimizer/fusion/adjust_col2im_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/adjust_col2im_pass.cc @@ -32,7 +32,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { STATUS AddConstInputToAttr(const CNodePtr &cnode, const size_t input_index, const std::string &arg_name, @@ -171,4 +171,4 @@ bool AdjustCol2imPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/adjust_col2im_pass.h b/mindspore-lite/tools/optimizer/fusion/adjust_col2im_pass.h index 14012fa724aafb155fbf45f2682a8ec22c9c8b1b..5725ba40f4e4e4dcc6853740bc220266cdc0aa3a 100644 --- a/mindspore-lite/tools/optimizer/fusion/adjust_col2im_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/adjust_col2im_pass.h @@ -19,7 +19,7 @@ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AdjustCol2imPass : public Pass { public: @@ -29,6 +29,6 @@ class AdjustCol2imPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ADJUST_COL2IM_PASS_H diff --git a/mindspore-lite/tools/optimizer/fusion/adjust_controlflow_pass.cc b/mindspore-lite/tools/optimizer/fusion/adjust_controlflow_pass.cc index 2bf99be8bcca5a6915178d618d77a959833d80ef..d23fb13cc167e6b384f03ddbaf632426cf0bd5dd 100644 --- a/mindspore-lite/tools/optimizer/fusion/adjust_controlflow_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/adjust_controlflow_pass.cc @@ -32,7 +32,7 @@ #include "tools/converter/export_model.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { int32_t AdjustControlflowPass::AdjustBranchs(const FuncGraphPtr &branch, const FuncGraphPtr &func_graph) { auto node_list = TopoSort(branch->get_return()); @@ -155,4 +155,4 @@ bool AdjustControlflowPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/adjust_controlflow_pass.h b/mindspore-lite/tools/optimizer/fusion/adjust_controlflow_pass.h index 0b7fb367663aa2a78fbcc98bf4a25aae067a72d5..0491c27db317402e5863e69c915e02b3d9b61421 100644 --- a/mindspore-lite/tools/optimizer/fusion/adjust_controlflow_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/adjust_controlflow_pass.h @@ -19,7 +19,7 @@ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AdjustControlflowPass : public Pass { public: @@ -32,6 +32,6 @@ class AdjustControlflowPass : public Pass { int32_t AdjustControlflow(const CNodePtr &cnode, const FuncGraphPtr &func_graph); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ADJUST_CONTROLFLOW_PASS_H diff --git a/mindspore-lite/tools/optimizer/fusion/adjust_matmul_pass.cc b/mindspore-lite/tools/optimizer/fusion/adjust_matmul_pass.cc index d03efa8e92e8fc792aecc1cc2f5304a0a6f65372..fb7d3a9481c9643a9e2f9dc168fd89be36f268b0 100644 --- a/mindspore-lite/tools/optimizer/fusion/adjust_matmul_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/adjust_matmul_pass.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int32_t kShapeMinus_1 = -1; @@ -421,4 +421,4 @@ bool AdjustMatmulPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/adjust_matmul_pass.h b/mindspore-lite/tools/optimizer/fusion/adjust_matmul_pass.h index 2a865b1fbe76b620be36e11243f0e308762bd327..513649b7bd20f131da5f01a0adb6ec99ae69a388 100644 --- a/mindspore-lite/tools/optimizer/fusion/adjust_matmul_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/adjust_matmul_pass.h @@ -19,7 +19,7 @@ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AdjustMatmulPass : public Pass { public: @@ -28,6 +28,6 @@ class AdjustMatmulPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ADJUST_MATMUL_PASS_H diff --git a/mindspore-lite/tools/optimizer/fusion/adjust_resize_dims_pass.cc b/mindspore-lite/tools/optimizer/fusion/adjust_resize_dims_pass.cc index e7563ff28a832f1aa1edf7843e5e5831204b52af..631b8bee23691df64221c7201d10756c84b485d4 100644 --- a/mindspore-lite/tools/optimizer/fusion/adjust_resize_dims_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/adjust_resize_dims_pass.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int32_t kShapeMinus_1 = -1; @@ -517,4 +517,4 @@ bool AdjustResizeDimsPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/adjust_resize_dims_pass.h b/mindspore-lite/tools/optimizer/fusion/adjust_resize_dims_pass.h index d6536ded5c096daf6fc1042ed2ffd90d962ce19a..ea8d14da83dea0e428da11e9f657cd77a8b46ae1 100644 --- a/mindspore-lite/tools/optimizer/fusion/adjust_resize_dims_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/adjust_resize_dims_pass.h @@ -19,7 +19,7 @@ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AdjustResizeDimsPass : public Pass { public: @@ -28,6 +28,6 @@ class AdjustResizeDimsPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ADJUST_RESIZE_DIMS_H diff --git a/mindspore-lite/tools/optimizer/fusion/affine_activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/affine_activation_fusion.cc index d627d93fae9b3e583e5b6c675a9cb9a3606c3274..80bf004c39bbfa51785caaa36afa2e06ad0de54e 100644 --- a/mindspore-lite/tools/optimizer/fusion/affine_activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/affine_activation_fusion.cc @@ -25,7 +25,7 @@ #include "ops_utils/op_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef AffineActivationFusion::DefinePattern() const { auto is_activation = std::make_shared(IsSpecifiedNode<&prim::kPrimActivation>); MS_CHECK_TRUE_RET(is_activation != nullptr, {}); @@ -85,4 +85,4 @@ const AnfNodePtr AffineActivationFusion::Process(const FuncGraphPtr &func_graph, return affine_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/affine_activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/affine_activation_fusion.h index cad0726d6b1f30098503cece3cd56a6946b5be8d..fa80def62fb0d9ef80a7c8a46e4d66ffcddc7677 100644 --- a/mindspore-lite/tools/optimizer/fusion/affine_activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/affine_activation_fusion.h @@ -21,7 +21,7 @@ #include "schema/inner/model_generated.h" #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AffineActivationFusion : public LitePatternProcessPass { public: @@ -32,5 +32,5 @@ class AffineActivationFusion : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_AFFINE_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/affine_fusion.cc b/mindspore-lite/tools/optimizer/fusion/affine_fusion.cc index bb043793d3b862e5faeb6cd91d8755bbf54f3131..353f7996087a85f0cd573d5052ad9194ac24445a 100644 --- a/mindspore-lite/tools/optimizer/fusion/affine_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/affine_fusion.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { constexpr auto kInputWithBiasNum = 4; constexpr auto kInputBias = 3; const BaseRef AffineFusion::DefinePattern() const { @@ -130,4 +130,4 @@ const AnfNodePtr AffineFusion::Process(const FuncGraphPtr &func_graph, const Anf MS_LOG(INFO) << "splice + matmul fused to affine node: " << affine_node->fullname_with_scope() << "success."; return affine_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/affine_fusion.h b/mindspore-lite/tools/optimizer/fusion/affine_fusion.h index 317987c59e17d60fbd6e0387e8b66a897f239fbd..de1013dffe94c6d050ee82995ecf4e0d58ef6bbf 100644 --- a/mindspore-lite/tools/optimizer/fusion/affine_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/affine_fusion.h @@ -21,7 +21,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "schema/inner/model_generated.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AffineFusion : public LitePatternProcessPass { public: @@ -32,5 +32,5 @@ class AffineFusion : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_AFFINE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/antiquant_add_mul_matmul_allreduce_fusion.cc b/mindspore-lite/tools/optimizer/fusion/antiquant_add_mul_matmul_allreduce_fusion.cc index eb96a84faf168df1c79292a07da2ead9b26e5fda..8bca60c3db8a9acfdfae85547448165bd1e973ff 100644 --- a/mindspore-lite/tools/optimizer/fusion/antiquant_add_mul_matmul_allreduce_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/antiquant_add_mul_matmul_allreduce_fusion.cc @@ -32,7 +32,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { std::unordered_map AntiquantAddMulMatMulAllReduceFusion::DefinePatterns() const { std::unordered_map patterns; patterns[kPatternNameAntiquantAddMulMatMulAllReduce] = DefineAntiquantAddMulMatMulAllReducePattern(); @@ -209,4 +209,4 @@ AnfNodePtr AntiquantAddMulMatMulAllReduceFusion::Process(const std::string &patt MS_LOG(INFO) << "MatMulAllReduce replace AntiquantAddMulMatMulAllReduce success"; return matmul_allreduce_cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/antiquant_add_mul_matmul_allreduce_fusion.h b/mindspore-lite/tools/optimizer/fusion/antiquant_add_mul_matmul_allreduce_fusion.h index 15a4e33dd0e0494836d1482778c4d8184447fda7..f535a0b9d245e0c027c4da3eda66b2577c29043f 100644 --- a/mindspore-lite/tools/optimizer/fusion/antiquant_add_mul_matmul_allreduce_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/antiquant_add_mul_matmul_allreduce_fusion.h @@ -22,7 +22,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class AntiquantAddMulMatMulAllReduceFusion : public MultiplePatternProcessPass { public: @@ -47,5 +47,5 @@ class AntiquantAddMulMatMulAllReduceFusion : public MultiplePatternProcessPass { const std::string kAttrNameTransposeA = "transpose_a"; const std::string kAttrNameTransposeB = "transpose_b"; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ANTIQUANT_ADD_MUL_MATMUL_ALLREDUCE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/batchmatmul_fusion.cc b/mindspore-lite/tools/optimizer/fusion/batchmatmul_fusion.cc index 5fba99355170529a0db5f8758b25db0d28c245fa..cc8ffde2a9b82b0ea0fd1a40f6ef6bc4896819c3 100644 --- a/mindspore-lite/tools/optimizer/fusion/batchmatmul_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/batchmatmul_fusion.cc @@ -36,7 +36,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "ir/tensor_new.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr int64_t kFcRightInputDims = 3; constexpr float kFpPrecision = 1e-6; @@ -401,4 +401,4 @@ const AnfNodePtr BatchMatMulFusion::Process(const FuncGraphPtr &func_graph, cons MS_LOG(INFO) << "stack node:" << stack_cnode->fullname_with_scope() << " batchmatmul fusion success"; return matmul_cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/batchmatmul_fusion.h b/mindspore-lite/tools/optimizer/fusion/batchmatmul_fusion.h index 4124ed03e05778e891256d1ca6171d9b95bc4d7f..d28bde16035e035f8702fb4d3e75d17d6c09943a 100644 --- a/mindspore-lite/tools/optimizer/fusion/batchmatmul_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/batchmatmul_fusion.h @@ -20,7 +20,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "tools/converter/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class BatchMatMulFusion : public LitePatternProcessPass { public: @@ -34,5 +34,5 @@ class BatchMatMulFusion : public LitePatternProcessPass { const CNodePtr &left_slice_cnode) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_BATCHMATMUL_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/batchnorm_to_scale_fusion.cc b/mindspore-lite/tools/optimizer/fusion/batchnorm_to_scale_fusion.cc index a9cff7e35c625cc61105169575ae8a517fd1b302..2aa9cf28444ec4a4fb45c2b291043e1ed40c6af2 100644 --- a/mindspore-lite/tools/optimizer/fusion/batchnorm_to_scale_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/batchnorm_to_scale_fusion.cc @@ -33,7 +33,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr float kEps = 1e-8; constexpr float kDefaultEps = 1e-5; @@ -353,4 +353,4 @@ bool BatchNormToScaleFusion::Run(const FuncGraphPtr &func_graph) { } return false; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/batchnorm_to_scale_fusion.h b/mindspore-lite/tools/optimizer/fusion/batchnorm_to_scale_fusion.h index ed197210621cf145f5432665c7f6afb2a4e19a6b..2387742873bb5325b376c940999cc275dda6728e 100644 --- a/mindspore-lite/tools/optimizer/fusion/batchnorm_to_scale_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/batchnorm_to_scale_fusion.h @@ -20,7 +20,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class BatchNormToScaleFusion : public Pass { public: BatchNormToScaleFusion() : Pass("BatchNormToScaleFusion") {} @@ -35,5 +35,5 @@ class BatchNormToScaleFusion : public Pass { }; int CalculateScaleAndBiasFromBN(const CNodePtr &bn_node, int kernel_num, float *trans_scale, float *trans_bias); -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_BATCHNORM_TO_SCALE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/cast_fusion.cc b/mindspore-lite/tools/optimizer/fusion/cast_fusion.cc index c9bec643360ee563334646a97a9dcdc0c0f1f9eb..59a718d3d1d7e85ea878278ed1126b477dc78920 100644 --- a/mindspore-lite/tools/optimizer/fusion/cast_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/cast_fusion.cc @@ -33,7 +33,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { bool IsGoodCastSplitFusion(const FuncGraphPtr &func_graph, const CNodePtr &split_cnode_2) { auto manager = func_graph->manager(); @@ -355,4 +355,4 @@ AnfNodePtr CastFusionPass::Process(const std::string &pattern_name, const mindsp } return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/cast_fusion.h b/mindspore-lite/tools/optimizer/fusion/cast_fusion.h index c423ec94cd54bfe8fb745ebc02abfffbb6fea4e6..8f073e961e127cd40470711661a94b3966cb90da 100644 --- a/mindspore-lite/tools/optimizer/fusion/cast_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/cast_fusion.h @@ -22,7 +22,7 @@ #include "include/backend/optimizer/optimizer.h" #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class CastFusionPass : public MultiplePatternProcessPass { public: @@ -47,5 +47,5 @@ class CastFusionPass : public MultiplePatternProcessPass { AnfNodePtr CastCastFusion(const FuncGraphPtr &func_graph, const mindspore::AnfNodePtr &node) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TRANSPOSE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/concat_concat_fusion.cc b/mindspore-lite/tools/optimizer/fusion/concat_concat_fusion.cc index 7511906f84f9e6ee4bce239f730ce62cf2b31bda..be71ae73d697cbcd6f1a772a75d49423f68fd5b4 100644 --- a/mindspore-lite/tools/optimizer/fusion/concat_concat_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/concat_concat_fusion.cc @@ -23,7 +23,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool ConcatConcatFusion::Run(const FuncGraphPtr &func_graph) { MS_ASSERT(func_graph != nullptr); @@ -94,4 +94,4 @@ int ConcatConcatFusion::Process(const FuncGraphPtr &func_graph, const CNodePtr & return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/concat_concat_fusion.h b/mindspore-lite/tools/optimizer/fusion/concat_concat_fusion.h index 15b84886f6a0a25398c2dcb1a03bdb2ec70f7cac..eabd46b05539127fd0f9ae39ac44fb0d632be801 100644 --- a/mindspore-lite/tools/optimizer/fusion/concat_concat_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/concat_concat_fusion.h @@ -19,7 +19,7 @@ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConcatConcatFusion : public Pass { public: @@ -31,6 +31,6 @@ class ConcatConcatFusion : public Pass { int Process(const FuncGraphPtr &func_graph, const CNodePtr &cnode); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONCAT_CONCAT_FUSION_H diff --git a/mindspore-lite/tools/optimizer/fusion/conv_activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_activation_fusion.cc index 730d45631bbebd09da524a3a7619133e422ff28a..f92ae494526e6d2b45c4a09ec69f71dbecb0c0e7 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_activation_fusion.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef ConvActivationFusion::DefinePattern() const { auto is_conv = std::make_shared(IsConvNode); MS_CHECK_TRUE_RET(is_conv != nullptr, {}); @@ -86,4 +86,4 @@ const AnfNodePtr ConvActivationFusion::Process(const FuncGraphPtr &func_graph, c } return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/conv_activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_activation_fusion.h index 611b3b0f465b2f7f9c7704aba956c8459e92a71d..a1a3e04e04223bdce19eb791c3525d6cfe95e977 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_activation_fusion.h @@ -22,7 +22,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "tools/converter/cxx_api/converter_para.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConvActivationFusion : public LitePatternProcessPass { public: @@ -40,5 +40,5 @@ class ConvActivationFusion : public LitePatternProcessPass { const std::shared_ptr param_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/conv_biasadd_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_biasadd_fusion.cc index da78af0a8f60f5cb9ed33f8f0a8ee63664ea126e..eef16916d19106c77df78b6adc8a8a9402197d28 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_biasadd_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_biasadd_fusion.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_b.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kAddWeightIndex = 2; bool IsConvExtendNode(const BaseRef &n) { @@ -236,4 +236,4 @@ const AnfNodePtr ConvBiasaddFusion::Process(const FuncGraphPtr &func_graph, cons MS_ASSERT(add_cnode != nullptr); return add_cnode->input(1); } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/conv_biasadd_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_biasadd_fusion.h index b806bd54e570c79b6e8712efd93d9b398b37c93d..8724ae5ff57d029847c9622ca71181cd01a8c7b6 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_biasadd_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_biasadd_fusion.h @@ -20,7 +20,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "tools/converter/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConvBiasaddFusion : public LitePatternProcessPass { public: @@ -35,5 +35,5 @@ class ConvBiasaddFusion : public LitePatternProcessPass { CNodePtr GetAddCnode(const AnfNodePtr &node) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_BIASADD_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/conv_bn_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_bn_fusion.cc index f9cc8268aa9745c37e690c1cd0e3800a6c99466d..d9c3449306803192799a5a9f38b7b0534406b856 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_bn_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_bn_fusion.cc @@ -24,7 +24,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_b.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_f.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { bool IsBatchNode(const BaseRef &n) { if (utils::isa(n)) { @@ -55,4 +55,4 @@ int ConvBatchNormFusion::InitTransParam(const CNodePtr &bn_node, int kernel_num, auto ret = CalculateScaleAndBiasFromBN(bn_node, kernel_num, trans_scale, trans_bias); return ret; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/conv_bn_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_bn_fusion.h index 229c5655591c6422238968cc0546ab3e576514e4..a56d534747efdb21a0e2f1c8e58db5a4c51b8de1 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_bn_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_bn_fusion.h @@ -19,7 +19,7 @@ #include "tools/optimizer/fusion/conv_transform_fusion.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ConvBatchNormFusion : public ConvTransformFusion { public: explicit ConvBatchNormFusion(FmkType fmk_type = converter::kFmkTypeMs, bool multigraph = true) @@ -32,5 +32,5 @@ class ConvBatchNormFusion : public ConvTransformFusion { private: int InitTransParam(const CNodePtr &, int, float *, float *) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_BN_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/conv_conv_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_conv_fusion.cc index 29d9d2d8a65143fdc71e3d51f30d742f1cb55095..0485ddb26bb82664965423b8fe6aae61ccc0a600 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_conv_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_conv_fusion.cc @@ -26,7 +26,7 @@ #include "ops_utils/op_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kConvNoBiasLen = 3; constexpr size_t kConvWithBiasLen = 4; @@ -322,4 +322,4 @@ const AnfNodePtr ConvConvFusion::Process(const FuncGraphPtr &func_graph, const A (void)ReplaceParametersAndNodes(func_graph, up_conv_cnode, down_conv_cnode); return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/conv_conv_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_conv_fusion.h index f9ac6419742034f36d94001db6ce5487a025a260..a08d23ddd14bf7ac7c3db98faf6a92c9967d7c45 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_conv_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_conv_fusion.h @@ -21,7 +21,7 @@ #include "schema/inner/model_generated.h" #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConvConvFusion : public LitePatternProcessPass { public: @@ -34,5 +34,5 @@ class ConvConvFusion : public LitePatternProcessPass { bool CheckCanFusion(const CNodePtr &up_conv_cnode, const CNodePtr &down_conv_cnode) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_CONV_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/conv_pad_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_pad_fusion.cc index 0851cab2b29a4ad5ebfa519ee7a698b0b3a8eb62..ebbaf080ecf445ab946bddf3ddfba317c67b6b7d 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_pad_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_pad_fusion.cc @@ -33,7 +33,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_p.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kPadInputsLength = 3; @@ -286,4 +286,4 @@ AnfNodePtr ConvPadFusion::Process(const std::string &pattern_name, const FuncGra return nullptr; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/conv_pad_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_pad_fusion.h index f8f9f7ca751f6c95cb9e368ec38f7fe4d1290556..db4ebbb8a8cf405d596e80bee93ea3ff10acd71f 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_pad_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_pad_fusion.h @@ -22,7 +22,7 @@ #include "include/backend/optimizer/optimizer.h" #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConvPadFusion : public MultiplePatternProcessPass { public: @@ -38,5 +38,5 @@ class ConvPadFusion : public MultiplePatternProcessPass { VectorRef DefinePadTransposeConvPattern() const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_PAD_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/conv_scale_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_scale_fusion.cc index ea98d48a847e24d0bf5755c7153acae206626256..dae43755d856bcd3f5b40eb5441d93dd2ba7c6f8 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_scale_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_scale_fusion.cc @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kScaleWeightIndex = 2; constexpr size_t kScaleBiasIndex = 3; @@ -97,4 +97,4 @@ int ConvScaleFusion::InitTransParam(const CNodePtr &scale_node, int kernel_num, } return lite::RET_OK; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/conv_scale_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_scale_fusion.h index d2c4012eea26889e4ed2d9c71db60731484c2088..60b5d08ab902709818feee315017af5e1e13a3df 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_scale_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_scale_fusion.h @@ -19,7 +19,7 @@ #include "tools/optimizer/fusion/conv_transform_fusion.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ConvScaleFusion : public ConvTransformFusion { public: explicit ConvScaleFusion(FmkType fmk_type = converter::kFmkTypeMs, bool multigraph = true) @@ -32,5 +32,5 @@ class ConvScaleFusion : public ConvTransformFusion { private: int InitTransParam(const CNodePtr &, int, float *, float *) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_SCALE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/conv_transform_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_transform_fusion.cc index cc57a7fca9f794cda2efea9fbb491f77fa308d35..92d3bb6553cb7f05586871ab3f0f7a7a0c5cead8 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_transform_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_transform_fusion.cc @@ -30,7 +30,7 @@ #include "ops_utils/op_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kConvWeightIndex = 2; constexpr size_t kConvBiasIndex = 3; @@ -450,4 +450,4 @@ bool ConvTransformFusion::CheckCanFused(const FuncGraphPtr &func_graph, const CN return is_value_node || conv_weight_param != nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/conv_transform_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_transform_fusion.h index a764bb89eb5506c0723b63150b32c566afa4e1bf..b313feb034e9bae02c18d8d02b5bc15b08c94054 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_transform_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_transform_fusion.h @@ -22,7 +22,7 @@ #include "include/registry/converter_context.h" using mindspore::converter::FmkType; -namespace mindspore::opt { +namespace mindspore::lite::opt { class ConvTransformFusion : public LitePatternProcessPass { public: explicit ConvTransformFusion(bool multigraph = true, const std::string &name = "ConvTransformFusion") @@ -45,5 +45,5 @@ class ConvTransformFusion : public LitePatternProcessPass { FmkType fmk_type_ = converter::kFmkTypeTf; bool nchw_format_ = false; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_TRANSFORM_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/conv_tuple_activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_tuple_activation_fusion.cc index c94104888bf287dde0721a2928cda18d8dec106c..cd526b493c2d96f791178727262c6ccc424cbba5 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_tuple_activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_tuple_activation_fusion.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef ConvTupleActivationFusion::DefinePattern() const { auto is_conv = std::make_shared(IsConvNode); MS_CHECK_TRUE_RET(is_conv != nullptr, {}); @@ -99,4 +99,4 @@ const AnfNodePtr ConvTupleActivationFusion::Process(const FuncGraphPtr &func_gra } return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/conv_tuple_activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_tuple_activation_fusion.h index e2ebd675e689516944684ef3aed0ae4096bec0a0..fa5c6b388c76f3b6caec3ea73e7445819d0e83ad 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_tuple_activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_tuple_activation_fusion.h @@ -20,7 +20,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ConvTupleActivationFusion : public LitePatternProcessPass { public: @@ -31,5 +31,5 @@ class ConvTupleActivationFusion : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_TUPLE_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/conv_tuplegetitem_fusion.cc b/mindspore-lite/tools/optimizer/fusion/conv_tuplegetitem_fusion.cc index 3e9ffd3d5e4b1110d5aeef143a7c28c7fff51e7c..b46c7b473fc541543edf476ec1ebf8f0ac85b00f 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_tuplegetitem_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/conv_tuplegetitem_fusion.cc @@ -22,7 +22,7 @@ #include "nnacl_c/op_base.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef ConvTupleGetItemFusion::DefinePattern() const { auto is_tuple_getitem = std::make_shared(IsSpecifiedNode<&prim::kPrimTupleGetItem>); MS_CHECK_TRUE_RET(is_tuple_getitem != nullptr, {}); @@ -73,4 +73,4 @@ const AnfNodePtr ConvTupleGetItemFusion::Process(const FuncGraphPtr &func_graph, } return conv_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/conv_tuplegetitem_fusion.h b/mindspore-lite/tools/optimizer/fusion/conv_tuplegetitem_fusion.h index 45ca1d4d67181b22ba14fa3701e6f286c1398855..235ea318f4006f3ea53132ac3dd22ea0db2d74c1 100644 --- a/mindspore-lite/tools/optimizer/fusion/conv_tuplegetitem_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/conv_tuplegetitem_fusion.h @@ -18,7 +18,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ConvTupleGetItemFusion : public LitePatternProcessPass { public: explicit ConvTupleGetItemFusion(const std::string &name = "ConvTupleGetItemFusion", bool multigraph = true) @@ -27,6 +27,6 @@ class ConvTupleGetItemFusion : public LitePatternProcessPass { const BaseRef DefinePattern() const override; const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_CONV_TUPLEGETITEM_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/decoder_layer_fusion.cc b/mindspore-lite/tools/optimizer/fusion/decoder_layer_fusion.cc index 24c7fd9679bcaf127276f5169af41209bb869aad..e0e2e679188aef4cf83b9556ae10553bc4ac6f5c 100644 --- a/mindspore-lite/tools/optimizer/fusion/decoder_layer_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/decoder_layer_fusion.cc @@ -37,7 +37,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { const auto &p1 = std::placeholders::_1; } // namespace @@ -524,4 +524,4 @@ CNodePtr DecoderLayerFusion::CreateMaskedDecoderLayerFusionNode(const FuncGraphP new_node->set_fullname_with_scope(node->fullname_with_scope() + "/decoder_layer"); return new_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/decoder_layer_fusion.h b/mindspore-lite/tools/optimizer/fusion/decoder_layer_fusion.h index bb631cf4701a96b184dd8cc7df5af77c91d37d6b..0bc716844fc4592f662546682de0e4d1ebb56219 100644 --- a/mindspore-lite/tools/optimizer/fusion/decoder_layer_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/decoder_layer_fusion.h @@ -28,7 +28,7 @@ #include "infer/cxx_api/activation.h" #include "tools/optimizer/fusion/multi_head_attention_fusion.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class DecoderLayerFusion : public MultiplePatternProcessPass { public: @@ -117,5 +117,5 @@ class DecoderLayerFusion : public MultiplePatternProcessPass { mutable bool layer_norm_{false}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_DECODER_LAYER_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/encoder_layer_fusion.cc b/mindspore-lite/tools/optimizer/fusion/encoder_layer_fusion.cc index 9d1dfc51e10833e3503921ff593e84d6593eb8a5..6be2729b8eeb9803d94c38423c41c063618c0acd 100644 --- a/mindspore-lite/tools/optimizer/fusion/encoder_layer_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/encoder_layer_fusion.cc @@ -47,7 +47,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { const auto &p1 = std::placeholders::_1; } // namespace @@ -1156,4 +1156,4 @@ CNodePtr EncoderLayerFusion::CreateMaskedEncoderLayerFusionNode(const FuncGraphP new_node->set_fullname_with_scope(node->fullname_with_scope() + "/encoder_layer"); return new_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/encoder_layer_fusion.h b/mindspore-lite/tools/optimizer/fusion/encoder_layer_fusion.h index 834832171a50b100ed0fa8a5af951acb196369b6..7d057f387083c9c5845a6ea205d534e4c2f23707 100644 --- a/mindspore-lite/tools/optimizer/fusion/encoder_layer_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/encoder_layer_fusion.h @@ -28,7 +28,7 @@ #include "infer/cxx_api/layer_norm_fusion.h" #include "infer/cxx_api/activation.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class EncoderLayerFusion : public MultiplePatternProcessPass { public: @@ -198,5 +198,5 @@ class EncoderLayerFusion : public MultiplePatternProcessPass { mutable bool embedding_layer_{false}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ENCODER_LAYER_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/expanddims_reshape_fusion.cc b/mindspore-lite/tools/optimizer/fusion/expanddims_reshape_fusion.cc index 455487af9cea5ebf55e1c0b4b3c27dd72d0eaa6e..fa33a975536859f8ff4fda1ce15bf79afe1f6191 100644 --- a/mindspore-lite/tools/optimizer/fusion/expanddims_reshape_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/expanddims_reshape_fusion.cc @@ -25,7 +25,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_e.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef ExpandDimsReshapeFusion::DefinePattern() const { auto is_reshape = std::make_shared(IsSpecifiedNode<&prim::kPrimReshape>); MS_CHECK_TRUE_RET(is_reshape != nullptr, {}); @@ -72,4 +72,4 @@ const AnfNodePtr ExpandDimsReshapeFusion::Process(const FuncGraphPtr &func_graph manage->SetEdge(reshape_cnode, C1NUM, expanddims_cnode->input(SECOND_INPUT)); return reshape_cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/expanddims_reshape_fusion.h b/mindspore-lite/tools/optimizer/fusion/expanddims_reshape_fusion.h index eb04fb1ccc915212b5005e99ccf990aa3357319a..550cc82556e961b29867eb926bf80da769723cc2 100644 --- a/mindspore-lite/tools/optimizer/fusion/expanddims_reshape_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/expanddims_reshape_fusion.h @@ -22,7 +22,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "utils/check_convert_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ExpandDimsReshapeFusion : public LitePatternProcessPass { public: @@ -36,5 +36,5 @@ class ExpandDimsReshapeFusion : public LitePatternProcessPass { bool CheckCanFuse(const FuncGraphPtr &func_graph, const AnfNodePtr &node) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_EXPANDDIMS_RESHAPE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/ffn_antiquant_fusion.cc b/mindspore-lite/tools/optimizer/fusion/ffn_antiquant_fusion.cc index eaf58248ac5c6822f803d00f5924a9f590863fbe..28b204f179baa6b46312119e8304fa3dce3fac6c 100644 --- a/mindspore-lite/tools/optimizer/fusion/ffn_antiquant_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/ffn_antiquant_fusion.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr size_t kFFNAntiquantScaleInputIndex = 10; constexpr size_t kFFNWeight1InputIndex = 1; @@ -325,4 +325,4 @@ int FFNAntiquantFusion::Process(const FuncGraphPtr &func_graph, const CNodePtr & return RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/ffn_antiquant_fusion.h b/mindspore-lite/tools/optimizer/fusion/ffn_antiquant_fusion.h index 1eb7aa37dbc645ea34c7ef2c403df987def11fda..af9ec38d0c0ae635465972ad0f834a472bac5617 100644 --- a/mindspore-lite/tools/optimizer/fusion/ffn_antiquant_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/ffn_antiquant_fusion.h @@ -20,7 +20,7 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class FFNAntiquantFusion : public Pass { public: @@ -39,6 +39,6 @@ class FFNAntiquantFusion : public Pass { std::vector GetScaleZpInStragety(std::vector weight_in_strategy); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_FFN_ANTIQUANT_FUSION_H diff --git a/mindspore-lite/tools/optimizer/fusion/ffn_custom_pass.cc b/mindspore-lite/tools/optimizer/fusion/ffn_custom_pass.cc index 94bcd429162384648ff64f2c2857e938a4045997..70cad575e5e57b36853187937ad97bc1f6e48dc4 100644 --- a/mindspore-lite/tools/optimizer/fusion/ffn_custom_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/ffn_custom_pass.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr auto kNameFFNNameConf = "FFNCust"; constexpr auto kNameFFNPatternForSD = "FFNCustPatternForSD"; @@ -418,4 +418,4 @@ AnfNodePtr FFNCustomPass::Process(const std::string &patten_name, const FuncGrap return cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/ffn_custom_pass.h b/mindspore-lite/tools/optimizer/fusion/ffn_custom_pass.h index 4caa14cad575ab6c7fe54667eec89d660cb990c2..0299abf211a360ca170807dc51886903a5f80f78 100644 --- a/mindspore-lite/tools/optimizer/fusion/ffn_custom_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/ffn_custom_pass.h @@ -24,7 +24,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class FFNCustomPass : public MultiplePatternProcessPass { public: @@ -48,5 +48,5 @@ class FFNCustomPass : public MultiplePatternProcessPass { op_attrs_type op_attrs_map_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_FFN_CUSTOM_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/ffn_fusion.cc b/mindspore-lite/tools/optimizer/fusion/ffn_fusion.cc index 91cdb1cca8e7d4719e80e39d39249d3ea992b24f..83e29e169000ed3476b30d0f7ef46a88b73961b1 100644 --- a/mindspore-lite/tools/optimizer/fusion/ffn_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/ffn_fusion.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int kStructureNum = 2; @@ -311,4 +311,4 @@ AnfNodePtr FFNFusion::Process(const std::string &pattern_name, const mindspore:: return cnode; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/ffn_fusion.h b/mindspore-lite/tools/optimizer/fusion/ffn_fusion.h index 22175fa8d0f4e8997e908d3ecb8ff0f697ef5311..fb195358592caedd5910624cbe5c7e0d6f3cd1f8 100644 --- a/mindspore-lite/tools/optimizer/fusion/ffn_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/ffn_fusion.h @@ -23,7 +23,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { enum PatternType { kDynamicDims, @@ -69,6 +69,6 @@ class FFNFusion : public MultiplePatternProcessPass { mutable VarPtr matmul2_b_[kMaxPatternNum] = {nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_FFN_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/flash_attention_antiquant_fusion.cc b/mindspore-lite/tools/optimizer/fusion/flash_attention_antiquant_fusion.cc index c77bf63ab62005233d57211cde3b77aba0ddaf0d..8b4e3591274f8d022aa2de5a0525732e00ac47c5 100644 --- a/mindspore-lite/tools/optimizer/fusion/flash_attention_antiquant_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/flash_attention_antiquant_fusion.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_i.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace { constexpr size_t kFlashAttentionAntiquantScaleInputIndex = 11; } // namespace @@ -230,4 +230,4 @@ int FlashAttentionAntiquantFusion::Process(const FuncGraphPtr &func_graph, const return RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/flash_attention_antiquant_fusion.h b/mindspore-lite/tools/optimizer/fusion/flash_attention_antiquant_fusion.h index 6f5ed2f511193730963cc0f872871459a524941c..3812dc0e5f6db666411190998ff446b22179bb38 100644 --- a/mindspore-lite/tools/optimizer/fusion/flash_attention_antiquant_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/flash_attention_antiquant_fusion.h @@ -20,7 +20,7 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class FlashAttentionAntiquantFusion : public Pass { public: @@ -36,6 +36,6 @@ class FlashAttentionAntiquantFusion : public Pass { const ParameterPtr param_node_2, std::string name); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_FFN_ANTIQUANT_FUSION_H diff --git a/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion.cc b/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion.cc index d06afc0cdd6ea5ac5492e72adafcc0f2bdc8cdb5..c771530a5b37e859ec5c72566a5764045f8136c3 100644 --- a/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion.cc @@ -40,7 +40,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { static int kNameIndex = 0; constexpr auto kNameFlashAttentionPatternForMsSD21 = "FlashAttentionPatternForMsSD21"; @@ -3032,4 +3032,4 @@ AnfNodePtr FlashAttentionFusion::Process(const std::string &patten_name, const F << flash_attention_node->fullname_with_scope(); return flash_attention_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion.h b/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion.h index 6bf5696f50804bebf06a9bf5414559376423e053..13e20f0a570ed2757b2e9ffa9fac678394eee12b 100644 --- a/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion.h @@ -24,7 +24,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { struct FlashAttentionParm { string input_layout = "BNSD"; @@ -229,5 +229,5 @@ class FlashAttentionFusion : public MultiplePatternProcessPass { static std::string soc_version_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_FLASH_ATTENTION_BASE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion_for_custom.cc b/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion_for_custom.cc index fbcdb17bd4143dab701a94667edb349a5a655345..a7892438a1060421a0d050293ae09d0e2f41485a 100644 --- a/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion_for_custom.cc +++ b/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion_for_custom.cc @@ -34,7 +34,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kNumInputSize1 = 1; constexpr size_t kNumInputSize2 = 2; @@ -446,4 +446,4 @@ AnfNodePtr FlashAttentionFusionForCustom::Process(const std::string &patten_name MS_LOG(INFO) << "Flash attention fusion success."; return cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion_for_custom.h b/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion_for_custom.h index 1094c4e956429ccb8001c96ec149c92ba4a4b59a..ae6a7c31aae7bcbede81d93c43738c06f07647b9 100644 --- a/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion_for_custom.h +++ b/mindspore-lite/tools/optimizer/fusion/flash_attention_fusion_for_custom.h @@ -23,7 +23,7 @@ #include #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /* * @@ -84,5 +84,5 @@ class FlashAttentionFusionForCustom : public MultiplePatternProcessPass { std::map> disable_pattern_names_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_FLASH_ATTENTION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/flash_attention_tik_fusion.cc b/mindspore-lite/tools/optimizer/fusion/flash_attention_tik_fusion.cc index 634b7a89bf4a808924f530ffaa532764cac03c17..95287785d7d15e26280528628336ef887464dff5 100644 --- a/mindspore-lite/tools/optimizer/fusion/flash_attention_tik_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/flash_attention_tik_fusion.cc @@ -23,7 +23,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_p.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kInputIndex1 = 1; @@ -148,4 +148,4 @@ bool FlashAttentionTikPass::Run(const FuncGraphPtr &func_graph) { } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/flash_attention_tik_fusion.h b/mindspore-lite/tools/optimizer/fusion/flash_attention_tik_fusion.h index 1afc4eb20c785342f4275909c8af8c869956c00f..1199b7264b7ea9564f20305d0e890e9137bd2907 100644 --- a/mindspore-lite/tools/optimizer/fusion/flash_attention_tik_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/flash_attention_tik_fusion.h @@ -24,7 +24,7 @@ #include "tools/optimizer/common/format_utils.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class FlashAttentionTikPass : public Pass { public: @@ -33,6 +33,6 @@ class FlashAttentionTikPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_FATik_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/fullconnected_add_fusion.cc b/mindspore-lite/tools/optimizer/fusion/fullconnected_add_fusion.cc index 614be3ad4852265b321c20af21fd7ad1185fc402..fb21459888f31528ad392f222f231cc2bdfd854a 100644 --- a/mindspore-lite/tools/optimizer/fusion/fullconnected_add_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/fullconnected_add_fusion.cc @@ -29,7 +29,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_b.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_f.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { bool IsPrimitiveProper(const CNodePtr &add_cnode, const CNodePtr &fc_cnode, int index) { @@ -202,4 +202,4 @@ AnfNodePtr FullconnectedAddFusion::Process(const std::string &pattern_name, cons return nullptr; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/fullconnected_add_fusion.h b/mindspore-lite/tools/optimizer/fusion/fullconnected_add_fusion.h index 87abb014c36ebc58e0caa81779ab3111442c9f84..3f2d77aef3a0352068d0e44f06e48be4774e1cae 100644 --- a/mindspore-lite/tools/optimizer/fusion/fullconnected_add_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/fullconnected_add_fusion.h @@ -21,7 +21,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class FullconnectedAddFusion : public MultiplePatternProcessPass { public: explicit FullconnectedAddFusion(const std::string &name = "FullconnectedAddFusion", bool multigraph = true) @@ -35,5 +35,5 @@ class FullconnectedAddFusion : public MultiplePatternProcessPass { VectorRef DefineFcAddFusionPattern() const; VectorRef DefineFcBiasAddPattern() const; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_FULLCONNECTED_ADD_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/fullconnected_fusion.cc b/mindspore-lite/tools/optimizer/fusion/fullconnected_fusion.cc index e31920fcbb03f96c687447038a8df169782040dd..52e45c172a9e4c08a29bc605d104611923fe08c7 100644 --- a/mindspore-lite/tools/optimizer/fusion/fullconnected_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/fullconnected_fusion.cc @@ -27,7 +27,7 @@ #include "ops_utils/op_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_f.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kFcWeightIndex = 2; constexpr size_t kFcParameterDims = 2; @@ -284,4 +284,4 @@ const AnfNodePtr FullConnectedFusion::Process(const FuncGraphPtr &func_graph, co MS_LOG(INFO) << curr_cnode->fullname_with_scope() << " fusion success"; return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/fullconnected_fusion.h b/mindspore-lite/tools/optimizer/fusion/fullconnected_fusion.h index 29d52655a6cb11eb14435e99ea481e12c047cb2a..a49ad2ea94217df461ca001371f9da090b09aedf 100644 --- a/mindspore-lite/tools/optimizer/fusion/fullconnected_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/fullconnected_fusion.h @@ -22,7 +22,7 @@ #include "tools/optimizer/fusion/conv_transform_fusion.h" #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "schema/inner/model_generated.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class FullConnectedFusion : public LitePatternProcessPass { public: explicit FullConnectedFusion(bool multigraph = true) : LitePatternProcessPass("FullConnectedFusion", multigraph) {} @@ -30,5 +30,5 @@ class FullConnectedFusion : public LitePatternProcessPass { const BaseRef DefinePattern() const override; const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_FULLCONNECTED_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/gegluv2_fusion.cc b/mindspore-lite/tools/optimizer/fusion/gegluv2_fusion.cc index 7f7f93e3743f995a8c0172115201b328c53e95e2..bb965a727ddb7c80768acc70f52cea57265fb2b0 100644 --- a/mindspore-lite/tools/optimizer/fusion/gegluv2_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/gegluv2_fusion.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr auto kNameGeGluV2Pattern = "GeGluV2Pattern"; @@ -147,4 +147,4 @@ AnfNodePtr GeGluV2Fusion::Process(const std::string &patten_name, const FuncGrap return GeGluV2_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/gegluv2_fusion.h b/mindspore-lite/tools/optimizer/fusion/gegluv2_fusion.h index e962810bed7a5bfd8b58fd30c4a57dc35f6b3c56..a111479fa40125f649b1e324341ab0c9a2a55903 100644 --- a/mindspore-lite/tools/optimizer/fusion/gegluv2_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/gegluv2_fusion.h @@ -23,7 +23,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class GeGluV2Fusion : public MultiplePatternProcessPass { public: @@ -61,5 +61,5 @@ class GeGluV2Fusion : public MultiplePatternProcessPass { const VectorRef DefineGeGluV2Pattern() const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_GEGLUV2_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/gelu_fusion.cc b/mindspore-lite/tools/optimizer/fusion/gelu_fusion.cc index 92b0f7f78fd2dce7a07d687ebebfc8ef91492a1d..753cbc05911bf3f0d32dfdde038f651dd63b0b51 100644 --- a/mindspore-lite/tools/optimizer/fusion/gelu_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/gelu_fusion.cc @@ -23,7 +23,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { CNodePtr GeLUFusion::CreateGeLUNode(const FuncGraphPtr &func_graph, const AnfNodePtr &node, const EquivPtr &equiv) const { @@ -91,4 +91,4 @@ AnfNodePtr GeLUFusion::Process(const std::string &pattern_name, const mindspore: return cnode; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/gelu_fusion.h b/mindspore-lite/tools/optimizer/fusion/gelu_fusion.h index ae0ef979cfadee9f0dbf5f2615422c13a8ec935d..f248fd5f6f59e02eb7af7a98d40b52086aab4904 100644 --- a/mindspore-lite/tools/optimizer/fusion/gelu_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/gelu_fusion.h @@ -23,7 +23,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class GeLUFusion : public MultiplePatternProcessPass { public: @@ -46,6 +46,6 @@ class GeLUFusion : public MultiplePatternProcessPass { mutable bool approximate_{false}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_GELU_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/glu_fusion.cc b/mindspore-lite/tools/optimizer/fusion/glu_fusion.cc index 2e4dcddbc5d8d56395f303a2db69e3ad851b0d1a..3c9c1cd0bdcafb584dda05e82e5b4051056e9d83 100644 --- a/mindspore-lite/tools/optimizer/fusion/glu_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/glu_fusion.cc @@ -29,7 +29,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { CNodePtr GLUFusion::CreateGLUNode(const FuncGraphPtr &func_graph, const AnfNodePtr &node, const EquivPtr &equiv) const { MS_ASSERT(func_graph != nullptr && node != nullptr && equiv != nullptr); @@ -108,4 +108,4 @@ const AnfNodePtr GLUFusion::Process(const FuncGraphPtr &func_graph, const AnfNod return cnode; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/glu_fusion.h b/mindspore-lite/tools/optimizer/fusion/glu_fusion.h index 5e6a7e79bb8b05cd046ce6a453af58bdbed754ee..143ada0a72fe0afec0e5c3f09f95d30e4feb4b9b 100644 --- a/mindspore-lite/tools/optimizer/fusion/glu_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/glu_fusion.h @@ -22,7 +22,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class GLUFusion : public LitePatternProcessPass { public: @@ -44,6 +44,6 @@ class GLUFusion : public LitePatternProcessPass { mutable VarPtr split_prim_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_GLU_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/gnbmm_pass.cc b/mindspore-lite/tools/optimizer/fusion/gnbmm_pass.cc index 3beed8479b6bbd5097991559e43452b725db8863..002ae3874592ee41d51018a1bedd6336e3404913 100644 --- a/mindspore-lite/tools/optimizer/fusion/gnbmm_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/gnbmm_pass.cc @@ -29,7 +29,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr auto kNameGNBMMPatternForSDXL = "GNBMMPatternForSDXL"; @@ -309,4 +309,4 @@ AnfNodePtr GNBMMPass::Process(const std::string &patten_name, const FuncGraphPtr return gnbmm_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/gnbmm_pass.h b/mindspore-lite/tools/optimizer/fusion/gnbmm_pass.h index a5603d4c7cec7b8f9fbffa9e8f819819b706272d..0ebbb66e21a194a6a7bf61797876ff608d9604c3 100644 --- a/mindspore-lite/tools/optimizer/fusion/gnbmm_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/gnbmm_pass.h @@ -24,7 +24,7 @@ #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class GNBMMPass : public MultiplePatternProcessPass { @@ -44,5 +44,5 @@ class GNBMMPass : public MultiplePatternProcessPass { }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_GNBMM_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/gnsnz_pass.cc b/mindspore-lite/tools/optimizer/fusion/gnsnz_pass.cc index 86f4d8bb2142f5ea5beb8677d8d6d45a73909716..3357a3699fe309078bd9192b1318def653a8e15e 100644 --- a/mindspore-lite/tools/optimizer/fusion/gnsnz_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/gnsnz_pass.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr auto kNameGNSNZPatternForSD15 = "GNSNZPatternForSD15"; constexpr auto kNameGNSNZPatternForSD15WithoutSilu = "GNSNZPatternForSD15WithoutSilu"; @@ -301,4 +301,4 @@ AnfNodePtr GNSNZPass::Process(const std::string &patten_name, const FuncGraphPtr return groupnormsilu_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/gnsnz_pass.h b/mindspore-lite/tools/optimizer/fusion/gnsnz_pass.h index 0306df613e7a72da7ff83d98d0508c7ffcd39467..cc31fe3ebbde1fd269cb2a2c379532490e3ad991 100644 --- a/mindspore-lite/tools/optimizer/fusion/gnsnz_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/gnsnz_pass.h @@ -24,7 +24,7 @@ #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class GNSNZPass : public MultiplePatternProcessPass { public: @@ -38,5 +38,5 @@ class GNSNZPass : public MultiplePatternProcessPass { AnfNodePtr Process(const std::string &, const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_GNSNZ_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/graph_split_pass.cc b/mindspore-lite/tools/optimizer/fusion/graph_split_pass.cc index 6ac2cab14e5539ea8b01b5357e05eaa47b5511bf..38df133fb8d2eacd9f02344e4e716157829523e5 100644 --- a/mindspore-lite/tools/optimizer/fusion/graph_split_pass.cc +++ b/mindspore-lite/tools/optimizer/fusion/graph_split_pass.cc @@ -26,7 +26,7 @@ #include "infer/make_tuple.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kTargetNodeSize = 2; } @@ -690,4 +690,4 @@ bool GraphSplitPass::Run(const FuncGraphPtr &original_graph) { original_graph->set_attr("subgraphs", MakeValue>(subgraphs)); return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/graph_split_pass.h b/mindspore-lite/tools/optimizer/fusion/graph_split_pass.h index ceaca68abd7db9a5d089992d89605f86490f56f5..129dbfbc481bb6f1b424f59b64b0c2b32aa068f0 100644 --- a/mindspore-lite/tools/optimizer/fusion/graph_split_pass.h +++ b/mindspore-lite/tools/optimizer/fusion/graph_split_pass.h @@ -24,7 +24,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "tools/converter/cxx_api/converter_para.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class GraphSplitPass : public Pass { public: @@ -36,5 +36,5 @@ class GraphSplitPass : public Pass { std::shared_ptr param_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_GRAPH_SPLIT_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/groupnorm_fusion.cc b/mindspore-lite/tools/optimizer/fusion/groupnorm_fusion.cc index 295d33cb3291152ace458d19b5eba99aeff5f444..0c1e8fb8481dba55106adf4a9ad262581b42f425 100644 --- a/mindspore-lite/tools/optimizer/fusion/groupnorm_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/groupnorm_fusion.cc @@ -34,7 +34,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { STATUS GetAxis(const BaseRef &n, std::vector *axes) { @@ -336,4 +336,4 @@ const BaseRef GroupNormFusion::DefinePattern() const { return add2_ref; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/groupnorm_fusion.h b/mindspore-lite/tools/optimizer/fusion/groupnorm_fusion.h index 0b3db8bb5ee904d639518b1f80bddc81764526b9..8665618fae982f56b4d953ddf439f3890a63cb5d 100644 --- a/mindspore-lite/tools/optimizer/fusion/groupnorm_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/groupnorm_fusion.h @@ -25,7 +25,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /// fuse layer_norm or instance_norm into one operator class GroupNormFusion : public LitePatternProcessPass { @@ -58,6 +58,6 @@ class GroupNormFusion : public LitePatternProcessPass { mutable VarPtr real_div_divider_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_GROUPNORM_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/groupnormsilu_fusion.cc b/mindspore-lite/tools/optimizer/fusion/groupnormsilu_fusion.cc index 1e7fe1ccdec493f099e101f665d6625abace4f53..866fab90ad0112c177c7a341494e812c25875f6b 100644 --- a/mindspore-lite/tools/optimizer/fusion/groupnormsilu_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/groupnormsilu_fusion.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr auto kNameGroupNormSiluPatternForSD15 = "GroupNormSiluPatternForSD15"; constexpr auto kNameGroupNormSiluPatternForSDWithCast = "GroupNormSiluPatternForSDWithCast"; @@ -671,4 +671,4 @@ AnfNodePtr GroupNormSiluFusion::Process(const std::string &patten_name, const Fu MS_LOG(INFO) << "GroupNormSilu node fusion success, fusion node name: " << groupnormsilu_node->fullname_with_scope(); return groupnormsilu_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/groupnormsilu_fusion.h b/mindspore-lite/tools/optimizer/fusion/groupnormsilu_fusion.h index 0eb23c72e4afa31155681a5c67a3bc99b80747c7..e6065cd2e4ecffed5e1acec629867b6346fd3792 100644 --- a/mindspore-lite/tools/optimizer/fusion/groupnormsilu_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/groupnormsilu_fusion.h @@ -23,7 +23,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class GroupNormSiluFusion : public MultiplePatternProcessPass { public: @@ -100,5 +100,5 @@ class GroupNormSiluFusion : public MultiplePatternProcessPass { const VectorRef DefineGroupNormSiluPatternForGroupNorm() const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_GROUPNORMSILU_BASE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/hard_swish_fusion.cc b/mindspore-lite/tools/optimizer/fusion/hard_swish_fusion.cc index 6a7e7088d29ff2b9cf6538c13df9bf4b698023af..c997225a843bbe8fd9efc95f0207a6907de4443e 100644 --- a/mindspore-lite/tools/optimizer/fusion/hard_swish_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/hard_swish_fusion.cc @@ -23,7 +23,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_d.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr float kHSwishAddConst = 3.0; @@ -150,4 +150,4 @@ bool HardSwishFusion::CheckPattern(const EquivPtr &equiv) const { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/hard_swish_fusion.h b/mindspore-lite/tools/optimizer/fusion/hard_swish_fusion.h index d1d2d8e372a565eb445ec812cd43c5584c9d35f7..7789d66e16ffa315fa100d151817735d0f8ec257 100644 --- a/mindspore-lite/tools/optimizer/fusion/hard_swish_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/hard_swish_fusion.h @@ -23,7 +23,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /// fuse hard swish into one operator class HardSwishFusion : public LitePatternProcessPass { @@ -45,6 +45,6 @@ class HardSwishFusion : public LitePatternProcessPass { mutable VarPtr div_const_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_HARD_SWISH_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_assign_fusion.cc b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_assign_fusion.cc index 5a263e752f4a80525f7a3891ea95ede323206433..972f468e586aa4971bdcdaa7a280db52ec02242a 100644 --- a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_assign_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_assign_fusion.cc @@ -29,7 +29,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_k.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { int KVCacheMgrAssignFusion::RemoveAssignOp(const AnfNodePtr &anf_node, const FuncGraphManagerPtr &manager, const CNodePtr &kv_cache_cnode) { @@ -96,4 +96,4 @@ bool KVCacheMgrAssignFusion::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_assign_fusion.h b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_assign_fusion.h index 16812e994b5dd69dfb78ff03ae29c92a09fc1050..31d7b686190bf983460503dc9d6a812dc1e73138 100644 --- a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_assign_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_assign_fusion.h @@ -22,7 +22,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class KVCacheMgrAssignFusion : public Pass { public: @@ -37,5 +37,5 @@ class KVCacheMgrAssignFusion : public Pass { std::set remove_cnode_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_KV_CACHE_MGR_ASSIGN_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_concat_fusion.cc b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_concat_fusion.cc index 667eb0116987db665550494a4b78355b45378cc2..9cbab172444839e39399b4a4d88b02effe89843e 100644 --- a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_concat_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_concat_fusion.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_k.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { AnfNodePtr KVCacheMgrConcatFusion::GetBatchValidLength(CNodePtr concat_cnode) { auto make_tuple_node = concat_cnode->input(kInputIndexOne); @@ -86,4 +86,4 @@ bool KVCacheMgrConcatFusion::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_concat_fusion.h b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_concat_fusion.h index 86f976f40686bbbdf9354fe8711f5e558e24ba67..feef53249363610ba1936b76d76a85ca9d9c3ca8 100644 --- a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_concat_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_concat_fusion.h @@ -21,7 +21,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class KVCacheMgrConcatFusion : public Pass { public: @@ -33,5 +33,5 @@ class KVCacheMgrConcatFusion : public Pass { AnfNodePtr GetBatchValidLength(CNodePtr concat_cnode); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_KV_CACHE_MGR_CONCAT_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_load_fusion.cc b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_load_fusion.cc index 045a3df48868b41eaa6bea1cd3d60cd1b8837de4..6d487fbc6cc80dd235b6ed379d38a2ba3ab7e728 100644 --- a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_load_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_load_fusion.cc @@ -29,7 +29,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_l.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { int KVCacheMgrLoadFusion::RemoveLoadOp(const AnfNodePtr &anf_node, const FuncGraphManagerPtr &manager, const CNodePtr &kv_cache_cnode) { @@ -94,4 +94,4 @@ bool KVCacheMgrLoadFusion::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_load_fusion.h b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_load_fusion.h index 3c5909eee9676f4260a4e4e7190a6dbeab009e99..901d1ddbe8357ec5dbbf37bda01c15246ee162f2 100644 --- a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_load_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_load_fusion.h @@ -22,7 +22,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class KVCacheMgrLoadFusion : public Pass { public: @@ -37,5 +37,5 @@ class KVCacheMgrLoadFusion : public Pass { std::set remove_cnode_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_KV_CACHE_MGR_LOAD_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_one_branch_fusion.cc b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_one_branch_fusion.cc index a32107371b0664a32312708bd99fd052108bed67..0e6be98b42a63765f16cfc285058a82ebad02671 100644 --- a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_one_branch_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_one_branch_fusion.cc @@ -39,7 +39,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "ir/tensor_new.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef KVCacheMgrOneBranchFusion::DefinePattern() const { if (!InitVar()) { MS_LOG(ERROR) << "initial member failed."; @@ -180,4 +180,4 @@ const AnfNodePtr KVCacheMgrOneBranchFusion::Process(const FuncGraphPtr &func_gra return kv_cache_cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_one_branch_fusion.h b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_one_branch_fusion.h index 0520f0bdc0ff018a99909d7f3663e39d81f25213..7c57a84b0d5bb2bfcb8852b0a1c41ab784f6cd71 100644 --- a/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_one_branch_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/kv_cache_mgr_one_branch_fusion.h @@ -20,7 +20,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "schema/inner/model_generated.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class KVCacheMgrOneBranchFusion : public LitePatternProcessPass { public: @@ -41,6 +41,6 @@ class KVCacheMgrOneBranchFusion : public LitePatternProcessPass { mutable VarPtr input_2_key_past_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif diff --git a/mindspore-lite/tools/optimizer/fusion/leaky_relu_fusion.cc b/mindspore-lite/tools/optimizer/fusion/leaky_relu_fusion.cc index fedb5bf1531af6277766b39739045175b8e76a6c..e62c6934a19cd1bb01e5e6332cff586afb044d99 100644 --- a/mindspore-lite/tools/optimizer/fusion/leaky_relu_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/leaky_relu_fusion.cc @@ -27,7 +27,7 @@ #include "infer/leaky_relu.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kNumIndex1 = 1; constexpr size_t kNumIndex2 = 2; @@ -140,4 +140,4 @@ const AnfNodePtr LeakyReluFusion::Process(const FuncGraphPtr &func_graph, const return activate_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/leaky_relu_fusion.h b/mindspore-lite/tools/optimizer/fusion/leaky_relu_fusion.h index 8dfc70f8e7cb7df2cdf136f0ebbefdda23fbb276..1b1b53fef514a0fa2b5bb3032655529819a720ab 100644 --- a/mindspore-lite/tools/optimizer/fusion/leaky_relu_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/leaky_relu_fusion.h @@ -19,7 +19,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class LeakyReluFusion : public LitePatternProcessPass { public: explicit LeakyReluFusion(bool multigraph = true, const std::string &name = "LeakyReluFusion") @@ -30,6 +30,6 @@ class LeakyReluFusion : public LitePatternProcessPass { const BaseRef DefinePattern() const override; const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/matmul_activation_fusion.cc index 918b634e1ee14d1089e20732f4338908fb671e77..3dfbbfd21c8497aa435ddb4cdb61a13454939810 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/matmul_activation_fusion.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef MatMulActivationFusion::DefinePattern() const { auto is_matmul = std::make_shared(IsSpecifiedNode<&prim::kPrimMatMulFusion>); MS_CHECK_TRUE_RET(is_matmul != nullptr, {}); @@ -91,4 +91,4 @@ const AnfNodePtr MatMulActivationFusion::Process(const FuncGraphPtr &func_graph, manage->Replace(act_cnode, matmul_cnode); return matmul_cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/matmul_activation_fusion.h index d14b170b65706b28f734ae202629c6d2699ead76..f31952a922ad999491eaaee293af7838238fd7ee 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/matmul_activation_fusion.h @@ -23,7 +23,7 @@ #include "tools/converter/converter_context.h" #include "tools/converter/cxx_api/converter_para.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class MatMulActivationFusion : public LitePatternProcessPass { public: @@ -37,5 +37,5 @@ class MatMulActivationFusion : public LitePatternProcessPass { const std::shared_ptr param_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_MATMUL_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_add_fusion.cc b/mindspore-lite/tools/optimizer/fusion/matmul_add_fusion.cc index bd404bec7686f002ced88b0ab60801e419e0adf8..f8ffe928a713f377945558821d3ac4c8f17c7afe 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_add_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/matmul_add_fusion.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { bool IsPrimitiveProper(const CNodePtr &add_cnode, const CNodePtr &matmul_cnode, int index) { @@ -183,4 +183,4 @@ bool MatMulAddFusion::Run(const FuncGraphPtr &func_graph) { return false; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_add_fusion.h b/mindspore-lite/tools/optimizer/fusion/matmul_add_fusion.h index ce875bd007434ede4f80e9d1cef54d744a044e55..d868977aa87fc3be5a42009c400fab5b2b81cf29 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_add_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/matmul_add_fusion.h @@ -21,7 +21,7 @@ #include #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class MatMulAddFusion : public Pass { public: @@ -30,5 +30,5 @@ class MatMulAddFusion : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_MATMUL_ADD_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_allreduce_fusion.cc b/mindspore-lite/tools/optimizer/fusion/matmul_allreduce_fusion.cc index 44bd688265fb2b0e20e1b42fc7e9c17699aafdf5..0ab01fef7b7cb91ea14d649220e32c8710fc0e1e 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_allreduce_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/matmul_allreduce_fusion.cc @@ -35,7 +35,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_q.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { std::unordered_map MatMulAllReduceFusion::DefinePatterns() const { std::unordered_map patterns; patterns[kPatternNameMatMulAllReduce] = DefineMatMulAllReducePattern(); @@ -410,4 +410,4 @@ AnfNodePtr MatMulAllReduceFusion::Process(const std::string &pattern_name, const MS_LOG(DEBUG) << "MatMulAllReduce replace success"; return matmul_allreduce_cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_allreduce_fusion.h b/mindspore-lite/tools/optimizer/fusion/matmul_allreduce_fusion.h index 9394d35fffc4665ee1ada868618369129c6643ac..10bbb408fee73d936c4ebddf979661871c37b5ed 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_allreduce_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/matmul_allreduce_fusion.h @@ -22,7 +22,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class MatMulAllReduceFusion : public MultiplePatternProcessPass { public: @@ -57,5 +57,5 @@ class MatMulAllReduceFusion : public MultiplePatternProcessPass { const std::string kAttrNameTransposeB = "transpose_b"; const std::string kAttrNameNeedFusedXoffsetToBias = "need_fused_x_offset_to_bias"; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_MATMUL_ALLREDUCE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_mul_fusion.cc b/mindspore-lite/tools/optimizer/fusion/matmul_mul_fusion.cc index 78cc55c3740d9d2c0abb379c862defb4c1a300dc..08633b05b64f417ce61c5e44381f5f034f7f2717 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_mul_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/matmul_mul_fusion.cc @@ -26,7 +26,7 @@ #include "ops_utils/op_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr int64_t KMatmulWeightDims = 2; constexpr size_t kMatMulNonBatchDims = 2; @@ -245,4 +245,4 @@ const AnfNodePtr MatMulMulFusion::Process(const FuncGraphPtr &func_graph, const (void)manager->Replace(mul_cnode, mul_cnode->input(1)); return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_mul_fusion.h b/mindspore-lite/tools/optimizer/fusion/matmul_mul_fusion.h index 3b43b8f4db9289aa13551bc8c02ecead67dad5bb..afa618797c3ce8f4623ddf7dbf355f06a90ada8e 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_mul_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/matmul_mul_fusion.h @@ -20,7 +20,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class MatMulMulFusion : public LitePatternProcessPass { public: explicit MatMulMulFusion(bool multigraph = true, const std::string &name = "MatMulMulFusion") @@ -29,5 +29,5 @@ class MatMulMulFusion : public LitePatternProcessPass { const BaseRef DefinePattern() const override; const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_MATMUL_MUL_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_scale_fusion.cc b/mindspore-lite/tools/optimizer/fusion/matmul_scale_fusion.cc index 1f5ea6034f23f2ea46c32739e4381b1b83f26f24..7d8c5d4339d40e472dde44765d27b88fcd7f9302 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_scale_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/matmul_scale_fusion.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kMatMulNonBatchDims = 2; } // namespace @@ -121,4 +121,4 @@ const BaseRef MatMulScaleFusion::DefinePattern() const { MS_CHECK_TRUE_RET(is_seq_var != nullptr, {}); return VectorRef({is_scale, is_fc, is_param, is_seq_var}); } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/matmul_scale_fusion.h b/mindspore-lite/tools/optimizer/fusion/matmul_scale_fusion.h index 879555f8b96a22135f96b6d245791761fe46817d..6b1b780eba96bfe8f7236b7fa2225a95b5e0773b 100644 --- a/mindspore-lite/tools/optimizer/fusion/matmul_scale_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/matmul_scale_fusion.h @@ -24,7 +24,7 @@ #include "tools/optimizer/fusion/scale_base_fusion.h" #include "mindspore/ops/op_def/auto_generate/gen_lite_ops.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class MatMulScaleFusion : public ScaleBaseFusion { public: explicit MatMulScaleFusion(bool multigraph = true) : ScaleBaseFusion("MatMulScaleFusion", multigraph) {} @@ -39,5 +39,5 @@ class MatMulScaleFusion : public ScaleBaseFusion { int CalNewScaleImpl(float *curr_weight_data, std::vector prev_weight_shape, float *prev_weight_data, const AnfNodePtr &prim) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_MATMUL_SCALE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/mul_activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/mul_activation_fusion.cc index b10a258758dc0103a9b250daa5cd515306b06366..915317fb1c8676e88ebba0e753598fa8359c57d1 100644 --- a/mindspore-lite/tools/optimizer/fusion/mul_activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/mul_activation_fusion.cc @@ -25,7 +25,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef MulActivationFusion::DefinePattern() const { auto is_act = std::make_shared(IsSpecifiedNode<&prim::kPrimActivation>); MS_CHECK_TRUE_RET(is_act != nullptr, {}); @@ -85,4 +85,4 @@ const AnfNodePtr MulActivationFusion::Process(const FuncGraphPtr &func_graph, co (void)manager->Replace(act_cnode, mul_node); return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/mul_activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/mul_activation_fusion.h index 487e30b3fa49c250314bc48c7b33eb30024b70e0..c6d5dacf2379e4427a2106d8650c3458511f1476 100644 --- a/mindspore-lite/tools/optimizer/fusion/mul_activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/mul_activation_fusion.h @@ -20,7 +20,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class MulActivationFusion : public LitePatternProcessPass { public: explicit MulActivationFusion(bool multigraph = true, const std::string &name = "MulActivationFusion") @@ -31,5 +31,5 @@ class MulActivationFusion : public LitePatternProcessPass { const BaseRef DefinePattern() const override; const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_MUL_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/mul_add_fusion.cc b/mindspore-lite/tools/optimizer/fusion/mul_add_fusion.cc index 68d334b487c07300deac5088bb092c5984aca575..a332145e5c8cf4199b02d8834665c37e9c26f1db 100644 --- a/mindspore-lite/tools/optimizer/fusion/mul_add_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/mul_add_fusion.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { VectorRef MulAddFusion::DefineMulFirstPattern() const { auto is_mul = std::make_shared(IsSpecifiedNode<&prim::kPrimMulFusion>); MS_CHECK_TRUE_RET(is_mul != nullptr, {}); @@ -303,4 +303,4 @@ AnfNodePtr MulAddFusion::Process(const std::string &pattern_name, const mindspor scale_node->set_abstract(add_cnode->abstract()); return scale_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/mul_add_fusion.h b/mindspore-lite/tools/optimizer/fusion/mul_add_fusion.h index 21e1a2fca1415cf1ff46ec25280eae254c9d0044..9d848f90dd91827981bc8ce8c445226aa2a72a67 100644 --- a/mindspore-lite/tools/optimizer/fusion/mul_add_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/mul_add_fusion.h @@ -26,7 +26,7 @@ #include "infer/cxx_api/scale_fusion.h" #include "utils/check_convert_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class MulAddFusion : public MultiplePatternProcessPass { public: @@ -59,5 +59,5 @@ class MulAddFusion : public MultiplePatternProcessPass { mutable ActivationType scale_act_type_ = ActivationType::NO_ACTIVATION; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_PASS_FUSION_CONV_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/mul_reduce_fusion.cc b/mindspore-lite/tools/optimizer/fusion/mul_reduce_fusion.cc index bc1025b2884791940aa9b49abe5503557e17d78b..0e9247db2b6ff8f2c912121fa39d4300d89b0e2a 100644 --- a/mindspore-lite/tools/optimizer/fusion/mul_reduce_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/mul_reduce_fusion.cc @@ -35,7 +35,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int kReciprocalFirstIndex = -1; @@ -493,4 +493,4 @@ bool MulReduceFusion::CheckConcatOp(const FuncGraphPtr &func_graph, const CNodeP return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/mul_reduce_fusion.h b/mindspore-lite/tools/optimizer/fusion/mul_reduce_fusion.h index a2842fc126c26f58bdd3ba7d5062fc1c428d27c7..5a8c5f39c4f63467bddc38a14ea58e422c620df7 100644 --- a/mindspore-lite/tools/optimizer/fusion/mul_reduce_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/mul_reduce_fusion.h @@ -23,7 +23,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/graph/preprocess_dynamic_shape.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class MulReduceFusion : public Pass { public: @@ -58,5 +58,5 @@ class MulReduceFusion : public Pass { squeeze_infos_; // record generated-squeeze(>) which is used to post-fusion. }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_MUL_REDUCE_FUSION_H diff --git a/mindspore-lite/tools/optimizer/fusion/multi_head_attention_fusion.cc b/mindspore-lite/tools/optimizer/fusion/multi_head_attention_fusion.cc index cebc52eef0c6eceeaf4fdb1e52669c5324b285fd..a44434910e8ac26e199e6d9554c813499a45213f 100644 --- a/mindspore-lite/tools/optimizer/fusion/multi_head_attention_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/multi_head_attention_fusion.cc @@ -44,7 +44,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "ir/tensor_new.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { const auto &p1 = std::placeholders::_1; const size_t kWeightShapeSize = 2; @@ -1102,4 +1102,4 @@ CNodePtr MultiHeadAttentionFusion::CreateMaskedMultiHeadAttentionNode(const Func (void)RemoveRedundantInput(func_graph, redundant); return ret_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/multi_head_attention_fusion.h b/mindspore-lite/tools/optimizer/fusion/multi_head_attention_fusion.h index e467d9178511d107fdbf10a5c23cddfc3bcd3305..2af366d8252a0d1ee4ae1ea3e9687b49068e8201 100644 --- a/mindspore-lite/tools/optimizer/fusion/multi_head_attention_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/multi_head_attention_fusion.h @@ -26,7 +26,7 @@ #include "include/errorcode.h" #include "infer/attention.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class MultiHeadAttentionFusion : public MultiplePatternProcessPass { public: @@ -130,5 +130,5 @@ class MultiHeadAttentionFusion : public MultiplePatternProcessPass { mutable float scale_{true}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_MULTI_HEAD_ATTENTION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/norm_fusion.cc b/mindspore-lite/tools/optimizer/fusion/norm_fusion.cc index b4ab07f0761ba0b25c351e445881b335bdc3615a..ab0e48a448bb3154361e0d983c2dd1665ab25e6d 100644 --- a/mindspore-lite/tools/optimizer/fusion/norm_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/norm_fusion.cc @@ -38,7 +38,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { STATUS GetReduceAxes(const BaseRef &n, std::vector *axes) { @@ -648,4 +648,4 @@ const BaseRef OnnxLayerNormFusion2::DefinePattern() const { return add2_ref; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/norm_fusion.h b/mindspore-lite/tools/optimizer/fusion/norm_fusion.h index 5f0cdd5800e65043b257adac5bbce68076972f1b..aa644c3e0bb33b4f7d3a5d5ec2989baf3d9395a6 100644 --- a/mindspore-lite/tools/optimizer/fusion/norm_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/norm_fusion.h @@ -26,7 +26,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /// fuse layer_norm or instance_norm into one operator @@ -106,6 +106,6 @@ class OnnxLayerNormFusion2 : public NormFusion { const BaseRef DefinePattern() const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_NORM_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/onnx_gelu_fusion.cc b/mindspore-lite/tools/optimizer/fusion/onnx_gelu_fusion.cc index 9a78a2f2d48347ee40f86330cc66e349e5965098..b842cfaf4b48255ffd68d828545b862c12295d43 100644 --- a/mindspore-lite/tools/optimizer/fusion/onnx_gelu_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/onnx_gelu_fusion.cc @@ -25,7 +25,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_e.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int kStructureNum = 2; @@ -127,4 +127,4 @@ bool OnnxGeLUFusion::CheckPattern(const std::string &pattern_name, const EquivPt return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/onnx_gelu_fusion.h b/mindspore-lite/tools/optimizer/fusion/onnx_gelu_fusion.h index 69b815c781d0fe29abdb0aa5ac0fa58bdee7f0b8..394aa2955184f7aa2e125aaad15ac5b0ad771140 100644 --- a/mindspore-lite/tools/optimizer/fusion/onnx_gelu_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/onnx_gelu_fusion.h @@ -23,7 +23,7 @@ #include #include "tools/optimizer/fusion/gelu_fusion.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class OnnxGeLUFusion : public GeLUFusion { public: @@ -47,6 +47,6 @@ class OnnxGeLUFusion : public GeLUFusion { mutable std::vector mul1_y_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_ONNX_GELU_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/prelu_fusion.cc b/mindspore-lite/tools/optimizer/fusion/prelu_fusion.cc index 594023da49d642e43b7dfdd4c1f9c14537f0c773..315a00b3f095060c510d30c62eb3431c8ab03121 100644 --- a/mindspore-lite/tools/optimizer/fusion/prelu_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/prelu_fusion.cc @@ -21,7 +21,7 @@ #include "infer/cxx_api/prelu_fusion.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool PReluFusion::Init() const { input_ = std::make_shared(); @@ -126,4 +126,4 @@ bool PReluFusion::CheckPattern(const EquivPtr &equiv, std::vector *slope) return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/prelu_fusion.h b/mindspore-lite/tools/optimizer/fusion/prelu_fusion.h index 9b19f671aea57a61c22af5cc7d2f20ad36c4192a..2be3202f4ef42a51986460521bf82b5dd13de036 100644 --- a/mindspore-lite/tools/optimizer/fusion/prelu_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/prelu_fusion.h @@ -25,7 +25,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class PReluFusion : public LitePatternProcessPass { public: @@ -45,6 +45,6 @@ class PReluFusion : public LitePatternProcessPass { mutable VarPtr mul_const_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_PRELU_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/quant_dtype_cast_fusion.cc b/mindspore-lite/tools/optimizer/fusion/quant_dtype_cast_fusion.cc index f8ce59dfe651b00cddb752654d1fcc1d9a36822a..894c5513218e044ec2b3a73228b2c359e25ceb90 100644 --- a/mindspore-lite/tools/optimizer/fusion/quant_dtype_cast_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/quant_dtype_cast_fusion.cc @@ -19,7 +19,7 @@ #include "nnacl_c/op_base.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_q.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { const BaseRef QuantDtypeCastFusion::DefinePattern() const { input_ = std::make_shared(); @@ -94,4 +94,4 @@ bool QuantDtypeCastFusion::CheckPattern(const EquivPtr &equiv, const AnfNodePtr return check_dtype_matched; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/quant_dtype_cast_fusion.h b/mindspore-lite/tools/optimizer/fusion/quant_dtype_cast_fusion.h index 146c42674fecf8d66c0d99358cc48ce2f054f5e4..6dd575468ba995c3a20da345355d455f1d67faec 100644 --- a/mindspore-lite/tools/optimizer/fusion/quant_dtype_cast_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/quant_dtype_cast_fusion.h @@ -25,7 +25,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class QuantDtypeCastFusion : public LitePatternProcessPass { public: @@ -43,5 +43,5 @@ class QuantDtypeCastFusion : public LitePatternProcessPass { mutable VarPtr input_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_QUANT_DTYPE_CAST_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/reduce_same_op_in_horizon.cc b/mindspore-lite/tools/optimizer/fusion/reduce_same_op_in_horizon.cc index ac6d30f7ef1f7e257ec549a7f73be4f02838dfe3..0d0e1f6f01b194b83240305b105da06d4d70bca7 100644 --- a/mindspore-lite/tools/optimizer/fusion/reduce_same_op_in_horizon.cc +++ b/mindspore-lite/tools/optimizer/fusion/reduce_same_op_in_horizon.cc @@ -26,7 +26,7 @@ #include "include/errorcode.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { bool CheckValueIsEqual(const ValuePtr &left, const ValuePtr &right) { @@ -174,4 +174,4 @@ bool ReduceSameOpInHorizon::Run(const FuncGraphPtr &func_graph) { return status == lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/reduce_same_op_in_horizon.h b/mindspore-lite/tools/optimizer/fusion/reduce_same_op_in_horizon.h index cce01387c62dbf4f45163b37e0443a7ef60167cd..ef508548eab1cad432a7195bcd582438cada419f 100644 --- a/mindspore-lite/tools/optimizer/fusion/reduce_same_op_in_horizon.h +++ b/mindspore-lite/tools/optimizer/fusion/reduce_same_op_in_horizon.h @@ -22,7 +22,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/converter/cxx_api/converter_para.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { using ConverterParaPtr = std::shared_ptr; class ReduceSameOpInHorizon : public Pass { @@ -37,6 +37,6 @@ class ReduceSameOpInHorizon : public Pass { ConverterParaPtr param_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_REDUCE_SAME_OP_IN_HORIZON_H diff --git a/mindspore-lite/tools/optimizer/fusion/reduce_stack_fusion.cc b/mindspore-lite/tools/optimizer/fusion/reduce_stack_fusion.cc index 543e865b9ba77e045927dd3b294e13a7f83550c8..c34a2fd094ceb02b485c0b79b2ff6d91ed8d1b85 100644 --- a/mindspore-lite/tools/optimizer/fusion/reduce_stack_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/reduce_stack_fusion.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool ReduceStackFusion::Run(const FuncGraphPtr &func_graph) { if (func_graph == nullptr) { @@ -125,4 +125,4 @@ bool ReduceStackFusion::CheckReduce(const FuncGraphPtr &func_graph, const CNodeP return *(static_cast(data_info.data_ptr_)) == stack_axis; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/reduce_stack_fusion.h b/mindspore-lite/tools/optimizer/fusion/reduce_stack_fusion.h index e94ab65359c54bcfb28ecf67c1ae42442a1290bf..fa028142a3bdfb9b027e1c15d252c00b06d248f5 100644 --- a/mindspore-lite/tools/optimizer/fusion/reduce_stack_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/reduce_stack_fusion.h @@ -20,7 +20,7 @@ #include "ir/anf.h" #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ReduceStackFusion : public Pass { public: @@ -35,5 +35,5 @@ class ReduceStackFusion : public Pass { PrimitivePtr reduce_prim_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_REDUCE_STACK_FUSION_H diff --git a/mindspore-lite/tools/optimizer/fusion/remove_transitivity_op.cc b/mindspore-lite/tools/optimizer/fusion/remove_transitivity_op.cc index d46b1dbf83e804153ea7ced827ae9786a90722db..e6526e5354616f1981932b7b434e716f39e3483a 100644 --- a/mindspore-lite/tools/optimizer/fusion/remove_transitivity_op.cc +++ b/mindspore-lite/tools/optimizer/fusion/remove_transitivity_op.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool RemoveTransitivityOp::Run(const FuncGraphPtr &func_graph) { if (func_graph == nullptr) { @@ -159,4 +159,4 @@ int RemoveTransitivityOp::DoReplace(const FuncGraphPtr &func_graph, const CNodeP return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/remove_transitivity_op.h b/mindspore-lite/tools/optimizer/fusion/remove_transitivity_op.h index 344eb4138440f7cf8dc1e13f73c6ed1bc5cca017..b59a088b88154358e131fb0dcd4cd13a5c7bcb95 100644 --- a/mindspore-lite/tools/optimizer/fusion/remove_transitivity_op.h +++ b/mindspore-lite/tools/optimizer/fusion/remove_transitivity_op.h @@ -20,7 +20,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/graph/preprocess_dynamic_shape.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { // remove the op whose output is equal to its input. class RemoveTransitivityOp : public Pass { @@ -37,5 +37,5 @@ class RemoveTransitivityOp : public Pass { DynamicShapePreprocessor preprocessor_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_REMOVE_TRANSITIVITY_OP_H diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_like_operator_ablation.cc b/mindspore-lite/tools/optimizer/fusion/reshape_like_operator_ablation.cc index 1d43dc26739afa2d2d9391732bf78d72f1a53312..c1140e96c40f9c47513920e7a2de4587d0480a59 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_like_operator_ablation.cc +++ b/mindspore-lite/tools/optimizer/fusion/reshape_like_operator_ablation.cc @@ -25,7 +25,7 @@ #include "mindspore/core/include/ir/graph_utils.h" #include "mindspore/core/include/ir/primitive.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { const std::set kReshapeLikeOp = {"Reshape", "Squeeze", "Unsqueeze", "ExpandDims"}; @@ -118,4 +118,4 @@ int AblateReshapeLikeOp::DoAblation(const FuncGraphPtr &func_graph, const CNodeP return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_like_operator_ablation.h b/mindspore-lite/tools/optimizer/fusion/reshape_like_operator_ablation.h index 6f3ca8577f0cfaf2a33886b1563578b62f1c8513..395724e62a413bb5f120a9d684d7d3ee5383a2b4 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_like_operator_ablation.h +++ b/mindspore-lite/tools/optimizer/fusion/reshape_like_operator_ablation.h @@ -21,7 +21,7 @@ #include "tools/optimizer/graph/preprocess_dynamic_shape.h" #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /* * If a link whose output-data is equal to its input-data, then the link may be ablated in some cases. @@ -44,5 +44,5 @@ class AblateReshapeLikeOp : public Pass { DynamicShapePreprocessor preprocessor_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_RESHAPE_LIKE_OPERATOR_ABLATION_H diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_reduce_fusion.cc b/mindspore-lite/tools/optimizer/fusion/reshape_reduce_fusion.cc index 4a80bea330416d6f06049d5fb3638c365330a55b..7b2591cce1d4e00c199321eb0c837bf83d1b5133 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_reduce_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/reshape_reduce_fusion.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool CheckIsClosedCycle(const FuncGraphPtr &func_graph, const CNodePtr &in_node, const CNodePtr &out_node) { std::set ops{in_node}; @@ -276,4 +276,4 @@ void ReshapeReduceFusion::FuseReduceWithReshape(const FuncGraphPtr &func_graph, (void)manager->Replace(reshape_, reduce); } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_reduce_fusion.h b/mindspore-lite/tools/optimizer/fusion/reshape_reduce_fusion.h index 58f351c3753783063cf0115bc5c7452543db8fbb..980da5614d13aacbeffc312d0ed222d4e40f511f 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_reduce_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/reshape_reduce_fusion.h @@ -23,7 +23,7 @@ #include "utils/check_convert_utils.h" #include "tools/optimizer/graph/preprocess_dynamic_shape.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ReshapeReduceFusion : public Pass { public: @@ -45,5 +45,5 @@ class ReshapeReduceFusion : public Pass { DynamicShapePreprocessor preprocessor_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_RESHAPE_REDUCE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_reshape_fusion.cc b/mindspore-lite/tools/optimizer/fusion/reshape_reshape_fusion.cc index 7cf375e69061b1637375d91a365acda513fd1fe7..7d8ac4c48ebf046998e7ee31edc1eb8cd7ca4623 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_reshape_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/reshape_reshape_fusion.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_u.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { const auto &p1 = std::placeholders::_1; const auto kPreReshapePattern = "PreReshapePatternName"; @@ -211,4 +211,4 @@ AnfNodePtr ReshapeReshapeFusion::Process(const std::string &pattern_name, const new_reshape->set_fullname_with_scope(cnode->fullname_with_scope()); return new_reshape; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_reshape_fusion.h b/mindspore-lite/tools/optimizer/fusion/reshape_reshape_fusion.h index 1e322c1db7816f078345dee65f0fb52cefa50a32..997de12d8802dfb7e16f67ef0f907cc92dc9eb4a 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_reshape_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/reshape_reshape_fusion.h @@ -23,7 +23,7 @@ #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "utils/check_convert_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ReshapeReshapeFusion : public MultiplePatternProcessPass { public: @@ -40,5 +40,5 @@ class ReshapeReshapeFusion : public MultiplePatternProcessPass { VectorRef DefineReshapeReshapePattern() const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_RESHAPE_RESHAPE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_shape_fusion.cc b/mindspore-lite/tools/optimizer/fusion/reshape_shape_fusion.cc index d98401cc9ab05c2c428f85aa7188a91b4c63c3c1..7bb0cede60775be314e5e7ed3b8cca81efd5e770 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_shape_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/reshape_shape_fusion.cc @@ -24,7 +24,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool ReshapeShapeFusion::Run(const FuncGraphPtr &func_graph) { if (func_graph == nullptr) { @@ -89,4 +89,4 @@ int ReshapeShapeFusion::Process(const FuncGraphPtr &func_graph, const CNodePtr & return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_shape_fusion.h b/mindspore-lite/tools/optimizer/fusion/reshape_shape_fusion.h index cf0dafcbd186d755c316472905bc8a4b6dc2ff8b..9a29ca183d70be671701973955df88f3918fe944 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_shape_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/reshape_shape_fusion.h @@ -19,7 +19,7 @@ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /* * The subgraph such as the following. @@ -39,6 +39,6 @@ class ReshapeShapeFusion : public Pass { int Process(const FuncGraphPtr &func_graph, const CNodePtr &reshape); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_RESHAPE_SHAPE_FUSION_H diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_transpose_fusion.cc b/mindspore-lite/tools/optimizer/fusion/reshape_transpose_fusion.cc index 87e4c45dbc5cf5aeae6ca343c40ae315fbe43007..76f1f52655ead7b42c006fe21d909e8fc207af82 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_transpose_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/reshape_transpose_fusion.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { const auto &p1 = std::placeholders::_1; } // namespace @@ -453,4 +453,4 @@ AnfNodePtr ReshapeTransposeFusion::Process(const std::string &pattern_name, cons return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/reshape_transpose_fusion.h b/mindspore-lite/tools/optimizer/fusion/reshape_transpose_fusion.h index aa8f82bcc7d2661429b777f8302162c5337ae134..6f004ae7aa72f9a567ee21e61704f9549e199302 100644 --- a/mindspore-lite/tools/optimizer/fusion/reshape_transpose_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/reshape_transpose_fusion.h @@ -24,7 +24,7 @@ #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "utils/check_convert_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ReshapeTransposeFusion : public MultiplePatternProcessPass { public: @@ -44,5 +44,5 @@ class ReshapeTransposeFusion : public MultiplePatternProcessPass { const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_RESHAPE_TRANSPOSE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/resize_fusion.cc b/mindspore-lite/tools/optimizer/fusion/resize_fusion.cc index 1755f1e7cd7a18fd7c439ff01c364f1c75e5a344..cfd77f06cadeadf27d2e2e788e9aa9a250f284e1 100644 --- a/mindspore-lite/tools/optimizer/fusion/resize_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/resize_fusion.cc @@ -37,7 +37,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef ResizeFusion1::DefinePattern() const { input_ = std::make_shared(); MS_CHECK_TRUE_RET(input_ != nullptr, false); @@ -267,4 +267,4 @@ const AnfNodePtr ResizeFusion::Process(const FuncGraphPtr &func_graph, const Anf } return node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/resize_fusion.h b/mindspore-lite/tools/optimizer/fusion/resize_fusion.h index cfd75b0240a718aa7809ba5da3ddbbec025dee3a..e7b9afdbc0ae89c11a8b6f04c7e6c5923c0cfd5b 100644 --- a/mindspore-lite/tools/optimizer/fusion/resize_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/resize_fusion.h @@ -20,7 +20,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "tools/converter/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ResizeFusion : public LitePatternProcessPass { public: @@ -56,5 +56,5 @@ class ResizeFusion2 : public ResizeFusion { mutable VarPtr input_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_RESIZE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/scale_activation_fusion.cc b/mindspore-lite/tools/optimizer/fusion/scale_activation_fusion.cc index 543cdfc5440bf7de981f1a358f80318faa5dc8f2..e5840853cec2af6ab4f744b3c51eb3500de0d742 100644 --- a/mindspore-lite/tools/optimizer/fusion/scale_activation_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/scale_activation_fusion.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef ScaleActivationFusion::DefinePattern() const { auto is_scale = std::make_shared(IsSpecifiedNode<&prim::kPrimScaleFusion>); MS_CHECK_TRUE_RET(is_scale != nullptr, {}); @@ -75,4 +75,4 @@ const AnfNodePtr ScaleActivationFusion::Process(const FuncGraphPtr &func_graph, (void)scale_prim_c->AddAttr(ops::kActivationType, MakeValue(static_cast(act_type))); return scale_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/scale_activation_fusion.h b/mindspore-lite/tools/optimizer/fusion/scale_activation_fusion.h index b6305277f6b2a373ee0a44c1e0a653dccba3afa4..815fe65d5060e9f836b218b42f6622f3dd00fdac 100644 --- a/mindspore-lite/tools/optimizer/fusion/scale_activation_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/scale_activation_fusion.h @@ -20,7 +20,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ScaleActivationFusion : public LitePatternProcessPass { public: @@ -31,5 +31,5 @@ class ScaleActivationFusion : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_SCALE_ACTIVATION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/scale_base_fusion.cc b/mindspore-lite/tools/optimizer/fusion/scale_base_fusion.cc index 214424bf9968018e13b829b07baa1004a96081f9..3eefba02067bbe3dfe947b4ad3388f5025d2d2a4 100644 --- a/mindspore-lite/tools/optimizer/fusion/scale_base_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/scale_base_fusion.cc @@ -25,7 +25,7 @@ #include "ops_utils/op_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { int ScaleBaseFusion::CalNewCnodeScale(const CNodePtr &curr_cnode, const std::vector &fusion_cnode_inputs) const { auto curr_weight_node = curr_cnode->input(kInputIndexTwo); @@ -245,4 +245,4 @@ const AnfNodePtr ScaleBaseFusion::Process(const FuncGraphPtr &func_graph, const MS_LOG(INFO) << curr_cnode->fullname_with_scope() << " fusion success"; return fusion_cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/scale_base_fusion.h b/mindspore-lite/tools/optimizer/fusion/scale_base_fusion.h index c7ecc2573d29797aab8ae14b76471b92c1558b28..c8c39836c544e1e45fec933a02461b2130f7a7cf 100644 --- a/mindspore-lite/tools/optimizer/fusion/scale_base_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/scale_base_fusion.h @@ -24,7 +24,7 @@ #include "infer/cxx_api/scale_fusion.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ScaleBaseFusion : public LitePatternProcessPass { public: explicit ScaleBaseFusion(std::string name, bool multigraph = true) : LitePatternProcessPass(name, multigraph) {} @@ -45,5 +45,5 @@ class ScaleBaseFusion : public LitePatternProcessPass { virtual int CalNewScaleImpl(float *curr_weight_data, std::vector prev_weight_shape, float *prev_weight_data, const AnfNodePtr &prim) const = 0; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_SRC_PASS_FUSION_SCALE_BASE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/scale_scale_fusion.cc b/mindspore-lite/tools/optimizer/fusion/scale_scale_fusion.cc index ff537a4c8490b0a0be0853edc8b115a10eb825ce..00a7211f81be5f3f4637e5e077773f59ccfd60e4 100644 --- a/mindspore-lite/tools/optimizer/fusion/scale_scale_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/scale_scale_fusion.cc @@ -28,7 +28,7 @@ #include "ops_utils/op_utils.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kScaleWeightIndex = 2; constexpr size_t kScaleBiasIndex = 3; @@ -334,4 +334,4 @@ const AnfNodePtr ScaleScaleFusion::Process(const FuncGraphPtr &func_graph, const return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/scale_scale_fusion.h b/mindspore-lite/tools/optimizer/fusion/scale_scale_fusion.h index 6043390c603f0e56c7b1c237a080ef9a8ec6d927..c191bbc2a7753e48833498860e175209e50762f0 100644 --- a/mindspore-lite/tools/optimizer/fusion/scale_scale_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/scale_scale_fusion.h @@ -21,7 +21,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ScaleScaleFusion : public LitePatternProcessPass { public: explicit ScaleScaleFusion(bool multigraph = true, const std::string &name = "ScaleScaleFusion") @@ -48,5 +48,5 @@ class ScaleScaleFusion : public LitePatternProcessPass { mutable size_t up_scale_axis_; mutable size_t down_scale_axis_; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_SCALE_SCALE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/sigmoid_mul_fusion.cc b/mindspore-lite/tools/optimizer/fusion/sigmoid_mul_fusion.cc index 34c15542b2399d2934870cd3c648722834de6323..3c3ccfe03d385f0e9dc5d9ec5afc49684b41ee3a 100644 --- a/mindspore-lite/tools/optimizer/fusion/sigmoid_mul_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/sigmoid_mul_fusion.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { VectorRef SigmoidMulFusion::DefineSigmoidMulFirstPattern() const { auto is_activation = std::make_shared(IsSpecifiedNode<&prim::kPrimActivation>); MS_CHECK_TRUE_RET(is_activation != nullptr, {}); @@ -105,4 +105,4 @@ bool SigmoidMulFusion::CheckPattern(const std::string &pattern_name, const FuncG } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/sigmoid_mul_fusion.h b/mindspore-lite/tools/optimizer/fusion/sigmoid_mul_fusion.h index dee6a110db0c579272984ca2f5320a7b4237c9b0..8eb7249a816f4ec6b2227913bfa74a21d1f5b1a8 100644 --- a/mindspore-lite/tools/optimizer/fusion/sigmoid_mul_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/sigmoid_mul_fusion.h @@ -23,7 +23,7 @@ #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "tools/converter/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class SigmoidMulFusion : public MultiplePatternProcessPass { public: @@ -42,5 +42,5 @@ class SigmoidMulFusion : public MultiplePatternProcessPass { const CNodePtr &mul_cnode) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_SIGMOID_MUL_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/squeeze_expanddims_fusion.cc b/mindspore-lite/tools/optimizer/fusion/squeeze_expanddims_fusion.cc index 74e9632beb4bc4da68e011354ece4445db22a7e8..c26c73705d1de79a5f699cc3a3ff0d19f1b0789d 100644 --- a/mindspore-lite/tools/optimizer/fusion/squeeze_expanddims_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/squeeze_expanddims_fusion.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_e.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef SqueezeExpandDimsFusion::DefinePattern() const { auto is_expanddims = std::make_shared(IsSpecifiedNode<&prim::kPrimExpandDims>); MS_CHECK_TRUE_RET(is_expanddims != nullptr, {}); @@ -117,4 +117,4 @@ const AnfNodePtr SqueezeExpandDimsFusion::Process(const FuncGraphPtr &func_graph (void)manage->Replace(expanddims_cnode, squeeze_cnode->input(SECOND_INPUT)); return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/squeeze_expanddims_fusion.h b/mindspore-lite/tools/optimizer/fusion/squeeze_expanddims_fusion.h index 35067080e5ab7af614f65060b2efc64b291ff438..17ed8987869e0456b9214038bace1c042a1f7909 100644 --- a/mindspore-lite/tools/optimizer/fusion/squeeze_expanddims_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/squeeze_expanddims_fusion.h @@ -22,7 +22,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "utils/check_convert_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class SqueezeExpandDimsFusion : public LitePatternProcessPass { public: @@ -36,5 +36,5 @@ class SqueezeExpandDimsFusion : public LitePatternProcessPass { bool CheckCanFuse(const FuncGraphPtr &func_graph, const AnfNodePtr &node) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_SQUEEZE_EXPANDDIMS_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/squeeze_fusion.cc b/mindspore-lite/tools/optimizer/fusion/squeeze_fusion.cc index 1eb956e706e00133d4c0729c58aa3abd591531f6..b009257079245724f62848fd25c0a291822de4b7 100644 --- a/mindspore-lite/tools/optimizer/fusion/squeeze_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/squeeze_fusion.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_u.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { const BaseRef SqueezeFusion::DefinePattern() const { auto is_squeeze = std::make_shared(IsSpecifiedNode<&prim::kPrimSqueeze>); MS_CHECK_TRUE_RET(is_squeeze != nullptr, {}); @@ -113,4 +113,4 @@ const AnfNodePtr SqueezeFusion::Process(const FuncGraphPtr &func_graph, const An } return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/squeeze_fusion.h b/mindspore-lite/tools/optimizer/fusion/squeeze_fusion.h index 5c5e2aba8e62b42d601b34694661d11b64e6ed3c..de910218c0209474810be5f757f4e21252c69334 100644 --- a/mindspore-lite/tools/optimizer/fusion/squeeze_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/squeeze_fusion.h @@ -21,7 +21,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "schema/inner/model_generated.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class SqueezeFusion : public LitePatternProcessPass { public: @@ -32,5 +32,5 @@ class SqueezeFusion : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_SQUEEZE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/strided_slice_checker.cc b/mindspore-lite/tools/optimizer/fusion/strided_slice_checker.cc index 79394bbbb1b1a73bf594c793dfa2f01de24f9554..2a844d624ca68fb6b05a03150cdd669b4a036484 100644 --- a/mindspore-lite/tools/optimizer/fusion/strided_slice_checker.cc +++ b/mindspore-lite/tools/optimizer/fusion/strided_slice_checker.cc @@ -21,7 +21,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "mindspore/ops/op_def/op_name.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool StridedSliceChecker::CheckCommonInfo(const CNodePtr &strided_slice) { if (strided_slice == nullptr || strided_slice->size() > kInputSizeFive) { @@ -154,4 +154,4 @@ int StridedSliceChecker::GetConstTensor(const CNodePtr &strided_slice, size_t in return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/strided_slice_checker.h b/mindspore-lite/tools/optimizer/fusion/strided_slice_checker.h index c0ea371421854e6fe15db48a98582f7408934d6b..da996cc631e316817d04c0e16db750c57a527065 100644 --- a/mindspore-lite/tools/optimizer/fusion/strided_slice_checker.h +++ b/mindspore-lite/tools/optimizer/fusion/strided_slice_checker.h @@ -21,7 +21,7 @@ #include "ir/anf.h" #include "tools/lite_exporter/fetch_content.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class StridedSliceChecker { public: @@ -36,5 +36,5 @@ class StridedSliceChecker { static int GetConstTensor(const CNodePtr &strided_slice, size_t index, lite::DataInfo *data_info); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_STRIDED_SLICE_CHECKER_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/strided_slice_fusion.cc b/mindspore-lite/tools/optimizer/fusion/strided_slice_fusion.cc index 6b22babba8f889216fc52d14e457f6fcafba930a..247cf67c6489314c4d84c670fa7b9dbc0a2f728a 100644 --- a/mindspore-lite/tools/optimizer/fusion/strided_slice_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/strided_slice_fusion.cc @@ -29,7 +29,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { bool CheckContinuity(const std::vector &nodes, int axis) { @@ -198,4 +198,4 @@ bool StridedSliceFusion::CheckCanFusion() { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/strided_slice_fusion.h b/mindspore-lite/tools/optimizer/fusion/strided_slice_fusion.h index 5a2170cb34dc1c787595f6bf01da2e62bc97acd8..9b36eca89bbb24da475f106280fc7c2d705d1c30 100644 --- a/mindspore-lite/tools/optimizer/fusion/strided_slice_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/strided_slice_fusion.h @@ -19,7 +19,7 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class StridedSliceFusion : public Pass { public: @@ -35,6 +35,6 @@ class StridedSliceFusion : public Pass { int axis_{0}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_STRIDED_SLICE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/tensor_dot_fusion.cc b/mindspore-lite/tools/optimizer/fusion/tensor_dot_fusion.cc index fabb55b274d4eea79553c7452755aabf589399e4..b3d063d3869a959448ee79a49f271bb527bee9a7 100644 --- a/mindspore-lite/tools/optimizer/fusion/tensor_dot_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/tensor_dot_fusion.cc @@ -32,7 +32,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { STATUS GetIndexValue(const CNodePtr &cnode, std::vector *index, int node_index) { MS_ASSERT(cnode != nullptr); @@ -210,4 +210,4 @@ const AnfNodePtr TensorDotFusion::Process(const FuncGraphPtr &func_graph, const } return nullptr; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/tensor_dot_fusion.h b/mindspore-lite/tools/optimizer/fusion/tensor_dot_fusion.h index b8ac87e82d9abbb9d64ac1a1d8ecfa7f4afcf3e4..708a307bde231580f10474ce508c0f23e08f9471 100644 --- a/mindspore-lite/tools/optimizer/fusion/tensor_dot_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/tensor_dot_fusion.h @@ -26,7 +26,7 @@ #include "infer/cxx_api/scale_fusion.h" #include "utils/check_convert_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class TensorDotFusion : public LitePatternProcessPass { public: @@ -36,5 +36,5 @@ class TensorDotFusion : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TENSOR_DOT_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/tf_bidirection_gru_fusion.cc b/mindspore-lite/tools/optimizer/fusion/tf_bidirection_gru_fusion.cc index f7ed4cc50fd6431683366703c376a58d91fa6aa3..f512be031c91ed2be9d238e95ad116805098c757 100644 --- a/mindspore-lite/tools/optimizer/fusion/tf_bidirection_gru_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/tf_bidirection_gru_fusion.cc @@ -43,7 +43,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_w.h" #include "ir/tensor_new.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int kOffsetTwo = 2; @@ -855,4 +855,4 @@ const AnfNodePtr TfBidirectionGruFusion::Process(const FuncGraphPtr &func_graph, return output_node; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/tf_bidirection_gru_fusion.h b/mindspore-lite/tools/optimizer/fusion/tf_bidirection_gru_fusion.h index f719ebb734e0255c48154158eefeba019bbfea75..e86b92a7d5db2e741bbc93121b521794bd30dcd3 100644 --- a/mindspore-lite/tools/optimizer/fusion/tf_bidirection_gru_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/tf_bidirection_gru_fusion.h @@ -25,7 +25,7 @@ #include "include/common/utils/utils.h" #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { constexpr size_t kWhileUniqInputsLength = 6; // fuse tf 2.x bidirection_gru into MSLITE GRU @@ -92,6 +92,6 @@ class TfBidirectionGruFusion : public LitePatternProcessPass { }; inline bool IsParameterNode(const BaseRef &n) { return utils::isa(n); } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TF_BIDIRECTION_GRU_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/tf_gelu_fusion.cc b/mindspore-lite/tools/optimizer/fusion/tf_gelu_fusion.cc index 91ed75861a8002e7403f342aef08f2010837b9c8..a5e7e8c1e66dea46f57bab5716e98be1da7c6a83 100644 --- a/mindspore-lite/tools/optimizer/fusion/tf_gelu_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/tf_gelu_fusion.cc @@ -24,7 +24,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr float DIFF_THRESHOLD = 0.0001; @@ -134,4 +134,4 @@ bool TfGeLUFusion::CheckPattern(const std::string &pattern_name, const EquivPtr return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/tf_gelu_fusion.h b/mindspore-lite/tools/optimizer/fusion/tf_gelu_fusion.h index b597f9295d353bcafb3ce639a3855625abe7847a..2198258a51fcc59aa8a34a093619dcf5e49bd967 100644 --- a/mindspore-lite/tools/optimizer/fusion/tf_gelu_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/tf_gelu_fusion.h @@ -22,7 +22,7 @@ #include #include "tools/optimizer/fusion/gelu_fusion.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class TfGeLUFusion : public GeLUFusion { public: @@ -48,6 +48,6 @@ class TfGeLUFusion : public GeLUFusion { mutable VarPtr mul3_x_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TF_GELU_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/tf_lstm_cell_fusion.cc b/mindspore-lite/tools/optimizer/fusion/tf_lstm_cell_fusion.cc index 3d12255f5077bf7614e4780420353189e14a02e2..93d2d854709a74eafc70b9c08f75f9a96df93a09 100644 --- a/mindspore-lite/tools/optimizer/fusion/tf_lstm_cell_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/tf_lstm_cell_fusion.cc @@ -32,7 +32,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int kNumInPlaceHolder = 10; @@ -449,4 +449,4 @@ CNodePtr TfLstmCellFusion::CreateLSTMNode(const FuncGraphPtr &func_graph, const return new_node; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/tf_lstm_cell_fusion.h b/mindspore-lite/tools/optimizer/fusion/tf_lstm_cell_fusion.h index b6716519f5a71a2cf74268001c1d27524ab62bd8..d574813f5f1e82c2631501cbefe600080d464685 100644 --- a/mindspore-lite/tools/optimizer/fusion/tf_lstm_cell_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/tf_lstm_cell_fusion.h @@ -24,7 +24,7 @@ #include "include/common/utils/utils.h" #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class TfLstmCellFusion : public TfliteLstmCellFusion { public: @@ -47,6 +47,6 @@ class TfLstmCellFusion : public TfliteLstmCellFusion { mutable VarPtr forget_bias_ = nullptr; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TF_LSTM_CELL_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/tflite_lstm_cell_fusion.cc b/mindspore-lite/tools/optimizer/fusion/tflite_lstm_cell_fusion.cc index 770bf7ec0ee1c1416b1ba2bcac00809b651d6010..481cbf91d52be3732c3551e9c420df173ff5239e 100644 --- a/mindspore-lite/tools/optimizer/fusion/tflite_lstm_cell_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/tflite_lstm_cell_fusion.cc @@ -40,7 +40,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_w.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kWhileInputsLength = 23; @@ -840,4 +840,4 @@ const AnfNodePtr TfliteLstmCellFusion::Process(const FuncGraphPtr &func_graph, c return squeeze_node; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/tflite_lstm_cell_fusion.h b/mindspore-lite/tools/optimizer/fusion/tflite_lstm_cell_fusion.h index 2851f15d7ada38249d81da78dd1302b1046ca659..bbfb675b640b24853dd8c7453122badff07705ac 100644 --- a/mindspore-lite/tools/optimizer/fusion/tflite_lstm_cell_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/tflite_lstm_cell_fusion.h @@ -23,7 +23,7 @@ #include "include/common/utils/utils.h" #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class TfliteLstmCellFusion : public LitePatternProcessPass { public: @@ -90,5 +90,5 @@ class TfliteLstmCellFusion : public LitePatternProcessPass { size_t body_cnodes_num_ = 0; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TFLITE_LSTM_CELL_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/tflite_rel_pos_multi_head_attention_fusion.cc b/mindspore-lite/tools/optimizer/fusion/tflite_rel_pos_multi_head_attention_fusion.cc index fd9f90989174f4e819472663441e49d33f59da72..34454af42a4157009daac7468978607fd0891e10 100644 --- a/mindspore-lite/tools/optimizer/fusion/tflite_rel_pos_multi_head_attention_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/tflite_rel_pos_multi_head_attention_fusion.cc @@ -35,7 +35,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { const auto &p1 = std::placeholders::_1; const size_t kWeightQueryIndex = 4; @@ -554,4 +554,4 @@ const VectorRef TfliteRelPosMultiHeadAttentionFusion::DefineProcessOutputPattern result = VectorRef({is_add, result, bias}); return result; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/tflite_rel_pos_multi_head_attention_fusion.h b/mindspore-lite/tools/optimizer/fusion/tflite_rel_pos_multi_head_attention_fusion.h index 0a154619ab2ec150e5f605c40453bd7ba60e9ae0..2c187e8b134a8081a727cab2f100f40df529f538 100644 --- a/mindspore-lite/tools/optimizer/fusion/tflite_rel_pos_multi_head_attention_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/tflite_rel_pos_multi_head_attention_fusion.h @@ -25,7 +25,7 @@ #include "include/errorcode.h" #include "tools/optimizer/fusion/multi_head_attention_fusion.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class TfliteRelPosMultiHeadAttentionFusion : public MultiHeadAttentionFusion { public: explicit TfliteRelPosMultiHeadAttentionFusion(const std::string &name = "TfliteRelPosMultiHeadAttentionFusion", @@ -72,5 +72,5 @@ class TfliteRelPosMultiHeadAttentionFusion : public MultiHeadAttentionFusion { mutable std::vector pos_stack_params_; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TFLITE_REL_POS_MULTI_HEAD_ATTENTION_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/tile_matmul_fusion.cc b/mindspore-lite/tools/optimizer/fusion/tile_matmul_fusion.cc index 927e1645bfe28a07426df480c9217a8c0ee70fc0..903d5b16e669f72875016eff08c1540b9983061a 100644 --- a/mindspore-lite/tools/optimizer/fusion/tile_matmul_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/tile_matmul_fusion.cc @@ -25,7 +25,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool TileMatMulFusion::CheckCanFuse(const FuncGraphPtr &func_graph, const AnfNodePtr &node) const { auto tile_cnode = node->cast(); @@ -113,4 +113,4 @@ bool TileMatMulFusion::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/tile_matmul_fusion.h b/mindspore-lite/tools/optimizer/fusion/tile_matmul_fusion.h index 280dc26564f2234d676a50b6a59cb8a9ce282696..37c3232b7ae32928e0165f6dfad7d8c94737856c 100644 --- a/mindspore-lite/tools/optimizer/fusion/tile_matmul_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/tile_matmul_fusion.h @@ -21,7 +21,7 @@ #include "tools/optimizer/common/multiple_pattern_process_pass.h" #include "utils/check_convert_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class TileMatMulFusion : public Pass { public: @@ -33,5 +33,5 @@ class TileMatMulFusion : public Pass { bool CheckCanFuse(const FuncGraphPtr &func_graph, const AnfNodePtr &node) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TILE_MATMUL_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/transpose_fusion.cc b/mindspore-lite/tools/optimizer/fusion/transpose_fusion.cc index 92676e2e201ecd264c1d354e084319ddc30e6466..a02cd72f51cfdacaba02a3907442871da700f23d 100644 --- a/mindspore-lite/tools/optimizer/fusion/transpose_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/transpose_fusion.cc @@ -35,7 +35,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { bool IsBNCNode(const BaseRef &n) { if (utils::isa(n)) { auto anf_node = utils::cast(n); @@ -368,4 +368,4 @@ AnfNodePtr TransposeFusion::Process(const std::string &pattern_name, const minds manager->SetEdge(any_cnode, 1, transpose_cnode->input(1)); return trans_post_node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/fusion/transpose_fusion.h b/mindspore-lite/tools/optimizer/fusion/transpose_fusion.h index 6e9c44ab40b040450596c2341ff83dee300a940e..a310449dcb5698ed7789f366ff58b8f15118dad7 100644 --- a/mindspore-lite/tools/optimizer/fusion/transpose_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/transpose_fusion.h @@ -22,7 +22,7 @@ #include "include/backend/optimizer/optimizer.h" #include "tools/optimizer/common/multiple_pattern_process_pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class TransposeFusion : public MultiplePatternProcessPass { public: @@ -47,5 +47,5 @@ class TransposeFusion : public MultiplePatternProcessPass { int AdjustAxis(const mindspore::AnfNodePtr &node) const; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TRANSPOSE_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/fusion/transpose_gather_fusion.cc b/mindspore-lite/tools/optimizer/fusion/transpose_gather_fusion.cc index 1611a69776aeeb19789e3574879585c2b2362ace..98e71246f2554cbe471b2c6981f58b59db961a76 100644 --- a/mindspore-lite/tools/optimizer/fusion/transpose_gather_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/transpose_gather_fusion.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kPermMaxSize = 20; @@ -250,4 +250,4 @@ bool TransposeGatherFusion::CheckIsMatch(const std::vector &pre_perm, const return third_transform == align_transform; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/transpose_gather_fusion.h b/mindspore-lite/tools/optimizer/fusion/transpose_gather_fusion.h index c8042034f06c4b06a2c972e088f4b74f690265e2..10418f32521720de6836b83251094134d0e32ebb 100644 --- a/mindspore-lite/tools/optimizer/fusion/transpose_gather_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/transpose_gather_fusion.h @@ -21,7 +21,7 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /* * The subgraph such as the following, in some times, the transpose-op can be fused. @@ -49,6 +49,6 @@ class TransposeGatherFusion : public Pass { std::vector gather_axes_data_ptr_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TRANSPOSE_GATHER_FUSION_H diff --git a/mindspore-lite/tools/optimizer/fusion/transpose_matmul_fusion.cc b/mindspore-lite/tools/optimizer/fusion/transpose_matmul_fusion.cc index b5f127d5ab3d459279348f7cebc872c9da989df1..39bf94d8b70f39548358a36e4cdbecd5a3fa7cdb 100644 --- a/mindspore-lite/tools/optimizer/fusion/transpose_matmul_fusion.cc +++ b/mindspore-lite/tools/optimizer/fusion/transpose_matmul_fusion.cc @@ -29,7 +29,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { inline const std::vector kMatMulTransPerm1 = {0, 1, 3, 2}; @@ -119,4 +119,4 @@ bool TransposeMatMulFusion::Run(const FuncGraphPtr &func_graph) { return false; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/fusion/transpose_matmul_fusion.h b/mindspore-lite/tools/optimizer/fusion/transpose_matmul_fusion.h index 629f75d51a263f67a4486e18cdb7910f7501fbea..035955abe1c81f03d6cbde0588f968b1b6eee5b0 100644 --- a/mindspore-lite/tools/optimizer/fusion/transpose_matmul_fusion.h +++ b/mindspore-lite/tools/optimizer/fusion/transpose_matmul_fusion.h @@ -21,7 +21,7 @@ #include "tools/converter/converter_context.h" #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class TransposeMatMulFusion : public Pass { public: @@ -30,5 +30,5 @@ class TransposeMatMulFusion : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FUSION_TRANSPOSE_MATMUL_FUSION_H_ diff --git a/mindspore-lite/tools/optimizer/graph/add_tensor_array.cc b/mindspore-lite/tools/optimizer/graph/add_tensor_array.cc index e6a40b0761aa51b3d652dd9e7b91a5320d788dff..1b7030085537ef7ebabebc3d3fff0d90063fc081 100644 --- a/mindspore-lite/tools/optimizer/graph/add_tensor_array.cc +++ b/mindspore-lite/tools/optimizer/graph/add_tensor_array.cc @@ -33,7 +33,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { constexpr auto kDefaultIndex = 0; constexpr auto kInputNodeIndex = 1; constexpr auto kDefaultNumTensors = 1; @@ -237,4 +237,4 @@ const AnfNodePtr AddTensorArray::Process(const FuncGraphPtr &func_graph, const A return node; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/add_tensor_array.h b/mindspore-lite/tools/optimizer/graph/add_tensor_array.h index 39c72955e6ef4a7dbb9becf10e78e33ea00dbc0a..02c9cc3643e9845eb9eeec50dbdf4197b1a171ca 100644 --- a/mindspore-lite/tools/optimizer/graph/add_tensor_array.h +++ b/mindspore-lite/tools/optimizer/graph/add_tensor_array.h @@ -21,7 +21,7 @@ #include "schema/inner/model_generated.h" #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AddTensorArray : public LitePatternProcessPass { public: @@ -32,6 +32,6 @@ class AddTensorArray : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_ADD_TENSOR_ARRAY_H_ diff --git a/mindspore-lite/tools/optimizer/graph/add_variable_node_pass.cc b/mindspore-lite/tools/optimizer/graph/add_variable_node_pass.cc index ada4fe63f22de09fa8e69a5a156dc8074bed53bf..7739272ed81393d195c60b8f448146587a2c4b05 100644 --- a/mindspore-lite/tools/optimizer/graph/add_variable_node_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/add_variable_node_pass.cc @@ -37,7 +37,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kInputSize3 = 3; @@ -719,4 +719,4 @@ bool InsertVariableNodePass::Run(const FuncGraphPtr &graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/add_variable_node_pass.h b/mindspore-lite/tools/optimizer/graph/add_variable_node_pass.h index ba623d6771f734f60bdde58336371fe7d172cd78..d3e5a9694a2b84f5d799e760c01c818e48a39143 100644 --- a/mindspore-lite/tools/optimizer/graph/add_variable_node_pass.h +++ b/mindspore-lite/tools/optimizer/graph/add_variable_node_pass.h @@ -25,7 +25,7 @@ #include "tools/converter/cxx_api/converter_para.h" #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class InsertVariableNodePass : public Pass { public: @@ -68,5 +68,5 @@ class InsertVariableNodePass : public Pass { std::shared_ptr param_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_ADD_VARIABLE_NODE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/adjust_ascend_quant_pass.cc b/mindspore-lite/tools/optimizer/graph/adjust_ascend_quant_pass.cc index 4bc9cfb4f6c67fa9c953e265122c2e57bbf8ca77..a599049d3f89ccaf2eeabdefb907ddeb4bfd9569 100644 --- a/mindspore-lite/tools/optimizer/graph/adjust_ascend_quant_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/adjust_ascend_quant_pass.cc @@ -25,7 +25,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { bool AdjustAscendQuant(const FuncGraphPtr &func_graph, const CNodePtr &cnode) { @@ -104,4 +104,4 @@ bool AdjustAscendQunatPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/adjust_ascend_quant_pass.h b/mindspore-lite/tools/optimizer/graph/adjust_ascend_quant_pass.h index 6d5b7905e2f7c45bacad0972e802b95e9ae82a91..959c898c663a3b1b55a0a6387f03550801ce16db 100644 --- a/mindspore-lite/tools/optimizer/graph/adjust_ascend_quant_pass.h +++ b/mindspore-lite/tools/optimizer/graph/adjust_ascend_quant_pass.h @@ -19,7 +19,7 @@ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class AdjustAscendQunatPass : public Pass { public: @@ -28,6 +28,6 @@ class AdjustAscendQunatPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_ADJUST_ASCEND_QUANT_H diff --git a/mindspore-lite/tools/optimizer/graph/args_to_attr_pass.cc b/mindspore-lite/tools/optimizer/graph/args_to_attr_pass.cc index 1d021cdc6c2b1bd6ad6f12ec50b0055426bb8823..e73b7f4e20804fa1e120081e84f4e002a86aaaaf 100644 --- a/mindspore-lite/tools/optimizer/graph/args_to_attr_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/args_to_attr_pass.cc @@ -22,7 +22,7 @@ #include "ops/op_def.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool ArgsToAttrPass::Run(const FuncGraphPtr &func_graph) { if (func_graph == nullptr) { @@ -107,4 +107,4 @@ bool ArgsToAttrPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/args_to_attr_pass.h b/mindspore-lite/tools/optimizer/graph/args_to_attr_pass.h index 3f1eac2e48fe04eedc1106c555bcf179a11db4d4..f959180e619f2584128740c59c8c2df53a6b12a5 100644 --- a/mindspore-lite/tools/optimizer/graph/args_to_attr_pass.h +++ b/mindspore-lite/tools/optimizer/graph/args_to_attr_pass.h @@ -23,7 +23,7 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class ArgsToAttrPass : public Pass { public: @@ -32,5 +32,5 @@ class ArgsToAttrPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_ARGS_TO_ATTR_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/attr_to_args_pass.cc b/mindspore-lite/tools/optimizer/graph/attr_to_args_pass.cc index 63f14d2b5e0f591bac3751f01196b2b7d6df1394..4fe0e1f54826e75bfab1349ae89eb011c296dc72 100644 --- a/mindspore-lite/tools/optimizer/graph/attr_to_args_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/attr_to_args_pass.cc @@ -24,7 +24,7 @@ #include "utils/anf_utils.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { @@ -318,4 +318,4 @@ bool AttrToArgsPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/attr_to_args_pass.h b/mindspore-lite/tools/optimizer/graph/attr_to_args_pass.h index ca369c37b8dbf73aa2ac7dfa34d2d0bc9ec07361..382832ffc9594beb818af3a393bcde0c6bb4b63d 100644 --- a/mindspore-lite/tools/optimizer/graph/attr_to_args_pass.h +++ b/mindspore-lite/tools/optimizer/graph/attr_to_args_pass.h @@ -23,7 +23,7 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { // The dynamic op defined be yaml has changed the node attrs to args. class AttrToArgsPass : public Pass { @@ -33,5 +33,5 @@ class AttrToArgsPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_ARGS_TO_ATTR_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/broadcast_for_select.cc b/mindspore-lite/tools/optimizer/graph/broadcast_for_select.cc index a800693c9001a5bb33a671f1d2eba2c81e354c47..1018a2d277b15454081376276b5dd3e696deb743 100644 --- a/mindspore-lite/tools/optimizer/graph/broadcast_for_select.cc +++ b/mindspore-lite/tools/optimizer/graph/broadcast_for_select.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_b.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { ShapeVector GetSelectInputShape(const AnfNodePtr &input) { @@ -133,4 +133,4 @@ const AnfNodePtr BroadCastForSelect::Process(const FuncGraphPtr &graph, const An return out_node; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/broadcast_for_select.h b/mindspore-lite/tools/optimizer/graph/broadcast_for_select.h index 6f45875fa5cda94672bd9a1643aa9507994c2ac4..4a97de61d8ea20c5cefe17cdebf4c7945152c379 100644 --- a/mindspore-lite/tools/optimizer/graph/broadcast_for_select.h +++ b/mindspore-lite/tools/optimizer/graph/broadcast_for_select.h @@ -22,7 +22,7 @@ #include #include "tools/optimizer/common/pattern_process_pass_extends.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class BroadCastForSelect : public LitePatternProcessPass { public: @@ -32,5 +32,5 @@ class BroadCastForSelect : public LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &graph, const AnfNodePtr &node, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_BROADCAST_FOR_SELECT_H_ diff --git a/mindspore-lite/tools/optimizer/graph/clip_convert_activation_pass.cc b/mindspore-lite/tools/optimizer/graph/clip_convert_activation_pass.cc index a9da5add57a2c42d9bc7ed41faf9924394668b6e..16dcff8f9e6041e4edca2433fa9b845f851dadd7 100644 --- a/mindspore-lite/tools/optimizer/graph/clip_convert_activation_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/clip_convert_activation_pass.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kClipMinIndex = 2; constexpr size_t kClipMaxIndex = 3; @@ -113,4 +113,4 @@ bool ClipConvertActivationPass::Run(const FuncGraphPtr &graph) { } return false; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/clip_convert_activation_pass.h b/mindspore-lite/tools/optimizer/graph/clip_convert_activation_pass.h index 0508a731af5c801eab74c3622e1953ba2d9df61a..7a3736edd420958ed5814000773d284c1a3f5106 100644 --- a/mindspore-lite/tools/optimizer/graph/clip_convert_activation_pass.h +++ b/mindspore-lite/tools/optimizer/graph/clip_convert_activation_pass.h @@ -19,7 +19,7 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ClipConvertActivationPass : public Pass { public: explicit ClipConvertActivationPass(bool only_relu = false) : Pass("clip_convert_activation_pass") { @@ -31,5 +31,5 @@ class ClipConvertActivationPass : public Pass { private: bool only_relu_ = false; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_CLIP_CONVERT_ACTIVATION_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/concat_op_pass.cc b/mindspore-lite/tools/optimizer/graph/concat_op_pass.cc index ae207faf5cd80878f1bb753791f4ef922f29ceaf..240844b8442fee4f74941a70a6d017199a397dac 100644 --- a/mindspore-lite/tools/optimizer/graph/concat_op_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/concat_op_pass.cc @@ -34,7 +34,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { #if !defined(_WIN32) && !defined(_WIN64) CNodePtr CreateTupleGetItemNode(const FuncGraphPtr &func_graph, const AnfNodePtr &node, size_t output_idx) { @@ -230,4 +230,4 @@ bool ConcatOpPass::Run(const FuncGraphPtr &func_graph) { #else bool ConcatOpPass::Run(const FuncGraphPtr &func_graph) { return true; } #endif -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/concat_op_pass.h b/mindspore-lite/tools/optimizer/graph/concat_op_pass.h index 79da2dfe889f546db0cc285931ac4c26a60e61f3..1d2f60b61598023a841aaaa8a0a2d6dffbba6218 100644 --- a/mindspore-lite/tools/optimizer/graph/concat_op_pass.h +++ b/mindspore-lite/tools/optimizer/graph/concat_op_pass.h @@ -21,7 +21,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ConcatOpPass : public Pass { public: ConcatOpPass() : Pass("concat_op_pass") {} @@ -33,5 +33,5 @@ class ConcatOpPass : public Pass { STATUS AddDynamicInputSizeAttrForNode(const AnfNodePtr &anf_node); STATUS RunInsertSizeAttrPass(const FuncGraphPtr &func_graph, const FuncGraphManagerPtr &manager); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_CONCAT_OP_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/control_flow_pass.cc b/mindspore-lite/tools/optimizer/graph/control_flow_pass.cc index 67764884947a38ac6bced09946eadef74c26cf7b..a4e48cd3f29d5660a816e6980cbaf6a90cad96cc 100644 --- a/mindspore-lite/tools/optimizer/graph/control_flow_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/control_flow_pass.cc @@ -36,7 +36,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_w.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { void ControlFlowPass::ReplaceNode(const FuncGraphPtr &fg, const std::unordered_map &replace_pairs) { for (auto &node : fg->nodes()) { @@ -818,4 +818,4 @@ bool ControlFlowPass::Run(const FuncGraphPtr &fg) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/control_flow_pass.h b/mindspore-lite/tools/optimizer/graph/control_flow_pass.h index b83b82cb374e7303b96a38e3706fbb9a0a851ee2..68d29f66662f709695dbb88fb5a8cbc048a01a9f 100644 --- a/mindspore-lite/tools/optimizer/graph/control_flow_pass.h +++ b/mindspore-lite/tools/optimizer/graph/control_flow_pass.h @@ -24,7 +24,7 @@ #include "schema/inner/model_generated.h" #include "include/backend/optimizer/pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ControlFlowPass : public Pass { public: ControlFlowPass() : Pass("control_flow_pass") {} @@ -94,5 +94,5 @@ class ControlFlowPass : public Pass { std::deque to_process_q{}; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif diff --git a/mindspore-lite/tools/optimizer/graph/core_infershape_pass.cc b/mindspore-lite/tools/optimizer/graph/core_infershape_pass.cc index 6c4722df16be1addb21b27d6c72b10ec52fcfe4d..8632fd38d6da527a9eeb1039b5fc0c88ab4244c1 100644 --- a/mindspore-lite/tools/optimizer/graph/core_infershape_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/core_infershape_pass.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_w.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { int JudgeControlFlowCertainOutputHasInferred(const CNodePtr &return_cnode, size_t index, bool *infer_info) { @@ -405,4 +405,4 @@ int CoreInferShapePass::ResetSubGraphInput() { return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/core_infershape_pass.h b/mindspore-lite/tools/optimizer/graph/core_infershape_pass.h index 3bae5b5620f717addd23971c7c6d308a3be686db..c48bc634d2373418c0d390c6cbad6c07c7683602 100644 --- a/mindspore-lite/tools/optimizer/graph/core_infershape_pass.h +++ b/mindspore-lite/tools/optimizer/graph/core_infershape_pass.h @@ -25,7 +25,7 @@ #include "include/errorcode.h" #include "include/registry/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { using mindspore::lite::STATUS; class CoreInferShapePass : public Pass { @@ -51,5 +51,5 @@ class CoreInferShapePass : public Pass { FuncGraphManagerPtr manager_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_CORE_INFERSHAPE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/decrease_transpose_algo.cc b/mindspore-lite/tools/optimizer/graph/decrease_transpose_algo.cc index 8f073b2b087dabdb0f6b6af8ff8eff859088b760..d5516063b72041029e54a27f4f3354ef441893ed 100644 --- a/mindspore-lite/tools/optimizer/graph/decrease_transpose_algo.cc +++ b/mindspore-lite/tools/optimizer/graph/decrease_transpose_algo.cc @@ -39,7 +39,7 @@ #include "ir/tensor_new.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { std::function check_node = [](const CNodePtr &cnode) { @@ -908,4 +908,4 @@ bool DecreaseTransposeAlgo::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/decrease_transpose_algo.h b/mindspore-lite/tools/optimizer/graph/decrease_transpose_algo.h index f5a8ffc89e046b87debfdf84b7a1a4c78bb2ec2c..778ab012da1623cfd3cb3cc47b3097ca73fff7a3 100644 --- a/mindspore-lite/tools/optimizer/graph/decrease_transpose_algo.h +++ b/mindspore-lite/tools/optimizer/graph/decrease_transpose_algo.h @@ -29,7 +29,7 @@ #include "tools/optimizer/graph/transpose_strategy.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class DecreaseTransposeAlgo : public Pass { public: @@ -68,6 +68,6 @@ class DecreaseTransposeAlgo : public Pass { std::unordered_map> sub_inputs_map_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_DECREASE_TRANSPOSE_ALGO_H_ diff --git a/mindspore-lite/tools/optimizer/graph/dump_graph.h b/mindspore-lite/tools/optimizer/graph/dump_graph.h index ccb9682e9da38ffb995839be1f55b91057ad94f1..25151bc242345cfbdda3c5609b6f427bacfceedb 100644 --- a/mindspore-lite/tools/optimizer/graph/dump_graph.h +++ b/mindspore-lite/tools/optimizer/graph/dump_graph.h @@ -22,7 +22,7 @@ #include "include/registry/pass_base.h" #include "mindapi/ir/func_graph.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class DumpGraph : public registry::PassBase, public Pass { public: @@ -50,6 +50,6 @@ class DumpGraph : public registry::PassBase, public Pass { const std::shared_ptr ¶m_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_DUMP_GRAPH_H_ diff --git a/mindspore-lite/tools/optimizer/graph/eliminate_redundant_cast_pass.cc b/mindspore-lite/tools/optimizer/graph/eliminate_redundant_cast_pass.cc index 250ff0a9765b9b8a0d7d846fb64b063cf9693202..788cab2cf99e58bbd184c18895e5d59ce86ece67 100644 --- a/mindspore-lite/tools/optimizer/graph/eliminate_redundant_cast_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/eliminate_redundant_cast_pass.cc @@ -20,7 +20,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { int EliminateRedundantCastPass::RemoveCastOp(const AnfNodePtr &anf_node, const FuncGraphManagerPtr &manager) { const int expected_cast_input_count = 3; auto cast_cnode = anf_node->cast(); @@ -75,4 +75,4 @@ bool EliminateRedundantCastPass::Run(const FuncGraphPtr &func_graph) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/eliminate_redundant_cast_pass.h b/mindspore-lite/tools/optimizer/graph/eliminate_redundant_cast_pass.h index aab3a4d126828b431d6a51c7bc9a60e7633342c6..0d4ca3245e2680be34bc1eaadf2bb8d35fe88760 100644 --- a/mindspore-lite/tools/optimizer/graph/eliminate_redundant_cast_pass.h +++ b/mindspore-lite/tools/optimizer/graph/eliminate_redundant_cast_pass.h @@ -20,7 +20,7 @@ #include "include/registry/converter_context.h" #include "include/backend/optimizer/pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { using mindspore::converter::FmkType; class EliminateRedundantCastPass : public Pass { public: @@ -37,5 +37,5 @@ class EliminateRedundantCastPass : public Pass { bool train_flag_{false}; std::set remove_cnode_; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_ELIMINATE_REDUNDANT_CAST_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/group_depthwise_op_convert_pass.cc b/mindspore-lite/tools/optimizer/graph/group_depthwise_op_convert_pass.cc index f0b4940789da2855f82847ee795b7105e8e9139b..c70c77d8ae22dce227487f71d9976fc25424898b 100644 --- a/mindspore-lite/tools/optimizer/graph/group_depthwise_op_convert_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/group_depthwise_op_convert_pass.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kConvWeightIndex = 2; constexpr size_t kConvInputIndex = 1; @@ -129,4 +129,4 @@ bool GroupDepthwiseOpConvertPass::Run(const FuncGraphPtr &graph) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/group_depthwise_op_convert_pass.h b/mindspore-lite/tools/optimizer/graph/group_depthwise_op_convert_pass.h index 7098cd0fbd46e2dde62e1e3e1a38bc5df186262c..7c8d344f961fd1d05b17dfaa89186b33bc2cd1a7 100644 --- a/mindspore-lite/tools/optimizer/graph/group_depthwise_op_convert_pass.h +++ b/mindspore-lite/tools/optimizer/graph/group_depthwise_op_convert_pass.h @@ -18,12 +18,12 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class GroupDepthwiseOpConvertPass : public Pass { public: GroupDepthwiseOpConvertPass() : Pass("group_depthwise_op_convert_pass") {} ~GroupDepthwiseOpConvertPass() override = default; bool Run(const FuncGraphPtr &graph) override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_GROUP_DEPTHWISE_OP_CONVERT_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/grouped_matmul_op_pass.cc b/mindspore-lite/tools/optimizer/graph/grouped_matmul_op_pass.cc index ef04f2c280923fea4af7ee8ef89ac461cf9c0c83..6eba34b69536c3b21469f6d29692e2a8d84f62c7 100644 --- a/mindspore-lite/tools/optimizer/graph/grouped_matmul_op_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/grouped_matmul_op_pass.cc @@ -38,7 +38,7 @@ #include "ir/tensor_new.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { #if !defined(_WIN32) && !defined(_WIN64) const std::map> OpInputDtypeMap = {{prim::kPrimGroupedMatmul->name(), {{2, TypeId::kTypeUnknown}, @@ -382,4 +382,4 @@ bool GroupedMatmulOpPass::Run(const FuncGraphPtr &func_graph) { #else bool GroupedMatmulOpPass::Run(const FuncGraphPtr &func_graph) { return true; } #endif -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/grouped_matmul_op_pass.h b/mindspore-lite/tools/optimizer/graph/grouped_matmul_op_pass.h index b3edce56ac2c7056f821ff75a89c31c7758fa688..943a6cdf6612832ee0e2a57e87d1c0b5cb05d64a 100644 --- a/mindspore-lite/tools/optimizer/graph/grouped_matmul_op_pass.h +++ b/mindspore-lite/tools/optimizer/graph/grouped_matmul_op_pass.h @@ -23,7 +23,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class GroupedMatmulOpPass : public Pass { public: GroupedMatmulOpPass() : Pass("grouped_matmul_op_pass") {} @@ -45,5 +45,5 @@ class GroupedMatmulOpPass : public Pass { bool IsNotSequenceOfTensor(const abstract::AbstractBasePtr &abs); AnfNodePtr ConvertMakeTupleInputToPlantInputs(const FuncGraphPtr &graph, const CNodePtr &cnode_ptr); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_GROUPED_MATMUL_OP_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/infershape_pass.cc b/mindspore-lite/tools/optimizer/graph/infershape_pass.cc index c4e06e0447e536e5485b6bbe49cf737c1a95e60d..9f00765e3c76618cd878d50f0adc12296553cb32 100644 --- a/mindspore-lite/tools/optimizer/graph/infershape_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/infershape_pass.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_w.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { int GetCNodeCertainInputFormat(const CNodePtr cnode, int index, mindspore::Format *format) { @@ -500,4 +500,4 @@ int InferShapePass::ResetSubGraphInput() { return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/infershape_pass.h b/mindspore-lite/tools/optimizer/graph/infershape_pass.h index d3f2831f980ce47846f31914cd583edc9e8d6c02..5b2afede3ce2e009bce783be5a4b511395976a4f 100644 --- a/mindspore-lite/tools/optimizer/graph/infershape_pass.h +++ b/mindspore-lite/tools/optimizer/graph/infershape_pass.h @@ -24,7 +24,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/graph/node_infershape.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class InferShapePass : public Pass { public: @@ -54,5 +54,5 @@ class InferShapePass : public Pass { FuncGraphManagerPtr manager_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_INFERSHAPE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/input_and_output_variable_pass.cc b/mindspore-lite/tools/optimizer/graph/input_and_output_variable_pass.cc index 5f79c5917c90a10dffba477d6323281c739b102c..5988faca9ef0ceb520f49fd16bc7dbb6f5b51dea 100644 --- a/mindspore-lite/tools/optimizer/graph/input_and_output_variable_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/input_and_output_variable_pass.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "ir/tensor_new.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { bool InputAndOutputVariablePass::Run(const FuncGraphPtr &graph) { MS_LOG(INFO) << "Start to run input and output variable pass"; @@ -170,4 +170,4 @@ CNodePtr InputAndOutputVariablePass::CreateAssign(const AnfNodePtr &anf_node, co return cnode; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/input_and_output_variable_pass.h b/mindspore-lite/tools/optimizer/graph/input_and_output_variable_pass.h index c6d99ca30584db672c095f4f572f74ea51131a79..30ddbe97d6e88eb8128ea5e8237f1eb5421ea209 100644 --- a/mindspore-lite/tools/optimizer/graph/input_and_output_variable_pass.h +++ b/mindspore-lite/tools/optimizer/graph/input_and_output_variable_pass.h @@ -21,7 +21,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class InputAndOutputVariablePass : public Pass { public: InputAndOutputVariablePass(std::vector inputs_variable, std::vector outputs_variable) @@ -38,5 +38,5 @@ class InputAndOutputVariablePass : public Pass { std::vector inputs_variable_index_; std::vector outputs_variable_index_; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_INPUT_AND_OUTPUT_VARIABLE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/input_data_type_trans_pass.cc b/mindspore-lite/tools/optimizer/graph/input_data_type_trans_pass.cc index c8b686abbf88ae64b78913ad01f96080bfc9aaae..f88334cac2e9e1f5f99ec82fc819b58f1641cb1a 100644 --- a/mindspore-lite/tools/optimizer/graph/input_data_type_trans_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/input_data_type_trans_pass.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_l.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_u.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kNotEqualMinIndex = 3; const std::vector kFloatDataType = {kNumberTypeFloat, kNumberTypeFloat16, kNumberTypeFloat32, @@ -147,4 +147,4 @@ bool InOutDTypeTransPass::Run(const FuncGraphPtr &graph) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/input_data_type_trans_pass.h b/mindspore-lite/tools/optimizer/graph/input_data_type_trans_pass.h index 33a7251d749cf97d529e3fed746ca6fc600be732..28b360cd30ff885940fa95d331678941fc7f8bdf 100644 --- a/mindspore-lite/tools/optimizer/graph/input_data_type_trans_pass.h +++ b/mindspore-lite/tools/optimizer/graph/input_data_type_trans_pass.h @@ -22,7 +22,7 @@ #include "tools/optimizer/common/gllo_utils.h" #include "include/api/types.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class InOutDTypeTransPass : public Pass { public: explicit InOutDTypeTransPass(DataType dst_input_data_type, DataType dst_output_data_type) @@ -38,5 +38,5 @@ class InOutDTypeTransPass : public Pass { TypeId dst_input_data_type_ = kTypeUnknown; TypeId dst_output_data_type_ = kTypeUnknown; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_INPUT_DATA_TYPE_TRANS_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/int64_cast_int32_pass.cc b/mindspore-lite/tools/optimizer/graph/int64_cast_int32_pass.cc index fc3f1a8e4e4d4607768970c93808910febceb5a8..8769b4106b5f943aeb3eb96ebd932d5f57cfb1c2 100644 --- a/mindspore-lite/tools/optimizer/graph/int64_cast_int32_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/int64_cast_int32_pass.cc @@ -36,7 +36,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kNotEqualMinIndex = 3; } // namespace @@ -151,4 +151,4 @@ bool Int64CastInt32Pass::Run(const FuncGraphPtr &graph) { } return change_flag; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/int64_cast_int32_pass.h b/mindspore-lite/tools/optimizer/graph/int64_cast_int32_pass.h index 8413d0806faeb4337bacb6bc54d8a9b01ca1850b..1d3a5177a7955bac89a65174f9c998476a327c6d 100644 --- a/mindspore-lite/tools/optimizer/graph/int64_cast_int32_pass.h +++ b/mindspore-lite/tools/optimizer/graph/int64_cast_int32_pass.h @@ -19,7 +19,7 @@ #include #include "include/backend/optimizer/pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class Int64CastInt32Pass : public Pass { public: Int64CastInt32Pass() : Pass("int64_cast_int32_pass") {} @@ -29,5 +29,5 @@ class Int64CastInt32Pass : public Pass { private: bool NotEqualInputsCheck(const CNodePtr &cnode); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_INT64_CAST_INT32_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/kvcache_quant_pass.cc b/mindspore-lite/tools/optimizer/graph/kvcache_quant_pass.cc index d1478a22425b8ff8cf302d1908995bdcbaa3345f..ebe47a9a95d5e78b54462f2ebdd6897aada291ea 100644 --- a/mindspore-lite/tools/optimizer/graph/kvcache_quant_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/kvcache_quant_pass.cc @@ -58,7 +58,7 @@ improve the inference performance */ -namespace mindspore::opt { +namespace mindspore::lite::opt { CNodePtr KVCacheQuantPass::NewQuantNode(const FuncGraphPtr &func_graph, const AnfNodePtr &input_node, TypeId dst_type) { MS_EXCEPTION_IF_NULL(func_graph); MS_EXCEPTION_IF_NULL(input_node); @@ -258,4 +258,4 @@ bool KVCacheQuantPass::Run(const FuncGraphPtr &func_graph) { MS_CHECK_TRUE_RET(status != lite::RET_ERROR, false); return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/kvcache_quant_pass.h b/mindspore-lite/tools/optimizer/graph/kvcache_quant_pass.h index 02ce94d3f124b5a35e0cf704a797bc41a4c2e579..1e3cdab4b2335b13bdc00919c4302ec87ad20812 100644 --- a/mindspore-lite/tools/optimizer/graph/kvcache_quant_pass.h +++ b/mindspore-lite/tools/optimizer/graph/kvcache_quant_pass.h @@ -21,7 +21,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class KVCacheQuantPass : public Pass { public: KVCacheQuantPass() : Pass("kvcache_quant_pass") {} @@ -39,5 +39,5 @@ class KVCacheQuantPass : public Pass { STATUS RunQuantPass(const FuncGraphPtr &func_graph, const FuncGraphManagerPtr &manager); STATUS RunAntiQuantPass(const FuncGraphPtr &func_graph, const FuncGraphManagerPtr &manager); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_KVCACHE_QUANT_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/lite_tensor_extractor.cc b/mindspore-lite/tools/optimizer/graph/lite_tensor_extractor.cc index 27409afd7d52b42acf04015be266edcbfbcdbc96..7cee54b0615cba7a9a91189f0959842cc4fbb9b4 100644 --- a/mindspore-lite/tools/optimizer/graph/lite_tensor_extractor.cc +++ b/mindspore-lite/tools/optimizer/graph/lite_tensor_extractor.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int kElementShapeIndex = 1; @@ -514,4 +514,4 @@ int LiteTensorExtractor::GetCNodeOutputTensors(const CNodePtr &cnode, std::vecto return RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/lite_tensor_extractor.h b/mindspore-lite/tools/optimizer/graph/lite_tensor_extractor.h index 62cc27d34f86260e61f4f80b40fceaa8107da33c..87f79925df8bde0b24e5895ef286d5584ada97a6 100644 --- a/mindspore-lite/tools/optimizer/graph/lite_tensor_extractor.h +++ b/mindspore-lite/tools/optimizer/graph/lite_tensor_extractor.h @@ -23,7 +23,7 @@ #include "src/tensor.h" #include "tools/lite_exporter/fetch_content.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class LiteTensorExtractor { public: @@ -42,5 +42,5 @@ class LiteTensorExtractor { converter::FmkType fmk_type, bool train_flag); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_LITE_TENSOR_EXTRACTOR_H_ diff --git a/mindspore-lite/tools/optimizer/graph/make_list_pass.cc b/mindspore-lite/tools/optimizer/graph/make_list_pass.cc index 99456d297d6c9c9fc5398b409df3f2157b1ade6a..9728f5ffc850c84f347af6203ab649517c35ecfe 100644 --- a/mindspore-lite/tools/optimizer/graph/make_list_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/make_list_pass.cc @@ -29,7 +29,7 @@ #include "mindspore/core/include/utils/trace_info.h" #include "mindspore/core/include/ir/scope.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { // From // MakeList(arg1, arg2, ...) // To @@ -312,4 +312,4 @@ bool MakeListPass::Run(const FuncGraphPtr &func_graph) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/make_list_pass.h b/mindspore-lite/tools/optimizer/graph/make_list_pass.h index e63f2dc865737c5aaa8c1f1a955af0a0300bf94e..abf9eb3987a89f05a6e927f1d1f06b96a68268da 100644 --- a/mindspore-lite/tools/optimizer/graph/make_list_pass.h +++ b/mindspore-lite/tools/optimizer/graph/make_list_pass.h @@ -21,7 +21,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class MakeListPass : public Pass { public: MakeListPass() : Pass("make_list_pass") {} @@ -41,5 +41,5 @@ class MakeListPass : public Pass { AnfNodePtr ConvertListGetItemToTupleGetItem(const CNodePtr &node); AnfNodePtr ConvertMakeListToMakeTuple(const CNodePtr &node); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SCALAR_OP_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/miniaturization_pass.cc b/mindspore-lite/tools/optimizer/graph/miniaturization_pass.cc index 35e35075ebc6d75b4c3ea74695567beab2e6a3b9..88cc4f3772585c355dd1e779a961edd0819b9d56 100644 --- a/mindspore-lite/tools/optimizer/graph/miniaturization_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/miniaturization_pass.cc @@ -27,7 +27,7 @@ #include "utils/check_convert_utils.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { static inline tensor::TensorPtr GetTensorFromNode(const AnfNodePtr &node) { MS_ASSERT(node != nullptr); auto value_node = node->cast(); @@ -127,4 +127,4 @@ bool MiniaturizationPass::ProcessOneCNode(const FuncGraphPtr &func_graph, const } return changed; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/miniaturization_pass.h b/mindspore-lite/tools/optimizer/graph/miniaturization_pass.h index 96f94d4ab99ff0a3d141638b64720f5dbe1ffcd0..b55a3840ca848a6a30e03cba929d52108ba3776e 100644 --- a/mindspore-lite/tools/optimizer/graph/miniaturization_pass.h +++ b/mindspore-lite/tools/optimizer/graph/miniaturization_pass.h @@ -18,7 +18,7 @@ #define MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_MINIATURIZATION_PASS_H #include "include/backend/optimizer/pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class MiniaturizationPass : public Pass { public: MiniaturizationPass() : Pass("MiniaturizationPass") {} @@ -32,6 +32,6 @@ class MiniaturizationPass : public Pass { bool ProcessOneCNode(const FuncGraphPtr &func_graph, const CNodePtr &cnode); static const ssize_t COMPRESS_TRIGGER_SIZE_ = 512; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_MINIATURIZATION_PASS_H diff --git a/mindspore-lite/tools/optimizer/graph/mul_constant_pass.cc b/mindspore-lite/tools/optimizer/graph/mul_constant_pass.cc index 3588f628e3a1ea17c6e472ec5e3996681091bb8e..f5da7d46c5eabf7bc78ddefcf7e20cfe1fe590e1 100644 --- a/mindspore-lite/tools/optimizer/graph/mul_constant_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/mul_constant_pass.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr int kMulInputSize = 3; @@ -111,4 +111,4 @@ bool MulConstantPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/mul_constant_pass.h b/mindspore-lite/tools/optimizer/graph/mul_constant_pass.h index 4938f40e23a48c159a172050395f1a7cd94f79c8..20d32dccf2b3e2db403ed71e090df34070185747 100644 --- a/mindspore-lite/tools/optimizer/graph/mul_constant_pass.h +++ b/mindspore-lite/tools/optimizer/graph/mul_constant_pass.h @@ -18,7 +18,7 @@ #define MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_MUL_CONSTANT_PASS_H_ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class MulConstantPass : public Pass { public: @@ -27,5 +27,5 @@ class MulConstantPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_MUL_CONSTANT_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/node_infershape.cc b/mindspore-lite/tools/optimizer/graph/node_infershape.cc index 3844b8aacdb69270311e1297d85daf1125504c6c..191464fb322871a524b2c5e9fe4b832d3cf297d0 100644 --- a/mindspore-lite/tools/optimizer/graph/node_infershape.cc +++ b/mindspore-lite/tools/optimizer/graph/node_infershape.cc @@ -59,7 +59,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_z.h" #include "ir/tensor_new.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { static const std::unordered_set kNNACLToOpsInfer = { // arithmetic_self @@ -689,4 +689,4 @@ abstract::AbstractBasePtr NodeInferShape::ConvertTensorListToAbstract(lite::Tens return tensor_list_abstract; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/node_infershape.h b/mindspore-lite/tools/optimizer/graph/node_infershape.h index 7862279b065d969eec64411641bc07e24b9e5ca6..e27b56b638d7ad0d1e5741f7bc6cf2a1f5c6dbd9 100644 --- a/mindspore-lite/tools/optimizer/graph/node_infershape.h +++ b/mindspore-lite/tools/optimizer/graph/node_infershape.h @@ -27,7 +27,7 @@ #include "tools/optimizer/common/format_utils.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class NodeInferShape { public: @@ -59,6 +59,6 @@ class NodeInferShape { bool train_flag_{false}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_NODE_INFERSHAPE_H_ diff --git a/mindspore-lite/tools/optimizer/graph/output_variable_pass.cc b/mindspore-lite/tools/optimizer/graph/output_variable_pass.cc index 6c1cd58336a1669b16eb0b6918842270d478f741..6f0a8167bd8e8ad82a55b66dcc0ca03b40c3334f 100644 --- a/mindspore-lite/tools/optimizer/graph/output_variable_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/output_variable_pass.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "ir/tensor_new.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr size_t kInputNumber = 2; } @@ -157,4 +157,4 @@ bool OutputVariablePass::CreateDependNode(const FuncGraphPtr &graph) { graph->set_output(depend_node); return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/output_variable_pass.h b/mindspore-lite/tools/optimizer/graph/output_variable_pass.h index 7519eee916840c033fdbbaf8e8affd53aae22782..910fdb97dd426e45ffc202db512f86f26bb69bd9 100644 --- a/mindspore-lite/tools/optimizer/graph/output_variable_pass.h +++ b/mindspore-lite/tools/optimizer/graph/output_variable_pass.h @@ -21,7 +21,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class OutputVariablePass : public Pass { public: explicit OutputVariablePass(const std::vector &output_variable) : Pass("OutputVariablePass") { @@ -35,5 +35,5 @@ class OutputVariablePass : public Pass { std::vector assign_nodes_; std::vector outputs_variable_index_; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_OUTPUT_VARIABLE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/padv3_ge_pass.cc b/mindspore-lite/tools/optimizer/graph/padv3_ge_pass.cc index fffef2f52016a2f98240b219be280a1654c7983c..458882ffd96093aa9cf70ddcb01eec56839d71c1 100644 --- a/mindspore-lite/tools/optimizer/graph/padv3_ge_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/padv3_ge_pass.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_p.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { /* In MindSpore, padding order starts from the last dimension and goes backward (same as PyTorch), but GE padding order @@ -258,4 +258,4 @@ bool PadV3GePass::Run(const FuncGraphPtr &func_graph) { MS_LOG(INFO) << "run padv3 pass success!"; return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/padv3_ge_pass.h b/mindspore-lite/tools/optimizer/graph/padv3_ge_pass.h index ddfd523a24191b4752006cf10a3a309c7f1d603c..b38304d569bc179bb789b2499be03746b9576c06 100644 --- a/mindspore-lite/tools/optimizer/graph/padv3_ge_pass.h +++ b/mindspore-lite/tools/optimizer/graph/padv3_ge_pass.h @@ -22,7 +22,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class PadV3GePass : public Pass { public: PadV3GePass() : Pass("padv3_ge_pass") {} @@ -41,5 +41,5 @@ class PadV3GePass : public Pass { const CNodePtr CreateConcatNode(const FuncGraphPtr &func_graph, const std::vector &concat_input_vec, std::string concat_node_name); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_PADV3_GE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/preprocess_dynamic_shape.cc b/mindspore-lite/tools/optimizer/graph/preprocess_dynamic_shape.cc index b08d40f85df8bd17bee677f7bca6bd203c0a4e3a..a4bd0ba2eae1ae3ae82befa11aeb8c7674ed7b65 100644 --- a/mindspore-lite/tools/optimizer/graph/preprocess_dynamic_shape.cc +++ b/mindspore-lite/tools/optimizer/graph/preprocess_dynamic_shape.cc @@ -42,7 +42,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { int DoStack(const CNodePtr &cnode, const ShapeVector &out_shape, ShapeVector *out_data) { @@ -892,4 +892,4 @@ int DynamicShapePreprocessor::DoInfer(const CNodePtr &cnode, const std::string & return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/preprocess_dynamic_shape.h b/mindspore-lite/tools/optimizer/graph/preprocess_dynamic_shape.h index 20846abebd5bdf864e5ceee124a4f32af22633c6..3f3c3cddd477b5593330b5b32ea2bd13dcd9073c 100644 --- a/mindspore-lite/tools/optimizer/graph/preprocess_dynamic_shape.h +++ b/mindspore-lite/tools/optimizer/graph/preprocess_dynamic_shape.h @@ -24,7 +24,7 @@ #include "ir/anf.h" #include "mindapi/base/shape_vector.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class DynamicShapePreprocessor { typedef std::map, std::vector>> ShapeContainer; @@ -42,6 +42,6 @@ class DynamicShapePreprocessor { ShapeContainer op_shape_infos_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_PREPROCESS_DYNAMIC_SHAPE_H diff --git a/mindspore-lite/tools/optimizer/graph/quant_fusion_x_offset_to_bias_pass.cc b/mindspore-lite/tools/optimizer/graph/quant_fusion_x_offset_to_bias_pass.cc index 2b61b63cbde4b84fbf3d4b20a0d2d16b59410c35..6592db83f0295f6d1abe469f9de83baad2217c83 100644 --- a/mindspore-lite/tools/optimizer/graph/quant_fusion_x_offset_to_bias_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/quant_fusion_x_offset_to_bias_pass.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_q.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { constexpr auto kAttrNameOffset = "offset"; constexpr auto kAttrNameTransposeB = "transpose_b"; @@ -134,4 +134,4 @@ bool QuantFusionXOffsetToBias::Run(const FuncGraphPtr &func_graph) { MS_CHECK_TRUE_RET(ret == lite::RET_OK, false); return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/quant_fusion_x_offset_to_bias_pass.h b/mindspore-lite/tools/optimizer/graph/quant_fusion_x_offset_to_bias_pass.h index 37bc3cb7324f1cf61d24152fb22e245fc59e0c06..96982ce9465e53d93f1284158c582aac71b00345 100644 --- a/mindspore-lite/tools/optimizer/graph/quant_fusion_x_offset_to_bias_pass.h +++ b/mindspore-lite/tools/optimizer/graph/quant_fusion_x_offset_to_bias_pass.h @@ -21,7 +21,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class QuantFusionXOffsetToBias : public Pass { public: QuantFusionXOffsetToBias() : Pass("quant_fusion_x_offset_to_bias_pass") {} @@ -33,5 +33,5 @@ class QuantFusionXOffsetToBias : public Pass { float x_offset, const tensor::TensorPtr weight, bool transpose); STATUS RunQuantFusionXOffsetToBias(const FuncGraphPtr &func_graph, const FuncGraphManagerPtr &manager); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_QUANT_FUSION_X_OFFSET_TO_BIAS_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/reduce_same_act_pass.cc b/mindspore-lite/tools/optimizer/graph/reduce_same_act_pass.cc index 4bc5a61147fc6568ff8fe05c21475900471c4fa8..ff6c8fa892e25a44ac4e60487e203e7f868139b9 100644 --- a/mindspore-lite/tools/optimizer/graph/reduce_same_act_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/reduce_same_act_pass.cc @@ -25,7 +25,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kMinUsersSize = 2; @@ -78,4 +78,4 @@ bool ReduceSameActPass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/reduce_same_act_pass.h b/mindspore-lite/tools/optimizer/graph/reduce_same_act_pass.h index 5411d2518324863a8e272768a00ed23fc8d8f4d1..8063243e12c9499d71e3b4ac1ed5454a373d373d 100644 --- a/mindspore-lite/tools/optimizer/graph/reduce_same_act_pass.h +++ b/mindspore-lite/tools/optimizer/graph/reduce_same_act_pass.h @@ -27,7 +27,7 @@ #include "tools/optimizer/graph/transpose_strategy.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class ReduceSameActPass : public Pass { public: @@ -36,6 +36,6 @@ class ReduceSameActPass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_REDUCE_SAME_ACT_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/redundant_op_remove_pass.cc b/mindspore-lite/tools/optimizer/graph/redundant_op_remove_pass.cc index a753b60c662756b59951920be34cd1152c8e6c11..74070c78f0f88161d70c2fa47df65a5d0f7fd80d 100644 --- a/mindspore-lite/tools/optimizer/graph/redundant_op_remove_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/redundant_op_remove_pass.cc @@ -43,7 +43,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_w.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { const size_t kIndexNum = 2; int ReplaceUpdateStateWithMonad(const FuncGraphPtr &func_graph, const CNodePtr &cnode, bool remove_side_effect) { @@ -611,4 +611,4 @@ bool RemoveRedundantOpPass::Run(const FuncGraphPtr &func_graph) { remove_cnode_.clear(); return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/redundant_op_remove_pass.h b/mindspore-lite/tools/optimizer/graph/redundant_op_remove_pass.h index 02fe29b8e6cfb28bc889c9f5e2cc76c29ae0c5c7..e9f69aeacf22e7e7320163d708e88f7c6f7c54c3 100644 --- a/mindspore-lite/tools/optimizer/graph/redundant_op_remove_pass.h +++ b/mindspore-lite/tools/optimizer/graph/redundant_op_remove_pass.h @@ -23,7 +23,7 @@ #include "tools/lite_exporter/fetch_content.h" using mindspore::converter::FmkType; -namespace mindspore::opt { +namespace mindspore::lite::opt { class RemoveRedundantOpPass : public Pass { public: explicit RemoveRedundantOpPass(bool is_train_model) @@ -54,5 +54,5 @@ class RemoveRedundantOpPass : public Pass { bool keep_update_state_ = false; std::set remove_cnode_; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_REDUNDANT_OP_REMOVE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/remove_load_pass.cc b/mindspore-lite/tools/optimizer/graph/remove_load_pass.cc index 0507bb54c9838399de9731fa7e9491a446b51409..0f5a5daeed7982cf5ff139b7475ce949607a5231 100644 --- a/mindspore-lite/tools/optimizer/graph/remove_load_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/remove_load_pass.cc @@ -19,7 +19,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_a.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_l.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { bool RemoveLoadPass::Run(const mindspore::FuncGraphPtr &func_graph) { // Remove Load Node auto mng = func_graph->manager(); @@ -59,4 +59,4 @@ bool RemoveLoadPass::Run(const mindspore::FuncGraphPtr &func_graph) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/remove_load_pass.h b/mindspore-lite/tools/optimizer/graph/remove_load_pass.h index 6cb81106efd440e0a7a43f5ffe0d77355511936a..390022cf3b43f71ad71fb211445570fdc41b808c 100644 --- a/mindspore-lite/tools/optimizer/graph/remove_load_pass.h +++ b/mindspore-lite/tools/optimizer/graph/remove_load_pass.h @@ -17,12 +17,12 @@ #ifndef MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_REMOVE_LOAD_PASS_H #define MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_REMOVE_LOAD_PASS_H #include "include/backend/optimizer/pass.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class RemoveLoadPass : public Pass { public: RemoveLoadPass() : Pass("RemoveLoadPass") {} ~RemoveLoadPass() override = default; bool Run(const FuncGraphPtr &func_graph) override; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_REMOVE_LOAD_PASS_H diff --git a/mindspore-lite/tools/optimizer/graph/scalar_op_pass.cc b/mindspore-lite/tools/optimizer/graph/scalar_op_pass.cc index 3e217b5fae7215e4aa7d893c1679b403aed5308f..23f7d7bf766c47018ef3333b7aef5700fe3ea906 100644 --- a/mindspore-lite/tools/optimizer/graph/scalar_op_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/scalar_op_pass.cc @@ -89,7 +89,7 @@ remove both, the Tensor are connected. ############### */ -namespace mindspore::opt { +namespace mindspore::lite::opt { /* This function returns the index of the input node, which is used by the user node. */ @@ -649,4 +649,4 @@ bool ScalarOpPass::Run(const FuncGraphPtr &func_graph) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/scalar_op_pass.h b/mindspore-lite/tools/optimizer/graph/scalar_op_pass.h index 794872719fd8ddc2260c330bba38e55a6ac01ac5..ef983b4daa8f6f38a66eab3cf85278f06080b4a1 100644 --- a/mindspore-lite/tools/optimizer/graph/scalar_op_pass.h +++ b/mindspore-lite/tools/optimizer/graph/scalar_op_pass.h @@ -21,7 +21,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class ScalarOpPass : public Pass { public: ScalarOpPass() : Pass("scalar_op_pass") {} @@ -53,5 +53,5 @@ class ScalarOpPass : public Pass { STATUS RunRemoveTensorToScalarPass(const FuncGraphPtr &func_graph, const FuncGraphManagerPtr &manager); STATUS RunArithmeticCheckPass(const FuncGraphPtr &func_graph, const FuncGraphManagerPtr &manager); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SCALAR_OP_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/send_op_add_control_depend.cc b/mindspore-lite/tools/optimizer/graph/send_op_add_control_depend.cc index c958e6a42f230398f90c3d3b6b211bbdd080b9bc..cbf81cb73b007e43faf83eaf701dc80342db1e3b 100644 --- a/mindspore-lite/tools/optimizer/graph/send_op_add_control_depend.cc +++ b/mindspore-lite/tools/optimizer/graph/send_op_add_control_depend.cc @@ -22,7 +22,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "ir/tensor_new.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { const auto kDataToControl = "data_to_control"; @@ -76,4 +76,4 @@ const AnfNodePtr SendOpAddControlDepend::Process(const FuncGraphPtr &func_graph, } #endif } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/send_op_add_control_depend.h b/mindspore-lite/tools/optimizer/graph/send_op_add_control_depend.h index 8d7cfb7ac58b7e8a161373499ad7c705f32f3324..614d28aa8707838ef1ad3613652f8a9f3cde6346 100644 --- a/mindspore-lite/tools/optimizer/graph/send_op_add_control_depend.h +++ b/mindspore-lite/tools/optimizer/graph/send_op_add_control_depend.h @@ -26,7 +26,7 @@ #include "tools/optimizer/common/pattern_process_pass_extends.h" #include "mindspore/ops/op_def/nn_optimizer_ops.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class SendOpAddControlDepend : public opt::LitePatternProcessPass { public: @@ -38,5 +38,5 @@ class SendOpAddControlDepend : public opt::LitePatternProcessPass { const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &node, const EquivPtr &) const override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SEND_OP_ADD_CONTROL_DEPEND_H_ diff --git a/mindspore-lite/tools/optimizer/graph/slice_prepose_pass.cc b/mindspore-lite/tools/optimizer/graph/slice_prepose_pass.cc index 3ac929acd8ca7a04494704ce878ed66873a66177..e8711c0f2468e034a55a676133caee0412bffe71 100644 --- a/mindspore-lite/tools/optimizer/graph/slice_prepose_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/slice_prepose_pass.cc @@ -41,7 +41,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { const int kArithmeticInputNum = 2; const int SliceBeginIndex = 2; @@ -1564,4 +1564,4 @@ bool SlicePreposePass::Run(const FuncGraphPtr &graph) { } return changed; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/slice_prepose_pass.h b/mindspore-lite/tools/optimizer/graph/slice_prepose_pass.h index 33736f5558d092c9660fc25ff180ec2b74ce4e35..dec73e11fa0f4917d403d8c22067692b6f1b5243 100644 --- a/mindspore-lite/tools/optimizer/graph/slice_prepose_pass.h +++ b/mindspore-lite/tools/optimizer/graph/slice_prepose_pass.h @@ -26,7 +26,7 @@ #include "include/registry/converter_context.h" using mindspore::converter::FmkType; -namespace mindspore::opt { +namespace mindspore::lite::opt { using lite::RET_ERROR; using lite::RET_OK; using lite::STATUS; @@ -95,6 +95,6 @@ class SlicePreposePass : public Pass { private: FmkType fmk_type = converter::kFmkTypeOnnx; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SLICE_PREPOSE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/special_node_postprocess.cc b/mindspore-lite/tools/optimizer/graph/special_node_postprocess.cc index 08d26b725c7321784f7d44c64bacddd317c40290..2b72a9a6ff20a2b5a9a6b0dbb5bd4cc701eb452a 100644 --- a/mindspore-lite/tools/optimizer/graph/special_node_postprocess.cc +++ b/mindspore-lite/tools/optimizer/graph/special_node_postprocess.cc @@ -32,7 +32,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_w.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { const PrimitivePtr kPrimInstanceNorm = std::make_shared("InstanceNorm"); @@ -175,4 +175,4 @@ int SpecialNodePostProcess::HandleInstanceNorm(const FuncGraphPtr &func_graph, c return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/special_node_postprocess.h b/mindspore-lite/tools/optimizer/graph/special_node_postprocess.h index 56a753b330641bcb4ed0a988b2bbee4dd6e29ff3..a6355a4658d10bd3ee8c916f56ae8e360d319603 100644 --- a/mindspore-lite/tools/optimizer/graph/special_node_postprocess.h +++ b/mindspore-lite/tools/optimizer/graph/special_node_postprocess.h @@ -19,7 +19,7 @@ #include "include/backend/optimizer/pass.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class SpecialNodePostProcess : public Pass { public: @@ -32,6 +32,6 @@ class SpecialNodePostProcess : public Pass { int HandleInstanceNorm(const FuncGraphPtr &func_graph, const CNodePtr &cnode); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SPECIAL_NODE_POSTPROCESS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/specify_graph_input_format.cc b/mindspore-lite/tools/optimizer/graph/specify_graph_input_format.cc index 5b73b8bf7b3644183dc69c4c41fc5415e8175237..1bac6f65602d8de547b7bf7b200a8f6893056291 100644 --- a/mindspore-lite/tools/optimizer/graph/specify_graph_input_format.cc +++ b/mindspore-lite/tools/optimizer/graph/specify_graph_input_format.cc @@ -31,7 +31,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_r.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool SpecifyGraphInputFormat::Run(const FuncGraphPtr &graph) { MS_CHECK_TRUE_MSG(graph != nullptr, false, "graph is nullptr!"); @@ -232,4 +232,4 @@ bool SpecifyGraphInputFormat::GetCurGraphInputFormat(const FuncGraphPtr &func_gr return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/specify_graph_input_format.h b/mindspore-lite/tools/optimizer/graph/specify_graph_input_format.h index 12d51a4cd5ecb6b3f0785ef8fa9e2bf4dfb8bb8f..0c84d5bb8bcdde76efe959b76c33a7cf94088dac 100644 --- a/mindspore-lite/tools/optimizer/graph/specify_graph_input_format.h +++ b/mindspore-lite/tools/optimizer/graph/specify_graph_input_format.h @@ -23,7 +23,7 @@ #include "include/api/types.h" #include "include/registry/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class SpecifyGraphInputFormat : public Pass { public: @@ -44,6 +44,6 @@ class SpecifyGraphInputFormat : public Pass { mindspore::Format cur_graph_input_format_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SPECIFY_GRAPH_INPUT_FORMAT_H_ diff --git a/mindspore-lite/tools/optimizer/graph/specify_graph_output_format.cc b/mindspore-lite/tools/optimizer/graph/specify_graph_output_format.cc index 18debeb7e7eabcaa5b7410e79252f7ce347f81e0..8d396bea4f167a3bcaf55ba39d5b158828efa6bc 100644 --- a/mindspore-lite/tools/optimizer/graph/specify_graph_output_format.cc +++ b/mindspore-lite/tools/optimizer/graph/specify_graph_output_format.cc @@ -33,7 +33,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_d.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool SpecifyGraphOutputFormat::Run(const FuncGraphPtr &graph) { MS_ASSERT(graph != nullptr); @@ -136,4 +136,4 @@ STATUS SpecifyGraphOutputFormat::HandleGraphOutput(const FuncGraphPtr &graph) { return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/specify_graph_output_format.h b/mindspore-lite/tools/optimizer/graph/specify_graph_output_format.h index 1b75110cba6579097a1be9e72875bb4bb1044f43..b154c1254df9c5f2e918cc8c2ccf170c8830e8b2 100644 --- a/mindspore-lite/tools/optimizer/graph/specify_graph_output_format.h +++ b/mindspore-lite/tools/optimizer/graph/specify_graph_output_format.h @@ -23,7 +23,7 @@ #include "include/api/types.h" #include "include/registry/converter_context.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class SpecifyGraphOutputFormat : public Pass { public: @@ -37,6 +37,6 @@ class SpecifyGraphOutputFormat : public Pass { mindspore::Format exp_graph_output_format_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SPECIFY_GRAPH_OUTPUT_FORMAT_H_ diff --git a/mindspore-lite/tools/optimizer/graph/split_one_pass.cc b/mindspore-lite/tools/optimizer/graph/split_one_pass.cc index 558dd11aaf587595b8e3dfaefffc6e28c380ba76..6e790ec758747d178b102a6d9388d1f4181fd25c 100644 --- a/mindspore-lite/tools/optimizer/graph/split_one_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/split_one_pass.cc @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kMinCnodeSize = 2; @@ -79,4 +79,4 @@ bool SplitOnePass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/split_one_pass.h b/mindspore-lite/tools/optimizer/graph/split_one_pass.h index 408ceb16dde5fec4eb0f3891cb4702e20314f660..f6bb62ce7a882c3ea5398463632150f5f6c6c518 100644 --- a/mindspore-lite/tools/optimizer/graph/split_one_pass.h +++ b/mindspore-lite/tools/optimizer/graph/split_one_pass.h @@ -27,7 +27,7 @@ #include "tools/optimizer/graph/transpose_strategy.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class SplitOnePass : public Pass { public: @@ -36,5 +36,5 @@ class SplitOnePass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SPLIT_ONE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/split_with_size_op_pass.cc b/mindspore-lite/tools/optimizer/graph/split_with_size_op_pass.cc index 5160acdbe2f16925026b28310864b65595ea7780..27646f3f85149629359b1a79d3aa9d2597d1b8fc 100644 --- a/mindspore-lite/tools/optimizer/graph/split_with_size_op_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/split_with_size_op_pass.cc @@ -33,7 +33,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { AnfNodePtr SplitWithSizeOpPass::SplitWithSizeMapperToSplitV(const FuncGraphPtr &func_graph, const CNodePtr &cnode) { MS_EXCEPTION_IF_NULL(cnode); @@ -101,4 +101,4 @@ bool SplitWithSizeOpPass::Run(const FuncGraphPtr &func_graph) { MS_CHECK_TRUE_RET(status != lite::RET_ERROR, false); return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/split_with_size_op_pass.h b/mindspore-lite/tools/optimizer/graph/split_with_size_op_pass.h index c74019ac3984e736553b3b34b40fab86ed2c8209..7d60e87b0730ebfe37a591104393511864a25fc9 100644 --- a/mindspore-lite/tools/optimizer/graph/split_with_size_op_pass.h +++ b/mindspore-lite/tools/optimizer/graph/split_with_size_op_pass.h @@ -22,7 +22,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class SplitWithSizeOpPass : public Pass { public: SplitWithSizeOpPass() : Pass("split_with_size_op_pass") {} @@ -38,5 +38,5 @@ class SplitWithSizeOpPass : public Pass { const std::string kAttrNameSizeSplits = "size_splits"; const std::string kAttrNameSplitDim = "split_dim"; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_SPLIT_WITH_SIZE_OP_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/transpose_strategy.cc b/mindspore-lite/tools/optimizer/graph/transpose_strategy.cc index afccb911aaf81b9c28a5d48118dffbdc13374840..1ae85f3129e665f39df1d6671d94d704055d7aa8 100644 --- a/mindspore-lite/tools/optimizer/graph/transpose_strategy.cc +++ b/mindspore-lite/tools/optimizer/graph/transpose_strategy.cc @@ -41,7 +41,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_s.h" #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kFirstInput = 1; @@ -580,4 +580,4 @@ void TransposeStrategy::DecidePreAndPostTransType(const TransTypePair *trans_inf } } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/transpose_strategy.h b/mindspore-lite/tools/optimizer/graph/transpose_strategy.h index c4ac9eb7915a6e2c57f76edd9f1e8216febaa029..063b651f62b13377fa9d03a4938fdecd035f0411 100644 --- a/mindspore-lite/tools/optimizer/graph/transpose_strategy.h +++ b/mindspore-lite/tools/optimizer/graph/transpose_strategy.h @@ -25,7 +25,7 @@ #include "tools/optimizer/graph/node_infershape.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class TransposeStrategy { public: @@ -54,6 +54,6 @@ class TransposeStrategy { NodeInferShape node_infer_shape_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_TRANSPOSE_STRATEGY_H_ diff --git a/mindspore-lite/tools/optimizer/graph/unused_add_node_remove_pass.cc b/mindspore-lite/tools/optimizer/graph/unused_add_node_remove_pass.cc index 7c16ab2ffe31c0d4fc13aa712ad86b4927e7e6e2..4e2485a6615419b415be853e57ae238ba9164456 100644 --- a/mindspore-lite/tools/optimizer/graph/unused_add_node_remove_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/unused_add_node_remove_pass.cc @@ -30,7 +30,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_m.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { constexpr size_t kAddInputSize = 3; @@ -107,4 +107,4 @@ bool RemoveUnusedAddNodePass::Run(const FuncGraphPtr &func_graph) { return true; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/graph/unused_add_node_remove_pass.h b/mindspore-lite/tools/optimizer/graph/unused_add_node_remove_pass.h index 249a9c9d2bd7ff52c740a0c8a9b8b2d00d8c38aa..1cc8c35f0deb7ffc2ca57c78f6c5bcc57d9ea1a6 100644 --- a/mindspore-lite/tools/optimizer/graph/unused_add_node_remove_pass.h +++ b/mindspore-lite/tools/optimizer/graph/unused_add_node_remove_pass.h @@ -27,7 +27,7 @@ #include "tools/optimizer/graph/transpose_strategy.h" using mindspore::converter::FmkType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class RemoveUnusedAddNodePass : public Pass { public: @@ -36,6 +36,6 @@ class RemoveUnusedAddNodePass : public Pass { bool Run(const FuncGraphPtr &func_graph) override; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_REMOVE_ADD_0_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/unused_transpose_node_remove_pass.cc b/mindspore-lite/tools/optimizer/graph/unused_transpose_node_remove_pass.cc index 5bdbb51fea876aa7b8eb0ea89cc16655bb3b5862..d7f6515fcfb442308997880cf61caf55756ed864 100644 --- a/mindspore-lite/tools/optimizer/graph/unused_transpose_node_remove_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/unused_transpose_node_remove_pass.cc @@ -28,7 +28,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_t.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { constexpr size_t kTransposeInput = 1; constexpr size_t kTransposeInputNum = 3; const std::vector kPermNCHW{0, 3, 1, 2}; @@ -119,4 +119,4 @@ bool RemoveUnusedTransposeOpPass::Run(const FuncGraphPtr &func_graph) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/unused_transpose_node_remove_pass.h b/mindspore-lite/tools/optimizer/graph/unused_transpose_node_remove_pass.h index e5e95fa1fc157493c4e936c94117b8b2a5263ba4..7d6b547a62634af55f2a7929b5df01be102315cf 100644 --- a/mindspore-lite/tools/optimizer/graph/unused_transpose_node_remove_pass.h +++ b/mindspore-lite/tools/optimizer/graph/unused_transpose_node_remove_pass.h @@ -21,7 +21,7 @@ #include "include/registry/converter_context.h" using mindspore::converter::FmkType; -namespace mindspore::opt { +namespace mindspore::lite::opt { class RemoveUnusedTransposeOpPass : public Pass { public: RemoveUnusedTransposeOpPass() : Pass("remove_unused_cast_pass") {} @@ -32,5 +32,5 @@ class RemoveUnusedTransposeOpPass : public Pass { private: FmkType fmk_type = converter::kFmkTypeTf; }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_UNUSED_TRANSPOSE_NODE_REMOVE_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/graph/update_conv2d_param_pass.cc b/mindspore-lite/tools/optimizer/graph/update_conv2d_param_pass.cc index 0c274ea3a13ea58b4748445c2c9dced19b50f121..cf28356b323e258fe499b06e534e8c6dd3d064a0 100644 --- a/mindspore-lite/tools/optimizer/graph/update_conv2d_param_pass.cc +++ b/mindspore-lite/tools/optimizer/graph/update_conv2d_param_pass.cc @@ -26,7 +26,7 @@ #include "mindspore/ops/op_def/auto_generate/gen_ops_primitive_c.h" #include "mindspore/core/include/ir/graph_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { namespace { void SetConvAttr(const PrimitivePtr &prim, const std::vector &kernel_size, int64_t in_channel, int64_t out_channel) { @@ -121,4 +121,4 @@ bool UpdateConv2DParamPass::Run(const FuncGraphPtr &func_graph) { } return true; } -} // namespace mindspore::opt +} // namespace mindspore::lite::opt diff --git a/mindspore-lite/tools/optimizer/graph/update_conv2d_param_pass.h b/mindspore-lite/tools/optimizer/graph/update_conv2d_param_pass.h index 79b926b93cfe45ff08691bdfdafebc7ee03f14f2..b6f867eb546f1035a96ceafb40900d70dd377afd 100644 --- a/mindspore-lite/tools/optimizer/graph/update_conv2d_param_pass.h +++ b/mindspore-lite/tools/optimizer/graph/update_conv2d_param_pass.h @@ -20,7 +20,7 @@ #include "include/backend/optimizer/pass.h" #include "tools/optimizer/common/gllo_utils.h" -namespace mindspore::opt { +namespace mindspore::lite::opt { class UpdateConv2DParamPass : public Pass { public: UpdateConv2DParamPass() : Pass("UpdateConv2DParamPass") {} @@ -30,5 +30,5 @@ class UpdateConv2DParamPass : public Pass { private: STATUS UpdateConv2DAttr(const CNodePtr &cnode); }; -} // namespace mindspore::opt +} // namespace mindspore::lite::opt #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_GRAPH_UPDATE_CONV2D_PARAM_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/conv2d_info.cc b/mindspore-lite/tools/optimizer/parallel/conv2d_info.cc index 06daaae828eb3fa6996c49ed22afd21a616df72e..8af3cd98c668ca61b3a91e51bac52595f32d0b5b 100644 --- a/mindspore-lite/tools/optimizer/parallel/conv2d_info.cc +++ b/mindspore-lite/tools/optimizer/parallel/conv2d_info.cc @@ -36,7 +36,7 @@ #include "utils/anf_utils.h" using mindspore::schema::PrimitiveType_Conv2DFusion; -namespace mindspore { +namespace mindspore::lite { namespace opt { constexpr auto kConvWithBias = 4; constexpr auto kAnfConvInput = 1; @@ -412,4 +412,4 @@ int Conv2DInfo::InferReplaceOp() { OPERATOR_INFO_REGISTER(PrimitiveType_Conv2DFusion, kNumberTypeFloat32, false, OperatorInfoCreator) OPERATOR_INFO_REGISTER(PrimitiveType_Conv2DFusion, kNumberTypeInt8, false, OperatorInfoCreator) } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/conv2d_info.h b/mindspore-lite/tools/optimizer/parallel/conv2d_info.h index 2318b59edfe92fb9596c55c684af7e657362458c..23e90b6dc121af3fb6b80b9a8df0a6d7a4242df8 100644 --- a/mindspore-lite/tools/optimizer/parallel/conv2d_info.h +++ b/mindspore-lite/tools/optimizer/parallel/conv2d_info.h @@ -25,7 +25,7 @@ #include "infer/cxx_api/conv2d_fusion.h" #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class Conv2DInfo : public OperatorInfo { @@ -55,6 +55,6 @@ class Conv2DInfo : public OperatorInfo { size_t dev_index, int cin_sum, int cout_sum); }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_CONV2D_INFO_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/depthwise_conv2d_info.cc b/mindspore-lite/tools/optimizer/parallel/depthwise_conv2d_info.cc index 7cb15ba0052a48234a0b5d27fc5e27e00bf98b2f..aec18207b658210d3f8833b63a1c3ae96f56312c 100644 --- a/mindspore-lite/tools/optimizer/parallel/depthwise_conv2d_info.cc +++ b/mindspore-lite/tools/optimizer/parallel/depthwise_conv2d_info.cc @@ -39,7 +39,7 @@ using mindspore::schema::PrimitiveType_Conv2DFusion; #include "ir/tensor_new.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { void SplitConstantData(char *in_data, char **out_data, int64_t num_split, int64_t split_dim_size, int64_t element_bytes, @@ -521,4 +521,4 @@ int DepthwiseConv2DInfo::InferReplaceOp() { OPERATOR_INFO_REGISTER(PrimitiveType_Conv2DFusion, kNumberTypeFloat32, true, OperatorInfoCreator) OPERATOR_INFO_REGISTER(PrimitiveType_Conv2DFusion, kNumberTypeInt8, true, OperatorInfoCreator) } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/depthwise_conv2d_info.h b/mindspore-lite/tools/optimizer/parallel/depthwise_conv2d_info.h index 81e6ebec12bce0f581219a63811251a0089fabef..76816f05a47c1db657f88d8bee93ede1aa5f1594 100644 --- a/mindspore-lite/tools/optimizer/parallel/depthwise_conv2d_info.h +++ b/mindspore-lite/tools/optimizer/parallel/depthwise_conv2d_info.h @@ -23,7 +23,7 @@ #include "tools/optimizer/parallel/conv2d_info.h" #include "infer/cxx_api/conv2d_fusion.h" #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class DepthwiseConv2DInfo : public Conv2DInfo { public: @@ -63,6 +63,6 @@ class DepthwiseConv2DInfo : public Conv2DInfo { }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_DEPTHWISE_CONV2D_INFO_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/multi_conv_info.cc b/mindspore-lite/tools/optimizer/parallel/multi_conv_info.cc index d143584417761b2e1a99af857d31153eb80d31d6..175dd35cdeedb036ce2dacf39426c47b90248c2f 100644 --- a/mindspore-lite/tools/optimizer/parallel/multi_conv_info.cc +++ b/mindspore-lite/tools/optimizer/parallel/multi_conv_info.cc @@ -25,7 +25,7 @@ #include "ops_utils/op_utils.h" using mindspore::schema::PrimitiveType_Conv2dTransposeFusion; -namespace mindspore { +namespace mindspore::lite { namespace opt { int MultiConvSplit::GenSplitInfo() { split_info_.out_num = static_cast(this->strategy_.dev_num); @@ -302,4 +302,4 @@ AnfNodePtr MultiConvSplitCIN::SplitMultiConv(const AnfNodePtr &node) { return nu AnfNodePtr MultiConvSplitCOUT::SplitMultiConv(const AnfNodePtr &node) { return nullptr; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/multi_conv_info.h b/mindspore-lite/tools/optimizer/parallel/multi_conv_info.h index aaf8e57ccc436de0b3ba9e250ed02b21bd150893..7f96da33d3d6b31b9351d758517cd930a0ce583c 100644 --- a/mindspore-lite/tools/optimizer/parallel/multi_conv_info.h +++ b/mindspore-lite/tools/optimizer/parallel/multi_conv_info.h @@ -20,7 +20,7 @@ #include "tools/optimizer/parallel/multi_node_split.h" #include "tools/optimizer/fisson/fisson_util.h" #include "infer/cxx_api/conv2d_fusion.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { class MultiConvSplit : public MultiNodeSplit { public: @@ -112,5 +112,5 @@ class MultiConvSplitH final : public MultiConvSplit { }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_MULTI_CONV_INFO_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/multi_node_split.cc b/mindspore-lite/tools/optimizer/parallel/multi_node_split.cc index 3cb6fae13500d6efdc5bd7e5a94b8f0edceb3ea0..d44d8885d46f89f946d86d2772f5afd168e4037c 100644 --- a/mindspore-lite/tools/optimizer/parallel/multi_node_split.cc +++ b/mindspore-lite/tools/optimizer/parallel/multi_node_split.cc @@ -18,7 +18,7 @@ #include "tools/optimizer/parallel/multi_node_split.h" #include "tools/optimizer/parallel/multi_conv_info.h" #include "nnacl_c/op_base.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { int MultiNodeSplitProxy::InitResource() { @@ -58,4 +58,4 @@ AnfNodePtr MultiNodeSplitProxy::DoSplit(const FuncGraphPtr &func_graph, const An } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/multi_node_split.h b/mindspore-lite/tools/optimizer/parallel/multi_node_split.h index f3fab761c3f1cf8f66a24a852cba01dd47387c97..5c9a89e9a923ab097a36b0eb22d1a44a764d01f0 100644 --- a/mindspore-lite/tools/optimizer/parallel/multi_node_split.h +++ b/mindspore-lite/tools/optimizer/parallel/multi_node_split.h @@ -23,7 +23,7 @@ #include "base/base.h" using mindspore::schema::PrimitiveType; -namespace mindspore { +namespace mindspore::lite { namespace opt { class MultiNodeSplit { public: @@ -57,5 +57,5 @@ class MultiNodeSplitProxy : public MultiNodeSplit { std::shared_ptr multi_node_split_{nullptr}; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_MULTI_NODE_SPLIT_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/operator_info.cc b/mindspore-lite/tools/optimizer/parallel/operator_info.cc index 8075b7ce05f2030ef0bb5cfae2afc78ded1f129c..6522e9213103b275814091aab484979901fe1c2a 100644 --- a/mindspore-lite/tools/optimizer/parallel/operator_info.cc +++ b/mindspore-lite/tools/optimizer/parallel/operator_info.cc @@ -26,7 +26,7 @@ #include "ops_utils/op_utils.h" #include "src/common/log_util.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { bool is_any_none(const std::vector &split) { return std::any_of(split.begin(), split.end(), [](int64_t v) { return v == static_cast(NoSplit); }); @@ -224,4 +224,4 @@ int OperatorInfo::DoSplit() { return lite::RET_OK; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/operator_info.h b/mindspore-lite/tools/optimizer/parallel/operator_info.h index cdb33fcd585a50dc489fbb1b3aa3cbb2fcfa923b..77e823b4003e0483e5516bce210673fa49f5cc30 100644 --- a/mindspore-lite/tools/optimizer/parallel/operator_info.h +++ b/mindspore-lite/tools/optimizer/parallel/operator_info.h @@ -28,7 +28,7 @@ #include "schema/model_generated.h" #include "include/errorcode.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { /** * Do following steps to make a operator support parallel: @@ -103,6 +103,6 @@ bool is_any_none(const std::vector &split); bool is_any_not_none(const std::vector &split); } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_OPERATOR_INFO_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/operator_info_register.cc b/mindspore-lite/tools/optimizer/parallel/operator_info_register.cc index d99d46a1a3d1f0c8da4cd220514d0bebf6a86948..0a61950f936ed882b2095fe268205111d2058ca7 100644 --- a/mindspore-lite/tools/optimizer/parallel/operator_info_register.cc +++ b/mindspore-lite/tools/optimizer/parallel/operator_info_register.cc @@ -16,7 +16,7 @@ #include "tools/optimizer/parallel/operator_info_register.h" #include -namespace mindspore { +namespace mindspore::lite { namespace opt { // find the only key of operator_info @@ -62,4 +62,4 @@ OperatorInfoRegister::OperatorInfoRegister(schema::PrimitiveType operator_type, OperatorInfoFactory::GeInstance()->RegisterOperatorInfo(operator_type, type_id, is_depth_wise, creator_func); } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/operator_info_register.h b/mindspore-lite/tools/optimizer/parallel/operator_info_register.h index 01dc0cab4cdbded7fbd9a8d46594766e64f8fd9b..0386c7615643097a8147fa911602130eac8d368e 100644 --- a/mindspore-lite/tools/optimizer/parallel/operator_info_register.h +++ b/mindspore-lite/tools/optimizer/parallel/operator_info_register.h @@ -23,7 +23,7 @@ #include #include "tools/optimizer/parallel/operator_info.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { using OperatorInfoCreatorFunc = std::function(const std::string &name, const SplitStrategy &strategy)>; @@ -85,6 +85,6 @@ class OperatorInfoRegister { static OperatorInfoRegister g_name##operator_type##type_id##is_depth_wise##Creator(operator_type, type_id, \ is_depth_wise, creator_func); } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_OPERATOR_INFO_REGISTER_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/parallel_pass.cc b/mindspore-lite/tools/optimizer/parallel/parallel_pass.cc index 4dd3e50d0497cb369b3bb3b992bc01625aacba00..c49d7db7734c360af019434fa32ddd7411f4b4e8 100644 --- a/mindspore-lite/tools/optimizer/parallel/parallel_pass.cc +++ b/mindspore-lite/tools/optimizer/parallel/parallel_pass.cc @@ -23,7 +23,7 @@ #include "nnacl_c/op_base.h" #include "ops_utils/op_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { namespace { @@ -142,4 +142,4 @@ AnfNodePtr ParallelPass::Run(const FuncGraphPtr &func_graph, const AnfNodePtr &n return parallel_operator->replace_op(); } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/parallel_pass.h b/mindspore-lite/tools/optimizer/parallel/parallel_pass.h index 9fd4bb479996d378a665773d6ded5ffcc8d990ef..acc7e03ca735cdb8d7f7f7678091c0be0e8fd846 100644 --- a/mindspore-lite/tools/optimizer/parallel/parallel_pass.h +++ b/mindspore-lite/tools/optimizer/parallel/parallel_pass.h @@ -28,7 +28,7 @@ #ifndef MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_PARALLEL_PASS_H_ #define MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_PARALLEL_PASS_H_ -namespace mindspore { +namespace mindspore::lite { namespace opt { class ParallelPass : public opt::LiteNodePass { public: @@ -56,6 +56,6 @@ class ParallelPass : public opt::LiteNodePass { }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_PARALLEL_PASS_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/split_strategy.cc b/mindspore-lite/tools/optimizer/parallel/split_strategy.cc index e76b036afb7037363c09cf4eff687aae42f1ebbd..92556a014b037d3bcc9e77992d22eff5832c4c78 100644 --- a/mindspore-lite/tools/optimizer/parallel/split_strategy.cc +++ b/mindspore-lite/tools/optimizer/parallel/split_strategy.cc @@ -22,7 +22,7 @@ #include "nnacl_c/op_base.h" #include "src/common/log_util.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { int64_t ApproximateFLOPs(const std::vector &strides, const std::vector &input_shape, @@ -85,4 +85,4 @@ std::unordered_map ParserSplitStrategy(const st return split_strategys; } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/split_strategy.h b/mindspore-lite/tools/optimizer/parallel/split_strategy.h index 745e0882da55c53053b557ce16b142d9030e8feb..a02a3e778fe6395a3bed1affce275f020c59b597 100644 --- a/mindspore-lite/tools/optimizer/parallel/split_strategy.h +++ b/mindspore-lite/tools/optimizer/parallel/split_strategy.h @@ -27,7 +27,7 @@ #include "mindspore/ops/op_def/lite_ops.h" #include "include/lite_types.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { constexpr auto PARALLEL_NAME_SUFFIX = "_parallel"; @@ -109,5 +109,5 @@ std::unordered_map ParserSplitStrategy( SplitMode split_mode); } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_SPLIT_STRATEGY_H_ diff --git a/mindspore-lite/tools/optimizer/parallel/spliter.cc b/mindspore-lite/tools/optimizer/parallel/spliter.cc index 443a9c17246a389185965f9645c439c78a41f575..199cdd75b714631928d8c4aec73c1d2c33755b9d 100644 --- a/mindspore-lite/tools/optimizer/parallel/spliter.cc +++ b/mindspore-lite/tools/optimizer/parallel/spliter.cc @@ -21,7 +21,7 @@ #include "tools/optimizer/parallel/split_strategy.h" #include "ops_utils/op_utils.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { Spliter *Spliter::GetInstance() { static Spliter spliter; @@ -147,4 +147,4 @@ void Spliter::UpdateNodeOutputShapes(const std::string &node_name, const std::ve } } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite diff --git a/mindspore-lite/tools/optimizer/parallel/spliter.h b/mindspore-lite/tools/optimizer/parallel/spliter.h index 985c6248e7c4767dcb46ac2eeacc75cb653ee697..6f703c889b54a7d396007512fc530e5438f64758 100644 --- a/mindspore-lite/tools/optimizer/parallel/spliter.h +++ b/mindspore-lite/tools/optimizer/parallel/spliter.h @@ -24,7 +24,7 @@ #include "include/common/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" #include "include/lite_types.h" -namespace mindspore { +namespace mindspore::lite { namespace opt { struct IntCompare { bool operator()(const int &lhs, const int &rhs) const { return lhs > rhs; } @@ -82,5 +82,5 @@ class Spliter { std::set match_numbers_; }; } // namespace opt -} // namespace mindspore +} // namespace mindspore::lite #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_PARALLEL_SPLITER_H_