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

Function TEST_F

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

Source from the content-addressed store, hash-verified

32namespace {
33
34TEST_F(OpenCLOperationTest, AddTwoEqualTensors) {
35 TensorFloat32 src0, src1;
36 src0.shape = BHWC(1, 2, 1, 2);
37 src0.data = {0.0f, -1.0f, -0.05f, 0.045f};
38 src1.shape = BHWC(1, 2, 1, 2);
39 src1.data = {0.0f, 1.0f, -0.05f, -0.045f};
40 std::vector<int> channels = {2, 2};
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 Add operation = CreateAdd(op_def, channels, channels[0]);
53 ASSERT_OK(ExecuteGPUOperation({src0, src1}, creation_context_, &operation,
54 BHWC(1, 2, 1, 2), &dst_tensor));
55 EXPECT_THAT(dst_tensor.data,
56 Pointwise(FloatNear(eps), {0.0f, 0.0f, -0.1f, 0.0f}));
57 }
58 }
59}
60
61TEST_F(OpenCLOperationTest, AddFirstTensorHasMoreChannelsThanSecond) {
62 TensorFloat32 src0, src1;

Callers

nothing calls this directly

Calls 6

CreateAddFunction · 0.85
ExecuteGPUOperationFunction · 0.85
GetSupportedStoragesMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected