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

Function TEST

tensorflow/lite/delegates/gpu/gl/kernels/conv_test.cc:33–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31namespace {
32
33TEST(ConvTest, O2H2W1I1Stride1x1Dilation1x1) {
34 TensorRef<BHWC> input;
35 input.type = DataType::FLOAT32;
36 input.ref = 0;
37 input.shape = BHWC(1, 2, 2, 1);
38
39 Convolution2DAttributes attr;
40 Tensor<Linear, DataType::FLOAT32> bias;
41 bias.shape.v = 2;
42 bias.id = 1;
43 bias.data = {1, 1};
44 attr.bias = std::move(bias);
45
46 Tensor<OHWI, DataType::FLOAT32> weights;
47 weights.shape = OHWI(2, 2, 1, 1);
48 weights.id = 2;
49 weights.data = {1, 2, 3, 4};
50 attr.weights = std::move(weights);
51
52 attr.dilations = HW(1, 1);
53 attr.padding.prepended = HW(0, 0);
54 attr.padding.appended = HW(1, 0);
55 attr.strides = HW(1, 1);
56
57 TensorRef<BHWC> output;
58 output.type = DataType::FLOAT32;
59 output.ref = 3;
60 output.shape = BHWC(1, 2, 2, 2);
61
62 SingleOpModel model(
63 {ToString(OperationType::CONVOLUTION_2D), std::move(attr)}, {input},
64 {output});
65 ASSERT_TRUE(model.PopulateTensor(0, {1, 1, 1, 1}));
66 ASSERT_OK(model.Invoke(*NewConvolutionNodeShader()));
67 EXPECT_THAT(model.GetOutput(0),
68 Pointwise(FloatNear(1e-6), {4, 8, 4, 8, 2, 4, 2, 4}));
69}
70
71TEST(ConvTest, O1H2W2I1Stride1x1Dilation2x2) {
72 TensorRef<BHWC> input;

Callers

nothing calls this directly

Calls 7

NewConvolutionNodeShaderFunction · 0.85
ToStringFunction · 0.50
PopulateTensorMethod · 0.45
InvokeMethod · 0.45
GetOutputMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected