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

Function TEST_F

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

Source from the content-addressed store, hash-verified

34namespace {
35
36TEST_F(OpenCLOperationTest, Softmax) {
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 Softmax operation = CreateSoftmax(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), {1.0f / 3.0f, 2.0f / 3.0f,
56 3.0f / 7.0f, 4.0f / 7.0f}));
57 }
58 }
59}
60
61} // namespace
62} // namespace cl

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected