/** * 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_LITE_TOOLS_OPTIMIZER_FISSON_FISSON_UTIL_H_ #define MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_FISSON_UTIL_H_ #include #include #include #include "schema/inner/model_generated.h" #include "mindspore/ccsrc/utils/utils.h" #include "tools/optimizer/common/gllo_utils.h" #include "tools/converter/converter_flags.h" #include "mindspore/lite/include/context.h" #include "mindspore/lite/include/lite_types.h" namespace mindspore { using mindspore::schema::PrimitiveType; namespace opt { extern std::unordered_map> g_graph_nodes_output; extern std::unordered_map>> g_graph_nodes_out_shapes; struct SplitInfo { int32_t axis; int32_t out_num; std::vector size_splits; std::vector extend_top; std::vector extend_bottom; std::vector dev_types; int32_t in_num_conv; int32_t fmk_type; std::vector weight_channel; PrimitiveType primitive_type; }; typedef enum { CUT_N, CUT_H, CUT_W, CUT_C_IN, CUT_C_OUT, CUT_NONE } CuttingStragedy; void GetMultipleOutputsOfAnfNode(const FuncGraphPtr &func_graph, const AnfNodePtr &node, size_t output_num, std::vector *outputs); AnfNodePtr CreateOutputsOfConcat(const FuncGraphPtr &func_graph, const CNodePtr &conv_cnode, const std::vector &conv_outputs, const SplitInfo &split_info, const std::string &node_name); void CreateOutputsOfSplitWithOverlap(const FuncGraphPtr &func_graph, const CNodePtr &conv_cnode, std::vector *split_outputs, const SplitInfo &split_info, const std::string &node_name); void GetCNodeShapeInfo(const FuncGraphPtr &func_graph, int32_t fmk_type); AnfNodePtr CreateOutputsOfAddN(const FuncGraphPtr &func_graph, const CNodePtr &conv_cnode, const std::vector &conv_outputs, const SplitInfo &split_info, const std::string &node_name); } // namespace opt } // namespace mindspore #endif // MINDSPORE_LITE_TOOLS_OPTIMIZER_FISSON_FISSON_UTIL_H_