13 #include <doctest/doctest.h> 17 using namespace armnn;
28 TEST_CASE(
"ReleaseBatchNormalizationLayerConstantDataTest")
34 layerDesc.
m_Eps = 0.05f;
38 layer->
m_Mean = std::make_unique<ScopedTensorHandle>(weightInfo);
39 layer->
m_Variance = std::make_unique<ScopedTensorHandle>(weightInfo);
40 layer->
m_Beta = std::make_unique<ScopedTensorHandle>(weightInfo);
41 layer->
m_Gamma = std::make_unique<ScopedTensorHandle>(weightInfo);
53 Connect(input, layer, tensorInfo);
54 Connect(layer, output, tensorInfo);
57 CHECK(layer->
m_Mean !=
nullptr);
59 CHECK(layer->
m_Beta !=
nullptr);
60 CHECK(layer->
m_Gamma !=
nullptr);
66 CHECK(layer->
m_Mean ==
nullptr);
68 CHECK(layer->
m_Beta ==
nullptr);
69 CHECK(layer->
m_Gamma ==
nullptr);
73 TEST_CASE(
"ReleaseConvolution2dLayerConstantDataTest")
91 layer->
m_Bias = std::make_unique<ScopedTensorHandle>
103 biasLayer->m_LayerOutput = std::make_shared<ScopedTensorHandle>(
108 TensorInfo biasInfo = biasLayer->m_LayerOutput->GetTensorInfo();
112 biasLayer->GetOutputSlot(0).SetTensorInfo(biasInfo);
121 biasLayer->GetOutputSlot().Connect(layer->
GetInputSlot(2));
126 CHECK(biasLayer->m_LayerOutput !=
nullptr);
133 CHECK(biasLayer->m_LayerOutput ==
nullptr);
136 TEST_CASE(
"ReleaseDepthwiseConvolution2dLayerConstantDataTest")
152 layer->
m_Weight = std::make_unique<ScopedTensorHandle>(
154 layer->
m_Bias = std::make_unique<ScopedTensorHandle>(
157 layer->
m_Bias->Allocate();
169 CHECK(layer->
m_Bias !=
nullptr);
176 CHECK(layer->
m_Bias ==
nullptr);
179 TEST_CASE(
"ReleaseFullyConnectedLayerConstantDataTest")
190 float inputsQScale = 1.0f;
191 float outputQScale = 2.0f;
193 layer->
m_Weight = std::make_unique<ScopedTensorHandle>(
195 layer->
m_Bias = std::make_unique<ScopedTensorHandle>(
198 layer->
m_Bias->Allocate();
210 CHECK(layer->
m_Bias !=
nullptr);
217 CHECK(layer->
m_Bias ==
nullptr);
TEST_SUITE("TestConstTensorLayerVisitor")
A layer that the constant data can be bound to.
virtual void ReleaseConstantData()
uint32_t m_PadBottom
Padding bottom value in the height dimension.
bool m_BiasEnabled
Enable/disable bias.
This layer represents a batch normalization operation.
bool m_BiasEnabled
Enable/disable bias.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
This layer represents a depthwise convolution 2d operation.
std::shared_ptr< ConstTensorHandle > m_LayerOutput
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
A Convolution2dDescriptor for the Convolution2dLayer.
uint32_t m_PadLeft
Padding left value in the width dimension.
int Connect(InputSlot &destination)
float m_Eps
Value to add to the variance. Used to avoid dividing by zero.
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store Weight values.
std::shared_ptr< ConstTensorHandle > m_Mean
A unique pointer to store Mean values.
uint32_t m_PadRight
Padding right value in the width dimension.
Copyright (c) 2021 ARM Limited and Contributors.
std::shared_ptr< ConstTensorHandle > m_Beta
A unique pointer to store Beta values.
uint32_t m_PadTop
Padding top value in the height dimension.
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
A layer user-provided data can be bound to (e.g. inputs, outputs).
This layer represents a fully connected operation.
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store Weight values.
uint32_t m_PadTop
Padding top value in the height dimension.
A FullyConnectedDescriptor for the FullyConnectedLayer.
bool m_BiasEnabled
Enable/disable bias.
std::shared_ptr< ConstTensorHandle > m_Bias
A unique pointer to store Bias values.
std::shared_ptr< ConstTensorHandle > m_Gamma
A unique pointer to store Gamma values.
std::shared_ptr< ConstTensorHandle > m_Variance
A unique pointer to store Variance values.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
std::shared_ptr< ConstTensorHandle > m_Bias
A unique pointer to store Bias values.
DataType GetBiasDataType(DataType inputDataType)
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
std::shared_ptr< ConstTensorHandle > m_Bias
A unique pointer to store Bias values.
std::shared_ptr< ConstTensorHandle > m_Weight
A unique pointer to store Weight values.
void SetTensorInfo(const TensorInfo &tensorInfo) override
void SetConstant(const bool IsConstant=true)
Marks the data corresponding to this tensor info as constant.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
This layer represents a convolution 2d operation.
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
uint32_t m_PadLeft
Padding left value in the width dimension.
uint32_t m_PadRight
Padding right value in the width dimension.