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

Function TEST_F

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

Source from the content-addressed store, hash-verified

32namespace {
33
34TEST_F(OpenCLOperationTest, UpsampleBilinearAligned) {
35 TensorFloat32 src_tensor;
36 src_tensor.shape = BHWC(1, 2, 3, 1);
37 src_tensor.data = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f};
38
39 Upsample2DAttributes attr;
40 attr.type = UpsamplingType::BILINEAR;
41 attr.new_shape = HW(4, 4);
42 attr.align_corners = true;
43
44 for (auto storage : env_.GetSupportedStorages()) {
45 for (auto precision : env_.GetSupportedPrecisions()) {
46 const float eps = precision == CalculationsPrecision::F32 ? 1e-5f : 1e-2f;
47 OperationDef op_def;
48 op_def.precision = precision;
49 auto data_type = DeduceDataTypeFromPrecision(precision);
50 op_def.src_tensors.push_back({data_type, storage});
51 op_def.dst_tensors.push_back({data_type, storage});
52 TensorFloat32 dst_tensor;
53 Upsample operation = CreateUpsample(op_def, attr);
54 ASSERT_OK(ExecuteGPUOperation(src_tensor, creation_context_, &operation,
55 BHWC(1, 4, 4, 1), &dst_tensor));
56 EXPECT_THAT(dst_tensor.data,
57 Pointwise(FloatNear(eps),
58 {0.0f, 0.666667f, 1.33333f, 2.0f, 1.0f, 1.66667f,
59 2.33333f, 3.0f, 2.0f, 2.66667f, 3.33333f, 4.0f,
60 3.0f, 3.66667f, 4.33333f, 5.0f}));
61 }
62 }
63}
64
65TEST_F(OpenCLOperationTest, UpsampleBilinearNonAligned) {
66 TensorFloat32 src_tensor;

Callers

nothing calls this directly

Calls 6

CreateUpsampleFunction · 0.85
ExecuteGPUOperationFunction · 0.85
GetSupportedStoragesMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected