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

Function SimpleConstTestV2

tensorflow/lite/kernels/pad_test.cc:594–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592
593template <typename integer_type, TensorType tensor_dtype>
594void SimpleConstTestV2() {
595 // Padding is represented as four 2-D lists representing above padding and
596 // below padding (i.e. {{0, 0}, {1, 1}, {1, 1}, {0, 0}}).
597 PadV2OpConstModel<integer_type> m(
598 {tensor_dtype, {1, 2, 2, 1}, -1.0, 1.0}, {4, 2}, {0, 0, 1, 1, 1, 1, 0, 0},
599 {tensor_dtype, {1}, -1.0, 1.0}, {tensor_dtype, {}, -1.0, 1.0});
600 m.template SetQuantizedInput<integer_type>({-0.8, 0.2, 0.9, 0.7});
601 m.template SetQuantizedPadValue<integer_type>(0);
602 m.Invoke();
603 EXPECT_THAT(m.template GetDequantizedOutput<integer_type>(),
604 ElementsAreArray(DequantizedArrayNear(
605 {0, 0, 0, 0, 0, -0.8, 0.2, 0, 0, 0.9, 0.7, 0, 0, 0, 0, 0},
606 -1.0, 1.0)));
607 EXPECT_THAT(m.GetOutputShape(), ElementsAreArray({1, 4, 4, 1}));
608}
609
610TEST_F(QuantizedPadV2OpTest, UInt8SimpleConstTest) {
611 SimpleConstTestV2<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