10 #include <doctest/doctest.h> 15 #define TEST_CASE_CHECK_LAYER_VISITOR_NAME_AND_DESCRIPTOR(name, testName) \ 16 TEST_CASE(#testName) \ 18 const char* layerName = "name##Layer"; \ 19 armnn::name##Descriptor descriptor = GetDescriptor<armnn::name##Descriptor>(); \ 20 Test##name##LayerVisitor visitor(descriptor, layerName); \ 21 armnn::NetworkImpl net; \ 22 armnn::IConnectableLayer *const layer = net.Add##name##Layer(descriptor, layerName); \ 23 layer->ExecuteStrategy(visitor); \ 26 #define TEST_CASE_CHECK_LAYER_VISITOR_NAME_NULLPTR_AND_DESCRIPTOR(name, testName) \ 27 TEST_CASE(#testName) \ 29 armnn::name##Descriptor descriptor = GetDescriptor<armnn::name##Descriptor>(); \ 30 Test##name##LayerVisitor visitor(descriptor); \ 31 armnn::NetworkImpl net; \ 32 armnn::IConnectableLayer *const layer = net.Add##name##Layer(descriptor); \ 33 layer->ExecuteStrategy(visitor); \ 36 template<
typename Descriptor> Descriptor GetDescriptor();
43 descriptor.
m_A = 2.0f;
44 descriptor.
m_B = 2.0f;
75 for (
unsigned int i = 0u; i < descriptor.GetNumViews(); ++i)
77 for (
unsigned int j = 0u; j < descriptor.GetNumDimensions(); ++j)
79 descriptor.SetViewOriginCoord(i, j, i);
110 descriptor.
m_Eps = 0.0001f;
120 descriptor.
m_Eps = 0.0001f;
147 descriptor.
m_K = 1.0f;
234 for (
unsigned int i = 0u; i < descriptor.GetNumViews(); ++i)
236 for (
unsigned int j = 0u; j < descriptor.GetNumDimensions(); ++j)
238 descriptor.SetViewOriginCoord(i, j, i);
239 descriptor.SetViewSize(i, j, 1);
257 descriptor.m_EndMask = 1;
258 descriptor.m_ShrinkAxisMask = 1;
259 descriptor.m_EllipsisMask = 1;
260 descriptor.m_NewAxisMask = 1;
286 CheckInstanceNormalizationLayerVisitorNameAndDescriptor)
307 CheckAdditionLayerVisitorNameNullptrAndDescriptor)
309 CheckArgMinMaxLayerVisitorNameNullptrAndDescriptor)
311 CheckDepthToSpaceLayerVisitorNameNullptrAndDescriptor)
313 CheckBatchToSpaceNdLayerVisitorNameNullptrAndDescriptor)
315 CheckComparisonLayerVisitorNameNullptrAndDescriptor)
317 CheckConcatLayerVisitorNameNullptrAndDescriptor)
319 CheckElementwiseUnaryLayerVisitorNameNullptrAndDescriptor)
321 CheckFillLayerVisitorNameNullptrAndDescriptor)
323 CheckGatherLayerVisitorNameNullptrAndDescriptor)
325 CheckInstanceNormalizationLayerVisitorNameNullptrAndDescriptor)
327 CheckL2NormalizationLayerVisitorNameNullptrAndDescriptor)
329 CheckLogicalBinaruLayerVisitorNameNullptrAndDescriptor)
331 CheckLogSoftmaxLayerVisitorNameNullptrAndDescriptor)
333 CheckMeanLayerVisitorNameNullptrAndDescriptor)
335 CheckNormalizationLayerVisitorNameNullptrAndDescriptor)
337 CheckPadLayerVisitorNameNullptrAndDescriptor)
339 CheckPermuteLayerVisitorNameNullptrAndDescriptor)
341 CheckPooling2dLayerVisitorNameNullptrAndDescriptor)
343 CheckReshapeLayerVisitorNameNullptrAndDescriptor)
345 CheckResizeLayerVisitorNameNullptrAndDescriptor)
347 CheckSliceLayerVisitorNameNullptrAndDescriptor)
349 CheckSoftmaxLayerVisitorNameNullptrAndDescriptor)
351 CheckSpaceToBatchNdLayerVisitorNameNullptrAndDescriptor)
353 CheckSpaceToDepthLayerVisitorNameNullptrAndDescriptor)
355 CheckSplitterLayerVisitorNameNullptrAndDescriptor)
357 CheckStackLayerVisitorNameNullptrAndDescriptor)
359 CheckStridedSliceLayerVisitorNameNullptrAndDescriptor)
361 CheckTransposeLayerVisitorNameNullptrAndDescriptor)
float m_Eps
Used to avoid dividing by zero.
A ViewsDescriptor for the SplitterLayer.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
void Slice(const TensorInfo &inputInfo, const SliceDescriptor &descriptor, const void *inputData, void *outputData, unsigned int dataTypeSize)
float m_K
Kappa value used for the across channel normalization equation.
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
uint32_t m_PadLeft
Padding left value in the width dimension.
A ReshapeDescriptor for the ReshapeLayer.
void Splitter(const SplitterQueueDescriptor &data, std::vector< ITensorHandle *> inputs, std::vector< ITensorHandle *> outputs)
void Stack(const StackQueueDescriptor &data, std::vector< std::unique_ptr< Decoder< float >>> &inputs, Encoder< float > &output, const TensorInfo &inputInfo, const TensorInfo &outputInfo)
#define TEST_CASE_CHECK_LAYER_VISITOR_NAME_AND_DESCRIPTOR(name, testName)
void Fill(Encoder< float > &output, const TensorShape &desiredOutputShape, const float value)
Creates a tensor and fills it with a scalar value.
A ComparisonDescriptor for the ComparisonLayer.
uint32_t m_PoolWidth
Pooling width value.
float m_Alpha
Alpha value for the normalization equation.
float m_Gamma
Gamma, the scale scalar value applied for the normalized tensor. Defaults to 1.0. ...
float m_Beta
Exponentiation value.
PaddingMethod m_PaddingMethod
The padding method to be used. (Exclude, IgnoreValue).
ArgMinMaxFunction m_Function
Specify if the function is to find Min or Max.
uint32_t m_PadTop
Padding top value in the height dimension.
A LogicalBinaryDescriptor for the LogicalBinaryLayer.
void Transpose(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)
void DepthToSpace(const TensorInfo &inputInfo, const DepthToSpaceDescriptor &descriptor, const void *inputData, void *outputData, unsigned int dataTypeSize)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
void ArgMinMax(Decoder< float > &in, OUT *out, const TensorInfo &inputTensorInfo, const TensorInfo &outputTensorInfo, ArgMinMaxFunction function, int axis)
int32_t m_BeginMask
Begin mask value.
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
#define TEST_CASE_CHECK_LAYER_VISITOR_NAME_NULLPTR_AND_DESCRIPTOR(name, testName)
NormalizationAlgorithmMethod m_NormMethodType
Normalization method algorithm to use (LocalBrightness, LocalContrast).
A ResizeBilinearDescriptor for the ResizeBilinearLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
A StackDescriptor for the StackLayer.
uint32_t m_PoolHeight
Pooling height value.
A PadDescriptor for the PadLayer.
void Permute(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)
uint32_t m_PadRight
Padding right value in the width dimension.
float m_Eps
Epsilon, small scalar value added to variance to avoid dividing by zero. Defaults to 1e-12f...
A L2NormalizationDescriptor for the L2NormalizationLayer.
An ArgMinMaxDescriptor for ArgMinMaxLayer.
void Gather(const TensorInfo ¶msInfo, const TensorInfo &indicesInfo, const TensorInfo &outputInfo, Decoder< float > ¶ms, const int32_t *indices, Encoder< float > &output, const int32_t axis)
An OriginsDescriptor for the ConcatLayer.
uint32_t m_TargetWidth
Target width value.
float Activation(float in, ActivationFunction function, float a, float b)
A GatherDescriptor for the GatherLayer.
void Pad(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const ITensorHandle *inputHandle, ITensorHandle *outputHandle, const PadQueueDescriptor &data)
void LogSoftmax(Decoder< float > &input, Encoder< float > &output, const TensorInfo &inputInfo, const LogSoftmaxDescriptor &descriptor)
An ActivationDescriptor for the ActivationLayer.
uint32_t m_TargetHeight
Target height value.
A SliceDescriptor for the SliceLayer.
void SpaceToBatchNd(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const SpaceToBatchNdDescriptor ¶ms, Decoder< float > &inputData, Encoder< float > &outputData)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
float m_Beta
Beta, the offset scalar value applied for the normalized tensor. Defaults to 1.0. ...
TEST_SUITE("TestNameAndDescriptorLayerVisitor")
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
NormalizationAlgorithmChannel m_NormChannelType
Normalization channel algorithm to use (Across, Within).
float m_A
Alpha upper bound value used by the activation functions. (BoundedReLu, Linear, TanH, Elu).
void StridedSlice(const TensorInfo &inputInfo, const StridedSliceDescriptor ¶ms, const void *inputData, void *outputData, unsigned int dataTypeSize)
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
PoolingAlgorithm m_PoolType
The pooling algorithm to use (Max. Average, L2).
The padding fields count, but are ignored.
Jarret 2009: Local Contrast Normalization.
OutputShapeRounding m_OutputShapeRounding
The rounding method for the output shape. (Floor, Ceiling).
A MeanDescriptor for the MeanLayer.
A TransposeDescriptor for the TransposeLayer.
A StridedSliceDescriptor for the StridedSliceLayer.
int m_Axis
Axis to reduce across the input tensor.
void SpaceToDepth(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const SpaceToDepthDescriptor ¶ms, Decoder< float > &inputData, Encoder< float > &outputData)
void BatchToSpaceNd(const DataLayoutIndexed &dataLayout, const TensorInfo &inputTensorInfo, const TensorInfo &outputTensorInfo, const std::vector< unsigned int > &blockShape, const std::vector< std::pair< unsigned int, unsigned int >> &cropsData, Decoder< float > &inputDecoder, Encoder< float > &outputEncoder)
A Pooling2dDescriptor for the Pooling2dLayer.
A NormalizationDescriptor for the NormalizationLayer.
void Pooling2d(Decoder< float > &rInputDecoder, Encoder< float > &rOutputEncoder, const TensorInfo &inputInfo, const TensorInfo &outputInfo, const Pooling2dDescriptor ¶ms)
Computes the Pooling2d operation.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
void Softmax(Decoder< float > &in, Encoder< float > &out, const TensorInfo &inputTensorInfo, float beta, int axis)
Computes the softmax function on some inputs, into outputs, with a shape given by tensorInfo...
float m_B
Beta lower bound value used by the activation functions. (BoundedReLu, Linear, TanH).
A SoftmaxDescriptor for the SoftmaxLayer.
float m_Beta
Beta value for the normalization equation.
uint32_t m_NormSize
Depth radius value.
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square, Elu).
void Resize(Decoder< float > &in, const TensorInfo &inputInfo, Encoder< float > &out, const TensorInfo &outputInfo, DataLayoutIndexed dataLayout, armnn::ResizeMethod resizeMethod, bool alignCorners, bool halfPixelCenters)
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
A FillDescriptor for the FillLayer.
A PermuteDescriptor for the PermuteLayer.