tensorflow/lite/delegates/hexagon/builders/tests/conv_test.cc
// Depthwise Conv with multiplier > 1 but input depth==1 should resolve into a
// Conv op.
Depthwise Conv with multiplier > 1 but input depth==1 should resolve into a
Conv op.
Depthwise Conv with multiplier > 1 but input depth == 1 should resolve into a Conv op .
TEST(QuantizedConvolutionOpModel,
     DepthwiseConvWithMultiplier_InputDepth1_RELU) {
  QuantizedConvolutionOpModel m(BuiltinOperator_DEPTHWISE_CONV_2D,
                                {TensorType_UINT8, {1, 6, 6, 1}, -63.5, 64},
                                {TensorType_UINT8, {1, 5, 5, 3}, -63.5, 64},
                                {TensorType_UINT8, {}, -127, 128},
                                Padding_VALID,  1,
                                 2, ActivationFunctionType_RELU6);
  m.SetInput({0, 0, 0, 0, 0, 0, 0, 0, 0,
              0, 0, 0, 1, 1, 1, 0, 0, 0,
              0, 0, 0, 1, 1, 1, 0, 0, 0,
              0, 0, 0, 0, 0, 0, 0, 0, 0});
  m.SetFilter({1, 2, 3, 4, 5,
               1, 2, 3, 4, 5,
               1, 2, 3, 4, 5,
               1, 2, 3, 4, 5,
               1, 2, 3, 4, 5,
               6, 7, 8, 9, 10,
               6, 7, 8, 9, 10,
               6, 7, 8, 9, 10,
               6, 7, 8, 9, 10,
               6, 7, 8, 9, 10,
               1, 2, 3, 4, 5,
               1, 2, 3, 4, 5,
               1, 2, 3, 4, 5,
               1, 2, 3, 4, 5,
               1, 2, 3, 4, 5});
  m.SetBias({1, 2, 3});
  m.Invoke();
  auto reference_output = m.GetDequantizedOutput<uint8_t>();
  m.ApplyDelegateAndInvoke();
  EXPECT_THAT(m.GetDequantizedOutput<uint8_t>(),
              ElementsAreArray(ArrayFloatNear(reference_output, 1e-5)));
}
TEST ( QuantizedConvolutionOpModel , DepthwiseConvWithMultiplier_InputDepth1_RELU ) { QuantizedConvolutionOpModel m ( BuiltinOperator_DEPTHWISE_CONV_2D , { TensorType_UINT8 , { 1 , 6 , 6 , 1 } , -63.5 , 64 } , { TensorType_UINT8 , { 1 , 5 , 5 , 3 } , -63.5 , 64 } , { TensorType_UINT8 , { } , -127 , 128 } , Padding_VALID , 1 , 2 , ActivationFunctionType_RELU6 ) ; m . SetInput ( { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ) ; m . SetFilter ( { 1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 6 , 7 , 8 , 9 , 10 , 6 , 7 , 8 , 9 , 10 , 6 , 7 , 8 , 9 , 10 , 6 , 7 , 8 , 9 , 10 , 1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5 } ) ; m . SetBias ( { 1 , 2 , 3 } ) ; m . Invoke ( ) ; auto reference_output = m . GetDequantizedOutput < uint8_t > ( ) ; m . ApplyDelegateAndInvoke ( ) ; EXPECT_THAT ( m . GetDequantizedOutput < uint8_t > ( ) , ElementsAreArray ( ArrayFloatNear ( reference_output , 1e-5 ) ) ) ; }
Depthwise Conv with multiplier > 1 but input depth==1 should resolve into a
Conv op.
Depthwise Conv with multiplier > 1 but input depth == 1 should resolve into a Conv op .
/**dilation_factor**/ /**stride**/ // clang-format off // clang-format on // Reference output.