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

Function TEST_F

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

Source from the content-addressed store, hash-verified

32namespace {
33
34TEST_F(OpenCLOperationTest, PReLUAlpha) {
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 PReLUAttributes attr;
40 ::tflite::gpu::Tensor<Linear, DataType::FLOAT32> parameters;
41 parameters.shape = Linear(2);
42 parameters.data = {0.5f, -2.0f};
43 attr.alpha = parameters;
44 attr.clip = 0.0;
45
46 for (auto storage : env_.GetSupportedStorages()) {
47 for (auto precision : env_.GetSupportedPrecisions()) {
48 const float eps = precision == CalculationsPrecision::F32 ? 1e-6f : 1e-3f;
49 OperationDef op_def;
50 op_def.precision = precision;
51 auto data_type = DeduceDataTypeFromPrecision(precision);
52 op_def.src_tensors.push_back({data_type, storage});
53 op_def.dst_tensors.push_back({data_type, storage});
54 TensorFloat32 dst_tensor;
55 PReLU operation;
56 ASSERT_OK(CreatePReLU(creation_context_, op_def, attr, &operation));
57 ASSERT_OK(ExecuteGPUOperation(src_tensor, creation_context_, &operation,
58 BHWC(1, 2, 1, 2), &dst_tensor));
59 EXPECT_THAT(dst_tensor.data,
60 Pointwise(FloatNear(eps), {0.0f, 2.0f, -1.0f, 3.0f}));
61 }
62 }
63}
64
65TEST_F(OpenCLOperationTest, PReLUAlphaClip) {
66 TensorFloat32 src_tensor;

Callers

nothing calls this directly

Calls 7

LinearFunction · 0.85
CreatePReLUFunction · 0.85
ExecuteGPUOperationFunction · 0.85
GetSupportedStoragesMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected