// // Copyright © 2022 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once #include #include #include #include #include namespace { armnn::INetworkPtr CreateTransposeNetwork(const armnn::TensorInfo& inputTensorInfo, const armnn::TensorInfo& outputTensorInfo, const armnn::PermutationVector& mappings) { armnn::INetworkPtr network(armnn::INetwork::Create()); const armnn::TransposeDescriptor transposeDescriptor(mappings); armnn::IConnectableLayer* inputLayer = network->AddInputLayer(0, "Input"); armnn::IConnectableLayer* transposeLayer = network->AddTransposeLayer(transposeDescriptor, "Transpose"); armnn::IConnectableLayer* outputLayer = network->AddOutputLayer(0, "Output"); Connect(inputLayer, transposeLayer, inputTensorInfo, 0, 0); Connect(transposeLayer, outputLayer, outputTensorInfo, 0, 0); return network; } template> void TransposeEndToEnd(const std::vector& backends) { using namespace armnn; std::vector floatInputData{ 1, 2, 3, 4, 5, 11, 12, 13, 14, 15, 21, 22, 23, 24, 25 }; std::vector inputData = armnnUtils::QuantizedVector(floatInputData); std::vector expectedOutputData = armnnUtils::QuantizedVector(floatInputData); const armnn::PermutationVector mappings{0, 2, 1 ,3}; TensorInfo inputInfo ({ 1, 1, 5, 3 }, ArmnnType, 0.0f, 0, true); TensorInfo outputInfo({ 1, 5, 1, 3 }, ArmnnType, 0.0f, 0, true); armnn::INetworkPtr network = CreateTransposeNetwork(inputInfo, outputInfo, mappings); CHECK(network); std::map> inputTensorData = {{ 0, inputData }}; std::map> expectedOutputTensorData = {{ 0, expectedOutputData }}; EndToEndLayerTestImpl(std::move(network), inputTensorData, expectedOutputTensorData, backends); } } // anonymous namespace