| 150 | }; |
| 151 | |
| 152 | class TensorInfo |
| 153 | { |
| 154 | public: |
| 155 | /// Empty (invalid) constructor. |
| 156 | TensorInfo(); |
| 157 | |
| 158 | TensorInfo(const TensorShape& shape, |
| 159 | DataType dataType, |
| 160 | float quantizationScale = 1.0f, |
| 161 | int32_t quantizationOffset = 0, |
| 162 | bool isConstant = false); |
| 163 | |
| 164 | TensorInfo(unsigned int numDimensions, |
| 165 | const unsigned int* dimensionSizes, |
| 166 | DataType dataType, |
| 167 | float quantizationScale = 1.0f, |
| 168 | int32_t quantizationOffset = 0, |
| 169 | bool isConstant = false); |
| 170 | |
| 171 | TensorInfo(const TensorShape& shape, |
| 172 | DataType dataType, |
| 173 | const std::vector<float>& quantizationScales, |
| 174 | unsigned int quantizationDim, |
| 175 | bool isConstant = false); |
| 176 | |
| 177 | TensorInfo(unsigned int numDimensions, |
| 178 | const unsigned int* dimensionSizes, |
| 179 | DataType dataType, |
| 180 | const std::vector<float>& quantizationScales, |
| 181 | unsigned int quantizationDim, |
| 182 | bool isConstant = false); |
| 183 | |
| 184 | TensorInfo(const TensorInfo& other); |
| 185 | |
| 186 | TensorInfo& operator=(const TensorInfo& other); |
| 187 | |
| 188 | bool operator==(const TensorInfo& other) const; |
| 189 | bool operator!=(const TensorInfo& other) const; |
| 190 | |
| 191 | using DifferenceType = std::vector<TensorInfo>::difference_type; |
| 192 | |
| 193 | const TensorShape& GetShape() const { return m_Shape; } |
| 194 | TensorShape& GetShape() { return m_Shape; } |
| 195 | void SetShape(const TensorShape& newShape) { m_Shape = newShape; } |
| 196 | |
| 197 | unsigned int GetNumDimensions() const { return m_Shape.GetNumDimensions(); } |
| 198 | unsigned int GetNumElements() const { return m_Shape.GetNumElements(); } |
| 199 | |
| 200 | DataType GetDataType() const { return m_DataType; } |
| 201 | void SetDataType(DataType type) { m_DataType = type; } |
| 202 | |
| 203 | bool HasMultipleQuantizationScales() const { return m_Quantization.m_Scales.size() > 1; } |
| 204 | |
| 205 | bool HasPerAxisQuantization() const; |
| 206 | |
| 207 | std::vector<float> GetQuantizationScales() const; |
| 208 | void SetQuantizationScales(const std::vector<float>& scales); |
| 209 |
no outgoing calls