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

Function TEST

tensorflow/lite/delegates/gpu/gl/kernels/prelu_test.cc:31–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29namespace {
30
31TEST(PReluTest, LinearAlphaNoClip) {
32 TensorRef<BHWC> input;
33 input.type = DataType::FLOAT32;
34 input.ref = 0;
35 input.shape = BHWC(1, 2, 2, 1);
36
37 PReLUAttributes attr;
38 attr.clip = 0;
39 Tensor<Linear, DataType::FLOAT32> alpha;
40 alpha.shape.v = 1;
41 alpha.id = 1;
42 alpha.data = {2};
43 attr.alpha = std::move(alpha);
44
45 TensorRef<BHWC> output;
46 output.type = DataType::FLOAT32;
47 output.ref = 2;
48 output.shape = BHWC(1, 2, 2, 1);
49
50 SingleOpModel model({ToString(OperationType::PRELU), attr}, {input},
51 {output});
52 ASSERT_TRUE(model.PopulateTensor(0, {-1.0, -2.0, 1.0, 2.0}));
53 ASSERT_OK(model.Invoke(*NewPReLUNodeShader()));
54 EXPECT_THAT(model.GetOutput(0), Pointwise(FloatNear(1e-6), {-2, -4, 1, 2}));
55}
56
57TEST(PReluTest, LinearAlphaWithClip) {
58 TensorRef<BHWC> input;

Callers 1

prelu_test.ccFile · 0.70

Calls 5

NewPReLUNodeShaderFunction · 0.85
ToStringFunction · 0.50
PopulateTensorMethod · 0.45
InvokeMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected