1 /** 2 * Copyright 2021 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MINDSPORE_LITE_TOOLS_ANF_EXPORTER_FETCH_CONTENT_H_ 18 #define MINDSPORE_LITE_TOOLS_ANF_EXPORTER_FETCH_CONTENT_H_ 19 20 #include <string> 21 #include <vector> 22 #include "ir/primitive.h" 23 #include "ir/func_graph.h" 24 #include "src/common/utils.h" 25 #include "tools/converter/converter_flags.h" 26 27 namespace mindspore { 28 namespace lite { 29 struct DataInfo { 30 bool enable_huffman_code_; 31 int format_; 32 int data_type_; 33 int node_type_; 34 std::vector<int> shape_; 35 std::vector<uint8_t> data_; DataInfoDataInfo36 DataInfo() : enable_huffman_code_(false), format_(0), data_type_(0), node_type_{0} {} 37 }; 38 39 int FetchFromDefaultParam(const ParameterPtr ¶m_node, const converter::FmkType &fmk_type, DataInfo *data_info); 40 41 int FetchDataFromParameterNode(const CNodePtr &cnode, size_t index, converter::FmkType fmk_type, bool train_flag, 42 DataInfo *data_info); 43 int FetchDataFromValueNode(const CNodePtr &cnode, size_t index, converter::FmkType fmk_type, bool train_flag, 44 DataInfo *data_info); 45 int FetchDataFromCNode(const CNodePtr &cnode, size_t index, converter::FmkType fmk_type, bool train_flag, 46 DataInfo *data_info); 47 int RemoveIfDepend(const CNodePtr &cnode); 48 49 int RemoveIfMakeTuple(const CNodePtr &cnode); 50 } // namespace lite 51 } // namespace mindspore 52 #endif // MINDSPORE_LITE_TOOLS_ANF_EXPORTER_FETCH_CONTENT_H_ 53