add quantization type to tensor info 82/319982/1 accepted/tizen/9.0/unified/20241117.013210 accepted/tizen/unified/20241108.105523
authorInki Dae <inki.dae@samsung.com>
Wed, 6 Nov 2024 04:28:26 +0000 (13:28 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 6 Nov 2024 04:37:52 +0000 (13:37 +0900)
[Version] : 0.5.1
[Issue type] : new feature

Add quantization type to tensor info.

Change-Id: I502f90b22ee86393f88760ad0a4cebc8c0a4af09
Signed-off-by: Inki Dae <inki.dae@samsung.com>
include/inference_engine_type.h
packaging/inference-engine-interface.spec
test/src/inference_engine_profiler.cpp
test/src/inference_engine_tc.cpp
tools/src/inference_engine_cltuner.cpp

index 243af02d0a4cb1c149515cf4efaa375ada53e27b..6c5d1e5ec7c49aebe061e99469c147bc3dbbd7b2 100644 (file)
@@ -115,6 +115,16 @@ extern "C"
                INFERENCE_TENSOR_DATA_TYPE_MAX
        } inference_tensor_data_type_e;
 
+       /**
+        * @brief Enumeration for Tensor quantization type.
+        *
+        * @since_tizen 9.0
+        */
+       typedef enum {
+               INFERENCE_TENSOR_QUANTIZATION_NONE = 0,
+               INFERENCE_TENSOR_QUANTIZATION_AFFINE, /** < Affine quantization */
+       } inference_tensor_quantization_type_e;
+
        /**
         * @brief Enumeration for OPenCL Tuner type.
         *
@@ -211,6 +221,7 @@ extern "C"
                size_t size; /** tensor element size. The size should be height * width * channel count */
                float scale; /**< a scale value of the layer. */
                int zero_point; /**< a zero point value of the layer. */
+               inference_tensor_quantization_type_e quantization_type; /**< a quantization type of the layer. */
                // TODO.
        } inference_engine_tensor_info;
 
index f425ebb29513ec60e66d99e1148cbff394af143d..1541d70374182e206a493fc53f0d30eb2a72fc47 100644 (file)
@@ -1,6 +1,6 @@
 Name:        inference-engine-interface
 Summary:     Interface of inference engines
-Version:     0.5.0
+Version:     0.5.1
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0
index 15786fbdee1033bf4b7b649e98894578717820ba..d111725b4bc1887629c54ebfef4f20f0bbb6b246 100644 (file)
@@ -258,7 +258,7 @@ TEST_P(InferenceEngineTfliteTest, Inference)
                (inference_tensor_shape_type_e) INFERENCE_TENSOR_SHAPE_NCHW,
                (inference_tensor_data_type_e) tensor_type,
                (size_t)(1 * ch * height * width),
-               0.0f, 0
+               0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& layer : input_layers) {
@@ -276,7 +276,8 @@ TEST_P(InferenceEngineTfliteTest, Inference)
                INFERENCE_TENSOR_DATA_TYPE_FLOAT32,
                1,
                0.0f,
-               0
+               0,
+               INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& layer : output_layers) {
@@ -458,7 +459,7 @@ TEST_P(InferenceEngineTfliteCLTunerTest, Inference)
                INFERENCE_TENSOR_SHAPE_NCHW,
                static_cast<inference_tensor_data_type_e>(tensor_type),
                static_cast<size_t>(1 * ch * height * width),
-               0.0f, 0
+               0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& input : input_layers) {
@@ -476,7 +477,8 @@ TEST_P(InferenceEngineTfliteCLTunerTest, Inference)
                INFERENCE_TENSOR_DATA_TYPE_FLOAT32,
                1,
                0.0f,
-               0
+               0,
+               INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& layer : output_layers) {
@@ -632,7 +634,7 @@ TEST_P(InferenceEngineCaffeTest, Inference)
                INFERENCE_TENSOR_SHAPE_NCHW,
                (inference_tensor_data_type_e) tensor_type,
                (size_t)(1 * ch * height * width),
-               0.0f, 0
+               0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& layer : input_layers) {
@@ -650,7 +652,8 @@ TEST_P(InferenceEngineCaffeTest, Inference)
                INFERENCE_TENSOR_DATA_TYPE_FLOAT32,
                1,
                0.0f,
-               0
+               0,
+               INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& layer : output_layers) {
@@ -799,7 +802,7 @@ TEST_P(InferenceEngineDldtTest, Inference)
                INFERENCE_TENSOR_SHAPE_NCHW,
                (inference_tensor_data_type_e) tensor_type,
                (size_t)(1 * ch * height * width),
-               0.0f, 0
+               0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& layer : input_layers) {
@@ -816,7 +819,7 @@ TEST_P(InferenceEngineDldtTest, Inference)
                INFERENCE_TENSOR_SHAPE_NCHW,
                (inference_tensor_data_type_e) tensor_type,
                (size_t)(1 * ch * height * width),
-               0.0f, 0
+               0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& layer : output_layers) {
index f8d8bca5cd88505ec86648f76327dd2ba48935bb..d37116a4097d6ee60f96694e6f1ef29b09fbe5bb 100644 (file)
@@ -330,7 +330,7 @@ TEST_P(InferenceEngineTestCase_G4, SetInputLayer_P)
                        (inference_tensor_shape_type_e) INFERENCE_TENSOR_SHAPE_NCHW,
                        (inference_tensor_data_type_e) tensor_type,
                        (size_t)(1 * ch * height * width),
-                       0.0f, 0
+                       0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
                };
 
                input_property.layers.insert(std::make_pair(layer, tensor_info));
