15 template<
typename armnn::DataType DataType>
20 using namespace armnn;
29 Connect(input, prelu, inputInfo, 0, 0);
30 Connect(alpha, prelu, alphaInfo, 0, 1);
31 Connect(prelu, output, outputInfo, 0, 0);
36 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
37 void PreluEndToEnd(
const std::vector<BackendId>& backends,
38 const std::vector<T>& inputData,
39 const std::vector<T>& alphaData,
40 const std::vector<T>& expectedOutputData,
42 const int32_t qOffset)
44 using namespace armnn;
57 INetworkPtr net = CreatePreluNetwork<ArmnnType>(inputInfo, alphaInfo, outputInfo);
59 BOOST_TEST_CHECKPOINT(
"Create a network");
61 std::map<int, std::vector<T>> inputTensorData = { { 0, inputData }, { 1, alphaData} };
62 std::map<int, std::vector<T>> expectedOutputTensorData = { { 0, expectedOutputData } };
64 EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net),
66 expectedOutputTensorData,
70 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
71 void PreluEndToEndPositiveTest(
const std::vector<BackendId>& backends,
const float qScale = 1.0f,
72 const int32_t qOffset = 2)
74 std::vector<T> inputData{ 1, 2, 3, 4, 5, 6, 7, 8 };
75 std::vector<T> alphaData{ 2, 1, 1, 1 };
77 std::vector<T> expectedOutputData{ 2, 2, 3, 4, 5, 6, 7, 8 };
79 PreluEndToEnd<ArmnnType>(backends, inputData, alphaData, expectedOutputData, qScale, qOffset);
82 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
83 void PreluEndToEndNegativeTest(
const std::vector<BackendId>& backends,
const float qScale = 1.0f,
84 const int32_t qOffset = 0)
86 std::vector<T> inputData{ 1, -2, 3, 4, 5, 6, 7, 8 };
87 std::vector<T> alphaData{ 1, 2, 1, 1 };
89 std::vector<T> expectedOutputData{ 1, -4, 3, 4, 5, 6, 7, 8 };
91 PreluEndToEnd<ArmnnType>(backends, inputData, alphaData, expectedOutputData, qScale, qOffset);
void SetQuantizationScale(float scale)
static INetworkPtr Create()
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
void SetQuantizationOffset(int32_t offset)