• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CORE_MINDAPI_BASE_TYPE_ID_H_
18 #define MINDSPORE_CORE_MINDAPI_BASE_TYPE_ID_H_
19 
20 namespace mindspore {
21 /// \brief TypeId defines data type identifiers.
22 enum TypeId : int {
23   kTypeUnknown = 0,
24   //
25   // Meta types.
26   //
27   kMetaTypeBegin = kTypeUnknown,
28   kMetaTypeType,  // Type
29   kMetaTypeAny,
30   kMetaTypeObject,
31   kMetaTypeTypeType,  // TypeType
32   kMetaTypeProblem,
33   kMetaTypeExternal,
34   kMetaTypeNone,
35   kMetaTypeNull,
36   kMetaTypeEllipsis,
37   kMetaTypeEnd,
38   //
39   // Object types
40   //
41   kObjectTypeBegin = kMetaTypeEnd,
42   kObjectTypeNumber,
43   kObjectTypeString,
44   kObjectTypeList,
45   kObjectTypeTuple,
46   kObjectTypeSlice,
47   kObjectTypeKeyword,
48   kObjectTypeTensorType,
49   kObjectTypeRowTensorType,
50   kObjectTypeCOOTensorType,
51   kObjectTypeUndeterminedType,
52   kObjectTypeClass,
53   kObjectTypeDictionary,
54   kObjectTypeFunction,
55   kObjectTypeJTagged,
56   kObjectTypeSymbolicKeyType,
57   kObjectTypeEnvType,
58   kObjectTypeRefKey,
59   kObjectTypeRef,
60   kObjectTypeEnd,
61   //
62   // Number Types
63   //
64   kNumberTypeBegin = kObjectTypeEnd,
65   kNumberTypeBool,
66   kNumberTypeInt,
67   kNumberTypeInt8,
68   kNumberTypeInt16,
69   kNumberTypeInt32,
70   kNumberTypeInt64,
71   kNumberTypeUInt,
72   kNumberTypeUInt8,
73   kNumberTypeUInt16,
74   kNumberTypeUInt32,
75   kNumberTypeUInt64,
76   kNumberTypeFloat,
77   kNumberTypeFloat16,
78   kNumberTypeFloat32,
79   kNumberTypeFloat64,
80   kNumberTypeBFloat16,
81   kNumberTypeDouble,
82   kNumberTypeComplex,
83   kNumberTypeComplex64,
84   kNumberTypeComplex128,
85   kNumberTypeInt4,
86   kNumberTypeGLUInt,
87   kNumberTypeEnd,
88   //
89   // Monad Types
90   //
91   kMonadTypeBegin = kNumberTypeEnd,
92   kObjectTypeMonad,
93   kObjectTypeUMonad,
94   kObjectTypeIOMonad,
95   kMonadTypeEnd,
96   //
97   // Sparse Types
98   //
99   kSparseTypeBegin = kMonadTypeEnd,
100   kObjectTypeCSRTensorType,
101   kObjectTypeSparseTensorType,
102   kObjectTypeMapTensorType,
103   kSparseTypeEnd,
104   // New types should placed at the end of enum,
105   // in order to keep fit with the type of existing model on the lite side.
106 };
107 
108 /// \brief QuantDataType defines data type for quantization: int1-int16, uint1-uint16.
109 enum QuantDataType : int {
110   kQuantDataTypeInt1 = 0,
111   kQuantDataTypeInt2,
112   kQuantDataTypeInt3,
113   kQuantDataTypeInt4,
114   kQuantDataTypeInt5,
115   kQuantDataTypeInt6,
116   kQuantDataTypeInt7,
117   kQuantDataTypeInt8,
118   kQuantDataTypeInt9,
119   kQuantDataTypeInt10,
120   kQuantDataTypeInt11,
121   kQuantDataTypeInt12,
122   kQuantDataTypeInt13,
123   kQuantDataTypeInt14,
124   kQuantDataTypeInt15,
125   kQuantDataTypeInt16,
126 
127   kQuantDataTypeUInt1 = 100,
128   kQuantDataTypeUInt2,
129   kQuantDataTypeUInt3,
130   kQuantDataTypeUInt4,
131   kQuantDataTypeUInt5,
132   kQuantDataTypeUInt6,
133   kQuantDataTypeUInt7,
134   kQuantDataTypeUInt8,
135   kQuantDataTypeUInt9,
136   kQuantDataTypeUInt10,
137   kQuantDataTypeUInt11,
138   kQuantDataTypeUInt12,
139   kQuantDataTypeUInt13,
140   kQuantDataTypeUInt14,
141   kQuantDataTypeUInt15,
142   kQuantDataTypeUInt16,
143 };
144 }  // namespace mindspore
145 #endif  // MINDSPORE_CORE_MINDAPI_BASE_TYPE_ID_H_
146