@@ -367,7 +367,7 @@ TEST_P(InferenceEngineTestCase_G5, SetInputLayer_N1)
                        (inference_tensor_shape_type_e) INFERENCE_TENSOR_SHAPE_NCHW,
                        (inference_tensor_data_type_e) tensor_type,
                        (size_t)(1 * ch * height * width),
-                       0.0f, 0
+                       0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
                };
 
                output_property.layers.insert(std::make_pair(layer, tensor_info));
@@ -424,7 +424,7 @@ TEST_P(InferenceEngineTestCase_G4, SetOutputLayer_P)
                        (inference_tensor_shape_type_e) INFERENCE_TENSOR_SHAPE_NCHW,
                        (inference_tensor_data_type_e) tensor_type,
                        (size_t)(1 * ch * height * width),
-                       0.0f, 0
+                       0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
                };
 
                output_property.layers.insert(std::make_pair(layer, tensor_info));
@@ -461,7 +461,7 @@ TEST_P(InferenceEngineTestCase_G5, SetOutputLayer_N1)
                        (inference_tensor_shape_type_e) INFERENCE_TENSOR_SHAPE_NCHW,
                        (inference_tensor_data_type_e) tensor_type,
                        (size_t)(1 * ch * height * width),
-                       0.0f, 0
+                       0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
                };
 
                output_property.layers.insert(std::make_pair(layer, tensor_info));
@@ -575,7 +575,7 @@ TEST_P(InferenceEngineTestCase_G6, Inference_P)
                (inference_tensor_shape_type_e) INFERENCE_TENSOR_SHAPE_NCHW,
                (inference_tensor_data_type_e) tensor_type,
                (size_t)(1 * ch * height * width),
-               0.0f, 0
+               0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE
        };
 
        for (auto& layer : input_layers) {
@@ -592,7 +592,8 @@ TEST_P(InferenceEngineTestCase_G6, Inference_P)
                                                        INFERENCE_TENSOR_DATA_TYPE_FLOAT32,
                                                        1,
                                                        0.0f,
-                                                       0};
+                                                       0,
+                                                       INFERENCE_TENSOR_QUANTIZATION_NONE};
        for (auto& layer : output_layers) {
                output_property.layers.insert(std::make_pair(layer, output_tensor_info));
        }
index aa082face57fee4504772a07047cbddc85f199c3..aee9bc41c6c03ef51464fd8adf449b172d0959a0 100644 (file)
@@ -166,7 +166,7 @@ int ConfigureOutputInfo(InferenceEngineCommon* backend, Metadata& metadata,
        inference_engine_layer_property property;
        inference_engine_tensor_info tensor_info = {
            std::vector<size_t>{1}, INFERENCE_TENSOR_SHAPE_NCHW,
-           INFERENCE_TENSOR_DATA_TYPE_FLOAT32, 1, 0.0f, 0};
+           INFERENCE_TENSOR_DATA_TYPE_FLOAT32, 1, 0.0f, 0, INFERENCE_TENSOR_QUANTIZATION_NONE};
 
        for (auto& name : tensorConfig.mOutputLayerNames) {
                LOGI("Configure %s layer as output", name.c_str());