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

Function TEST_F

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

Source from the content-addressed store, hash-verified

32namespace {
33
34TEST_F(OpenCLOperationTest, ApplyMaskOneChannel) {
35 TensorFloat32 src_tensor;
36 src_tensor.shape = BHWC(1, 2, 2, 2);
37 src_tensor.data = {-4.0f, -3.0f, -1.0f, 0.0f, 1.0f, 3.0f, 4.0f, 6.0f};
38 TensorFloat32 mask_tensor;
39 mask_tensor.shape = BHWC(1, 2, 2, 1);
40 mask_tensor.data = {2.0f, 0.5f, 1.0f, 0.0f};
41
42 for (auto storage : env_.GetSupportedStorages()) {
43 for (auto precision : env_.GetSupportedPrecisions()) {
44 const float eps = precision == CalculationsPrecision::F32 ? 1e-6f : 1e-3f;
45 OperationDef op_def;
46 op_def.precision = precision;
47 auto data_type = DeduceDataTypeFromPrecision(precision);
48 op_def.src_tensors.push_back({data_type, storage});
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 ApplyMask operation = CreateApplyMask(op_def);
53 ASSERT_OK(ExecuteGPUOperation({src_tensor, mask_tensor},
54 creation_context_, &operation,
55 BHWC(1, 2, 2, 2), &dst_tensor));
56 EXPECT_THAT(dst_tensor.data,
57 Pointwise(FloatNear(eps), {-8.0f, -6.0f, -0.5f, 0.0f, 1.0f,
58 3.0f, 0.0f, 0.0f}));
59 }
60 }
61}
62
63TEST_F(OpenCLOperationTest, ApplyMaskEqualSizes) {
64 TensorFloat32 src_tensor;

Callers

nothing calls this directly

Calls 6

CreateApplyMaskFunction · 0.85
ExecuteGPUOperationFunction · 0.85
GetSupportedStoragesMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected