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

Function TEST_F

tensorflow/lite/delegates/gpu/cl/kernels/padding_test.cc:34–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace {
33
34TEST_F(OpenCLOperationTest, PaddingAppendWidth) {
35 TensorFloat32 src_tensor;
36 src_tensor.shape = BHWC(1, 2, 1, 2);
37 src_tensor.data = {0.0f, 1.0f, 2.0f, 3.0f};
38
39 PadAttributes attr;
40 attr.prepended = HWC(0, 0, 0);
41 attr.appended = HWC(0, 1, 0);
42
43 for (auto storage : env_.GetSupportedStorages()) {
44 for (auto precision : env_.GetSupportedPrecisions()) {
45 const float eps = precision == CalculationsPrecision::F32 ? 1e-6f : 1e-3f;
46 OperationDef op_def;
47 op_def.precision = precision;
48 auto data_type = DeduceDataTypeFromPrecision(precision);
49 op_def.src_tensors.push_back({data_type, storage});
50 op_def.dst_tensors.push_back({data_type, storage});
51 TensorFloat32 dst_tensor;
52 Padding operation = CreatePadding(op_def, attr);
53 ASSERT_OK(ExecuteGPUOperation(src_tensor, creation_context_, &operation,
54 BHWC(1, 2, 2, 2), &dst_tensor));
55 EXPECT_THAT(dst_tensor.data,
56 Pointwise(FloatNear(eps),
57 {0.0f, 1.0f, 0.0f, 0.0f, 2.0f, 3.0f, 0.0f, 0.0f}));
58 }
59 }
60}
61
62TEST_F(OpenCLOperationTest, PaddingPrependWidth) {
63 TensorFloat32 src_tensor;

Callers

nothing calls this directly

Calls 6

CreatePaddingFunction · 0.85
ExecuteGPUOperationFunction · 0.85
GetSupportedStoragesMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected