Correction in pad CPU version for quant8 datatype (#3687)
authorShubham Gupta/SNAP /SRI-Bangalore/Engineer/삼성전자 <shub98.gupta@samsung.com>
Wed, 28 Nov 2018 04:22:14 +0000 (09:52 +0530)
committer이춘석/동작제어Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Wed, 28 Nov 2018 04:22:14 +0000 (13:22 +0900)
This patch set the correct padding value which is offset for quant8 dataypes.

Signed-off-by: shubham <shub98.gupta@samsung.com>
runtimes/pure_arm_compute/src/internal/layers/SimplePadLayer.cc

index 6f0bdc3..6423660 100644 (file)
@@ -79,7 +79,7 @@ inline void ApplyPadding(const ::arm_compute::ITensor *input_data,
                          const ::arm_compute::ITensor *padding_size,
                          ::arm_compute::ITensor *output_data,
                          const ::arm_compute::TensorShape &output_shape,
-                         const ::arm_compute::Coordinates &axises)
+                         const ::arm_compute::Coordinates &axises, T zero_value)
 {
 
   assert(validate_arg(input_data, output_data, padding_size, axises) &&
@@ -117,7 +117,7 @@ inline void ApplyPadding(const ::arm_compute::ITensor *input_data,
               out_w < pad_width_left || out_w >= (input_width + pad_width_left) ||
               out_d < pad_depth_front || out_d >= (input_depth + pad_depth_front))
           {
-            *reinterpret_cast<T *>(output_data->ptr_to_element(output_id)) = 0;
+            *reinterpret_cast<T *>(output_data->ptr_to_element(output_id)) = zero_value;
           }
           else
           {
@@ -149,11 +149,12 @@ void SimplePadLayer::run()
     case ::arm_compute::DataType::U8:
     case ::arm_compute::DataType::QASYMM8:
       ApplyPadding<uint8_t>(_input, _input->info()->tensor_shape(), _padding_size, _output,
-                            _output->info()->tensor_shape(), _axises);
+                            _output->info()->tensor_shape(), _axises,
+                            _input->info()->quantization_info().offset);
       break;
     case ::arm_compute::DataType::F32:
       ApplyPadding<float>(_input, _input->info()->tensor_shape(), _padding_size, _output,
-                          _output->info()->tensor_shape(), _axises);
+                          _output->info()->tensor_shape(), _axises, 0.0f);
       break;
     default:
       ARM_COMPUTE_ERROR("DataType not supported");