6 #include <doctest/doctest.h> 14 explicit PreluFixture(
const std::string& inputShape,
15 const std::string& alphaShape,
16 const std::string& outputShape,
17 const std::string& inputIndex,
18 const std::string& alphaData)
25 "builtin_code": "PRELU", 33 "shape": )" + inputShape + R"(, 38 "details_type": "NONE", 39 "quantized_dimension": 0 44 "shape": )" + alphaShape + R"(, 49 "details_type": "NONE", 50 "quantized_dimension": 0 55 "shape": )" + outputShape + R"(, 60 "details_type": "NONE", 61 "quantized_dimension": 0 66 "inputs": )" + inputIndex + R"(, 80 "builtin_options_type": "NONE", 81 "custom_options_format": "FLEXBUFFERS" 87 "description": "MLIR Converted.", 93 { )" + alphaData + R"( 106 explicit PreluNetworkFixture()
113 "builtin_code": "PRELU", 117 "builtin_code": "MUL", 121 "builtin_code": "ADD", 138 "details_type": "NONE", 139 "quantized_dimension": 0 152 "details_type": "NONE", 153 "quantized_dimension": 0 166 "details_type": "NONE", 167 "quantized_dimension": 0 179 "details_type": "NONE", 180 "quantized_dimension": 0 191 "details_type": "NONE", 192 "quantized_dimension": 0 205 "details_type": "NONE", 206 "quantized_dimension": 0 226 "builtin_options_type": "NONE", 227 "custom_options_format": "FLEXBUFFERS" 238 "builtin_options_type": "MulOptions", 240 "fused_activation_function": "NONE" 242 "custom_options_format": "FLEXBUFFERS" 253 "builtin_options_type": "AddOptions", 255 "fused_activation_function": "NONE" 257 "custom_options_format": "FLEXBUFFERS" 319 struct SimplePreluFixture : PreluFixture
321 SimplePreluFixture() : PreluFixture(
"[ 2, 3 ]",
328 struct PreluConstAlphaFixture : PreluFixture
330 PreluConstAlphaFixture() : PreluFixture(
335 "\"data\": [ 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62 ]"){}
338 struct PreluBroadcastAlphaFixture : PreluFixture
340 PreluBroadcastAlphaFixture() : PreluFixture(
345 "\"data\": [ 0, 0, 128, 62, 0, 0, 128, 62, 0, 0, 128, 62 ]"){}
348 struct PreluDynamicTensorFixture : PreluFixture
350 PreluDynamicTensorFixture() : PreluFixture(
"[ 2, 3 ]",
354 "\"data\": [ 0, 0, 128, 62 ]") {}
359 RunTest<2, armnn::DataType::Float32>(
361 {{
"input0", { -14.f, 2.f, 0.f, 1.f, -5.f, 14.f }},{
"input1", { 0.25f }}},
362 {{
"output", { -3.5f, 2.f, 0.f, 1.f, -1.25f, 14.f }}});
367 RunTest<3, armnn::DataType::Float32>(
369 {{
"input0", { -14.f, 2.f, 0.f, 1.f, -5.f, 14.f }}},
370 {{
"output", { -3.5f, 2.f, 0.f, 1.f, -1.25f, 14.f }}});
375 RunTest<4, armnn::DataType::Float32>(
377 {{
"input0", { -14.f, 2.f, 0.f, 1.f, -5.f, 14.f }}},
378 {{
"output", { -3.5f, 2.f, 0.f, 1.f, -1.25f, 14.f }}});
383 RunTest<2, armnn::DataType::Float32, armnn::DataType::Float32>(
385 {{
"input0", { -14.f, 2.f, 0.f, 1.f, -5.f, 14.f }}},
386 {{
"output", { -3.5f, 2.f, 0.f, 1.f, -1.25f, 14.f }}},
392 RunTest<3, armnn::DataType::Float32>(
394 {{
"input0", { -14.f, 2.f, 0.f, 1.f, -5.f, 14.f }}},
395 {{
"output", { -21.f, 12.f, 0.f, 6.f, -7.5f, 84.f }}});
TEST_SUITE("TensorflowLiteParser_Prelu")
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")
void Setup(bool testDynamic=true)