tensorflow/lite/delegates/hexagon/builders/tests/conv_test.cc
// Same as above, but the output min/max matches the RELU bounds.
// Therefore, a Requantize node will not get added after Supernode.
Same as above, but the output min/max matches the RELU bounds.
Therefore, a Requantize node will not get added after Supernode.
Same as above but the output min / max matches the RELU bounds . Therefore a Requantize node will not get added after Supernode .
TEST(QuantizedConvolutionOpModel,
     SimpleConvTestReLU6Activation_NoRequantizeRequired) {
  QuantizedConvolutionOpModel m(
      BuiltinOperator_CONV_2D, {TensorType_UINT8, {2, 2, 4, 1}, -63.5, 64},
      {TensorType_UINT8, {3, 2, 2, 1}, -63.5, 64}, {TensorType_UINT8, {}, 0, 6},
      Padding_VALID,  1,
       2, ActivationFunctionType_RELU6);
  m.SetInput({
      1, 1, 1, 1,  
      2, 2, 2, 2,  
      1, 2, 3, 4,  
      1, 2, 3, 4,  
  });
  m.SetFilter({
      1, 2, 3, 4,    
      -1, 1, -1, 1,  
      -1, -1, 1, 1,  
  });
  m.SetBias({1, 2, 3});
  m.ApplyDelegateAndInvoke();
  EXPECT_THAT(m.GetDequantizedOutput<uint8_t>(),
              ElementsAreArray(ArrayFloatNear(
                  {
                      6, 2, 5,  
                      6, 2, 5,  
                      6, 4, 3,  
                      6, 4, 3,  
                  },
                  2e-2)));
}
TEST ( QuantizedConvolutionOpModel , SimpleConvTestReLU6Activation_NoRequantizeRequired ) { QuantizedConvolutionOpModel m ( BuiltinOperator_CONV_2D , { TensorType_UINT8 , { 2 , 2 , 4 , 1 } , -63.5 , 64 } , { TensorType_UINT8 , { 3 , 2 , 2 , 1 } , -63.5 , 64 } , { TensorType_UINT8 , { } , 0 , 6 } , Padding_VALID , 1 , 2 , ActivationFunctionType_RELU6 ) ; m . SetInput ( { 1 , 1 , 1 , 1 , 2 , 2 , 2 , 2 , 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4 , } ) ; m . SetFilter ( { 1 , 2 , 3 , 4 , -1 , 1 , -1 , 1 , -1 , -1 , 1 , 1 , } ) ; m . SetBias ( { 1 , 2 , 3 } ) ; m . ApplyDelegateAndInvoke ( ) ; EXPECT_THAT ( m . GetDequantizedOutput < uint8_t > ( ) , ElementsAreArray ( ArrayFloatNear ( { 6 , 2 , 5 , 6 , 2 , 5 , 6 , 4 , 3 , 6 , 4 , 3 , } , 2e-2 ) ) ) ; }
Same as above, but the output min/max matches the RELU bounds.
Same as above but the output min / max matches the RELU bounds .
/**dilation_factor**/ /**stride**/ // First batch // row = 1 // row = 2 // Second batch // row = 1 // row = 2 // first 2x2 filter // second 2x2 filter // third 2x2 filter // first batch, left // first batch, right // second batch, left // second batch, right