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

Function TEST_F

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

Source from the content-addressed store, hash-verified

33namespace {
34
35TEST_F(OpenCLOperationTest, MultiplyAddVectorMul) {
36 TensorFloat32 src_tensor;
37 src_tensor.shape = BHWC(1, 2, 1, 2);
38 src_tensor.data = {0.0f, 1.0f, 2.0f, 3.0f};
39
40 MultiplyScalarAttributes attr;
41 ::tflite::gpu::Tensor<Linear, DataType::FLOAT32> parameters;
42 parameters.shape = Linear(2);
43 parameters.data = {0.5f, 2.0f};
44 attr.param = parameters;
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 MultiplyAdd operation;
56 ASSERT_OK(CreateMultiplyAdd(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, 6.0f}));
61 }
62 }
63}
64
65TEST_F(OpenCLOperationTest, MultiplyAddVectorAdd) {
66 TensorFloat32 src_tensor;

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected