31 #include "tests/datasets/ShapeDatasets.h" 36 #include "tests/validation/fixtures/DirectConvolutionLayerFixture.h" 46 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 47 const RelativeTolerance<half_float::half> rel_tolerance_f16(
half_float::half(0.2f));
48 const AbsoluteTolerance<float> abs_tolerance_f16(0.2f);
49 constexpr
float tolerance_num = 0.07f;
72 const auto data_f32 =
combine(datasets::SmallDirectConvolutionShapes(),
77 const auto data_f16 =
combine(datasets::SmallDirectConvolutionShapes(),
82 const auto data_prec =
combine(datasets::SmallDirectConvolutionShapes(),
89 const auto data9x9 =
combine(datasets::SmallDirectConvolutionShapes(),
111 constexpr AbsoluteTolerance<float> usecase_tolerance_fp32(0.05f);
124 ActivationLayerInfo(),
137 const auto src_shape = TensorShape(27U, 13U, 2U);
138 const auto weights_shape = TensorShape(3U, 3U, 2U, 4U);
140 const auto dst_shape = TensorShape(25U, 11U, 4U);
143 auto src = create_tensor<Tensor>(src_shape,
dt);
144 auto weights = create_tensor<Tensor>(weights_shape,
dt);
147 const auto conv_info = PadStrideInfo(1, 1, 0, 0);
150 NEDirectConvolutionLayer conv{};
151 conv.configure(&
src, &weights,
nullptr, &dst, conv_info);
153 src.allocator()->allocate();
154 weights.allocator()->allocate();
155 dst.allocator()->allocate();
157 library->fill_tensor_value(Accessor(
src), 1.f);
158 library->fill_tensor_value(Accessor(weights), 1.f);
163 SimpleTensor<float> ref_src{ src_shape, dt };
164 SimpleTensor<float> ref_weights{ weights_shape, dt };
165 SimpleTensor<float> ref_bias{
bias_shape, dt };
166 library->fill_tensor_value(ref_src, 1.f);
167 library->fill_tensor_value(ref_weights, 1.f);
169 library->fill_tensor_value(ref_bias, 0.f);
170 auto ref_dst = reference::convolution_layer<float>(ref_src, ref_weights, ref_bias,
dst_shape,
conv_info);
240 framework::dataset::make(
"Expected", {
false,
false,
false,
false,
false,
false,
false,
false,
false })),
243 bool is_valid = bool(
NEDirectConvolutionLayer::validate(&
input_info.clone()->set_is_resizable(
false), &weights_info.clone()->set_is_resizable(
false), &biases_info.clone()->set_is_resizable(
false), &output_info.clone()->set_is_resizable(
false),
conv_info, act_info));
251 ActivationFunctionsDataset),
257 TensorShape weights_shape(kernel_size, kernel_size, input_shape.
z(), num_kernels);
279 conv.
configure(&src, &weights,
nullptr, &dst, info, act_info);
286 template <
typename T>
288 template <
typename T>
292 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 296 ActivationFunctionsDataset),
300 validate(
Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16);
303 ActivationFunctionsDataset),
307 validate(
Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16);
315 ActivationFunctionsDataset),
323 ActivationFunctionsDataset),
331 ActivationFunctionsDataset),
339 ActivationFunctionsDataset),
DirectConvolutionValidationFixture< Tensor, Accessor, NEDirectConvolutionLayer, T, true > NEDirectConvolutionLayerMixedDataLayoutFixture
TensorShape compute_deep_convolution_shape(const ITensorInfo &input, const ITensorInfo &weights, PadStrideInfo conv_info)
Calculate the deep convolution shape output shape of a tensor.
half_float::half half
16-bit floating point type
1 channel, 1 F32 per channel
ARM_COMPUTE_EXPECT(has_error==expected, framework::LogLevel::ERRORS)
Strides PermutationVector
Permutation vector.
const DataLayout data_layout
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
RelativeTolerance< float > tolerance_fp32(0.001f)
Activation Layer Information class.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
void permute(Dimensions< T > &dimensions, const PermutationVector &perm)
Permutes given Dimensions according to a permutation vector.
Quantization information.
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), }), framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), })), framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::SQRT), })), framework::dataset::make("Expected", { false, true, true, true, false, false, true, true, false })), input_info, output_info, act_info, expected)
TensorShape input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
Accessor implementation for Tensor objects.
DatasetMode
Possible dataset modes.
std::unique_ptr< AssetsLibrary > library
TEST_SUITE_END() FIXTURE_DATA_TEST_CASE(RunSmall
[CLActivationLayer Test snippet]
T z() const
Alias to access the size of the third dimension.
Basic implementation of the tensor interface.
TEST_SUITE(U8_to_S8) FIXTURE_DATA_TEST_CASE(RunSmall
Padding and stride information class.
validate(CLAccessor(output_state), expected_output)
virtual PaddingSize padding() const =0
Padding of tensor.
BorderSize PaddingSize
Container for 2D padding size.
Num samples, channels, height, width.
void configure(ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Set the input, weights, biases and output tensors.
Function to run the direct convolution.
Lower and Upper Bounded Rectifier ( )
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsLayerFixture< half >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)))
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Num samples, height, width, channels.
Store the tensor's metadata.
JoinDataset< T, U > concat(T &&dataset1, U &&dataset2)
Helper function to create a JoinDataset.
TEST_CASE(FusedActivation, framework::DatasetMode::ALL)
Validate fused activation expecting the following behaviours:
zip(zip(framework::dataset::make("Weights", { TensorInfo(TensorShape(32U, 13U, 2U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U, 1U), 1, DataType::F32), }), framework::dataset::make("MVBGInfo",{ TensorInfo(TensorShape(2U), 1, DataType::F32), TensorInfo(TensorShape(2U), 1, DataType::F16), TensorInfo(TensorShape(5U), 1, DataType::F32), })), framework::dataset::make("Expected", { true, false, false}))
DataType
Available data types.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, const ITensorInfo *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Static function to check if given info will lead to a valid configuration of NEDirectConvolutionLayer...
DataLayout
[DataLayout enum definition]
combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)))
DirectConvolutionValidationFixture< Tensor, Accessor, NEDirectConvolutionLayer, T > NEDirectConvolutionLayerFixture