MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST_F

Function TEST_F

tensorflow/lite/kernels/depthwise_conv_test.cc:621–662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619// Only enable this test for neon.
620#ifdef USE_NEON
621TEST_F(QuantizedDepthwiseConvolutionOpTest, LargeOutputChannelTest) {
622 const TensorData input({TensorType_UINT8, {1, 4, 4, 2400}, -63.5, 64});
623 const TensorData filter({TensorType_UINT8, {1, 3, 3, 2400}, -63.5, 64});
624 const TensorData output({TensorType_UINT8, {}, -127, 128});
625 const Padding padding = Padding_VALID;
626
627 // Populate input, filter & bias data.
628 const int input_size = 1 * 4 * 4 * 2400;
629 const int filter_size = 1 * 3 * 3 * 2400;
630 const int bias_size = 2400;
631 std::vector<float> input_data(input_size);
632 std::vector<float> filter_data(filter_size);
633 std::vector<float> bias_data(bias_size);
634 for (int i = 0; i < input_size; ++i) {
635 input_data[i] = UniformRandomFloat(-1, -1);
636 }
637 for (int i = 0; i < filter_size; ++i) {
638 filter_data[i] = UniformRandomFloat(-1, -1);
639 }
640 for (int i = 0; i < bias_size; ++i) {
641 bias_data[i] = UniformRandomFloat(-1, -1);
642 }
643
644 // Make sure reference impl & optimized impl produce the same result.
645 QuantizedDepthwiseConvolutionOpModel reference_impl(
646 ops::builtin::Register_DEPTHWISE_CONVOLUTION_REF(), input, filter, output,
647 padding);
648 reference_impl.SetInput(input_data);
649 reference_impl.SetFilter(filter_data);
650 reference_impl.SetBias(bias_data);
651 reference_impl.Invoke();
652
653 QuantizedDepthwiseConvolutionOpModel optimized_impl(
654 ops::builtin::Register_DEPTHWISE_CONVOLUTION_GENERIC_OPT(), input, filter,
655 output, padding);
656 optimized_impl.SetInput(input_data);
657 optimized_impl.SetFilter(filter_data);
658 optimized_impl.SetBias(bias_data);
659 optimized_impl.Invoke();
660
661 EXPECT_THAT(reference_impl.GetOutput(), optimized_impl.GetOutput());
662}
663#endif
664
665// In this test we set the input and output scales so that the results match

Callers

nothing calls this directly

Calls 8

UniformRandomFloatFunction · 0.85
SetInputMethod · 0.45
SetFilterMethod · 0.45
SetBiasMethod · 0.45
InvokeMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected