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

Function TEST_F

tensorflow/lite/delegates/gpu/cl/kernels/sigmoid_test.cc:36–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34namespace {
35
36TEST_F(OpenCLOperationTest, Sigmoid) {
37 TensorFloat32 src_tensor;
38 src_tensor.shape = BHWC(1, 2, 1, 2);
39 src_tensor.data = {-std::log(1.0f), -std::log(2.0f), -std::log(3.0f),
40 -std::log(4.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.dst_tensors.push_back({data_type, storage});
50 TensorFloat32 dst_tensor;
51 Sigmoid operation = CreateSigmoid(op_def);
52 ASSERT_OK(ExecuteGPUOperation(src_tensor, creation_context_, &operation,
53 BHWC(1, 2, 1, 2), &dst_tensor));
54 EXPECT_THAT(dst_tensor.data,
55 Pointwise(FloatNear(eps), {0.5f, 1.0f / 3.0f, 0.25f, 0.2f}));
56 }
57 }
58}
59
60} // namespace
61} // namespace cl

Callers

nothing calls this directly

Calls 7

CreateSigmoidFunction · 0.85
ExecuteGPUOperationFunction · 0.85
GetSupportedStoragesMethod · 0.80
logFunction · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected