| 1 | // Tencent is pleased to support the open source community by making ncnn available. |
| 2 | // |
| 3 | // Copyright (C) 2024 THL A29 Limited, a Tencent company. All rights reserved. |
| 4 | // |
| 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except |
| 6 | // in compliance with the License. You may obtain a copy of the License at |
| 7 | // |
| 8 | // https://opensource.org/licenses/BSD-3-Clause |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software distributed |
| 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 13 | // specific language governing permissions and limitations under the License. |
| 14 | |
| 15 | #include "onnx-ml.pb.h" |
| 16 | |
| 17 | namespace pnnx { |
| 18 | |
| 19 | namespace onnx2pnnx { |
| 20 | |
| 21 | struct ModelStat |
| 22 | { |
| 23 | ModelStat() |
| 24 | { |
| 25 | node_size = 0; |
| 26 | initializer_size = 0; |
| 27 | functions_size = 0; |
| 28 | |
| 29 | nn_module_count = 0; |
| 30 | custom_module_count = 0; |
| 31 | aten_count = 0; |
| 32 | prims_count = 0; |
| 33 | onnx_count = 0; |
| 34 | } |
| 35 | |
| 36 | int node_size; |
| 37 | int initializer_size; |
| 38 | int functions_size; |
| 39 | |
| 40 | int nn_module_count; |
| 41 | int custom_module_count; |
| 42 | int aten_count; |
| 43 | int prims_count; |
| 44 | int onnx_count; |
| 45 | |
| 46 | std::map<std::string, int> nn_module_op_count; |
| 47 | std::map<std::string, int> aten_op_count; |
| 48 | std::map<std::string, int> prims_op_count; |
| 49 | std::map<std::string, int> onnx_op_count; |
| 50 | }; |
| 51 | |
| 52 | ModelStat get_model_stat(const onnx::ModelProto& model); |
| 53 | |
| 54 | void print_model_stat(const ModelStat& oldstat, const ModelStat& newstat); |
| 55 | |
| 56 | } // namespace onnx2pnnx |
| 57 | |
| 58 | } // namespace pnnx |