30 #include "tests/datasets/FullyConnectedLayerDataset.h" 35 #include "tests/validation/fixtures/FullyConnectedLayerFixture.h" 46 constexpr RelativeTolerance<float> rel_tolerance_f32(0.01f);
48 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 49 const AbsoluteTolerance<float> abs_tolerance_f16(0.3f);
50 const RelativeTolerance<half_float::half> rel_tolerance_f16(
half_float::half(0.2f));
55 constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1);
61 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 71 QuantizationInfo(1.f / 256.f, 10),
72 QuantizationInfo(1.1f, 10),
76 ActivationLayerInfo(),
138 Status status =
NEFullyConnectedLayer::validate(&
input_info.clone()->set_is_resizable(
false), &weights_info.clone()->set_is_resizable(
false), &bias_info.clone()->set_is_resizable(
false), &output_info.clone()->set_is_resizable(
false), fc_info);
144 template <
typename T>
148 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 151 FullyConnectedParameters),
153 EmptyActivationFunctionDataset))
156 validate(
Accessor(_target), _reference, rel_tolerance_f16, tolerance_num_f16, abs_tolerance_f16);
159 combine(datasets::FullyConnectedLayerWithActivationDataset(),
160 FullyConnectedParameters),
162 ActivationFunctionsDataset))
165 validate(
Accessor(_target), _reference, rel_tolerance_f16, tolerance_num_f16, abs_tolerance_f16);
168 FullyConnectedParameters),
170 EmptyActivationFunctionDataset))
173 validate(
Accessor(_target), _reference, rel_tolerance_f16, tolerance_num_f16, abs_tolerance_f16);
181 EmptyActivationFunctionDataset))
187 combine(datasets::FullyConnectedLayerWithActivationDataset(),
188 FullyConnectedParameters),
190 ActivationFunctionsDataset))
197 EmptyActivationFunctionDataset))
205 template <
typename T>
211 combine(datasets::SmallFullyConnectedLayerDataset(),
212 FullyConnectedParameters),
213 framework::dataset::
make("
DataType", DataType::QASYMM8)),
215 EmptyActivationFunctionDataset))
222 combine(datasets::FullyConnectedLayerWithActivationDataset(),
223 FullyConnectedParameters),
226 ActivationFunctionsQuantizedDataset))
233 combine(datasets::LargeFullyConnectedLayerDataset(),
234 FullyConnectedParameters),
237 EmptyActivationFunctionDataset))
245 combine(datasets::SmallFullyConnectedLayerDataset(),
246 FullyConnectedParameters),
247 framework::dataset::
make("
DataType", DataType::QASYMM8_SIGNED)),
249 EmptyActivationFunctionDataset))
256 combine(datasets::FullyConnectedLayerWithActivationDataset(),
257 FullyConnectedParameters),
260 ActivationFunctionsQuantizedDataset))
constexpr float tolerance_num_f16
F16 Tolerance number.
half_float::half half
16-bit floating point type
1 channel, 1 F32 per channel
ARM_COMPUTE_EXPECT(has_error==expected, framework::LogLevel::ERRORS)
FullyConnectedLayerValidationFixture< Tensor, Accessor, NEFullyConnectedLayer, T > NEFullyConnectedLayerFixture
Fully connected layer info.
constexpr AbsoluteTolerance< int8_t > tolerance_qasymm8_signed
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
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)
Accessor implementation for Tensor objects.
DatasetMode
Possible dataset modes.
TEST_SUITE_END() FIXTURE_DATA_TEST_CASE(RunSmall
[CLActivationLayer Test snippet]
quantized, asymmetric fixed-point 8-bit number unsigned
bool are_weights_reshaped
Reshape the weights tensor if false.
TEST_SUITE(U8_to_S8) FIXTURE_DATA_TEST_CASE(RunSmall
FullyConnectedLayerValidationQuantizedFixture< Tensor, Accessor, NEFullyConnectedLayer, T > NEFullyConnectedLayerQuantizedFixture
validate(CLAccessor(output_state), expected_output)
Lower and Upper Bounded Rectifier ( )
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsLayerFixture< half >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)))
Upper Bounded Rectifier ( )
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, FullyConnectedLayerInfo fc_info=FullyConnectedLayerInfo())
Static function to check if given info will lead to a valid configuration of NEFullyConnectedLayer.
bool transpose_weights
Transpose weights if true.
Store the tensor's metadata.
quantized, asymmetric fixed-point 8-bit number signed
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.
constexpr float abs_tolerance_f32(0.0001f)
F32 Absolute tolerance value for comparing reference's output against implementation's output for flo...
combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)))
const auto QuantizationData