30 #include "tests/datasets/FullyConnectedLayerDataset.h" 35 #include "tests/validation/fixtures/FullyConnectedLayerFixture.h" 46 RelativeTolerance<float> tolerance_f32(0.05f);
47 RelativeTolerance<half_float::half> tolerance_f16(
half(0.2));
48 constexpr
float tolerance_num = 0.07f;
51 constexpr AbsoluteTolerance<float> tolerance_fixed_point(1.f);
53 constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1);
72 FullyConnectedParameters),
74 src_shape, weights_shape, bias_shape, dst_shape, transpose_weights, reshape_weights,
data_type)
84 if(!reshape_weights || !transpose_weights)
86 const size_t shape_x = ws.
x();
92 CLTensor src = create_tensor<CLTensor>(src_shape,
data_type, 1, fixed_point_position, quantization_info);
93 CLTensor weights = create_tensor<CLTensor>(ws,
data_type, 1, fixed_point_position, quantization_info);
94 CLTensor bias = create_tensor<CLTensor>(bias_shape, bias_data_type, 1, fixed_point_position, quantization_info);
95 CLTensor dst = create_tensor<CLTensor>(dst_shape,
data_type, 1, fixed_point_position, quantization_info);
103 const QuantizationInfo weights_quantization_info = weights.info()->quantization_info();
107 fc.
configure(&src, &weights, &bias, &dst, transpose_weights, !reshape_weights);
155 &weights_info.clone()->set_is_resizable(
false),
156 &bias_info.clone()->set_is_resizable(
false),
157 &output_info.clone()->set_is_resizable(
false),
165 template <
typename T>
171 FullyConnectedParameters),
178 FullyConnectedParameters),
202 template <
typename T>
209 FullyConnectedParameters),
212 framework::dataset::
make("FractionalBits", 1, 6)))
218 FullyConnectedParameters),
231 FullyConnectedParameters),
234 framework::dataset::
make("FractionalBits", 1, 14)))
240 FullyConnectedParameters),
251 template <
typename T>
257 combine(datasets::SmallFullyConnectedLayerDataset(),
258 FullyConnectedParameters),
259 framework::dataset::
make("
DataType", DataType::QASYMM8)),
266 combine(datasets::LargeFullyConnectedLayerDataset(),
267 FullyConnectedParameters),
FullyConnectedLayerValidationQuantizedFixture< CLTensor, CLAccessor, CLFullyConnectedLayer, T, false > CLFullyConnectedLayerQuantizedFixture
quantized, symmetric fixed-point 16-bit number
Basic function to compute a Fully Connected layer on OpenCL.
quantized, symmetric fixed-point 8-bit number
bool is_resizable() const override
Flag indicating whether the size of the tensor can be changed.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, bool transpose_weights=true, bool are_weights_reshaped=false)
Static function to check if given info will lead to a valid configuration of CLFullyConnectedLayer.
QuantizationInfo quantization_info() const override
Get the quantization settings (scale and offset) of the tensor.
half_float::half half
16-bit floating point type
1 channel, 1 F32 per channel
FullyConnectedLayerValidationFixture< CLTensor, CLAccessor, CLFullyConnectedLayer, T, false > CLFullyConnectedLayerFixture
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
TensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
void configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, bool transpose_weights=true, bool are_weights_reshaped=false)
Set the input and output tensors.
This file contains all available output stages for GEMMLowp on OpenCL.
1 channel, 1 F16 per channel
#define TEST_SUITE(SUITE_NAME)
T x() const
Alias to access the size of the first dimension.
1 channel, 1 S32 per channel
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsoluteDifferenceFixture< uint8_t >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), AbsoluteDifferenceU8Dataset))
validate(dst.info() ->valid_region(), dst_valid_region)
DatasetMode
Possible dataset modes.
quantized, asymmetric fixed-point 8-bit number
bool is_data_type_fixed_point(DataType dt)
Check if a given data type is of fixed point type.
Accessor implementation for CLTensor objects.
FullyConnectedLayerValidationFixedPointFixture< CLTensor, CLAccessor, CLFullyConnectedLayer, T, false > CLFullyConnectedLayerFixedPointFixture
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), AbsoluteDifferenceU8Dataset), shape, data_type0, data_type1, output_data_type)
TEST_SUITE_END() DATA_TEST_CASE(Configuration
T y() const
Alias to access the size of the second dimension.
const ValidRegion dst_valid_region
ARM_COMPUTE_EXPECT(src.info() ->is_resizable(), framework::LogLevel::ERRORS)
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true)
Accessor to set the value of one of the dimensions.
combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType",{DataType::U8, DataType::S16})), datasets::BorderModes()), framework::dataset::make("filter_size",{5}))
Store the tensor's metadata.
JoinDataset< T, U > concat(T &&dataset1, U &&dataset2)
Helper function to create a JoinDataset.
Quantization settings (used for QASYMM8 data type)
Container for valid region of a window.
DataType
Available data types.
zip(zip(zip(framework::dataset::make("InputInfo",{TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F16), TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::QASYMM8), TensorInfo(TensorShape(5U, 5U, 5U, 3U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 37U, 2U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 37U, 22U), 1, DataType::F32)}), framework::dataset::make("OutputInfo",{TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F16), TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::QASYMM8), TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32), TensorInfo(TensorShape(1U, 1U, 16U), 1, DataType::F32), TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32), TensorInfo(TensorShape(2U, 37U, 16U), 1, DataType::F32), TensorInfo(TensorShape(22U, 37U, 36U), 1, DataType::F32)})), framework::dataset::make("WinogradInfo",{WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(3U, 3U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(), PadStrideInfo(), DataLayout::NCHW)})), framework::dataset::make("Expected",{false, false, false, false, true, true, true}))
convolution configure & src
ValidRegion shape_to_valid_region(const TensorShape &a_shape, bool border_undefined=false, BorderSize border_size=BorderSize(0))
Create a valid region based on tensor shape, border mode and border size.
Basic implementation of the OpenCL tensor interface.