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

Function SimpleConstValuedTest

tensorflow/lite/kernels/pad_test.cc:688–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686
687template <typename integer_type, TensorType tensor_dtype>
688void SimpleConstValuedTest() {
689 // Padding is represented as four 2-D lists representing above padding and
690 // below padding (i.e. {{0, 0}, {1, 1}, {1, 1}, {0, 0}}).
691 PadV2OpConstModel<integer_type> m(
692 {tensor_dtype, {1, 2, 2, 1}, -1.0, 1.0}, {4, 2}, {0, 0, 1, 1, 1, 1, 0, 0},
693 {tensor_dtype, {1}, -1.0, 1.0}, {tensor_dtype, {}, -1.0, 1.0});
694 m.template SetQuantizedInput<integer_type>({-0.8, 0.2, 0.9, 0.7});
695 m.template SetQuantizedPadValue<integer_type>(-0.5);
696 m.Invoke();
697 EXPECT_THAT(m.template GetDequantizedOutput<integer_type>(),
698 ElementsAreArray(DequantizedArrayNear(
699 {-0.5, -0.5, -0.5, -0.5, -0.5, -0.8, 0.2, -0.5, -0.5, 0.9,
700 0.7, -0.5, -0.5, -0.5, -0.5, -0.5},
701 -1.0, 1.0)));
702 EXPECT_THAT(m.GetOutputShape(), ElementsAreArray({1, 4, 4, 1}));
703}
704
705TEST_F(QuantizedPadV2OpTest, UInt8SimpleConstValuedTest) {
706 SimpleConstValuedTest<uint8_t, TensorType_UINT8>();

Callers

nothing calls this directly

Calls 3

DequantizedArrayNearFunction · 0.70
InvokeMethod · 0.45
GetOutputShapeMethod · 0.45

Tested by

no test coverage detected