46 using namespace armnn;
49 constexpr
unsigned int batches = 1u;
50 constexpr
unsigned int channels = 1u;
52 constexpr
unsigned int wInput = 3u;
53 constexpr
unsigned int hInput = wInput;
55 constexpr
unsigned int wOutput = 5u;
56 constexpr
unsigned int hOutput = wOutput;
58 constexpr
unsigned int wWeights = 3u;
59 constexpr
unsigned int hWeights = wWeights;
65 const float qScale = IsQuantizedType<T>() ? 0.25f : 1.0f;
66 const int32_t qOffset = IsQuantizedType<T>() ? 50 : 0;
68 TensorInfo inputInfo(inputShape, ArmnnType, qScale, qOffset,
true);
69 TensorInfo outputInfo(outputShape, ArmnnType, qScale, qOffset);
70 TensorInfo weightsInfo(weightsShape, ArmnnType, qScale, qOffset,
true);
71 TensorInfo biasesInfo({ channels }, ArmnnBType, qScale * qScale, 0,
true);
73 std::vector<float> inputData =
80 std::vector<float> weightsData =
87 std::vector<float> biasesData = { 1.f };
89 std::vector<float> expectedOutputData =
91 6.f, 11.f, 6.f, 11.f, 6.f,
92 11.f, 21.f, 11.f, 21.f, 11.f,
93 6.f, 11.f, 6.f, 11.f, 6.f,
94 11.f, 21.f, 11.f, 21.f, 11.f,
95 6.f, 11.f, 6.f, 11.f, 6.f
111 constexpr
size_t dataTypeSize =
sizeof(float);
114 std::vector<float> tmp(inputData.size());
115 armnnUtils::Permute(inputInfo.GetShape(), nchwToNhwc, inputData.data(), tmp.data(), dataTypeSize);
118 tmp.resize(weightsData.size());
119 armnnUtils::Permute(weightsInfo.GetShape(), nchwToNhwc, weightsData.data(), tmp.data(), dataTypeSize);
122 tmp.resize(expectedOutputData.size());
123 armnnUtils::Permute(outputInfo.GetShape(), nchwToNhwc, expectedOutputData.data(), tmp.data(), dataTypeSize);
124 expectedOutputData = tmp;
128 std::vector<T> qInputData = armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset);
129 std::vector<T> qWeightsData = armnnUtils::QuantizedVector<T>(weightsData, qScale, qOffset);
130 std::vector<T> qExpectedOutputData = armnnUtils::QuantizedVector<T>(expectedOutputData, qScale, qOffset);
133 std::vector<BT> qBiasesData = armnnUtils::QuantizedVector<BT>(biasesData, qScale * qScale, 0);
138 INetworkPtr network = CreateTransposeConvolution2dNetwork(descriptor,
145 EndToEndLayerTestImpl<ArmnnType, ArmnnType>(std::move(network),
146 { { 0, qInputData } },
147 { { 0, qExpectedOutputData } },
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
bool m_BiasEnabled
Enable/disable bias.
typename ResolveTypeImpl< DT >::Type ResolveType
Copyright (c) 2021 ARM Limited and Contributors.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
uint32_t m_PadTop
Padding top value in the height dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_PadLeft
Padding left value in the width dimension.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
uint32_t m_PadRight
Padding right value in the width dimension.
armnn::TensorShape MakeTensorShape(unsigned int batches, unsigned int channels, unsigned int height, unsigned int width, armnn::DataLayout layout)
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr