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

Function TEST_F

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

Source from the content-addressed store, hash-verified

34namespace {
35
36TEST_F(OpenCLOperationTest, StridedSlice) {
37 TensorFloat32 src_tensor;
38 src_tensor.shape = BHWC(1, 3, 2, 4);
39 src_tensor.data = {half(0.1f), half(0.2f), half(0.3f), half(0.4),
40 half(1.1f), half(1.2f), half(1.3f), half(1.4),
41 half(10.1f), half(10.2f), half(10.3f), half(10.4),
42 half(11.1f), half(11.2f), half(11.3f), half(11.4),
43 half(20.1f), half(20.2f), half(20.3f), half(20.4),
44 half(21.1f), half(21.2f), half(21.3f), half(21.4)};
45
46 SliceAttributes attr;
47 attr.starts = HWC(1, 0, 1);
48 attr.ends = HWC(2, 2, 3);
49 attr.strides = HWC(1, 2, 2);
50
51 for (auto storage : env_.GetSupportedStorages()) {
52 for (auto precision : env_.GetSupportedPrecisions()) {
53 OperationDef op_def;
54 op_def.precision = precision;
55 auto data_type = DeduceDataTypeFromPrecision(precision);
56 op_def.src_tensors.push_back({data_type, storage});
57 op_def.dst_tensors.push_back({data_type, storage});
58 TensorFloat32 dst_tensor;
59 StridedSlice operation = CreateStridedSlice(op_def, attr);
60 ASSERT_OK(ExecuteGPUOperation(src_tensor, creation_context_, &operation,
61 BHWC(1, 2, 1, 2), &dst_tensor));
62 EXPECT_THAT(dst_tensor.data,
63 Pointwise(FloatNear(0.0f), {half(10.2f), half(10.4),
64 half(20.2f), half(20.4)}));
65 }
66 }
67}
68
69} // namespace
70} // namespace cl

Callers

nothing calls this directly

Calls 7

CreateStridedSliceFunction · 0.85
ExecuteGPUOperationFunction · 0.85
GetSupportedStoragesMethod · 0.80
halfClass · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected