• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 Huawei Technologies Co., Ltd
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ============================================================================
15"""
16model related enum infos
17"""
18
19from enum import Enum
20
21
22class TaskType(Enum):
23    """task type enum"""
24    MODEL_INFER = "infer"
25    FRAMEWORK_CMP = "framework_cmp"
26    CONVERTER = "convert"
27    AUTO_CMP = "auto_cmp"
28    NPU_DYNAMIC_INFER = "npu_dynamic_infer"
29
30
31class DeviceType(Enum):
32    """device type enum"""
33    CPU = 'cpu'
34    ASCEND = 'ascend'
35    GPU = 'gpu'
36
37
38class FrameworkType(Enum):
39    """framework type enum"""
40    TF = 'TF'
41    ONNX = 'ONNX'
42    MSLITE = 'MSLITE'
43    PADDLE = 'PADDLE'
44
45
46class SaveFileType(Enum):
47    """save file type enum"""
48    DONT_SAVE = 'dont_save'
49    NPY = 'npy'
50    BIN = 'bin'
51
52
53class ErrorAlgType(Enum):
54    """
55    Algorithm types to calculate error between features
56    - MEAN_RELATIVE_ERROR: sum(abs(A-B) / A) / A.size
57    - COSINE_SIMILARITY: sum(A * B) / (sqrt(sum(A * A)) * sqrt(sum(B * B)))
58    """
59    MEAN_RELATIVE_ERROR = "mean_relative_error"
60    COSINE_SIMILARITY = "cosine_similarity"
61