30 #include "tests/datasets/FullyConnectedLayerDataset.h" 35 #include "tests/validation/fixtures/FullyConnectedLayerFixture.h" 46 constexpr RelativeTolerance<float> tolerance_f32(0.01f);
47 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 48 constexpr RelativeTolerance<float> tolerance_f16(0.01f);
51 constexpr AbsoluteTolerance<float> tolerance_fixed_point(1.f);
56 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 71 FullyConnectedParameters),
73 src_shape, weights_shape, bias_shape, dst_shape, transpose_weights, reshape_weights,
data_type)
78 TensorShape ws(weights_shape);
81 if(!reshape_weights || !transpose_weights)
83 const size_t shape_x = ws.x();
89 if(!reshape_weights && dst_shape.y() > 1)
92 const size_t shape_x = ws.x();
93 ws.set(0, ws.y() *
static_cast<unsigned int>(transpose_width));
94 ws.set(1, static_cast<unsigned int>(std::ceil(shape_x / transpose_width)));
99 Tensor
src = create_tensor<Tensor>(src_shape,
data_type, 1, fixed_point_position);
100 Tensor weights = create_tensor<Tensor>(ws,
data_type, 1, fixed_point_position);
101 Tensor bias = create_tensor<Tensor>(bias_shape,
data_type, 1, fixed_point_position);
102 Tensor
dst = create_tensor<Tensor>(dst_shape,
data_type, 1, fixed_point_position);
110 NEFullyConnectedLayer fc;
111 fc.configure(&src, &weights, &bias, &dst, transpose_weights, !reshape_weights);
158 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), transpose_weights, reshaped_weights);
164 template <
typename T>
168 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 171 FullyConnectedParameters),
178 FullyConnectedParameters),
203 template <
typename T>
210 FullyConnectedParameters),
213 framework::dataset::
make("FractionalBits", 1, 6)))
219 FullyConnectedParameters),
232 FullyConnectedParameters),
235 framework::dataset::
make("FractionalBits", 1, 14)))
241 FullyConnectedParameters),
quantized, symmetric fixed-point 16-bit number
FullyConnectedLayerValidationFixedPointFixture< Tensor, Accessor, NEFullyConnectedLayer, T, true > NEFullyConnectedLayerFixedPointFixture
quantized, symmetric fixed-point 8-bit number
half_float::half half
16-bit floating point type
1 channel, 1 F32 per channel
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
This file contains all available output stages for GEMMLowp on OpenCL.
1 channel, 1 F16 per channel
FullyConnectedLayerValidationFixture< Tensor, Accessor, NEFullyConnectedLayer, T, true > NEFullyConnectedLayerFixture
#define TEST_SUITE(SUITE_NAME)
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsoluteDifferenceFixture< uint8_t >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), AbsoluteDifferenceU8Dataset))
validate(dst.info() ->valid_region(), dst_valid_region)
Accessor implementation for Tensor objects.
DatasetMode
Possible dataset modes.
bool is_data_type_fixed_point(DataType dt)
Check if a given data type is of fixed point type.
size_t data_size_from_type(DataType data_type)
The size in bytes of the data 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
const ValidRegion dst_valid_region
ARM_COMPUTE_EXPECT(src.info() ->is_resizable(), framework::LogLevel::ERRORS)
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.
DataType
Available data types.
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.
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.