Imported Upstream version 1.8.0
[platform/core/ml/nnfw.git] / compiler / luci-interpreter / include / luci_interpreter / core / Tensor.h
index 9987898..4ac3d86 100644 (file)
@@ -79,12 +79,11 @@ private:
 //
 // Note that due to historical and performance reasons, per-tensor quantization uses unsigned
 // integer types, while per-channel uses signed types assuming 'zero_point' == 0.
-//
-// TODO Add 'quantized_dimension' field for per-channel case when IR provides it.
 struct AffineQuantization
 {
   std::vector<float> scale;
   std::vector<int32_t> zero_point;
+  int32_t quantized_dimension;
 };
 
 class Tensor
@@ -108,6 +107,12 @@ public:
     return _quantization.zero_point[0];
   }
 
+  const std::vector<float> &scales() const { return _quantization.scale; }
+
+  const std::vector<int32_t> &zero_points() const { return _quantization.zero_point; }
+
+  int32_t quantized_dimension() const { return _quantization.quantized_dimension; }
+
   template <typename T> const T *data() const { return reinterpret_cast<const T *>(_data.get()); }
 
   template <typename T> T *data() { return reinterpret_cast<T *>(_data.get()); }