17 #include <boost/test/unit_test.hpp> 29 using namespace armnn;
36 Connect(input, resize, inputInfo, 0, 0);
37 Connect(resize, output, outputInfo, 0, 0);
42 template<armnn::DataType ArmnnType>
43 void ResizeEndToEnd(
const std::vector<armnn::BackendId>& backends,
47 using namespace armnn;
50 constexpr
unsigned int inputWidth = 3u;
51 constexpr
unsigned int inputHeight = inputWidth;
53 constexpr
unsigned int outputWidth = 5u;
54 constexpr
unsigned int outputHeight = outputWidth;
59 const float qScale = IsQuantizedType<T>() ? 0.25f : 1.0f;
60 const int32_t qOffset = IsQuantizedType<T>() ? 50 : 0;
62 TensorInfo inputInfo(inputShape, ArmnnType, qScale, qOffset);
63 TensorInfo outputInfo(outputShape, ArmnnType, qScale, qOffset);
65 std::vector<float> inputData =
72 std::vector<float> expectedOutputData;
79 1.0f, 1.6f, 2.2f, 2.8f, 3.0f,
80 2.8f, 3.4f, 4.0f, 4.6f, 4.8f,
81 4.6f, 5.2f, 5.8f, 6.4f, 6.6f,
82 6.4f, 7.0f, 7.6f, 8.2f, 8.4f,
83 7.0f, 7.6f, 8.2f, 8.8f, 9.0f
91 1.f, 1.f, 2.f, 2.f, 3.f,
92 1.f, 1.f, 2.f, 2.f, 3.f,
93 4.f, 4.f, 5.f, 5.f, 6.f,
94 4.f, 4.f, 5.f, 5.f, 6.f,
95 7.f, 7.f, 8.f, 8.f, 9.f
114 constexpr
size_t dataTypeSize =
sizeof(float);
117 std::vector<float> tmp(inputData.size());
123 std::vector<T> qInputData = armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset);
124 std::vector<T> qExpectedOutputData = armnnUtils::QuantizedVector<T>(expectedOutputData, qScale, qOffset);
126 INetworkPtr network = CreateResizeNetwork(descriptor, inputInfo, outputInfo);
128 EndToEndLayerTestImpl<ArmnnType, ArmnnType>(std::move(network),
129 { { 0, qInputData } },
130 { { 0, qExpectedOutputData } },
136 template<armnn::DataType ArmnnType>
143 template<armnn::DataType ArmnnType>
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
const TensorShape & GetShape() const
void ResizeBilinearEndToEnd(const std::vector< armnn::BackendId > &backends, armnn::DataLayout dataLayout)
ResizeMethod m_Method
The Interpolation method to use (Bilinear, NearestNeighbor).
void ResizeNearestNeighborEndToEnd(const std::vector< armnn::BackendId > &backends, armnn::DataLayout dataLayout)
typename ResolveTypeImpl< DT >::Type ResolveType
Copyright (c) 2020 ARM Limited.
A ResizeDescriptor for the ResizeLayer.
uint32_t m_TargetWidth
Target width value.
uint32_t m_TargetHeight
Target height value.
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
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
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
static INetworkPtr Create()