arm_compute v18.08
diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h
index 1fba3d4..b1c8c43 100644
--- a/tests/AssetsLibrary.h
+++ b/tests/AssetsLibrary.h
@@ -480,7 +480,7 @@
for(int channel = 0; channel < tensor.num_channels(); ++channel)
{
const ResultType value = distribution(gen);
- ResultType &target_value = reinterpret_cast<ResultType *const>(tensor(id))[channel];
+ ResultType &target_value = reinterpret_cast<ResultType *>(tensor(id))[channel];
store_value_with_data_type(&target_value, value, tensor.data_type());
}
@@ -564,7 +564,6 @@
break;
}
case DataType::S8:
- case DataType::QS8:
{
std::uniform_int_distribution<int8_t> distribution_s8(std::numeric_limits<int8_t>::lowest(), std::numeric_limits<int8_t>::max());
fill(tensor, distribution_s8, seed_offset);
@@ -577,7 +576,6 @@
break;
}
case DataType::S16:
- case DataType::QS16:
{
std::uniform_int_distribution<int16_t> distribution_s16(std::numeric_limits<int16_t>::lowest(), std::numeric_limits<int16_t>::max());
fill(tensor, distribution_s16, seed_offset);
@@ -653,7 +651,6 @@
break;
}
case DataType::S8:
- case DataType::QS8:
{
ARM_COMPUTE_ERROR_ON(!(std::is_same<int8_t, D>::value));
std::uniform_int_distribution<int8_t> distribution_s8(low, high);
@@ -668,7 +665,6 @@
break;
}
case DataType::S16:
- case DataType::QS16:
{
ARM_COMPUTE_ERROR_ON(!(std::is_same<int16_t, D>::value));
std::uniform_int_distribution<int16_t> distribution_s16(low, high);
diff --git a/tests/CL/CLAccessor.h b/tests/CL/CLAccessor.h
index 66f3df0..8e800c7 100644
--- a/tests/CL/CLAccessor.h
+++ b/tests/CL/CLAccessor.h
@@ -77,7 +77,6 @@
int num_channels() const override;
int num_elements() const override;
PaddingSize padding() const override;
- int fixed_point_position() const override;
QuantizationInfo quantization_info() const override;
const void *operator()(const Coordinates &coord) const override;
void *operator()(const Coordinates &coord) override;
@@ -142,11 +141,6 @@
return _tensor.info()->padding();
}
-inline int CLAccessor::fixed_point_position() const
-{
- return _tensor.info()->fixed_point_position();
-}
-
inline QuantizationInfo CLAccessor::quantization_info() const
{
return _tensor.info()->quantization_info();
diff --git a/tests/CL/Helper.h b/tests/CL/Helper.h
index 30fbe56..32f9ca0 100644
--- a/tests/CL/Helper.h
+++ b/tests/CL/Helper.h
@@ -47,6 +47,15 @@
k->configure(std::forward<Args>(args)...);
_kernel = std::move(k);
}
+ /** Validate input arguments
+ *
+ * @param[in] args Configuration arguments.
+ */
+ template <typename... Args>
+ static Status validate(Args &&... args)
+ {
+ return K::validate(std::forward<Args>(args)...);
+ }
};
/** As above but this also setups a Zero border on the input tensor of the specified bordersize */
diff --git a/tests/GLES_COMPUTE/GCAccessor.h b/tests/GLES_COMPUTE/GCAccessor.h
index df0fbaa..6b722b4 100644
--- a/tests/GLES_COMPUTE/GCAccessor.h
+++ b/tests/GLES_COMPUTE/GCAccessor.h
@@ -65,7 +65,6 @@
int num_channels() const override;
int num_elements() const override;
PaddingSize padding() const override;
- int fixed_point_position() const override;
QuantizationInfo quantization_info() const override;
const void *operator()(const Coordinates &coord) const override;
void *operator()(const Coordinates &coord) override;
@@ -130,11 +129,6 @@
return _tensor.info()->padding();
}
-inline int GCAccessor::fixed_point_position() const
-{
- return _tensor.info()->fixed_point_position();
-}
-
inline QuantizationInfo GCAccessor::quantization_info() const
{
return _tensor.info()->quantization_info();
diff --git a/tests/GLES_COMPUTE/Helper.h b/tests/GLES_COMPUTE/Helper.h
index 65f9926..c04c6b6 100644
--- a/tests/GLES_COMPUTE/Helper.h
+++ b/tests/GLES_COMPUTE/Helper.h
@@ -37,17 +37,16 @@
{
/** Helper to create an empty tensor.
*
- * @param[in] shape Desired shape.
- * @param[in] data_type Desired data type.
- * @param[in] num_channels (Optional) It indicates the number of channels for each tensor element
- * @param[in] fixed_point_position (Optional) Fixed point position that expresses the number of bits for the fractional part of the number when the tensor's data type is QS8 or QS16.
+ * @param[in] shape Desired shape.
+ * @param[in] data_type Desired data type.
+ * @param[in] num_channels (Optional) It indicates the number of channels for each tensor element
*
* @return Empty @ref GCTensor with the specified shape and data type.
*/
-inline GCTensor create_tensor(const TensorShape &shape, DataType data_type, int num_channels = 1, int fixed_point_position = 0)
+inline GCTensor create_tensor(const TensorShape &shape, DataType data_type, int num_channels = 1)
{
GCTensor tensor;
- tensor.allocator()->init(TensorInfo(shape, num_channels, data_type, fixed_point_position));
+ tensor.allocator()->init(TensorInfo(shape, num_channels, data_type));
return tensor;
}
diff --git a/tests/IAccessor.h b/tests/IAccessor.h
index 609eafe..fac526c 100644
--- a/tests/IAccessor.h
+++ b/tests/IAccessor.h
@@ -94,12 +94,6 @@
*/
virtual PaddingSize padding() const = 0;
- /** Number of bits for the fractional part.
- *
- * @return the number of bits for the fractional part.
- */
- virtual int fixed_point_position() const = 0;
-
/** Quantization info in case of asymmetric quantized type
*
* @return
diff --git a/tests/NEON/Accessor.h b/tests/NEON/Accessor.h
index 60a94c2..ceb4c47 100644
--- a/tests/NEON/Accessor.h
+++ b/tests/NEON/Accessor.h
@@ -70,7 +70,6 @@
int num_channels() const override;
int num_elements() const override;
PaddingSize padding() const override;
- int fixed_point_position() const override;
QuantizationInfo quantization_info() const override;
const void *operator()(const Coordinates &coord) const override;
void *operator()(const Coordinates &coord) override;
@@ -129,11 +128,6 @@
return _tensor.info()->padding();
}
-inline int Accessor::fixed_point_position() const
-{
- return _tensor.info()->fixed_point_position();
-}
-
inline QuantizationInfo Accessor::quantization_info() const
{
return _tensor.info()->quantization_info();
diff --git a/tests/RawTensor.cpp b/tests/RawTensor.cpp
index bc2747d..ce2510f 100644
--- a/tests/RawTensor.cpp
+++ b/tests/RawTensor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,20 +27,20 @@
{
namespace test
{
-RawTensor::RawTensor(TensorShape shape, Format format, int fixed_point_position)
- : SimpleTensor(shape, format, fixed_point_position)
+RawTensor::RawTensor(TensorShape shape, Format format)
+ : SimpleTensor(shape, format)
{
_buffer = support::cpp14::make_unique<uint8_t[]>(SimpleTensor::num_elements() * SimpleTensor::num_channels() * SimpleTensor::element_size());
}
-RawTensor::RawTensor(TensorShape shape, DataType data_type, int num_channels, int fixed_point_position)
- : SimpleTensor(shape, data_type, num_channels, fixed_point_position)
+RawTensor::RawTensor(TensorShape shape, DataType data_type, int num_channels)
+ : SimpleTensor(shape, data_type, num_channels)
{
_buffer = support::cpp14::make_unique<uint8_t[]>(SimpleTensor::num_elements() * SimpleTensor::num_channels() * SimpleTensor::element_size());
}
RawTensor::RawTensor(const RawTensor &tensor)
- : SimpleTensor(tensor.shape(), tensor.data_type(), tensor.num_channels(), tensor.fixed_point_position())
+ : SimpleTensor(tensor.shape(), tensor.data_type(), tensor.num_channels())
{
_format = tensor.format();
_buffer = support::cpp14::make_unique<uint8_t[]>(num_elements() * num_channels() * element_size());
diff --git a/tests/RawTensor.h b/tests/RawTensor.h
index 3501ad1..6078f12 100644
--- a/tests/RawTensor.h
+++ b/tests/RawTensor.h
@@ -40,20 +40,18 @@
public:
/** Create an uninitialised tensor of the given @p shape and @p format.
*
- * @param[in] shape Shape of the new raw tensor.
- * @param[in] format Format of the new raw tensor.
- * @param[in] fixed_point_position (Optional) Number of bits for the fractional part of the fixed point numbers
+ * @param[in] shape Shape of the new raw tensor.
+ * @param[in] format Format of the new raw tensor.
*/
- RawTensor(TensorShape shape, Format format, int fixed_point_position = 0);
+ RawTensor(TensorShape shape, Format format);
/** Create an uninitialised tensor of the given @p shape and @p data type.
*
- * @param[in] shape Shape of the new raw tensor.
- * @param[in] data_type Data type of the new raw tensor.
- * @param[in] num_channels (Optional) Number of channels (default = 1).
- * @param[in] fixed_point_position (Optional) Number of bits for the fractional part of the fixed point numbers (default = 0).
+ * @param[in] shape Shape of the new raw tensor.
+ * @param[in] data_type Data type of the new raw tensor.
+ * @param[in] num_channels (Optional) Number of channels (default = 1).
*/
- RawTensor(TensorShape shape, DataType data_type, int num_channels = 1, int fixed_point_position = 0);
+ RawTensor(TensorShape shape, DataType data_type, int num_channels = 1);
/** Conversion constructor from SimpleTensor.
*
@@ -65,13 +63,12 @@
template <typename T>
RawTensor(SimpleTensor<T> &&tensor)
{
- _buffer = std::unique_ptr<uint8_t[]>(reinterpret_cast<uint8_t *>(tensor._buffer.release()));
- _shape = std::move(tensor._shape);
- _format = tensor._format;
- _data_type = tensor._data_type;
- _num_channels = tensor._num_channels;
- _fixed_point_position = tensor._fixed_point_position;
- _data_layout = tensor._data_layout;
+ _buffer = std::unique_ptr<uint8_t[]>(reinterpret_cast<uint8_t *>(tensor._buffer.release()));
+ _shape = std::move(tensor._shape);
+ _format = tensor._format;
+ _data_type = tensor._data_type;
+ _num_channels = tensor._num_channels;
+ _data_layout = tensor._data_layout;
}
/** Conversion operator to SimpleTensor.
@@ -84,13 +81,12 @@
operator SimpleTensor<T>()
{
SimpleTensor<T> cast;
- cast._buffer = std::unique_ptr<T[]>(reinterpret_cast<T *>(_buffer.release()));
- cast._shape = std::move(_shape);
- cast._format = _format;
- cast._data_type = _data_type;
- cast._num_channels = _num_channels;
- cast._fixed_point_position = _fixed_point_position;
- cast._data_layout = _data_layout;
+ cast._buffer = std::unique_ptr<T[]>(reinterpret_cast<T *>(_buffer.release()));
+ cast._shape = std::move(_shape);
+ cast._format = _format;
+ cast._data_type = _data_type;
+ cast._num_channels = _num_channels;
+ cast._data_layout = _data_layout;
return cast;
}
diff --git a/tests/SConscript b/tests/SConscript
index cea9ba8..38e4d47 100644
--- a/tests/SConscript
+++ b/tests/SConscript
@@ -53,6 +53,10 @@
Import("arm_compute_test_framework")
test_env.Append(LIBS = arm_compute_test_framework)
+# Remove -Wnoexcept from tests
+if 'g++' in test_env['CXX'] and '-Wnoexcept' in test_env['CXXFLAGS']:
+ test_env['CXXFLAGS'].remove("-Wnoexcept")
+
if env['os'] in ['android', 'bare_metal'] or env['standalone']:
Import("arm_compute_a")
Import("arm_compute_core_a")
@@ -61,6 +65,7 @@
arm_compute_lib = arm_compute_graph_a
else:
Import("arm_compute_graph_so")
+ Import("arm_compute_core_a")
test_env.Append(LIBS = ["arm_compute_graph", "arm_compute", "arm_compute_core"])
arm_compute_lib = arm_compute_graph_so
@@ -72,10 +77,6 @@
common_objects = [test_env.StaticObject(f) for f in common_files]
files_benchmark = Glob('benchmark/*.cpp')
-files_validation_framework = [test_env.Object(f) for f in Glob('validation/*.cpp')]
-
-# Always compile reference for validation
-files_validation_framework += [ test_env.Object(f) for f in Glob('validation/reference/*.cpp')]
# Add unit tests
files_validation = Glob('validation/UNIT/*/*.cpp')
@@ -126,7 +127,12 @@
Export('arm_compute_benchmark')
if test_env['validation_tests']:
- arm_compute_validation = test_env.Program('arm_compute_validation', files_validation_framework + files_validation + common_objects)
+ arm_compute_validation_framework = env.StaticLibrary('arm_compute_validation_framework', Glob('validation/reference/*.cpp') + Glob('validation/*.cpp'), LIBS= [ arm_compute_test_framework, arm_compute_core_a])
+ Depends(arm_compute_validation_framework , arm_compute_test_framework)
+ Depends(arm_compute_validation_framework , arm_compute_core_a)
+
+ arm_compute_validation = test_env.Program('arm_compute_validation', files_validation + common_objects, LIBS=[arm_compute_validation_framework] + test_env['LIBS'])
+ Depends(arm_compute_validation, arm_compute_validation_framework)
Depends(arm_compute_validation, arm_compute_test_framework)
Depends(arm_compute_validation, arm_compute_lib)
diff --git a/tests/SimpleTensor.h b/tests/SimpleTensor.h
index 8b3b370..335ef91 100644
--- a/tests/SimpleTensor.h
+++ b/tests/SimpleTensor.h
@@ -64,26 +64,23 @@
/** Create an uninitialised tensor of the given @p shape and @p format.
*
- * @param[in] shape Shape of the new raw tensor.
- * @param[in] format Format of the new raw tensor.
- * @param[in] fixed_point_position (Optional) Number of bits for the fractional part of the fixed point numbers
+ * @param[in] shape Shape of the new raw tensor.
+ * @param[in] format Format of the new raw tensor.
*/
- SimpleTensor(TensorShape shape, Format format, int fixed_point_position = 0);
+ SimpleTensor(TensorShape shape, Format format);
/** Create an uninitialised tensor of the given @p shape and @p data type.
*
- * @param[in] shape Shape of the new raw tensor.
- * @param[in] data_type Data type of the new raw tensor.
- * @param[in] num_channels (Optional) Number of channels (default = 1).
- * @param[in] fixed_point_position (Optional) Number of bits for the fractional part of the fixed point numbers (default = 0).
- * @param[in] quantization_info (Optional) Quantization info for asymmetric quantization (default = empty).
- * @param[in] data_layout (Optional) Data layout of the tensor (default = NCHW).
+ * @param[in] shape Shape of the new raw tensor.
+ * @param[in] data_type Data type of the new raw tensor.
+ * @param[in] num_channels (Optional) Number of channels (default = 1).
+ * @param[in] quantization_info (Optional) Quantization info for asymmetric quantization (default = empty).
+ * @param[in] data_layout (Optional) Data layout of the tensor (default = NCHW).
*/
SimpleTensor(TensorShape shape, DataType data_type,
- int num_channels = 1,
- int fixed_point_position = 0,
- QuantizationInfo quantization_info = QuantizationInfo(),
- DataLayout data_layout = DataLayout::NCHW);
+ int num_channels = 1,
+ QuantizationInfo quantization_info = QuantizationInfo(),
+ DataLayout data_layout = DataLayout::NCHW);
/** Create a deep copy of the given @p tensor.
*
@@ -171,11 +168,6 @@
* @return the available padding around the tensor.
*/
PaddingSize padding() const override;
- /** Number of bits for the fractional part.
- *
- * @return the number of bits for the fractional part.
- */
- int fixed_point_position() const override;
/** Quantization info in case of asymmetric quantized type
*
* @return
@@ -224,17 +216,15 @@
Format _format{ Format::UNKNOWN };
DataType _data_type{ DataType::UNKNOWN };
int _num_channels{ 0 };
- int _fixed_point_position{ 0 };
QuantizationInfo _quantization_info{};
DataLayout _data_layout{ DataLayout::UNKNOWN };
};
template <typename T>
-SimpleTensor<T>::SimpleTensor(TensorShape shape, Format format, int fixed_point_position)
+SimpleTensor<T>::SimpleTensor(TensorShape shape, Format format)
: _buffer(nullptr),
_shape(shape),
_format(format),
- _fixed_point_position(fixed_point_position),
_quantization_info(),
_data_layout(DataLayout::NCHW)
{
@@ -243,12 +233,11 @@
}
template <typename T>
-SimpleTensor<T>::SimpleTensor(TensorShape shape, DataType data_type, int num_channels, int fixed_point_position, QuantizationInfo quantization_info, DataLayout data_layout)
+SimpleTensor<T>::SimpleTensor(TensorShape shape, DataType data_type, int num_channels, QuantizationInfo quantization_info, DataLayout data_layout)
: _buffer(nullptr),
_shape(shape),
_data_type(data_type),
_num_channels(num_channels),
- _fixed_point_position(fixed_point_position),
_quantization_info(quantization_info),
_data_layout(data_layout)
{
@@ -262,7 +251,6 @@
_format(tensor.format()),
_data_type(tensor.data_type()),
_num_channels(tensor.num_channels()),
- _fixed_point_position(tensor.fixed_point_position()),
_quantization_info(tensor.quantization_info()),
_data_layout(tensor.data_layout())
{
@@ -303,12 +291,6 @@
}
template <typename T>
-int SimpleTensor<T>::fixed_point_position() const
-{
- return _fixed_point_position;
-}
-
-template <typename T>
QuantizationInfo SimpleTensor<T>::quantization_info() const
{
return _quantization_info;
@@ -428,7 +410,6 @@
swap(tensor1._format, tensor2._format);
swap(tensor1._data_type, tensor2._data_type);
swap(tensor1._num_channels, tensor2._num_channels);
- swap(tensor1._fixed_point_position, tensor2._fixed_point_position);
swap(tensor1._quantization_info, tensor2._quantization_info);
swap(tensor1._buffer, tensor2._buffer);
}
diff --git a/tests/SimpleTensorPrinter.h b/tests/SimpleTensorPrinter.h
new file mode 100644
index 0000000..905a156
--- /dev/null
+++ b/tests/SimpleTensorPrinter.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "arm_compute/core/Error.h"
+
+#include "tests/RawTensor.h"
+#include "tests/SimpleTensor.h"
+
+#include <iostream>
+#include <sstream>
+
+namespace arm_compute
+{
+namespace test
+{
+namespace
+{
+template <typename T>
+inline std::string prettify_tensor(const SimpleTensor<T> &input, const IOFormatInfo &io_fmt = IOFormatInfo{ IOFormatInfo::PrintRegion::NoPadding })
+{
+ ARM_COMPUTE_ERROR_ON(input.data() == nullptr);
+
+ RawTensor tensor(std::move(SimpleTensor<T>(input)));
+
+ TensorInfo info(tensor.shape(), tensor.num_channels(), tensor.data_type());
+
+ const DataType dt = info.data_type();
+ const size_t slices2D = info.tensor_shape().total_size_upper(2);
+ const Strides strides = info.strides_in_bytes();
+ const PaddingSize padding = info.padding();
+ const size_t num_channels = info.num_channels();
+
+ std::ostringstream os;
+
+ // Set precision
+ if(is_data_type_float(dt) && (io_fmt.precision_type != IOFormatInfo::PrecisionType::Default))
+ {
+ int precision = io_fmt.precision;
+ if(io_fmt.precision_type == IOFormatInfo::PrecisionType::Full)
+ {
+ precision = std::numeric_limits<float>().max_digits10;
+ }
+ os.precision(precision);
+ }
+
+ // Define region to print
+ size_t print_width = 0;
+ size_t print_height = 0;
+ int start_offset = 0;
+ switch(io_fmt.print_region)
+ {
+ case IOFormatInfo::PrintRegion::NoPadding:
+ print_width = info.dimension(0);
+ print_height = info.dimension(1);
+ start_offset = info.offset_first_element_in_bytes();
+ break;
+ case IOFormatInfo::PrintRegion::ValidRegion:
+ print_width = info.valid_region().shape.x();
+ print_height = info.valid_region().shape.y();
+ start_offset = info.offset_element_in_bytes(Coordinates(info.valid_region().anchor.x(),
+ info.valid_region().anchor.y()));
+ break;
+ case IOFormatInfo::PrintRegion::Full:
+ print_width = padding.left + info.dimension(0) + padding.right;
+ print_height = padding.top + info.dimension(1) + padding.bottom;
+ start_offset = static_cast<int>(info.offset_first_element_in_bytes()) - padding.top * strides[1] - padding.left * strides[0];
+ break;
+ default:
+ break;
+ }
+
+ print_width = print_width * num_channels;
+
+ // Set pointer to start
+ const uint8_t *ptr = tensor.data() + start_offset;
+
+ // Start printing
+ for(size_t i = 0; i < slices2D; ++i)
+ {
+ // Find max_width of elements in slice to align columns
+ int max_element_width = 0;
+ if(io_fmt.align_columns)
+ {
+ size_t offset = i * strides[2];
+ for(size_t h = 0; h < print_height; ++h)
+ {
+ max_element_width = std::max<int>(max_element_width, max_consecutive_elements_display_width(os, dt, ptr + offset, print_width));
+ offset += strides[1];
+ }
+ }
+
+ // Print slice
+ {
+ size_t offset = i * strides[2];
+ for(size_t h = 0; h < print_height; ++h)
+ {
+ print_consecutive_elements(os, dt, ptr + offset, print_width, max_element_width, io_fmt.element_delim);
+ offset += strides[1];
+ os << io_fmt.row_delim;
+ }
+ os << io_fmt.row_delim;
+ }
+ }
+
+ return os.str();
+}
+
+template <typename T>
+inline std::ostream &operator<<(std::ostream &os, const SimpleTensor<T> &tensor)
+{
+ os << prettify_tensor(tensor, IOFormatInfo{ IOFormatInfo::PrintRegion::NoPadding });
+ return os;
+}
+
+template <typename T>
+inline std::string to_string(const SimpleTensor<T> &tensor)
+{
+ std::stringstream ss;
+ ss << tensor;
+ return ss.str();
+}
+
+#if PRINT_TENSOR_LIMIT
+template <typename T>
+void print_simpletensor(const SimpleTensor<T> &tensor, const std::string &title, const IOFormatInfo::PrintRegion ®ion = IOFormatInfo::PrintRegion::NoPadding)
+{
+ if(tensor.num_elements() < PRINT_TENSOR_LIMIT)
+ {
+ std::cout << title << ":" << std::endl;
+ std::cout << prettify_tensor(tensor, IOFormatInfo{ region });
+ }
+}
+#endif // PRINT_TENSOR_LIMIT
+}
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/TypePrinter.h b/tests/TypePrinter.h
new file mode 100644
index 0000000..4ba7f5f
--- /dev/null
+++ b/tests/TypePrinter.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_TEST_TYPE_PRINTER_H__
+#define __ARM_COMPUTE_TEST_TYPE_PRINTER_H__
+
+#include "tests/Types.h"
+
+namespace arm_compute
+{
+/** Formatted output of the GradientDimension type.
+ *
+ * @param[out] os Output stream
+ * @param[in] dim Type to output
+ *
+ * @return Modified output stream.
+ */
+inline ::std::ostream &operator<<(::std::ostream &os, const GradientDimension &dim)
+{
+ switch(dim)
+ {
+ case GradientDimension::GRAD_X:
+ os << "GRAD_X";
+ break;
+ case GradientDimension::GRAD_Y:
+ os << "GRAD_Y";
+ break;
+ case GradientDimension::GRAD_XY:
+ os << "GRAD_XY";
+ break;
+ default:
+ ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
+ }
+
+ return os;
+}
+
+/** Formatted output of the GradientDimension type.
+ *
+ * @param[in] type Type to output
+ *
+ * @return Formatted string.
+ */
+inline std::string to_string(const arm_compute::GradientDimension &type)
+{
+ std::stringstream str;
+ str << type;
+ return str.str();
+}
+
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ */
diff --git a/tests/Types.h b/tests/Types.h
index c65b56c..407de8d 100644
--- a/tests/Types.h
+++ b/tests/Types.h
@@ -30,18 +30,6 @@
namespace arm_compute
{
-/** Fixed point operation */
-enum class FixedPointOp
-{
- ADD, /**< Addition */
- SUB, /**< Subtraction */
- MUL, /**< Multiplication */
- EXP, /**< Exponential */
- LOG, /**< Logarithm */
- INV_SQRT, /**< Inverse square root */
- RECIPROCAL /**< Reciprocal */
-};
-
/** Gradient dimension type. */
enum class GradientDimension
{
diff --git a/tests/Utils.h b/tests/Utils.h
index 7d960dd..111d80f 100644
--- a/tests/Utils.h
+++ b/tests/Utils.h
@@ -26,7 +26,6 @@
#include "arm_compute/core/Coordinates.h"
#include "arm_compute/core/Error.h"
-#include "arm_compute/core/FixedPoint.h"
#include "arm_compute/core/HOGInfo.h"
#include "arm_compute/core/PyramidInfo.h"
#include "arm_compute/core/Size2D.h"
@@ -306,6 +305,38 @@
return valid_region;
}
+/** Create a valid region for Laplacian Pyramid based on tensor shape and valid region at level "i - 1" and border mode
+ *
+ * @note The border size is 2 in case of Laplacian Pyramid
+ *
+ * @param[in] a_shape Shape used at level "i - 1" of Laplacian Pyramid
+ * @param[in] a_valid_region Valid region used at level "i - 1" of Laplacian Pyramid
+ * @param[in] border_undefined (Optional) Boolean indicating if the border mode is undefined.
+ *
+ * return The valid region for the level "i" of Laplacian Pyramid
+ */
+inline ValidRegion shape_to_valid_region_laplacian_pyramid(const TensorShape &a_shape, const ValidRegion &a_valid_region, bool border_undefined = false)
+{
+ ValidRegion valid_region = shape_to_valid_region_gaussian_pyramid_half(a_shape, a_valid_region, border_undefined);
+
+ if(border_undefined)
+ {
+ const BorderSize gaussian5x5_border(2);
+
+ auto border_left = static_cast<int>(gaussian5x5_border.left);
+ auto border_right = static_cast<int>(gaussian5x5_border.right);
+ auto border_top = static_cast<int>(gaussian5x5_border.top);
+ auto border_bottom = static_cast<int>(gaussian5x5_border.bottom);
+
+ valid_region.anchor.set(0, valid_region.anchor[0] + border_left);
+ valid_region.anchor.set(1, valid_region.anchor[1] + border_top);
+ valid_region.shape.set(0, std::max(0, static_cast<int>(valid_region.shape[0]) - border_right - border_left));
+ valid_region.shape.set(1, std::max(0, static_cast<int>(valid_region.shape[1]) - border_top - border_bottom));
+ }
+
+ return valid_region;
+}
+
/** Write the value after casting the pointer according to @p data_type.
*
* @warning The type of the value must match the specified data type.
@@ -324,14 +355,12 @@
*reinterpret_cast<uint8_t *>(ptr) = value;
break;
case DataType::S8:
- case DataType::QS8:
*reinterpret_cast<int8_t *>(ptr) = value;
break;
case DataType::U16:
*reinterpret_cast<uint16_t *>(ptr) = value;
break;
case DataType::S16:
- case DataType::QS16:
*reinterpret_cast<int16_t *>(ptr) = value;
break;
case DataType::U32:
@@ -478,21 +507,20 @@
/** Create and initialize a tensor of the given type.
*
- * @param[in] shape Tensor shape.
- * @param[in] data_type Data type.
- * @param[in] num_channels (Optional) Number of channels.
- * @param[in] fixed_point_position (Optional) Number of fractional bits.
- * @param[in] quantization_info (Optional) Quantization info for asymmetric quantized types.
- * @param[in] data_layout (Optional) Data layout. Default is NCHW.
+ * @param[in] shape Tensor shape.
+ * @param[in] data_type Data type.
+ * @param[in] num_channels (Optional) Number of channels.
+ * @param[in] quantization_info (Optional) Quantization info for asymmetric quantized types.
+ * @param[in] data_layout (Optional) Data layout. Default is NCHW.
*
* @return Initialized tensor of given type.
*/
template <typename T>
inline T create_tensor(const TensorShape &shape, DataType data_type, int num_channels = 1,
- int fixed_point_position = 0, QuantizationInfo quantization_info = QuantizationInfo(), DataLayout data_layout = DataLayout::NCHW)
+ QuantizationInfo quantization_info = QuantizationInfo(), DataLayout data_layout = DataLayout::NCHW)
{
T tensor;
- TensorInfo info(shape, num_channels, data_type, fixed_point_position);
+ TensorInfo info(shape, num_channels, data_type);
info.set_quantization_info(quantization_info);
info.set_data_layout(data_layout);
tensor.allocator()->init(info);
@@ -564,6 +592,61 @@
return pyramid;
}
+/** Initialize a convolution matrix.
+ *
+ * @param[in, out] conv The input convolution matrix.
+ * @param[in] width The width of the convolution matrix.
+ * @param[in] height The height of the convolution matrix.
+ * @param[in] seed The random seed to be used.
+ */
+inline void init_conv(int16_t *conv, unsigned int width, unsigned int height, std::random_device::result_type seed)
+{
+ std::mt19937 gen(seed);
+ std::uniform_int_distribution<int16_t> distribution_int16(-32768, 32767);
+
+ for(unsigned int i = 0; i < width * height; ++i)
+ {
+ conv[i] = distribution_int16(gen);
+ }
+}
+
+/** Initialize a separable convolution matrix.
+ *
+ * @param[in, out] conv The input convolution matrix.
+ * @param[in] width The width of the convolution matrix.
+ * @param[in] height The height of the convolution matrix.
+ * @param[in] seed The random seed to be used.
+ */
+inline void init_separable_conv(int16_t *conv, unsigned int width, unsigned int height, std::random_device::result_type seed)
+{
+ std::mt19937 gen(seed);
+ // Set it between -128 and 127 to ensure the matrix does not overflow
+ std::uniform_int_distribution<int16_t> distribution_int16(-128, 127);
+
+ int16_t conv_row[width];
+ int16_t conv_col[height];
+
+ conv_row[0] = conv_col[0] = 1;
+ for(unsigned int i = 1; i < width; ++i)
+ {
+ conv_row[i] = distribution_int16(gen);
+ }
+
+ for(unsigned int i = 1; i < height; ++i)
+ {
+ conv_col[i] = distribution_int16(gen);
+ }
+
+ // Multiply two matrices
+ for(unsigned int i = 0; i < width; ++i)
+ {
+ for(unsigned int j = 0; j < height; ++j)
+ {
+ conv[i * width + j] = conv_col[i] * conv_row[j];
+ }
+ }
+}
+
/** Create a vector of random ROIs.
*
* @param[in] shape The shape of the input tensor.
diff --git a/tests/benchmark/CL/ActivationLayer.cpp b/tests/benchmark/CL/ActivationLayer.cpp
index ff612e3..69db5a1 100644
--- a/tests/benchmark/CL/ActivationLayer.cpp
+++ b/tests/benchmark/CL/ActivationLayer.cpp
@@ -48,8 +48,8 @@
{
namespace
{
-const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16 });
-const auto data_types_mobilenet = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16, DataType::QASYMM8 });
+const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 });
+const auto data_types_mobilenet = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QASYMM8 });
} // namespace
using CLActivationLayerFixture = ActivationLayerFixture<CLTensor, CLActivationLayer, CLAccessor>;
diff --git a/tests/benchmark/CL/CannyEdge.cpp b/tests/benchmark/CL/CannyEdge.cpp
new file mode 100644
index 0000000..7e327f3
--- /dev/null
+++ b/tests/benchmark/CL/CannyEdge.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLCannyEdge.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/CannyEdgeFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ImageFileDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+// *INDENT-OFF*
+// clang-format off
+const auto use_fp16 = framework::dataset::make("UseFP16", { false });
+const auto canny_edge_dataset = combine(framework::dataset::make("GradientSize", { 3, 5, 7 }),
+ combine(framework::dataset::make("Normalization", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }),
+ combine(datasets::BorderModes(), use_fp16)));
+} // namespace
+
+using CLCannyEdgeFixture = CannyEdgeFixture<CLTensor, CLCannyEdge, CLAccessor>;
+
+TEST_SUITE(CL)
+TEST_SUITE(CannyEdge)
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLCannyEdgeFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(
+ datasets::SmallImageFiles(),
+ canny_edge_dataset),
+ framework::dataset::make("Format", Format::U8)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLCannyEdgeFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(
+ datasets::LargeImageFiles(),
+ canny_edge_dataset),
+ framework::dataset::make("Format", Format::U8)));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // CannyEdge
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/ColorConvert.cpp b/tests/benchmark/CL/ColorConvert.cpp
new file mode 100644
index 0000000..a633791
--- /dev/null
+++ b/tests/benchmark/CL/ColorConvert.cpp
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/runtime/CL/CLMultiImage.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLColorConvert.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/ColorConvertFixture.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto RGBDataset = framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 });
+const auto YUYVDataset = framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 });
+
+const auto ColorConvert_RGBA_to_RGB = combine(framework::dataset::make("FormatType", { Format::RGBA8888 }),
+ framework::dataset::make("FormatType", { Format::RGB888 }));
+
+const auto ColorConvert_RGB_to_RGBA = combine(framework::dataset::make("FormatType", { Format::RGB888 }),
+ framework::dataset::make("FormatType", { Format::RGBA8888 }));
+
+const auto ColorConvert_YUYV_to_RGBDataset = combine(YUYVDataset,
+ RGBDataset);
+
+const auto ColorConvert_YUVPlanar_to_RGBDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::NV12, Format::NV21 }),
+ RGBDataset);
+
+const auto ColorConvert_RGBDataset_to_NVDataset = combine(RGBDataset,
+ framework::dataset::make("FormatType", { Format::NV12, Format::IYUV, Format::YUV444 }));
+
+const auto ColorConvert_YUYVDataset_to_NVDataset = combine(YUYVDataset,
+ framework::dataset::make("FormatType", { Format::NV12, Format::IYUV }));
+
+const auto ColorConvert_NVDataset_to_YUVDataset = combine(framework::dataset::make("FormatType", { Format::NV12, Format::NV21 }),
+ framework::dataset::make("FormatType", { Format::IYUV, Format::YUV444 }));
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(ColorConvert)
+
+using CLColorConvertFixture = ColorConvertFixture<CLMultiImage, CLTensor, CLAccessor, CLColorConvert>;
+
+TEST_SUITE(RGBA)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBA_to_RGB));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBA_to_RGB));
+TEST_SUITE_END()
+
+TEST_SUITE(RGB)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_RGBA));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_RGBA));
+TEST_SUITE_END()
+
+TEST_SUITE(YUV)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYV_to_RGBDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYV_to_RGBDataset));
+TEST_SUITE_END()
+
+TEST_SUITE(YUVPlanar)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset));
+TEST_SUITE_END()
+
+TEST_SUITE(NV)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBDataset_to_NVDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBDataset_to_NVDataset));
+TEST_SUITE_END()
+
+TEST_SUITE(YUYVtoNV)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_NVDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_NVDataset));
+TEST_SUITE_END()
+
+TEST_SUITE(NVtoYUV)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_NVDataset_to_YUVDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_NVDataset_to_YUVDataset));
+TEST_SUITE_END()
+
+TEST_SUITE_END() // ColorConvert
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/Convolution.cpp b/tests/benchmark/CL/Convolution.cpp
new file mode 100644
index 0000000..04622aa
--- /dev/null
+++ b/tests/benchmark/CL/Convolution.cpp
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLConvolution.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/ConvolutionFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+// *INDENT-OFF*
+// clang-format off
+
+#define CONVOLUTION_SQUARE_DATA_TEST_CASE(TEST_NAME, MODE, SHAPES, DT, FILTER_SIZE) \
+ REGISTER_FIXTURE_DATA_TEST_CASE(TEST_NAME, CLConvolutionFixture, framework::DatasetMode::MODE, \
+ combine(combine(combine( \
+ datasets::SHAPES, \
+ framework::dataset::make("DataType", DataType::DT)), \
+ datasets::BorderModes()), \
+ framework::dataset::make("FilterSize", { FILTER_SIZE })));
+
+#define CONVOLUTION_RECTANGLE_DATA_TEST_CASE(TEST_NAME, MODE, SHAPES, DT) \
+ REGISTER_FIXTURE_DATA_TEST_CASE(TEST_NAME, CLConvolutionFixture, framework::DatasetMode::MODE, \
+ combine(combine(combine(combine( \
+ datasets::SHAPES, \
+ framework::dataset::make("DataType", DataType::DT)), \
+ datasets::BorderModes()), \
+ framework::dataset::make("FilterSize", { 3, 5, 7, 9 })), \
+ framework::dataset::make("FilterSize", { 3, 5, 7, 9 })));
+
+#define CONVOLUTION_SEPARABLE_DATA_TEST_CASE(TEST_NAME, MODE, SHAPES, DT, FILTER_SIZE) \
+ CONVOLUTION_SQUARE_DATA_TEST_CASE(TEST_NAME, MODE, SHAPES, DT, FILTER_SIZE)
+
+// clang-format on
+// *INDENT-ON*
+
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(CustomConvolution)
+
+TEST_SUITE(Square3x3)
+
+using CLConvolutionFixture = ConvolutionSquareFixture<CLTensor, CLConvolution3x3, CLAccessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 3)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 3)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 3)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 3)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Square3x3
+
+TEST_SUITE(Square5x5)
+
+using CLConvolutionFixture = ConvolutionSquareFixture<CLTensor, CLConvolution5x5, CLAccessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 5)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 5)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 5)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 5)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Square5x5
+
+TEST_SUITE(Square7x7)
+
+using CLConvolutionFixture = ConvolutionSquareFixture<CLTensor, CLConvolution7x7, CLAccessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 7)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 7)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 7)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 7)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Square7x7
+
+TEST_SUITE(Square9x9)
+
+using CLConvolutionFixture = ConvolutionSquareFixture<CLTensor, CLConvolution9x9, CLAccessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 9)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 9)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 9)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 9)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Square9x9
+
+TEST_SUITE(Rectangle)
+
+using CLConvolutionFixture = ConvolutionRectangleFixture<CLTensor, CLConvolutionRectangle, CLAccessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_RECTANGLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8)
+CONVOLUTION_RECTANGLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_RECTANGLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16)
+CONVOLUTION_RECTANGLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Rectangle
+
+TEST_SUITE(Separable5x5)
+
+using CLConvolutionFixture = ConvolutionSeperableFixture<CLTensor, CLConvolution5x5, CLAccessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 5)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 5)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 5)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 5)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Separable5x5
+
+TEST_SUITE(Separable7x7)
+
+using CLConvolutionFixture = ConvolutionSeperableFixture<CLTensor, CLConvolution7x7, CLAccessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 7)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 7)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 7)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 7)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Separable7x7
+
+TEST_SUITE(Separable9x9)
+
+using CLConvolutionFixture = ConvolutionSeperableFixture<CLTensor, CLConvolution9x9, CLAccessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 9)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 9)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 9)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 9)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Separable9x9
+
+TEST_SUITE_END() // CustomConvolution
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/ConvolutionLayer.cpp b/tests/benchmark/CL/ConvolutionLayer.cpp
index e1cf99b..1eb2190 100644
--- a/tests/benchmark/CL/ConvolutionLayer.cpp
+++ b/tests/benchmark/CL/ConvolutionLayer.cpp
@@ -50,7 +50,7 @@
{
namespace
{
-const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 });
+const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QASYMM8 });
} // namespace
using CLGEMMConvolutionLayerFixture = ConvolutionLayerFixture<CLTensor, CLGEMMConvolutionLayer, CLAccessor>;
diff --git a/tests/benchmark/CL/FastCorners.cpp b/tests/benchmark/CL/FastCorners.cpp
new file mode 100644
index 0000000..8b85893
--- /dev/null
+++ b/tests/benchmark/CL/FastCorners.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLArray.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLFastCorners.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/FastCornersFixture.h"
+#include "tests/datasets/ImageFileDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto threshold = framework::dataset::make("Threshold", { 64.f }); // valid range (0.0 ≤ threshold < 256.0)
+const auto border_mode = framework::dataset::make("BorderMode", { BorderMode::UNDEFINED }); // NOTE: only BorderMode::UNDEFINED is implemented
+const auto suppress_nonmax = framework::dataset::make("SuppressNonMax", { false, true });
+} // namespace
+
+using CLFastCornersFixture = FastCornersFixture<CLTensor, CLFastCorners, CLAccessor, CLKeyPointArray>;
+
+TEST_SUITE(CL)
+TEST_SUITE(FastCorners)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLFastCornersFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(combine(
+ datasets::SmallImageFiles(),
+ framework::dataset::make("Format", { Format::U8 })),
+ threshold),
+ suppress_nonmax),
+ border_mode));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLFastCornersFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(combine(
+ datasets::LargeImageFiles(),
+ framework::dataset::make("Format", { Format::U8 })),
+ threshold),
+ suppress_nonmax),
+ border_mode));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // FastCorners
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/GaussianPyramid.cpp b/tests/benchmark/CL/GaussianPyramid.cpp
new file mode 100644
index 0000000..2689847
--- /dev/null
+++ b/tests/benchmark/CL/GaussianPyramid.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLGaussianPyramid.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/GaussianPyramidFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+TEST_SUITE(CL)
+TEST_SUITE(GaussianPyramid)
+TEST_SUITE(Half)
+
+using CLGaussianPyramidFixture = GaussianPyramidHalfFixture<CLTensor, CLGaussianPyramidHalf, CLAccessor, CLPyramid>;
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLGaussianPyramidFixture, framework::DatasetMode::PRECOMMIT,
+ combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 4));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLGaussianPyramidFixture, framework::DatasetMode::NIGHTLY,
+ combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 5));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // Half
+TEST_SUITE_END() // GaussianPyramid
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/HOGDetector.cpp b/tests/benchmark/CL/HOGDetector.cpp
new file mode 100644
index 0000000..aeed4d2
--- /dev/null
+++ b/tests/benchmark/CL/HOGDetector.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLArray.h"
+#include "arm_compute/runtime/CL/CLHOG.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLHOGDescriptor.h"
+#include "arm_compute/runtime/CL/functions/CLHOGDetector.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/CL/CLHOGAccessor.h"
+#include "tests/benchmark/fixtures/HOGDetectorFixture.h"
+#include "tests/datasets/HOGDescriptorDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+/* Input dataset (values must be a multiple of the HOGInfo block_size) */
+const auto DetectionWindowStrideDataset = framework::dataset::make("DetectionWindowStride", { Size2D(8, 8), Size2D(16, 16) });
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(HOGDetector)
+
+using CLHOGDetectorFixture = HOGDetectorFixture<CLTensor, CLHOG, CLHOGDetector, CLAccessor, CLHOGAccessor, CLHOGDescriptor, CLDetectionWindowArray>;
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLHOGDetectorFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ DetectionWindowStrideDataset,
+ datasets::SmallHOGDescriptorDataset()),
+ framework::dataset::make("Format", Format::U8)),
+ framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLHOGDetectorFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ DetectionWindowStrideDataset,
+ datasets::LargeHOGDescriptorDataset()),
+ framework::dataset::make("Format", Format::U8)),
+ framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // HOGDetector
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/HOGMultiDetection.cpp b/tests/benchmark/CL/HOGMultiDetection.cpp
new file mode 100644
index 0000000..c2fbfec
--- /dev/null
+++ b/tests/benchmark/CL/HOGMultiDetection.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLMultiHOG.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLHOGMultiDetection.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/CL/CLArrayAccessor.h"
+#include "tests/CL/CLHOGAccessor.h"
+#include "tests/benchmark/fixtures/HOGMultiDetectionFixture.h"
+#include "tests/datasets/HOGMultiDetectionDataset.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+// *INDENT-OFF*
+// clang-format off
+using CLHOGMultiDetectionFixture = HOGMultiDetectionFixture<CLTensor,
+ CLHOG,
+ CLMultiHOG,
+ CLDetectionWindowArray,
+ CLSize2DArray,
+ CLHOGMultiDetection,
+ CLAccessor,
+ CLHOGAccessor,
+ CLArrayAccessor<Size2D>>;
+TEST_SUITE(CL)
+TEST_SUITE(HOGMultiDetection)
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLHOGMultiDetectionFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::SmallHOGMultiDetectionDataset(),
+ framework::dataset::make("Format", Format::U8)),
+ framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})),
+ framework::dataset::make("NonMaximaSuppression", {false, true})));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLHOGMultiDetectionFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::LargeHOGMultiDetectionDataset(),
+ framework::dataset::make("Format", Format::U8)),
+ framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})),
+ framework::dataset::make("NonMaximaSuppression", {false, true})));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // HOGMultiDetection
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/LaplacianPyramid.cpp b/tests/benchmark/CL/LaplacianPyramid.cpp
new file mode 100644
index 0000000..5355102
--- /dev/null
+++ b/tests/benchmark/CL/LaplacianPyramid.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLLaplacianPyramid.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/LaplacianPyramidFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto small_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 3);
+const auto large_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 5);
+
+const auto formats = combine(framework::dataset::make("FormatIn", Format::U8), framework::dataset::make("FormatOut", Format::S16));
+} // namespace
+
+using CLLaplacianPyramidFixture = LaplacianPyramidFixture<CLTensor, CLLaplacianPyramid, CLAccessor, CLPyramid>;
+
+TEST_SUITE(CL)
+TEST_SUITE(LaplacianPyramid)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLLaplacianPyramidFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()),
+ small_laplacian_pyramid_levels),
+ formats));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLLaplacianPyramidFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ large_laplacian_pyramid_levels),
+ formats));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // LaplacianPyramid
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/LaplacianReconstruct.cpp b/tests/benchmark/CL/LaplacianReconstruct.cpp
new file mode 100644
index 0000000..a25ea59
--- /dev/null
+++ b/tests/benchmark/CL/LaplacianReconstruct.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLLaplacianPyramid.h"
+#include "arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/LaplacianReconstructFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto small_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 3);
+const auto large_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 5);
+
+const auto formats = combine(framework::dataset::make("FormatIn", Format::S16), framework::dataset::make("FormatOut", Format::U8));
+} // namespace
+
+// *INDENT-OFF*
+// clang-format off
+using CLLaplacianReconstructFixture = LaplacianReconstructFixture<CLTensor,
+ CLLaplacianReconstruct,
+ CLAccessor,
+ CLLaplacianPyramid,
+ CLPyramid>;
+
+TEST_SUITE(CL)
+TEST_SUITE(LaplacianReconstruct)
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLLaplacianReconstructFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()),
+ small_laplacian_reconstruct_levels),
+ formats));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLLaplacianReconstructFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ large_laplacian_reconstruct_levels),
+ formats));
+
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // LaplacianReconstruct
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/LocallyConnectedLayer.cpp b/tests/benchmark/CL/LocallyConnectedLayer.cpp
new file mode 100644
index 0000000..91e2bd3
--- /dev/null
+++ b/tests/benchmark/CL/LocallyConnectedLayer.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/functions/CLLocallyConnectedLayer.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/LocallyConnectedLayerFixture.h"
+#include "tests/datasets/LocallyConnectedDataset.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto data_types = framework::dataset::make("DataType", { DataType::F32 });
+} // namespace
+
+using CLLocallyConnectedLayerFixture = LocallyConnectedLayerFixture<CLTensor, CLLocallyConnectedLayer, CLAccessor>;
+
+TEST_SUITE(CL)
+TEST_SUITE(LocallyConnectedLayer)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLLocallyConnectedLayerFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(
+ datasets::SmallLocallyConnectedDataset(),
+ data_types),
+ framework::dataset::make("Batches", 1)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLLocallyConnectedLayerFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(
+ datasets::SmallLocallyConnectedDataset(),
+ data_types),
+ framework::dataset::make("Batches", { 4, 8 })));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // LocallyConnectedLayer
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/Magnitude.cpp b/tests/benchmark/CL/Magnitude.cpp
index 5e75083..c2bb590 100644
--- a/tests/benchmark/CL/Magnitude.cpp
+++ b/tests/benchmark/CL/Magnitude.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -47,12 +47,10 @@
TEST_SUITE(CL)
TEST_SUITE(Magnitude)
-REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLMagnitudeFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallImageShapes(), framework::dataset::make("Format", { Format::S16, Format::S32 })),
- magnitude_types),
- framework::dataset::make("UseFP16", { false })));
-REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeImageShapes(), framework::dataset::make("Format", { Format::S16, Format::S32 })),
- magnitude_types),
- framework::dataset::make("UseFP16", { false })));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLMagnitudeFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallImageShapes(), framework::dataset::make("Format", { Format::S16, Format::S32 })),
+ magnitude_types));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeImageShapes(), framework::dataset::make("Format", { Format::S16, Format::S32 })),
+ magnitude_types));
TEST_SUITE_END() // Magnitude
TEST_SUITE_END() // CL
} // namespace benchmark
diff --git a/tests/benchmark/CL/OpticalFlow.cpp b/tests/benchmark/CL/OpticalFlow.cpp
new file mode 100644
index 0000000..4794d8a
--- /dev/null
+++ b/tests/benchmark/CL/OpticalFlow.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLArray.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLGaussianPyramid.h"
+#include "arm_compute/runtime/CL/functions/CLOpticalFlow.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/CL/CLArrayAccessor.h"
+#include "tests/benchmark/fixtures/OpticalFlowFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ImageFileDatasets.h"
+#include "tests/datasets/OpticalFlowDataset.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+using CLOpticalFlowFixture = OpticalFlowFixture<CLTensor, CLOpticalFlow, CLAccessor, CLKeyPointArray, CLArrayAccessor<KeyPoint>, CLPyramid, CLGaussianPyramidHalf>;
+
+TEST_SUITE(CL)
+TEST_SUITE(OpticalFlow)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLOpticalFlowFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(
+ datasets::SmallOpticalFlowDataset(),
+ framework::dataset::make("Format", Format::U8)),
+ datasets::BorderModes()));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLOpticalFlowFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(
+ datasets::LargeOpticalFlowDataset(),
+ framework::dataset::make("Format", Format::U8)),
+ datasets::BorderModes()));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // OpticalFlow
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/Remap.cpp b/tests/benchmark/CL/Remap.cpp
new file mode 100644
index 0000000..9da1356
--- /dev/null
+++ b/tests/benchmark/CL/Remap.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLRemap.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/RemapFixture.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto interpolation_policies = framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR });
+const auto border_modes = framework::dataset::make("BorderModes", { BorderMode::UNDEFINED, BorderMode::CONSTANT });
+const auto remap_data = interpolation_policies * framework::dataset::make("DataType", DataType::U8) * border_modes;
+} // namespace
+
+using CLRemapFixture = RemapFixture<CLTensor, CLRemap, CLAccessor>;
+
+TEST_SUITE(CL)
+TEST_SUITE(Remap)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLRemapFixture, framework::DatasetMode::PRECOMMIT,
+ combine( datasets::SmallShapes(), remap_data));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLRemapFixture, framework::DatasetMode::NIGHTLY,
+ combine( datasets::LargeShapes(), remap_data));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // Remap
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/SYSTEM/AlexNet.cpp b/tests/benchmark/CL/SYSTEM/AlexNet.cpp
deleted file mode 100644
index f24803d..0000000
--- a/tests/benchmark/CL/SYSTEM/AlexNet.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/core/TensorShape.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLSubTensor.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#include "arm_compute/runtime/CL/CLTensorAllocator.h"
-#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h"
-#include "arm_compute/runtime/CL/functions/CLNormalizationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLPoolingLayer.h"
-#include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h"
-#include "tests/CL/CLAccessor.h"
-#include "tests/benchmark/fixtures/AlexNetFixture.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "utils/TypePrinter.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-using CLAlexNetFixture = AlexNetFixture<ICLTensor,
- CLTensor,
- CLSubTensor,
- CLAccessor,
- CLActivationLayer,
- CLConvolutionLayer,
- CLDirectConvolutionLayer,
- CLFullyConnectedLayer,
- CLNormalizationLayer,
- CLPoolingLayer,
- CLSoftmaxLayer>;
-
-TEST_SUITE(CL)
-TEST_SUITE(SYSTEM_TESTS)
-
-REGISTER_FIXTURE_DATA_TEST_CASE(AlexNet, CLAlexNetFixture, framework::DatasetMode::ALL,
- framework::dataset::combine(framework::dataset::make("DataType", { DataType::F16, DataType::F32 }),
- framework::dataset::make("Batches", { 1, 2, 4 })));
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/benchmark/CL/SYSTEM/LeNet5.cpp b/tests/benchmark/CL/SYSTEM/LeNet5.cpp
deleted file mode 100644
index 0fa6791..0000000
--- a/tests/benchmark/CL/SYSTEM/LeNet5.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/core/TensorShape.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#include "arm_compute/runtime/CL/CLTensorAllocator.h"
-#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h"
-#include "arm_compute/runtime/CL/functions/CLPoolingLayer.h"
-#include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h"
-#include "tests/CL/CLAccessor.h"
-#include "tests/benchmark/fixtures/LeNet5Fixture.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "utils/TypePrinter.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-using CLLeNet5Fixture = LeNet5Fixture<CLTensor,
- CLAccessor,
- CLActivationLayer,
- CLConvolutionLayer,
- CLFullyConnectedLayer,
- CLPoolingLayer,
- CLSoftmaxLayer>;
-
-TEST_SUITE(CL)
-TEST_SUITE(SYSTEM_TESTS)
-
-REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5, CLLeNet5Fixture, framework::DatasetMode::ALL,
- framework::dataset::make("Batches", { 1, 4, 8 }));
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/benchmark/CL/SYSTEM/MobileNet.cpp b/tests/benchmark/CL/SYSTEM/MobileNet.cpp
deleted file mode 100644
index 304e966..0000000
--- a/tests/benchmark/CL/SYSTEM/MobileNet.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/core/TensorShape.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#include "arm_compute/runtime/CL/CLTensorAllocator.h"
-#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLPoolingLayer.h"
-#include "arm_compute/runtime/CL/functions/CLReshapeLayer.h"
-#include "tests/CL/CLAccessor.h"
-#include "tests/benchmark/fixtures/MobileNetFixture.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "utils/TypePrinter.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-using CLMobileNetFixture = MobileNetFixture<CLTensor,
- CLAccessor,
- CLActivationLayer,
- CLConvolutionLayer,
- CLDirectConvolutionLayer,
- CLDepthwiseConvolutionLayer,
- CLReshapeLayer,
- CLPoolingLayer>;
-
-TEST_SUITE(CL)
-TEST_SUITE(SYSTEM_TESTS)
-
-REGISTER_FIXTURE_DATA_TEST_CASE(MobileNet, CLMobileNetFixture, framework::DatasetMode::ALL,
- framework::dataset::make("Batches", { 1, 4, 8 }));
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/benchmark/CL/SYSTEM/MobileNetV1.cpp b/tests/benchmark/CL/SYSTEM/MobileNetV1.cpp
deleted file mode 100644
index de38d37..0000000
--- a/tests/benchmark/CL/SYSTEM/MobileNetV1.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/core/TensorShape.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#include "arm_compute/runtime/CL/CLTensorAllocator.h"
-#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLBatchNormalizationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLPoolingLayer.h"
-#include "arm_compute/runtime/CL/functions/CLReshapeLayer.h"
-#include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h"
-#include "tests/CL/CLAccessor.h"
-#include "tests/benchmark/fixtures/MobileNetV1Fixture.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "utils/TypePrinter.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-using CLMobileNetV1_224_Fixture = MobileNetV1Fixture<CLTensor,
- CLAccessor,
- CLActivationLayer,
- CLBatchNormalizationLayer,
- CLConvolutionLayer,
- CLDirectConvolutionLayer,
- CLDepthwiseConvolutionLayer3x3,
- CLReshapeLayer,
- CLPoolingLayer,
- CLSoftmaxLayer,
- 224>;
-
-using CLMobileNetV1_128_Fixture = MobileNetV1Fixture<CLTensor,
- CLAccessor,
- CLActivationLayer,
- CLBatchNormalizationLayer,
- CLConvolutionLayer,
- CLDirectConvolutionLayer,
- CLDepthwiseConvolutionLayer3x3,
- CLReshapeLayer,
- CLPoolingLayer,
- CLSoftmaxLayer,
- 128>;
-
-TEST_SUITE(CL)
-TEST_SUITE(SYSTEM_TESTS)
-
-REGISTER_FIXTURE_DATA_TEST_CASE(MobileNetV1_224, CLMobileNetV1_224_Fixture, framework::DatasetMode::ALL,
- framework::dataset::make("Batches", { 1, 4, 8 }));
-
-REGISTER_FIXTURE_DATA_TEST_CASE(MobileNetV1_128, CLMobileNetV1_128_Fixture, framework::DatasetMode::ALL,
- framework::dataset::make("Batches", { 1, 4, 8 }));
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/benchmark/CL/Sobel.cpp b/tests/benchmark/CL/Sobel.cpp
new file mode 100644
index 0000000..f0478b8
--- /dev/null
+++ b/tests/benchmark/CL/Sobel.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLSobel3x3.h"
+#include "arm_compute/runtime/CL/functions/CLSobel5x5.h"
+#include "arm_compute/runtime/CL/functions/CLSobel7x7.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/SobelFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/GradientDimensionDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+using CLSobel3x3Fixture = SobelFixture<CLTensor, CLSobel3x3, CLAccessor>;
+
+TEST_SUITE(CL)
+TEST_SUITE(Sobel)
+
+// *INDENT-OFF*
+// clang-format off
+TEST_SUITE(W3x3)
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Small2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+TEST_SUITE_END() // W3x3
+
+using CLSobel5x5Fixture = SobelFixture<CLTensor, CLSobel5x5, CLAccessor>;
+
+TEST_SUITE(W5x5)
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Small2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+TEST_SUITE_END() // W5x5
+
+using CLSobel7x7Fixture = SobelFixture<CLTensor, CLSobel7x7, CLAccessor>;
+
+TEST_SUITE(W7x7)
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel7x7Fixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Small2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+TEST_SUITE_END() // W7x7
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // Sobel
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/CL/WarpAffine.cpp b/tests/benchmark/CL/WarpAffine.cpp
new file mode 100644
index 0000000..48a1825
--- /dev/null
+++ b/tests/benchmark/CL/WarpAffine.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/functions/CLWarpAffine.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/benchmark/fixtures/WarpAffineFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto data_type = framework::dataset::make("DataType", DataType::U8);
+const auto interpolation_types = framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR });
+} // namespace
+
+using CLWarpAffineFixture = WarpAffineFixture<CLTensor, CLWarpAffine, CLAccessor>;
+
+TEST_SUITE(CL)
+TEST_SUITE(WarpAffine)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLWarpAffineFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::SmallShapes(),
+ data_type),
+ interpolation_types),
+ datasets::BorderModes()));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLWarpAffineFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::LargeShapes(),
+ data_type),
+ interpolation_types),
+ datasets::BorderModes()));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // WarpAffine
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/ActivationLayer.cpp b/tests/benchmark/NEON/ActivationLayer.cpp
index e1664d3..1c4ea21 100644
--- a/tests/benchmark/NEON/ActivationLayer.cpp
+++ b/tests/benchmark/NEON/ActivationLayer.cpp
@@ -49,11 +49,11 @@
namespace
{
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16 });
-const auto data_types_mobilenet = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16, DataType::QASYMM8 });
+const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 });
+const auto data_types_mobilenet = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QASYMM8 });
#else /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-const auto data_types = framework::dataset::make("DataType", { DataType::F32, DataType::QS8, DataType::QS16 });
-const auto data_types_mobilenet = framework::dataset::make("DataType", { DataType::F32, DataType::QS8, DataType::QS16, DataType::QASYMM8 });
+const auto data_types = framework::dataset::make("DataType", { DataType::F32 });
+const auto data_types_mobilenet = framework::dataset::make("DataType", { DataType::F32, DataType::QASYMM8 });
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
} // namespace
diff --git a/tests/benchmark/NEON/CannyEdge.cpp b/tests/benchmark/NEON/CannyEdge.cpp
new file mode 100644
index 0000000..50fd832
--- /dev/null
+++ b/tests/benchmark/NEON/CannyEdge.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NECannyEdge.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/CannyEdgeFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ImageFileDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+// *INDENT-OFF*
+// clang-format off
+const auto use_fp16 = framework::dataset::make("UseFP16", { false });
+const auto canny_edge_dataset = combine(framework::dataset::make("GradientSize", { 3, 5, 7 }),
+ combine(framework::dataset::make("Normalization", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }),
+ combine(datasets::BorderModes(), use_fp16)));
+} // namespace
+
+using NECannyEdgeFixture = CannyEdgeFixture<Tensor, NECannyEdge, Accessor>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(CannyEdge)
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NECannyEdgeFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(
+ datasets::SmallImageFiles(),
+ canny_edge_dataset),
+ framework::dataset::make("Format", Format::U8)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NECannyEdgeFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(
+ datasets::LargeImageFiles(),
+ canny_edge_dataset),
+ framework::dataset::make("Format", Format::U8)));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // CannyEdge
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/ColorConvert.cpp b/tests/benchmark/NEON/ColorConvert.cpp
new file mode 100644
index 0000000..6aef572
--- /dev/null
+++ b/tests/benchmark/NEON/ColorConvert.cpp
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/runtime/MultiImage.h"
+#include "arm_compute/runtime/NEON/functions/NEColorConvert.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/ColorConvertFixture.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto RGBDataset = framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 });
+const auto YUYVDataset = framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 });
+
+const auto ColorConvert_RGBA_to_RGB = combine(framework::dataset::make("FormatType", { Format::RGBA8888 }),
+ framework::dataset::make("FormatType", { Format::RGB888 }));
+
+const auto ColorConvert_RGB_to_RGBA = combine(framework::dataset::make("FormatType", { Format::RGB888 }),
+ framework::dataset::make("FormatType", { Format::RGBA8888 }));
+
+const auto ColorConvert_YUYVDataset_to_RGBDataset = combine(YUYVDataset,
+ RGBDataset);
+
+const auto ColorConvert_YUVPlanar_to_RGBDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::NV12, Format::NV21 }),
+ RGBDataset);
+
+const auto ColorConvert_RGBDataset_to_NVDataset = combine(RGBDataset,
+ framework::dataset::make("FormatType", { Format::NV12, Format::IYUV, Format::YUV444 }));
+
+const auto ColorConvert_YUYVDataset_to_NVDataset = combine(YUYVDataset,
+ framework::dataset::make("FormatType", { Format::NV12, Format::IYUV }));
+
+const auto ColorConvert_NVDataset_to_YUVDataset = combine(framework::dataset::make("FormatType", { Format::NV12, Format::NV21 }),
+ framework::dataset::make("FormatType", { Format::IYUV, Format::YUV444 }));
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(ColorConvert)
+
+using NEColorConvertFixture = ColorConvertFixture<MultiImage, Tensor, Accessor, NEColorConvert>;
+
+TEST_SUITE(RGBA)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBA_to_RGB));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBA_to_RGB));
+TEST_SUITE_END()
+
+TEST_SUITE(RGB)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_RGBA));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_RGBA));
+TEST_SUITE_END()
+
+TEST_SUITE(YUYV)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_RGBDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_RGBDataset));
+TEST_SUITE_END()
+
+TEST_SUITE(YUVPlanar)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset));
+TEST_SUITE_END()
+
+TEST_SUITE(NV)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBDataset_to_NVDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBDataset_to_NVDataset));
+TEST_SUITE_END()
+
+TEST_SUITE(YUYVtoNV)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_NVDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_NVDataset));
+TEST_SUITE_END()
+
+TEST_SUITE(NVtoYUV)
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_NVDataset_to_YUVDataset));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_NVDataset_to_YUVDataset));
+TEST_SUITE_END()
+
+TEST_SUITE_END() // ColorConvert
+TEST_SUITE_END() // CL
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/Convolution.cpp b/tests/benchmark/NEON/Convolution.cpp
new file mode 100644
index 0000000..29ff60a
--- /dev/null
+++ b/tests/benchmark/NEON/Convolution.cpp
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime//Tensor.h"
+#include "arm_compute/runtime/NEON/functions/NEConvolution.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/ConvolutionFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+// *INDENT-OFF*
+// clang-format off
+
+#define CONVOLUTION_SQUARE_DATA_TEST_CASE(TEST_NAME, MODE, SHAPES, DT, FILTER_SIZE) \
+ REGISTER_FIXTURE_DATA_TEST_CASE(TEST_NAME, NEConvolutionFixture, framework::DatasetMode::MODE, \
+ combine(combine(combine( \
+ datasets::SHAPES, \
+ framework::dataset::make("DataType", DataType::DT)), \
+ datasets::BorderModes()), \
+ framework::dataset::make("FilterSize", { FILTER_SIZE })));
+
+#define CONVOLUTION_RECTANGLE_DATA_TEST_CASE(TEST_NAME, MODE, SHAPES, DT) \
+ REGISTER_FIXTURE_DATA_TEST_CASE(TEST_NAME, NEConvolutionFixture, framework::DatasetMode::MODE, \
+ combine(combine(combine(combine( \
+ datasets::SHAPES, \
+ framework::dataset::make("DataType", DataType::DT)), \
+ datasets::BorderModes()), \
+ framework::dataset::make("FilterSize", { 3, 5, 7, 9 })), \
+ framework::dataset::make("FilterSize", { 3, 5, 7, 9 })));
+
+#define CONVOLUTION_SEPARABLE_DATA_TEST_CASE(TEST_NAME, MODE, SHAPES, DT, FILTER_SIZE) \
+ CONVOLUTION_SQUARE_DATA_TEST_CASE(TEST_NAME, MODE, SHAPES, DT, FILTER_SIZE)
+
+// clang-format on
+// *INDENT-ON*
+
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(CustomConvolution)
+
+TEST_SUITE(Square3x3)
+
+using NEConvolutionFixture = ConvolutionSquareFixture<Tensor, NEConvolution3x3, Accessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 3)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 3)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 3)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 3)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Square3x3
+
+TEST_SUITE(Square5x5)
+
+using NEConvolutionFixture = ConvolutionSquareFixture<Tensor, NEConvolution5x5, Accessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 5)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 5)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 5)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 5)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Square5x5
+
+TEST_SUITE(Square7x7)
+
+using NEConvolutionFixture = ConvolutionSquareFixture<Tensor, NEConvolution7x7, Accessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 7)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 7)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 7)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 7)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Square7x7
+
+TEST_SUITE(Square9x9)
+
+using NEConvolutionFixture = ConvolutionSquareFixture<Tensor, NEConvolution9x9, Accessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 9)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 9)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 9)
+CONVOLUTION_SQUARE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 9)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Square9x9
+
+TEST_SUITE(Rectangle)
+
+using NEConvolutionFixture = ConvolutionRectangleFixture<Tensor, NEConvolutionRectangle, Accessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_RECTANGLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8)
+CONVOLUTION_RECTANGLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_RECTANGLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16)
+CONVOLUTION_RECTANGLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Rectangle
+
+TEST_SUITE(Separable5x5)
+
+using NEConvolutionFixture = ConvolutionSeperableFixture<Tensor, NEConvolution5x5, Accessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 5)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 5)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 5)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 5)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Separable5x5
+
+TEST_SUITE(Separable7x7)
+
+using NEConvolutionFixture = ConvolutionSeperableFixture<Tensor, NEConvolution7x7, Accessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 7)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 7)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 7)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 7)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Separable7x7
+
+TEST_SUITE(Separable9x9)
+
+using NEConvolutionFixture = ConvolutionSeperableFixture<Tensor, NEConvolution9x9, Accessor>;
+
+TEST_SUITE(U8)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), U8, 9)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), U8, 9)
+TEST_SUITE_END() // U8
+
+TEST_SUITE(S16)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunSmall, PRECOMMIT, SmallShapes(), S16, 9)
+CONVOLUTION_SEPARABLE_DATA_TEST_CASE(RunLarge, NIGHTLY, LargeShapes(), S16, 9)
+TEST_SUITE_END() // S16
+
+TEST_SUITE_END() // Separable9x9
+
+TEST_SUITE_END() // CustomConvolution
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/DirectConvolutionLayer.cpp b/tests/benchmark/NEON/DirectConvolutionLayer.cpp
index 22f1bd2..f94ef6b 100644
--- a/tests/benchmark/NEON/DirectConvolutionLayer.cpp
+++ b/tests/benchmark/NEON/DirectConvolutionLayer.cpp
@@ -47,7 +47,7 @@
{
namespace
{
-// Special data types for networks that need 5x5 direct convolution, which does not support Fixed Point
+// Special data types for networks that need 5x5 direct convolution
#ifdef ARM_COMPUTE_ENABLE_F16
const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 });
#else /* ARM_COMPUTE_ENABLE_F16 */
diff --git a/tests/benchmark/NEON/FastCorners.cpp b/tests/benchmark/NEON/FastCorners.cpp
new file mode 100644
index 0000000..0e30d90
--- /dev/null
+++ b/tests/benchmark/NEON/FastCorners.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/Array.h"
+#include "arm_compute/runtime/NEON/functions/NEFastCorners.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/FastCornersFixture.h"
+#include "tests/datasets/ImageFileDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto threshold = framework::dataset::make("Threshold", { 64.f }); // valid range (0.0 ≤ threshold < 256.0)
+const auto border_mode = framework::dataset::make("BorderMode", { BorderMode::UNDEFINED }); // NOTE: only BorderMode::UNDEFINED is implemented
+const auto suppress_nonmax = framework::dataset::make("SuppressNonMax", { false, true });
+} // namespace
+
+using NEFastCornersFixture = FastCornersFixture<Tensor, NEFastCorners, Accessor, KeyPointArray>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(FastCorners)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEFastCornersFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(combine(
+ datasets::SmallImageFiles(),
+ framework::dataset::make("Format", { Format::U8 })),
+ threshold),
+ suppress_nonmax),
+ border_mode));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEFastCornersFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(combine(
+ datasets::LargeImageFiles(),
+ framework::dataset::make("Format", { Format::U8 })),
+ threshold),
+ suppress_nonmax),
+ border_mode));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // FastCorners
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/GaussianPyramid.cpp b/tests/benchmark/NEON/GaussianPyramid.cpp
new file mode 100644
index 0000000..a62819f
--- /dev/null
+++ b/tests/benchmark/NEON/GaussianPyramid.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NEGaussianPyramid.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/GaussianPyramidFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+TEST_SUITE(NEON)
+TEST_SUITE(GaussianPyramid)
+TEST_SUITE(Half)
+
+using NEGaussianPyramidFixture = GaussianPyramidHalfFixture<Tensor, NEGaussianPyramidHalf, Accessor, Pyramid>;
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEGaussianPyramidFixture, framework::DatasetMode::PRECOMMIT,
+ combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 4));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEGaussianPyramidFixture, framework::DatasetMode::NIGHTLY,
+ combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 5));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // Half
+TEST_SUITE_END() // GaussianPyramid
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/HOGDetector.cpp b/tests/benchmark/NEON/HOGDetector.cpp
new file mode 100644
index 0000000..3ab9fae
--- /dev/null
+++ b/tests/benchmark/NEON/HOGDetector.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/Array.h"
+#include "arm_compute/runtime/NEON/functions/NEHOGDescriptor.h"
+#include "arm_compute/runtime/NEON/functions/NEHOGDetector.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/NEON/HOGAccessor.h"
+#include "tests/benchmark/fixtures/HOGDetectorFixture.h"
+#include "tests/datasets/HOGDescriptorDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+/* Input dataset (values must be a multiple of the HOGInfo block_size) */
+const auto DetectionWindowStrideDataset = framework::dataset::make("DetectionWindowStride", { Size2D(8, 8), Size2D(16, 16) });
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(HOGDetector)
+
+using NEHOGDetectorFixture = HOGDetectorFixture<Tensor, HOG, NEHOGDetector, Accessor, HOGAccessor, NEHOGDescriptor, DetectionWindowArray>;
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEHOGDetectorFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ DetectionWindowStrideDataset,
+ datasets::SmallHOGDescriptorDataset()),
+ framework::dataset::make("Format", Format::U8)),
+ framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEHOGDetectorFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ DetectionWindowStrideDataset,
+ datasets::LargeHOGDescriptorDataset()),
+ framework::dataset::make("Format", Format::U8)),
+ framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // HOGDetector
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/HOGMultiDetection.cpp b/tests/benchmark/NEON/HOGMultiDetection.cpp
new file mode 100644
index 0000000..c0b9d1d
--- /dev/null
+++ b/tests/benchmark/NEON/HOGMultiDetection.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/MultiHOG.h"
+#include "arm_compute/runtime/NEON/functions/NEHOGMultiDetection.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/NEON/ArrayAccessor.h"
+#include "tests/NEON/HOGAccessor.h"
+#include "tests/benchmark/fixtures/HOGMultiDetectionFixture.h"
+#include "tests/datasets/HOGMultiDetectionDataset.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+// *INDENT-OFF*
+// clang-format off
+using NEHOGMultiDetectionFixture = HOGMultiDetectionFixture<Tensor,
+ HOG,
+ MultiHOG,
+ DetectionWindowArray,
+ Size2DArray,
+ NEHOGMultiDetection,
+ Accessor,
+ HOGAccessor,
+ ArrayAccessor<Size2D>>;
+TEST_SUITE(NEON)
+TEST_SUITE(HOGMultiDetection)
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEHOGMultiDetectionFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::SmallHOGMultiDetectionDataset(),
+ framework::dataset::make("Format", Format::U8)),
+ framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})),
+ framework::dataset::make("NonMaximaSuppression", {false, true})));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEHOGMultiDetectionFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::LargeHOGMultiDetectionDataset(),
+ framework::dataset::make("Format", Format::U8)),
+ framework::dataset::make("BorderMode", {BorderMode::CONSTANT, BorderMode::REPLICATE})),
+ framework::dataset::make("NonMaximaSuppression", {false, true})));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // HOGMultiDetection
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/LaplacianPyramid.cpp b/tests/benchmark/NEON/LaplacianPyramid.cpp
new file mode 100644
index 0000000..e314aff
--- /dev/null
+++ b/tests/benchmark/NEON/LaplacianPyramid.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NELaplacianPyramid.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/LaplacianPyramidFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto small_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 3);
+const auto large_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 5);
+
+const auto formats = combine(framework::dataset::make("FormatIn", Format::U8), framework::dataset::make("FormatOut", Format::S16));
+} // namespace
+
+using NELaplacianPyramidFixture = LaplacianPyramidFixture<Tensor, NELaplacianPyramid, Accessor, Pyramid>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(LaplacianPyramid)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NELaplacianPyramidFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()),
+ small_laplacian_pyramid_levels),
+ formats));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NELaplacianPyramidFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ large_laplacian_pyramid_levels),
+ formats));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // LaplacianPyramid
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/LaplacianReconstruct.cpp b/tests/benchmark/NEON/LaplacianReconstruct.cpp
new file mode 100644
index 0000000..602923b
--- /dev/null
+++ b/tests/benchmark/NEON/LaplacianReconstruct.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NELaplacianPyramid.h"
+#include "arm_compute/runtime/NEON/functions/NELaplacianReconstruct.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/LaplacianReconstructFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto small_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 3);
+const auto large_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 5);
+
+const auto formats = combine(framework::dataset::make("FormatIn", Format::S16), framework::dataset::make("FormatOut", Format::U8));
+} // namespace
+
+// *INDENT-OFF*
+// clang-format off
+using NELaplacianReconstructFixture = LaplacianReconstructFixture<Tensor,
+ NELaplacianReconstruct,
+ Accessor,
+ NELaplacianPyramid,
+ Pyramid>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(LaplacianReconstruct)
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NELaplacianReconstructFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()),
+ small_laplacian_reconstruct_levels),
+ formats));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NELaplacianReconstructFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ large_laplacian_reconstruct_levels),
+ formats));
+
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // LaplacianReconstruct
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/LocallyConnectedLayer.cpp b/tests/benchmark/NEON/LocallyConnectedLayer.cpp
new file mode 100644
index 0000000..4609093
--- /dev/null
+++ b/tests/benchmark/NEON/LocallyConnectedLayer.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NELocallyConnectedLayer.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/LocallyConnectedLayerFixture.h"
+#include "tests/datasets/LocallyConnectedDataset.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto data_types = framework::dataset::make("DataType", { DataType::F32 });
+} // namespace
+
+using NELocallyConnectedLayerFixture = LocallyConnectedLayerFixture<Tensor, NELocallyConnectedLayer, Accessor>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(LocallyConnectedLayer)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NELocallyConnectedLayerFixture, framework::DatasetMode::ALL,
+ combine(combine(
+ datasets::SmallLocallyConnectedDataset(),
+ data_types),
+ framework::dataset::make("Batches", 1)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NELocallyConnectedLayerFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(
+ datasets::SmallLocallyConnectedDataset(),
+ data_types),
+ framework::dataset::make("Batches", { 4, 8 })));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // LocallyConnectedLayer
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/Magnitude.cpp b/tests/benchmark/NEON/Magnitude.cpp
index e2b1210..d671b8e 100644
--- a/tests/benchmark/NEON/Magnitude.cpp
+++ b/tests/benchmark/NEON/Magnitude.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -47,25 +47,11 @@
TEST_SUITE(NEON)
TEST_SUITE(Magnitude)
-
-#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-TEST_SUITE(FP16)
-REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallImageShapes(), framework::dataset::make("Format", { Format::S16 })),
- magnitude_types),
- framework::dataset::make("UseFP16", { true })));
-REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeImageShapes(), framework::dataset::make("Format", { Format::S16 })),
- magnitude_types),
- framework::dataset::make("UseFP16", { true })));
-TEST_SUITE_END() // FP16
-#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-
TEST_SUITE(S16)
-REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallImageShapes(), framework::dataset::make("Format", { Format::S16 })),
- magnitude_types),
- framework::dataset::make("UseFP16", { false })));
-REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeImageShapes(), framework::dataset::make("Format", { Format::S16 })),
- magnitude_types),
- framework::dataset::make("UseFP16", { false })));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallImageShapes(), framework::dataset::make("Format", { Format::S16 })),
+ magnitude_types));
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEMagnitudeFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeImageShapes(), framework::dataset::make("Format", { Format::S16 })),
+ magnitude_types));
TEST_SUITE_END() // S16
TEST_SUITE_END() // Magnitude
TEST_SUITE_END() // NEON
diff --git a/tests/benchmark/NEON/OpticalFlow.cpp b/tests/benchmark/NEON/OpticalFlow.cpp
new file mode 100644
index 0000000..30672a1
--- /dev/null
+++ b/tests/benchmark/NEON/OpticalFlow.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/Array.h"
+#include "arm_compute/runtime/NEON/functions/NEGaussianPyramid.h"
+#include "arm_compute/runtime/NEON/functions/NEOpticalFlow.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/NEON/ArrayAccessor.h"
+#include "tests/benchmark/fixtures/OpticalFlowFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ImageFileDatasets.h"
+#include "tests/datasets/OpticalFlowDataset.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+using NEOpticalFlowFixture = OpticalFlowFixture<Tensor, NEOpticalFlow, Accessor, KeyPointArray, ArrayAccessor<KeyPoint>, Pyramid, NEGaussianPyramidHalf>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(OpticalFlow)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEOpticalFlowFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(
+ datasets::SmallOpticalFlowDataset(),
+ framework::dataset::make("Format", Format::U8)),
+ datasets::BorderModes()));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEOpticalFlowFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(
+ datasets::LargeOpticalFlowDataset(),
+ framework::dataset::make("Format", Format::U8)),
+ datasets::BorderModes()));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // OpticalFlow
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/Remap.cpp b/tests/benchmark/NEON/Remap.cpp
new file mode 100644
index 0000000..187aeb7
--- /dev/null
+++ b/tests/benchmark/NEON/Remap.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NERemap.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/RemapFixture.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto interpolation_policies = framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR });
+const auto border_modes = framework::dataset::make("BorderModes", { BorderMode::UNDEFINED, BorderMode::CONSTANT });
+const auto remap_data = interpolation_policies * framework::dataset::make("DataType", DataType::U8) * border_modes;
+} // namespace
+
+using NERemapFixture = RemapFixture<Tensor, NERemap, Accessor>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(Remap)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NERemapFixture, framework::DatasetMode::PRECOMMIT,
+ combine( datasets::SmallShapes(), remap_data));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NERemapFixture, framework::DatasetMode::NIGHTLY,
+ combine( datasets::LargeShapes(), remap_data));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // Remap
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/SYSTEM/AlexNet.cpp b/tests/benchmark/NEON/SYSTEM/AlexNet.cpp
deleted file mode 100644
index e349175..0000000
--- a/tests/benchmark/NEON/SYSTEM/AlexNet.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/core/TensorShape.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/NEON/functions/NEActivationLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEDirectConvolutionLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h"
-#include "arm_compute/runtime/NEON/functions/NENormalizationLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h"
-#include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h"
-#include "arm_compute/runtime/SubTensor.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "arm_compute/runtime/TensorAllocator.h"
-#include "tests/NEON/Accessor.h"
-#include "tests/benchmark/fixtures/AlexNetFixture.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "utils/TypePrinter.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-namespace
-{
-#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-const auto alex_net_data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 });
-#else /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-const auto alex_net_data_types = framework::dataset::make("DataType", { DataType::F32 });
-#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-} // namespace
-
-using NEAlexNetFixture = AlexNetFixture<ITensor,
- Tensor,
- SubTensor,
- Accessor,
- NEActivationLayer,
- NEConvolutionLayer,
- NEConvolutionLayer,
- NEFullyConnectedLayer,
- NENormalizationLayer,
- NEPoolingLayer,
- NESoftmaxLayer>;
-
-TEST_SUITE(NEON)
-TEST_SUITE(SYSTEM_TESTS)
-
-REGISTER_FIXTURE_DATA_TEST_CASE(AlexNet, NEAlexNetFixture, framework::DatasetMode::ALL,
- framework::dataset::combine(alex_net_data_types,
- framework::dataset::make("Batches", { 1, 2, 4 })));
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/benchmark/NEON/SYSTEM/LeNet5.cpp b/tests/benchmark/NEON/SYSTEM/LeNet5.cpp
deleted file mode 100644
index d9d08f4..0000000
--- a/tests/benchmark/NEON/SYSTEM/LeNet5.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/core/TensorShape.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/NEON/functions/NEActivationLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h"
-#include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "arm_compute/runtime/TensorAllocator.h"
-#include "tests/NEON/Accessor.h"
-#include "tests/benchmark/fixtures/LeNet5Fixture.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "utils/TypePrinter.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-using NELeNet5Fixture = LeNet5Fixture<Tensor,
- Accessor,
- NEActivationLayer,
- NEConvolutionLayer,
- NEFullyConnectedLayer,
- NEPoolingLayer,
- NESoftmaxLayer>;
-
-TEST_SUITE(NEON)
-TEST_SUITE(SYSTEM_TESTS)
-
-REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5, NELeNet5Fixture, framework::DatasetMode::ALL,
- framework::dataset::make("Batches", { 1, 4, 8 }));
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/benchmark/NEON/Sobel.cpp b/tests/benchmark/NEON/Sobel.cpp
new file mode 100644
index 0000000..8afda38
--- /dev/null
+++ b/tests/benchmark/NEON/Sobel.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NESobel3x3.h"
+#include "arm_compute/runtime/NEON/functions/NESobel5x5.h"
+#include "arm_compute/runtime/NEON/functions/NESobel7x7.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/SobelFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/GradientDimensionDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+using NESobel3x3Fixture = SobelFixture<Tensor, NESobel3x3, Accessor>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(Sobel)
+
+// *INDENT-OFF*
+// clang-format off
+TEST_SUITE(W3x3)
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NESobel3x3Fixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Small2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NESobel3x3Fixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+TEST_SUITE_END() // W3x3
+
+using NESobel5x5Fixture = SobelFixture<Tensor, NESobel5x5, Accessor>;
+
+TEST_SUITE(W5x5)
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NESobel5x5Fixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Small2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NESobel5x5Fixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+TEST_SUITE_END() // W5x5
+
+using NESobel7x7Fixture = SobelFixture<Tensor, NESobel7x7, Accessor>;
+
+TEST_SUITE(W7x7)
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NESobel7x7Fixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Small2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NESobel7x7Fixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ datasets::GradientDimensions()),
+ framework::dataset::make("Format", Format::U8)));
+TEST_SUITE_END() // W7x7
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // Sobel
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/NEON/WarpAffine.cpp b/tests/benchmark/NEON/WarpAffine.cpp
new file mode 100644
index 0000000..e1da874
--- /dev/null
+++ b/tests/benchmark/NEON/WarpAffine.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NEWarpAffine.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/benchmark/fixtures/WarpAffineFixture.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "utils/TypePrinter.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+const auto data_type = framework::dataset::make("DataType", DataType::U8);
+const auto interpolation_types = framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR });
+} // namespace
+
+using NEWarpAffineFixture = WarpAffineFixture<Tensor, NEWarpAffine, Accessor>;
+
+TEST_SUITE(NEON)
+TEST_SUITE(WarpAffine)
+
+// *INDENT-OFF*
+// clang-format off
+REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEWarpAffineFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::SmallShapes(),
+ data_type),
+ interpolation_types),
+ datasets::BorderModes()));
+
+REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEWarpAffineFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::LargeShapes(),
+ data_type),
+ interpolation_types),
+ datasets::BorderModes()));
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END() // WarpAffine
+TEST_SUITE_END() // NEON
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/benchmark/fixtures/ActivationLayerFixture.h b/tests/benchmark/fixtures/ActivationLayerFixture.h
index d46ef28..a82861f 100644
--- a/tests/benchmark/fixtures/ActivationLayerFixture.h
+++ b/tests/benchmark/fixtures/ActivationLayerFixture.h
@@ -48,10 +48,9 @@
shape.set(shape.num_dimensions(), batches);
// Create tensors
- const int fixed_point_position = 4;
const QuantizationInfo q_info(0.5f, -10);
- src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, q_info);
- dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, q_info);
+ src = create_tensor<TensorType>(shape, data_type, 1, q_info);
+ dst = create_tensor<TensorType>(shape, data_type, 1, q_info);
// Create and configure function
act_layer.configure(&src, &dst, info);
diff --git a/tests/benchmark/fixtures/AlexNetFixture.h b/tests/benchmark/fixtures/AlexNetFixture.h
deleted file mode 100644
index 46ac61b..0000000
--- a/tests/benchmark/fixtures/AlexNetFixture.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_ALEXNETFIXTURE
-#define ARM_COMPUTE_TEST_ALEXNETFIXTURE
-
-#include "tests/AssetsLibrary.h"
-#include "tests/Utils.h"
-#include "tests/framework/Fixture.h"
-#include "tests/networks/AlexNetNetwork.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-template <typename ITensorType,
- typename TensorType,
- typename SubTensorType,
- typename Accessor,
- typename ActivationLayerFunction,
- typename ConvolutionLayerFunction,
- typename DirectConvolutionLayerFunction,
- typename FullyConnectedLayerFunction,
- typename NormalizationLayerFunction,
- typename PoolingLayerFunction,
- typename SoftmaxLayerFunction>
-
-class AlexNetFixture : public framework::Fixture
-{
-public:
- template <typename...>
- void setup(DataType data_type, int batches)
- {
- constexpr bool weights_reshaped = false;
- constexpr int fixed_point_position = 4;
-
- network.init(data_type, fixed_point_position, batches, weights_reshaped);
- network.build();
- network.allocate();
- }
-
- void run()
- {
- network.run();
- }
-
- void sync()
- {
- network.sync();
- }
-
- void teardown()
- {
- network.clear();
- }
-
-private:
- networks::AlexNetNetwork<ITensorType,
- TensorType,
- SubTensorType,
- Accessor,
- ActivationLayerFunction,
- ConvolutionLayerFunction,
- DirectConvolutionLayerFunction,
- FullyConnectedLayerFunction,
- NormalizationLayerFunction,
- PoolingLayerFunction,
- SoftmaxLayerFunction>
- network{};
-};
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_ALEXNETFIXTURE */
diff --git a/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h b/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h
index ae8f8a7..42adefe 100644
--- a/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h
+++ b/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h
@@ -45,7 +45,7 @@
void setup(TensorShape tensor_shape, TensorShape param_shape, float epsilon, bool use_gamma, bool use_beta, ActivationLayerInfo act_info, DataType data_type, DataLayout data_layout, int batches)
{
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
+
tensor_shape.set(tensor_shape.num_dimensions(), batches);
if(data_layout == DataLayout::NHWC)
{
@@ -53,12 +53,12 @@
}
// Create tensors
- src = create_tensor<TensorType>(tensor_shape, data_type, 1, fixed_point_position, QuantizationInfo(), data_layout);
- dst = create_tensor<TensorType>(tensor_shape, data_type, 1, fixed_point_position, QuantizationInfo(), data_layout);
- mean = create_tensor<TensorType>(param_shape, data_type, 1, fixed_point_position);
- variance = create_tensor<TensorType>(param_shape, data_type, 1, fixed_point_position);
- beta = create_tensor<TensorType>(param_shape, data_type, 1, fixed_point_position);
- gamma = create_tensor<TensorType>(param_shape, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(tensor_shape, data_type, 1, QuantizationInfo(), data_layout);
+ dst = create_tensor<TensorType>(tensor_shape, data_type, 1, QuantizationInfo(), data_layout);
+ mean = create_tensor<TensorType>(param_shape, data_type, 1);
+ variance = create_tensor<TensorType>(param_shape, data_type, 1);
+ beta = create_tensor<TensorType>(param_shape, data_type, 1);
+ gamma = create_tensor<TensorType>(param_shape, data_type, 1);
// Create and configure function
TensorType *beta_ptr = use_beta ? &beta : nullptr;
diff --git a/tests/benchmark/fixtures/CannyEdgeFixture.h b/tests/benchmark/fixtures/CannyEdgeFixture.h
new file mode 100644
index 0000000..099daba
--- /dev/null
+++ b/tests/benchmark/fixtures/CannyEdgeFixture.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE
+#define ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+class CLCannyEdge;
+class NECannyEdge;
+
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType, typename Function, typename Accessor>
+class CannyEdgeFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(std::string image, int gradient_size, MagnitudeType norm_type, BorderMode border_mode, bool use_fp16, Format format)
+ {
+ // Load the image (cached by the library if loaded before)
+ const RawTensor &raw = library->get(image, format);
+
+ src = create_tensor<TensorType>(raw.shape(), format);
+ dst = create_tensor<TensorType>(raw.shape(), format);
+
+ configure_target<Function>(canny_edge_func, src, dst, gradient_size, static_cast<int>(norm_type) + 1, border_mode, use_fp16);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ library->fill(Accessor(src), raw);
+ }
+
+ void run()
+ {
+ canny_edge_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst);
+ }
+
+protected:
+ template <typename F, typename std::enable_if<std::is_same<F, NECannyEdge>::value, int>::type = 0>
+ void configure_target(F &func, TensorType &src, TensorType &dst, int gradient_size, int norm_type, BorderMode border_mode, bool use_fp16)
+ {
+ func.configure(&src, &dst, upper_thresh, lower_thresh, gradient_size, norm_type, border_mode, constant_border_value, use_fp16);
+ }
+
+ template <typename F, typename std::enable_if<std::is_same<F, CLCannyEdge>::value, int>::type = 0>
+ void configure_target(F &func, TensorType &src, TensorType &dst, int gradient_size, int norm_type, BorderMode border_mode, bool use_fp16)
+ {
+ ARM_COMPUTE_UNUSED(use_fp16);
+ ARM_COMPUTE_ERROR_ON(use_fp16);
+
+ func.configure(&src, &dst, upper_thresh, lower_thresh, gradient_size, norm_type, border_mode, constant_border_value);
+ }
+
+private:
+ static const int32_t lower_thresh = 0;
+ static const int32_t upper_thresh = 255;
+ static const uint8_t constant_border_value = 0;
+
+ TensorType src{};
+ TensorType dst{};
+ Function canny_edge_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE */
diff --git a/tests/benchmark/fixtures/ColorConvertFixture.h b/tests/benchmark/fixtures/ColorConvertFixture.h
new file mode 100644
index 0000000..6656e14
--- /dev/null
+++ b/tests/benchmark/fixtures/ColorConvertFixture.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE
+#define ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename MultiImageType, typename TensorType, typename AccessorType, typename FunctionType>
+class ColorConvertFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape input_shape, Format src_format, Format dst_format)
+ {
+ _src_num_planes = num_planes_from_format(src_format);
+ _dst_num_planes = num_planes_from_format(dst_format);
+
+ TensorShape dst_shape = adjust_odd_shape(input_shape, src_format);
+ dst_shape = adjust_odd_shape(dst_shape, dst_format);
+
+ // Create tensors
+ ref_src = create_multi_image<MultiImageType>(dst_shape, src_format);
+ ref_dst = create_multi_image<MultiImageType>(dst_shape, dst_format);
+
+ if(1U == _src_num_planes)
+ {
+ const TensorType *plane_src = static_cast<TensorType *>(ref_src.plane(0));
+
+ if(1U == _dst_num_planes)
+ {
+ TensorType *plane_dst = static_cast<TensorType *>(ref_dst.plane(0));
+ colorconvert_func.configure(plane_src, plane_dst);
+ }
+ else
+ {
+ colorconvert_func.configure(plane_src, &ref_dst);
+ }
+ }
+ else
+ {
+ if(1U == _dst_num_planes)
+ {
+ TensorType *plane_dst = static_cast<TensorType *>(ref_dst.plane(0));
+ colorconvert_func.configure(&ref_src, plane_dst);
+ }
+ else
+ {
+ colorconvert_func.configure(&ref_src, &ref_dst);
+ }
+ }
+
+ // Allocate tensors
+ ref_src.allocate();
+ ref_dst.allocate();
+
+ // Fill tensor planes
+ for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx)
+ {
+ TensorType *src_plane = static_cast<TensorType *>(ref_src.plane(plane_idx));
+
+ fill(AccessorType(*src_plane), plane_idx);
+ }
+ }
+
+ void run()
+ {
+ colorconvert_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ TensorType *dst_plane = static_cast<TensorType *>(ref_dst.plane(plane_idx));
+ sync_tensor_if_necessary<TensorType>(*dst_plane);
+ }
+ }
+
+ void teardown()
+ {
+ for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx)
+ {
+ TensorType *src_plane = static_cast<TensorType *>(ref_src.plane(plane_idx));
+ src_plane->allocator()->free();
+ }
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ TensorType *dst_plane = static_cast<TensorType *>(ref_dst.plane(plane_idx));
+ dst_plane->allocator()->free();
+ }
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, int i)
+ {
+ library->fill_tensor_uniform(tensor, i);
+ }
+
+private:
+ MultiImageType ref_src{};
+ MultiImageType ref_dst{};
+ FunctionType colorconvert_func{};
+
+ unsigned int _src_num_planes{};
+ unsigned int _dst_num_planes{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE */
diff --git a/tests/benchmark/fixtures/ConvolutionFixture.h b/tests/benchmark/fixtures/ConvolutionFixture.h
new file mode 100644
index 0000000..3f9c2a4
--- /dev/null
+++ b/tests/benchmark/fixtures/ConvolutionFixture.h
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_CONVOLUTIONFIXTURE
+#define ARM_COMPUTE_TEST_CONVOLUTIONFIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+/** Parent fixture that can be used for NEON and CL */
+template <typename TensorType, typename Function, typename Accessor>
+class ConvolutionFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape src_shape, DataType output_data_type, BorderMode border_mode, unsigned int width, unsigned int height, bool is_separable = false)
+ {
+ std::mt19937 gen(library->seed());
+ const uint8_t constant_border_value = 0;
+
+ // Generate random scale value between 1 and 255.
+ std::uniform_int_distribution<uint8_t> distribution_scale(1, 255);
+ const uint32_t scale = distribution_scale(gen);
+
+ ARM_COMPUTE_ERROR_ON(3 != width && 5 != width && 7 != width && 9 != width);
+ ARM_COMPUTE_ERROR_ON(3 != height && 5 != height && 7 != height && 9 != height);
+
+ std::vector<int16_t> conv(width * height);
+
+ _width = width;
+ _height = height;
+
+ if(is_separable)
+ {
+ init_separable_conv(conv.data(), width, height, seed);
+ }
+ else
+ {
+ init_conv(conv.data(), width, height, seed);
+ }
+
+ // Create tensors
+ src = create_tensor<TensorType>(src_shape, DataType::U8);
+ dst = create_tensor<TensorType>(src_shape, output_data_type);
+
+ // Configure function
+ configure_target(convolution_func, src, dst, conv.data(), scale, border_mode, constant_border_value);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ // Fill tensors
+ library->fill_tensor_uniform(Accessor(src), 0);
+ library->fill_tensor_uniform(Accessor(dst), 1);
+ }
+
+ void run()
+ {
+ convolution_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst);
+ }
+
+protected:
+ virtual void configure_target(Function &func, TensorType &src, TensorType &dst, const int16_t *conv, uint32_t scale,
+ BorderMode border_mode, uint8_t border_value) = 0;
+
+protected:
+ unsigned int _width{};
+ unsigned int _height{};
+ Function convolution_func{};
+
+private:
+ const std::random_device::result_type seed = 0;
+ TensorType src{};
+ TensorType dst{};
+};
+
+/** Child fixture used for square convolutions */
+template <typename TensorType, typename Function, typename Accessor>
+class ConvolutionSquareFixture : public ConvolutionFixture<TensorType, Function, Accessor>
+{
+public:
+ template <typename...>
+ void setup(TensorShape src_shape, DataType output_data_type, BorderMode border_mode, unsigned int width)
+ {
+ ConvolutionFixture<TensorType, Function, Accessor>::setup(src_shape, output_data_type, border_mode, width, width);
+ }
+
+protected:
+ void configure_target(Function &func, TensorType &src, TensorType &dst, const int16_t *conv, uint32_t scale,
+ BorderMode border_mode, uint8_t constant_border_value)
+ {
+ this->convolution_func.configure(&src, &dst, conv, scale, border_mode, constant_border_value);
+ }
+};
+
+/** Child fixture used for rectangular convolutions */
+template <typename TensorType, typename Function, typename Accessor>
+class ConvolutionRectangleFixture : public ConvolutionFixture<TensorType, Function, Accessor>
+{
+public:
+ template <typename...>
+ void setup(TensorShape src_shape, DataType output_data_type, BorderMode border_mode, unsigned int width, unsigned int height)
+ {
+ ConvolutionFixture<TensorType, Function, Accessor>::setup(src_shape, output_data_type, border_mode, width, height);
+ }
+
+protected:
+ void configure_target(Function &func, TensorType &src, TensorType &dst, const int16_t *conv, uint32_t scale,
+ BorderMode border_mode, uint8_t constant_border_value)
+ {
+ this->convolution_func.configure(&src, &dst, conv, this->_width, this->_height, scale, border_mode, constant_border_value);
+ }
+};
+
+/** Child fixture used for separable convolutions */
+template <typename TensorType, typename Function, typename Accessor>
+class ConvolutionSeperableFixture : public ConvolutionFixture<TensorType, Function, Accessor>
+{
+public:
+ template <typename...>
+ void setup(TensorShape src_shape, DataType output_data_type, BorderMode border_mode, unsigned int width)
+ {
+ ConvolutionFixture<TensorType, Function, Accessor>::setup(src_shape, output_data_type, border_mode, width, width, true);
+ }
+
+protected:
+ void configure_target(Function &func, TensorType &src, TensorType &dst, const int16_t *conv, uint32_t scale,
+ BorderMode border_mode, uint8_t constant_border_value)
+ {
+ this->convolution_func.configure(&src, &dst, conv, scale, border_mode, constant_border_value);
+ }
+};
+
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_CONVOLUTIONFIXTURE */
diff --git a/tests/benchmark/fixtures/ConvolutionLayerFixture.h b/tests/benchmark/fixtures/ConvolutionLayerFixture.h
index 511daf7..b23c345 100644
--- a/tests/benchmark/fixtures/ConvolutionLayerFixture.h
+++ b/tests/benchmark/fixtures/ConvolutionLayerFixture.h
@@ -46,16 +46,16 @@
int batches)
{
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
src_shape.set(3 /* batch */, batches);
dst_shape.set(3 /* batch */, batches);
- DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
+ DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
+ const QuantizationInfo qinfo(2.f / 255.f, 127);
// Create tensors
- src = create_tensor<TensorType>(src_shape, data_type, 1, fixed_point_position);
- weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position);
- biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(dst_shape, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(src_shape, data_type, 1, qinfo);
+ weights = create_tensor<TensorType>(weights_shape, data_type, 1, qinfo);
+ biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1);
+ dst = create_tensor<TensorType>(dst_shape, data_type, 1, qinfo);
// Create and configure function
conv_layer.configure(&src, &weights, &biases, &dst, info, WeightsInfo(), dilation, act_info);
diff --git a/tests/benchmark/fixtures/DepthConcatenateLayerFixture.h b/tests/benchmark/fixtures/DepthConcatenateLayerFixture.h
index bd4b404..7f7ed8b 100644
--- a/tests/benchmark/fixtures/DepthConcatenateLayerFixture.h
+++ b/tests/benchmark/fixtures/DepthConcatenateLayerFixture.h
@@ -27,6 +27,7 @@
#include "arm_compute/core/TensorShape.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/core/Utils.h"
+#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "tests/AssetsLibrary.h"
#include "tests/Globals.h"
#include "tests/Utils.h"
@@ -95,12 +96,12 @@
for(const auto &shape : src_shapes)
{
- _srcs.emplace_back(create_tensor<TensorType>(shape, data_type, 1, _fractional_bits));
+ _srcs.emplace_back(create_tensor<TensorType>(shape, data_type, 1));
src_ptrs.emplace_back(&_srcs.back());
}
- TensorShape dst_shape = calculate_depth_concatenate_shape(src_ptrs);
- _dst = create_tensor<TensorType>(dst_shape, data_type, 1, _fractional_bits);
+ TensorShape dst_shape = misc::shape_calculator::calculate_depth_concatenate_shape(src_ptrs);
+ _dst = create_tensor<TensorType>(dst_shape, data_type, 1);
_depth_concat.configure(src_ptrs, &_dst);
@@ -139,7 +140,6 @@
std::vector<TensorType> _srcs{};
TensorType _dst{};
Function _depth_concat{};
- int _fractional_bits{ 1 };
};
} // namespace benchmark
} // namespace test
diff --git a/tests/benchmark/fixtures/DepthwiseConvolutionLayerFixture.h b/tests/benchmark/fixtures/DepthwiseConvolutionLayerFixture.h
index 9276431..48ea038 100644
--- a/tests/benchmark/fixtures/DepthwiseConvolutionLayerFixture.h
+++ b/tests/benchmark/fixtures/DepthwiseConvolutionLayerFixture.h
@@ -57,15 +57,15 @@
weights_shape.set(2, dst_shape.z());
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
+
src_shape.set(3 /* batch */, batches);
dst_shape.set(3 /* batch */, batches);
// Create tensors
- src = create_tensor<TensorType>(src_shape, data_type, 1, fixed_point_position, QuantizationInfo(0.5f, 10));
- weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position, QuantizationInfo(0.5f, 10));
- biases = create_tensor<TensorType>(TensorShape(weights_shape[2]), is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(dst_shape, data_type, 1, fixed_point_position, QuantizationInfo(0.5f, 10));
+ src = create_tensor<TensorType>(src_shape, data_type, 1, QuantizationInfo(0.5f, 10));
+ weights = create_tensor<TensorType>(weights_shape, data_type, 1, QuantizationInfo(0.5f, 10));
+ biases = create_tensor<TensorType>(TensorShape(weights_shape[2]), is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type, 1);
+ dst = create_tensor<TensorType>(dst_shape, data_type, 1, QuantizationInfo(0.5f, 10));
// Create and configure function
depth_conv.configure(&src, &weights, &biases, &dst, info);
diff --git a/tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h b/tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h
index ef1a407..927bb4d 100644
--- a/tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h
+++ b/tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h
@@ -47,18 +47,18 @@
PadStrideInfo pad_stride_depthwise_info, PadStrideInfo pad_stride_pointwise_info, DataType data_type, int batches)
{
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
+
src_shape.set(3 /* batch */, batches);
depthwise_out_shape.set(3 /* batch */, batches);
dst_shape.set(3 /* batch */, batches);
- src = create_tensor<TensorType>(src_shape, data_type, 1, fixed_point_position);
- depthwise_weights = create_tensor<TensorType>(depthwise_weights_shape, data_type, 1, fixed_point_position);
- depthwise_biases = create_tensor<TensorType>(depthwise_biases_shape, data_type, 1, fixed_point_position);
- depthwise_out = create_tensor<TensorType>(depthwise_out_shape, data_type, 1, fixed_point_position);
- pointwise_weights = create_tensor<TensorType>(pointwise_weights_shape, data_type, 1, fixed_point_position);
- pointwise_biases = create_tensor<TensorType>(pointwise_biases_shape, data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(dst_shape, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(src_shape, data_type, 1);
+ depthwise_weights = create_tensor<TensorType>(depthwise_weights_shape, data_type, 1);
+ depthwise_biases = create_tensor<TensorType>(depthwise_biases_shape, data_type, 1);
+ depthwise_out = create_tensor<TensorType>(depthwise_out_shape, data_type, 1);
+ pointwise_weights = create_tensor<TensorType>(pointwise_weights_shape, data_type, 1);
+ pointwise_biases = create_tensor<TensorType>(pointwise_biases_shape, data_type, 1);
+ dst = create_tensor<TensorType>(dst_shape, data_type, 1);
// Create and configure function
depth_sep_conv_layer.configure(&src, &depthwise_weights, &depthwise_biases, &depthwise_out, &pointwise_weights, &pointwise_biases, &dst, pad_stride_depthwise_info, pad_stride_pointwise_info);
diff --git a/tests/benchmark/fixtures/DirectConvolutionLayerFixture.h b/tests/benchmark/fixtures/DirectConvolutionLayerFixture.h
index 419f6dd..f74f0ec 100644
--- a/tests/benchmark/fixtures/DirectConvolutionLayerFixture.h
+++ b/tests/benchmark/fixtures/DirectConvolutionLayerFixture.h
@@ -49,16 +49,16 @@
ARM_COMPUTE_UNUSED(dilation);
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
+
src_shape.set(3 /* batch */, batches);
dst_shape.set(3 /* batch */, batches);
DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
// Create tensors
- src = create_tensor<TensorType>(src_shape, data_type, 1, fixed_point_position);
- weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position);
- biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(dst_shape, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(src_shape, data_type, 1);
+ weights = create_tensor<TensorType>(weights_shape, data_type, 1);
+ biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1);
+ dst = create_tensor<TensorType>(dst_shape, data_type, 1);
// Create and configure function
conv_layer.configure(&src, &weights, &biases, &dst, info, act_info);
diff --git a/tests/benchmark/fixtures/FastCornersFixture.h b/tests/benchmark/fixtures/FastCornersFixture.h
new file mode 100644
index 0000000..636d258
--- /dev/null
+++ b/tests/benchmark/fixtures/FastCornersFixture.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_FAST_CORNERS_FIXTURE
+#define ARM_COMPUTE_TEST_FAST_CORNERS_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+class CLFastCorners;
+class NEFastCorners;
+
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType, typename Function, typename Accessor, typename ArrayType>
+class FastCornersFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(std::string image, Format format, float threshold, bool suppress_nonmax, BorderMode border_mode)
+ {
+ // Load the image (cached by the library if loaded before)
+ const RawTensor &raw = library->get(image, format);
+
+ // Create tensor
+ src = create_tensor<TensorType>(raw.shape(), format);
+
+ // Create and configure function
+ configure_target<Function>(fast_corners_func, src, corners, &num_corners, threshold, suppress_nonmax, border_mode, 0);
+
+ // Allocate tensor
+ src.allocator()->allocate();
+
+ // Copy image data to tensor
+ library->fill(Accessor(src), raw);
+ }
+
+ void run()
+ {
+ fast_corners_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ }
+
+ void teardown()
+ {
+ src.allocator()->free();
+ }
+
+protected:
+ template <typename F, typename std::enable_if<std::is_same<F, CLFastCorners>::value, int>::type = 0>
+ void configure_target(F &func, TensorType &src, ArrayType &corners, unsigned int *num_corners, float threshold, bool suppress_nonmax, BorderMode border_mode, uint8_t constant_border_value)
+ {
+ func.configure(&src, threshold, suppress_nonmax, &corners, num_corners, border_mode, constant_border_value);
+ }
+
+ template <typename F, typename std::enable_if<std::is_same<F, NEFastCorners>::value, int>::type = 0>
+ void configure_target(F &func, TensorType &src, ArrayType &corners, unsigned int *num_corners, float threshold, bool suppress_nonmax, BorderMode border_mode, uint8_t constant_border_value)
+ {
+ ARM_COMPUTE_UNUSED(num_corners);
+ func.configure(&src, threshold, suppress_nonmax, &corners, border_mode, constant_border_value);
+ }
+
+private:
+ const static size_t max_corners = 20000;
+
+ TensorType src{};
+ ArrayType corners{ max_corners };
+ unsigned int num_corners{ max_corners };
+ Function fast_corners_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_FAST_CORNERS_FIXTURE */
diff --git a/tests/benchmark/fixtures/FlattenLayerFixture.h b/tests/benchmark/fixtures/FlattenLayerFixture.h
index 749fa0d..3d46989 100644
--- a/tests/benchmark/fixtures/FlattenLayerFixture.h
+++ b/tests/benchmark/fixtures/FlattenLayerFixture.h
@@ -46,11 +46,9 @@
TensorShape shape_flatten(shape);
shape_flatten.collapse(3);
- const unsigned int fixed_point_position = is_data_type_fixed_point(data_type) ? 4 : 0;
-
// Create tensors
- src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(shape_flatten, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(shape, data_type, 1);
+ dst = create_tensor<TensorType>(shape_flatten, data_type, 1);
// Create and configure function
flatten_func.configure(&src, &dst);
diff --git a/tests/benchmark/fixtures/FullyConnectedLayerFixture.h b/tests/benchmark/fixtures/FullyConnectedLayerFixture.h
index e7a5260..caef5be 100644
--- a/tests/benchmark/fixtures/FullyConnectedLayerFixture.h
+++ b/tests/benchmark/fixtures/FullyConnectedLayerFixture.h
@@ -45,15 +45,15 @@
void setup(TensorShape src_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape dst_shape, DataType data_type, int batches)
{
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
+
src_shape.set(src_shape.num_dimensions() /* batch */, batches);
dst_shape.set(dst_shape.num_dimensions() /* batch */, batches);
// Create tensors
- src = create_tensor<TensorType>(src_shape, data_type, 1, fixed_point_position);
- weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position);
- biases = create_tensor<TensorType>(biases_shape, data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(dst_shape, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(src_shape, data_type, 1);
+ weights = create_tensor<TensorType>(weights_shape, data_type, 1);
+ biases = create_tensor<TensorType>(biases_shape, data_type, 1);
+ dst = create_tensor<TensorType>(dst_shape, data_type, 1);
// Create and configure function
fc_layer.configure(&src, &weights, &biases, &dst);
diff --git a/tests/benchmark/fixtures/GEMMFixture.h b/tests/benchmark/fixtures/GEMMFixture.h
index f706f3e..7628abc 100644
--- a/tests/benchmark/fixtures/GEMMFixture.h
+++ b/tests/benchmark/fixtures/GEMMFixture.h
@@ -44,13 +44,11 @@
template <typename...>
void setup(TensorShape shape_a, TensorShape shape_b, TensorShape shape_c, TensorShape shape_dst, float alpha, float beta, DataType data_type, bool reshape_b_only_on_first_run)
{
- constexpr int fixed_point_position = 4;
-
// Create tensors
- a = create_tensor<TensorType>(shape_a, data_type, 1, fixed_point_position);
- b = create_tensor<TensorType>(shape_b, data_type, 1, fixed_point_position);
- c = create_tensor<TensorType>(shape_c, data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(shape_dst, data_type, 1, fixed_point_position);
+ a = create_tensor<TensorType>(shape_a, data_type, 1);
+ b = create_tensor<TensorType>(shape_b, data_type, 1);
+ c = create_tensor<TensorType>(shape_c, data_type, 1);
+ dst = create_tensor<TensorType>(shape_dst, data_type, 1);
// Create and configure function
gemm.configure(&a, &b, &c, &dst, alpha, beta, GEMMInfo(false, false, reshape_b_only_on_first_run));
diff --git a/tests/benchmark/fixtures/GEMMInterleave4x4Fixture.h b/tests/benchmark/fixtures/GEMMInterleave4x4Fixture.h
index 793c540..c8e6f4a 100644
--- a/tests/benchmark/fixtures/GEMMInterleave4x4Fixture.h
+++ b/tests/benchmark/fixtures/GEMMInterleave4x4Fixture.h
@@ -44,14 +44,12 @@
template <typename...>
void setup(size_t x, size_t y, DataType data_type)
{
- constexpr int fixed_point_position = 4;
-
const TensorShape shape_a(x, y);
const TensorShape shape_b(static_cast<size_t>(x * 4.f), static_cast<size_t>(std::ceil(y / 4.f)));
// Create tensors
- a = create_tensor<TensorType>(shape_a, data_type, 1, fixed_point_position);
- b = create_tensor<TensorType>(shape_b, data_type, 1, fixed_point_position);
+ a = create_tensor<TensorType>(shape_a, data_type, 1);
+ b = create_tensor<TensorType>(shape_b, data_type, 1);
// Create and configure function
gemm.configure(&a, &b);
diff --git a/tests/benchmark/fixtures/GEMMLowpFixture.h b/tests/benchmark/fixtures/GEMMLowpFixture.h
index cf02fa0..215fdef 100644
--- a/tests/benchmark/fixtures/GEMMLowpFixture.h
+++ b/tests/benchmark/fixtures/GEMMLowpFixture.h
@@ -44,6 +44,7 @@
template <typename...>
void setup(TensorShape shape_a, TensorShape shape_b, TensorShape shape_c, TensorShape shape_dst, float alpha, float beta)
{
+ // However the interface for both GEMM and GEMMLowp should be reworked in order to accepts only the 3 dimensions M, N and K
ARM_COMPUTE_UNUSED(shape_c);
ARM_COMPUTE_UNUSED(alpha);
ARM_COMPUTE_UNUSED(beta);
@@ -51,9 +52,9 @@
// Note: The offsets for matrix A and matrix B are set to 0 in order to skip the computation for the offset contribution
// Create tensors
- a = create_tensor<TensorType>(shape_a, DataType::QASYMM8, 1, 0, QuantizationInfo(1.0f / 255.0f, 0));
- b = create_tensor<TensorType>(shape_b, DataType::QASYMM8, 1, 0, QuantizationInfo(1.0f / 255.0f, 0));
- c = create_tensor<TensorType>(shape_dst, DataType::S32, 1, 0, QuantizationInfo(1.0f / 255.0f, 0));
+ a = create_tensor<TensorType>(shape_a, DataType::QASYMM8, 1, QuantizationInfo(1.0f / 255.0f, 0));
+ b = create_tensor<TensorType>(shape_b, DataType::QASYMM8, 1, QuantizationInfo(1.0f / 255.0f, 0));
+ c = create_tensor<TensorType>(shape_dst, DataType::S32, 1, QuantizationInfo(1.0f / 255.0f, 0));
// Create and configure function
gemmlowp.configure(&a, &b, &c);
diff --git a/tests/benchmark/fixtures/GaussianPyramidFixture.h b/tests/benchmark/fixtures/GaussianPyramidFixture.h
new file mode 100644
index 0000000..0df7c1a
--- /dev/null
+++ b/tests/benchmark/fixtures/GaussianPyramidFixture.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_GAUSSIAN_PYRAMID_HALF_FIXTURE
+#define ARM_COMPUTE_GAUSSIAN_PYRAMID_HALF_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType, typename Function, typename Accessor, typename PyramidType>
+class GaussianPyramidHalfFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape shape, BorderMode border_mode, size_t num_levels)
+ {
+ const uint8_t constant_border_value = 0;
+
+ // Create tensors
+ src = create_tensor<TensorType>(shape, DataType::U8);
+ PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, shape, Format::U8);
+ pyramid.init(pyramid_info);
+
+ // Configure function
+ gaussian_pyramid_func.configure(&src, &pyramid, border_mode, constant_border_value);
+
+ // Allocate input tensor and pyramid
+ src.allocator()->allocate();
+ pyramid.allocate();
+
+ // Fill tensor
+ library->fill_tensor_uniform(Accessor(src), 0);
+ }
+
+ void run()
+ {
+ gaussian_pyramid_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ }
+
+private:
+ TensorType src{};
+ PyramidType pyramid{};
+ Function gaussian_pyramid_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_GAUSSIAN_PYRAMID_HALF_FIXTURE */
diff --git a/tests/benchmark/fixtures/HOGDescriptorFixture.h b/tests/benchmark/fixtures/HOGDescriptorFixture.h
index 3933a16..3129593 100644
--- a/tests/benchmark/fixtures/HOGDescriptorFixture.h
+++ b/tests/benchmark/fixtures/HOGDescriptorFixture.h
@@ -82,15 +82,11 @@
sync_if_necessary<TensorType>();
}
- void teardown()
- {
- src.allocator()->free();
- dst.allocator()->free();
- }
+protected:
+ TensorType dst{};
private:
TensorType src{};
- TensorType dst{};
Function hog_descriptor_func{};
};
} // namespace benchmark
diff --git a/tests/benchmark/fixtures/HOGDetectorFixture.h b/tests/benchmark/fixtures/HOGDetectorFixture.h
new file mode 100644
index 0000000..48404d8
--- /dev/null
+++ b/tests/benchmark/fixtures/HOGDetectorFixture.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_HOG_DETECTOR_FIXTURE
+#define ARM_COMPUTE_TEST_HOG_DETECTOR_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/benchmark/fixtures/HOGDescriptorFixture.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType,
+ typename HOGType,
+ typename Function,
+ typename Accessor,
+ typename HOGAccessor,
+ typename HOGDescriptorType,
+ typename ArrayType>
+class HOGDetectorFixture : public HOGDescriptorFixture<TensorType, HOGType, HOGDescriptorType, Accessor>
+{
+public:
+ template <typename...>
+ void setup(Size2D detection_window_stride, std::string image, HOGInfo hog_info, Format format, BorderMode border_mode)
+ {
+ HDF::setup(image, hog_info, format, border_mode);
+ HDF::run();
+
+ // Initialise descriptor (linear SVM coefficients).
+ // NOTE: Fixed values are used to keep the number of detection windows detected
+ // consistent in order to have meaningful validation tolerances.
+ // The values are "unbalanced" to reduce the number of detected objects
+ const std::random_device::result_type seed = 0;
+ std::vector<float> descriptor = generate_random_real(hog_info.descriptor_size(), -0.505f, 0.495f, seed);
+
+ // Create HOG
+ hog = create_HOG<HOGType>(hog_info);
+
+ // Copy HOG descriptor values to HOG memory
+ {
+ HOGAccessor hog_accessor(hog);
+ std::memcpy(hog_accessor.descriptor(), descriptor.data(), descriptor.size() * sizeof(float));
+ }
+
+ // Create and configure function
+ hog_detector_func.configure(&(HDF::dst), &hog, &detection_windows, detection_window_stride);
+
+ // Reset detection windows
+ detection_windows.clear();
+ }
+
+ void run()
+ {
+ hog_detector_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ }
+
+private:
+ static const unsigned int max_num_detection_windows = 100000;
+
+ HOGType hog{};
+ Function hog_detector_func{};
+ ArrayType detection_windows{ max_num_detection_windows };
+
+ using HDF = HOGDescriptorFixture<TensorType, HOGType, HOGDescriptorType, Accessor>;
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_HOG_DETECTOR_FIXTURE */
diff --git a/tests/benchmark/fixtures/HOGMultiDetectionFixture.h b/tests/benchmark/fixtures/HOGMultiDetectionFixture.h
new file mode 100644
index 0000000..947646c
--- /dev/null
+++ b/tests/benchmark/fixtures/HOGMultiDetectionFixture.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_HOG_MULTI_DETECTION_FIXTURE
+#define ARM_COMPUTE_TEST_HOG_MULTI_DETECTION_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType,
+ typename HOGType,
+ typename MultiHOGType,
+ typename DetectionWindowArrayType,
+ typename DetectionWindowStrideType,
+ typename Function,
+ typename Accessor,
+ typename HOGAccessorType,
+ typename Size2DArrayAccessorType>
+class HOGMultiDetectionFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(std::string image, std::vector<HOGInfo> models, Format format, BorderMode border_mode, bool non_maxima_suppression)
+ {
+ // Only defined borders supported
+ ARM_COMPUTE_ERROR_ON(border_mode == BorderMode::UNDEFINED);
+
+ std::mt19937 generator(library->seed());
+ std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
+ uint8_t constant_border_value = static_cast<uint8_t>(distribution_u8(generator));
+
+ // Load the image (cached by the library if loaded before)
+ const RawTensor &raw = library->get(image, format);
+
+ // Initialize descriptors vector
+ std::vector<std::vector<float>> descriptors(models.size());
+
+ // Resize detection window_strides for index access
+ detection_window_strides.resize(models.size());
+
+ // Initialiize MultiHOG and detection windows
+ initialize_batch(models, multi_hog, descriptors, detection_window_strides);
+
+ // Create tensors
+ src = create_tensor<TensorType>(raw.shape(), format);
+
+ // Use default values for threshold and min_distance
+ const float threshold = 0.f;
+ const float min_distance = 1.f;
+
+ hog_multi_detection_func.configure(&src,
+ &multi_hog,
+ &detection_windows,
+ &detection_window_strides,
+ border_mode,
+ constant_border_value,
+ threshold,
+ non_maxima_suppression,
+ min_distance);
+
+ // Reset detection windows
+ detection_windows.clear();
+
+ // Allocate tensor
+ src.allocator()->allocate();
+
+ library->fill(Accessor(src), raw);
+ }
+
+ void run()
+ {
+ hog_multi_detection_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ }
+
+private:
+ void initialize_batch(const std::vector<HOGInfo> &models, MultiHOGType &multi_hog,
+ std::vector<std::vector<float>> &descriptors, DetectionWindowStrideType &detection_window_strides)
+ {
+ for(unsigned i = 0; i < models.size(); ++i)
+ {
+ auto hog_model = reinterpret_cast<HOGType *>(multi_hog.model(i));
+ hog_model->init(models[i]);
+
+ // Initialise descriptor (linear SVM coefficients).
+ std::random_device::result_type seed = 0;
+ descriptors.at(i) = generate_random_real(models[i].descriptor_size(), -0.505f, 0.495f, seed);
+
+ // Copy HOG descriptor values to HOG memory
+ {
+ HOGAccessorType hog_accessor(*hog_model);
+ std::memcpy(hog_accessor.descriptor(), descriptors.at(i).data(), descriptors.at(i).size() * sizeof(float));
+ }
+
+ // Initialize detection window stride
+ Size2DArrayAccessorType accessor(detection_window_strides);
+ accessor.at(i) = models[i].block_stride();
+ }
+ }
+
+private:
+ static const unsigned int model_size = 4;
+ static const unsigned int max_num_detection_windows = 100000;
+
+ MultiHOGType multi_hog{ model_size };
+ DetectionWindowStrideType detection_window_strides{ model_size };
+ DetectionWindowArrayType detection_windows{ max_num_detection_windows };
+
+ TensorType src{};
+ Function hog_multi_detection_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_HOG_MULTI_DETECTION_FIXTURE */
diff --git a/tests/benchmark/fixtures/LaplacianPyramidFixture.h b/tests/benchmark/fixtures/LaplacianPyramidFixture.h
new file mode 100644
index 0000000..7bc3370
--- /dev/null
+++ b/tests/benchmark/fixtures/LaplacianPyramidFixture.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE
+#define ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType, typename Function, typename Accessor, typename PyramidType>
+class LaplacianPyramidFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(const TensorShape &input_shape, BorderMode border_mode, size_t num_levels, Format format_in, Format format_out)
+ {
+ const uint8_t constant_border_value = 0;
+
+ // Initialize pyramid
+ PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, input_shape, format_out);
+
+ // Use conservative padding strategy to fit all subsequent kernels
+ pyramid.init_auto_padding(pyramid_info);
+
+ // Create tensor
+ src = create_tensor<TensorType>(input_shape, format_in);
+
+ // The first two dimensions of the output tensor must match the first
+ // two dimensions of the tensor in the last level of the pyramid
+ TensorShape dst_shape(input_shape);
+ dst_shape.set(0, pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(0));
+ dst_shape.set(1, pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(1));
+
+ // The lowest resolution tensor necessary to reconstruct the input
+ // tensor from the pyramid.
+ dst = create_tensor<TensorType>(dst_shape, format_out);
+
+ laplacian_pyramid_func.configure(&src, &pyramid, &dst, border_mode, constant_border_value);
+
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ pyramid.allocate();
+
+ // Fill tensor
+ library->fill_tensor_uniform(Accessor(src), 0);
+ }
+
+ void run()
+ {
+ laplacian_pyramid_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst);
+ }
+
+protected:
+ TensorType dst{};
+ PyramidType pyramid{};
+
+private:
+ TensorType src{};
+ Function laplacian_pyramid_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE */
diff --git a/tests/benchmark/fixtures/LaplacianReconstructFixture.h b/tests/benchmark/fixtures/LaplacianReconstructFixture.h
new file mode 100644
index 0000000..3990697
--- /dev/null
+++ b/tests/benchmark/fixtures/LaplacianReconstructFixture.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE
+#define ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/benchmark/fixtures/LaplacianPyramidFixture.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType, typename Function, typename Accessor, typename LaplacianPyramidFunc, typename PyramidType>
+class LaplacianReconstructFixture : public LaplacianPyramidFixture<TensorType, LaplacianPyramidFunc, Accessor, PyramidType>
+{
+public:
+ template <typename...>
+ void setup(TensorShape input_shape, BorderMode border_mode, size_t num_levels, Format format_in, Format format_out)
+ {
+ const uint8_t constant_border_value = 0;
+
+ LPF::setup(input_shape, border_mode, num_levels, format_out, format_in);
+ LPF::run();
+
+ // Create tensor
+ dst = create_tensor<TensorType>(input_shape, DataType::U8);
+
+ laplacian_reconstruct_func.configure(&(LPF::pyramid), &(LPF::dst), &dst, border_mode, constant_border_value);
+
+ dst.allocator()->allocate();
+ }
+
+ void run()
+ {
+ laplacian_reconstruct_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst);
+ }
+
+private:
+ TensorType dst{};
+ Function laplacian_reconstruct_func{};
+
+ using LPF = LaplacianPyramidFixture<TensorType, LaplacianPyramidFunc, Accessor, PyramidType>;
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE */
diff --git a/tests/benchmark/fixtures/LeNet5Fixture.h b/tests/benchmark/fixtures/LeNet5Fixture.h
deleted file mode 100644
index 03e426d..0000000
--- a/tests/benchmark/fixtures/LeNet5Fixture.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_LENET5FIXTURE
-#define ARM_COMPUTE_TEST_LENET5FIXTURE
-
-#include "tests/AssetsLibrary.h"
-#include "tests/Utils.h"
-#include "tests/framework/Fixture.h"
-#include "tests/networks/LeNet5Network.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-template <typename TensorType,
- typename Accessor,
- typename ActivationLayerFunction,
- typename ConvolutionLayerFunction,
- typename FullyConnectedLayerFunction,
- typename PoolingLayerFunction,
- typename SoftmaxLayerFunction>
-class LeNet5Fixture : public framework::Fixture
-{
-public:
- template <typename...>
- void setup(int batches)
- {
- network.init(batches);
- network.build();
- network.allocate();
- }
-
- void run()
- {
- network.run();
- }
-
- void sync()
- {
- network.sync();
- }
-
- void teardown()
- {
- network.clear();
- }
-
-private:
- networks::LeNet5Network<TensorType,
- Accessor,
- ActivationLayerFunction,
- ConvolutionLayerFunction,
- FullyConnectedLayerFunction,
- PoolingLayerFunction,
- SoftmaxLayerFunction>
- network{};
-};
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_LENET5FIXTURE */
diff --git a/tests/benchmark/fixtures/LocallyConnectedLayerFixture.h b/tests/benchmark/fixtures/LocallyConnectedLayerFixture.h
new file mode 100644
index 0000000..ba511e5
--- /dev/null
+++ b/tests/benchmark/fixtures/LocallyConnectedLayerFixture.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_LOCALLYCONNECTEDLAYERFIXTURE
+#define ARM_COMPUTE_TEST_LOCALLYCONNECTEDLAYERFIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+/** Fixture that can be used for NEON and CL */
+template <typename TensorType, typename Function, typename Accessor>
+class LocallyConnectedLayerFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape src_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape dst_shape, PadStrideInfo info, Size2D dilation, DataType data_type, int batches)
+ {
+ ARM_COMPUTE_UNUSED(dilation);
+
+ // Set batched in source and destination shapes
+ src_shape.set(src_shape.num_dimensions() /* batch */, batches);
+ dst_shape.set(dst_shape.num_dimensions() /* batch */, batches);
+
+ // Create tensors
+ src = create_tensor<TensorType>(src_shape, data_type);
+ weights = create_tensor<TensorType>(weights_shape, data_type);
+ biases = create_tensor<TensorType>(biases_shape, data_type);
+ dst = create_tensor<TensorType>(dst_shape, data_type);
+
+ // Create and configure function
+ lc_layer.configure(&src, &weights, &biases, &dst, info);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ weights.allocator()->allocate();
+ biases.allocator()->allocate();
+ dst.allocator()->allocate();
+ }
+
+ void run()
+ {
+ lc_layer.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst);
+ }
+
+private:
+ TensorType src{};
+ TensorType weights{};
+ TensorType biases{};
+ TensorType dst{};
+ Function lc_layer{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_LOCALLYCONNECTEDLAYERFIXTURE */
diff --git a/tests/benchmark/fixtures/MagnitudeFixture.h b/tests/benchmark/fixtures/MagnitudeFixture.h
index f75540c..a1b8054 100644
--- a/tests/benchmark/fixtures/MagnitudeFixture.h
+++ b/tests/benchmark/fixtures/MagnitudeFixture.h
@@ -41,7 +41,7 @@
{
public:
template <typename...>
- void setup(const TensorShape &shape, Format format, MagnitudeType magnitude_type, bool use_fp16)
+ void setup(const TensorShape &shape, Format format, MagnitudeType magnitude_type)
{
// Create tensors
src1 = create_tensor<TensorType>(shape, format);
@@ -49,7 +49,7 @@
dst = create_tensor<TensorType>(shape, format);
// Create and configure function
- magnitude_func.configure(&src1, &src2, &dst, magnitude_type, use_fp16);
+ magnitude_func.configure(&src1, &src2, &dst, magnitude_type);
// Allocate tensors
src1.allocator()->allocate();
diff --git a/tests/benchmark/fixtures/MobileNetFixture.h b/tests/benchmark/fixtures/MobileNetFixture.h
deleted file mode 100644
index 3236e82..0000000
--- a/tests/benchmark/fixtures/MobileNetFixture.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_MOBILENETFIXTURE
-#define ARM_COMPUTE_TEST_MOBILENETFIXTURE
-
-#include "tests/AssetsLibrary.h"
-#include "tests/Utils.h"
-#include "tests/framework/Fixture.h"
-#include "tests/networks/MobileNetNetwork.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-template <typename TensorType,
- typename Accessor,
- typename ActivationLayerFunction,
- typename ConvolutionLayerFunction,
- typename DirectConvolutionLayerFunction,
- typename DepthwiseConvolutionLayerFunction,
- typename ReshapeFunction,
- typename PoolingLayerFunction>
-class MobileNetFixture : public framework::Fixture
-{
-public:
- template <typename...>
- void setup(int batches)
- {
- network.init(batches);
- network.build();
- network.allocate();
- }
-
- void run()
- {
- network.run();
- }
-
- void sync()
- {
- network.sync();
- }
-
- void teardown()
- {
- network.clear();
- }
-
-private:
- networks::MobileNetNetwork<TensorType,
- Accessor,
- ActivationLayerFunction,
- ConvolutionLayerFunction,
- DirectConvolutionLayerFunction,
- DepthwiseConvolutionLayerFunction,
- ReshapeFunction,
- PoolingLayerFunction>
- network{};
-};
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_MOBILENETFIXTURE */
diff --git a/tests/benchmark/fixtures/MobileNetV1Fixture.h b/tests/benchmark/fixtures/MobileNetV1Fixture.h
deleted file mode 100644
index 590aecf..0000000
--- a/tests/benchmark/fixtures/MobileNetV1Fixture.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_MOBILENETV1_FIXTURE
-#define ARM_COMPUTE_TEST_MOBILENETV1_FIXTURE
-
-#include "tests/AssetsLibrary.h"
-#include "tests/Utils.h"
-#include "tests/framework/Fixture.h"
-#include "tests/networks/MobileNetV1Network.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace benchmark
-{
-template <typename TensorType,
- typename Accessor,
- typename ActivationLayerFunction,
- typename BatchNormalizationLayerFunction,
- typename ConvolutionLayerFunction,
- typename DirectConvolutionLayerFunction,
- typename DepthwiseConvolutionFunction,
- typename ReshapeFunction,
- typename PoolingLayerFunction,
- typename SoftmaxLayerFunction,
- unsigned int InputSize>
-class MobileNetV1Fixture : public framework::Fixture
-{
-public:
- template <typename...>
- void setup(int batches)
- {
- network.init(InputSize, batches);
- network.build();
- network.allocate();
- }
-
- void run()
- {
- network.run();
- }
-
- void sync()
- {
- network.sync();
- }
-
- void teardown()
- {
- network.clear();
- }
-
-private:
- networks::MobileNetV1Network<TensorType,
- Accessor,
- ActivationLayerFunction,
- BatchNormalizationLayerFunction,
- ConvolutionLayerFunction,
- DirectConvolutionLayerFunction,
- DepthwiseConvolutionFunction,
- ReshapeFunction,
- PoolingLayerFunction,
- SoftmaxLayerFunction>
- network{};
-};
-} // namespace benchmark
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_MOBILENETV1_FIXTURE */
diff --git a/tests/benchmark/fixtures/NormalizationLayerFixture.h b/tests/benchmark/fixtures/NormalizationLayerFixture.h
index 7742dca..4331506 100644
--- a/tests/benchmark/fixtures/NormalizationLayerFixture.h
+++ b/tests/benchmark/fixtures/NormalizationLayerFixture.h
@@ -45,12 +45,12 @@
void setup(TensorShape shape, NormalizationLayerInfo info, DataType data_type, int batches)
{
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
+
shape.set(shape.num_dimensions(), batches);
// Create tensors
- src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(shape, data_type, 1);
+ dst = create_tensor<TensorType>(shape, data_type, 1);
// Create and configure function
norm_layer.configure(&src, &dst, info);
diff --git a/tests/benchmark/fixtures/OpticalFlowFixture.h b/tests/benchmark/fixtures/OpticalFlowFixture.h
new file mode 100644
index 0000000..f781875
--- /dev/null
+++ b/tests/benchmark/fixtures/OpticalFlowFixture.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_OPTICAL_FLOW_FIXTURE
+#define ARM_COMPUTE_TEST_OPTICAL_FLOW_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Types.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType,
+ typename Function,
+ typename Accessor,
+ typename ArrayType,
+ typename ArrayAccessor,
+ typename PyramidType,
+ typename PyramidFunctionType>
+class OpticalFlowFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(std::string old_image_name, std::string new_image_name, OpticalFlowParameters params,
+ size_t num_levels, size_t num_keypoints, Format format, BorderMode border_mode)
+ {
+ const uint8_t constant_border_value = 0;
+ const std::random_device::result_type seed = 0;
+
+ // Create keypoints
+ old_keypoints = generate_random_keypoints(library->get_image_shape(old_image_name), num_keypoints, seed, num_levels);
+ new_keypoints_estimates = old_keypoints;
+
+ // Create tensors
+ old_image = create_tensor<TensorType>(library->get_image_shape(old_image_name), format);
+ new_image = create_tensor<TensorType>(library->get_image_shape(new_image_name), format);
+
+ // Load keypoints
+ fill_array(ArrayAccessor(old_points), old_keypoints);
+ fill_array(ArrayAccessor(new_points_estimates), new_keypoints_estimates);
+
+ // Create pyramid images
+ PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, old_image.info()->tensor_shape(), format);
+ old_pyramid = create_pyramid<PyramidType>(pyramid_info);
+ new_pyramid = create_pyramid<PyramidType>(pyramid_info);
+
+ // Create and configure pyramid functions
+ old_gaussian_pyramid_func.configure(&old_image, &old_pyramid, border_mode, constant_border_value);
+ new_gaussian_pyramid_func.configure(&new_image, &new_pyramid, border_mode, constant_border_value);
+
+ optical_flow_func.configure(&old_pyramid,
+ &new_pyramid,
+ &old_points,
+ &new_points_estimates,
+ &new_points,
+ params.termination,
+ params.epsilon,
+ params.num_iterations,
+ params.window_dimension,
+ params.use_initial_estimate,
+ border_mode,
+ constant_border_value);
+
+ // Allocate input tensors
+ old_image.allocator()->allocate();
+ new_image.allocator()->allocate();
+
+ // Allocate pyramids
+ old_pyramid.allocate();
+ new_pyramid.allocate();
+
+ // Copy image data to tensors
+ library->fill(Accessor(old_image), old_image_name, format);
+ library->fill(Accessor(new_image), new_image_name, format);
+
+ // Compute gaussian pyramids
+ old_gaussian_pyramid_func.run();
+ new_gaussian_pyramid_func.run();
+ }
+
+ void run()
+ {
+ optical_flow_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ }
+
+ void teardown()
+ {
+ old_image.allocator()->free();
+ new_image.allocator()->free();
+ }
+
+private:
+ static const size_t max_keypoints = 10000;
+
+ std::vector<KeyPoint> old_keypoints{};
+ std::vector<KeyPoint> new_keypoints_estimates{};
+
+ TensorType old_image{};
+ TensorType new_image{};
+
+ ArrayType old_points{ max_keypoints };
+ ArrayType new_points{ max_keypoints };
+ ArrayType new_points_estimates{ max_keypoints };
+
+ PyramidType old_pyramid{};
+ PyramidType new_pyramid{};
+
+ PyramidFunctionType old_gaussian_pyramid_func{};
+ PyramidFunctionType new_gaussian_pyramid_func{};
+
+ Function optical_flow_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_OPTICAL_FLOW_FIXTURE */
diff --git a/tests/benchmark/fixtures/PoolingLayerFixture.h b/tests/benchmark/fixtures/PoolingLayerFixture.h
index 5a1a296..cbcfe2e 100644
--- a/tests/benchmark/fixtures/PoolingLayerFixture.h
+++ b/tests/benchmark/fixtures/PoolingLayerFixture.h
@@ -48,7 +48,6 @@
void setup(TensorShape src_shape, PoolingLayerInfo info, DataType data_type, DataLayout data_layout, int batches)
{
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
// Permute shape if NHWC format
if(data_layout == DataLayout::NHWC)
@@ -56,7 +55,7 @@
permute(src_shape, PermutationVector(2U, 0U, 1U));
}
- TensorInfo src_info(src_shape, 1, data_type, fixed_point_position);
+ TensorInfo src_info(src_shape, 1, data_type);
src_info.set_data_layout(data_layout);
TensorShape dst_shape = compute_pool_shape(src_info, info);
@@ -65,8 +64,8 @@
dst_shape.set(dst_shape.num_dimensions(), batches);
// Create tensors
- src = create_tensor<TensorType>(src_shape, data_type, 1, fixed_point_position, QuantizationInfo(), data_layout);
- dst = create_tensor<TensorType>(dst_shape, data_type, 1, fixed_point_position, QuantizationInfo(), data_layout);
+ src = create_tensor<TensorType>(src_shape, data_type, 1, QuantizationInfo(), data_layout);
+ dst = create_tensor<TensorType>(dst_shape, data_type, 1, QuantizationInfo(), data_layout);
// Create and configure function
pool_layer.configure(&src, &dst, info);
diff --git a/tests/benchmark/fixtures/ROIPoolingLayerFixture.h b/tests/benchmark/fixtures/ROIPoolingLayerFixture.h
index 4adfa44..fa4a5b7 100644
--- a/tests/benchmark/fixtures/ROIPoolingLayerFixture.h
+++ b/tests/benchmark/fixtures/ROIPoolingLayerFixture.h
@@ -47,8 +47,8 @@
void setup(TensorShape shape, const ROIPoolingLayerInfo pool_info, unsigned int num_rois, DataType data_type, int batches)
{
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
- TensorShape shape_dst;
+
+ TensorShape shape_dst;
shape.set(shape.num_dimensions(), batches);
shape_dst.set(0, pool_info.pooled_width());
shape_dst.set(1, pool_info.pooled_height());
@@ -56,8 +56,8 @@
shape_dst.set(3, num_rois);
// Create tensors
- src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(shape_dst, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(shape, data_type, 1);
+ dst = create_tensor<TensorType>(shape_dst, data_type, 1);
// Create random ROIs
std::vector<ROI> rois = generate_random_rois(shape, pool_info, num_rois, 0U);
diff --git a/tests/benchmark/fixtures/RemapFixture.h b/tests/benchmark/fixtures/RemapFixture.h
new file mode 100644
index 0000000..c0b0c13
--- /dev/null
+++ b/tests/benchmark/fixtures/RemapFixture.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_REMAP_FIXTURE
+#define ARM_COMPUTE_TEST_REMAP_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType, typename Function, typename Accessor>
+class RemapFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(const TensorShape &input_shape, InterpolationPolicy policy, DataType data_type, BorderMode border_mode)
+ {
+ std::mt19937 gen(library->seed());
+ std::uniform_int_distribution<uint8_t> distribution(0, 255);
+ const uint8_t constant_border_value = distribution(gen);
+
+ // Create tensors
+ src = create_tensor<TensorType>(input_shape, data_type);
+ map_x = create_tensor<TensorType>(input_shape, DataType::F32);
+ map_y = create_tensor<TensorType>(input_shape, DataType::F32);
+ dst = create_tensor<TensorType>(input_shape, data_type);
+
+ // Create and configure function
+ remap_func.configure(&src, &map_x, &map_y, &dst, policy, border_mode, constant_border_value);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ map_x.allocator()->allocate();
+ map_y.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ // Fill tensors
+ fill(Accessor(src), 0, 0, 255);
+ fill(Accessor(map_x), 1, -5, input_shape.x() + 5);
+ fill(Accessor(map_y), 2, -5, input_shape.y() + 5);
+ }
+
+ void run()
+ {
+ remap_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst);
+ }
+
+ void teardown()
+ {
+ src.allocator()->free();
+ map_x.allocator()->free();
+ map_y.allocator()->free();
+ dst.allocator()->free();
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, int i, float min, float max)
+ {
+ std::uniform_int_distribution<> distribution((int)min, (int)max);
+ library->fill(tensor, distribution, i);
+ }
+
+private:
+ TensorType src{};
+ TensorType map_x{};
+ TensorType map_y{};
+ TensorType dst{};
+ Function remap_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_REMAP_FIXTURE */
diff --git a/tests/benchmark/fixtures/SobelFixture.h b/tests/benchmark/fixtures/SobelFixture.h
new file mode 100644
index 0000000..2717e81
--- /dev/null
+++ b/tests/benchmark/fixtures/SobelFixture.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_SOBEL_FIXTURE
+#define ARM_COMPUTE_TEST_SOBEL_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Types.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+
+namespace arm_compute
+{
+class CLSobel3x3;
+class CLSobel5x5;
+class CLSobel7x7;
+class NESobel3x3;
+class NESobel5x5;
+class NESobel7x7;
+
+namespace test
+{
+namespace benchmark
+{
+namespace
+{
+template <typename Function>
+struct info;
+
+template <>
+struct info<NESobel3x3>
+{
+ static const Format dst_format = Format::S16;
+};
+
+template <>
+struct info<CLSobel3x3>
+{
+ static const Format dst_format = Format::S16;
+};
+
+template <>
+struct info<NESobel5x5>
+{
+ static const Format dst_format = Format::S16;
+};
+
+template <>
+struct info<CLSobel5x5>
+{
+ static const Format dst_format = Format::S16;
+};
+
+template <>
+struct info<NESobel7x7>
+{
+ static const Format dst_format = Format::S32;
+};
+
+template <>
+struct info<CLSobel7x7>
+{
+ static const Format dst_format = Format::S32;
+};
+} // namespace
+
+template <typename TensorType, typename Function, typename Accessor>
+class SobelFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(const TensorShape &input_shape, BorderMode border_mode, GradientDimension gradient_dimension, Format input_format)
+ {
+ // Generate a random constant value
+ std::mt19937 gen(library->seed());
+ std::uniform_int_distribution<uint8_t> int_dist(0, 255);
+ const uint8_t constant_border_value = int_dist(gen);
+
+ // Create source tensor
+ src = create_tensor<TensorType>(input_shape, input_format);
+
+ // Create destination tensors and configure function
+ switch(gradient_dimension)
+ {
+ case GradientDimension::GRAD_X:
+ dst_x = create_tensor<TensorType>(input_shape, info<Function>::dst_format);
+ sobel_func.configure(&src, &dst_x, nullptr, border_mode, constant_border_value);
+ break;
+ case GradientDimension::GRAD_Y:
+ dst_y = create_tensor<TensorType>(input_shape, info<Function>::dst_format);
+ sobel_func.configure(&src, nullptr, &dst_y, border_mode, constant_border_value);
+ break;
+ case GradientDimension::GRAD_XY:
+ dst_x = create_tensor<TensorType>(input_shape, info<Function>::dst_format);
+ dst_y = create_tensor<TensorType>(input_shape, info<Function>::dst_format);
+ sobel_func.configure(&src, &dst_x, &dst_y, border_mode, constant_border_value);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Gradient dimension not supported");
+ }
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ dst_x.allocator()->allocate();
+ dst_y.allocator()->allocate();
+ }
+
+ void run()
+ {
+ sobel_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst_x);
+ sync_tensor_if_necessary<TensorType>(dst_y);
+ }
+
+ void teardown()
+ {
+ src.allocator()->free();
+ dst_x.allocator()->free();
+ dst_y.allocator()->free();
+ }
+
+private:
+ TensorType src{};
+ TensorType dst_x{};
+ TensorType dst_y{};
+ Function sobel_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_SOBEL_FIXTURE */
diff --git a/tests/benchmark/fixtures/SoftmaxLayerFixture.h b/tests/benchmark/fixtures/SoftmaxLayerFixture.h
index 4f6dde8..4d092f7 100644
--- a/tests/benchmark/fixtures/SoftmaxLayerFixture.h
+++ b/tests/benchmark/fixtures/SoftmaxLayerFixture.h
@@ -45,11 +45,9 @@
template <typename...>
void setup(TensorShape shape, DataType data_type)
{
- const unsigned int fixed_point_position = 4;
-
// Create tensors
- src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, QuantizationInfo(1.f / 256, 10));
- dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, QuantizationInfo(1.f / 256, 0));
+ src = create_tensor<TensorType>(shape, data_type, 1, QuantizationInfo(1.f / 256, 10));
+ dst = create_tensor<TensorType>(shape, data_type, 1, QuantizationInfo(1.f / 256, 0));
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
diff --git a/tests/benchmark/fixtures/WarpAffineFixture.h b/tests/benchmark/fixtures/WarpAffineFixture.h
new file mode 100644
index 0000000..e1d6855
--- /dev/null
+++ b/tests/benchmark/fixtures/WarpAffineFixture.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE
+#define ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/reference/Utils.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace benchmark
+{
+template <typename TensorType, typename Function, typename Accessor>
+class WarpAffineFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(const TensorShape &shape, DataType data_type, InterpolationPolicy policy, BorderMode border_mode)
+ {
+ // Generate a random constant value if border_mode is constant
+ std::mt19937 gen(library->seed());
+ std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
+ uint8_t constant_border_value = distribution_u8(gen);
+
+ // Create tensors
+ src = create_tensor<TensorType>(shape, data_type);
+ dst = create_tensor<TensorType>(shape, data_type);
+
+ // Create and configure function
+ warp_affine_func.configure(&src, &dst, matrix, policy, border_mode, constant_border_value);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+ }
+
+ void run()
+ {
+ warp_affine_func.run();
+ }
+
+ void sync()
+ {
+ sync_if_necessary<TensorType>();
+ sync_tensor_if_necessary<TensorType>(dst);
+ }
+
+ void teardown()
+ {
+ src.allocator()->free();
+ dst.allocator()->free();
+ }
+
+private:
+ const std::array<float, 9> matrix{ { -0.9f, -0.6f, -0.3f, 0.3f, 0.6f, 0.9f, /* ignored*/ 1.f, 1.f, 1.f } };
+ TensorType src{};
+ TensorType dst{};
+ Function warp_affine_func{};
+};
+} // namespace benchmark
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE */
diff --git a/tests/benchmark/fixtures/WinogradConvolutionLayerFixture.h b/tests/benchmark/fixtures/WinogradConvolutionLayerFixture.h
index 8ed75af..5f44517 100644
--- a/tests/benchmark/fixtures/WinogradConvolutionLayerFixture.h
+++ b/tests/benchmark/fixtures/WinogradConvolutionLayerFixture.h
@@ -48,16 +48,16 @@
ARM_COMPUTE_UNUSED(dilation);
// Set batched in source and destination shapes
- const unsigned int fixed_point_position = 4;
+
src_shape.set(3 /* batch */, batches);
dst_shape.set(3 /* batch */, batches);
DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
// Create tensors
- src = create_tensor<TensorType>(src_shape, data_type, 1, fixed_point_position);
- weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position);
- biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1, fixed_point_position);
- dst = create_tensor<TensorType>(dst_shape, data_type, 1, fixed_point_position);
+ src = create_tensor<TensorType>(src_shape, data_type, 1);
+ weights = create_tensor<TensorType>(weights_shape, data_type, 1);
+ biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1);
+ dst = create_tensor<TensorType>(dst_shape, data_type, 1);
// Create and configure function
conv_layer.configure(&src, &weights, &biases, &dst, info, act_info);
diff --git a/tests/datasets/Col2ImLayerDataset.h b/tests/datasets/Col2ImLayerDataset.h
new file mode 100644
index 0000000..96a3cab
--- /dev/null
+++ b/tests/datasets/Col2ImLayerDataset.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_COL2IM_DATASET
+#define ARM_COMPUTE_TEST_COL2IM_DATASET
+
+#include "utils/TypePrinter.h"
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace datasets
+{
+class Col2ImLayerDataset
+{
+public:
+ using type = std::tuple<TensorShape, unsigned int, unsigned int, unsigned int>;
+
+ struct iterator
+ {
+ iterator(std::vector<TensorShape>::const_iterator src_it,
+ std::vector<unsigned int>::const_iterator convolved_width_it,
+ std::vector<unsigned int>::const_iterator convolved_height_it,
+ std::vector<unsigned int>::const_iterator num_groups_it)
+ : _src_it{ std::move(src_it) },
+ _convolved_width_it{ std::move(convolved_width_it) },
+ _convolved_height_it{ std::move(convolved_height_it) },
+ _num_groups_it{ std::move(num_groups_it) }
+ {
+ }
+
+ std::string description() const
+ {
+ std::stringstream description;
+ description << "In=" << *_src_it << ":";
+ description << "ConvolvedWidth=" << *_convolved_width_it << ":";
+ description << "ConvolvedHeight=" << *_convolved_height_it << ":";
+ description << "NumGroups=" << *_num_groups_it;
+ return description.str();
+ }
+
+ Col2ImLayerDataset::type operator*() const
+ {
+ return std::make_tuple(*_src_it, *_convolved_width_it, *_convolved_height_it, *_num_groups_it);
+ }
+
+ iterator &operator++()
+ {
+ ++_src_it;
+ ++_convolved_width_it;
+ ++_convolved_height_it;
+ ++_num_groups_it;
+
+ return *this;
+ }
+
+ private:
+ std::vector<TensorShape>::const_iterator _src_it;
+ std::vector<unsigned int>::const_iterator _convolved_width_it;
+ std::vector<unsigned int>::const_iterator _convolved_height_it;
+ std::vector<unsigned int>::const_iterator _num_groups_it;
+ };
+
+ iterator begin() const
+ {
+ return iterator(_src_shapes.begin(), _convolved_widths.begin(), _convolved_heights.begin(), _num_groups.begin());
+ }
+
+ int size() const
+ {
+ return std::min(_src_shapes.size(), std::min(_convolved_widths.size(), std::min(_convolved_heights.size(), _num_groups.size())));
+ }
+
+ void add_config(TensorShape src, unsigned int convolved_width, unsigned int convolved_height, unsigned int info)
+ {
+ _src_shapes.emplace_back(std::move(src));
+ _convolved_widths.emplace_back(std::move(convolved_width));
+ _convolved_heights.emplace_back(std::move(convolved_height));
+ _num_groups.emplace_back(std::move(info));
+ }
+
+protected:
+ Col2ImLayerDataset() = default;
+ Col2ImLayerDataset(Col2ImLayerDataset &&) = default;
+
+private:
+ std::vector<TensorShape> _src_shapes{};
+ std::vector<unsigned int> _convolved_widths{};
+ std::vector<unsigned int> _convolved_heights{};
+ std::vector<unsigned int> _num_groups{};
+};
+
+/** Dataset containing small grouped col2im shapes. */
+class SmallGroupedCol2ImLayerDataset final : public Col2ImLayerDataset
+{
+public:
+ SmallGroupedCol2ImLayerDataset()
+ {
+ add_config(TensorShape(10U, 12U, 1U, 1U), 3U, 4U, 1U);
+ add_config(TensorShape(12U, 30U, 1U, 2U), 5U, 6U, 1U);
+ add_config(TensorShape(12U, 30U, 4U, 1U), 5U, 6U, 1U);
+ add_config(TensorShape(10U, 12U, 2U, 4U), 3U, 4U, 2U);
+ add_config(TensorShape(10U, 12U, 2U, 4U), 3U, 4U, 2U);
+ add_config(TensorShape(8U, 16U, 3U, 1U), 4U, 4U, 3U);
+ add_config(TensorShape(8U, 16U, 3U, 3U), 4U, 4U, 3U);
+ add_config(TensorShape(12U, 20U, 4U, 1U), 5U, 4U, 4U);
+ add_config(TensorShape(12U, 20U, 4U, 3U), 5U, 4U, 4U);
+ }
+};
+
+/** Dataset containing large grouped col2im shapes. */
+class LargeGroupedCol2ImLayerDataset final : public Col2ImLayerDataset
+{
+public:
+ LargeGroupedCol2ImLayerDataset()
+ {
+ add_config(TensorShape(233U, 280U, 1U, 55U), 14U, 20U, 1U);
+ add_config(TensorShape(333U, 280U, 1U, 77U), 14U, 20U, 1U);
+ add_config(TensorShape(333U, 280U, 77U, 1U), 14U, 20U, 1U);
+ add_config(TensorShape(120U, 300U, 8U, 3U), 20U, 15U, 8U);
+ add_config(TensorShape(233U, 300U, 8U, 3U), 20U, 15U, 8U);
+ add_config(TensorShape(333U, 280U, 12U, 5U), 20U, 14U, 12U);
+ add_config(TensorShape(177U, 300U, 12U, 5U), 15U, 20U, 12U);
+ add_config(TensorShape(450U, 400U, 16U, 5U), 20U, 20U, 16U);
+ add_config(TensorShape(220U, 400U, 16U, 5U), 20U, 20U, 16U);
+ }
+};
+} // namespace datasets
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_COL2IM_DATASET */
diff --git a/tests/datasets/DepthwiseConvolutionLayerDataset.h b/tests/datasets/DepthwiseConvolutionLayerDataset.h
index 4b6d85b..889473e 100644
--- a/tests/datasets/DepthwiseConvolutionLayerDataset.h
+++ b/tests/datasets/DepthwiseConvolutionLayerDataset.h
@@ -153,8 +153,18 @@
{
add_config(TensorShape(3U, 3U, 2U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0));
add_config(TensorShape(7U, 7U, 3U, 2U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 1));
add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 0));
add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 2, 0, 1));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 1));
+ add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 0));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 1, 0, 1));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 1));
+ add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(2, 2, 1, 0));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 1));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 2, 1, 1));
// Asymmetric padding
add_config(TensorShape(33U, 27U, 11U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR));
}
diff --git a/tests/datasets/LSTMLayerDataset.h b/tests/datasets/LSTMLayerDataset.h
index 51802fd..c21f320 100644
--- a/tests/datasets/LSTMLayerDataset.h
+++ b/tests/datasets/LSTMLayerDataset.h
@@ -160,8 +160,12 @@
public:
SmallLSTMLayerDataset()
{
- add_config(TensorShape(8U, 2U), TensorShape(8U, 16U), TensorShape(16U, 16U), TensorShape(16U), TensorShape(16U, 2U), TensorShape(16U, 2U), TensorShape(64U, 2U), ActivationLayerInfo(), 0.05f, 0.93f);
- add_config(TensorShape(8U, 2U), TensorShape(8U, 16U), TensorShape(16U, 16U), TensorShape(16U), TensorShape(16U, 2U), TensorShape(16U, 2U), TensorShape(48U, 2U), ActivationLayerInfo(), 0.05f, 0.93f);
+ add_config(TensorShape(8U), TensorShape(8U, 16U), TensorShape(16U, 16U), TensorShape(16U), TensorShape(16U), TensorShape(16U), TensorShape(64U),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), 0.05f, 0.93f);
+ add_config(TensorShape(8U, 2U), TensorShape(8U, 16U), TensorShape(16U, 16U), TensorShape(16U), TensorShape(16U, 2U), TensorShape(16U, 2U), TensorShape(64U, 2U),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), 0.05f, 0.93f);
+ add_config(TensorShape(8U, 2U), TensorShape(8U, 16U), TensorShape(16U, 16U), TensorShape(16U), TensorShape(16U, 2U), TensorShape(16U, 2U), TensorShape(48U, 2U),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), 0.05f, 0.93f);
}
};
diff --git a/tests/datasets/LargeConvolutionLayerDataset.h b/tests/datasets/LargeConvolutionLayerDataset.h
index 36b3d60..170d562 100644
--- a/tests/datasets/LargeConvolutionLayerDataset.h
+++ b/tests/datasets/LargeConvolutionLayerDataset.h
@@ -59,6 +59,50 @@
}
};
+class LargeWinogradConvolutionLayer3x1Dataset final : public ConvolutionLayerDataset
+{
+public:
+ LargeWinogradConvolutionLayer3x1Dataset()
+ {
+ // Kernel size 3
+ // Batch size 1
+ add_config(TensorShape(224U, 222U, 64U), TensorShape(3U, 1U, 64U, 64U), TensorShape(64U), TensorShape(224U, 222U, 64U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(112U, 113U, 64U), TensorShape(3U, 1U, 64U, 128U), TensorShape(128U), TensorShape(112U, 113U, 128U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(112U, 112U, 128U), TensorShape(3U, 1U, 128U, 129U), TensorShape(129U), TensorShape(112U, 112U, 129U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(53U, 56U, 125U), TensorShape(3U, 1U, 125U, 256U), TensorShape(256U), TensorShape(51U, 56U, 256U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(56U, 56U, 256U), TensorShape(3U, 1U, 256U, 256U), TensorShape(256U), TensorShape(56U, 56U, 256U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(28U, 28U, 257U), TensorShape(3U, 1U, 257U, 512U), TensorShape(512U), TensorShape(26U, 28U, 512U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(28U, 28U, 512U), TensorShape(3U, 1U, 512U, 512U), TensorShape(512U), TensorShape(28U, 28U, 512U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(14U, 14U, 512U), TensorShape(3U, 1U, 512U, 512U), TensorShape(512U), TensorShape(12U, 14U, 512U), PadStrideInfo(1, 1, 0, 0));
+ // Batch size 3, 2 and 4
+ add_config(TensorShape(224U, 222U, 64U, 3U), TensorShape(3U, 1U, 64U, 64U), TensorShape(64U), TensorShape(224U, 222U, 64U, 3U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(112U, 113U, 64U, 2U), TensorShape(3U, 1U, 64U, 128U), TensorShape(128U), TensorShape(110U, 113U, 128U, 2U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(111U, 112U, 127U, 4U), TensorShape(3U, 1U, 127U, 128U), TensorShape(128U), TensorShape(111U, 112U, 128U, 4U), PadStrideInfo(1, 1, 1, 0));
+ }
+};
+
+class LargeWinogradConvolutionLayer1x3Dataset final : public ConvolutionLayerDataset
+{
+public:
+ LargeWinogradConvolutionLayer1x3Dataset()
+ {
+ // Kernel size 3
+ // Batch size 1
+ add_config(TensorShape(224U, 222U, 64U), TensorShape(1U, 3U, 64U, 64U), TensorShape(64U), TensorShape(224U, 222U, 64U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(112U, 113U, 64U), TensorShape(1U, 3U, 64U, 128U), TensorShape(128U), TensorShape(112U, 113U, 128U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(112U, 112U, 128U), TensorShape(1U, 3U, 128U, 129U), TensorShape(129U), TensorShape(112U, 110U, 129U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(53U, 56U, 125U), TensorShape(1U, 3U, 125U, 256U), TensorShape(256U), TensorShape(53U, 56U, 256U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(56U, 56U, 256U), TensorShape(1U, 3U, 256U, 256U), TensorShape(256U), TensorShape(56U, 54U, 256U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(28U, 28U, 257U), TensorShape(1U, 3U, 257U, 512U), TensorShape(512U), TensorShape(28U, 28U, 512U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(28U, 28U, 512U), TensorShape(1U, 3U, 512U, 512U), TensorShape(512U), TensorShape(28U, 28U, 512U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(14U, 14U, 512U), TensorShape(1U, 3U, 512U, 512U), TensorShape(512U), TensorShape(14U, 12U, 512U), PadStrideInfo(1, 1, 0, 0));
+ // Batch size 3, 2 and 4
+ add_config(TensorShape(224U, 222U, 64U, 3U), TensorShape(1U, 3U, 64U, 64U), TensorShape(64U), TensorShape(224U, 222U, 64U, 3U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(112U, 113U, 64U, 2U), TensorShape(1U, 3U, 64U, 128U), TensorShape(128U), TensorShape(112U, 113U, 128U, 2U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(111U, 112U, 127U, 4U), TensorShape(1U, 3U, 127U, 128U), TensorShape(128U), TensorShape(111U, 112U, 128U, 4U), PadStrideInfo(1, 1, 0, 1));
+ }
+};
+
class LargeWinogradConvolutionLayer5x5Dataset final : public ConvolutionLayerDataset
{
public:
@@ -78,6 +122,42 @@
}
};
+class LargeWinogradConvolutionLayer5x1Dataset final : public ConvolutionLayerDataset
+{
+public:
+ LargeWinogradConvolutionLayer5x1Dataset()
+ {
+ // Batch size 1
+ add_config(TensorShape(224U, 224U, 3U), TensorShape(5U, 1U, 3U, 64U), TensorShape(64U), TensorShape(222U, 224U, 64U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(123U, 134U, 16U), TensorShape(5U, 1U, 16U, 7U), TensorShape(7U), TensorShape(121U, 134U, 7U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(181U, 152U, 42U), TensorShape(5U, 1U, 42U, 100U), TensorShape(100U), TensorShape(177U, 152U, 100U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(200U, 201U, 24U), TensorShape(5U, 1U, 24U, 61), TensorShape(61U), TensorShape(200U, 201U, 61), PadStrideInfo(1, 1, 2, 0));
+
+ // Batch size 2, 3 and 4
+ add_config(TensorShape(224U, 224U, 3U, 2U), TensorShape(5U, 1U, 3U, 64U), TensorShape(64U), TensorShape(222U, 224U, 64U, 2U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(123U, 134U, 16U, 3U), TensorShape(5U, 1U, 16U, 7U), TensorShape(7U), TensorShape(121U, 134U, 7U, 3U), PadStrideInfo(1, 1, 1, 0));
+ add_config(TensorShape(181U, 152U, 42U, 4U), TensorShape(5U, 1U, 42U, 100U), TensorShape(100U), TensorShape(177U, 152U, 100U, 4U), PadStrideInfo(1, 1, 0, 0));
+ }
+};
+
+class LargeWinogradConvolutionLayer1x5Dataset final : public ConvolutionLayerDataset
+{
+public:
+ LargeWinogradConvolutionLayer1x5Dataset()
+ {
+ // Batch size 1
+ add_config(TensorShape(224U, 224U, 3U), TensorShape(1U, 5U, 3U, 64U), TensorShape(64U), TensorShape(224U, 222U, 64U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(123U, 134U, 16U), TensorShape(1U, 5U, 16U, 7U), TensorShape(7U), TensorShape(123U, 130U, 7U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(181U, 152U, 42U), TensorShape(1U, 5U, 42U, 100U), TensorShape(100U), TensorShape(181U, 148U, 100U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(200U, 201U, 24U), TensorShape(1U, 5U, 24U, 61), TensorShape(61U), TensorShape(200U, 201U, 61), PadStrideInfo(1, 1, 0, 2));
+
+ // Batch size 2, 3 and 4
+ add_config(TensorShape(224U, 224U, 3U, 2U), TensorShape(1U, 5U, 3U, 64U), TensorShape(64U), TensorShape(224U, 222U, 64U, 2U), PadStrideInfo(1, 1, 0, 1));
+ add_config(TensorShape(123U, 134U, 16U, 3U), TensorShape(1U, 5U, 16U, 7U), TensorShape(7U), TensorShape(123U, 130U, 7U, 3U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(181U, 152U, 42U, 4U), TensorShape(1U, 5U, 42U, 100U), TensorShape(100U), TensorShape(181U, 148U, 100U, 4U), PadStrideInfo(1, 1, 0, 0));
+ }
+};
+
class LargeConvolutionLayerDataset final : public ConvolutionLayerDataset
{
public:
@@ -86,31 +166,51 @@
// Batch size 1
add_config(TensorShape(227U, 227U, 3U), TensorShape(11U, 11U, 3U, 96U), TensorShape(96U), TensorShape(55U, 55U, 96U), PadStrideInfo(4, 4, 0, 0));
add_config(TensorShape(27U, 27U, 96U), TensorShape(5U, 5U, 96U, 256U), TensorShape(256U), TensorShape(27U, 27U, 256U), PadStrideInfo(1, 1, 2, 2));
- add_config(TensorShape(13U, 13U, 256U), TensorShape(3U, 3U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 1, 1));
- add_config(TensorShape(13U, 13U, 384U), TensorShape(3U, 3U, 384U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 1, 1));
- add_config(TensorShape(13U, 13U, 384U), TensorShape(3U, 3U, 384U, 256U), TensorShape(256U), TensorShape(13U, 13U, 256U), PadStrideInfo(1, 1, 1, 1));
+ add_config(TensorShape(13U, 13U, 256U), TensorShape(1U, 1U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(13U, 13U, 384U), TensorShape(1U, 1U, 384U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 0, 0));
add_config(TensorShape(224U, 224U, 3U), TensorShape(7U, 7U, 3U, 64U), TensorShape(64U), TensorShape(112U, 112U, 64U), PadStrideInfo(2, 2, 3, 3));
add_config(TensorShape(28U, 28U, 256U), TensorShape(1U, 1U, 256U, 64U), TensorShape(64U), TensorShape(28U, 28U, 64U), PadStrideInfo(1, 1, 0, 0));
// Batch size 4
add_config(TensorShape(227U, 227U, 3U, 4U), TensorShape(11U, 11U, 3U, 96U), TensorShape(96U), TensorShape(55U, 55U, 96U, 4U), PadStrideInfo(4, 4, 0, 0));
add_config(TensorShape(27U, 27U, 96U, 4U), TensorShape(5U, 5U, 96U, 256U), TensorShape(256U), TensorShape(27U, 27U, 256U, 4U), PadStrideInfo(1, 1, 2, 2));
- add_config(TensorShape(13U, 13U, 256U, 4U), TensorShape(3U, 3U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 4U), PadStrideInfo(1, 1, 1, 1));
- add_config(TensorShape(13U, 13U, 384U, 4U), TensorShape(3U, 3U, 384U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 4U), PadStrideInfo(1, 1, 1, 1));
- add_config(TensorShape(13U, 13U, 384U, 4U), TensorShape(3U, 3U, 384U, 256U), TensorShape(256U), TensorShape(13U, 13U, 256U, 4U), PadStrideInfo(1, 1, 1, 1));
+ add_config(TensorShape(13U, 13U, 256U, 4U), TensorShape(1U, 1U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 4U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(13U, 13U, 384U, 4U), TensorShape(1U, 1U, 384U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 4U), PadStrideInfo(1, 1, 0, 0));
add_config(TensorShape(224U, 224U, 3U, 4U), TensorShape(7U, 7U, 3U, 64U), TensorShape(64U), TensorShape(112U, 112U, 64U, 4U), PadStrideInfo(2, 2, 3, 3));
add_config(TensorShape(28U, 28U, 256U, 4U), TensorShape(1U, 1U, 256U, 64U), TensorShape(64U), TensorShape(28U, 28U, 64U, 4U), PadStrideInfo(1, 1, 0, 0));
// Batch size 8
add_config(TensorShape(227U, 227U, 3U, 8U), TensorShape(11U, 11U, 3U, 96U), TensorShape(96U), TensorShape(55U, 55U, 96U, 8U), PadStrideInfo(4, 4, 0, 0));
add_config(TensorShape(27U, 27U, 96U, 8U), TensorShape(5U, 5U, 96U, 256U), TensorShape(256U), TensorShape(27U, 27U, 256U, 8U), PadStrideInfo(1, 1, 2, 2));
- add_config(TensorShape(13U, 13U, 256U, 8U), TensorShape(3U, 3U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 8U), PadStrideInfo(1, 1, 1, 1));
- add_config(TensorShape(13U, 13U, 384U, 8U), TensorShape(3U, 3U, 384U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 8U), PadStrideInfo(1, 1, 1, 1));
- add_config(TensorShape(13U, 13U, 384U, 8U), TensorShape(3U, 3U, 384U, 256U), TensorShape(256U), TensorShape(13U, 13U, 256U, 8U), PadStrideInfo(1, 1, 1, 1));
+ add_config(TensorShape(13U, 13U, 256U, 8U), TensorShape(1U, 1U, 256U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 8U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(13U, 13U, 384U, 8U), TensorShape(1U, 1U, 384U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 8U), PadStrideInfo(1, 1, 0, 0));
add_config(TensorShape(224U, 224U, 3U, 8U), TensorShape(7U, 7U, 3U, 64U), TensorShape(64U), TensorShape(112U, 112U, 64U, 8U), PadStrideInfo(2, 2, 3, 3));
add_config(TensorShape(28U, 28U, 256U, 8U), TensorShape(1U, 1U, 256U, 64U), TensorShape(64U), TensorShape(28U, 28U, 64U, 8U), PadStrideInfo(1, 1, 0, 0));
// Arbitrary batch size
add_config(TensorShape(227U, 227U, 3U, 5U), TensorShape(11U, 11U, 3U, 96U), TensorShape(96U), TensorShape(55U, 55U, 96U, 5U), PadStrideInfo(4, 4, 0, 0));
}
};
+
+class LargeGroupedConvolutionLayerDataset final : public ConvolutionLayerDataset
+{
+public:
+ LargeGroupedConvolutionLayerDataset()
+ {
+ // Batch size 1
+ add_config(TensorShape(227U, 227U, 4U), TensorShape(11U, 11U, 2U, 96U), TensorShape(96U), TensorShape(55U, 55U, 96U), PadStrideInfo(4, 4, 0, 0));
+ add_config(TensorShape(27U, 27U, 96U), TensorShape(5U, 5U, 24U, 256U), TensorShape(256U), TensorShape(27U, 27U, 256U), PadStrideInfo(1, 1, 2, 2));
+ add_config(TensorShape(13U, 13U, 256U), TensorShape(1U, 1U, 128U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(13U, 13U, 384U), TensorShape(3U, 3U, 128U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U), PadStrideInfo(1, 1, 1, 1));
+ // Batch size 4
+ add_config(TensorShape(227U, 227U, 4U, 4U), TensorShape(11U, 11U, 2U, 96U), TensorShape(96U), TensorShape(55U, 55U, 96U, 4U), PadStrideInfo(4, 4, 0, 0));
+ add_config(TensorShape(27U, 27U, 96U, 4U), TensorShape(5U, 5U, 24U, 256U), TensorShape(256U), TensorShape(27U, 27U, 256U, 4U), PadStrideInfo(1, 1, 2, 2));
+ add_config(TensorShape(13U, 13U, 256U, 4U), TensorShape(3U, 3U, 128U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 4U), PadStrideInfo(1, 1, 1, 1));
+ add_config(TensorShape(13U, 13U, 384U, 4U), TensorShape(3U, 3U, 128U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 4U), PadStrideInfo(1, 1, 1, 1));
+ // Batch size 8
+ add_config(TensorShape(227U, 227U, 4U, 8U), TensorShape(11U, 11U, 2U, 96U), TensorShape(96U), TensorShape(55U, 55U, 96U, 8U), PadStrideInfo(4, 4, 0, 0));
+ add_config(TensorShape(27U, 27U, 96U, 8U), TensorShape(5U, 5U, 24U, 256U), TensorShape(256U), TensorShape(27U, 27U, 256U, 8U), PadStrideInfo(1, 1, 2, 2));
+ add_config(TensorShape(13U, 13U, 256U, 8U), TensorShape(3U, 3U, 128U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 8U), PadStrideInfo(1, 1, 1, 1));
+ add_config(TensorShape(13U, 13U, 384U, 8U), TensorShape(3U, 3U, 128U, 384U), TensorShape(384U), TensorShape(13U, 13U, 384U, 8U), PadStrideInfo(1, 1, 1, 1));
+ }
+};
} // namespace datasets
} // namespace test
} // namespace arm_compute
diff --git a/tests/datasets/LargeGEMMDataset.h b/tests/datasets/LargeGEMMDataset.h
index 638eb90..bbf362c 100644
--- a/tests/datasets/LargeGEMMDataset.h
+++ b/tests/datasets/LargeGEMMDataset.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -48,6 +48,36 @@
add_config(TensorShape(941U, 1U), TensorShape(623U, 941U), TensorShape(623U, 1U), TensorShape(623U, 1U), 0.4f, 0.7f);
}
};
+
+class LargeGEMMOutput3DDataset final : public GEMMDataset
+{
+public:
+ LargeGEMMOutput3DDataset()
+ {
+ add_config(TensorShape(923U, 429U), TensorShape(871U, 923U), TensorShape(871U, 143U, 3U), TensorShape(871U, 143U, 3U), 1.0f, 0.0f);
+ add_config(TensorShape(681U, 1025U), TensorShape(213U, 681U), TensorShape(213U, 205U, 5U), TensorShape(213U, 205U, 5U), 1.0f, 0.0f);
+ add_config(TensorShape(364U, 3025U), TensorShape(96U, 364U), TensorShape(96U, 605U, 5U), TensorShape(96U, 605U, 5U), 1.0f, 0.0f);
+ add_config(TensorShape(1201U, 729U), TensorShape(128U, 1201U), TensorShape(128U, 243U, 3U), TensorShape(128U, 243U, 3U), 1.0f, 0.0f);
+ add_config(TensorShape(2305U, 169U), TensorShape(384U, 2305U), TensorShape(384U, 13U, 13U), TensorShape(384U, 13U, 13U), 1.0f, 0.0f);
+ add_config(TensorShape(1729U, 170U), TensorShape(192U, 1729U), TensorShape(192U, 85U, 2U), TensorShape(192U, 85U, 2U), 1.0f, 0.0f);
+ add_config(TensorShape(1729U, 170U), TensorShape(128U, 1729U), TensorShape(128U, 17U, 10U), TensorShape(128U, 17U, 10U), 1.0f, 0.0f);
+ }
+};
+
+class LargeGEMMInputOutput3DDataset final : public GEMMDataset
+{
+public:
+ LargeGEMMInputOutput3DDataset()
+ {
+ add_config(TensorShape(923U, 143U, 3U), TensorShape(871U, 923U), TensorShape(871U, 143U, 3U), TensorShape(871U, 143U, 3U), 1.0f, 0.0f);
+ add_config(TensorShape(681U, 205U, 5U), TensorShape(213U, 681U), TensorShape(213U, 205U, 5U), TensorShape(213U, 205U, 5U), 1.0f, 0.0f);
+ add_config(TensorShape(364U, 605U, 5U), TensorShape(96U, 364U), TensorShape(96U, 605U, 5U), TensorShape(96U, 605U, 5U), 0.2f, 1.2f);
+ add_config(TensorShape(1201U, 243U, 3U), TensorShape(128U, 1201U), TensorShape(128U, 243U, 3U), TensorShape(128U, 243U, 3U), 1.0f, 0.0f);
+ add_config(TensorShape(2305U, 13U, 13U), TensorShape(384U, 2305U), TensorShape(384U, 13U, 13U), TensorShape(384U, 13U, 13U), 0.4f, 0.7f);
+ add_config(TensorShape(1729U, 85U, 2U, 2U), TensorShape(192U, 1729U), TensorShape(192U, 85U, 2U, 2U), TensorShape(192U, 85U, 2U, 2U), 1.0f, 0.0f);
+ add_config(TensorShape(1729U, 17U, 10U, 3U), TensorShape(128U, 1729U), TensorShape(128U, 17U, 10U, 3U), TensorShape(128U, 17U, 10U, 3U), 1.0f, 0.3f);
+ }
+};
} // namespace datasets
} // namespace test
} // namespace arm_compute
diff --git a/tests/datasets/MatrixMultiplyGEMMDataset.h b/tests/datasets/MatrixMultiplyGEMMDataset.h
index 5693706..fd2a3d6 100644
--- a/tests/datasets/MatrixMultiplyGEMMDataset.h
+++ b/tests/datasets/MatrixMultiplyGEMMDataset.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
diff --git a/tests/datasets/OpticalFlowDataset.h b/tests/datasets/OpticalFlowDataset.h
index 9e24720..00b1487 100644
--- a/tests/datasets/OpticalFlowDataset.h
+++ b/tests/datasets/OpticalFlowDataset.h
@@ -24,6 +24,7 @@
#ifndef ARM_COMPUTE_TEST_OPTICAL_FLOW_DATASET
#define ARM_COMPUTE_TEST_OPTICAL_FLOW_DATASET
+#include "tests/TypePrinter.h"
#include "tests/validation/Helpers.h"
#include "utils/TypePrinter.h"
diff --git a/tests/datasets/RNNLayerDataset.h b/tests/datasets/RNNLayerDataset.h
index 616a69e..5f42def 100644
--- a/tests/datasets/RNNLayerDataset.h
+++ b/tests/datasets/RNNLayerDataset.h
@@ -131,7 +131,7 @@
public:
SmallRNNLayerDataset()
{
- add_config(TensorShape(8U, 2U), TensorShape(8U, 16U), TensorShape(16U, 16U), TensorShape(16U), TensorShape(16U, 2U), ActivationLayerInfo());
+ add_config(TensorShape(128U, 16U), TensorShape(128U, 32U), TensorShape(32U, 32U), TensorShape(32U), TensorShape(32U, 16U), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
}
};
diff --git a/tests/datasets/ShapeDatasets.h b/tests/datasets/ShapeDatasets.h
index a5620ff..57bb9d0 100644
--- a/tests/datasets/ShapeDatasets.h
+++ b/tests/datasets/ShapeDatasets.h
@@ -160,14 +160,14 @@
: ShapeDataset("Shape",
{
// Batch size 1
- TensorShape{ 9U, 9U },
+ TensorShape{ 11U, 11U },
TensorShape{ 27U, 13U, 2U },
TensorShape{ 128U, 64U, 1U, 3U },
// Batch size 4
- TensorShape{ 9U, 9U, 3U, 4U },
+ TensorShape{ 11U, 11U, 3U, 4U },
TensorShape{ 27U, 13U, 2U, 4U },
// Arbitrary batch size
- TensorShape{ 9U, 9U, 3U, 5U }
+ TensorShape{ 11U, 11U, 3U, 5U }
})
{
}
@@ -388,6 +388,38 @@
}
};
+/** Data set containing small 3x1 tensor shapes. */
+class Small3x1Shapes final : public ShapeDataset
+{
+public:
+ Small3x1Shapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 3U, 1U, 7U, 4U },
+ TensorShape{ 3U, 1U, 4U, 13U },
+ TensorShape{ 3U, 1U, 9U, 2U },
+ TensorShape{ 3U, 1U, 3U, 5U },
+ })
+ {
+ }
+};
+
+/** Data set containing small 1x3 tensor shapes. */
+class Small1x3Shapes final : public ShapeDataset
+{
+public:
+ Small1x3Shapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 1U, 3U, 7U, 4U },
+ TensorShape{ 1U, 3U, 4U, 13U },
+ TensorShape{ 1U, 3U, 9U, 2U },
+ TensorShape{ 1U, 3U, 3U, 5U },
+ })
+ {
+ }
+};
+
/** Data set containing large 3x3 tensor shapes. */
class Large3x3Shapes final : public ShapeDataset
{
@@ -404,6 +436,38 @@
}
};
+/** Data set containing large 3x1 tensor shapes. */
+class Large3x1Shapes final : public ShapeDataset
+{
+public:
+ Large3x1Shapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 3U, 1U, 32U, 64U },
+ TensorShape{ 3U, 1U, 51U, 13U },
+ TensorShape{ 3U, 1U, 53U, 47U },
+ TensorShape{ 3U, 1U, 128U, 384U },
+ })
+ {
+ }
+};
+
+/** Data set containing large 1x3 tensor shapes. */
+class Large1x3Shapes final : public ShapeDataset
+{
+public:
+ Large1x3Shapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 1U, 3U, 32U, 64U },
+ TensorShape{ 1U, 3U, 51U, 13U },
+ TensorShape{ 1U, 3U, 53U, 47U },
+ TensorShape{ 1U, 3U, 128U, 384U },
+ })
+ {
+ }
+};
+
/** Data set containing small 5x5 tensor shapes. */
class Small5x5Shapes final : public ShapeDataset
{
@@ -436,6 +500,70 @@
}
};
+/** Data set containing small 5x1 tensor shapes. */
+class Small5x1Shapes final : public ShapeDataset
+{
+public:
+ Small5x1Shapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 5U, 1U, 7U, 4U },
+ TensorShape{ 5U, 1U, 4U, 13U },
+ TensorShape{ 5U, 1U, 9U, 2U },
+ TensorShape{ 5U, 1U, 3U, 5U },
+ })
+ {
+ }
+};
+
+/** Data set containing large 5x1 tensor shapes. */
+class Large5x1Shapes final : public ShapeDataset
+{
+public:
+ Large5x1Shapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 5U, 1U, 32U, 64U },
+ TensorShape{ 5U, 1U, 51U, 13U },
+ TensorShape{ 5U, 1U, 53U, 47U },
+ TensorShape{ 5U, 1U, 128U, 384U },
+ })
+ {
+ }
+};
+
+/** Data set containing small 1x5 tensor shapes. */
+class Small1x5Shapes final : public ShapeDataset
+{
+public:
+ Small1x5Shapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 1U, 5U, 7U, 4U },
+ TensorShape{ 1U, 5U, 4U, 13U },
+ TensorShape{ 1U, 5U, 9U, 2U },
+ TensorShape{ 1U, 5U, 3U, 5U },
+ })
+ {
+ }
+};
+
+/** Data set containing large 1x5 tensor shapes. */
+class Large1x5Shapes final : public ShapeDataset
+{
+public:
+ Large1x5Shapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 1U, 5U, 32U, 64U },
+ TensorShape{ 1U, 5U, 51U, 13U },
+ TensorShape{ 1U, 5U, 53U, 47U },
+ TensorShape{ 1U, 5U, 128U, 384U },
+ })
+ {
+ }
+};
+
/** Data set containing small tensor shapes for deconvolution. */
class SmallDeconvolutionShapes final : public ShapeDataset
{
@@ -507,6 +635,74 @@
}
};
+/** Data set containing small grouped im2col tensor shapes. */
+class GroupedIm2ColSmallShapes final : public ShapeDataset
+{
+public:
+ GroupedIm2ColSmallShapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 11U, 11U, 48U },
+ TensorShape{ 27U, 13U, 24U },
+ TensorShape{ 128U, 64U, 12U, 3U },
+ TensorShape{ 11U, 11U, 48U, 4U },
+ TensorShape{ 27U, 13U, 24U, 4U },
+ TensorShape{ 11U, 11U, 48U, 5U }
+ })
+ {
+ }
+};
+
+/** Data set containing large grouped im2col tensor shapes. */
+class GroupedIm2ColLargeShapes final : public ShapeDataset
+{
+public:
+ GroupedIm2ColLargeShapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 153U, 231U, 12U },
+ TensorShape{ 123U, 191U, 12U, 2U },
+ })
+ {
+ }
+};
+
+/** Data set containing small grouped weights tensor shapes. */
+class GroupedWeightsSmallShapes final : public ShapeDataset
+{
+public:
+ GroupedWeightsSmallShapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 3U, 3U, 48U, 120U },
+ TensorShape{ 1U, 3U, 24U, 240U },
+ TensorShape{ 3U, 1U, 12U, 480U },
+ TensorShape{ 5U, 5U, 48U, 120U },
+ TensorShape{ 1U, 5U, 24U, 240U },
+ TensorShape{ 5U, 1U, 48U, 480U }
+ })
+ {
+ }
+};
+
+/** Data set containing large grouped weights tensor shapes. */
+class GroupedWeightsLargeShapes final : public ShapeDataset
+{
+public:
+ GroupedWeightsLargeShapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 9U, 9U, 96U, 240U },
+ TensorShape{ 7U, 9U, 48U, 480U },
+ TensorShape{ 9U, 7U, 24U, 960U },
+ TensorShape{ 13U, 13U, 96U, 240U },
+ TensorShape{ 11U, 13U, 48U, 480U },
+ TensorShape{ 13U, 11U, 24U, 960U }
+ })
+ {
+ }
+};
+
/** Data set containing 2D tensor shapes for DepthConcatenateLayer. */
class DepthConcatenateLayerShapes final : public ShapeDataset
{
@@ -563,7 +759,7 @@
: ShapeDataset("Shape",
{
TensorShape{ 9U, 9U },
- TensorShape{ 128U, 10U, 2U },
+ TensorShape{ 128U, 10U },
})
{
}
@@ -577,11 +773,9 @@
: ShapeDataset("Shape",
{
TensorShape{ 9U, 9U },
- TensorShape{ 256U, 10U, 2U },
- TensorShape{ 353U, 8U, 2U, 2U },
- TensorShape{ 512U, 7U, 2U, 2U },
- TensorShape{ 633U, 10U, 1U, 2U },
- TensorShape{ 781U, 5U, 2U },
+ TensorShape{ 256U, 10U },
+ TensorShape{ 353U, 8U },
+ TensorShape{ 781U, 5U },
})
{
}
@@ -595,8 +789,7 @@
: ShapeDataset("Shape",
{
TensorShape{ 1000U, 10U },
- TensorShape{ 3989U, 10U, 2U },
- TensorShape{ 4098U, 8U, 1U, 2U },
+ TensorShape{ 3989U, 10U },
TensorShape{ 7339U, 11U },
})
{
diff --git a/tests/datasets/SmallConvolutionLayerDataset.h b/tests/datasets/SmallConvolutionLayerDataset.h
index fed36de..a288d07 100644
--- a/tests/datasets/SmallConvolutionLayerDataset.h
+++ b/tests/datasets/SmallConvolutionLayerDataset.h
@@ -52,6 +52,36 @@
}
};
+class SmallWinogradConvolutionLayer3x1Dataset final : public ConvolutionLayerDataset
+{
+public:
+ SmallWinogradConvolutionLayer3x1Dataset()
+ {
+ // Channel size big enough to force multithreaded execution of the input transform
+ add_config(TensorShape(8U, 8U, 32U), TensorShape(3U, 1U, 32U, 1U), TensorShape(1U), TensorShape(6U, 8U, 1U), PadStrideInfo(1, 1, 0, 0));
+ // Batch size 1
+ add_config(TensorShape(8U, 8U, 2U), TensorShape(3U, 1U, 2U, 1U), TensorShape(1U), TensorShape(6U, 8U, 1U), PadStrideInfo(1, 1, 0, 0));
+ // Batch size 4
+ add_config(TensorShape(23U, 27U, 5U, 4U), TensorShape(3U, 1U, 5U, 21U), TensorShape(21U), TensorShape(21U, 27U, 21U, 4U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(8U, 8U, 2U), TensorShape(3U, 1U, 2U, 1U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 1, 0));
+ }
+};
+
+class SmallWinogradConvolutionLayer1x3Dataset final : public ConvolutionLayerDataset
+{
+public:
+ SmallWinogradConvolutionLayer1x3Dataset()
+ {
+ // Channel size big enough to force multithreaded execution of the input transform
+ add_config(TensorShape(8U, 8U, 32U), TensorShape(1U, 3U, 32U, 1U), TensorShape(1U), TensorShape(8U, 6U, 1U), PadStrideInfo(1, 1, 0, 0));
+ // Batch size 1
+ add_config(TensorShape(8U, 8U, 2U), TensorShape(1U, 3U, 2U, 1U), TensorShape(1U), TensorShape(8U, 6U, 1U), PadStrideInfo(1, 1, 0, 0));
+ // Batch size 4
+ add_config(TensorShape(23U, 27U, 5U, 4U), TensorShape(1U, 3U, 5U, 21U), TensorShape(21U), TensorShape(23U, 25U, 21U, 4U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(8U, 8U, 2U), TensorShape(1U, 3U, 2U, 1U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 0, 1));
+ }
+};
+
class SmallWinogradConvolutionLayer5x5Dataset final : public ConvolutionLayerDataset
{
public:
@@ -62,6 +92,26 @@
}
};
+class SmallWinogradConvolutionLayer5x1Dataset final : public ConvolutionLayerDataset
+{
+public:
+ SmallWinogradConvolutionLayer5x1Dataset()
+ {
+ add_config(TensorShape(8U, 8U, 2U), TensorShape(5U, 1U, 2U, 1U), TensorShape(1U), TensorShape(4U, 8U, 1U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(8U, 8U, 2U), TensorShape(5U, 1U, 2U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 2, 0));
+ }
+};
+
+class SmallWinogradConvolutionLayer1x5Dataset final : public ConvolutionLayerDataset
+{
+public:
+ SmallWinogradConvolutionLayer1x5Dataset()
+ {
+ add_config(TensorShape(8U, 8U, 2U), TensorShape(1U, 5U, 2U, 1U), TensorShape(1U), TensorShape(8U, 4U, 1U), PadStrideInfo(1, 1, 0, 0));
+ add_config(TensorShape(8U, 8U, 2U), TensorShape(1U, 5U, 2U), TensorShape(1U), TensorShape(8U, 8U, 1U), PadStrideInfo(1, 1, 0, 2));
+ }
+};
+
class SmallConvolutionLayerDataset final : public ConvolutionLayerDataset
{
public:
@@ -96,6 +146,41 @@
add_config(TensorShape(33U, 27U, 7U, 5U), TensorShape(5U, 7U, 7U, 16U), TensorShape(16U), TensorShape(10U, 11U, 16U, 5U), PadStrideInfo(3, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR));
}
};
+
+class SmallGroupedConvolutionLayerDataset final : public ConvolutionLayerDataset
+{
+public:
+ SmallGroupedConvolutionLayerDataset()
+ {
+ // Batch size 1
+ // Number of groups = 2
+ add_config(TensorShape(23U, 27U, 8U), TensorShape(1U, 1U, 4U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U), PadStrideInfo(2, 1, 0, 0));
+ add_config(TensorShape(33U, 27U, 12U), TensorShape(5U, 5U, 6U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U), PadStrideInfo(3, 2, 1, 0));
+ // Number of groups = 4
+ add_config(TensorShape(23U, 27U, 8U), TensorShape(1U, 1U, 2U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U), PadStrideInfo(2, 1, 0, 0));
+ add_config(TensorShape(33U, 27U, 12U), TensorShape(5U, 5U, 4U, 15U), TensorShape(15U), TensorShape(11U, 12U, 15U), PadStrideInfo(3, 2, 1, 0));
+
+ // Batch size 4
+ // Number of groups = 2
+ add_config(TensorShape(23U, 27U, 8U, 4U), TensorShape(1U, 1U, 4U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U, 4U), PadStrideInfo(2, 1, 0, 0));
+ add_config(TensorShape(33U, 27U, 12U, 4U), TensorShape(5U, 5U, 6U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 4U), PadStrideInfo(3, 2, 1, 0));
+ // Number of groups = 4
+ add_config(TensorShape(23U, 27U, 8U, 4U), TensorShape(1U, 1U, 2U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U, 4U), PadStrideInfo(2, 1, 0, 0));
+ add_config(TensorShape(33U, 27U, 12U, 4U), TensorShape(5U, 5U, 4U, 15U), TensorShape(15U), TensorShape(11U, 12U, 15U, 4U), PadStrideInfo(3, 2, 1, 0));
+
+ // Arbitrary batch size
+ add_config(TensorShape(23U, 27U, 8U, 5U), TensorShape(1U, 1U, 4U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U, 5U), PadStrideInfo(2, 1, 0, 0));
+ add_config(TensorShape(33U, 27U, 12U, 3U), TensorShape(5U, 5U, 6U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 3U), PadStrideInfo(3, 2, 1, 0));
+ // Number of groups = 4
+ add_config(TensorShape(23U, 27U, 8U, 2U), TensorShape(1U, 1U, 2U, 24U), TensorShape(24U), TensorShape(12U, 27U, 24U, 2U), PadStrideInfo(2, 1, 0, 0));
+ add_config(TensorShape(33U, 27U, 12U, 5U), TensorShape(5U, 5U, 4U, 15U), TensorShape(15U), TensorShape(11U, 12U, 15U, 5U), PadStrideInfo(3, 2, 1, 0));
+
+ // Asymmetric padding
+ add_config(TensorShape(33U, 27U, 8U, 5U), TensorShape(5U, 7U, 2U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR));
+ add_config(TensorShape(33U, 27U, 8U, 5U), TensorShape(5U, 7U, 4U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 1, 1, 0, 2, DimensionRoundingType::FLOOR));
+ add_config(TensorShape(33U, 27U, 6U, 5U), TensorShape(5U, 7U, 3U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 2, 1, 2, 0, DimensionRoundingType::FLOOR));
+ }
+};
} // namespace datasets
} // namespace test
} // namespace arm_compute
diff --git a/tests/datasets/SmallGEMMDataset.h b/tests/datasets/SmallGEMMDataset.h
index 5d59c1d..15a3504 100644
--- a/tests/datasets/SmallGEMMDataset.h
+++ b/tests/datasets/SmallGEMMDataset.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -44,10 +44,38 @@
{
add_config(TensorShape(21U, 13U), TensorShape(33U, 21U), TensorShape(33U, 13U), TensorShape(33U, 13U), 1.0f, 0.0f);
add_config(TensorShape(31U, 1U), TensorShape(23U, 31U), TensorShape(23U, 1U), TensorShape(23U, 1U), 1.0f, 0.0f);
+ add_config(TensorShape(8U, 2U), TensorShape(16U, 8U), TensorShape(16U, 2U), TensorShape(16U, 2U), 1.0f, 0.0f);
add_config(TensorShape(38U, 12U), TensorShape(21U, 38U), TensorShape(21U, 12U), TensorShape(21U, 12U), 0.2f, 1.2f);
add_config(TensorShape(32U, 1U), TensorShape(17U, 32U), TensorShape(17U, 1U), TensorShape(17U, 1U), 0.4f, 0.7f);
}
};
+class SmallGEMMOutput3DDataset final : public GEMMDataset
+{
+public:
+ SmallGEMMOutput3DDataset()
+ {
+ add_config(TensorShape(21U, 14U), TensorShape(34U, 21U), TensorShape(34U, 7U, 2U), TensorShape(34U, 7U, 2U), 1.0f, 0.0f);
+ add_config(TensorShape(31U, 1U), TensorShape(23U, 31U), TensorShape(23U, 1U, 1U), TensorShape(23U, 1U, 1U), 1.0f, 0.0f);
+ add_config(TensorShape(38U, 12U), TensorShape(21U, 38U), TensorShape(21U, 4U, 3U), TensorShape(21U, 4U, 3U), 0.2f, 1.2f);
+ add_config(TensorShape(32U, 1U), TensorShape(17U, 32U), TensorShape(17U, 1U, 1U), TensorShape(17U, 1U, 1U), 0.4f, 0.7f);
+ add_config(TensorShape(16U, 16U), TensorShape(8U, 16U), TensorShape(8U, 8U, 2U), TensorShape(8U, 8U, 2U), 1.0f, 0.0f);
+ add_config(TensorShape(16U, 16U, 5U), TensorShape(8U, 16U, 5U), TensorShape(8U, 8U, 2U, 5U), TensorShape(8U, 8U, 2U, 5U), 1.0f, 0.0f);
+ }
+};
+
+class SmallGEMMInputOutput3DDataset final : public GEMMDataset
+{
+public:
+ SmallGEMMInputOutput3DDataset()
+ {
+ add_config(TensorShape(21U, 14U, 13U), TensorShape(34U, 21U), TensorShape(34U, 14U, 13U), TensorShape(34U, 14U, 13U), 1.0f, 0.0f);
+ add_config(TensorShape(31U, 1U, 3U), TensorShape(23U, 31U), TensorShape(23U, 1U, 3U), TensorShape(23U, 1U, 3U), 1.0f, 0.0f);
+ add_config(TensorShape(38U, 12U, 2U), TensorShape(21U, 38U), TensorShape(21U, 12U, 2U), TensorShape(21U, 12U, 2U), 0.2f, 1.2f);
+ add_config(TensorShape(32U, 1U, 4U, 3U), TensorShape(17U, 32U), TensorShape(17U, 1U, 4U, 3U), TensorShape(17U, 1U, 4U, 3U), 0.4f, 0.7f);
+ add_config(TensorShape(16U, 16U, 3U, 2U), TensorShape(8U, 16U), TensorShape(8U, 16U, 3U, 2U), TensorShape(8U, 16U, 3U, 2U), 1.0f, 0.0f);
+ add_config(TensorShape(16U, 16U, 5U, 3U), TensorShape(8U, 16U), TensorShape(8U, 16U, 5U, 3U), TensorShape(8U, 16U, 5U, 3U), 1.0f, 0.3f);
+ }
+};
} // namespace datasets
} // namespace test
} // namespace arm_compute
diff --git a/tests/datasets/WinogradInputTransformDataset.h b/tests/datasets/WinogradInputTransformDataset.h
index 59fb2ad..bd910fb 100644
--- a/tests/datasets/WinogradInputTransformDataset.h
+++ b/tests/datasets/WinogradInputTransformDataset.h
@@ -97,12 +97,11 @@
std::vector<WinogradInfo> _infos{};
};
-class SmallWinogradInputTransformDataset final : public WinogradInputTransformDataset
+class SmallWinogradInputTransformDataset2x2_3x3 final : public WinogradInputTransformDataset
{
public:
- SmallWinogradInputTransformDataset()
+ SmallWinogradInputTransformDataset2x2_3x3()
{
- // (2x2, 3x3)
add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(128U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
@@ -110,8 +109,44 @@
add_config(TensorShape(27U, 13U, 2U, 4U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(27U, 13U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(9U, 9U, 3U, 5U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(14U, 14U, 512U, 2U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ }
+};
- // (4x4, 3x3)
+class SmallWinogradInputTransformDataset2x1_3x1 final : public WinogradInputTransformDataset
+{
+public:
+ SmallWinogradInputTransformDataset2x1_3x1()
+ {
+ add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(128U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 4U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U, 4U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(27U, 13U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 5U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(14U, 14U, 512U, 2U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ }
+};
+
+class SmallWinogradInputTransformDataset1x2_1x3 final : public WinogradInputTransformDataset
+{
+public:
+ SmallWinogradInputTransformDataset1x2_1x3()
+ {
+ add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(128U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 4U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U, 4U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(27U, 13U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 5U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(14U, 14U, 512U, 2U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ }
+};
+
+class SmallWinogradInputTransformDataset4x4_3x3 final : public WinogradInputTransformDataset
+{
+public:
+ SmallWinogradInputTransformDataset4x4_3x3()
+ {
add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(128U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
@@ -119,8 +154,44 @@
add_config(TensorShape(27U, 13U, 2U, 4U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(27U, 13U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(9U, 9U, 3U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(14U, 14U, 512U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ }
+};
- // (4x4, 5x5)
+class SmallWinogradInputTransformDataset4x1_3x1 final : public WinogradInputTransformDataset
+{
+public:
+ SmallWinogradInputTransformDataset4x1_3x1()
+ {
+ add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(128U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 4U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U, 4U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(27U, 13U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(14U, 14U, 512U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ }
+};
+
+class SmallWinogradInputTransformDataset1x4_1x3 final : public WinogradInputTransformDataset
+{
+public:
+ SmallWinogradInputTransformDataset1x4_1x3()
+ {
+ add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(128U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 4U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U, 4U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(27U, 13U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(14U, 14U, 512U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ }
+};
+
+class SmallWinogradInputTransformDataset4x4_5x5 final : public WinogradInputTransformDataset
+{
+public:
+ SmallWinogradInputTransformDataset4x4_5x5()
+ {
add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(9U, 9U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(128U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
@@ -131,30 +202,143 @@
}
};
-class LargeWinogradInputTransformDataset final : public WinogradInputTransformDataset
+class SmallWinogradInputTransformDataset4x1_5x1 final : public WinogradInputTransformDataset
{
public:
- LargeWinogradInputTransformDataset()
+ SmallWinogradInputTransformDataset4x1_5x1()
{
- // (2x2, 3x3)
+ add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 2, 0), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(27U, 13U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(128U, 64U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 4U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 2, 0), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U, 4U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(27U, 13U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(14U, 14U, 512U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(14U, 14U), PadStrideInfo(1, 1, 2, 0), DataLayout::NCHW));
+ }
+};
+
+class SmallWinogradInputTransformDataset1x4_1x5 final : public WinogradInputTransformDataset
+{
+public:
+ SmallWinogradInputTransformDataset1x4_1x5()
+ {
+ add_config(TensorShape(9U, 9U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 2), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 1U, 3U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 4U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 2), DataLayout::NCHW));
+ add_config(TensorShape(27U, 13U, 2U, 4U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(27U, 13U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(9U, 9U, 3U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(14U, 14U, 512U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(14U, 14U), PadStrideInfo(1, 1, 0, 2), DataLayout::NCHW));
+ }
+};
+
+class LargeWinogradInputTransformDataset2x2_3x3 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset2x2_3x3()
+ {
add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(42U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(57U, 60U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(83U, 72U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ }
+};
- // (4x4, 3x3)
+class LargeWinogradInputTransformDataset2x1_3x1 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset2x1_3x1()
+ {
+ add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(42U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(57U, 60U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(83U, 72U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ }
+};
+
+class LargeWinogradInputTransformDataset1x2_1x3 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset1x2_1x3()
+ {
+ add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(42U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(57U, 60U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(83U, 72U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ }
+};
+
+class LargeWinogradInputTransformDataset4x4_3x3 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset4x4_3x3()
+ {
add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(42U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(57U, 60U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(83U, 72U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ }
+};
- // (4x4, 5x5)
+class LargeWinogradInputTransformDataset4x1_3x1 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset4x1_3x1()
+ {
+ add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(42U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(57U, 60U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(83U, 72U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ }
+};
+
+class LargeWinogradInputTransformDataset1x4_1x3 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset1x4_1x3()
+ {
+ add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(42U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(57U, 60U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(83U, 72U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ }
+};
+
+class LargeWinogradInputTransformDataset4x4_5x5 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset4x4_5x5()
+ {
add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(42U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(57U, 60U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(83U, 72U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
}
};
+
+class LargeWinogradInputTransformDataset4x1_5x1 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset4x1_5x1()
+ {
+ add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(42U, 37U), PadStrideInfo(1, 1, 2, 0), DataLayout::NCHW));
+ add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(57U, 60U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(83U, 72U), PadStrideInfo(1, 1, 2, 0), DataLayout::NCHW));
+ }
+};
+
+class LargeWinogradInputTransformDataset1x4_1x5 final : public WinogradInputTransformDataset
+{
+public:
+ LargeWinogradInputTransformDataset1x4_1x5()
+ {
+ add_config(TensorShape(42U, 37U, 8U, 15U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(42U, 37U), PadStrideInfo(1, 1, 0, 2), DataLayout::NCHW));
+ add_config(TensorShape(57U, 60U, 13U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(57U, 60U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(128U, 64U, 21U, 13U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(128U, 64U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(83U, 72U, 14U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(83U, 72U), PadStrideInfo(1, 1, 0, 2), DataLayout::NCHW));
+ }
+};
} // namespace datasets
} // namespace test
} // namespace arm_compute
diff --git a/tests/datasets/WinogradOutputTransformDataset.h b/tests/datasets/WinogradOutputTransformDataset.h
index b28df39..617a67d 100644
--- a/tests/datasets/WinogradOutputTransformDataset.h
+++ b/tests/datasets/WinogradOutputTransformDataset.h
@@ -99,10 +99,10 @@
std::vector<WinogradInfo> _info{};
};
-class SmallWinogradOutputTransformDataset final : public WinogradOutputTransformDataset
+class SmallWinogradOutputTransformDatasetNCHW final : public WinogradOutputTransformDataset
{
public:
- SmallWinogradOutputTransformDataset()
+ SmallWinogradOutputTransformDatasetNCHW()
{
// (2x2, 3x3)
add_config(TensorShape(13U, 6U, 16U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
@@ -119,6 +119,34 @@
add_config(TensorShape(24U, 16U, 36U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(7U, 12U, 16U, 5U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ // (2x1, 3x1)
+ add_config(TensorShape(13U, 18U, 4U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 44U, 4U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(1U, 891U, 4U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(53U, 33U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 30U, 4U, 3U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(24U, 98U, 4U, 2U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+
+ // (1x2, 1x3)
+ add_config(TensorShape(13U, 14U, 4U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 50U, 4U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(1U, 901U, 4U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(7U, 32U, 4U, 3U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(24U, 98U, 4U, 2U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+
+ // (4x1, 3x1)
+ add_config(TensorShape(13U, 12U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 22U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(1U, 462U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(53U, 33U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 20U, 6U, 3U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(24U, 56U, 6U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+
+ // (1x4, 1x3)
+ add_config(TensorShape(13U, 7U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 30U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(1U, 477U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(7U, 16U, 6U, 3U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(24U, 56U, 6U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+
// (4x4, 5x5)
add_config(TensorShape(13U, 1U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(7U, 4U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
@@ -126,13 +154,81 @@
add_config(TensorShape(7U, 2U, 64U, 3U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
add_config(TensorShape(24U, 9U, 64U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(7U, 2U, 64U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+
+ // (4x1, 5x1)
+ add_config(TensorShape(13U, 6U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 22U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(5U, 462U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(53U, 33U), PadStrideInfo(1, 1, 2, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 10U, 8U, 3U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(24U, 42U, 8U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 20U, 8U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(8U, 10U), PadStrideInfo(1, 1, 2, 0), DataLayout::NCHW));
+
+ // (1x4, 1x5)
+ add_config(TensorShape(13U, 7U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(7U, 20U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(5U, 477U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 2), DataLayout::NCHW));
+ add_config(TensorShape(7U, 16U, 8U, 3U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(24U, 42U, 8U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(14U, 14U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(7U, 24U, 8U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 2), DataLayout::NCHW));
}
};
-class LargeWinogradOutputTransformDataset final : public WinogradOutputTransformDataset
+class SmallWinogradOutputTransformDatasetNHWC final : public WinogradOutputTransformDataset
{
public:
- LargeWinogradOutputTransformDataset()
+ SmallWinogradOutputTransformDatasetNHWC()
+ {
+ // (4x1, 3x1)
+ add_config(TensorShape(13U, 12U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 22U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(1U, 462U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(53U, 33U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 20U, 6U, 3U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(24U, 56U, 6U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+
+ // (1x4, 1x3)
+ add_config(TensorShape(13U, 7U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 30U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(1U, 477U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(7U, 16U, 6U, 3U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(24U, 56U, 6U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+
+ // (4x4, 3x3)
+ add_config(TensorShape(13U, 4U, 36U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(10U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 6U, 36U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 117U, 36U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(7U, 4U, 36U, 3U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(24U, 16U, 36U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NHWC));
+
+ // (4x4, 5x5)
+ add_config(TensorShape(13U, 1U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 4U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(5U, 104U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(7U, 2U, 64U, 3U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(24U, 9U, 64U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NHWC));
+ add_config(TensorShape(7U, 2U, 64U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+
+ // (4x1, 5x1)
+ add_config(TensorShape(13U, 6U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 22U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(5U, 462U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(53U, 33U), PadStrideInfo(1, 1, 2, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 10U, 8U, 3U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(24U, 42U, 8U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 20U, 8U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(8U, 10U), PadStrideInfo(1, 1, 2, 0), DataLayout::NHWC));
+
+ // (1x4, 1x5)
+ add_config(TensorShape(13U, 7U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(7U, 20U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(10U, 11U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(5U, 477U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 2), DataLayout::NHWC));
+ add_config(TensorShape(7U, 16U, 8U, 3U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(24U, 42U, 8U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(14U, 14U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(7U, 24U, 8U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 2), DataLayout::NHWC));
+ }
+};
+
+class LargeWinogradOutputTransformDatasetNCHW final : public WinogradOutputTransformDataset
+{
+public:
+ LargeWinogradOutputTransformDatasetNCHW()
{
// (2x2, 3x3)
add_config(TensorShape(64U, 12544U, 16U), WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(224U, 224U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
@@ -149,6 +245,105 @@
add_config(TensorShape(64U, 3136U, 36U, 3U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(224U, 224U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW));
add_config(TensorShape(32U, 784U, 36U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(112U, 112U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
add_config(TensorShape(13U, 196U, 36U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+
+ // (2x1, 3x1)
+ add_config(TensorShape(64U, 24976U, 4U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(224U, 223U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(32U, 6160U, 4U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(112U, 110U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 1568U, 4U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(64U, 24753U, 4U, 3U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(32U, 6050U, 4U, 2U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 1512U, 4U, 5U), WinogradInfo(Size2D(2U, 1U), Size2D(3U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+
+ // (1x2, 1x3)
+ add_config(TensorShape(64U, 25088U, 4U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(32U, 6160U, 4U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(13U, 1568U, 4U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(64U, 24864U, 4U, 3U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(32U, 6048U, 4U, 2U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 1512U, 4U, 5U), WinogradInfo(Size2D(1U, 2U), Size2D(1U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+
+ // (4x1, 3x1)
+ add_config(TensorShape(64U, 12488U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(224U, 223U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(32U, 3080U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(112U, 110U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 784U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(64U, 12488U, 6U, 3U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(32U, 3080U, 6U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 784U, 6U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+
+ // (1x4, 1x3)
+ add_config(TensorShape(64U, 12544U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(32U, 3136U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(13U, 784U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(64U, 12544U, 6U, 3U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(32U, 3024U, 6U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 784U, 6U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+
+ // (4x4, 5x5)
+ add_config(TensorShape(32U, 756U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(112U, 112U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 182U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(32U, 756U, 64U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(112U, 112U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 182U, 64U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+
+ // (4x1, 5x1)
+ add_config(TensorShape(32U, 3136U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(112U, 112U), PadStrideInfo(1, 1, 2, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 784U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+ add_config(TensorShape(32U, 3024U, 8U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(112U, 112U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 784U, 8U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW));
+
+ // (1x4, 1x5)
+ add_config(TensorShape(32U, 3136U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(112U, 112U), PadStrideInfo(1, 1, 0, 2), DataLayout::NCHW));
+ add_config(TensorShape(13U, 784U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ add_config(TensorShape(32U, 3024U, 8U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(112U, 112U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW));
+ add_config(TensorShape(13U, 784U, 8U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW));
+ }
+};
+
+class LargeWinogradOutputTransformDatasetNHWC final : public WinogradOutputTransformDataset
+{
+public:
+ LargeWinogradOutputTransformDatasetNHWC()
+ {
+ // (4x1, 3x1)
+ add_config(TensorShape(64U, 12488U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(224U, 223U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(32U, 3080U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(112U, 110U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 784U, 6U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(64U, 12488U, 6U, 3U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(32U, 3080U, 6U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 784U, 6U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(3U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+
+ // (1x4, 1x3)
+ add_config(TensorShape(64U, 12544U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(32U, 3136U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(13U, 784U, 6U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(64U, 12544U, 6U, 3U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(224U, 223U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(32U, 3024U, 6U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(112U, 110U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 784U, 6U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+
+ // (4x4, 3x3)
+ add_config(TensorShape(64U, 3136U, 36U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(224U, 224U), PadStrideInfo(1, 1, 1, 1), DataLayout::NHWC));
+ add_config(TensorShape(32U, 784U, 36U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(112U, 112U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 196U, 36U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(64U, 3136U, 36U, 3U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(224U, 224U), PadStrideInfo(1, 1, 1, 1), DataLayout::NHWC));
+ add_config(TensorShape(32U, 784U, 36U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(112U, 112U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 196U, 36U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+
+ // (4x4, 5x5)
+ add_config(TensorShape(32U, 756U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(112U, 112U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 182U, 64U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(32U, 756U, 64U, 2U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(112U, 112U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 182U, 64U, 5U), WinogradInfo(Size2D(4U, 4U), Size2D(5U, 5U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+
+ // (4x1, 5x1)
+ add_config(TensorShape(32U, 3136U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(112U, 112U), PadStrideInfo(1, 1, 2, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 784U, 8U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+ add_config(TensorShape(32U, 3024U, 8U, 2U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(112U, 112U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 784U, 8U, 5U), WinogradInfo(Size2D(4U, 1U), Size2D(5U, 1U), Size2D(56U, 56U), PadStrideInfo(1, 1, 1, 0), DataLayout::NHWC));
+
+ // (1x4, 1x5)
+ add_config(TensorShape(32U, 3136U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(112U, 112U), PadStrideInfo(1, 1, 0, 2), DataLayout::NHWC));
+ add_config(TensorShape(13U, 784U, 8U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
+ add_config(TensorShape(32U, 3024U, 8U, 2U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(112U, 112U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC));
+ add_config(TensorShape(13U, 784U, 8U, 5U), WinogradInfo(Size2D(1U, 4U), Size2D(1U, 5U), Size2D(56U, 56U), PadStrideInfo(1, 1, 0, 1), DataLayout::NHWC));
}
};
} // namespace datasets
diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp
index fd0afe9..eea7745 100644
--- a/tests/framework/Framework.cpp
+++ b/tests/framework/Framework.cpp
@@ -532,14 +532,17 @@
{
#ifdef ARM_COMPUTE_CL
// Every 5000 tests, reset the OpenCL context to release the allocated memory
- if((id_run_test % 5000) == 0)
+ if(opencl_is_available() && (id_run_test % 5000) == 0)
{
- cl::Context::setDefault(cl::Context());
- CLScheduler::get().set_context(cl::Context());
- CLKernelLibrary::get().clear_programs_cache();
+ auto ctx_properties = CLScheduler::get().context().getInfo<CL_CONTEXT_PROPERTIES>(nullptr);
+ auto queue_properties = CLScheduler::get().queue().getInfo<CL_QUEUE_PROPERTIES>(nullptr);
- cl::Context::setDefault(cl::Context(CL_DEVICE_TYPE_DEFAULT));
- CLScheduler::get().set_context(cl::Context::getDefault());
+ cl::Context new_ctx = cl::Context(CL_DEVICE_TYPE_DEFAULT, ctx_properties.data());
+ cl::CommandQueue new_queue = cl::CommandQueue(new_ctx, CLKernelLibrary::get().get_device(), queue_properties);
+
+ CLKernelLibrary::get().clear_programs_cache();
+ CLScheduler::get().set_context(new_ctx);
+ CLScheduler::get().set_queue(new_queue);
}
#endif // ARM_COMPUTE_CL
run_test(test_info, *test_factory);
diff --git a/tests/framework/command_line/CommandLineOptions.h b/tests/framework/command_line/CommandLineOptions.h
deleted file mode 100644
index cb4b794..0000000
--- a/tests/framework/command_line/CommandLineOptions.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_COMMANDLINEOPTIONS
-#define ARM_COMPUTE_TEST_COMMANDLINEOPTIONS
-
-#include "EnumListOption.h"
-#include "EnumOption.h"
-#include "ListOption.h"
-#include "Option.h"
-#include "ToggleOption.h"
-
-#endif /* ARM_COMPUTE_TEST_COMMANDLINEOPTIONS */
diff --git a/tests/framework/command_line/CommandLineParser.cpp b/tests/framework/command_line/CommandLineParser.cpp
deleted file mode 100644
index 51efd6d..0000000
--- a/tests/framework/command_line/CommandLineParser.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "CommandLineParser.h"
-
-#include <iostream>
-#include <regex>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-void CommandLineParser::parse(int argc, char **argv)
-{
- const std::regex option_regex{ "--((?:no-)?)([^=]+)(?:=(.*))?" };
-
- const auto set_option = [&](const std::string & option, const std::string & name, const std::string & value)
- {
- if(_options.find(name) == _options.end())
- {
- _unknown_options.push_back(option);
- return;
- }
-
- const bool success = _options[name]->parse(value);
-
- if(!success)
- {
- _invalid_options.push_back(option);
- }
- };
-
- unsigned int positional_index = 0;
-
- for(int i = 1; i < argc; ++i)
- {
- std::string mixed_case_opt{ argv[i] };
- int equal_sign = mixed_case_opt.find('=');
- int pos = (equal_sign == -1) ? strlen(argv[i]) : equal_sign;
-
- const std::string option = tolower(mixed_case_opt.substr(0, pos)) + mixed_case_opt.substr(pos);
- std::smatch option_matches;
-
- if(std::regex_match(option, option_matches, option_regex))
- {
- // Boolean option
- if(option_matches.str(3).empty())
- {
- set_option(option, option_matches.str(2), option_matches.str(1).empty() ? "true" : "false");
- }
- else
- {
- // Can't have "no-" and a value
- if(!option_matches.str(1).empty())
- {
- _invalid_options.emplace_back(option);
- }
- else
- {
- set_option(option, option_matches.str(2), option_matches.str(3));
- }
- }
- }
- else
- {
- if(positional_index >= _positional_options.size())
- {
- _invalid_options.push_back(mixed_case_opt);
- }
- else
- {
- _positional_options[positional_index]->parse(mixed_case_opt);
- ++positional_index;
- }
- }
- }
-}
-
-bool CommandLineParser::validate() const
-{
- bool is_valid = true;
-
- for(const auto &option : _options)
- {
- if(option.second->is_required() && !option.second->is_set())
- {
- is_valid = false;
- std::cerr << "ERROR: Option '" << option.second->name() << "' is required but not given!\n";
- }
- }
-
- for(const auto &option : _positional_options)
- {
- if(option->is_required() && !option->is_set())
- {
- is_valid = false;
- std::cerr << "ERROR: Option '" << option->name() << "' is required but not given!\n";
- }
- }
-
- for(const auto &option : _unknown_options)
- {
- std::cerr << "WARNING: Skipping unknown option '" << option << "'!\n";
- }
-
- for(const auto &option : _invalid_options)
- {
- std::cerr << "WARNING: Skipping invalid option '" << option << "'!\n";
- }
-
- return is_valid;
-}
-
-void CommandLineParser::print_help(const std::string &program_name) const
-{
- std::cout << "usage: " << program_name << " \n";
-
- for(const auto &option : _options)
- {
- std::cout << option.second->help() << "\n";
- }
-
- for(const auto &option : _positional_options)
- {
- std::cout << option->name() << "\n";
- }
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/framework/command_line/CommandLineParser.h b/tests/framework/command_line/CommandLineParser.h
deleted file mode 100644
index adb5214..0000000
--- a/tests/framework/command_line/CommandLineParser.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_COMMANDLINEPARSER
-#define ARM_COMPUTE_TEST_COMMANDLINEPARSER
-
-#include "../Utils.h"
-#include "Option.h"
-
-#include <map>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Class to parse command line arguments. */
-class CommandLineParser final
-{
-public:
- /** Default constructor. */
- CommandLineParser() = default;
-
- /** Function to add a new option to the parser.
- *
- * @param[in] name Name of the option. Will be available under --name=VALUE.
- * @param[in] args Option specific configuration arguments.
- *
- * @return Pointer to the option. The option is owned by the parser.
- */
- template <typename T, typename... As>
- T *add_option(const std::string &name, As &&... args);
-
- /** Function to add a new positional argument to the parser.
- *
- * @param[in] args Option specific configuration arguments.
- *
- * @return Pointer to the option. The option is owned by the parser.
- */
- template <typename T, typename... As>
- T *add_positional_option(As &&... args);
-
- /** Parses the command line arguments and updates the options accordingly.
- *
- * @param[in] argc Number of arguments.
- * @param[in] argv Arguments.
- */
- void parse(int argc, char **argv);
-
- /** Validates the previously parsed command line arguments.
- *
- * Validation fails if not all required options are provided. Additionally
- * warnings are generated for options that have illegal values or unknown
- * options.
- *
- * @return True if all required options have been provided.
- */
- bool validate() const;
-
- /** Prints a help message for all configured options.
- *
- * @param[in] program_name Name of the program to be used in the help message.
- */
- void print_help(const std::string &program_name) const;
-
-private:
- using OptionsMap = std::map<std::string, std::unique_ptr<Option>>;
- using PositionalOptionsVector = std::vector<std::unique_ptr<Option>>;
-
- OptionsMap _options{};
- PositionalOptionsVector _positional_options{};
- std::vector<std::string> _unknown_options{};
- std::vector<std::string> _invalid_options{};
-};
-
-template <typename T, typename... As>
-inline T *CommandLineParser::add_option(const std::string &name, As &&... args)
-{
- auto result = _options.emplace(name, support::cpp14::make_unique<T>(name, std::forward<As>(args)...));
- return static_cast<T *>(result.first->second.get());
-}
-
-template <typename T, typename... As>
-inline T *CommandLineParser::add_positional_option(As &&... args)
-{
- _positional_options.emplace_back(support::cpp14::make_unique<T>(std::forward<As>(args)...));
- return static_cast<T *>(_positional_options.back().get());
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_COMMANDLINEPARSER */
diff --git a/tests/framework/command_line/CommonOptions.cpp b/tests/framework/command_line/CommonOptions.cpp
index e0b93f6..fee18f6 100644
--- a/tests/framework/command_line/CommonOptions.cpp
+++ b/tests/framework/command_line/CommonOptions.cpp
@@ -25,9 +25,10 @@
#include "../Framework.h"
#include "../printers/Printers.h"
-#include "CommandLineParser.h"
#include <unistd.h>
+using namespace arm_compute::utils;
+
namespace arm_compute
{
namespace test
@@ -38,7 +39,6 @@
: help(parser.add_option<ToggleOption>("help")),
instruments(),
iterations(parser.add_option<SimpleOption<int>>("iterations", 1)),
- threads(parser.add_option<SimpleOption<int>>("threads", 1)),
log_format(),
log_file(parser.add_option<SimpleOption<std::string>>("log-file")),
log_level(),
@@ -86,7 +86,6 @@
help->set_help("Show this help message");
instruments->set_help("Set the profiling instruments to use");
iterations->set_help("Number of iterations per test case");
- threads->set_help("Number of threads to use");
log_format->set_help("Output format for measurements and failures (affects only log-file)");
log_file->set_help("Write output to file instead of to the console (affected by log-format)");
log_level->set_help("Verbosity of the output");
diff --git a/tests/framework/command_line/CommonOptions.h b/tests/framework/command_line/CommonOptions.h
index 651316c..f4646a0 100644
--- a/tests/framework/command_line/CommonOptions.h
+++ b/tests/framework/command_line/CommonOptions.h
@@ -25,7 +25,10 @@
#define ARM_COMPUTE_TEST_COMMONOPTIONS
#include "../instruments/Instruments.h"
-#include "CommandLineOptions.h"
+
+#include "utils/command_line/CommandLineOptions.h"
+#include "utils/command_line/CommandLineParser.h"
+
#include <memory>
namespace arm_compute
@@ -34,7 +37,6 @@
{
namespace framework
{
-class CommandLineParser;
class Printer;
enum class LogFormat;
enum class LogLevel;
@@ -56,7 +58,7 @@
*
* @param[in,out] parser A parser on which "parse()" hasn't been called yet.
*/
- CommonOptions(CommandLineParser &parser);
+ CommonOptions(arm_compute::utils::CommandLineParser &parser);
/** Prevent instances of this class from being copy constructed */
CommonOptions(const CommonOptions &) = delete;
/** Prevent instances of this class from being copied */
@@ -69,19 +71,18 @@
*/
std::vector<std::unique_ptr<Printer>> create_printers();
- ToggleOption *help; /**< Show help option */
- EnumListOption<InstrumentsDescription> *instruments; /**< Instruments option */
- SimpleOption<int> *iterations; /**< Number of iterations option */
- SimpleOption<int> *threads; /**< Number of threads option */
- EnumOption<LogFormat> *log_format; /**< Log format option */
- SimpleOption<std::string> *log_file; /**< Log file option */
- EnumOption<LogLevel> *log_level; /**< Logging level option */
- ToggleOption *throw_errors; /**< Throw errors option */
- ToggleOption *color_output; /**< Color output option */
- ToggleOption *pretty_console; /**< Pretty console option */
- SimpleOption<std::string> *json_file; /**< JSON output file option */
- SimpleOption<std::string> *pretty_file; /**< Pretty output file option */
- std::vector<std::shared_ptr<std::ofstream>> log_streams; /**< Log streams */
+ arm_compute::utils::ToggleOption *help; /**< Show help option */
+ arm_compute::utils::EnumListOption<InstrumentsDescription> *instruments; /**< Instruments option */
+ arm_compute::utils::SimpleOption<int> *iterations; /**< Number of iterations option */
+ arm_compute::utils::EnumOption<LogFormat> *log_format; /**< Log format option */
+ arm_compute::utils::SimpleOption<std::string> *log_file; /**< Log file option */
+ arm_compute::utils::EnumOption<LogLevel> *log_level; /**< Logging level option */
+ arm_compute::utils::ToggleOption *throw_errors; /**< Throw errors option */
+ arm_compute::utils::ToggleOption *color_output; /**< Color output option */
+ arm_compute::utils::ToggleOption *pretty_console; /**< Pretty console option */
+ arm_compute::utils::SimpleOption<std::string> *json_file; /**< JSON output file option */
+ arm_compute::utils::SimpleOption<std::string> *pretty_file; /**< Pretty output file option */
+ std::vector<std::shared_ptr<std::ofstream>> log_streams; /**< Log streams */
};
} // namespace framework
diff --git a/tests/framework/command_line/EnumListOption.h b/tests/framework/command_line/EnumListOption.h
deleted file mode 100644
index 39006d8..0000000
--- a/tests/framework/command_line/EnumListOption.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_ENUMLISTOPTION
-#define ARM_COMPUTE_TEST_ENUMLISTOPTION
-
-#include "Option.h"
-
-#include <initializer_list>
-#include <set>
-#include <sstream>
-#include <stdexcept>
-#include <string>
-#include <vector>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Implementation of an option that accepts any number of values from a fixed set. */
-template <typename T>
-class EnumListOption : public Option
-{
-public:
- /** Construct option with allowed values.
- *
- * @param[in] name Name of the option.
- * @param[in] allowed_values Set of allowed values for the option.
- */
- EnumListOption(std::string name, std::set<T> allowed_values);
-
- /** Construct option with allowed values, a fixed number of accepted values and default values for the option.
- *
- * @param[in] name Name of the option.
- * @param[in] allowed_values Set of allowed values for the option.
- * @param[in] default_values Default values.
- */
- EnumListOption(std::string name, std::set<T> allowed_values, std::initializer_list<T> &&default_values);
-
- bool parse(std::string value) override;
- std::string help() const override;
-
- /** Get the values of the option.
- *
- * @return a list of the selected option values.
- */
- const std::vector<T> &value() const;
-
-private:
- std::vector<T> _values{};
- std::set<T> _allowed_values{};
-};
-
-template <typename T>
-inline EnumListOption<T>::EnumListOption(std::string name, std::set<T> allowed_values)
- : Option{ std::move(name) }, _allowed_values{ std::move(allowed_values) }
-{
-}
-
-template <typename T>
-inline EnumListOption<T>::EnumListOption(std::string name, std::set<T> allowed_values, std::initializer_list<T> &&default_values)
- : Option{ std::move(name), false, true }, _values{ std::forward<std::initializer_list<T>>(default_values) }, _allowed_values{ std::move(allowed_values) }
-{
-}
-
-template <typename T>
-bool EnumListOption<T>::parse(std::string value)
-{
- // Remove default values
- _values.clear();
- _is_set = true;
-
- std::stringstream stream{ value };
- std::string item;
-
- while(!std::getline(stream, item, ',').fail())
- {
- try
- {
- std::stringstream item_stream(item);
- T typed_value{};
-
- item_stream >> typed_value;
-
- if(!item_stream.fail())
- {
- if(_allowed_values.count(typed_value) == 0)
- {
- _is_set = false;
- continue;
- }
-
- _values.emplace_back(typed_value);
- }
-
- _is_set = _is_set && !item_stream.fail();
- }
- catch(const std::invalid_argument &)
- {
- _is_set = false;
- }
- }
-
- return _is_set;
-}
-
-template <typename T>
-std::string EnumListOption<T>::help() const
-{
- std::stringstream msg;
- msg << "--" + name() + "={";
-
- for(const auto &value : _allowed_values)
- {
- msg << value << ",";
- }
-
- msg << "}[,{...}[,...]] - " << _help;
-
- return msg.str();
-}
-
-template <typename T>
-inline const std::vector<T> &EnumListOption<T>::value() const
-{
- return _values;
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_ENUMLISTOPTION */
diff --git a/tests/framework/command_line/EnumOption.h b/tests/framework/command_line/EnumOption.h
deleted file mode 100644
index 14d6185..0000000
--- a/tests/framework/command_line/EnumOption.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_ENUMOPTION
-#define ARM_COMPUTE_TEST_ENUMOPTION
-
-#include "SimpleOption.h"
-
-#include <set>
-#include <sstream>
-#include <stdexcept>
-#include <string>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Implementation of a simple option that accepts a value from a fixed set. */
-template <typename T>
-class EnumOption : public SimpleOption<T>
-{
-public:
- /** Construct option with allowed values.
- *
- * @param[in] name Name of the option.
- * @param[in] allowed_values Set of allowed values for the option.
- */
- EnumOption(std::string name, std::set<T> allowed_values);
-
- /** Construct option with allowed values, a fixed number of accepted values and default values for the option.
- *
- * @param[in] name Name of the option.
- * @param[in] allowed_values Set of allowed values for the option.
- * @param[in] default_value Default value.
- */
- EnumOption(std::string name, std::set<T> allowed_values, T default_value);
-
- bool parse(std::string value) override;
- std::string help() const override;
-
- /** Get the selected value.
- *
- * @return get the selected enum value.
- */
- const T &value() const;
-
-private:
- std::set<T> _allowed_values{};
-};
-
-template <typename T>
-inline EnumOption<T>::EnumOption(std::string name, std::set<T> allowed_values)
- : SimpleOption<T>{ std::move(name) }, _allowed_values{ std::move(allowed_values) }
-{
-}
-
-template <typename T>
-inline EnumOption<T>::EnumOption(std::string name, std::set<T> allowed_values, T default_value)
- : SimpleOption<T>{ std::move(name), std::move(default_value) }, _allowed_values{ std::move(allowed_values) }
-{
-}
-
-template <typename T>
-bool EnumOption<T>::parse(std::string value)
-{
- try
- {
- std::stringstream stream{ value };
- T typed_value{};
-
- stream >> typed_value;
-
- if(!stream.fail())
- {
- if(_allowed_values.count(typed_value) == 0)
- {
- return false;
- }
-
- this->_value = std::move(typed_value);
- this->_is_set = true;
- return true;
- }
-
- return false;
- }
- catch(const std::invalid_argument &)
- {
- return false;
- }
-}
-
-template <typename T>
-std::string EnumOption<T>::help() const
-{
- std::stringstream msg;
- msg << "--" + this->name() + "={";
-
- for(const auto &value : _allowed_values)
- {
- msg << value << ",";
- }
-
- msg << "} - " << this->_help;
-
- return msg.str();
-}
-
-template <typename T>
-inline const T &EnumOption<T>::value() const
-{
- return this->_value;
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_ENUMOPTION */
diff --git a/tests/framework/command_line/ListOption.h b/tests/framework/command_line/ListOption.h
deleted file mode 100644
index 07184e8..0000000
--- a/tests/framework/command_line/ListOption.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_LISTOPTION
-#define ARM_COMPUTE_TEST_LISTOPTION
-
-#include "Option.h"
-
-#include <initializer_list>
-#include <sstream>
-#include <stdexcept>
-#include <string>
-#include <vector>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Implementation of an option that accepts any number of values. */
-template <typename T>
-class ListOption : public Option
-{
-public:
- using Option::Option;
-
- /** Construct the option with the given default values.
- *
- * @param[in] name Name of the option.
- * @param[in] default_values Default values.
- */
- ListOption(std::string name, std::initializer_list<T> &&default_values);
-
- bool parse(std::string value) override;
- std::string help() const override;
-
- /** Get the list of option values.
- *
- * @return get the list of option values.
- */
- const std::vector<T> &value() const;
-
-private:
- std::vector<T> _values{};
-};
-
-template <typename T>
-inline ListOption<T>::ListOption(std::string name, std::initializer_list<T> &&default_values)
- : Option{ std::move(name), false, true }, _values{ std::forward<std::initializer_list<T>>(default_values) }
-{
-}
-
-template <typename T>
-bool ListOption<T>::parse(std::string value)
-{
- _is_set = true;
-
- try
- {
- std::stringstream stream{ value };
- std::string item;
-
- while(!std::getline(stream, item, ',').fail())
- {
- std::stringstream item_stream(item);
- T typed_value{};
-
- item_stream >> typed_value;
-
- if(!item_stream.fail())
- {
- _values.emplace_back(typed_value);
- }
-
- _is_set = _is_set && !item_stream.fail();
- }
-
- return _is_set;
- }
- catch(const std::invalid_argument &)
- {
- return false;
- }
-}
-
-template <typename T>
-inline std::string ListOption<T>::help() const
-{
- return "--" + name() + "=VALUE[,VALUE[,...]] - " + _help;
-}
-
-template <typename T>
-inline const std::vector<T> &ListOption<T>::value() const
-{
- return _values;
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_LISTOPTION */
diff --git a/tests/framework/command_line/Option.cpp b/tests/framework/command_line/Option.cpp
deleted file mode 100644
index d60c35a..0000000
--- a/tests/framework/command_line/Option.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "Option.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-Option::Option(std::string name)
- : _name{ std::move(name) }
-{
-}
-
-Option::Option(std::string name, bool is_required, bool is_set)
- : _name{ std::move(name) }, _is_required{ is_required }, _is_set{ is_set }
-{
-}
-
-std::string Option::name() const
-{
- return _name;
-}
-
-void Option::set_required(bool is_required)
-{
- _is_required = is_required;
-}
-
-void Option::set_help(std::string help)
-{
- _help = std::move(help);
-}
-
-bool Option::is_required() const
-{
- return _is_required;
-}
-
-bool Option::is_set() const
-{
- return _is_set;
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/framework/command_line/Option.h b/tests/framework/command_line/Option.h
deleted file mode 100644
index 25cf492..0000000
--- a/tests/framework/command_line/Option.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_OPTIONBASE
-#define ARM_COMPUTE_TEST_OPTIONBASE
-
-#include <string>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Abstract base class for a command line option. */
-class Option
-{
-public:
- /** Constructor.
- *
- * @param[in] name Name of the option.
- */
- Option(std::string name);
-
- /** Constructor.
- *
- * @param[in] name Name of the option.
- * @param[in] is_required Is the option required?
- * @param[in] is_set Has a value been assigned to the option?
- */
- Option(std::string name, bool is_required, bool is_set);
-
- /** Default destructor. */
- virtual ~Option() = default;
-
- /** Parses the given string.
- *
- * @param[in] value String representation as passed on the command line.
- *
- * @return True if the value could be parsed by the specific subclass.
- */
- virtual bool parse(std::string value) = 0;
-
- /** Help message for the option.
- *
- * @return String representing the help message for the specific subclass.
- */
- virtual std::string help() const = 0;
-
- /** Name of the option.
- *
- * @return Name of the option.
- */
- std::string name() const;
-
- /** Set whether the option is required.
- *
- * @param[in] is_required Pass true if the option is required.
- */
- void set_required(bool is_required);
-
- /** Set the help message for the option.
- *
- * @param[in] help Option specific help message.
- */
- void set_help(std::string help);
-
- /** Is the option required?
- *
- * @return True if the option is required.
- */
- bool is_required() const;
-
- /** Has a value been assigned to the option?
- *
- * @return True if a value has been set.
- */
- bool is_set() const;
-
-protected:
- std::string _name;
- bool _is_required{ false };
- bool _is_set{ false };
- std::string _help{};
-};
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_OPTIONBASE */
diff --git a/tests/framework/command_line/SimpleOption.h b/tests/framework/command_line/SimpleOption.h
deleted file mode 100644
index d02778e..0000000
--- a/tests/framework/command_line/SimpleOption.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_SIMPLEOPTION
-#define ARM_COMPUTE_TEST_SIMPLEOPTION
-
-#include "Option.h"
-
-#include <sstream>
-#include <stdexcept>
-#include <string>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Implementation of an option that accepts a single value. */
-template <typename T>
-class SimpleOption : public Option
-{
-public:
- using Option::Option;
-
- /** Construct the option with the given default value.
- *
- * @param[in] name Name of the option.
- * @param[in] default_value Default value.
- */
- SimpleOption(std::string name, T default_value);
-
- /** Parses the given string.
- *
- * @param[in] value String representation as passed on the command line.
- *
- * @return True if the value could be parsed by the specific subclass.
- */
- bool parse(std::string value) override;
-
- /** Help message for the option.
- *
- * @return String representing the help message for the specific subclass.
- */
- std::string help() const override;
-
- /** Get the option value.
- *
- * @return the option value.
- */
- const T &value() const;
-
-protected:
- T _value{};
-};
-
-template <typename T>
-inline SimpleOption<T>::SimpleOption(std::string name, T default_value)
- : Option{ std::move(name), false, true }, _value{ std::move(default_value) }
-{
-}
-
-template <typename T>
-bool SimpleOption<T>::parse(std::string value)
-{
- try
- {
- std::stringstream stream{ std::move(value) };
- stream >> _value;
- _is_set = !stream.fail();
- return _is_set;
- }
- catch(const std::invalid_argument &)
- {
- return false;
- }
-}
-
-template <>
-inline bool SimpleOption<std::string>::parse(std::string value)
-{
- _value = std::move(value);
- _is_set = true;
- return true;
-}
-
-template <typename T>
-inline std::string SimpleOption<T>::help() const
-{
- return "--" + name() + "=VALUE - " + _help;
-}
-
-template <typename T>
-inline const T &SimpleOption<T>::value() const
-{
- return _value;
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_SIMPLEOPTION */
diff --git a/tests/framework/command_line/ToggleOption.cpp b/tests/framework/command_line/ToggleOption.cpp
deleted file mode 100644
index df5b1f8..0000000
--- a/tests/framework/command_line/ToggleOption.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "ToggleOption.h"
-
-#include <utility>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-ToggleOption::ToggleOption(std::string name, bool default_value)
- : SimpleOption<bool>
-{
- std::move(name), default_value
-}
-{
-}
-
-bool ToggleOption::parse(std::string value)
-{
- if(value == "true")
- {
- _value = true;
- _is_set = true;
- }
- else if(value == "false")
- {
- _value = false;
- _is_set = true;
- }
-
- return _is_set;
-}
-
-std::string ToggleOption::help() const
-{
- return "--" + name() + ", --no-" + name() + " - " + _help;
-}
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/framework/command_line/ToggleOption.h b/tests/framework/command_line/ToggleOption.h
deleted file mode 100644
index c440c0e..0000000
--- a/tests/framework/command_line/ToggleOption.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_TOGGLEOPTION
-#define ARM_COMPUTE_TEST_TOGGLEOPTION
-
-#include "SimpleOption.h"
-
-#include <string>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace framework
-{
-/** Implementation of an option that can be either true or false. */
-class ToggleOption : public SimpleOption<bool>
-{
-public:
- using SimpleOption::SimpleOption;
-
- /** Construct the option with the given default value.
- *
- * @param[in] name Name of the option.
- * @param[in] default_value Default value.
- */
- ToggleOption(std::string name, bool default_value);
-
- bool parse(std::string value) override;
- std::string help() const override;
-};
-} // namespace framework
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_TOGGLEOPTION */
diff --git a/tests/framework/datasets/ContainerDataset.h b/tests/framework/datasets/ContainerDataset.h
index 8dfd216..20af8a4 100644
--- a/tests/framework/datasets/ContainerDataset.h
+++ b/tests/framework/datasets/ContainerDataset.h
@@ -26,6 +26,7 @@
#include "Dataset.h"
#include "support/ToolchainSupport.h"
+#include "tests/TypePrinter.h"
#include <string>
#include <tuple>
diff --git a/tests/framework/datasets/InitializerListDataset.h b/tests/framework/datasets/InitializerListDataset.h
index f90e0b7..ec1550d 100644
--- a/tests/framework/datasets/InitializerListDataset.h
+++ b/tests/framework/datasets/InitializerListDataset.h
@@ -25,7 +25,7 @@
#define ARM_COMPUTE_TEST_DATASET_LIST
#include "Dataset.h"
-#include "support/ToolchainSupport.h"
+#include "utils/TypePrinter.h"
#include <initializer_list>
#include <string>
@@ -84,8 +84,7 @@
*/
std::string description() const
{
- using support::cpp11::to_string;
- return _name + "=" + to_string(*_iterator);
+ return _name + "=" + arm_compute::to_string(*_iterator);
}
/** Get the current value.
diff --git a/tests/framework/instruments/SchedulerTimer.cpp b/tests/framework/instruments/SchedulerTimer.cpp
index 1b37b18..50d77dd 100644
--- a/tests/framework/instruments/SchedulerTimer.cpp
+++ b/tests/framework/instruments/SchedulerTimer.cpp
@@ -63,10 +63,10 @@
_prefix = std::move(prefix);
}
- void schedule(ICPPKernel *kernel, unsigned int split_dimension) override
+ void schedule(ICPPKernel *kernel, const Hints &hints) override
{
_timer.start();
- _real_scheduler.schedule(kernel, split_dimension);
+ _real_scheduler.schedule(kernel, hints.split_dimension());
_timer.stop();
SchedulerTimer::kernel_info info;
@@ -76,6 +76,19 @@
_kernels.push_back(std::move(info));
}
+ void run_workloads(std::vector<Workload> &workloads) override
+ {
+ _timer.start();
+ _real_scheduler.run_workloads(workloads);
+ _timer.stop();
+
+ SchedulerTimer::kernel_info info;
+ info.name = "Unknown";
+ info.prefix = _prefix;
+ info.measurements = _timer.measurements();
+ _kernels.push_back(std::move(info));
+ }
+
private:
std::list<SchedulerTimer::kernel_info> &_kernels;
IScheduler &_real_scheduler;
diff --git a/tests/main.cpp b/tests/main.cpp
index 4a8a82d..13f5aff 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -28,14 +28,15 @@
#include "tests/framework/Framework.h"
#include "tests/framework/Macros.h"
#include "tests/framework/Profiler.h"
-#include "tests/framework/command_line/CommandLineOptions.h"
-#include "tests/framework/command_line/CommandLineParser.h"
#include "tests/framework/command_line/CommonOptions.h"
#include "tests/framework/instruments/Instruments.h"
#include "tests/framework/printers/Printers.h"
+#include "utils/command_line/CommandLineOptions.h"
+#include "utils/command_line/CommandLineParser.h"
#ifdef ARM_COMPUTE_CL
#include "arm_compute/runtime/CL/CLScheduler.h"
+#include "arm_compute/runtime/CL/CLTuner.h"
#endif /* ARM_COMPUTE_CL */
#ifdef ARM_COMPUTE_GC
#include "arm_compute/runtime/GLES_COMPUTE/GCScheduler.h"
@@ -52,6 +53,18 @@
using namespace arm_compute;
using namespace arm_compute::test;
+namespace
+{
+std::string command_line(int argc, char **argv)
+{
+ std::stringstream ss;
+ for(int i = 0; i < argc; i++)
+ {
+ ss << argv[i] << " ";
+ }
+ return ss.str();
+}
+} // namespace
namespace arm_compute
{
namespace test
@@ -60,10 +73,25 @@
} // namespace test
} // namespace arm_compute
+namespace
+{
+#ifdef ARM_COMPUTE_CL
+bool file_exists(const std::string &filename)
+{
+ std::ifstream file(filename);
+ return file.good();
+}
+#endif /* ARM_COMPUTE_CL */
+} //namespace
+
int main(int argc, char **argv)
{
#ifdef ARM_COMPUTE_CL
- CLScheduler::get().default_init();
+ CLTuner cl_tuner(false);
+ if(opencl_is_available())
+ {
+ CLScheduler::get().default_init(&cl_tuner);
+ }
#endif /* ARM_COMPUTE_CL */
#ifdef ARM_COMPUTE_GC
@@ -72,7 +100,7 @@
framework::Framework &framework = framework::Framework::get();
- framework::CommandLineParser parser;
+ utils::CommandLineParser parser;
std::set<framework::DatasetMode> allowed_modes
{
@@ -83,24 +111,32 @@
framework::CommonOptions options(parser);
- auto dataset_mode = parser.add_option<framework::EnumOption<framework::DatasetMode>>("mode", allowed_modes, framework::DatasetMode::PRECOMMIT);
+ auto dataset_mode = parser.add_option<utils::EnumOption<framework::DatasetMode>>("mode", allowed_modes, framework::DatasetMode::PRECOMMIT);
dataset_mode->set_help("For managed datasets select which group to use");
- auto filter = parser.add_option<framework::SimpleOption<std::string>>("filter", ".*");
+ auto filter = parser.add_option<utils::SimpleOption<std::string>>("filter", ".*");
filter->set_help("Regular expression to select test cases");
- auto filter_id = parser.add_option<framework::SimpleOption<std::string>>("filter-id");
+ auto filter_id = parser.add_option<utils::SimpleOption<std::string>>("filter-id");
filter_id->set_help("List of test ids. ... can be used to define a range.");
- auto stop_on_error = parser.add_option<framework::ToggleOption>("stop-on-error");
+ auto stop_on_error = parser.add_option<utils::ToggleOption>("stop-on-error");
stop_on_error->set_help("Abort execution after the first failed test (useful for debugging)");
- auto seed = parser.add_option<framework::SimpleOption<std::random_device::result_type>>("seed", std::random_device()());
+ auto seed = parser.add_option<utils::SimpleOption<std::random_device::result_type>>("seed", std::random_device()());
seed->set_help("Global seed for random number generation");
- auto list_tests = parser.add_option<framework::ToggleOption>("list-tests", false);
+ auto list_tests = parser.add_option<utils::ToggleOption>("list-tests", false);
list_tests->set_help("List all test names");
- auto test_instruments = parser.add_option<framework::ToggleOption>("test-instruments", false);
+ auto test_instruments = parser.add_option<utils::ToggleOption>("test-instruments", false);
test_instruments->set_help("Test if the instruments work on the platform");
- auto error_on_missing_assets = parser.add_option<framework::ToggleOption>("error-on-missing-assets", false);
+ auto error_on_missing_assets = parser.add_option<utils::ToggleOption>("error-on-missing-assets", false);
error_on_missing_assets->set_help("Mark a test as failed instead of skipping it when assets are missing");
- auto assets = parser.add_positional_option<framework::SimpleOption<std::string>>("assets");
+ auto assets = parser.add_positional_option<utils::SimpleOption<std::string>>("assets");
assets->set_help("Path to the assets directory");
+#ifdef ARM_COMPUTE_CL
+ auto enable_tuner = parser.add_option<utils::ToggleOption>("enable-tuner");
+ enable_tuner->set_help("Enable OpenCL dynamic tuner");
+ auto tuner_file = parser.add_option<utils::SimpleOption<std::string>>("tuner-file", "");
+ tuner_file->set_help("File to load/save CLTuner values");
+#endif /* ARM_COMPUTE_CL */
+ auto threads = parser.add_option<utils::SimpleOption<int>>("threads", 1);
+ threads->set_help("Number of threads to use");
try
{
@@ -114,8 +150,23 @@
std::vector<std::unique_ptr<framework::Printer>> printers = options.create_printers();
- Scheduler::get().set_num_threads(options.threads->value());
-
+ Scheduler::get().set_num_threads(threads->value());
+#ifdef ARM_COMPUTE_CL
+ if(enable_tuner->is_set())
+ {
+ cl_tuner.set_tune_new_kernels(enable_tuner->value());
+ // If that's the first run then the file won't exist yet
+ if(file_exists(tuner_file->value()))
+ {
+ cl_tuner.load_from_file(tuner_file->value());
+ }
+ }
+ else if(!tuner_file->value().empty())
+ {
+ //If we're not tuning and the file doesn't exist then we should raise an error:
+ cl_tuner.load_from_file(tuner_file->value());
+ }
+#endif /* ARM_COMPUTE_CL */
if(options.log_level->value() > framework::LogLevel::NONE)
{
for(auto &p : printers)
@@ -129,6 +180,7 @@
for(auto &p : printers)
{
p->print_entry("Version", build_information());
+ p->print_entry("CommandLine", command_line(argc, argv));
p->print_entry("Seed", support::cpp11::to_string(seed->value()));
#ifdef ARM_COMPUTE_CL
if(opencl_is_available())
@@ -141,7 +193,7 @@
}
#endif /* ARM_COMPUTE_CL */
p->print_entry("Iterations", support::cpp11::to_string(options.iterations->value()));
- p->print_entry("Threads", support::cpp11::to_string(options.threads->value()));
+ p->print_entry("Threads", support::cpp11::to_string(threads->value()));
{
using support::cpp11::to_string;
p->print_entry("Dataset mode", to_string(dataset_mode->value()));
@@ -202,7 +254,14 @@
}
#ifdef ARM_COMPUTE_CL
- CLScheduler::get().sync();
+ if(opencl_is_available())
+ {
+ CLScheduler::get().sync();
+ if(enable_tuner->is_set() && enable_tuner->value() && tuner_file->is_set())
+ {
+ cl_tuner.save_to_file(tuner_file->value());
+ }
+ }
#endif /* ARM_COMPUTE_CL */
return (success ? 0 : 1);
diff --git a/tests/networks/AlexNetNetwork.h b/tests/networks/AlexNetNetwork.h
deleted file mode 100644
index fa3734d..0000000
--- a/tests/networks/AlexNetNetwork.h
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_TEST_MODEL_OBJECTS_ALEXNET_H__
-#define __ARM_COMPUTE_TEST_MODEL_OBJECTS_ALEXNET_H__
-
-#include "arm_compute/runtime/NEON/NEScheduler.h"
-#include "arm_compute/runtime/Tensor.h"
-
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/Utils.h"
-
-#include <memory>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace networks
-{
-/** AlexNet model object */
-template <typename ITensorType,
- typename TensorType,
- typename SubTensorType,
- typename Accessor,
- typename ActivationLayerFunction,
- typename ConvolutionLayerFunction,
- typename DirectConvolutionLayerFunction,
- typename FullyConnectedLayerFunction,
- typename NormalizationLayerFunction,
- typename PoolingLayerFunction,
- typename SoftmaxLayerFunction>
-class AlexNetNetwork
-{
-public:
- /** Initialize the network.
- *
- * @param[in] data_type Data type.
- * @param[in] fixed_point_position Fixed point position (for quantized data types).
- * @param[in] batches Number of batches.
- * @param[in] reshaped_weights Whether the weights need reshaping or not. Default: false.
- */
- void init(DataType data_type, int fixed_point_position, int batches, bool reshaped_weights = false)
- {
- _data_type = data_type;
- _fixed_point_position = fixed_point_position;
- _batches = batches;
- _reshaped_weights = reshaped_weights;
-
- // Initialize weights and biases
- if(!_reshaped_weights)
- {
- w[0].allocator()->init(TensorInfo(TensorShape(11U, 11U, 3U, 96U), 1, _data_type, _fixed_point_position));
- b[0].allocator()->init(TensorInfo(TensorShape(96U), 1, _data_type, _fixed_point_position));
- w[1].allocator()->init(TensorInfo(TensorShape(5U, 5U, 48U, 256U), 1, _data_type, _fixed_point_position));
- b[1].allocator()->init(TensorInfo(TensorShape(256U), 1, _data_type, _fixed_point_position));
- w[2].allocator()->init(TensorInfo(TensorShape(3U, 3U, 256U, 384U), 1, _data_type, _fixed_point_position));
- b[2].allocator()->init(TensorInfo(TensorShape(384U), 1, _data_type, _fixed_point_position));
- w[3].allocator()->init(TensorInfo(TensorShape(3U, 3U, 192U, 384U), 1, _data_type, _fixed_point_position));
- b[3].allocator()->init(TensorInfo(TensorShape(384U), 1, _data_type, _fixed_point_position));
- w[4].allocator()->init(TensorInfo(TensorShape(3U, 3U, 192U, 256U), 1, _data_type, _fixed_point_position));
- b[4].allocator()->init(TensorInfo(TensorShape(256U), 1, _data_type, _fixed_point_position));
- w[5].allocator()->init(TensorInfo(TensorShape(9216U, 4096U), 1, _data_type, _fixed_point_position));
- b[5].allocator()->init(TensorInfo(TensorShape(4096U), 1, _data_type, _fixed_point_position));
- w[6].allocator()->init(TensorInfo(TensorShape(4096U, 4096U), 1, _data_type, _fixed_point_position));
- b[6].allocator()->init(TensorInfo(TensorShape(4096U), 1, _data_type, _fixed_point_position));
- w[7].allocator()->init(TensorInfo(TensorShape(4096U, 1000U), 1, _data_type, _fixed_point_position));
- b[7].allocator()->init(TensorInfo(TensorShape(1000U), 1, _data_type, _fixed_point_position));
-
- w11 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[1], TensorShape(5U, 5U, 48U, 128U), Coordinates()));
- w12 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[1], TensorShape(5U, 5U, 48U, 128U), Coordinates(0, 0, 0, 128)));
- b11 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[1], TensorShape(128U), Coordinates(), true));
- b12 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[1], TensorShape(128U), Coordinates(128), true));
-
- w31 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[3], TensorShape(3U, 3U, 192U, 192U), Coordinates()));
- w32 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[3], TensorShape(3U, 3U, 192U, 192U), Coordinates(0, 0, 0, 192)));
- b31 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[3], TensorShape(192U), Coordinates(), true));
- b32 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[3], TensorShape(192U), Coordinates(192), true));
-
- w41 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[4], TensorShape(3U, 3U, 192U, 128U), Coordinates()));
- w42 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[4], TensorShape(3U, 3U, 192U, 128U), Coordinates(0, 0, 0, 128)));
- b41 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[4], TensorShape(128U), Coordinates(), true));
- b42 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[4], TensorShape(128U), Coordinates(128), true));
- }
- else
- {
- auto reshape = [&](unsigned int width, unsigned int height, bool convolution_layer) -> TensorShape
- {
- const bool is_optimised = std::is_same<ITensorType, ITensor>::value && data_type == DataType::F32;
-
- if(convolution_layer && is_optimised)
- {
- return TensorShape{ height, width };
- }
- else
- {
- const int interleave_width = 16 / arm_compute::data_size_from_type(_data_type);
-
- return TensorShape{ width * interleave_width, static_cast<unsigned int>(std::ceil(static_cast<float>(height) / interleave_width)) };
- }
- };
-
- // Create tensor for the reshaped weights
- w[0].allocator()->init(TensorInfo(reshape(366U, 96U, true), 1, _data_type, _fixed_point_position));
-
- // Configure the direct convolution's weights. Direct convolution doesn't need reshape weights
- if(!_is_direct_conv)
- {
- auto w11_tensor = std::unique_ptr<TensorType>(new TensorType());
- auto w12_tensor = std::unique_ptr<TensorType>(new TensorType());
- auto w31_tensor = std::unique_ptr<TensorType>(new TensorType());
- auto w32_tensor = std::unique_ptr<TensorType>(new TensorType());
- auto w41_tensor = std::unique_ptr<TensorType>(new TensorType());
- auto w42_tensor = std::unique_ptr<TensorType>(new TensorType());
- w11_tensor->allocator()->init(TensorInfo(reshape(1248U, 128U, true), 1, _data_type, _fixed_point_position));
- w12_tensor->allocator()->init(TensorInfo(reshape(1248U, 128U, true), 1, _data_type, _fixed_point_position));
- w31_tensor->allocator()->init(TensorInfo(reshape(1920U, 192U, true), 1, _data_type, _fixed_point_position));
- w32_tensor->allocator()->init(TensorInfo(reshape(1920U, 192U, true), 1, _data_type, _fixed_point_position));
- w41_tensor->allocator()->init(TensorInfo(reshape(1920U, 128U, true), 1, _data_type, _fixed_point_position));
- w42_tensor->allocator()->init(TensorInfo(reshape(1920U, 128U, true), 1, _data_type, _fixed_point_position));
- w[2].allocator()->init(TensorInfo(reshape(2560U, 384U, true), 1, _data_type, _fixed_point_position));
- w11 = std::move(w11_tensor);
- w12 = std::move(w12_tensor);
- w31 = std::move(w31_tensor);
- w32 = std::move(w32_tensor);
- w41 = std::move(w41_tensor);
- w42 = std::move(w42_tensor);
- }
- else
- {
- w[1].allocator()->init(TensorInfo(TensorShape(5U, 5U, 48U, 256U), 1, _data_type, _fixed_point_position));
- b[1].allocator()->init(TensorInfo(TensorShape(256U), 1, _data_type, _fixed_point_position));
- w[2].allocator()->init(TensorInfo(TensorShape(3U, 3U, 256U, 384U), 1, _data_type, _fixed_point_position));
- b[2].allocator()->init(TensorInfo(TensorShape(384U), 1, _data_type, _fixed_point_position));
- w[3].allocator()->init(TensorInfo(TensorShape(3U, 3U, 192U, 384U), 1, _data_type, _fixed_point_position));
- b[3].allocator()->init(TensorInfo(TensorShape(384U), 1, _data_type, _fixed_point_position));
- w[4].allocator()->init(TensorInfo(TensorShape(3U, 3U, 192U, 256U), 1, _data_type, _fixed_point_position));
- b[4].allocator()->init(TensorInfo(TensorShape(256U), 1, _data_type, _fixed_point_position));
- w11 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[1], TensorShape(5U, 5U, 48U, 128U), Coordinates()));
- w12 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[1], TensorShape(5U, 5U, 48U, 128U), Coordinates(0, 0, 0, 128)));
- b11 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[1], TensorShape(128U), Coordinates()));
- b12 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[1], TensorShape(128U), Coordinates(128)));
-
- w31 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[3], TensorShape(3U, 3U, 192U, 192U), Coordinates()));
- w32 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[3], TensorShape(3U, 3U, 192U, 192U), Coordinates(0, 0, 0, 192)));
- b31 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[3], TensorShape(192U), Coordinates()));
- b32 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[3], TensorShape(192U), Coordinates(192)));
-
- w41 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[4], TensorShape(3U, 3U, 192U, 128U), Coordinates()));
- w42 = std::unique_ptr<SubTensorType>(new SubTensorType(&w[4], TensorShape(3U, 3U, 192U, 128U), Coordinates(0, 0, 0, 128)));
- b41 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[4], TensorShape(128U), Coordinates()));
- b42 = std::unique_ptr<SubTensorType>(new SubTensorType(&b[4], TensorShape(128U), Coordinates(128)));
- }
-
- b[5].allocator()->init(TensorInfo(TensorShape(4096U), 1, _data_type, _fixed_point_position));
- b[6].allocator()->init(TensorInfo(TensorShape(4096U), 1, _data_type, _fixed_point_position));
- b[7].allocator()->init(TensorInfo(TensorShape(1000U), 1, _data_type, _fixed_point_position));
-
- if(_batches > 1 && std::is_same<TensorType, Tensor>::value)
- {
- w[5].allocator()->init(TensorInfo(reshape(9216U, 4096U, false), 1, _data_type, _fixed_point_position));
- w[6].allocator()->init(TensorInfo(reshape(4096U, 4096U, false), 1, _data_type, _fixed_point_position));
- w[7].allocator()->init(TensorInfo(reshape(4096U, 1000U, false), 1, _data_type, _fixed_point_position));
- }
- else
- {
- w[5].allocator()->init(TensorInfo(TensorShape(4096U, 9216U), 1, _data_type, _fixed_point_position));
- w[6].allocator()->init(TensorInfo(TensorShape(4096U, 4096U), 1, _data_type, _fixed_point_position));
- w[7].allocator()->init(TensorInfo(TensorShape(1000U, 4096U), 1, _data_type, _fixed_point_position));
- }
- }
- }
-
- /** Build the network */
- void build()
- {
- input.allocator()->init(TensorInfo(TensorShape(227U, 227U, 3U, _batches), 1, _data_type, _fixed_point_position));
- output.allocator()->init(TensorInfo(TensorShape(1000U, _batches), 1, _data_type, _fixed_point_position));
-
- // Initialize intermediate tensors
- // Layer 1
- conv1_out.allocator()->init(TensorInfo(TensorShape(55U, 55U, 96U, _batches), 1, _data_type, _fixed_point_position));
- act1_out.allocator()->init(TensorInfo(TensorShape(55U, 55U, 96U, _batches), 1, _data_type, _fixed_point_position));
- norm1_out.allocator()->init(TensorInfo(TensorShape(55U, 55U, 96U, _batches), 1, _data_type, _fixed_point_position));
- pool1_out.allocator()->init(TensorInfo(TensorShape(27U, 27U, 96U, _batches), 1, _data_type, _fixed_point_position));
- pool11_out = std::unique_ptr<SubTensorType>(new SubTensorType(&pool1_out, TensorShape(27U, 27U, 48U, _batches), Coordinates()));
- pool12_out = std::unique_ptr<SubTensorType>(new SubTensorType(&pool1_out, TensorShape(27U, 27U, 48U, _batches), Coordinates(0, 0, 48)));
- // Layer 2
- conv2_out.allocator()->init(TensorInfo(TensorShape(27U, 27U, 256U, _batches), 1, _data_type, _fixed_point_position));
- conv21_out = std::unique_ptr<SubTensorType>(new SubTensorType(&conv2_out, TensorShape(27U, 27U, 128U, _batches), Coordinates()));
- conv22_out = std::unique_ptr<SubTensorType>(new SubTensorType(&conv2_out, TensorShape(27U, 27U, 128U, _batches), Coordinates(0, 0, 128)));
- act2_out.allocator()->init(TensorInfo(TensorShape(27U, 27U, 256U, _batches), 1, _data_type, _fixed_point_position));
- norm2_out.allocator()->init(TensorInfo(TensorShape(27U, 27U, 256U, _batches), 1, _data_type, _fixed_point_position));
- pool2_out.allocator()->init(TensorInfo(TensorShape(13U, 13U, 256U, _batches), 1, _data_type, _fixed_point_position));
- // Layer 3
- conv3_out.allocator()->init(TensorInfo(TensorShape(13U, 13U, 384U, _batches), 1, _data_type, _fixed_point_position));
- act3_out.allocator()->init(TensorInfo(TensorShape(13U, 13U, 384U, _batches), 1, _data_type, _fixed_point_position));
- act31_out = std::unique_ptr<SubTensorType>(new SubTensorType(&act3_out, TensorShape(13U, 13U, 192U, _batches), Coordinates()));
- act32_out = std::unique_ptr<SubTensorType>(new SubTensorType(&act3_out, TensorShape(13U, 13U, 192U, _batches), Coordinates(0, 0, 192)));
- // Layer 4
- conv4_out.allocator()->init(TensorInfo(TensorShape(13U, 13U, 384U, _batches), 1, _data_type, _fixed_point_position));
- conv41_out = std::unique_ptr<SubTensorType>(new SubTensorType(&conv4_out, TensorShape(13U, 13U, 192U, _batches), Coordinates()));
- conv42_out = std::unique_ptr<SubTensorType>(new SubTensorType(&conv4_out, TensorShape(13U, 13U, 192U, _batches), Coordinates(0, 0, 192)));
- act4_out.allocator()->init(TensorInfo(TensorShape(13U, 13U, 384U, _batches), 1, _data_type, _fixed_point_position));
- act41_out = std::unique_ptr<SubTensorType>(new SubTensorType(&act4_out, TensorShape(13U, 13U, 192U, _batches), Coordinates()));
- act42_out = std::unique_ptr<SubTensorType>(new SubTensorType(&act4_out, TensorShape(13U, 13U, 192U, _batches), Coordinates(0, 0, 192)));
- // Layer 5
- conv5_out.allocator()->init(TensorInfo(TensorShape(13U, 13U, 256U, _batches), 1, _data_type, _fixed_point_position));
- conv51_out = std::unique_ptr<SubTensorType>(new SubTensorType(&conv5_out, TensorShape(13U, 13U, 128U, _batches), Coordinates()));
- conv52_out = std::unique_ptr<SubTensorType>(new SubTensorType(&conv5_out, TensorShape(13U, 13U, 128U, _batches), Coordinates(0, 0, 128)));
- act5_out.allocator()->init(TensorInfo(TensorShape(13U, 13U, 256U, _batches), 1, _data_type, _fixed_point_position));
- pool5_out.allocator()->init(TensorInfo(TensorShape(6U, 6U, 256U, _batches), 1, _data_type, _fixed_point_position));
- // Layer 6
- fc6_out.allocator()->init(TensorInfo(TensorShape(4096U, _batches), 1, _data_type, _fixed_point_position));
- act6_out.allocator()->init(TensorInfo(TensorShape(4096U, _batches), 1, _data_type, _fixed_point_position));
- // Layer 7
- fc7_out.allocator()->init(TensorInfo(TensorShape(4096U, _batches), 1, _data_type, _fixed_point_position));
- act7_out.allocator()->init(TensorInfo(TensorShape(4096U, _batches), 1, _data_type, _fixed_point_position));
- // Layer 8
- fc8_out.allocator()->init(TensorInfo(TensorShape(1000U, _batches), 1, _data_type, _fixed_point_position));
-
- // Configure Layers
- // Layer 1
- TensorType *b0 = _reshaped_weights ? nullptr : &b[0];
- conv1.configure(&input, &w[0], b0, &conv1_out, PadStrideInfo(4, 4, 0, 0), WeightsInfo(_reshaped_weights, 11U, 11U, 96U));
- act1.configure(&conv1_out, &act1_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
- norm1.configure(&act1_out, &norm1_out, NormalizationLayerInfo(NormType::CROSS_MAP, 5, 0.0001f, 0.75f));
- pool1.configure(&norm1_out, &pool1_out, PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0)));
- // Layer 2
- conv21.configure(pool11_out.get(), w11.get(), b11.get(), conv21_out.get(), PadStrideInfo(1, 1, 2, 2), WeightsInfo(_reshaped_weights, 5U, 5U, 128U));
- conv22.configure(pool12_out.get(), w12.get(), b12.get(), conv22_out.get(), PadStrideInfo(1, 1, 2, 2), WeightsInfo(_reshaped_weights, 5U, 5U, 128U));
- act2.configure(&conv2_out, &act2_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
- norm2.configure(&act2_out, &norm2_out, NormalizationLayerInfo(NormType::CROSS_MAP, 5, 0.0001f, 0.75f));
- pool2.configure(&norm2_out, &pool2_out, PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0)));
- // Layer 3
- TensorType *b2 = (_reshaped_weights && !_is_direct_conv) ? nullptr : &b[2];
- conv3.configure(&pool2_out, &w[2], b2, &conv3_out, PadStrideInfo(1, 1, 1, 1), WeightsInfo(_reshaped_weights, 3U, 3U, 384U));
- act3.configure(&conv3_out, &act3_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
- // Layer 4
- conv41.configure(act31_out.get(), w31.get(), b31.get(), conv41_out.get(), PadStrideInfo(1, 1, 1, 1), WeightsInfo(_reshaped_weights, 3U, 3U, 192U));
- conv42.configure(act32_out.get(), w32.get(), b32.get(), conv42_out.get(), PadStrideInfo(1, 1, 1, 1), WeightsInfo(_reshaped_weights, 3U, 3U, 192U));
- act4.configure(&conv4_out, &act4_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
- // Layer 5
- conv51.configure(act41_out.get(), w41.get(), b41.get(), conv51_out.get(), PadStrideInfo(1, 1, 1, 1), WeightsInfo(_reshaped_weights, 3U, 3U, 128U));
- conv52.configure(act42_out.get(), w42.get(), b42.get(), conv52_out.get(), PadStrideInfo(1, 1, 1, 1), WeightsInfo(_reshaped_weights, 3U, 3U, 128U));
- act5.configure(&conv5_out, &act5_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
- pool5.configure(&act5_out, &pool5_out, PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0)));
- // Layer 6
- fc6.configure(&pool5_out, &w[5], &b[5], &fc6_out, true, _reshaped_weights);
- act6.configure(&fc6_out, &act6_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
- // Layer 7
- fc7.configure(&act6_out, &w[6], &b[6], &fc7_out, true, _reshaped_weights);
- act7.configure(&fc7_out, &act7_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
- // Layer 8
- fc8.configure(&act7_out, &w[7], &b[7], &fc8_out, true, _reshaped_weights);
- // Softmax
- smx.configure(&fc8_out, &output);
- }
-
- /** Allocate the network */
- void allocate()
- {
- input.allocator()->allocate();
- output.allocator()->allocate();
-
- if(!_reshaped_weights)
- {
- for(auto &wi : w)
- {
- wi.allocator()->allocate();
- }
-
- for(auto &bi : b)
- {
- bi.allocator()->allocate();
- }
- }
- else
- {
- w[0].allocator()->allocate();
- w[2].allocator()->allocate();
- w[5].allocator()->allocate();
- w[6].allocator()->allocate();
- w[7].allocator()->allocate();
-
- b[5].allocator()->allocate();
- b[6].allocator()->allocate();
- b[7].allocator()->allocate();
-
- if(!_is_direct_conv)
- {
- dynamic_cast<TensorType *>(w11.get())->allocator()->allocate();
- dynamic_cast<TensorType *>(w12.get())->allocator()->allocate();
- dynamic_cast<TensorType *>(w31.get())->allocator()->allocate();
- dynamic_cast<TensorType *>(w32.get())->allocator()->allocate();
- dynamic_cast<TensorType *>(w41.get())->allocator()->allocate();
- dynamic_cast<TensorType *>(w42.get())->allocator()->allocate();
- }
- else
- {
- b[1].allocator()->allocate();
- b[2].allocator()->allocate();
- b[3].allocator()->allocate();
- b[4].allocator()->allocate();
- w[1].allocator()->allocate();
- w[3].allocator()->allocate();
- w[4].allocator()->allocate();
- }
- }
-
- conv1_out.allocator()->allocate();
- act1_out.allocator()->allocate();
- norm1_out.allocator()->allocate();
- pool1_out.allocator()->allocate();
- conv2_out.allocator()->allocate();
- act2_out.allocator()->allocate();
- norm2_out.allocator()->allocate();
- pool2_out.allocator()->allocate();
- conv3_out.allocator()->allocate();
- act3_out.allocator()->allocate();
- conv4_out.allocator()->allocate();
- act4_out.allocator()->allocate();
- conv5_out.allocator()->allocate();
- act5_out.allocator()->allocate();
- pool5_out.allocator()->allocate();
- fc6_out.allocator()->allocate();
- act6_out.allocator()->allocate();
- fc7_out.allocator()->allocate();
- act7_out.allocator()->allocate();
- fc8_out.allocator()->allocate();
- }
-
- /** Fills the trainable parameters and input with random data. */
- void fill_random()
- {
- library->fill_tensor_uniform(Accessor(input), 0);
-
- if(!_reshaped_weights)
- {
- for(unsigned int i = 0; i < w.size(); ++i)
- {
- library->fill_tensor_uniform(Accessor(w[i]), i + 1);
- library->fill_tensor_uniform(Accessor(b[i]), i + 10);
- }
- }
- else
- {
- library->fill_tensor_uniform(Accessor(w[0]), 1);
- library->fill_tensor_uniform(Accessor(w[2]), 2);
-
- library->fill_tensor_uniform(Accessor(w[5]), 3);
- library->fill_tensor_uniform(Accessor(b[5]), 4);
- library->fill_tensor_uniform(Accessor(w[6]), 5);
- library->fill_tensor_uniform(Accessor(b[6]), 6);
- library->fill_tensor_uniform(Accessor(w[7]), 7);
- library->fill_tensor_uniform(Accessor(b[7]), 8);
-
- if(!_is_direct_conv)
- {
- library->fill_tensor_uniform(Accessor(*dynamic_cast<TensorType *>(w11.get())), 9);
- library->fill_tensor_uniform(Accessor(*dynamic_cast<TensorType *>(w12.get())), 10);
- library->fill_tensor_uniform(Accessor(*dynamic_cast<TensorType *>(w31.get())), 11);
- library->fill_tensor_uniform(Accessor(*dynamic_cast<TensorType *>(w32.get())), 12);
- library->fill_tensor_uniform(Accessor(*dynamic_cast<TensorType *>(w41.get())), 13);
- library->fill_tensor_uniform(Accessor(*dynamic_cast<TensorType *>(w42.get())), 14);
- }
- else
- {
- library->fill_tensor_uniform(Accessor(w[1]), 9);
- library->fill_tensor_uniform(Accessor(b[1]), 10);
- library->fill_tensor_uniform(Accessor(w[3]), 11);
- library->fill_tensor_uniform(Accessor(b[3]), 12);
- library->fill_tensor_uniform(Accessor(w[4]), 13);
- library->fill_tensor_uniform(Accessor(b[4]), 14);
- }
- }
- }
-
- /** Fills the trainable parameters from binary files
- *
- * @param weights Files names containing the weights data
- * @param biases Files names containing the bias data
- */
- void fill(std::vector<std::string> weights, std::vector<std::string> biases)
- {
- ARM_COMPUTE_ERROR_ON(weights.size() != w.size());
- ARM_COMPUTE_ERROR_ON(biases.size() != b.size());
- ARM_COMPUTE_ERROR_ON(_reshaped_weights);
-
- for(unsigned int i = 0; i < weights.size(); ++i)
- {
- library->fill_layer_data(Accessor(w[i]), weights[i]);
- library->fill_layer_data(Accessor(b[i]), biases[i]);
- }
- }
-
- /** Feed input to network from file.
- *
- * @param name File name of containing the input data.
- */
- void feed(std::string name)
- {
- library->fill_layer_data(Accessor(input), name);
- }
-
- /** Get the classification results.
- *
- * @return Vector containing the classified labels
- */
- std::vector<unsigned int> get_classifications()
- {
- std::vector<unsigned int> classified_labels;
- Accessor output_accessor(output);
-
- Window window;
- window.set(Window::DimX, Window::Dimension(0, 1, 1));
- for(unsigned int d = 1; d < output_accessor.shape().num_dimensions(); ++d)
- {
- window.set(d, Window::Dimension(0, output_accessor.shape()[d], 1));
- }
-
- execute_window_loop(window, [&](const Coordinates & id)
- {
- int max_idx = 0;
- float val = 0;
- const void *const out_ptr = output_accessor(id);
- for(unsigned int l = 0; l < output_accessor.shape().x(); ++l)
- {
- float curr_val = reinterpret_cast<const float *>(out_ptr)[l];
- if(curr_val > val)
- {
- max_idx = l;
- val = curr_val;
- }
- }
- classified_labels.push_back(max_idx);
- });
- return classified_labels;
- }
-
- /** Clear all allocated memory from the tensor objects */
- void clear()
- {
- // Free allocations
- input.allocator()->free();
- output.allocator()->free();
-
- if(!_reshaped_weights)
- {
- for(auto &wi : w)
- {
- wi.allocator()->free();
- }
-
- for(auto &bi : b)
- {
- bi.allocator()->free();
- }
- }
- else
- {
- w[0].allocator()->free();
- w[2].allocator()->free();
- w[5].allocator()->free();
- w[6].allocator()->free();
- w[7].allocator()->free();
-
- b[5].allocator()->free();
- b[6].allocator()->free();
- b[7].allocator()->free();
-
- if(_is_direct_conv)
- {
- w[3].allocator()->free();
- w[4].allocator()->free();
- b[2].allocator()->free();
- b[3].allocator()->free();
- b[4].allocator()->free();
- }
- }
-
- w11.reset();
- w12.reset();
- b11.reset();
- b11.reset();
- w31.reset();
- w32.reset();
- b31.reset();
- b32.reset();
- w41.reset();
- w42.reset();
- b41.reset();
- b42.reset();
-
- conv1_out.allocator()->free();
- act1_out.allocator()->free();
- norm1_out.allocator()->free();
- pool1_out.allocator()->free();
- conv2_out.allocator()->free();
- act2_out.allocator()->free();
- norm2_out.allocator()->free();
- pool2_out.allocator()->free();
- conv3_out.allocator()->free();
- act3_out.allocator()->free();
- conv4_out.allocator()->free();
- act4_out.allocator()->free();
- conv5_out.allocator()->free();
- act5_out.allocator()->free();
- pool5_out.allocator()->free();
- fc6_out.allocator()->free();
- act6_out.allocator()->free();
- fc7_out.allocator()->free();
- act7_out.allocator()->free();
- fc8_out.allocator()->free();
- }
-
- /** Runs the model */
- void run()
- {
- // Layer 1
- conv1.run();
- act1.run();
- norm1.run();
- pool1.run();
- // Layer 2
- conv21.run();
- conv22.run();
- act2.run();
- norm2.run();
- pool2.run();
- // Layer 3
- conv3.run();
- act3.run();
- // Layer 4
- conv41.run();
- conv42.run();
- act4.run();
- // Layer 5
- conv51.run();
- conv52.run();
- act5.run();
- pool5.run();
- // Layer 6
- fc6.run();
- act6.run();
- // Layer 7
- fc7.run();
- act7.run();
- // Layer 8
- fc8.run();
- // Softmax
- smx.run();
- }
-
- /** Sync the results */
- void sync()
- {
- sync_if_necessary<TensorType>();
- sync_tensor_if_necessary<TensorType>(output);
- }
-
-private:
- struct DirectConv
- {
- template <typename ConvolutionLayerFunction1 = ConvolutionLayerFunction, typename DirectConvolutionLayerFunction1 = DirectConvolutionLayerFunction>
- typename std::enable_if < !std::is_same<ConvolutionLayerFunction1, DirectConvolutionLayerFunction1>::value, void >::type
- configure(ITensorType *input, const ITensorType *weights, const ITensorType *biases, ITensorType *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info = WeightsInfo())
- {
- _func.configure(input, weights, biases, output, conv_info);
- }
-
- template <typename ConvolutionLayerFunction1 = ConvolutionLayerFunction, typename DirectConvolutionLayerFunction1 = DirectConvolutionLayerFunction>
- typename std::enable_if<std::is_same<ConvolutionLayerFunction1, DirectConvolutionLayerFunction1>::value, void>::type
- configure(ITensorType *input, const ITensorType *weights, const ITensorType *biases, ITensorType *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info = WeightsInfo())
- {
- _func.configure(input, weights, biases, output, conv_info, weights_info);
- }
-
- void run()
- {
- _func.run();
- }
-
- DirectConvolutionLayerFunction _func{};
- };
-
- DataType _data_type{ DataType::UNKNOWN };
- int _fixed_point_position{ 0 };
- unsigned int _batches{ 0 };
- bool _reshaped_weights{ false };
- bool _is_direct_conv{ !std::is_same<ConvolutionLayerFunction, DirectConvolutionLayerFunction>::value };
-
- ActivationLayerFunction act1{}, act2{}, act3{}, act4{}, act5{}, act6{}, act7{};
- ConvolutionLayerFunction conv1{};
- DirectConv conv21{}, conv22{}, conv3{}, conv41{}, conv42{}, conv51{}, conv52{};
- FullyConnectedLayerFunction fc6{}, fc7{}, fc8{};
- NormalizationLayerFunction norm1{}, norm2{};
- PoolingLayerFunction pool1{}, pool2{}, pool5{};
- SoftmaxLayerFunction smx{};
-
- TensorType input{}, output{};
- std::array<TensorType, 8> w{ {} }, b{ {} };
- std::unique_ptr<ITensorType> w11{ nullptr }, w12{ nullptr }, b11{ nullptr }, b12{ nullptr };
- std::unique_ptr<ITensorType> w31{ nullptr }, w32{ nullptr }, b31{ nullptr }, b32{ nullptr };
- std::unique_ptr<ITensorType> w41{ nullptr }, w42{ nullptr }, b41{ nullptr }, b42{ nullptr };
-
- TensorType conv1_out{}, act1_out{}, norm1_out{}, pool1_out{};
- TensorType conv2_out{}, act2_out{}, pool2_out{}, norm2_out{};
- TensorType conv3_out{}, act3_out{};
- TensorType conv4_out{}, act4_out{};
- TensorType conv5_out{}, act5_out{}, pool5_out{};
- TensorType fc6_out{}, act6_out{};
- TensorType fc7_out{}, act7_out{};
- TensorType fc8_out{};
-
- std::unique_ptr<SubTensorType> pool11_out{}, pool12_out{};
- std::unique_ptr<SubTensorType> conv21_out{}, conv22_out{};
- std::unique_ptr<SubTensorType> act31_out{}, act32_out{};
- std::unique_ptr<SubTensorType> conv41_out{}, conv42_out{}, act41_out{}, act42_out{};
- std::unique_ptr<SubTensorType> conv51_out{}, conv52_out{};
-};
-} // namespace networks
-} // namespace test
-} // namespace arm_compute
-#endif //__ARM_COMPUTE_TEST_MODEL_OBJECTS_ALEXNET_H__
diff --git a/tests/networks/LeNet5Network.h b/tests/networks/LeNet5Network.h
deleted file mode 100644
index 9cfd592..0000000
--- a/tests/networks/LeNet5Network.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_TEST_MODEL_OBJECTS_LENET5_H__
-#define __ARM_COMPUTE_TEST_MODEL_OBJECTS_LENET5_H__
-
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/Utils.h"
-
-#include <memory>
-
-using namespace arm_compute;
-using namespace arm_compute::test;
-
-namespace arm_compute
-{
-namespace test
-{
-namespace networks
-{
-/** Lenet5 model object */
-template <typename TensorType,
- typename Accessor,
- typename ActivationLayerFunction,
- typename ConvolutionLayerFunction,
- typename FullyConnectedLayerFunction,
- typename PoolingLayerFunction,
- typename SoftmaxLayerFunction>
-class LeNet5Network
-{
-public:
- /** Initialize the network.
- *
- * @param[in] batches Number of batches.
- */
- void init(int batches)
- {
- _batches = batches;
-
- // Initialize input, output, weights and biases
- input.allocator()->init(TensorInfo(TensorShape(28U, 28U, 1U, _batches), 1, DataType::F32));
- output.allocator()->init(TensorInfo(TensorShape(10U, _batches), 1, DataType::F32));
- w[0].allocator()->init(TensorInfo(TensorShape(5U, 5U, 1U, 20U), 1, DataType::F32));
- b[0].allocator()->init(TensorInfo(TensorShape(20U), 1, DataType::F32));
- w[1].allocator()->init(TensorInfo(TensorShape(5U, 5U, 20U, 50U), 1, DataType::F32));
- b[1].allocator()->init(TensorInfo(TensorShape(50U), 1, DataType::F32));
- w[2].allocator()->init(TensorInfo(TensorShape(800U, 500U), 1, DataType::F32));
- b[2].allocator()->init(TensorInfo(TensorShape(500U), 1, DataType::F32));
- w[3].allocator()->init(TensorInfo(TensorShape(500U, 10U), 1, DataType::F32));
- b[3].allocator()->init(TensorInfo(TensorShape(10U), 1, DataType::F32));
- }
-
- /** Build the model. */
- void build()
- {
- // Initialize intermediate tensors
- // Layer 1
- conv1_out.allocator()->init(TensorInfo(TensorShape(24U, 24U, 20U, _batches), 1, DataType::F32));
- pool1_out.allocator()->init(TensorInfo(TensorShape(12U, 12U, 20U, _batches), 1, DataType::F32));
- // Layer 2
- conv2_out.allocator()->init(TensorInfo(TensorShape(8U, 8U, 50U, _batches), 1, DataType::F32));
- pool2_out.allocator()->init(TensorInfo(TensorShape(4U, 4U, 50U, _batches), 1, DataType::F32));
- // Layer 3
- fc1_out.allocator()->init(TensorInfo(TensorShape(500U, _batches), 1, DataType::F32));
- act1_out.allocator()->init(TensorInfo(TensorShape(500U, _batches), 1, DataType::F32));
- // Layer 6
- fc2_out.allocator()->init(TensorInfo(TensorShape(10U, _batches), 1, DataType::F32));
-
- // Configure Layers
- conv1.configure(&input, &w[0], &b[0], &conv1_out, PadStrideInfo(1, 1, 0, 0));
- pool1.configure(&conv1_out, &pool1_out, PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0)));
- conv2.configure(&pool1_out, &w[1], &b[1], &conv2_out, PadStrideInfo(1, 1, 0, 0));
- pool2.configure(&conv2_out, &pool2_out, PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0)));
- fc1.configure(&pool2_out, &w[2], &b[2], &fc1_out);
- act1.configure(&fc1_out, &act1_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU));
- fc2.configure(&act1_out, &w[3], &b[3], &fc2_out);
- smx.configure(&fc2_out, &output);
- }
-
- /** Allocate the network */
- void allocate()
- {
- // Allocate tensors
- input.allocator()->allocate();
- output.allocator()->allocate();
- for(auto &wi : w)
- {
- wi.allocator()->allocate();
- }
- for(auto &bi : b)
- {
- bi.allocator()->allocate();
- }
- conv1_out.allocator()->allocate();
- pool1_out.allocator()->allocate();
- conv2_out.allocator()->allocate();
- pool2_out.allocator()->allocate();
- fc1_out.allocator()->allocate();
- act1_out.allocator()->allocate();
- fc2_out.allocator()->allocate();
- }
-
- /** Fills the trainable parameters and input with random data. */
- void fill_random()
- {
- std::uniform_real_distribution<> distribution(-1, 1);
- library->fill(Accessor(input), distribution, 0);
- for(unsigned int i = 0; i < w.size(); ++i)
- {
- library->fill(Accessor(w[i]), distribution, i + 1);
- library->fill(Accessor(b[i]), distribution, i + 10);
- }
- }
-
- /** Fills the trainable parameters from binary files
- *
- * @param weights Files names containing the weights data
- * @param biases Files names containing the bias data
- */
- void fill(std::vector<std::string> weights, std::vector<std::string> biases)
- {
- ARM_COMPUTE_ERROR_ON(weights.size() != w.size());
- ARM_COMPUTE_ERROR_ON(biases.size() != b.size());
-
- for(unsigned int i = 0; i < weights.size(); ++i)
- {
- library->fill_layer_data(Accessor(w[i]), weights[i]);
- library->fill_layer_data(Accessor(b[i]), biases[i]);
- }
- }
-
- /** Feed input to network from file.
- *
- * @param name File name of containing the input data.
- */
- void feed(std::string name)
- {
- library->fill_layer_data(Accessor(input), name);
- }
-
- /** Get the classification results.
- *
- * @return Vector containing the classified labels
- */
- std::vector<unsigned int> get_classifications()
- {
- std::vector<unsigned int> classified_labels;
- Accessor output_accessor(output);
-
- Window window;
- window.set(Window::DimX, Window::Dimension(0, 1, 1));
- for(unsigned int d = 1; d < output_accessor.shape().num_dimensions(); ++d)
- {
- window.set(d, Window::Dimension(0, output_accessor.shape()[d], 1));
- }
-
- execute_window_loop(window, [&](const Coordinates & id)
- {
- int max_idx = 0;
- float val = 0;
- const void *const out_ptr = output_accessor(id);
- for(unsigned int l = 0; l < output_accessor.shape().x(); ++l)
- {
- float curr_val = reinterpret_cast<const float *>(out_ptr)[l];
- if(curr_val > val)
- {
- max_idx = l;
- val = curr_val;
- }
- }
- classified_labels.push_back(max_idx);
- });
- return classified_labels;
- }
-
- /** Clear all allocated memory from the tensor objects */
- void clear()
- {
- input.allocator()->free();
- output.allocator()->free();
- for(auto &wi : w)
- {
- wi.allocator()->free();
- }
- for(auto &bi : b)
- {
- bi.allocator()->free();
- }
-
- conv1_out.allocator()->free();
- pool1_out.allocator()->free();
- conv2_out.allocator()->free();
- pool2_out.allocator()->free();
- fc1_out.allocator()->free();
- act1_out.allocator()->free();
- fc2_out.allocator()->free();
- }
-
- /** Runs the model */
- void run()
- {
- // Layer 1
- conv1.run();
- pool1.run();
- // Layer 2
- conv2.run();
- pool2.run();
- // Layer 3
- fc1.run();
- act1.run();
- // Layer 4
- fc2.run();
- // Softmax
- smx.run();
- }
-
- /** Sync the results */
- void sync()
- {
- sync_if_necessary<TensorType>();
- sync_tensor_if_necessary<TensorType>(output);
- }
-
-private:
- unsigned int _batches{ 0 };
-
- ActivationLayerFunction act1{};
- ConvolutionLayerFunction conv1{}, conv2{};
- FullyConnectedLayerFunction fc1{}, fc2{};
- PoolingLayerFunction pool1{}, pool2{};
- SoftmaxLayerFunction smx{};
-
- TensorType input{}, output{};
- std::array<TensorType, 4> w{ {} }, b{ {} };
-
- TensorType conv1_out{}, pool1_out{};
- TensorType conv2_out{}, pool2_out{};
- TensorType fc1_out{}, act1_out{};
- TensorType fc2_out{};
-};
-} // namespace networks
-} // namespace test
-} // namespace arm_compute
-#endif //__ARM_COMPUTE_TEST_MODEL_OBJECTS_LENET5_H__
diff --git a/tests/networks/MobileNetNetwork.h b/tests/networks/MobileNetNetwork.h
deleted file mode 100644
index ec054b2..0000000
--- a/tests/networks/MobileNetNetwork.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_TEST_MODEL_OBJECTS_MOBILENET_H__
-#define __ARM_COMPUTE_TEST_MODEL_OBJECTS_MOBILENET_H__
-
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/Utils.h"
-
-#include "utils/Utils.h"
-
-#include <memory>
-
-using namespace arm_compute;
-using namespace arm_compute::test;
-
-namespace arm_compute
-{
-namespace test
-{
-namespace networks
-{
-/** MobileNet model object */
-template <typename TensorType,
- typename Accessor,
- typename ActivationLayerFunction,
- typename ConvolutionLayerFunction,
- typename DirectConvolutionLayerFunction,
- typename DepthwiseConvolutionLayerFunction,
- typename ReshapeFunction,
- typename PoolingLayerFunction>
-class MobileNetNetwork
-{
-public:
- /** Initialize the network.
- *
- * @param[in] batches Number of batches.
- */
- void init(int batches)
- {
- _batches = batches;
-
- // Initialize input, output
- input.allocator()->init(TensorInfo(TensorShape(224U, 224U, 3U, _batches), 1, DataType::F32));
- output.allocator()->init(TensorInfo(TensorShape(11U, _batches), 1, DataType::F32));
- // Initialize weights and biases
- w_conv3x3.allocator()->init(TensorInfo(TensorShape(3U, 3U, 3U, 16U), 1, DataType::F32));
- b_conv3x3.allocator()->init(TensorInfo(TensorShape(16U), 1, DataType::F32));
- depthwise_conv_block_init(0, 16, 16);
- depthwise_conv_block_init(1, 16, 32);
- depthwise_conv_block_init(2, 32, 32);
- depthwise_conv_block_init(3, 32, 64);
- depthwise_conv_block_init(4, 64, 64);
- depthwise_conv_block_init(5, 64, 128);
- depthwise_conv_block_init(6, 128, 128);
- depthwise_conv_block_init(7, 128, 128);
- depthwise_conv_block_init(8, 128, 128);
- depthwise_conv_block_init(9, 128, 128);
- depthwise_conv_block_init(10, 128, 128);
- depthwise_conv_block_init(11, 128, 256);
- depthwise_conv_block_init(12, 256, 256);
- w_conv[13].allocator()->init(TensorInfo(TensorShape(1U, 1U, 256U, 11U), 1, DataType::F32));
- b_conv[13].allocator()->init(TensorInfo(TensorShape(11U), 1, DataType::F32));
- }
-
- /** Build the model. */
- void build()
- {
- // Configure Layers
- conv3x3.configure(&input, &w_conv3x3, &b_conv3x3, &conv_out[0], PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR));
- conv3x3_act.configure(&conv_out[0], nullptr, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f));
- depthwise_conv_block_build(0, PadStrideInfo(1, 1, 1, 1), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(1, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(2, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(3, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(4, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(5, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(6, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(7, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(8, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(9, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(10, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(11, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(12, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- pool.configure(&conv_out[13], &pool_out, PoolingLayerInfo(PoolingType::AVG, 7, PadStrideInfo(2, 2, 0, 0)));
- conv1x1[13].configure(&pool_out, &w_conv[13], &b_conv[13], &conv_out[14], PadStrideInfo(1, 1, 0, 0));
- logistic.configure(&conv_out[14], nullptr, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC));
- reshape.configure(&conv_out[14], &output);
- }
-
- /** Allocate the network. */
- void allocate()
- {
- input.allocator()->allocate();
- output.allocator()->allocate();
-
- w_conv3x3.allocator()->allocate();
- b_conv3x3.allocator()->allocate();
- for(unsigned int i = 0; i < w_conv.size(); ++i)
- {
- w_conv[i].allocator()->allocate();
- b_conv[i].allocator()->allocate();
- }
- for(unsigned int i = 0; i < w_dwc.size(); ++i)
- {
- w_dwc[i].allocator()->allocate();
- b_dwc[i].allocator()->allocate();
- }
- for(auto &o : conv_out)
- {
- o.allocator()->allocate();
- }
- for(auto &o : dwc_out)
- {
- o.allocator()->allocate();
- }
- pool_out.allocator()->allocate();
- }
-
- /** Fills the trainable parameters and input with random data. */
- void fill_random()
- {
- unsigned int seed_idx = 0;
- std::uniform_real_distribution<> distribution(-1, 1);
- library->fill(Accessor(input), distribution, seed_idx++);
-
- library->fill(Accessor(w_conv3x3), distribution, seed_idx++);
- library->fill(Accessor(b_conv3x3), distribution, seed_idx++);
- for(unsigned int i = 0; i < w_conv.size(); ++i)
- {
- library->fill(Accessor(w_conv[i]), distribution, seed_idx++);
- library->fill(Accessor(b_conv[i]), distribution, seed_idx++);
- }
- for(unsigned int i = 0; i < w_dwc.size(); ++i)
- {
- library->fill(Accessor(w_dwc[i]), distribution, seed_idx++);
- library->fill(Accessor(b_dwc[i]), distribution, seed_idx++);
- }
- }
-
- /** Feed input to network from file.
- *
- * @param name File name of containing the input data.
- */
- void feed(std::string name)
- {
- library->fill_layer_data(Accessor(input), name);
- }
-
- /** Get the classification results.
- *
- * @return Vector containing the classified labels
- */
- std::vector<unsigned int> get_classifications()
- {
- std::vector<unsigned int> classified_labels;
- Accessor output_accessor(output);
-
- Window window;
- window.set(Window::DimX, Window::Dimension(0, 1, 1));
- for(unsigned int d = 1; d < output_accessor.shape().num_dimensions(); ++d)
- {
- window.set(d, Window::Dimension(0, output_accessor.shape()[d], 1));
- }
-
- execute_window_loop(window, [&](const Coordinates & id)
- {
- int max_idx = 0;
- float val = 0;
- const void *const out_ptr = output_accessor(id);
- for(unsigned int l = 0; l < output_accessor.shape().x(); ++l)
- {
- float curr_val = reinterpret_cast<const float *>(out_ptr)[l];
- if(curr_val > val)
- {
- max_idx = l;
- val = curr_val;
- }
- }
- classified_labels.push_back(max_idx);
- });
- return classified_labels;
- }
-
- /** Clear all allocated memory from the tensor objects */
- void clear()
- {
- input.allocator()->free();
- output.allocator()->free();
-
- w_conv3x3.allocator()->free();
- b_conv3x3.allocator()->free();
- for(unsigned int i = 0; i < w_conv.size(); ++i)
- {
- w_conv[i].allocator()->free();
- b_conv[i].allocator()->free();
- }
- for(unsigned int i = 0; i < w_dwc.size(); ++i)
- {
- w_dwc[i].allocator()->free();
- b_dwc[i].allocator()->free();
- }
- for(auto &o : conv_out)
- {
- o.allocator()->free();
- }
- for(auto &o : dwc_out)
- {
- o.allocator()->free();
- }
- pool_out.allocator()->free();
- }
-
- /** Runs the model */
- void run()
- {
- conv3x3.run();
- conv3x3_act.run();
- depthwise_conv_block_run(0);
- depthwise_conv_block_run(1);
- depthwise_conv_block_run(2);
- depthwise_conv_block_run(3);
- depthwise_conv_block_run(4);
- depthwise_conv_block_run(5);
- depthwise_conv_block_run(6);
- depthwise_conv_block_run(7);
- depthwise_conv_block_run(8);
- depthwise_conv_block_run(9);
- depthwise_conv_block_run(10);
- depthwise_conv_block_run(11);
- depthwise_conv_block_run(12);
- pool.run();
- conv1x1[13].run();
- logistic.run();
- reshape.run();
- }
-
- /** Sync the results */
- void sync()
- {
- sync_if_necessary<TensorType>();
- sync_tensor_if_necessary<TensorType>(output);
- }
-
-private:
- void depthwise_conv_block_init(unsigned int idx, unsigned int ifm, unsigned int ofm)
- {
- w_dwc[idx].allocator()->init(TensorInfo(TensorShape(3U, 3U, ifm), 1, DataType::F32));
- b_dwc[idx].allocator()->init(TensorInfo(TensorShape(ifm), 1, DataType::F32));
- w_conv[idx].allocator()->init(TensorInfo(TensorShape(1U, 1U, ifm, ofm), 1, DataType::F32));
- b_conv[idx].allocator()->init(TensorInfo(TensorShape(ofm), 1, DataType::F32));
- }
- void depthwise_conv_block_build(unsigned int idx, PadStrideInfo dwc_ps, PadStrideInfo conv_ps)
- {
- dwc3x3[idx].configure(&conv_out[idx], &w_dwc[idx], &b_dwc[idx], &dwc_out[idx], dwc_ps);
- act[2 * idx].configure(&dwc_out[idx], nullptr, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f));
- conv1x1[idx].configure(&dwc_out[idx], &w_conv[idx], &b_conv[idx], &conv_out[idx + 1], conv_ps);
- act[2 * idx + 1].configure(&conv_out[idx], nullptr, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f));
- }
- void depthwise_conv_block_run(unsigned int idx)
- {
- dwc3x3[idx].run();
- act[2 * idx].run();
- conv1x1[idx].run();
- act[2 * idx + 1].run();
- }
-
-private:
- unsigned int _batches{ 0 };
-
- ConvolutionLayerFunction conv3x3{};
- ActivationLayerFunction conv3x3_act{};
- std::array<ActivationLayerFunction, 26> act{ {} };
- std::array<DirectConvolutionLayerFunction, 14> conv1x1{ {} };
- std::array<DepthwiseConvolutionLayerFunction, 13> dwc3x3{ {} };
- PoolingLayerFunction pool{};
- ActivationLayerFunction logistic{};
- ReshapeFunction reshape{};
-
- TensorType w_conv3x3{}, b_conv3x3{};
- std::array<TensorType, 14> w_conv{ {} }, b_conv{ {} };
- std::array<TensorType, 13> w_dwc{ {} }, b_dwc{ {} };
-
- TensorType input{}, output{};
-
- std::array<TensorType, 15> conv_out{ {} };
- std::array<TensorType, 13> dwc_out{ {} };
- TensorType pool_out{};
-};
-} // namespace networks
-} // namespace test
-} // namespace arm_compute
-#endif //__ARM_COMPUTE_TEST_MODEL_OBJECTS_MOBILENET_H__
diff --git a/tests/networks/MobileNetV1Network.h b/tests/networks/MobileNetV1Network.h
deleted file mode 100644
index aea5c11..0000000
--- a/tests/networks/MobileNetV1Network.h
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_TEST_MODEL_OBJECTS_MOBILENETV1_H__
-#define __ARM_COMPUTE_TEST_MODEL_OBJECTS_MOBILENETV1_H__
-
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/Utils.h"
-
-#include "utils/Utils.h"
-
-#include <memory>
-
-using namespace arm_compute;
-using namespace arm_compute::test;
-
-namespace arm_compute
-{
-namespace test
-{
-namespace networks
-{
-/** MobileNet model object */
-template <typename TensorType,
- typename Accessor,
- typename ActivationLayerFunction,
- typename BatchNormalizationLayerFunction,
- typename ConvolutionLayerFunction,
- typename DirectConvolutionLayerFunction,
- typename DepthwiseConvolutionFunction,
- typename ReshapeFunction,
- typename PoolingLayerFunction,
- typename SoftmaxLayerFunction>
-class MobileNetV1Network
-{
-public:
- /** Initialize the network.
- *
- * @param[in] input_spatial_size Size of the spatial input.
- * @param[in] batches Number of batches.
- */
- void init(unsigned int input_spatial_size, int batches)
- {
- _batches = batches;
- _input_spatial_size = input_spatial_size;
-
- // Currently supported sizes
- ARM_COMPUTE_ERROR_ON(input_spatial_size != 128 && input_spatial_size != 224);
-
- // Initialize input, output
- input.allocator()->init(TensorInfo(TensorShape(input_spatial_size, input_spatial_size, 3U, _batches), 1, DataType::F32));
- output.allocator()->init(TensorInfo(TensorShape(1001U, _batches), 1, DataType::F32));
- // Initialize weights and biases
- w_conv3x3.allocator()->init(TensorInfo(TensorShape(3U, 3U, 3U, 32U), 1, DataType::F32));
- mean_conv3x3.allocator()->init(TensorInfo(TensorShape(32U), 1, DataType::F32));
- var_conv3x3.allocator()->init(TensorInfo(TensorShape(32U), 1, DataType::F32));
- beta_conv3x3.allocator()->init(TensorInfo(TensorShape(32U), 1, DataType::F32));
- gamma_conv3x3.allocator()->init(TensorInfo(TensorShape(32U), 1, DataType::F32));
- depthwise_conv_block_init(0, 32, 32);
- depthwise_conv_block_init(1, 32, 64);
- depthwise_conv_block_init(2, 64, 64);
- depthwise_conv_block_init(3, 64, 128);
- depthwise_conv_block_init(4, 128, 256);
- depthwise_conv_block_init(5, 256, 512);
- depthwise_conv_block_init(6, 512, 512);
- depthwise_conv_block_init(7, 512, 512);
- depthwise_conv_block_init(8, 512, 512);
- depthwise_conv_block_init(9, 512, 512);
- depthwise_conv_block_init(10, 512, 512);
- depthwise_conv_block_init(11, 512, 1024);
- depthwise_conv_block_init(12, 1024, 1024);
- w_conv1c.allocator()->init(TensorInfo(TensorShape(1U, 1U, 1024U, 1001U), 1, DataType::F32));
- b_conv1c.allocator()->init(TensorInfo(TensorShape(1001U), 1, DataType::F32));
- // Init reshaped output
- reshape_out.allocator()->init(TensorInfo(TensorShape(1001U, _batches), 1, DataType::F32));
- }
-
- /** Build the model. */
- void build()
- {
- // Configure Layers
- conv3x3.configure(&input, &w_conv3x3, nullptr, &conv_out[0], PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR));
- conv3x3_bn.configure(&conv_out[0], nullptr, &mean_conv3x3, &var_conv3x3, &beta_conv3x3, &gamma_conv3x3, 0.001f);
- conv3x3_act.configure(&conv_out[0], nullptr, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f));
- depthwise_conv_block_build(0, PadStrideInfo(1, 1, 1, 1), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(1, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(2, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(3, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(4, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(5, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(6, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(7, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(8, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(9, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(10, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(11, PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- depthwise_conv_block_build(12, PadStrideInfo(1, 1, 1, 1, 1, 1, DimensionRoundingType::FLOOR), PadStrideInfo(1, 1, 0, 0));
- pool.configure(&conv_out[13], &pool_out, PoolingLayerInfo(PoolingType::AVG));
- conv1c.configure(&pool_out, &w_conv1c, &b_conv1c, &conv_out[14], PadStrideInfo(1, 1, 0, 0));
- reshape.configure(&conv_out[14], &reshape_out);
- smx.configure(&reshape_out, &output);
- }
-
- /** Allocate the network. */
- void allocate()
- {
- input.allocator()->allocate();
- output.allocator()->allocate();
-
- w_conv3x3.allocator()->allocate();
- mean_conv3x3.allocator()->allocate();
- var_conv3x3.allocator()->allocate();
- beta_conv3x3.allocator()->allocate();
- gamma_conv3x3.allocator()->allocate();
-
- ARM_COMPUTE_ERROR_ON(w_conv.size() != w_dwc.size());
- for(unsigned int i = 0; i < w_conv.size(); ++i)
- {
- w_dwc[i].allocator()->allocate();
- bn_mean[2 * i].allocator()->allocate();
- bn_var[2 * i].allocator()->allocate();
- bn_beta[2 * i].allocator()->allocate();
- bn_gamma[2 * i].allocator()->allocate();
- w_conv[i].allocator()->allocate();
- bn_mean[2 * i + 1].allocator()->allocate();
- bn_var[2 * i + 1].allocator()->allocate();
- bn_beta[2 * i + 1].allocator()->allocate();
- bn_gamma[2 * i + 1].allocator()->allocate();
- }
- w_conv1c.allocator()->allocate();
- b_conv1c.allocator()->allocate();
-
- // Allocate intermediate buffers
- for(auto &o : conv_out)
- {
- o.allocator()->allocate();
- }
- for(auto &o : dwc_out)
- {
- o.allocator()->allocate();
- }
- pool_out.allocator()->allocate();
- reshape_out.allocator()->allocate();
- }
-
- /** Fills the trainable parameters and input with random data. */
- void fill_random()
- {
- unsigned int seed_idx = 0;
- std::uniform_real_distribution<> distribution(-1, 1);
- library->fill(Accessor(input), distribution, seed_idx++);
-
- library->fill(Accessor(w_conv3x3), distribution, seed_idx++);
- library->fill(Accessor(mean_conv3x3), distribution, seed_idx++);
- library->fill(Accessor(var_conv3x3), distribution, seed_idx++);
- library->fill(Accessor(beta_conv3x3), distribution, seed_idx++);
- library->fill(Accessor(gamma_conv3x3), distribution, seed_idx++);
-
- ARM_COMPUTE_ERROR_ON(w_conv.size() != w_dwc.size());
- for(unsigned int i = 0; i < w_conv.size(); ++i)
- {
- library->fill(Accessor(w_dwc[i]), distribution, seed_idx++);
- library->fill(Accessor(bn_mean[2 * i]), distribution, seed_idx++);
- library->fill(Accessor(bn_var[2 * i]), distribution, seed_idx++);
- library->fill(Accessor(bn_beta[2 * i]), distribution, seed_idx++);
- library->fill(Accessor(bn_gamma[2 * i]), distribution, seed_idx++);
- library->fill(Accessor(w_conv[i]), distribution, seed_idx++);
- library->fill(Accessor(bn_mean[2 * i + 1]), distribution, seed_idx++);
- library->fill(Accessor(bn_var[2 * i + 1]), distribution, seed_idx++);
- library->fill(Accessor(bn_beta[2 * i + 1]), distribution, seed_idx++);
- library->fill(Accessor(bn_gamma[2 * i + 1]), distribution, seed_idx++);
- }
- library->fill(Accessor(w_conv1c), distribution, seed_idx++);
- library->fill(Accessor(b_conv1c), distribution, seed_idx++);
- }
-
- /** Feed input to network from file.
- *
- * @param name File name of containing the input data.
- */
- void feed(std::string name)
- {
- library->fill_layer_data(Accessor(input), name);
- }
-
- /** Get the classification results.
- *
- * @return Vector containing the classified labels
- */
- std::vector<unsigned int> get_classifications()
- {
- std::vector<unsigned int> classified_labels;
- Accessor output_accessor(output);
-
- Window window;
- window.set(Window::DimX, Window::Dimension(0, 1, 1));
- for(unsigned int d = 1; d < output_accessor.shape().num_dimensions(); ++d)
- {
- window.set(d, Window::Dimension(0, output_accessor.shape()[d], 1));
- }
-
- execute_window_loop(window, [&](const Coordinates & id)
- {
- int max_idx = 0;
- float val = 0;
- const void *const out_ptr = output_accessor(id);
- for(unsigned int l = 0; l < output_accessor.shape().x(); ++l)
- {
- float curr_val = reinterpret_cast<const float *>(out_ptr)[l];
- if(curr_val > val)
- {
- max_idx = l;
- val = curr_val;
- }
- }
- classified_labels.push_back(max_idx);
- });
- return classified_labels;
- }
-
- /** Clear all allocated memory from the tensor objects */
- void clear()
- {
- input.allocator()->free();
- output.allocator()->free();
-
- w_conv3x3.allocator()->free();
- mean_conv3x3.allocator()->free();
- var_conv3x3.allocator()->free();
- beta_conv3x3.allocator()->free();
- gamma_conv3x3.allocator()->free();
-
- ARM_COMPUTE_ERROR_ON(w_conv.size() != w_dwc.size());
- for(unsigned int i = 0; i < w_conv.size(); ++i)
- {
- w_dwc[i].allocator()->free();
- bn_mean[2 * i].allocator()->free();
- bn_var[2 * i].allocator()->free();
- bn_beta[2 * i].allocator()->free();
- bn_gamma[2 * i].allocator()->free();
- w_conv[i].allocator()->free();
- bn_mean[2 * i + 1].allocator()->free();
- bn_var[2 * i + 1].allocator()->free();
- bn_beta[2 * i + 1].allocator()->free();
- bn_gamma[2 * i + 1].allocator()->free();
- }
- w_conv1c.allocator()->free();
- b_conv1c.allocator()->free();
-
- // Free intermediate buffers
- for(auto &o : conv_out)
- {
- o.allocator()->free();
- }
- for(auto &o : dwc_out)
- {
- o.allocator()->free();
- }
- pool_out.allocator()->free();
- reshape_out.allocator()->free();
- }
-
- /** Runs the model */
- void run()
- {
- conv3x3.run();
- conv3x3_bn.run();
- conv3x3_act.run();
- depthwise_conv_block_run(0);
- depthwise_conv_block_run(1);
- depthwise_conv_block_run(2);
- depthwise_conv_block_run(3);
- depthwise_conv_block_run(4);
- depthwise_conv_block_run(5);
- depthwise_conv_block_run(6);
- depthwise_conv_block_run(7);
- depthwise_conv_block_run(8);
- depthwise_conv_block_run(9);
- depthwise_conv_block_run(10);
- depthwise_conv_block_run(11);
- depthwise_conv_block_run(12);
- pool.run();
- conv1c.run();
- reshape.run();
- smx.run();
- }
-
- /** Sync the results */
- void sync()
- {
- sync_if_necessary<TensorType>();
- sync_tensor_if_necessary<TensorType>(output);
- }
-
-private:
- void depthwise_conv_block_init(unsigned int idx, unsigned int ifm, unsigned int ofm)
- {
- // Depthwise Convolution weights
- w_dwc[idx].allocator()->init(TensorInfo(TensorShape(3U, 3U, ifm), 1, DataType::F32));
- // Batch normalization parameters
- bn_mean[2 * idx].allocator()->init(TensorInfo(TensorShape(ifm), 1, DataType::F32));
- bn_var[2 * idx].allocator()->init(TensorInfo(TensorShape(ifm), 1, DataType::F32));
- bn_beta[2 * idx].allocator()->init(TensorInfo(TensorShape(ifm), 1, DataType::F32));
- bn_gamma[2 * idx].allocator()->init(TensorInfo(TensorShape(ifm), 1, DataType::F32));
- // Convolution weights
- w_conv[idx].allocator()->init(TensorInfo(TensorShape(1U, 1U, ifm, ofm), 1, DataType::F32));
- // Batch normalization parameters
- bn_mean[2 * idx + 1].allocator()->init(TensorInfo(TensorShape(ofm), 1, DataType::F32));
- bn_var[2 * idx + 1].allocator()->init(TensorInfo(TensorShape(ofm), 1, DataType::F32));
- bn_beta[2 * idx + 1].allocator()->init(TensorInfo(TensorShape(ofm), 1, DataType::F32));
- bn_gamma[2 * idx + 1].allocator()->init(TensorInfo(TensorShape(ofm), 1, DataType::F32));
- }
- void depthwise_conv_block_build(unsigned int idx, PadStrideInfo dwc_ps, PadStrideInfo conv_ps)
- {
- // Configure depthwise convolution block
- dwc3x3[idx].configure(&conv_out[idx], &w_dwc[idx], nullptr, &dwc_out[idx], dwc_ps);
- bn[2 * idx].configure(&dwc_out[idx], nullptr, &bn_mean[2 * idx], &bn_var[2 * idx], &bn_beta[2 * idx], &bn_gamma[2 * idx], 0.001f);
- act[2 * idx].configure(&dwc_out[idx], nullptr, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f));
- // Configure pointwise convolution block
- conv1x1[idx].configure(&dwc_out[idx], &w_conv[idx], nullptr, &conv_out[idx + 1], conv_ps);
- bn[2 * idx + 1].configure(&conv_out[idx + 1], nullptr, &bn_mean[2 * idx + 1], &bn_var[2 * idx + 1], &bn_beta[2 * idx + 1], &bn_gamma[2 * idx + 1], 0.001f);
- act[2 * idx + 1].configure(&conv_out[idx], nullptr, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f));
- }
- void depthwise_conv_block_run(unsigned int idx)
- {
- dwc3x3[idx].run();
- bn[2 * idx].run();
- act[2 * idx].run();
- conv1x1[idx].run();
- bn[2 * idx + 1].run();
- act[2 * idx + 1].run();
- }
-
-private:
- unsigned int _batches{ 0 };
- unsigned int _input_spatial_size{ 0 };
-
- ConvolutionLayerFunction conv3x3{};
- BatchNormalizationLayerFunction conv3x3_bn{};
- ActivationLayerFunction conv3x3_act{};
- std::array<ActivationLayerFunction, 26> act{ {} };
- std::array<BatchNormalizationLayerFunction, 26> bn{ {} };
- std::array<DepthwiseConvolutionFunction, 13> dwc3x3{ {} };
- std::array<DirectConvolutionLayerFunction, 13> conv1x1{ {} };
- DirectConvolutionLayerFunction conv1c{};
- PoolingLayerFunction pool{};
- ReshapeFunction reshape{};
- SoftmaxLayerFunction smx{};
-
- TensorType w_conv3x3{}, mean_conv3x3{}, var_conv3x3{}, beta_conv3x3{}, gamma_conv3x3{};
- std::array<TensorType, 13> w_conv{ {} };
- std::array<TensorType, 13> w_dwc{ {} };
- std::array<TensorType, 26> bn_mean{ {} };
- std::array<TensorType, 26> bn_var{ {} };
- std::array<TensorType, 26> bn_beta{ {} };
- std::array<TensorType, 26> bn_gamma{ {} };
- TensorType w_conv1c{}, b_conv1c{};
-
- TensorType input{}, output{};
-
- std::array<TensorType, 15> conv_out{ {} };
- std::array<TensorType, 13> dwc_out{ {} };
- TensorType pool_out{};
- TensorType reshape_out{};
-};
-} // namespace networks
-} // namespace test
-} // namespace arm_compute
-#endif //__ARM_COMPUTE_TEST_MODEL_OBJECTS_MOBILENETV1_H__
diff --git a/tests/validation/CL/ActivationLayer.cpp b/tests/validation/CL/ActivationLayer.cpp
index 5fd0855..d91f708 100644
--- a/tests/validation/CL/ActivationLayer.cpp
+++ b/tests/validation/CL/ActivationLayer.cpp
@@ -61,35 +61,14 @@
case ActivationLayerInfo::ActivationFunction::SQUARE:
return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.1f : epsilon);
case ActivationLayerInfo::ActivationFunction::LOGISTIC:
- if(is_data_type_fixed_point(data_type))
- {
- return AbsoluteTolerance<float>(5.f);
- }
- else
- {
- return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : epsilon);
- }
+ return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : epsilon);
case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.00001f : epsilon);
case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
case ActivationLayerInfo::ActivationFunction::SQRT:
- if(is_data_type_fixed_point(data_type))
- {
- return AbsoluteTolerance<float>(5.f);
- }
- else
- {
- return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.01f : 0.00001f);
- }
+ return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.01f : 0.00001f);
case ActivationLayerInfo::ActivationFunction::TANH:
- if(is_data_type_fixed_point(data_type))
- {
- return AbsoluteTolerance<float>(5.f);
- }
- else
- {
- return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : 0.00001f);
- }
+ return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : 0.00001f);
default:
return AbsoluteTolerance<float>(epsilon);
}
@@ -99,9 +78,7 @@
const auto CNNDataTypes = framework::dataset::make("DataType",
{
DataType::F16,
- DataType::F32,
- DataType::QS8,
- DataType::QS16,
+ DataType::F32
});
/** Input data sets. */
@@ -114,12 +91,9 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), CNNDataTypes), framework::dataset::make("InPlace", { false, true })),
shape, data_type, in_place)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, data_type, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, data_type, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, data_type, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, data_type, 1);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -165,9 +139,6 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), // Unsupported activation
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
}),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
@@ -175,9 +146,6 @@
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(27U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
- TensorInfo(),
})),
framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
@@ -185,11 +153,8 @@
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
})),
- framework::dataset::make("Expected", { false, false, true, true, false, false, false, true, true })),
+ framework::dataset::make("Expected", { false, false, true, true, false, false })),
input_info, output_info, act_info, expected)
{
ARM_COMPUTE_EXPECT(bool(CLActivationLayer::validate(&input_info.clone()->set_is_resizable(false), (output_info.total_size() == 0) ? nullptr : &output_info.clone()->set_is_resizable(false), act_info)) == expected, framework::LogLevel::ERRORS);
@@ -235,57 +200,12 @@
TEST_SUITE_END()
template <typename T>
-using CLActivationLayerFixedPointFixture = ActivationValidationFixedPointFixture<CLTensor, CLAccessor, CLActivationLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// We test for fixed point precision [3,5] because [1,2] and [6,7] ranges cause
-// overflowing issues in most of the transcendentals functions.
-FIXTURE_DATA_TEST_CASE(RunTiny, CLActivationLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(), ActivationDataset),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 3, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance(_function, _data_type));
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), ActivationDataset),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 3, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance(_function, _data_type));
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14
-FIXTURE_DATA_TEST_CASE(RunTiny, CLActivationLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(), ActivationDataset),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance(_function, _data_type));
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLActivationLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), ActivationDataset),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance(_function, _data_type));
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
using CLActivationLayerQuantizedFixture = ActivationValidationQuantizedFixture<CLTensor, CLAccessor, CLActivationLayer, T>;
/** Input data sets. */
const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationFunction", { ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU,
ActivationLayerInfo::ActivationFunction::RELU,
+ ActivationLayerInfo::ActivationFunction::LOGISTIC,
ActivationLayerInfo::ActivationFunction::BOUNDED_RELU
});
diff --git a/tests/validation/CL/ArithmeticAddition.cpp b/tests/validation/CL/ArithmeticAddition.cpp
index e9a892d..bd27bc4 100644
--- a/tests/validation/CL/ArithmeticAddition.cpp
+++ b/tests/validation/CL/ArithmeticAddition.cpp
@@ -46,12 +46,11 @@
/** Input data sets **/
const auto ArithmeticAdditionU8Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U8)), framework::dataset::make("DataType",
DataType::U8));
+const auto ArithmeticAdditionQASYMM8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QASYMM8), framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataType",
+ DataType::QASYMM8));
const auto ArithmeticAdditionS16Dataset = combine(combine(framework::dataset::make("DataType", { DataType::U8, DataType::S16 }), framework::dataset::make("DataType", DataType::S16)),
framework::dataset::make("DataType", DataType::S16));
-const auto ArithmeticAdditionQS8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS8), framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("DataType", DataType::QS8));
-const auto ArithmeticAdditionQS16Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS16), framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("DataType", DataType::QS16));
const auto ArithmeticAdditionFP16Dataset = combine(combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::F16)),
framework::dataset::make("DataType", DataType::F16));
const auto ArithmeticAdditionFP32Dataset = combine(combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::F32)),
@@ -69,26 +68,20 @@
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Window shrink
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
}),
framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
- framework::dataset::make("Expected", { true, true, false, false, false, false, true })),
+ framework::dataset::make("Expected", { true, true, false, false, false})),
input1_info, input2_info, output_info, expected)
{
ARM_COMPUTE_EXPECT(bool(CLArithmeticAddition::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), ConvertPolicy::WRAP)) == expected, framework::LogLevel::ERRORS);
@@ -131,6 +124,49 @@
}
TEST_SUITE_END()
+template <typename T>
+using CLArithmeticAdditionQuantizedFixture = ArithmeticAdditionValidationQuantizedFixture<CLTensor, CLAccessor, CLArithmeticAddition, T>;
+
+TEST_SUITE(Quantized)
+TEST_SUITE(QASYMM8)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
+ shape, policy)
+{
+ // Create tensors
+ CLTensor ref_src1 = create_tensor<CLTensor>(shape, DataType::QASYMM8);
+ CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::QASYMM8);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::QASYMM8);
+
+ // Create and Configure function
+ CLArithmeticAddition add;
+ add.configure(&ref_src1, &ref_src2, &dst, policy);
+
+ // Validate valid region
+ const ValidRegion valid_region = shape_to_valid_region(shape);
+ validate(dst.info()->valid_region(), valid_region);
+
+ // Validate padding
+ const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding();
+ validate(ref_src1.info()->padding(), padding);
+ validate(ref_src2.info()->padding(), padding);
+ validate(dst.info()->padding(), padding);
+}
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallShapes(),
+ ArithmeticAdditionQASYMM8Dataset),
+ framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(5.f / 255.f, 20) })),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f / 255.f, 5) }))
+
+ )
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+TEST_SUITE_END()
+
TEST_SUITE(S16)
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::U8, DataType::S16 })),
framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
@@ -171,47 +207,6 @@
}
TEST_SUITE_END()
-template <typename T>
-using CLArithmeticAdditionFixedPointFixture = ArithmeticAdditionValidationFixedPointFixture<CLTensor, CLAccessor, CLArithmeticAddition, T>;
-
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLArithmeticAdditionFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(), ArithmeticAdditionQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), ArithmeticAdditionQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLArithmeticAdditionFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(), ArithmeticAdditionQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), ArithmeticAdditionQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE(Float)
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticAdditionFixture<half>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), ArithmeticAdditionFP16Dataset),
diff --git a/tests/validation/CL/ArithmeticDivision.cpp b/tests/validation/CL/ArithmeticDivision.cpp
new file mode 100644
index 0000000..5d4fa1f
--- /dev/null
+++ b/tests/validation/CL/ArithmeticDivision.cpp
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/CLTensorAllocator.h"
+#include "arm_compute/runtime/CL/functions/CLArithmeticDivision.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/PaddingCalculator.h"
+#include "tests/datasets/ConvertPolicyDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/ArithmeticDivisionFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+RelativeTolerance<float> tolerance_fp32(0.000001f);
+RelativeTolerance<float> tolerance_fp16(0.001f);
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(ArithmeticDivision)
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
+ framework::dataset::make("Input1Info", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Wrong data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Window shrink
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
+ }),
+ framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
+ TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
+ })),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
+ })),
+ framework::dataset::make("Expected", { false, false, false, false, true })),
+ input1_info, input2_info, output_info, expected)
+{
+ ARM_COMPUTE_EXPECT(bool(CLArithmeticDivision::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false))) == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
+template <typename T>
+using CLArithmeticDivisionFixture = ArithmeticDivisionValidationFixture<CLTensor, CLAccessor, CLArithmeticDivision, T>;
+
+TEST_SUITE(Float)
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticDivisionFixture<half>, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_fp16);
+}
+TEST_SUITE_END() // FP16
+
+TEST_SUITE(FP32)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, concat(datasets::SmallShapes(), datasets::LargeShapes()), shape)
+{
+ // Create tensors
+ CLTensor ref_src1 = create_tensor<CLTensor>(shape, DataType::F32);
+ CLTensor ref_src2 = create_tensor<CLTensor>(shape, DataType::F32);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::F32);
+
+ // Create and Configure function
+ CLArithmeticDivision div;
+ div.configure(&ref_src1, &ref_src2, &dst);
+
+ // Validate valid region
+ const ValidRegion valid_region = shape_to_valid_region(shape);
+ validate(dst.info()->valid_region(), valid_region);
+
+ // Validate padding
+ const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding();
+ validate(ref_src1.info()->padding(), padding);
+ validate(ref_src2.info()->padding(), padding);
+ validate(dst.info()->padding(), padding);
+}
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticDivisionFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_fp32);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLArithmeticDivisionFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_fp32);
+}
+
+template <typename T>
+using CLArithmeticDivisionBroadcastFixture = ArithmeticDivisionBroadcastValidationFixture<CLTensor, CLAccessor, CLArithmeticDivision, T>;
+
+FIXTURE_DATA_TEST_CASE(RunSmallBroadcast, CLArithmeticDivisionBroadcastFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapesBroadcast(),
+ framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_fp32);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLargeBroadcast, CLArithmeticDivisionBroadcastFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapesBroadcast(),
+ framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_fp32);
+}
+TEST_SUITE_END() // FP32
+TEST_SUITE_END() // Float
+
+TEST_SUITE_END() // ArithmeticDivision
+TEST_SUITE_END() // CL
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/ArithmeticSubtraction.cpp b/tests/validation/CL/ArithmeticSubtraction.cpp
index 43c94a7..b19d963 100644
--- a/tests/validation/CL/ArithmeticSubtraction.cpp
+++ b/tests/validation/CL/ArithmeticSubtraction.cpp
@@ -55,10 +55,6 @@
framework::dataset::make("DataType", DataType::S16));
const auto ArithmeticSubtractionU8S16S16Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16)),
framework::dataset::make("DataType", DataType::S16));
-const auto ArithmeticSubtractionQS8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS8), framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("DataType", DataType::QS8));
-const auto ArithmeticSubtractionQS16Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS16), framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("DataType", DataType::QS16));
const auto ArithmeticSubtractionFP16Dataset = combine(combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::F16)),
framework::dataset::make("DataType", DataType::F16));
const auto ArithmeticSubtractionFP32Dataset = combine(combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::F32)),
@@ -76,24 +72,18 @@
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Window shrink
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
}),
framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
framework::dataset::make("Expected", { true, true, false, false, false, false, true })),
input1_info, input2_info, output_info, expected)
@@ -241,51 +231,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-template <typename T1, typename T2 = T1, typename T3 = T1>
-using CLArithmeticSubtractionFixedPointFixture = ArithmeticSubtractionValidationFixedPointFixture<CLTensor, CLAccessor, CLArithmeticSubtraction, T1, T2, T3>;
-
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLArithmeticSubtractionFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- ArithmeticSubtractionQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- ArithmeticSubtractionQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLArithmeticSubtractionFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- ArithmeticSubtractionQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- ArithmeticSubtractionQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE(Float)
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLArithmeticSubtractionFixture<half>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), ArithmeticSubtractionFP16Dataset),
diff --git a/tests/validation/CL/BatchNormalizationLayer.cpp b/tests/validation/CL/BatchNormalizationLayer.cpp
index f6dc6b3..0d80ff7 100644
--- a/tests/validation/CL/BatchNormalizationLayer.cpp
+++ b/tests/validation/CL/BatchNormalizationLayer.cpp
@@ -46,8 +46,6 @@
{
constexpr AbsoluteTolerance<float> tolerance_f32(0.00001f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
constexpr AbsoluteTolerance<float> tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
-constexpr AbsoluteTolerance<float> tolerance_qs8(3.0f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QS8 */
-constexpr AbsoluteTolerance<float> tolerance_qs16(6.0f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QS16 */
const auto act_infos = framework::dataset::make("ActivationInfo",
{
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
@@ -65,13 +63,10 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(datasets::RandomBatchNormalizationLayerDataset(),
combine(framework::dataset::make("UseBeta", { false, true }),
framework::dataset::make("UseGamma", { false, true }))),
- framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F16, DataType::F32 })),
+ framework::dataset::make("DataType", { DataType::F16, DataType::F32 })),
framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
shape0, shape1, epsilon, use_gamma, use_beta, dt, data_layout)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = (arm_compute::is_data_type_fixed_point(dt)) ? 3 : 0;
-
TensorShape src_dst_shapes = shape0;
if(data_layout == DataLayout::NHWC)
{
@@ -79,12 +74,12 @@
}
// Create tensors
- CLTensor src = create_tensor<CLTensor>(src_dst_shapes, dt, 1, fixed_point_position, QuantizationInfo(), data_layout);
- CLTensor dst = create_tensor<CLTensor>(src_dst_shapes, dt, 1, fixed_point_position, QuantizationInfo(), data_layout);
- CLTensor mean = create_tensor<CLTensor>(shape1, dt, 1, fixed_point_position);
- CLTensor var = create_tensor<CLTensor>(shape1, dt, 1, fixed_point_position);
- CLTensor beta = create_tensor<CLTensor>(shape1, dt, 1, fixed_point_position);
- CLTensor gamma = create_tensor<CLTensor>(shape1, dt, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(src_dst_shapes, dt, 1, QuantizationInfo(), data_layout);
+ CLTensor dst = create_tensor<CLTensor>(src_dst_shapes, dt, 1, QuantizationInfo(), data_layout);
+ CLTensor mean = create_tensor<CLTensor>(shape1, dt, 1);
+ CLTensor var = create_tensor<CLTensor>(shape1, dt, 1);
+ CLTensor beta = create_tensor<CLTensor>(shape1, dt, 1);
+ CLTensor gamma = create_tensor<CLTensor>(shape1, dt, 1);
// Create and Configure function
CLBatchNormalizationLayer norm;
@@ -105,50 +100,34 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching data types
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching data types
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Invalid mean/var/beta/gamma shape
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point position
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Fused activation with fixed point not supported
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Unsupported fused activation
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Fused activation's a < b
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
}),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 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::F16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
- TensorInfo(),
})),
framework::dataset::make("MVBGInfo",{ TensorInfo(TensorShape(2U), 1, DataType::F32),
TensorInfo(TensorShape(2U), 1, DataType::F32),
TensorInfo(TensorShape(2U), 1, DataType::F16),
TensorInfo(TensorShape(2U), 1, DataType::F32),
TensorInfo(TensorShape(5U), 1, DataType::F32),
- TensorInfo(TensorShape(2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(2U), 1, DataType::QS8, 2),
TensorInfo(TensorShape(2U), 1, DataType::F32),
TensorInfo(TensorShape(2U), 1, DataType::F32),
- TensorInfo(TensorShape(2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(2U), 1, DataType::QS8, 2),
})),
framework::dataset::make("ActivationLayerInfo",{ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f, 2.f),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f, 2.f),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 2.f, 6.f),
- ActivationLayerInfo(),
- ActivationLayerInfo(),
})),
- framework::dataset::make("Expected", { true, false, false, false, false, false, false, false, false, true, true})),
+ framework::dataset::make("Expected", { true, false, false, false, false, false, false})),
input_info, output_info, mvbg_info, act_info, expected)
{
const auto &mean_info = mvbg_info;
@@ -189,42 +168,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-TEST_SUITE(Quantized)
-template <typename T>
-using CLBatchNormalizationLayerFixedPointFixture = BatchNormalizationLayerValidationFixedPointFixture<CLTensor, CLAccessor, CLBatchNormalizationLayer, T>;
-
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(Random, CLBatchNormalizationLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(combine(combine(datasets::RandomBatchNormalizationLayerDataset(),
- framework::dataset::make("UseBeta", false)),
- framework::dataset::make("UseGamma", false)),
- framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
- framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs8, 0);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(Random, CLBatchNormalizationLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(combine(combine(datasets::RandomBatchNormalizationLayerDataset(),
- framework::dataset::make("UseBeta", false)),
- framework::dataset::make("UseGamma", false)),
- framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
- framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs16, 0);
-}
-TEST_SUITE_END()
-
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/CL/CannyEdge.cpp b/tests/validation/CL/CannyEdge.cpp
new file mode 100644
index 0000000..9d3fe58
--- /dev/null
+++ b/tests/validation/CL/CannyEdge.cpp
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/CLTensorAllocator.h"
+#include "arm_compute/runtime/CL/functions/CLCannyEdge.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/CL/CLArrayAccessor.h"
+#include "tests/PaddingCalculator.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ImageFileDatasets.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/CannyEdgeFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+/* Allowed ratio of mismatches between target and reference (1.0 = 100%) */
+const float allowed_mismatch_ratio = 0.1f;
+
+const auto use_fp16 = framework::dataset::make("UseFP16", { false });
+
+const auto data = combine(framework::dataset::make("GradientSize", { 3, 5, 7 }),
+ combine(framework::dataset::make("Normalization", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }), combine(datasets::BorderModes(), use_fp16)));
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(CannyEdge)
+
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), data), framework::dataset::make("Format", Format::U8)),
+ shape, gradient_size, normalization, border_mode, use_fp16, format)
+{
+ ARM_COMPUTE_UNUSED(use_fp16);
+ ARM_COMPUTE_ERROR_ON(use_fp16);
+
+ CannyEdgeParameters params = canny_edge_parameters();
+ // Convert normalisation type to integer
+ const auto norm_type = static_cast<int>(normalization) + 1;
+
+ // Create tensors
+ CLTensor src = create_tensor<CLTensor>(shape, data_type_from_format(format));
+ CLTensor dst = create_tensor<CLTensor>(shape, data_type_from_format(format));
+ src.info()->set_format(format);
+ dst.info()->set_format(format);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create Canny edge configure function
+ CLCannyEdge canny_edge;
+ canny_edge.configure(&src, &dst, params.upper_thresh, params.lower_thresh, gradient_size, norm_type, border_mode, params.constant_border_value);
+
+ // Validate valid region
+ validate(src.info()->valid_region(), shape_to_valid_region(shape, (BorderMode::UNDEFINED == border_mode)));
+
+ if(!(shape == TensorShape{ 7u, 7u } && gradient_size == 7 && border_mode == BorderMode::UNDEFINED))
+ {
+ validate(dst.info()->valid_region(), shape_to_valid_region(shape, (BorderMode::UNDEFINED == border_mode), BorderSize(gradient_size / 2 + 1)));
+ }
+
+ // Validate padding
+ PaddingCalculator calculator(shape.x(), 1);
+ calculator.set_border_mode(border_mode);
+ calculator.set_border_size(1);
+ const PaddingSize dst_padding = calculator.required_padding();
+
+ calculator.set_border_size(gradient_size / 2);
+ calculator.set_access_offset(-gradient_size / 2);
+ calculator.set_accessed_elements(16);
+ calculator.set_processed_elements(8);
+ const PaddingSize src_padding = calculator.required_padding();
+
+ validate(src.info()->padding(), src_padding);
+ validate(dst.info()->padding(), dst_padding);
+}
+
+template <typename T>
+using CLCannyEdgeFixture = CannyEdgeValidationFixture<CLTensor, CLAccessor, CLKeyPointArray, CLCannyEdge, T>;
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLCannyEdgeFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallImageFiles(), data), framework::dataset::make("Format", Format::U8)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, AbsoluteTolerance<uint8_t>(0), allowed_mismatch_ratio);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLCannyEdgeFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeImageFiles(), data), framework::dataset::make("Format", Format::U8)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, AbsoluteTolerance<uint8_t>(0), allowed_mismatch_ratio);
+}
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/ChannelCombine.cpp b/tests/validation/CL/ChannelCombine.cpp
index d8eccba..4c5bb69 100644
--- a/tests/validation/CL/ChannelCombine.cpp
+++ b/tests/validation/CL/ChannelCombine.cpp
@@ -65,6 +65,7 @@
{
channel_combine.configure(&ref_src[0], &ref_src[1], &ref_src[2], &dst);
}
+
}
} // namespace
diff --git a/tests/validation/CL/ChannelExtract.cpp b/tests/validation/CL/ChannelExtract.cpp
index 926e16b..6f56def 100644
--- a/tests/validation/CL/ChannelExtract.cpp
+++ b/tests/validation/CL/ChannelExtract.cpp
@@ -76,6 +76,7 @@
{
channel_extract.configure(&ref_src, channel, &dst);
}
+
}
} // namespace
diff --git a/tests/validation/CL/Col2Im.cpp b/tests/validation/CL/Col2Im.cpp
new file mode 100644
index 0000000..6f1163c
--- /dev/null
+++ b/tests/validation/CL/Col2Im.cpp
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/CL/kernels/CLCol2ImKernel.h"
+#include "arm_compute/core/Types.h"
+#include "tests/CL/Helper.h"
+
+#include "tests/CL/CLAccessor.h"
+#include "tests/datasets/Col2ImLayerDataset.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/Col2ImFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+TEST_SUITE(CL)
+TEST_SUITE(Col2Im)
+
+using CLCol2Im = CLSynthetizeFunction<CLCol2ImKernel>;
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::S64), // Unsupported data type
+ TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32), // Mismatching data type
+ TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32), // Invalid output shape
+ TensorInfo(TensorShape(3U, 12U, 4U, 2U), 1, DataType::F32),
+ }),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 10U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 4U, 12U, 2U), 1, DataType::F32),
+ })),
+ framework::dataset::make("ConvolvedWidth", { 3, 3, 3, 3 })),
+ framework::dataset::make("ConvolvedHeight", { 4, 4, 4, 4 })),
+ framework::dataset::make("NumGroups", { 1, 1, 1, 4 })),
+ framework::dataset::make("Expected", { false, false, false, true })),
+ input_info, output_info, convolved_width, convolved_height, num_groups, expected)
+{
+ bool status = bool(CLCol2Im::validate(&input_info, &output_info, std::make_pair(convolved_width, convolved_height), num_groups));
+ ARM_COMPUTE_EXPECT(status == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
+template <typename T>
+using CLCol2ImFixture = Col2ImValidationFixture<CLTensor, CLAccessor, CLCol2Im, T>;
+
+TEST_SUITE(Float)
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLCol2ImFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGroupedCol2ImLayerDataset(), framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLCol2ImFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGroupedCol2ImLayerDataset(), framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLCol2ImFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGroupedCol2ImLayerDataset(), framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLCol2ImFixture<half>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGroupedCol2ImLayerDataset(), framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLCol2ImFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGroupedCol2ImLayerDataset(), framework::dataset::make("DataType",
+ DataType::QASYMM8)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLCol2ImFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGroupedCol2ImLayerDataset(), framework::dataset::make("DataType",
+ DataType::QASYMM8)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/ColorConvert.cpp b/tests/validation/CL/ColorConvert.cpp
new file mode 100644
index 0000000..34b0e0d
--- /dev/null
+++ b/tests/validation/CL/ColorConvert.cpp
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/runtime/CL/CLMultiImage.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/CLTensorAllocator.h"
+#include "arm_compute/runtime/CL/functions/CLColorConvert.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/ColorConvertFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+constexpr AbsoluteTolerance<uint8_t> tolerance_nv(2);
+
+// Input data sets
+const auto RGBDataset = framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 });
+const auto YUYVDataset = framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 });
+
+const auto ColorConvert_RGBA_to_RGB = combine(framework::dataset::make("FormatType", { Format::RGBA8888 }),
+ framework::dataset::make("FormatType", { Format::RGB888 }));
+
+const auto ColorConvert_RGB_to_RGBA = combine(framework::dataset::make("FormatType", { Format::RGB888 }),
+ framework::dataset::make("FormatType", { Format::RGBA8888 }));
+
+const auto ColorConvert_YUYV_to_RGBDataset = combine(YUYVDataset,
+ RGBDataset);
+
+const auto ColorConvert_YUVPlanar_to_RGBDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::NV12, Format::NV21 }),
+ RGBDataset);
+
+const auto ColorConvert_RGBDataset_to_NVDataset = combine(RGBDataset,
+ framework::dataset::make("FormatType", { Format::NV12, Format::IYUV, Format::YUV444 }));
+
+const auto ColorConvert_YUYVDataset_to_NVDataset = combine(YUYVDataset,
+ framework::dataset::make("FormatType", { Format::NV12, Format::IYUV }));
+
+const auto ColorConvert_NVDataset_to_YUVDataset = combine(framework::dataset::make("FormatType", { Format::NV12, Format::NV21 }),
+ framework::dataset::make("FormatType", { Format::IYUV, Format::YUV444 }));
+
+inline void validate_configuration(const TensorShape &shape, Format src_format, Format dst_format)
+{
+ const unsigned int src_num_planes = num_planes_from_format(src_format);
+ const unsigned int dst_num_planes = num_planes_from_format(dst_format);
+
+ TensorShape input = adjust_odd_shape(shape, src_format);
+ input = adjust_odd_shape(input, src_format);
+
+ // Create tensors
+ CLMultiImage ref_src = create_multi_image<CLMultiImage>(input, src_format);
+ CLMultiImage ref_dst = create_multi_image<CLMultiImage>(input, dst_format);
+
+ // Create and Configure function
+ CLColorConvert color_convert;
+
+ if(1U == src_num_planes)
+ {
+ const CLTensor *src_plane = ref_src.cl_plane(0);
+
+ if(1U == dst_num_planes)
+ {
+ CLTensor *dst_plane = ref_dst.cl_plane(0);
+ color_convert.configure(src_plane, dst_plane);
+ }
+ else
+ {
+ color_convert.configure(src_plane, &ref_dst);
+ }
+ }
+ else
+ {
+ if(1U == dst_num_planes)
+ {
+ CLTensor *dst_plane = ref_dst.cl_plane(0);
+ color_convert.configure(&ref_src, dst_plane);
+ }
+ else
+ {
+ color_convert.configure(&ref_src, &ref_dst);
+ }
+ }
+
+ for(unsigned int plane_idx = 0; plane_idx < src_num_planes; ++plane_idx)
+ {
+ const CLTensor *src_plane = ref_src.cl_plane(plane_idx);
+
+ ARM_COMPUTE_EXPECT(src_plane->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+ for(unsigned int plane_idx = 0; plane_idx < dst_num_planes; ++plane_idx)
+ {
+ const CLTensor *dst_plane = ref_dst.cl_plane(plane_idx);
+
+ ARM_COMPUTE_EXPECT(dst_plane->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+}
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(ColorConvert)
+
+template <typename T>
+using CLColorConvertFixture = ColorConvertValidationFixture<CLMultiImage, CLTensor, CLAccessor, CLColorConvert, T>;
+
+TEST_SUITE(Configuration)
+DATA_TEST_CASE(RGBA, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_RGBA_to_RGB),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(RGB, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_RGB_to_RGBA),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(YUV, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_YUYV_to_RGBDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(YUVPlanar, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_YUVPlanar_to_RGBDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(NV, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_RGBDataset_to_NVDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(YUYVtoNV, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_YUYVDataset_to_NVDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(NVtoYUV, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_NVDataset_to_YUVDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(RGBA)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBA_to_RGB))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBA_to_RGB))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(RGB)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_RGBA))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_RGBA))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(YUV)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYV_to_RGBDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYV_to_RGBDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(YUVPlanar)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(NV)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBDataset_to_NVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx], tolerance_nv);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBDataset_to_NVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx], tolerance_nv);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(YUYVtoNV)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_NVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_NVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+
+TEST_SUITE_END()
+
+TEST_SUITE(NVtoYUV)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_NVDataset_to_YUVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_NVDataset_to_YUVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(CLAccessor(*_target.cl_plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/ConvolutionLayer.cpp b/tests/validation/CL/ConvolutionLayer.cpp
index ec729b3..2cb704f 100644
--- a/tests/validation/CL/ConvolutionLayer.cpp
+++ b/tests/validation/CL/ConvolutionLayer.cpp
@@ -48,7 +48,6 @@
constexpr AbsoluteTolerance<float> absolute_tolerance_float(0.0001f); /**< Absolute Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
RelativeTolerance<float> tolerance_f32(0.05f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.2)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
-constexpr AbsoluteTolerance<float> tolerance_fixed(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */
constexpr AbsoluteTolerance<float> tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
constexpr float tolerance_num = 0.07f; /**< Tolerance number */
@@ -57,10 +56,16 @@
{
DataType::F16,
DataType::F32,
- DataType::QS8,
- DataType::QS16,
DataType::QASYMM8,
});
+
+/** Grouped CNN data types */
+const auto GroupedCNNDataTypes = framework::dataset::make("DataType",
+{
+ DataType::F16,
+ DataType::F32
+});
+
const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
{
ActivationLayerInfo(),
@@ -74,32 +79,32 @@
TEST_SUITE(ConvolutionLayer)
DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(23U, 27U, 5U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(23U, 27U, 31U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(17U, 31U, 32U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32, 0)
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 5U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 31U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32),
+ TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(17U, 31U, 32U), 1, DataType::F32),
+ TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32)
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 31U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(5U, 5U, 32U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32, 0)
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 31U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16),
+ TensorInfo(TensorShape(5U, 5U, 32U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32)
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F32, 0)
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F32)
})),
framework::dataset::make("ConvInfo", { PadStrideInfo(1, 2, 1, 1),
PadStrideInfo(1, 2, 1, 1),
@@ -156,16 +161,13 @@
ActivationFunctionsDataset),
input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, act_info)
{
- // Set fixed point position data type allowed
- int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
auto bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
// Create tensors
- CLTensor src = create_tensor<CLTensor>(input_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- CLTensor weights = create_tensor<CLTensor>(weights_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- CLTensor bias = create_tensor<CLTensor>(bias_shape, bias_data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- CLTensor dst = create_tensor<CLTensor>(output_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
+ CLTensor src = create_tensor<CLTensor>(input_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ CLTensor weights = create_tensor<CLTensor>(weights_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ CLTensor bias = create_tensor<CLTensor>(bias_shape, bias_data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ CLTensor dst = create_tensor<CLTensor>(output_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -207,7 +209,7 @@
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType",
DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
ActivationFunctionsDataset))
{
// Validate output
@@ -218,13 +220,13 @@
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType",
DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
ActivationFunctionsDataset))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
}
-TEST_SUITE_END()
+TEST_SUITE_END() // FP16
TEST_SUITE(FP32)
@@ -232,7 +234,7 @@
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
ActivationFunctionsDataset))
{
// Validate output
@@ -243,69 +245,14 @@
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
ActivationFunctionsDataset))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f32, 0.f, absolute_tolerance_float);
}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
-using CLGEMMConvolutionLayerFixedPointFixture = ConvolutionValidationFixedPointFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// We test for fixed point precision [4,6]
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::TinyConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::TinyConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // FP32
+TEST_SUITE_END() // Float
template <typename T>
using CLGEMMConvolutionLayerQuantizedFixture = ConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T>;
@@ -320,29 +267,125 @@
TEST_SUITE(Quantized)
TEST_SUITE(QASYMM8)
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
+FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
QuantizedActivationFunctionsDataset))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(),
+FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 0) })),
QuantizedActivationFunctionsDataset))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // QASYMM8
+TEST_SUITE_END() // Quantized
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // GEMMConvolutionLayer
+
+template <typename T>
+using CLGEMMGroupedConvolutionLayerFixture = ConvolutionValidationFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T>;
+
+TEST_SUITE(GroupedGEMMConvolutionLayer)
+
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallGroupedConvolutionLayerDataset(), datasets::LargeGroupedConvolutionLayerDataset()),
+ GroupedCNNDataTypes),
+ ActivationFunctionsDataset),
+ input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, act_info)
+{
+ ARM_COMPUTE_ERROR_ON((input_shape[2] % weights_shape[2]) != 0);
+
+ // The number of groups is calculated dividing the number of input channels of the input tensor by the number of input channels of the weights shape
+ const int num_groups = input_shape[2] / weights_shape[2];
+
+ // Create tensors
+ CLTensor src = create_tensor<CLTensor>(input_shape, data_type);
+ CLTensor weights = create_tensor<CLTensor>(weights_shape, data_type, 1);
+ CLTensor bias = create_tensor<CLTensor>(bias_shape, data_type, 1);
+ CLTensor dst = create_tensor<CLTensor>(output_shape, data_type, 1);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create and configure function
+ CLGEMMConvolutionLayer conv;
+ conv.configure(&src, &weights, &bias, &dst, info, WeightsInfo(), dilation, act_info, num_groups);
+
+ // Validate valid region
+ const ValidRegion src_valid_region = shape_to_valid_region(input_shape);
+ const ValidRegion weights_valid_region = shape_to_valid_region(weights_shape);
+ const ValidRegion bias_valid_region = shape_to_valid_region(bias_shape);
+ const ValidRegion dst_valid_region = shape_to_valid_region(output_shape);
+
+ validate(src.info()->valid_region(), src_valid_region);
+ validate(weights.info()->valid_region(), weights_valid_region);
+ validate(bias.info()->valid_region(), bias_valid_region);
+ validate(dst.info()->valid_region(), dst_valid_region);
+
+ // Validate padding
+}
+
+TEST_SUITE(Float)
+TEST_SUITE(FP32)
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMGroupedConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallGroupedConvolutionLayerDataset(),
+ framework::dataset::make("ReshapeWeights", { true })),
+ framework::dataset::make("DataType", DataType::F32)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ ActivationFunctionsDataset))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32, tolerance_num);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMGroupedConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeGroupedConvolutionLayerDataset(),
+ framework::dataset::make("ReshapeWeights", { true })),
+ framework::dataset::make("DataType", DataType::F32)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ ActivationFunctionsDataset))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32, tolerance_num);
+}
+TEST_SUITE_END() // FP32
+
+TEST_SUITE(FP16)
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMGroupedConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallGroupedConvolutionLayerDataset(),
+ framework::dataset::make("ReshapeWeights", { true })),
+ framework::dataset::make("DataType", DataType::F16)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ ActivationFunctionsDataset))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32, tolerance_num);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMGroupedConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeGroupedConvolutionLayerDataset(),
+ framework::dataset::make("ReshapeWeights", { true })),
+ framework::dataset::make("DataType", DataType::F16)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ ActivationFunctionsDataset))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32, tolerance_num);
+}
+TEST_SUITE_END() // FP16
+TEST_SUITE_END() // Float
+
+TEST_SUITE_END() // GroupedGEMMConvolutionLayer
+TEST_SUITE_END() // CL
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/CL/DeconvolutionLayer.cpp b/tests/validation/CL/DeconvolutionLayer.cpp
index 58a2026..0fd7ed4 100644
--- a/tests/validation/CL/DeconvolutionLayer.cpp
+++ b/tests/validation/CL/DeconvolutionLayer.cpp
@@ -43,7 +43,9 @@
{
namespace
{
-constexpr AbsoluteTolerance<float> tolerance_fp32(0.001f); /**< Tolerance for floating point tests */
+constexpr AbsoluteTolerance<float> tolerance_fp32(0.001f); /**< Tolerance for floating point tests */
+RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.2)); /**< Tolerance value for comparing reference's for DataType::F16 */
+constexpr float tolerance_num = 0.07f; /**< Tolerance number */
const auto data4x4 = datasets::SmallDeconvolutionShapes() * framework::dataset::make("StrideX", 1, 4) * framework::dataset::make("StrideY", 1, 4) * framework::dataset::make("PadX", 0, 3)
* framework::dataset::make("PadY", 0, 3) * framework::dataset::make("ax", 0) * framework::dataset::make("ay", 0) * framework::dataset::make("NumKernels", { 1, 3 });
@@ -101,33 +103,33 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid weights shape
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 4), // Non supported data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 11), // Invalid bias shape
- TensorInfo(TensorShape(13U, 11U, 4U, 3U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights shape
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), // Non supported data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid bias shape
+ TensorInfo(TensorShape(13U, 11U, 4U, 3U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32),
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QS8, 5),
- TensorInfo(TensorShape(3U, 2U, 2U, 2U), 1, DataType::F32, 11),
- TensorInfo(TensorShape(3U, 3U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32, 0),
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(3U, 2U, 2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32),
})),
- framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(1U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(1U), 1, DataType::F32, 5),
- TensorInfo(TensorShape(25U, 11U), 1, DataType::F32, 11),
- TensorInfo(TensorShape(1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
+ framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(1U), 1, DataType::F16),
+ TensorInfo(TensorShape(1U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
})),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(25U, 10U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 5),
- TensorInfo(TensorShape(13U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 9U, 1U, 3U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(25U, 10U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(13U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 9U, 1U, 3U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32),
})),
framework::dataset::make("PadStrideInfo", { PadStrideInfo(1, 1, 0, 0),
PadStrideInfo(1, 1, 0, 0),
@@ -169,10 +171,9 @@
using CLDeconvolutionLayerFixture1x1 = DeconvolutionValidationFixture<CLTensor, CLAccessor, CLDeconvolutionLayer, T, 1, 1>;
TEST_SUITE(Float)
-
TEST_SUITE(FP32)
-TEST_SUITE(W4x4)
+TEST_SUITE(W4x4)
FIXTURE_DATA_TEST_CASE(Run, CLDeconvolutionLayerFixture4x4<float>, framework::DatasetMode::ALL, combine(data4x4, framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
@@ -181,7 +182,6 @@
TEST_SUITE_END()
TEST_SUITE(W3x3)
-
FIXTURE_DATA_TEST_CASE(Run, CLDeconvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, combine(data3x3, framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
@@ -198,6 +198,34 @@
TEST_SUITE_END()
TEST_SUITE_END()
+
+TEST_SUITE(FP16)
+
+TEST_SUITE(W4x4)
+FIXTURE_DATA_TEST_CASE(Run, CLDeconvolutionLayerFixture4x4<half>, framework::DatasetMode::ALL, combine(data4x4, framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(W3x3)
+FIXTURE_DATA_TEST_CASE(Run, CLDeconvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(data3x3, framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(W1x1)
+FIXTURE_DATA_TEST_CASE(Run, CLDeconvolutionLayerFixture1x1<half>, framework::DatasetMode::ALL, combine(data1x1, framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
+}
+TEST_SUITE_END()
+
+TEST_SUITE_END()
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/CL/DepthConcatenateLayer.cpp b/tests/validation/CL/DepthConcatenateLayer.cpp
index 725af88..a9346dc 100644
--- a/tests/validation/CL/DepthConcatenateLayer.cpp
+++ b/tests/validation/CL/DepthConcatenateLayer.cpp
@@ -42,6 +42,44 @@
TEST_SUITE(CL)
TEST_SUITE(DepthConcatenateLayer)
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
+ framework::dataset::make("InputInfo1", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/output
+ TensorInfo(TensorShape(24U, 27U, 4U), 1, DataType::F32), // Mismatching x dimension
+ TensorInfo(TensorShape(23U, 27U, 3U), 1, DataType::F32), // Mismatching total depth
+ TensorInfo(TensorShape(16U, 27U, 6U), 1, DataType::F32)
+ }),
+ framework::dataset::make("InputInfo2", { TensorInfo(TensorShape(23U, 27U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 27U, 6U), 1, DataType::F32)
+ })),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(23U, 27U, 9U), 1, DataType::F16),
+ TensorInfo(TensorShape(25U, 12U, 9U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 8U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 27U, 12U), 1, DataType::F32)
+ })),
+ framework::dataset::make("Expected", { false, false, false, true })),
+ input_info1, input_info2, output_info,expected)
+{
+ std::vector<TensorInfo> inputs_vector_info;
+ inputs_vector_info.emplace_back(std::move(input_info1));
+ inputs_vector_info.emplace_back(std::move(input_info2));
+
+ std::vector<ITensorInfo *> inputs_vector_info_raw;
+ for(auto &input : inputs_vector_info)
+ {
+ inputs_vector_info_raw.emplace_back(&input);
+ }
+
+ bool is_valid = bool(CLDepthConcatenateLayer::validate(inputs_vector_info_raw,
+ &output_info.clone()->set_is_resizable(false)));
+ ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
TEST_CASE(Configuration, framework::DatasetMode::ALL)
{
// Create tensors
@@ -98,42 +136,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLDepthConcatenateLayerFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Tiny2DShapes(),
- framework::dataset::make("DataType",
- DataType::QS8)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthConcatenateLayerFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(),
- framework::dataset::make("DataType",
- DataType::QS8)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLDepthConcatenateLayerFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Tiny2DShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthConcatenateLayerFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/CL/DepthConvertLayer.cpp b/tests/validation/CL/DepthConvertLayer.cpp
index 603f4a0..fe46313 100644
--- a/tests/validation/CL/DepthConvertLayer.cpp
+++ b/tests/validation/CL/DepthConvertLayer.cpp
@@ -44,19 +44,16 @@
namespace
{
/** Input data sets **/
-const auto DepthConvertLayerU8toU16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U16));
-const auto DepthConvertLayerU8toS16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16));
-const auto DepthConvertLayerU8toS32Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S32));
-const auto DepthConvertLayerU16toU8Dataset = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U8));
-const auto DepthConvertLayerU16toU32Dataset = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U32));
-const auto DepthConvertLayerS16toU8Dataset = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::U8));
-const auto DepthConvertLayerS16toS32Dataset = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::S32));
-const auto DepthConvertLayerQS8toFP32Dataset = combine(framework::dataset::make("DataType", DataType::QS8), framework::dataset::make("DataType", DataType::F32));
-const auto DepthConvertLayerQS16toFP32Dataset = combine(framework::dataset::make("DataType", DataType::QS16), framework::dataset::make("DataType", DataType::F32));
-const auto DepthConvertLayerFP32toQS8Dataset = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::QS8));
-const auto DepthConvertLayerFP32toQS16Dataset = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::QS16));
-const auto DepthConvertLayerShiftDataset = framework::dataset::make("Shift", 0, 7);
-const auto DepthConvertLayerFixedPointQuantizedDataset = framework::dataset::make("FractionalBits", 1, 7);
+const auto DepthConvertLayerU8toU16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U16));
+const auto DepthConvertLayerU8toS16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16));
+const auto DepthConvertLayerU8toS32Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S32));
+const auto DepthConvertLayerU16toU8Dataset = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U8));
+const auto DepthConvertLayerU16toU32Dataset = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U32));
+const auto DepthConvertLayerS16toU8Dataset = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::U8));
+const auto DepthConvertLayerS16toS32Dataset = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::S32));
+const auto DepthConvertLayerF16toF32Dataset = combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::F32));
+const auto DepthConvertLayerF32toF16Dataset = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::F16));
+const auto DepthConvertLayerShiftDataset = framework::dataset::make("Shift", 0, 7);
} // namespace
TEST_SUITE(CL)
@@ -72,22 +69,18 @@
template <typename T>
using CLDepthConvertLayerToU32Fixture = DepthConvertLayerValidationFixture<CLTensor, CLAccessor, CLDepthConvertLayer, T, uint32_t>;
template <typename T>
-using CLDepthConvertLayerToFP32FixedPointFixture = DepthConvertLayerValidationFractionalBitsFixture<CLTensor, CLAccessor, CLDepthConvertLayer, T, float>;
+using CLDepthConvertLayerToF16Fixture = DepthConvertLayerValidationFixture<CLTensor, CLAccessor, CLDepthConvertLayer, T, half>;
template <typename T>
-using CLDepthConvertLayerToQS8FixedPointFixture = DepthConvertLayerValidationFractionalBitsFixture<CLTensor, CLAccessor, CLDepthConvertLayer, T, int8_t>;
-template <typename T>
-using CLDepthConvertLayerToQS16FixedPointFixture = DepthConvertLayerValidationFractionalBitsFixture<CLTensor, CLAccessor, CLDepthConvertLayer, T, int16_t>;
+using CLDepthConvertLayerToF32Fixture = DepthConvertLayerValidationFixture<CLTensor, CLAccessor, CLDepthConvertLayer, T, float>;
TEST_SUITE(U8_to_U16)
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, DataType::U8, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::U16, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::U8, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::U16, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -125,11 +118,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, DataType::U8, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::S16, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::U8, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::S16, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -166,11 +157,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, DataType::U8, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::S32, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::U8, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::S32, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -208,11 +197,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, DataType::U16, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::U16, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -249,11 +236,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, DataType::U16, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::U32, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::U16, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::U32, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -290,11 +275,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, DataType::S16, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::S16, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::U8, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -331,11 +314,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, DataType::S16, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::S32, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::S16, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::S32, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -367,17 +348,14 @@
}
TEST_SUITE_END()
-TEST_SUITE(Quantized_to_FP32)
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::QS8, DataType::QS16 })),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset),
- shape, dt, policy, fixed_point_position)
+TEST_SUITE(F16_to_F32)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
+ DepthConvertLayerShiftDataset),
+ shape, policy, shift)
{
- int shift = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, dt, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, DataType::F32, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::F16, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::F32, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -392,51 +370,31 @@
validate(src.info()->padding(), padding);
validate(dst.info()->padding(), padding);
}
-FIXTURE_DATA_TEST_CASE(RunTinyQS8, CLDepthConvertLayerToFP32FixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- DepthConvertLayerQS8toFP32Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthConvertLayerToF32Fixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerF16toF32Dataset),
+ framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
+ DepthConvertLayerShiftDataset))
{
// Validate output
validate(CLAccessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunTinyQS16, CLDepthConvertLayerToFP32FixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- DepthConvertLayerQS16toFP32Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmallQS8, CLDepthConvertLayerToFP32FixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- DepthConvertLayerQS8toFP32Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmallQS16, CLDepthConvertLayerToFP32FixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- DepthConvertLayerQS16toFP32Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthConvertLayerToF32Fixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerF16toF32Dataset),
+ framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
+ DepthConvertLayerShiftDataset))
{
// Validate output
validate(CLAccessor(_target), _reference);
}
TEST_SUITE_END()
-TEST_SUITE(FP32_to_Quantized)
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::QS8, DataType::QS16 })),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset),
- shape, dt, policy, fixed_point_position)
+TEST_SUITE(F32_to_F16)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
+ DepthConvertLayerShiftDataset),
+ shape, policy, shift)
{
- int shift = 0;
-
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, DataType::F32, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(shape, dt, 1, fixed_point_position);
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::F32, 1);
+ CLTensor dst = create_tensor<CLTensor>(shape, DataType::F16, 1);
// Create and Configure function
CLDepthConvertLayer depth_convert;
@@ -451,34 +409,17 @@
validate(src.info()->padding(), padding);
validate(dst.info()->padding(), padding);
}
-FIXTURE_DATA_TEST_CASE(RunTinyQS8, CLDepthConvertLayerToQS8FixedPointFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- DepthConvertLayerFP32toQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthConvertLayerToF16Fixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerF32toF16Dataset),
+ framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
+ DepthConvertLayerShiftDataset))
{
// Validate output
validate(CLAccessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunTinyQS16, CLDepthConvertLayerToQS16FixedPointFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- DepthConvertLayerFP32toQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmallQS8, CLDepthConvertLayerToQS8FixedPointFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- DepthConvertLayerFP32toQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmallQS16, CLDepthConvertLayerToQS16FixedPointFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- DepthConvertLayerFP32toQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthConvertLayerToF16Fixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerF32toF16Dataset),
+ framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
+ DepthConvertLayerShiftDataset))
{
// Validate output
validate(CLAccessor(_target), _reference);
diff --git a/tests/validation/CL/DepthwiseConvolutionLayer.cpp b/tests/validation/CL/DepthwiseConvolutionLayer.cpp
index 093d342..d4891bc 100644
--- a/tests/validation/CL/DepthwiseConvolutionLayer.cpp
+++ b/tests/validation/CL/DepthwiseConvolutionLayer.cpp
@@ -56,57 +56,57 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32, 0), // Mismatching data type input/weights
- TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32, 0), // Mismatching input feature maps
- TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32, 0), // Unsupported weights dimensions
- TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8, 0), // Unsupported activation
- TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32, 0), // Mismatching depth multiplier
- TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32, 0), // Invalid stride
- TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32, 0), // Invalid biases size
- TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32, 0), // Invalid biases dimensions
- TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32, 0), // Invalid output size
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(50U, 32U, 8U), 1, DataType::QASYMM8, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
+ TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Unsupported activation
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid stride
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32),
+ TensorInfo(TensorShape(50U, 32U, 8U), 1, DataType::QASYMM8),
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::QASYMM8, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8, 0),
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
})),
- framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::S32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(24U), 1, DataType::S32, 0),
+ framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::S32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(24U), 1, DataType::S32),
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8, 0),
- TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(48U, 30U, 24U), 1, DataType::QASYMM8, 0),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(48U, 30U, 24U), 1, DataType::QASYMM8),
})),
framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
PadStrideInfo(1, 1, 0, 0),
@@ -155,41 +155,41 @@
}
DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type input/weights
- TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32, 0), // Mismatching input feature maps
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching depth multiplier
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid biases size
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid biases dimensions
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid output size
- TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
+ TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
+ TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8),
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8, 0),
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
})),
- framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(24U), 1, DataType::S32, 0),
+ framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(24U), 1, DataType::S32),
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8, 0),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8),
})),
framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
PadStrideInfo(1, 1, 0, 0),
@@ -251,7 +251,7 @@
FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers),
framework::dataset::make("DataType",
DataType::F16)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
}
@@ -259,7 +259,7 @@
depth_multipliers),
framework::dataset::make("DataType",
DataType::F16)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
}
@@ -268,6 +268,7 @@
TEST_SUITE(FP32)
TEST_SUITE(W3x3)
+TEST_SUITE(NCHW)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL,
combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()),
@@ -287,12 +288,32 @@
validate(CLAccessor(_target), _reference, tolerance_f32);
}
TEST_SUITE_END()
+TEST_SUITE(NHWC)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL,
+ combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
+ framework::dataset::make("DepthMultiplier", 1)),
+ framework::dataset::make("DataType",
+ DataType::F32)),
+ framework::dataset::make("DataLayout", DataLayout::NHWC)))
+{
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
+ framework::dataset::make("DepthMultiplier", 1)),
+ framework::dataset::make("DataType",
+ DataType::F32)),
+ framework::dataset::make("DataLayout", DataLayout::NHWC)))
+{
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+TEST_SUITE_END()
+TEST_SUITE_END()
TEST_SUITE(Generic)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers),
framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(CLAccessor(_target), _reference, tolerance_f32);
}
@@ -300,7 +321,7 @@
depth_multipliers),
framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(CLAccessor(_target), _reference, tolerance_f32);
}
@@ -321,7 +342,7 @@
depth_multipliers),
framework::dataset::make("DataType", DataType::QASYMM8)),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
@@ -330,7 +351,7 @@
depth_multipliers),
framework::dataset::make("DataType", DataType::QASYMM8)),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
@@ -338,7 +359,7 @@
TEST_SUITE(W3x3)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
- framework::dataset::make("DepthMultiplier", 1)), // COMPMID-1071 Add depth multiplier support for NHWC
+ framework::dataset::make("DepthMultiplier", 1)),
framework::dataset::make("DataType", DataType::QASYMM8)),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
@@ -347,7 +368,7 @@
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
- framework::dataset::make("DepthMultiplier", 1)), // COMPMID-1071 Add depth multiplier support for NHWC
+ framework::dataset::make("DepthMultiplier", 1)),
framework::dataset::make("DataType", DataType::QASYMM8)),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
diff --git a/tests/validation/CL/DilatedConvolutionLayer.cpp b/tests/validation/CL/DilatedConvolutionLayer.cpp
index 18d0fa8..d6b2859 100644
--- a/tests/validation/CL/DilatedConvolutionLayer.cpp
+++ b/tests/validation/CL/DilatedConvolutionLayer.cpp
@@ -43,19 +43,18 @@
{
namespace
{
-RelativeTolerance<float> tolerance_f32(0.05f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
-RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.2)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
-constexpr AbsoluteTolerance<float> tolerance_fixed(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */
-constexpr AbsoluteTolerance<float> tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
-constexpr float tolerance_num = 0.07f; /**< Tolerance number */
+RelativeTolerance<float> rel_tolerance_f32(0.05f); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType::F32 */
+RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.2)); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType::F16 */
+constexpr AbsoluteTolerance<float> abs_tolerance_qasymm8(0.0); /**< Relative tolerance value for comparing reference's output against implementation's output for quantized data types */
+constexpr float abs_tolerance_f32 = 0.001f; /**< Absolute tolerance value for comparing reference's output against implementation's output for DataType::F32 */
+constexpr float abs_tolerance_f16 = 0.3f; /**< Absolute tolerance value for comparing reference's output against implementation's output for DataType::F16 */
+constexpr float tolerance_num_f16 = 0.07f; /**< Tolerance number for FP16 */
/** CNN data types */
const auto CNNDataTypes = framework::dataset::make("DataType",
{
DataType::F16,
DataType::F32,
- DataType::QS8,
- DataType::QS16,
DataType::QASYMM8,
});
} // namespace
@@ -64,23 +63,23 @@
TEST_SUITE(DilatedConvolutionLayer)
DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(23U, 27U, 23U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32, 0)
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 23U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32),
+ TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32)
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 23U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16, 0)
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 2U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 23U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16)
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32, 0)
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32)
})),
framework::dataset::make("ConvInfo", { PadStrideInfo(1, 2, 1, 1),
PadStrideInfo(1, 2, 1, 1),
@@ -109,6 +108,7 @@
&output_info.clone()->set_is_resizable(true), conv_info, WeightsInfo(), ActivationLayerInfo(), gpu_target, dilation);
ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
}
+
TEST_SUITE_END()
TEST_SUITE(GEMMDilatedConvolutionLayer)
@@ -117,16 +117,13 @@
CNNDataTypes),
input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type)
{
- // Set fixed point position data type allowed
- int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
auto bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
// Create tensors
- CLTensor src = create_tensor<CLTensor>(input_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- CLTensor weights = create_tensor<CLTensor>(weights_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- CLTensor bias = create_tensor<CLTensor>(bias_shape, bias_data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- CLTensor dst = create_tensor<CLTensor>(output_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
+ CLTensor src = create_tensor<CLTensor>(input_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ CLTensor weights = create_tensor<CLTensor>(weights_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ CLTensor bias = create_tensor<CLTensor>(bias_shape, bias_data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ CLTensor dst = create_tensor<CLTensor>(output_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -166,98 +163,44 @@
FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMDilatedConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType", DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
+ validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.0f, abs_tolerance_f16);
}
+
FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMDilatedConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDilatedConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType", DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
+ validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num_f16);
}
+
TEST_SUITE_END()
TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMDilatedConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType", DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_f32);
+ validate(CLAccessor(_target), _reference, rel_tolerance_f32);
}
+
FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMDilatedConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDilatedConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType", DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_f32, 0.00002);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
-using CLGEMMDilatedConvolutionLayerFixedPointFixture = ConvolutionValidationFixedPointFixture<CLTensor, CLAccessor, CLGEMMConvolutionLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// We test for fixed point precision [4,6]
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMDilatedConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(datasets::TinyDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMDilatedConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY,
- combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMDilatedConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(datasets::TinyDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)),
- framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMDilatedConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY,
- combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)),
- framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed);
+ validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32);
}
TEST_SUITE_END()
TEST_SUITE_END()
@@ -268,24 +211,27 @@
TEST_SUITE(Quantized)
TEST_SUITE(QASYMM8)
FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMDilatedConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QASYMM8)),
+ combine(combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
+ framework::dataset::make("ReshapeWeights", { true })),
+ framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_qasymm8);
+ validate(CLAccessor(_target), _reference, abs_tolerance_qasymm8);
}
+
FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMDilatedConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
- combine(combine(combine(combine(datasets::LargeDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QASYMM8)),
+ combine(combine(combine(combine(combine(datasets::LargeDilatedConvolutionLayerDataset(),
+ framework::dataset::make("ReshapeWeights", { true })),
+ framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 0) })),
framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_qasymm8);
+ validate(CLAccessor(_target), _reference, abs_tolerance_qasymm8);
}
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/CL/DirectConvolutionLayer.cpp b/tests/validation/CL/DirectConvolutionLayer.cpp
index 00a01b0..23dbc7a 100644
--- a/tests/validation/CL/DirectConvolutionLayer.cpp
+++ b/tests/validation/CL/DirectConvolutionLayer.cpp
@@ -43,13 +43,10 @@
{
namespace
{
-// COMPMID-517 Invesitgate the mismatch to see whether it is a real bug
RelativeTolerance<half> tolerance_fp16(half(0.2)); /**< Tolerance for floating point tests */
RelativeTolerance<float> tolerance_fp32(0.02f); /**< Tolerance for floating point tests */
constexpr float tolerance_num = 0.07f; /**< Tolerance number */
-constexpr AbsoluteTolerance<int8_t> tolerance_qs8(0); /**< Tolerance for fixed point tests */
-constexpr AbsoluteTolerance<int16_t> tolerance_qs16(0); /**< Tolerance for fixed point tests */
constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance for quantized tests */
/** Direct convolution data set. */
@@ -63,16 +60,7 @@
combine(framework::dataset::make("PadY", 0, 2),
framework::dataset::make("KernelSize", { 3, 5 })))),
framework::dataset::make("NumKernels", { 1, 4, 8, 16 })))));
-const auto data_fixed_point = combine(datasets::TinyDirectConvolutionShapes(),
- combine(framework::dataset::make("StrideX", 1, 3),
- combine(framework::dataset::make("StrideY", 1, 3),
- combine(concat(combine(framework::dataset::make("PadX", 0),
- combine(framework::dataset::make("PadY", 0),
- framework::dataset::make("KernelSize", 1))),
- combine(framework::dataset::make("PadX", 0, 2),
- combine(framework::dataset::make("PadY", 0, 2),
- framework::dataset::make("KernelSize", { 3 })))),
- framework::dataset::make("NumKernels", { 1, 4, 8, 16 })))));
+
/** Activation function Dataset*/
const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
{
@@ -89,53 +77,53 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type input/weights
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching input feature maps
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Unsupported kernel width
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Non-rectangular weights dimensions
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid weights dimensions
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid stride
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid biases size
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid biases dimensions
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid output size
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching input feature maps
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported kernel width
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Non-rectangular weights dimensions
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights dimensions
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid stride
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32),
}),
- framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(3U, 3U, 3U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(9U, 9U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U, 3U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32, 0),
+ framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 3U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(9U, 9U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U, 3U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32),
})),
- framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
+ framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
})),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(26U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(26U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32),
})),
framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
PadStrideInfo(1, 1, 0, 0),
@@ -181,7 +169,7 @@
TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(data, framework::dataset::make("DataType", DataType::F32)),
ActivationFunctionsDataset),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_fp32);
@@ -200,33 +188,6 @@
TEST_SUITE_END()
template <typename T>
-using CLDirectConvolutionLayerFixedPointFixture = DirectConvolutionValidationFixedPointFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(data_fixed_point, framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 2, 7)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs8);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(data_fixed_point, framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 2, 15)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs16);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
using CLDirectConvolutionLayerQuantizedFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
template <typename T>
using CLDirectConvolutionValidationWithTensorShapesQuantizedFixture = DirectConvolutionValidationWithTensorShapesQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
diff --git a/tests/validation/CL/FixedPoint/FixedPointTarget.h b/tests/validation/CL/FixedPoint/FixedPointTarget.h
deleted file mode 100644
index 3847354..0000000
--- a/tests/validation/CL/FixedPoint/FixedPointTarget.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_FIXED_POINT_CL_TARGET
-#define ARM_COMPUTE_TEST_FIXED_POINT_CL_TARGET
-
-#include "arm_compute/runtime/CL/CLScheduler.h"
-
-#include "tests/Globals.h"
-#include "tests/Types.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-template <typename TensorType, typename AccessorType, typename T>
-void compute_target_impl(const TensorShape &shape, DataType dt, FixedPointOp op, int fixed_point_position, TensorType &src, TensorType &dst)
-{
- std::string fixed_point_operation_kernel;
-#ifndef EMBEDDED_KERNELS
- std::cout << "EMBEDDED_KERNELS NOT DEFINED" << std::endl;
-
- fixed_point_operation_kernel += "#include \"fixed_point.h\"\n";
-#endif /* EMBEDDED_KERNELS */
- fixed_point_operation_kernel +=
- "__kernel void fixed_point_operation_qs8( \n"
- " __global char* src, \n"
- " __global char* dst) \n"
- "{ \n"
- " char16 in = vload16(0, src + get_global_id(0) * 16); \n"
- " if(FIXED_POINT_OP == 0) \n"
- " { \n"
- " vstore16(EXP_OP_EXPAND(in, DATA_TYPE, 16, FIXED_POINT_POS), 0, dst + get_global_id(0) * 16); \n"
- " } \n"
- " else if(FIXED_POINT_OP == 1) \n"
- " { \n"
- " vstore16(INVSQRT_OP_EXPAND(in, DATA_TYPE, 16, FIXED_POINT_POS), 0, dst + get_global_id(0) * 16); \n"
- " } \n"
- " else \n"
- " { \n"
- " vstore16(LOG_OP_EXPAND(in, DATA_TYPE, 16, FIXED_POINT_POS), 0, dst + get_global_id(0) * 16); \n"
- " } \n"
- "} \n"
- "\n";
-
- // Set build options
- std::string build_opts = "-DFIXED_POINT_POS=" + support::cpp11::to_string(fixed_point_position);
- build_opts += " -DDATA_TYPE=qs8";
-
- // Fill tensors.
- int min = 0;
- int max = 0;
- switch(op)
- {
- case(FixedPointOp::EXP):
- min = -(1 << (fixed_point_position - 1));
- max = (1 << (fixed_point_position - 1));
- build_opts += " -DFIXED_POINT_OP=0";
- break;
- case(FixedPointOp::INV_SQRT):
- min = 1;
- max = (dt == DataType::QS8) ? 0x7F : 0x7FFF;
- build_opts += " -DFIXED_POINT_OP=1";
- break;
- case(FixedPointOp::LOG):
- min = (1 << (fixed_point_position - 1));
- max = (dt == DataType::QS8) ? 0x3F : 0x3FFF;
- build_opts += " -DFIXED_POINT_OP=2";
- break;
- default:
- ARM_COMPUTE_ERROR("Fixed point operation not supported");
- break;
- }
-
- std::uniform_int_distribution<> distribution(min, max);
- library->fill(AccessorType(src), distribution, 0);
-
- std::vector<std::string> sources;
-
-#ifndef EMBEDDED_KERNELS
- build_opts += " -I" + CLKernelLibrary::get().get_kernel_path();
-#else /* EMBEDDED_KERNELS */
- sources.push_back(CLKernelLibrary::get().get_program_source("fixed_point.h"));
-#endif /* EMBEDDED_KERNELS */
-
- sources.push_back(fixed_point_operation_kernel);
-
- // Create program
- ::cl::Program program(sources);
-
- // Build program
- program.build(build_opts.c_str());
-
- ::cl::Kernel kernel(program, "fixed_point_operation_qs8", nullptr);
-
- unsigned int idx = 0;
- kernel.setArg(idx++, src.cl_buffer());
- kernel.setArg(idx++, dst.cl_buffer());
-
- ::cl::NDRange gws(shape[0] / 16, 1, 1);
- CLScheduler::get().queue().enqueueNDRangeKernel(kernel, 0, gws);
-}
-} // namespace
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_FIXED_POINT_TARGET */
diff --git a/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp b/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp
deleted file mode 100644
index 186fc4c..0000000
--- a/tests/validation/CL/FixedPoint/FixedPoint_QS8.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "FixedPointTarget.h"
-
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#include "arm_compute/runtime/CL/CLTensorAllocator.h"
-#include "tests/CL/CLAccessor.h"
-#include "tests/PaddingCalculator.h"
-#include "tests/datasets/ShapeDatasets.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "tests/validation/Validation.h"
-#include "tests/validation/fixtures/FixedPointFixture.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-constexpr AbsoluteTolerance<float> tolerance_exp(1.0f); /**< Tolerance value for comparing reference's output against implementation's output (exponential)*/
-constexpr AbsoluteTolerance<float> tolerance_invsqrt(4.0f); /**< Tolerance value for comparing reference's output against implementation's output (inverse square-root) */
-constexpr AbsoluteTolerance<float> tolerance_log(5.0f); /**< Tolerance value for comparing reference's output against implementation's output (logarithm) */
-} // namespace
-
-TEST_SUITE(CL)
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-
-template <typename T>
-using CLFixedPointFixture = FixedPointValidationFixture<CLTensor, CLAccessor, T>;
-
-TEST_SUITE(Exp)
-FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FixedPointOp", FixedPointOp::EXP)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_exp);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(Log)
-FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FixedPointOp", FixedPointOp::LOG)),
- framework::dataset::make("FractionalBits", 3, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_log);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(Invsqrt)
-FIXTURE_DATA_TEST_CASE(RunSmall, CLFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FixedPointOp", FixedPointOp::INV_SQRT)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_invsqrt);
-}
-TEST_SUITE_END()
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/CL/Flatten.cpp b/tests/validation/CL/Flatten.cpp
index 04fbef6..ceaf123 100644
--- a/tests/validation/CL/Flatten.cpp
+++ b/tests/validation/CL/Flatten.cpp
@@ -78,38 +78,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLFlattenLayerFixture<int8_t>, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::Tiny3DShapes(), datasets::Tiny4DShapes()),
- framework::dataset::make("DataType", DataType::QS8)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLFlattenLayerFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(framework::dataset::concat(datasets::Small3DShapes(), datasets::Small4DShapes()),
- framework::dataset::make("DataType", DataType::QS8)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLFlattenLayerFixture<int16_t>, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::Tiny3DShapes(), datasets::Tiny4DShapes()),
- framework::dataset::make("DataType", DataType::QS16)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLFlattenLayerFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(framework::dataset::concat(datasets::Small3DShapes(), datasets::Small4DShapes()),
- framework::dataset::make("DataType", DataType::QS16)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/CL/FullyConnectedLayer.cpp b/tests/validation/CL/FullyConnectedLayer.cpp
index 7db9cf5..18ee518 100644
--- a/tests/validation/CL/FullyConnectedLayer.cpp
+++ b/tests/validation/CL/FullyConnectedLayer.cpp
@@ -43,12 +43,11 @@
namespace
{
/** Tolerance for float operations */
-RelativeTolerance<float> tolerance_f32(0.05f);
-RelativeTolerance<half_float::half> tolerance_f16(half(0.2));
-constexpr float tolerance_num = 0.07f; /**< Tolerance number */
+constexpr RelativeTolerance<float> rel_tolerance_f32(0.05f); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType:F32 */
+constexpr AbsoluteTolerance<float> abs_tolerance_f32(0.0001f); /**< Absolute tolerance value for comparing reference's output against implementation's output for DataType::F32 */
+RelativeTolerance<half_float::half> tolerance_f16(half(0.2)); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType::F16 */
+constexpr float tolerance_num = 0.07f; /**< Tolerance number */
-/** Tolerance for fixed point operations */
-constexpr AbsoluteTolerance<float> tolerance_fixed_point(1.f);
/** Tolerance for quantized asymmetric operations */
constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1);
@@ -57,8 +56,6 @@
{
DataType::F16,
DataType::F32,
- DataType::QS8,
- DataType::QS16,
DataType::QASYMM8,
});
@@ -73,10 +70,8 @@
CNNDataTypes),
src_shape, weights_shape, bias_shape, dst_shape, transpose_weights, reshape_weights, data_type)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
- const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
- const QuantizationInfo quantization_info = is_data_type_quantized_asymmetric(data_type) ? QuantizationInfo(2.f / 255.f, 127) : QuantizationInfo();
+ const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
+ const QuantizationInfo quantization_info = is_data_type_quantized_asymmetric(data_type) ? QuantizationInfo(2.f / 255.f, 127) : QuantizationInfo();
TensorShape ws(weights_shape);
@@ -89,10 +84,10 @@
}
// Create tensors
- CLTensor src = create_tensor<CLTensor>(src_shape, data_type, 1, fixed_point_position, quantization_info);
- CLTensor weights = create_tensor<CLTensor>(ws, data_type, 1, fixed_point_position, quantization_info);
- CLTensor bias = create_tensor<CLTensor>(bias_shape, bias_data_type, 1, fixed_point_position, quantization_info);
- CLTensor dst = create_tensor<CLTensor>(dst_shape, data_type, 1, fixed_point_position, quantization_info);
+ CLTensor src = create_tensor<CLTensor>(src_shape, data_type, 1, quantization_info);
+ CLTensor weights = create_tensor<CLTensor>(ws, data_type, 1, quantization_info);
+ CLTensor bias = create_tensor<CLTensor>(bias_shape, bias_data_type, 1, quantization_info);
+ CLTensor dst = create_tensor<CLTensor>(dst_shape, data_type, 1, quantization_info);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -102,9 +97,14 @@
const QuantizationInfo src_quantization_info = src.info()->quantization_info();
const QuantizationInfo weights_quantization_info = weights.info()->quantization_info();
+ // Create Fully Connected layer info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.transpose_weights = transpose_weights;
+ fc_info.are_weights_reshaped = !reshape_weights;
+
// Create and configure function.
CLFullyConnectedLayer fc;
- fc.configure(&src, &weights, &bias, &dst, transpose_weights, !reshape_weights);
+ fc.configure(&src, &weights, &bias, &dst, fc_info);
// Validate valid region
const ValidRegion dst_valid_region = shape_to_valid_region(dst_shape);
@@ -119,51 +119,51 @@
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
framework::dataset::make("InputInfo", { TensorInfo(TensorShape(9U, 5U, 7U, 3U), 1, DataType::F32), // Mismatching data types
- TensorInfo(TensorShape(9U, 5U, 7U, 3U), 1, DataType::QS8, 2), // Mismatching fixed point position
TensorInfo(TensorShape(8U, 4U, 6U, 4U), 1, DataType::F32),
TensorInfo(TensorShape(8U, 4U, 6U, 4U), 1, DataType::F32),
TensorInfo(TensorShape(9U, 5U, 7U, 3U), 1, DataType::F32), // Invalid weights dimensions
TensorInfo(TensorShape(9U, 5U, 7U, 3U), 1, DataType::F32), // Wrongly reshaped weights
}),
framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(315U, 271U), 1, DataType::F16),
- TensorInfo(TensorShape(315U, 271U), 1, DataType::QS8, 3),
TensorInfo(TensorShape(192U, 192U), 1, DataType::F32),
TensorInfo(TensorShape(192U, 192U), 1, DataType::F32),
TensorInfo(TensorShape(217U, 231U), 1, DataType::F32),
TensorInfo(TensorShape(217U, 315U), 1, DataType::F32),
})),
framework::dataset::make("BiasInfo",{ TensorInfo(TensorShape(271U), 1, DataType::F32),
- TensorInfo(TensorShape(271U), 1, DataType::QS8, 2),
TensorInfo(TensorShape(192U), 1, DataType::F32),
TensorInfo(TensorShape(192U), 1, DataType::F32),
TensorInfo(TensorShape(271U), 1, DataType::F32),
TensorInfo(TensorShape(271U), 1, DataType::F32),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(271U, 3U), 1, DataType::F32),
- TensorInfo(TensorShape(271U, 3U), 1, DataType::QS8, 3),
TensorInfo(TensorShape(192U, 4U), 1, DataType::F32),
TensorInfo(TensorShape(192U, 4U), 1, DataType::F32),
TensorInfo(TensorShape(271U, 3U), 1, DataType::F32),
TensorInfo(TensorShape(271U, 3U), 1, DataType::F32),
})),
- framework::dataset::make("TransposeWeights",{ true, true, true, false, true, true })),
- framework::dataset::make("ReshapedWeights",{ false, false, false, false, false, false})),
- framework::dataset::make("Expected", { false, false, true, true, false, false })),
+ framework::dataset::make("TransposeWeights",{ true, true, false, true, true })),
+ framework::dataset::make("ReshapedWeights",{ false, false, false, false, false})),
+ framework::dataset::make("Expected", { false, true, true, false, false })),
input_info, weights_info, bias_info, output_info, transpose_weights, reshaped_weights, expected)
{
+ // Create Fully Connected layer info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.transpose_weights = transpose_weights;
+ fc_info.are_weights_reshaped = reshaped_weights;
+
Status status = CLFullyConnectedLayer::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);
+ fc_info);
ARM_COMPUTE_EXPECT(bool(status) == expected, framework::LogLevel::ERRORS);
}
// clang-format on
// *INDENT-ON*
template <typename T>
-using CLFullyConnectedLayerFixture = FullyConnectedLayerValidationFixture<CLTensor, CLAccessor, CLFullyConnectedLayer, T, false>;
+using CLFullyConnectedLayerFixture = FullyConnectedLayerValidationFixture<CLTensor, CLAccessor, CLFullyConnectedLayer, T>;
TEST_SUITE(Float)
TEST_SUITE(FP16)
@@ -188,68 +188,19 @@
framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_f32);
+ validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0, abs_tolerance_f32);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLFullyConnectedLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeFullyConnectedLayerDataset(), FullyConnectedParameters),
framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_f32);
+ validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0, abs_tolerance_f32);
}
TEST_SUITE_END()
TEST_SUITE_END()
template <typename T>
-using CLFullyConnectedLayerFixedPointFixture = FullyConnectedLayerValidationFixedPointFixture<CLTensor, CLAccessor, CLFullyConnectedLayer, T, false>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5
-FIXTURE_DATA_TEST_CASE(RunTiny, CLFullyConnectedLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyFullyConnectedLayerDataset(),
- FullyConnectedParameters),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed_point);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallFullyConnectedLayerDataset(),
- FullyConnectedParameters),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed_point);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14
-FIXTURE_DATA_TEST_CASE(RunTiny, CLFullyConnectedLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyFullyConnectedLayerDataset(),
- FullyConnectedParameters),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed_point);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLFullyConnectedLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallFullyConnectedLayerDataset(),
- FullyConnectedParameters),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed_point);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
-using CLFullyConnectedLayerQuantizedFixture = FullyConnectedLayerValidationQuantizedFixture<CLTensor, CLAccessor, CLFullyConnectedLayer, T, false>;
+using CLFullyConnectedLayerQuantizedFixture = FullyConnectedLayerValidationQuantizedFixture<CLTensor, CLAccessor, CLFullyConnectedLayer, T>;
TEST_SUITE(Quantized)
TEST_SUITE(QASYMM8)
diff --git a/tests/validation/CL/GEMM.cpp b/tests/validation/CL/GEMM.cpp
index 3712de9..b33787c 100644
--- a/tests/validation/CL/GEMM.cpp
+++ b/tests/validation/CL/GEMM.cpp
@@ -53,7 +53,6 @@
constexpr float abs_tolerance_f32(
0.0001f); /**< Absolute tolerance value for comparing reference's output against implementation's output for floating point data types in case using relative tolerance fails because of small values */
RelativeTolerance<half_float::half> tolerance_f16(half(0.2)); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */
-constexpr AbsoluteTolerance<float> tolerance_q(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */
constexpr float tolerance_num = 0.02f; /**< Tolerance number */
const auto data_interleave = framework::dataset::make("M", 8, 14) * framework::dataset::make("N", 7, 14);
@@ -62,8 +61,6 @@
{
DataType::F16,
DataType::F32,
- DataType::QS8,
- DataType::QS16,
});
} // namespace
@@ -84,44 +81,16 @@
}
TEST_SUITE_END() // FP32
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-using CLGEMMInterleave4x4Fixture = GEMMInterleave4x4ValidationFixedPointFixture<CLTensor, CLAccessor, CLGEMMInterleave4x4, int8_t>;
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMInterleave4x4Fixture, framework::DatasetMode::PRECOMMIT, data_interleave *
- framework::dataset::make("DataType", DataType::QS8)
- * framework::dataset::make("FractionalBits", 1, 7))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-using CLGEMMInterleave4x4Fixture = GEMMInterleave4x4ValidationFixedPointFixture<CLTensor, CLAccessor, CLGEMMInterleave4x4, int16_t>;
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMInterleave4x4Fixture, framework::DatasetMode::PRECOMMIT, data_interleave *
- framework::dataset::make("DataType", DataType::QS16)
- * framework::dataset::make("FractionalBits", 1, 14))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE_END()
-
TEST_SUITE_END() // INTERLEAVE_4X4
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallGEMMDataset(), datasets::LargeGEMMDataset()), CNNDataTypes),
shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
// Create tensors
- CLTensor a = create_tensor<CLTensor>(shape_a, data_type, 1, fixed_point_position);
- CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, fixed_point_position);
- CLTensor c = create_tensor<CLTensor>(shape_c, data_type, 1, fixed_point_position);
- CLTensor dst = create_tensor<CLTensor>(output_shape, data_type, 1, fixed_point_position);
+ CLTensor a = create_tensor<CLTensor>(shape_a, data_type, 1);
+ CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1);
+ CLTensor c = create_tensor<CLTensor>(shape_c, data_type, 1);
+ CLTensor dst = create_tensor<CLTensor>(output_shape, data_type, 1);
ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -136,6 +105,12 @@
template <typename T>
using CLGEMMFixture = GEMMValidationFixture<CLTensor, CLAccessor, CLGEMM, T>;
+template <typename T>
+using CLGEMMOutput3DFixture = GEMMValidationFixture<CLTensor, CLAccessor, CLGEMM, T, false, true>;
+
+template <typename T>
+using CLGEMMInputOutput3DFixture = GEMMValidationFixture<CLTensor, CLAccessor, CLGEMM, T, true, true>;
+
TEST_SUITE(TRANSPOSE_1XW)
using CLGEMMTranspose1xW = CLSynthetizeFunctionWithZeroConstantBorder<CLGEMMTranspose1xWKernel, 4>;
using CLGEMMTranspose1xWFixture = GEMMTranspose1xWValidationFixture<CLTensor, CLAccessor, CLGEMMTranspose1xW, float>;
@@ -147,33 +122,6 @@
}
TEST_SUITE_END() // FP32
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-using CLGEMMTranspose1xW = CLSynthetizeFunctionWithZeroConstantBorder<CLGEMMTranspose1xWKernel, 16>;
-using CLGEMMTranspose1xWFixture = GEMMTranspose1xWValidationFixedPointFixture<CLTensor, CLAccessor, CLGEMMTranspose1xW, int8_t>;
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMTranspose1xWFixture, framework::DatasetMode::PRECOMMIT, data_transpose *
- framework::dataset::make("DataType", DataType::QS8)
- * framework::dataset::make("FractionalBits", 1, 7))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-using CLGEMMTranspose1xW = CLSynthetizeFunctionWithZeroConstantBorder<CLGEMMTranspose1xWKernel, 8>;
-using CLGEMMTranspose1xWFixture = GEMMTranspose1xWValidationFixedPointFixture<CLTensor, CLAccessor, CLGEMMTranspose1xW, int16_t>;
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMTranspose1xWFixture, framework::DatasetMode::PRECOMMIT, data_transpose *
- framework::dataset::make("DataType", DataType::QS16)
- * framework::dataset::make("FractionalBits", 1, 14))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE_END()
-
TEST_SUITE_END() //TRANSPOSE_1XW
TEST_SUITE(Float)
@@ -205,51 +153,80 @@
TEST_SUITE_END()
TEST_SUITE_END()
-template <typename T>
-using CLGEMMFixedPointFixture = GEMMValidationFixedPointFixture<CLTensor, CLAccessor, CLGEMM, T>;
+TEST_SUITE(INPUT_OUTPUT_3D)
+TEST_SUITE(Float)
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMInputOutput3DFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMInputOutput3DDataset(),
+ framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMInputOutput3DFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMInputOutput3DDataset(),
+ framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32, 0.f, abs_tolerance_f32);
+}
+TEST_SUITE_END() // FP32
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::TinyGEMMDataset(),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 7)))
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMInputOutput3DFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMInputOutput3DDataset(),
+ framework::dataset::make("DataType", DataType::F16)))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_q);
+ validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallGEMMDataset(),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 7)))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMInputOutput3DFixture<half>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMInputOutput3DDataset(),
+ framework::dataset::make("DataType",
+ DataType::F16)))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_q);
+ validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
}
-TEST_SUITE_END()
+TEST_SUITE_END() // FP16
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLGEMMFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::TinyGEMMDataset(),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_q);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallGEMMDataset(),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_q);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // Float
+TEST_SUITE_END() // INPUT_OUTPUT_3D
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE(OUTPUT_3D)
+TEST_SUITE(Float)
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMOutput3DFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMOutput3DDataset(),
+ framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMOutput3DFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMOutput3DDataset(),
+ framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32, 0.f, abs_tolerance_f32);
+}
+TEST_SUITE_END() // FP32
+
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMOutput3DFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMOutput3DDataset(),
+ framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMOutput3DFixture<half>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMOutput3DDataset(),
+ framework::dataset::make("DataType",
+ DataType::F16)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
+}
+TEST_SUITE_END() // FP16
+
+TEST_SUITE_END() // Float
+TEST_SUITE_END() // OUTPUT_3D
+
+TEST_SUITE_END() // GEMM
+TEST_SUITE_END() // CL
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/CL/Im2Col.cpp b/tests/validation/CL/Im2Col.cpp
new file mode 100644
index 0000000..cf7c79a
--- /dev/null
+++ b/tests/validation/CL/Im2Col.cpp
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/CL/kernels/CLIm2ColKernel.h"
+#include "arm_compute/core/Types.h"
+#include "tests/CL/Helper.h"
+
+#include "tests/CL/CLAccessor.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/Im2ColFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+// *INDENT-OFF*
+// clang-format off
+const auto conv_filter_sizes = framework::dataset::make("KernelDims", { Size2D(3U, 3U),
+ Size2D(5U, 5U),
+ Size2D(3U, 1U),
+ Size2D(1U, 3U),
+ Size2D(5U, 3U),
+ Size2D(1U, 1U),
+ Size2D(11U, 11U)} );
+const auto padstrides = framework::dataset::make("PadStride", { PadStrideInfo(1U, 1U, 0U, 0U),
+ PadStrideInfo(1U, 1U, 1U, 1U),
+ PadStrideInfo(2U, 2U, 0U, 2U) });
+const auto conv_args = combine(combine(combine(combine(conv_filter_sizes, padstrides),
+ framework::dataset::make("QuantizationInfo", QuantizationInfo(0.5f, 10))),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
+ framework::dataset::make("NumGroups", { 1 }));
+const auto grouped_args = combine(combine(combine(combine(conv_filter_sizes, padstrides),
+ framework::dataset::make("QuantizationInfo", QuantizationInfo(0.5f, 10))),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("NumGroups", { 2, 3, 4 }));
+
+} // namespace
+TEST_SUITE(CL)
+TEST_SUITE(Im2Col)
+
+using CLIm2Col = CLSynthetizeFunction<CLIm2ColKernel>;
+
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::U8), // Unsupported data type
+ TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::F32), // Mismatching data type
+ TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::QASYMM8), // Bias not supported with QASYMM8
+ TensorInfo(TensorShape(10U, 12U, 2U, 2U), 1, DataType::QASYMM8),
+ }),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 10U, 2U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(18U, 80U, 2U, 1U), 1, DataType::QASYMM8),
+ })),
+ framework::dataset::make("HasBias", { true, true, true, false })),
+ framework::dataset::make("Expected", { false, false, false, true })),
+ input_info, output_info, has_bias, expected)
+{
+
+ bool status = bool(CLIm2Col::validate(&input_info, &output_info, Size2D(3U, 3U), PadStrideInfo(), has_bias));
+ ARM_COMPUTE_EXPECT(status == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
+template <typename T>
+using CLIm2ColFixture = Im2ColValidationFixture<CLTensor, CLAccessor, CLIm2Col, T, true>;
+TEST_SUITE(Float)
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F16)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+TEST_SUITE_END()
+
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QASYMM8)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::QASYMM8)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(Grouped)
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::GroupedIm2ColSmallShapes(), framework::dataset::make("DataType",
+ DataType::F32)),
+ grouped_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::GroupedIm2ColLargeShapes(), framework::dataset::make("DataType",
+ DataType::F32)),
+ grouped_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::GroupedIm2ColSmallShapes(), framework::dataset::make("DataType",
+ DataType::F16)),
+ grouped_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::GroupedIm2ColLargeShapes(), framework::dataset::make("DataType",
+ DataType::F16)),
+ grouped_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLIm2ColFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::GroupedIm2ColSmallShapes(), framework::dataset::make("DataType",
+ DataType::QASYMM8)),
+ grouped_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLIm2ColFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::GroupedIm2ColLargeShapes(), framework::dataset::make("DataType",
+ DataType::QASYMM8)),
+ grouped_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", true)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/LSTMLayer.cpp b/tests/validation/CL/LSTMLayer.cpp
index bd43678..4afebdc 100644
--- a/tests/validation/CL/LSTMLayer.cpp
+++ b/tests/validation/CL/LSTMLayer.cpp
@@ -49,77 +49,77 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(8U, 2U), 1, DataType::U8, 0), // Wrong data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Wrong input size
- TensorInfo(TensorShape(8U, 2U), 1, DataType::F32, 0), // Wrong input weights size
- TensorInfo(TensorShape(8U, 2U), 1, DataType::F32, 0), // Wrong recurrent weights size
- TensorInfo(TensorShape(8U, 2U), 1, DataType::F32, 0), // Wrong cell bias size
- TensorInfo(TensorShape(8U, 2U), 1, DataType::F32, 0), // Wrong cell state size
- TensorInfo(TensorShape(8U, 2U), 1, DataType::F32, 0), // Wrong output size
- TensorInfo(TensorShape(8U, 2U), 1, DataType::F32, 0), // Wrong scratch size
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(8U, 2U), 1, DataType::U8), // Wrong data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Wrong input size
+ TensorInfo(TensorShape(8U, 2U), 1, DataType::F32), // Wrong input weights size
+ TensorInfo(TensorShape(8U, 2U), 1, DataType::F32), // Wrong recurrent weights size
+ TensorInfo(TensorShape(8U, 2U), 1, DataType::F32), // Wrong cell bias size
+ TensorInfo(TensorShape(8U, 2U), 1, DataType::F32), // Wrong cell state size
+ TensorInfo(TensorShape(8U, 2U), 1, DataType::F32), // Wrong output size
+ TensorInfo(TensorShape(8U, 2U), 1, DataType::F32), // Wrong scratch size
}),
- framework::dataset::make("InputWeightsInfo", { TensorInfo(TensorShape(8U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(8U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(8U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(8U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(8U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(8U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(8U, 16U), 1, DataType::F32, 0),
+ framework::dataset::make("InputWeightsInfo", { TensorInfo(TensorShape(8U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(8U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(8U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(8U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(8U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(8U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(8U, 16U), 1, DataType::F32),
})),
- framework::dataset::make("RecurrentWeightsInfo", { TensorInfo(TensorShape(16U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 16U), 1, DataType::F32, 0),
+ framework::dataset::make("RecurrentWeightsInfo", { TensorInfo(TensorShape(16U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 16U), 1, DataType::F32),
})),
- framework::dataset::make("CellBiasInfo", { TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
+ framework::dataset::make("CellBiasInfo", { TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
})),
- framework::dataset::make("ProjectionBiasInfo", { TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U), 1, DataType::F32, 0),
+ framework::dataset::make("ProjectionBiasInfo", { TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
})),
- framework::dataset::make("CellStateInfo", { TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("CellStateInfo", { TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 2U), 1, DataType::F32),
})),
- framework::dataset::make("ScratchInfo", { TensorInfo(TensorShape(64U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(64U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(64U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(64U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(64U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(64U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(64U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(12U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("ScratchInfo", { TensorInfo(TensorShape(64U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(64U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(64U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(64U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(64U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(64U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(64U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(12U, 2U), 1, DataType::F32),
})),
framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
@@ -134,15 +134,17 @@
input_info, input_weights_info, recurrent_weights_info, cell_bias_info, projection_bias_info, cell_state_info, output_info, scratch_info, info, expected)
{
LSTMParams<ITensorInfo> lstm_params_info;
- lstm_params_info.set_peephole_params(&cell_bias_info, &cell_bias_info, &cell_bias_info)
+ lstm_params_info.set_peephole_params(&cell_bias_info, &cell_bias_info)
.set_projection_params(&recurrent_weights_info, &projection_bias_info)
.set_cifg_params(&input_weights_info, &recurrent_weights_info, &cell_bias_info, &cell_bias_info);
ARM_COMPUTE_EXPECT(bool(CLLSTMLayer::validate(&input_info.clone()->set_is_resizable(false), &input_weights_info.clone()->set_is_resizable(false), &input_weights_info.clone()->set_is_resizable(false),
&input_weights_info.clone()->set_is_resizable(false), &recurrent_weights_info.clone()->set_is_resizable(false), &recurrent_weights_info.clone()->set_is_resizable(false),
&recurrent_weights_info.clone()->set_is_resizable(false), &cell_bias_info.clone()->set_is_resizable(false), &cell_bias_info.clone()->set_is_resizable(false),
- &cell_bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), &cell_state_info.clone()->set_is_resizable(false),
- &scratch_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), lstm_params_info, info, 0.05, 0.9)) == expected, framework::LogLevel::ERRORS);
+ &cell_bias_info.clone()->set_is_resizable(false),
+ &output_info.clone()->set_is_resizable(false), &cell_state_info.clone()->set_is_resizable(false),
+ &scratch_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), &cell_state_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false),
+ lstm_params_info, info, 0.05, 0.9)) == expected, framework::LogLevel::ERRORS);
}
// clang-format on
// *INDENT-ON*
diff --git a/tests/validation/CL/LaplacianPyramid.cpp b/tests/validation/CL/LaplacianPyramid.cpp
new file mode 100644
index 0000000..960dcee
--- /dev/null
+++ b/tests/validation/CL/LaplacianPyramid.cpp
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLPyramid.h"
+#include "arm_compute/runtime/CL/CLTensor.h"
+#include "arm_compute/runtime/CL/CLTensorAllocator.h"
+#include "arm_compute/runtime/CL/functions/CLLaplacianPyramid.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/LaplacianPyramidFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+const auto small_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 3);
+const auto large_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 5);
+
+const auto formats = combine(framework::dataset::make("FormatIn", Format::U8), framework::dataset::make("FormatOut", Format::S16));
+
+template <typename T>
+inline void validate_laplacian_pyramid(const CLPyramid &target, const std::vector<SimpleTensor<T>> &reference, BorderMode border_mode)
+{
+ CLTensor *level_image = target.get_pyramid_level(0);
+ ValidRegion valid_region = shape_to_valid_region(reference[0].shape(), border_mode == BorderMode::UNDEFINED, BorderSize(2));
+
+ // Validate lowest level
+ validate(CLAccessor(*level_image), reference[0], valid_region);
+
+ // Validate remaining levels
+ for(size_t lev = 1; lev < target.info()->num_levels(); lev++)
+ {
+ level_image = target.get_pyramid_level(lev);
+ CLTensor *prev_level_image = target.get_pyramid_level(lev - 1);
+
+ valid_region = shape_to_valid_region_laplacian_pyramid(prev_level_image->info()->tensor_shape(),
+ prev_level_image->info()->valid_region(),
+ border_mode == BorderMode::UNDEFINED);
+
+ // Validate level
+ validate(CLAccessor(*level_image), reference[lev], valid_region);
+ }
+}
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(LaplacianPyramid)
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(
+ concat(datasets::Medium2DShapes(), datasets::Large2DShapes()),
+ datasets::BorderModes()),
+ large_laplacian_pyramid_levels),
+ shape, border_mode, num_levels)
+{
+ // Create pyramid info
+ PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, shape, Format::S16);
+ CLPyramid dst_pyramid{};
+ dst_pyramid.init(pyramid_info);
+
+ // Create Tensors
+ CLTensor src = create_tensor<CLTensor>(shape, Format::U8);
+
+ // The first two dimensions of the output tensor must match the first two
+ // dimensions of the tensor in the last level of the pyramid
+ TensorShape dst_shape(shape);
+ dst_shape.set(0, dst_pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(0));
+ dst_shape.set(1, dst_pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(1));
+ CLTensor dst = create_tensor<CLTensor>(dst_shape, Format::S16);
+
+ // Create and configure function
+ CLLaplacianPyramid laplacian_pyramid;
+ laplacian_pyramid.configure(&src, &dst_pyramid, &dst, border_mode, 0);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ for(size_t level = 0; level < pyramid_info.num_levels(); ++level)
+ {
+ ARM_COMPUTE_EXPECT(dst_pyramid.get_pyramid_level(level)->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+}
+
+using CLLaplacianPyramidFixture = LaplacianPyramidValidationFixture<CLTensor, CLAccessor, CLLaplacianPyramid, uint8_t, int16_t, CLPyramid>;
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLLaplacianPyramidFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()),
+ small_laplacian_pyramid_levels),
+ formats))
+{
+ validate_laplacian_pyramid(_target, _reference, _border_mode);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLLaplacianPyramidFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ large_laplacian_pyramid_levels),
+ formats))
+{
+ validate_laplacian_pyramid(_target, _reference, _border_mode);
+}
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/LaplacianReconstruct.cpp b/tests/validation/CL/LaplacianReconstruct.cpp
new file mode 100644
index 0000000..30079e7
--- /dev/null
+++ b/tests/validation/CL/LaplacianReconstruct.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLPyramid.h"
+#include "arm_compute/runtime/CL/functions/CLLaplacianPyramid.h"
+#include "arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/LaplacianReconstructFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+const auto small_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 3);
+const auto large_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 5);
+
+const auto formats = combine(framework::dataset::make("FormatIn", Format::S16), framework::dataset::make("FormatOut", Format::U8));
+
+template <typename T>
+void validate_laplacian_reconstruct(CLTensor &target, const SimpleTensor<T> &reference, BorderMode border_mode, size_t num_levels)
+{
+ const unsigned int filter_size = 5;
+ const unsigned int border_size(filter_size / 2);
+
+ BorderSize border(std::pow(border_size, num_levels));
+
+ // Validate output
+ ValidRegion valid_region = shape_to_valid_region(reference.shape(), border_mode == BorderMode::UNDEFINED, border);
+ validate(CLAccessor(target), reference, valid_region);
+}
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(LaplacianReconstruct)
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(
+ concat(datasets::Medium2DShapes(), datasets::Large2DShapes()),
+ datasets::BorderModes()),
+ large_laplacian_reconstruct_levels),
+ shape, border_mode, num_levels)
+{
+ // Create pyramid info
+ PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, shape, Format::S16);
+ CLPyramid dst_pyramid{};
+ dst_pyramid.init(pyramid_info);
+
+ // Create Tensors
+ CLTensor src = create_tensor<CLTensor>(shape, DataType::U8);
+
+ // The first two dimensions of the output tensor must match the first two
+ // dimensions of the tensor in the last level of the pyramid
+ TensorShape dst_shape(shape);
+ dst_shape.set(0, dst_pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(0));
+ dst_shape.set(1, dst_pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(1));
+ CLTensor dst = create_tensor<CLTensor>(dst_shape, DataType::S16);
+
+ // The dimensions of the reconstruct are the same as the src shape
+ CLTensor rec_dst = create_tensor<CLTensor>(shape, DataType::U8);
+
+ // Create and configure pyramid function
+ CLLaplacianPyramid laplacian_pyramid;
+ laplacian_pyramid.configure(&src, &dst_pyramid, &dst, border_mode, 0);
+
+ // Create and configure reconstruct function
+ CLLaplacianReconstruct laplacian_reconstruct;
+ laplacian_reconstruct.configure(&dst_pyramid, &dst, &rec_dst, border_mode, 0);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ for(size_t level = 0; level < pyramid_info.num_levels(); ++level)
+ {
+ ARM_COMPUTE_EXPECT(dst_pyramid.get_pyramid_level(level)->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+
+ ARM_COMPUTE_EXPECT(rec_dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+}
+
+using CLLaplacianReconstructFixture = LaplacianReconstructValidationFixture<CLTensor, CLAccessor, CLLaplacianReconstruct, CLLaplacianPyramid, int16_t, uint8_t, CLPyramid>;
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLLaplacianReconstructFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()),
+ small_laplacian_reconstruct_levels),
+ formats))
+{
+ validate_laplacian_reconstruct(_target, _reference, _border_mode, _pyramid_levels);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLLaplacianReconstructFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ large_laplacian_reconstruct_levels),
+ formats))
+{
+ validate_laplacian_reconstruct(_target, _reference, _border_mode, _pyramid_levels);
+}
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/LocallyConnected.cpp b/tests/validation/CL/LocallyConnected.cpp
index d8f236c..dbfe4e2 100644
--- a/tests/validation/CL/LocallyConnected.cpp
+++ b/tests/validation/CL/LocallyConnected.cpp
@@ -52,41 +52,45 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching data type input/weights
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching data type input/bias
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching data type input/output
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching shape input/weights
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching shape input/bias
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching shape input/output
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Asymmetric padding
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0)
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/weights
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/bias
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/output
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching shape input/weights
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching shape input/bias
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching shape input/output
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Asymmetric padding
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Padding required
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32)
}),
- framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 274U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0)
+ framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 274U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U, 3U, 5U, 21U, 575U), 1, DataType::F32)
})),
- framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 274U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0)
+ framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F16),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 274U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 575U), 1, DataType::F32)
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 22U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0)
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F16),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 22U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 25U, 21U), 1, DataType::F32)
})),
framework::dataset::make("PadStride", { PadStrideInfo(2, 1, 0, 0),
PadStrideInfo(2, 1, 0, 0),
@@ -94,10 +98,11 @@
PadStrideInfo(2, 1, 0, 0),
PadStrideInfo(2, 1, 0, 0),
PadStrideInfo(2, 1, 0, 0),
- PadStrideInfo(2, 1, 1, 0, 0, 0, DimensionRoundingType::FLOOR),
- PadStrideInfo(2, 1, 0, 0)
+ PadStrideInfo(2, 1, 1, 0),
+ PadStrideInfo(2, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0)
})),
- framework::dataset::make("Expected", { false, false, false, false, false, false, false, true })),
+ framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, true })),
input_info, weights_info, bias_info, output_info, conv_info, expected)
{
bool is_valid = bool(CLLocallyConnectedLayer::validate(&input_info.clone()->set_is_resizable(false),
diff --git a/tests/validation/CL/Magnitude.cpp b/tests/validation/CL/Magnitude.cpp
index b002239..7c517a4 100644
--- a/tests/validation/CL/Magnitude.cpp
+++ b/tests/validation/CL/Magnitude.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -81,17 +81,15 @@
using CLMagnitudeFixture = MagnitudeValidationFixture<CLTensor, CLAccessor, CLMagnitude, T>;
TEST_SUITE(S16)
-FIXTURE_DATA_TEST_CASE(RunSmall, CLMagnitudeFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", Format::S16)),
- framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })),
- framework::dataset::make("UseFP16", false)))
+FIXTURE_DATA_TEST_CASE(RunSmall, CLMagnitudeFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", Format::S16)),
+ framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance<int16_t>(_magnitude_type));
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CLMagnitudeFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S16)),
- framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })),
- framework::dataset::make("UseFP16", false)))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLMagnitudeFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S16)),
+ framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance<int16_t>(_magnitude_type));
@@ -99,17 +97,15 @@
TEST_SUITE_END() // S16
TEST_SUITE(S32)
-FIXTURE_DATA_TEST_CASE(RunSmall, CLMagnitudeFixture<int32_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", Format::S32)),
- framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })),
- framework::dataset::make("UseFP16", false)))
+FIXTURE_DATA_TEST_CASE(RunSmall, CLMagnitudeFixture<int32_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", Format::S32)),
+ framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance<int32_t>(_magnitude_type));
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CLMagnitudeFixture<int32_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S32)),
- framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })),
- framework::dataset::make("UseFP16", false)))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLMagnitudeFixture<int32_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S32)),
+ framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance<int32_t>(_magnitude_type));
diff --git a/tests/validation/CL/MeanStdDev.cpp b/tests/validation/CL/MeanStdDev.cpp
index 92d87e0..76ec210 100644
--- a/tests/validation/CL/MeanStdDev.cpp
+++ b/tests/validation/CL/MeanStdDev.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -39,12 +39,17 @@
{
RelativeTolerance<float> tolerance_rel_high_error(0.05f);
RelativeTolerance<float> tolerance_rel_low_error(0.0005f);
+AbsoluteTolerance<float> tolerance_rel_high_error_f32(0.01f);
+AbsoluteTolerance<float> tolerance_rel_low_error_f32(0.00001f);
+AbsoluteTolerance<float> tolerance_rel_high_error_f16(0.1f);
+AbsoluteTolerance<float> tolerance_rel_low_error_f16(0.01f);
} // namespace
TEST_SUITE(CL)
TEST_SUITE(MeanStdDev)
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), framework::dataset::make("DataType", DataType::U8)), shape, data_type)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), framework::dataset::make("DataType", { DataType::U8 })), shape,
+ data_type)
{
// Create tensors
CLTensor src = create_tensor<CLTensor>(shape, data_type);
@@ -71,6 +76,7 @@
template <typename T>
using CLMeanStdDevFixture = MeanStdDevValidationFixture<CLTensor, CLAccessor, CLMeanStdDev, T>;
+TEST_SUITE(U8)
FIXTURE_DATA_TEST_CASE(RunSmall, CLMeanStdDevFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType",
DataType::U8)))
{
@@ -89,9 +95,43 @@
// Validate std_dev output
validate(_target.second, _reference.second, tolerance_rel_high_error);
}
+TEST_SUITE_END() // U8
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE(F16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLMeanStdDevFixture<half>, framework::DatasetMode::ALL, combine(datasets::Small2DShapes(), framework::dataset::make("DataType",
+ DataType::F16)))
+{
+ // Validate mean output
+ validate(_target.first, _reference.first, tolerance_rel_low_error_f16);
+
+ // Validate std_dev output
+ validate(_target.second, _reference.second, tolerance_rel_high_error_f16);
+}
+TEST_SUITE_END() // F16
+
+TEST_SUITE(F32)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLMeanStdDevFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType",
+ DataType::F32)))
+{
+ // Validate mean output
+ validate(_target.first, _reference.first, tolerance_rel_low_error_f32);
+
+ // Validate std_dev output
+ validate(_target.second, _reference.second, tolerance_rel_high_error_f32);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLMeanStdDevFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), framework::dataset::make("DataType",
+ DataType::F32)))
+{
+ // Validate mean output
+ validate(_target.first, _reference.first, tolerance_rel_low_error_f32);
+
+ // Validate std_dev output
+ validate(_target.second, _reference.second, tolerance_rel_high_error_f32);
+}
+TEST_SUITE_END() // F32
+
+TEST_SUITE_END() // MeanStdDev
+TEST_SUITE_END() // CL
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/CL/NormalizationLayer.cpp b/tests/validation/CL/NormalizationLayer.cpp
index bc1f44d..c3a390b 100644
--- a/tests/validation/CL/NormalizationLayer.cpp
+++ b/tests/validation/CL/NormalizationLayer.cpp
@@ -47,19 +47,11 @@
RelativeTolerance<half> tolerance_f16(half(0.2));
RelativeTolerance<float> tolerance_f32(0.05f);
-/** Tolerance for fixed point operations */
-constexpr AbsoluteTolerance<int8_t> tolerance_qs8(2);
-constexpr AbsoluteTolerance<int16_t> tolerance_qs16(4);
-
/** Input data set. */
const auto NormalizationDataset = combine(combine(combine(combine(datasets::SmallShapes(), datasets::NormalizationTypes()),
framework::dataset::make("NormalizationSize", 3, 9, 2)),
framework::dataset::make("Beta", { 0.5f, 1.f, 2.f })),
framework::dataset::make("IsScaled", { true }));
-const auto NormalizationDatasetQS = combine(combine(combine(combine(datasets::TinyShapes(), datasets::NormalizationTypes()),
- framework::dataset::make("NormalizationSize", 3, 9, 2)),
- framework::dataset::make("Beta", { 0.5f, 1.f, 2.f })),
- framework::dataset::make("IsScaled", { true }));
const auto NormalizationDatasetFP16 = combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("NormType", { NormType::IN_MAP_1D, NormType::CROSS_MAP })),
framework::dataset::make("NormalizationSize", 3, 9, 2)),
framework::dataset::make("Beta", { 0.5f, 1.f, 2.f })),
@@ -77,31 +69,28 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type input/output
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching shapes
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Even normalization
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Non implemented IN_MAP_2D
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 4), // Mismatching fixed point position
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/output
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Even normalization
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Non implemented IN_MAP_2D
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
}),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
})),
framework::dataset::make("NormInfo", { NormalizationLayerInfo(NormType::IN_MAP_1D, 5),
NormalizationLayerInfo(NormType::IN_MAP_1D, 5),
NormalizationLayerInfo(NormType::IN_MAP_1D, 4),
NormalizationLayerInfo(NormType::IN_MAP_2D, 5),
NormalizationLayerInfo(NormType::IN_MAP_1D, 5),
- NormalizationLayerInfo(NormType::IN_MAP_1D, 5),
NormalizationLayerInfo(NormType::CROSS_MAP, 5),
})),
- framework::dataset::make("Expected", { false, false, false, false, false, false, true })),
+ framework::dataset::make("Expected", { false, false, false, false, false, true })),
input_info, output_info, norm_info, expected)
{
ARM_COMPUTE_EXPECT(bool(CLNormalizationLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), norm_info)) == expected, framework::LogLevel::ERRORS);
@@ -140,47 +129,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-template <typename T>
-using CLNormalizationLayerFixedPointFixture = NormalizationValidationFixedPointFixture<CLTensor, CLAccessor, CLNormalizationLayer, T>;
-
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5
-FIXTURE_DATA_TEST_CASE(RunTiny, CLNormalizationLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(NormalizationDatasetQS, framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs8);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLNormalizationLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(NormalizationDataset, framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs8);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 5
-FIXTURE_DATA_TEST_CASE(RunTiny, CLNormalizationLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(NormalizationDatasetQS, framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs16);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLNormalizationLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(NormalizationDataset, framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs16);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/CL/PixelWiseMultiplication.cpp b/tests/validation/CL/PixelWiseMultiplication.cpp
index 6a71175..8aa19dc 100644
--- a/tests/validation/CL/PixelWiseMultiplication.cpp
+++ b/tests/validation/CL/PixelWiseMultiplication.cpp
@@ -28,7 +28,6 @@
#include "tests/datasets/ShapeDatasets.h"
#include "tests/framework/Macros.h"
#include "tests/validation/Validation.h"
-#include "tests/validation/fixtures/FixedPointPixelWiseMultiplicationFixture.h"
#include "tests/validation/fixtures/PixelWiseMultiplicationFixture.h"
namespace arm_compute
@@ -39,8 +38,7 @@
{
namespace
{
-const float scale_unity = 1.f;
-const float scale_255 = 1.f / 255.f;
+const float scale_255 = 1.f / 255.f;
// *INDENT-OFF*
// clang-format off
@@ -58,20 +56,6 @@
{ \
VALIDATE \
}
-
-#define FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, SHAPES, DT1, DT2, SCALE, RP, FPP_START, FPP_END) \
- FIXTURE_DATA_TEST_CASE(TEST_NAME, CLFixedPointPixelWiseMultiplication##FIXTURE, framework::DatasetMode::MODE, \
- combine(combine(combine(combine(combine(combine( \
- datasets::SHAPES, \
- framework::dataset::make("DataType1", DataType::DT1)), \
- framework::dataset::make("DataType2", DataType::DT2)), \
- framework::dataset::make("Scale", std::move(SCALE))), \
- datasets::ConvertPolicies()), \
- framework::dataset::make("RoundingPolicy", RoundingPolicy::RP)), \
- framework::dataset::make("FixedPointPosition", FPP_START, FPP_END))) \
- { \
- validate(CLAccessor(_target), _reference); \
- }
// clang-format on
// *INDENT-ON*
} // namespace
@@ -81,12 +65,6 @@
template <typename T>
using CLPixelWiseMultiplicationToF32Fixture = PixelWiseMultiplicationValidationFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, float>;
template <typename T>
-using CLPixelWiseMultiplicationToQS8Fixture = PixelWiseMultiplicationValidationFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, qint8_t>;
-template <typename T>
-using CLPixelWiseMultiplicationToQS16Fixture = PixelWiseMultiplicationValidationFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, qint16_t>;
-template <typename T>
-using CLFixedPointPixelWiseMultiplicationFixture = FixedPointPixelWiseMultiplicationValidationFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T>;
-template <typename T>
using CLPixelWiseMultiplicationBroadcastFixture = PixelWiseMultiplicationBroadcastValidationFixture<CLTensor, CLAccessor, CLPixelWiseMultiplication, T, float>;
TEST_SUITE(CL)
@@ -101,9 +79,6 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid scale
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching data type
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Invalid scale
}),
framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
@@ -111,9 +86,6 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS16, 2),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
@@ -121,12 +93,9 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
- framework::dataset::make("Scale",{ 2.f, 2.f, 2.f, -1.f, 1.f, 1.f, 1.f, 1.f, 3.f})),
- framework::dataset::make("Expected", { true, true, false, false, false, false, false, false, false })),
+ framework::dataset::make("Scale",{ 2.f, 2.f, 2.f, -1.f, 1.f, 1.f})),
+ framework::dataset::make("Expected", { true, true, false, false, false, false})),
input1_info, input2_info, output_info, scale, expected)
{
bool has_error = bool(CLPixelWiseMultiplication::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), scale, ConvertPolicy::WRAP, RoundingPolicy::TO_ZERO));
@@ -155,22 +124,6 @@
TEST_SUITE(FixedPointPixelWiseMultiplication)
-TEST_SUITE(QS8)
-
-TEST_SUITE(ScaleUnity)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunTiny, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, scale_unity, TO_ZERO, 1, 7)
-TEST_SUITE_END() // ScaleUnity
-
-TEST_SUITE_END() // QS8
-
-TEST_SUITE(QS16)
-
-TEST_SUITE(ScaleUnity)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunTiny, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, scale_unity, TO_ZERO, 1, 15)
-TEST_SUITE_END() // ScaleUnity
-
-TEST_SUITE_END() // QS16
-
TEST_SUITE(Broadcast)
PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmall, BroadcastFixture<float>, PRECOMMIT, SmallShapesBroadcast(), F32, F32, scale_255, TO_NEAREST_UP, VALIDATE(float, 1.f))
TEST_SUITE_END() // Broadcast
diff --git a/tests/validation/CL/PoolingLayer.cpp b/tests/validation/CL/PoolingLayer.cpp
index 7bd090c..1331522 100644
--- a/tests/validation/CL/PoolingLayer.cpp
+++ b/tests/validation/CL/PoolingLayer.cpp
@@ -49,11 +49,6 @@
framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(1, 2, 1, 1), PadStrideInfo(2, 2, 1, 0) })),
framework::dataset::make("ExcludePadding", { true, false }));
-/** Input data set for fixed-point data types */
-const auto PoolingLayerDatasetQS = combine(combine(combine(framework::dataset::make("PoolingType", { PoolingType::MAX, PoolingType::AVG }), framework::dataset::make("PoolingSize", { Size2D(2, 2), Size2D(3, 3) })),
- framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(1, 2, 1, 1), PadStrideInfo(2, 2, 1, 0) })),
- framework::dataset::make("ExcludePadding", { true, false }));
-
/** Input data set for asymmetric data type */
const auto PoolingLayerDatasetQASYMM8 = combine(combine(combine(framework::dataset::make("PoolingType", { PoolingType::MAX, PoolingType::AVG }), framework::dataset::make("PoolingSize", { Size2D(2, 2), Size2D(3, 3), Size2D(5, 7), Size2D(8, 9) })),
framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(1, 2, 1, 1), PadStrideInfo(2, 2, 1, 0) })),
@@ -61,8 +56,6 @@
constexpr AbsoluteTolerance<float> tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for 32-bit floating-point type */
constexpr AbsoluteTolerance<float> tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for 16-bit floating-point type */
-constexpr AbsoluteTolerance<float> tolerance_qs16(6); /**< Tolerance value for comparing reference's output against implementation's output for 16-bit fixed-point type */
-constexpr AbsoluteTolerance<float> tolerance_qs8(3); /**< Tolerance value for comparing reference's output against implementation's output for 8-bit fixed-point type */
constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for 8-bit asymmetric type */
} // namespace
@@ -72,32 +65,26 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 4), // Mismatching fixed point position
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS16, 11),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid pad/size combination
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid pad/size combination
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8, 0), // Invalid parameters
- TensorInfo(TensorShape(15U, 13U, 5U), 1, DataType::F32, 0), // Non-rectangular Global Pooling
- TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32, 0), // Invalid output Global Pooling
- TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid pad/size combination
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid pad/size combination
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), // Invalid parameters
+ TensorInfo(TensorShape(15U, 13U, 5U), 1, DataType::F32), // Non-rectangular Global Pooling
+ TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32), // Invalid output Global Pooling
+ TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32),
}),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::QS8, 5),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::QS16, 11),
- TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8, 0),
- TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U, 2U, 5U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U, 2U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32),
})),
framework::dataset::make("PoolInfo", { PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 0, 0)),
PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 0, 0)),
- PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 0, 0)),
- PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 0, 0)),
PoolingLayerInfo(PoolingType::AVG, 2, PadStrideInfo(1, 1, 2, 0)),
PoolingLayerInfo(PoolingType::AVG, 2, PadStrideInfo(1, 1, 0, 2)),
PoolingLayerInfo(PoolingType::L2, 3, PadStrideInfo(1, 1, 0, 0)),
@@ -105,7 +92,7 @@
PoolingLayerInfo(PoolingType::MAX),
PoolingLayerInfo(PoolingType::AVG),
})),
- framework::dataset::make("Expected", { false, false, false, true, false, false, false, true, false, true })),
+ framework::dataset::make("Expected", { false, false, false, false, false, true, false, true })),
input_info, output_info, pool_info, expected)
{
ARM_COMPUTE_EXPECT(bool(CLPoolingLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), pool_info)) == expected, framework::LogLevel::ERRORS);
@@ -161,45 +148,6 @@
TEST_SUITE_END() // FP16
TEST_SUITE_END() // Float
-template <typename T>
-using CLPoolingLayerFixedPointFixture = PoolingLayerValidationFixedPointFixture<CLTensor, CLAccessor, CLPoolingLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLPoolingLayerFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(datasets::TinyShapes(), combine(PoolingLayerDatasetQS,
- framework::dataset::make("DataType", DataType::QS8))),
- framework::dataset::make("FractionalBits", 1, 4)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs8);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLPoolingLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), combine(PoolingLayerDatasetQS,
- framework::dataset::make("DataType", DataType::QS8))),
- framework::dataset::make("FractionalBits", 1, 4)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs8);
-}
-TEST_SUITE_END() // QS8
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLPoolingLayerFixedPointFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(datasets::TinyShapes(), combine(PoolingLayerDatasetQS,
- framework::dataset::make("DataType", DataType::QS16))),
- framework::dataset::make("FractionalBits", 1, 12)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs16);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLPoolingLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), combine(PoolingLayerDatasetQS,
- framework::dataset::make("DataType", DataType::QS16))),
- framework::dataset::make("FractionalBits", 1, 12)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_qs16);
-}
-TEST_SUITE_END() // QS16
-TEST_SUITE_END() // fixedPoint
-
TEST_SUITE(Quantized)
template <typename T>
diff --git a/tests/validation/CL/RNNLayer.cpp b/tests/validation/CL/RNNLayer.cpp
index 0af6f8e..5ae38fb 100644
--- a/tests/validation/CL/RNNLayer.cpp
+++ b/tests/validation/CL/RNNLayer.cpp
@@ -39,8 +39,9 @@
{
namespace
{
-RelativeTolerance<float> tolerance_f32(0.001f);
-RelativeTolerance<half> tolerance_f16(half(0.1));
+RelativeTolerance<float> tolerance_f32(0.001f); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType:F32 */
+RelativeTolerance<half> rel_tolerance_f16(half(0.2)); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType:F16 */
+constexpr float abs_tolerance_f16(0.02f); /**< Absolute tolerance value for comparing reference's output against implementation's output for DataType:F16 */
} // namespace
TEST_SUITE(CL)
@@ -49,53 +50,53 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::U8, 0), // Wrong data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Wrong input size
- TensorInfo(TensorShape(27U, 13U), 1, DataType::F32, 0), // Wrong weights size
- TensorInfo(TensorShape(27U, 13U), 1, DataType::F32, 0), // Wrong recurrent weights size
- TensorInfo(TensorShape(27U, 13U), 1, DataType::F32, 0), // Wrong bias size
- TensorInfo(TensorShape(27U, 13U), 1, DataType::F32, 0), // Wrong output size
- TensorInfo(TensorShape(27U, 13U), 1, DataType::F32, 0), // Wrong hidden output size
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::U8), // Wrong data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Wrong input size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong weights size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong recurrent weights size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong bias size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong output size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong hidden output size
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(27U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 11U), 1, DataType::F32, 0),
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
})),
- framework::dataset::make("RecurrentWeightsInfo", { TensorInfo(TensorShape(11U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 11U), 1, DataType::F32, 0),
+ framework::dataset::make("RecurrentWeightsInfo", { TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
})),
- framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(30U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U), 1, DataType::F32, 0),
+ framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
})),
- framework::dataset::make("HiddenStateInfo", { TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 13U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("HiddenStateInfo", { TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U, 2U), 1, DataType::F32),
})),
framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
@@ -128,7 +129,7 @@
FIXTURE_DATA_TEST_CASE(RunSmall, CLRNNLayerFixture<half>, framework::DatasetMode::ALL, combine(datasets::SmallRNNLayerDataset(), framework::dataset::make("DataType", DataType::F16)))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_f16);
+ validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
}
TEST_SUITE_END() // FP16
TEST_SUITE_END() // RNNLayer
diff --git a/tests/validation/CL/ReductionOperation.cpp b/tests/validation/CL/ReductionOperation.cpp
index a48e2f9..ca0988f 100644
--- a/tests/validation/CL/ReductionOperation.cpp
+++ b/tests/validation/CL/ReductionOperation.cpp
@@ -45,6 +45,7 @@
{
/** Tolerance for float operations */
RelativeTolerance<float> tolerance_f32(0.00001f);
+RelativeTolerance<float> tolerance_f16(0.1f);
} // namespace
TEST_SUITE(CL)
@@ -55,7 +56,7 @@
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
framework::dataset::make("InputInfo", { TensorInfo(TensorShape(128U, 64U), 1, DataType::F32), // Mismatching data type input/output
TensorInfo(TensorShape(128U, 64U), 2, DataType::F32), // Number of Input channels != 1
- TensorInfo(TensorShape(128U, 64U), 1, DataType::S16), // DataType != F32
+ TensorInfo(TensorShape(128U, 64U), 1, DataType::S16), // DataType != F16/F32
TensorInfo(TensorShape(128U, 64U), 1, DataType::F32), // Axis >= num_max_dimensions
TensorInfo(TensorShape(128U, 64U), 1, DataType::F32), // Axis > 0
TensorInfo(TensorShape(128U, 64U), 1, DataType::F32)
@@ -84,9 +85,23 @@
using CLReductionOperationFixture = ReductionOperationValidationFixture<CLTensor, CLAccessor, CLReductionOperation, T>;
TEST_SUITE(Float)
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLReductionOperationFixture<half>, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)), framework::dataset::make("Axis", { 0 })), datasets::ReductionOperations()))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f16);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLReductionOperationFixture<half>, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F16)), framework::dataset::make("Axis", { 0 })), datasets::ReductionOperations()))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f16);
+}
+TEST_SUITE_END() // F16
TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, CLReductionOperationFixture<float>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("Axis", { 0 })), datasets::ReductionOperations()))
+ combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("Axis", { 0 })), datasets::ReductionOperations()))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f32);
@@ -97,11 +112,11 @@
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f32);
}
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // F32
+TEST_SUITE_END() // Float
-TEST_SUITE_END()
-TEST_SUITE_END()
+TEST_SUITE_END() // Reduction
+TEST_SUITE_END() // CL
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/CL/SYSTEM/AlexNet.cpp b/tests/validation/CL/SYSTEM/AlexNet.cpp
deleted file mode 100644
index 75f8d19..0000000
--- a/tests/validation/CL/SYSTEM/AlexNet.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/CL/CLSubTensor.h"
-#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h"
-#include "arm_compute/runtime/CL/functions/CLNormalizationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLPoolingLayer.h"
-#include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h"
-#include "tests/CL/CLAccessor.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/networks/AlexNetNetwork.h"
-#include "tests/validation/Validation.h"
-
-#include <string>
-#include <vector>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-using CLAlexNetModel = networks::AlexNetNetwork<ICLTensor,
- CLTensor,
- CLSubTensor,
- CLAccessor,
- CLActivationLayer,
- CLConvolutionLayer,
- CLDirectConvolutionLayer,
- CLFullyConnectedLayer,
- CLNormalizationLayer,
- CLPoolingLayer,
- CLSoftmaxLayer>;
-std::vector<unsigned int> compute_alexnet(DataType dt, unsigned int batches, std::string input_file)
-{
- std::vector<std::string> weight_files = { "cnn_data/alexnet_model/conv1_w.npy",
- "cnn_data/alexnet_model/conv2_w.npy",
- "cnn_data/alexnet_model/conv3_w.npy",
- "cnn_data/alexnet_model/conv4_w.npy",
- "cnn_data/alexnet_model/conv5_w.npy",
- "cnn_data/alexnet_model/fc6_w.npy",
- "cnn_data/alexnet_model/fc7_w.npy",
- "cnn_data/alexnet_model/fc8_w.npy"
- };
-
- std::vector<std::string> bias_files = { "cnn_data/alexnet_model/conv1_b.npy",
- "cnn_data/alexnet_model/conv2_b.npy",
- "cnn_data/alexnet_model/conv3_b.npy",
- "cnn_data/alexnet_model/conv4_b.npy",
- "cnn_data/alexnet_model/conv5_b.npy",
- "cnn_data/alexnet_model/fc6_b.npy",
- "cnn_data/alexnet_model/fc7_b.npy",
- "cnn_data/alexnet_model/fc8_b.npy"
- };
- CLAlexNetModel network{};
- network.init(dt, 4, batches);
- network.build();
- network.allocate();
- network.fill(weight_files, bias_files);
- network.feed(std::move(input_file));
- network.run();
-
- return network.get_classifications();
-}
-} // namespace
-
-TEST_SUITE(CL)
-TEST_SUITE(SYSTEM_TESTS)
-
-TEST_CASE(AlexNet, framework::DatasetMode::PRECOMMIT)
-{
- // Compute alexnet
- std::vector<unsigned int> classified_labels = compute_alexnet(DataType::F32, 1, "cnn_data/imagenet_data/cat.npy");
-
- // Expected labels
- std::vector<unsigned int> expected_labels = { 281 };
-
- // Validate labels
- validate(classified_labels, expected_labels);
-}
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/CL/SYSTEM/LeNet5.cpp b/tests/validation/CL/SYSTEM/LeNet5.cpp
deleted file mode 100644
index 92dcdea..0000000
--- a/tests/validation/CL/SYSTEM/LeNet5.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/CL/functions/CLActivationLayer.h"
-#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h"
-#include "arm_compute/runtime/CL/functions/CLPoolingLayer.h"
-#include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h"
-#include "tests/CL/CLAccessor.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/networks/LeNet5Network.h"
-#include "tests/validation/Validation.h"
-
-#include <string>
-#include <vector>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-using CLLeNet5Model = networks::LeNet5Network<CLTensor,
- CLAccessor,
- CLActivationLayer,
- CLConvolutionLayer,
- CLFullyConnectedLayer,
- CLPoolingLayer,
- CLSoftmaxLayer>;
-std::vector<unsigned int> compute_lenet5(unsigned int batches, std::string input_file)
-{
- std::vector<std::string> weight_files = { "cnn_data/lenet_model/conv1_w.npy",
- "cnn_data/lenet_model/conv2_w.npy",
- "cnn_data/lenet_model/ip1_w.npy",
- "cnn_data/lenet_model/ip2_w.npy"
- };
-
- std::vector<std::string> bias_files = { "cnn_data/lenet_model/conv1_b.npy",
- "cnn_data/lenet_model/conv2_b.npy",
- "cnn_data/lenet_model/ip1_b.npy",
- "cnn_data/lenet_model/ip2_b.npy"
- };
- CLLeNet5Model network{};
- network.init(batches);
- network.build();
- network.allocate();
- network.fill(weight_files, bias_files);
- network.feed(std::move(input_file));
- network.run();
-
- return network.get_classifications();
-}
-} // namespace
-
-TEST_SUITE(CL)
-TEST_SUITE(SYSTEM_TESTS)
-
-TEST_CASE(LeNet5, framework::DatasetMode::PRECOMMIT)
-{
- // Compute alexnet
- std::vector<unsigned int> classified_labels = compute_lenet5(10, "cnn_data/mnist_data/input10.npy");
-
- // Expected labels
- std::vector<unsigned int> expected_labels = { 7, 2, 1, 0, 4, 1, 4, 9, 5, 9 };
-
- // Validate labels
- validate(classified_labels, expected_labels);
-}
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/CL/Scale.cpp b/tests/validation/CL/Scale.cpp
index 3d8750a..ddc93d0 100644
--- a/tests/validation/CL/Scale.cpp
+++ b/tests/validation/CL/Scale.cpp
@@ -120,7 +120,7 @@
TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
datasets::BorderModes()),
datasets::SamplingPolicies()))
@@ -134,7 +134,7 @@
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
datasets::BorderModes()),
datasets::SamplingPolicies()))
@@ -150,7 +150,7 @@
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
datasets::BorderModes()),
datasets::SamplingPolicies()))
@@ -164,7 +164,7 @@
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
DataType::F16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
datasets::BorderModes()),
datasets::SamplingPolicies()))
@@ -183,7 +183,7 @@
TEST_SUITE(U8)
FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
DataType::U8)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
datasets::BorderModes()),
datasets::SamplingPolicies()))
@@ -197,7 +197,7 @@
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
DataType::U8)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
datasets::BorderModes()),
datasets::SamplingPolicies()))
@@ -213,7 +213,7 @@
TEST_SUITE(S16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
DataType::S16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
datasets::BorderModes()),
datasets::SamplingPolicies()))
@@ -227,7 +227,7 @@
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
DataType::S16)),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
datasets::BorderModes()),
datasets::SamplingPolicies()))
diff --git a/tests/validation/CL/SoftmaxLayer.cpp b/tests/validation/CL/SoftmaxLayer.cpp
index f9204f9..66ca0b8 100644
--- a/tests/validation/CL/SoftmaxLayer.cpp
+++ b/tests/validation/CL/SoftmaxLayer.cpp
@@ -47,9 +47,6 @@
RelativeTolerance<half> tolerance_f16(half(0.2));
RelativeTolerance<float> tolerance_f32(0.001f);
-/** Tolerance for fixed point operations */
-constexpr AbsoluteTolerance<int16_t> tolerance_fixed_point(2);
-
/** Tolerance for quantized operations */
constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1);
@@ -59,8 +56,6 @@
DataType::QASYMM8,
DataType::F16,
DataType::F32,
- DataType::QS8,
- DataType::QS16,
});
} // namespace
@@ -69,13 +64,11 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SoftmaxLayerSmallShapes(), datasets::SoftmaxLayerLargeShapes()), CNNDataTypes), shape, data_type)
{
- // Set fixed point position and quantization info if is allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
- const QuantizationInfo quantization_info = is_data_type_quantized_asymmetric(data_type) ? QuantizationInfo(1.f / 255.f, 0) : QuantizationInfo();
+ const QuantizationInfo quantization_info = is_data_type_quantized_asymmetric(data_type) ? QuantizationInfo(1.f / 255.f, 0) : QuantizationInfo();
// Create tensors
- CLTensor src = create_tensor<CLTensor>(shape, data_type, 1, fixed_point_position, quantization_info);
- CLTensor dst = create_tensor<CLTensor>(shape, data_type, 1, fixed_point_position, QuantizationInfo(1.f / 256.f, 0));
+ CLTensor src = create_tensor<CLTensor>(shape, data_type, 1, quantization_info);
+ CLTensor dst = create_tensor<CLTensor>(shape, data_type, 1, QuantizationInfo(1.f / 256.f, 0));
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -104,29 +97,27 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data types
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8, // Invalid output quantization info
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching data types
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching shapes
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::QASYMM8, // Invalid output quantization info
QuantizationInfo(1.f/256, 12)),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8,
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),// Invalid input dimensionality
+ TensorInfo(TensorShape(32U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8,
QuantizationInfo(1.f/256, 12)),
}),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16),
- TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8,
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U), 1, DataType::F16),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::QASYMM8,
QuantizationInfo(1.f/256, 12)),
+ TensorInfo(TensorShape(27U, 13U), 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::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8,
+ TensorInfo(TensorShape(32U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8,
QuantizationInfo(1.f/256, 0)),
})),
- framework::dataset::make("Expected", { false, false, false, false, false, true, true, true })),
+ framework::dataset::make("Expected", { false, false, false, false, false, true, true })),
input_info, output_info, expected)
{
ARM_COMPUTE_EXPECT(bool(CLSoftmaxLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false))) == expected, framework::LogLevel::ERRORS);
@@ -174,49 +165,6 @@
TEST_SUITE_END()
template <typename T>
-using CLSoftmaxLayerFixedPointFixture = SoftmaxValidationFixedPointFixture<CLTensor, CLAccessor, CLSoftmaxLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5
-FIXTURE_DATA_TEST_CASE(RunTiny, CLSoftmaxLayerFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(datasets::SoftmaxLayerTinyShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed_point);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SoftmaxLayerSmallShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed_point);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14
-FIXTURE_DATA_TEST_CASE(RunTiny, CLSoftmaxLayerFixedPointFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(datasets::SoftmaxLayerTinyShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed_point);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLSoftmaxLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SoftmaxLayerSmallShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference, tolerance_fixed_point);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
using CLSoftmaxLayerQuantizedFixture = SoftmaxValidationQuantizedFixture<CLTensor, CLAccessor, CLSoftmaxLayer, T>;
TEST_SUITE(Quantized)
diff --git a/tests/validation/CL/UNIT/Tuner.cpp b/tests/validation/CL/UNIT/Tuner.cpp
index 26d21b5..9f76056 100644
--- a/tests/validation/CL/UNIT/Tuner.cpp
+++ b/tests/validation/CL/UNIT/Tuner.cpp
@@ -57,12 +57,11 @@
CLDirectConvolutionLayerKernel conv;
conv.set_target(GPUTarget::G72);
- // Hard-wire lws to kernel and validate lws
- conv.set_lws_hint(fake_lws);
- ARM_COMPUTE_EXPECT(conv.lws_hint()[0] == 2000, framework::LogLevel::ERRORS);
-
// Configure
conv.configure(&src, &weights, &bias, &dst, PadStrideInfo(1, 1, 1, 1));
+
+ // Hard-wire lws to kernel and validate lws
+ conv.set_lws_hint(fake_lws);
ARM_COMPUTE_EXPECT(conv.lws_hint()[0] == 2000, framework::LogLevel::ERRORS);
// Tune kernel and validate
diff --git a/tests/validation/CL/UNIT/WeightsRetention.cpp b/tests/validation/CL/UNIT/WeightsRetention.cpp
new file mode 100644
index 0000000..bfaef56
--- /dev/null
+++ b/tests/validation/CL/UNIT/WeightsRetention.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h"
+#include "support/ToolchainSupport.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/CL/CLAccessor.h"
+#include "tests/Globals.h"
+#include "tests/Utils.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/UNIT/WeightsRetentionFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+RelativeTolerance<float> tolerance_f32(0.05f);
+} // namespace
+
+TEST_SUITE(CL)
+TEST_SUITE(UNIT)
+TEST_SUITE(WeightsRetention)
+
+using CLWeightsRetentionFixture = WeightsRetentionReconfigureTestCaseFixture<CLTensor,
+ CLAccessor,
+ CLFullyConnectedLayer>;
+FIXTURE_TEST_CASE(WeightsRetention,
+ CLWeightsRetentionFixture,
+ framework::DatasetMode::ALL)
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/WarpAffine.cpp b/tests/validation/CL/WarpAffine.cpp
index 7f3001c..29f24cc 100644
--- a/tests/validation/CL/WarpAffine.cpp
+++ b/tests/validation/CL/WarpAffine.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -65,8 +65,8 @@
uint8_t constant_border_value = distribution_u8(gen);
// Create the matrix
- std::array<float, 6> matrix{ {} };
- fill_warp_matrix<6>(matrix);
+ std::array<float, 9> matrix{ {} };
+ fill_warp_matrix<9>(matrix);
// Create tensors
CLTensor src = create_tensor<CLTensor>(shape, data_type);
@@ -77,7 +77,7 @@
// Create and configure function
CLWarpAffine warp_affine;
- warp_affine.configure(&src, &dst, matrix.data(), policy, border_mode, constant_border_value);
+ warp_affine.configure(&src, &dst, matrix, policy, border_mode, constant_border_value);
// Validate valid region
const ValidRegion valid_region = shape_to_valid_region(shape);
diff --git a/tests/validation/CL/WarpPerspective.cpp b/tests/validation/CL/WarpPerspective.cpp
index a868e16..e164a80 100644
--- a/tests/validation/CL/WarpPerspective.cpp
+++ b/tests/validation/CL/WarpPerspective.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -78,7 +78,7 @@
// Create and configure function
CLWarpPerspective warp_perspective;
- warp_perspective.configure(&src, &dst, matrix.data(), policy, border_mode, constant_border_value);
+ warp_perspective.configure(&src, &dst, matrix, policy, border_mode, constant_border_value);
// Validate valid region
const ValidRegion valid_region = shape_to_valid_region(shape);
diff --git a/tests/validation/CL/WeightsReshape.cpp b/tests/validation/CL/WeightsReshape.cpp
new file mode 100644
index 0000000..30c231d
--- /dev/null
+++ b/tests/validation/CL/WeightsReshape.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/CL/kernels/CLWeightsReshapeKernel.h"
+#include "arm_compute/core/Types.h"
+#include "tests/CL/Helper.h"
+
+#include "tests/CL/CLAccessor.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/WeightsReshapeFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+TEST_SUITE(CL)
+TEST_SUITE(WeightsReshape)
+
+using CLWeightsReshape = CLSynthetizeFunction<CLWeightsReshapeKernel>;
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::U8), // Unsupported data type
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), // Mismatching data type
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::QASYMM8), // Bias not supported with QASYMM8
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ }),
+ framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(4U), 1, DataType::U8),
+ TensorInfo(TensorShape(4U), 1, DataType::F16),
+ TensorInfo(TensorShape(4U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ })),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(4U, 19U), 1, DataType::U8),
+ TensorInfo(TensorShape(4U, 19U), 1, DataType::F16),
+ TensorInfo(TensorShape(4U, 19U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(4U, 19U), 1, DataType::F32),
+ })),
+ framework::dataset::make("Expected", { false, false, false, true })),
+ input_info, biases_info, output_info, expected)
+{
+ bool status = bool(CLWeightsReshape::validate(&input_info, &biases_info, &output_info));
+ ARM_COMPUTE_EXPECT(status == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
+template <typename T>
+using CLWeightsReshapeFixture = WeightsReshapeValidationFixture<CLTensor, CLAccessor, CLWeightsReshape, T>;
+
+TEST_SUITE(Float)
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWeightsReshapeFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::GroupedWeightsSmallShapes(), framework::dataset::make("DataType",
+ DataType::F32)),
+ framework::dataset::make("HasBias", { true, false })),
+ framework::dataset::make("NumGroups", { 1, 2, 3, 4 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWeightsReshapeFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::GroupedWeightsLargeShapes(), framework::dataset::make("DataType",
+ DataType::F32)),
+ framework::dataset::make("HasBias", { true, false })),
+ framework::dataset::make("NumGroups", { 1, 2, 3, 4 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWeightsReshapeFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::GroupedWeightsSmallShapes(), framework::dataset::make("DataType",
+ DataType::F16)),
+ framework::dataset::make("HasBias", { true, false })),
+ framework::dataset::make("NumGroups", { 1, 2, 3 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWeightsReshapeFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::GroupedWeightsLargeShapes(), framework::dataset::make("DataType",
+ DataType::F16)),
+ framework::dataset::make("HasBias", { true, false })),
+ framework::dataset::make("NumGroups", { 1, 2, 3 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWeightsReshapeFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::GroupedWeightsSmallShapes(), framework::dataset::make("DataType",
+ DataType::QASYMM8)),
+ framework::dataset::make("HasBias", { false })),
+ framework::dataset::make("NumGroups", { 1, 2, 3 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWeightsReshapeFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::GroupedWeightsLargeShapes(), framework::dataset::make("DataType",
+ DataType::QASYMM8)),
+ framework::dataset::make("HasBias", { false })),
+ framework::dataset::make("NumGroups", { 1, 2, 3 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/CL/WidthConcatenateLayer.cpp b/tests/validation/CL/WidthConcatenateLayer.cpp
index 0ff95df..6af3c64 100644
--- a/tests/validation/CL/WidthConcatenateLayer.cpp
+++ b/tests/validation/CL/WidthConcatenateLayer.cpp
@@ -44,20 +44,20 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
- framework::dataset::make("InputInfo1", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching data type input/output
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching y dimension
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching total width
- TensorInfo(TensorShape(16U, 27U, 5U), 1, DataType::F32, 0)
+ framework::dataset::make("InputInfo1", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/output
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching y dimension
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching total width
+ TensorInfo(TensorShape(16U, 27U, 5U), 1, DataType::F32)
}),
- framework::dataset::make("InputInfo2", { TensorInfo(TensorShape(24U, 27U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(52U, 27U, 5U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(52U, 27U, 5U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(16U, 27U, 5U), 1, DataType::F32, 0)
+ framework::dataset::make("InputInfo2", { TensorInfo(TensorShape(24U, 27U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(52U, 27U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(52U, 27U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 27U, 5U), 1, DataType::F32)
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(47U, 27U, 5U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(75U, 12U, 5U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 27U, 5U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 27U, 5U), 1, DataType::F32, 0)
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(47U, 27U, 5U), 1, DataType::F16),
+ TensorInfo(TensorShape(75U, 12U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 27U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 27U, 5U), 1, DataType::F32)
})),
framework::dataset::make("Expected", { false, false, false, true })),
input_info1, input_info2, output_info,expected)
@@ -133,42 +133,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLWidthConcatenateLayerFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Tiny2DShapes(),
- framework::dataset::make("DataType",
- DataType::QS8)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLWidthConcatenateLayerFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::WidthConcatenateLayerShapes(),
- framework::dataset::make("DataType",
- DataType::QS8)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, CLWidthConcatenateLayerFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Tiny2DShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLWidthConcatenateLayerFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(datasets::WidthConcatenateLayerShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)))
-{
- // Validate output
- validate(CLAccessor(_target), _reference);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/CL/Winograd.cpp b/tests/validation/CL/Winograd.cpp
index a61dd3f..bb83f5a 100644
--- a/tests/validation/CL/Winograd.cpp
+++ b/tests/validation/CL/Winograd.cpp
@@ -23,6 +23,7 @@
*/
#include "arm_compute/core/CL/kernels/CLWinogradFilterTransformKernel.h"
#include "arm_compute/core/CL/kernels/CLWinogradOutputTransformKernel.h"
+#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/runtime/CL/CLTensor.h"
@@ -51,8 +52,88 @@
{
namespace
{
+// *INDENT-OFF*
+// clang-format off
constexpr AbsoluteTolerance<float> tolerance_f32(0.001f);
constexpr AbsoluteTolerance<float> tolerance_convolution_layer_f32(0.1f);
+
+// Input transform
+const auto SmallWinogradInputTransformDatasetNCHW =
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x2_3x3(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x1_3x1(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x2_1x3(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_3x3(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_3x1(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x3(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_5x5(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_5x1(),
+ datasets::SmallWinogradInputTransformDataset1x4_1x5()))))))));
+
+const auto SmallWinogradInputTransformDatasetNHWC = framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_3x3(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_3x1(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x3(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_5x5(),
+ framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_5x1(),
+ datasets::SmallWinogradInputTransformDataset1x4_1x5())))));
+
+const auto LargeWinogradInputTransformDatasetNCHW =
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset2x2_3x3(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset2x1_3x1(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset1x2_1x3(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_3x3(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_3x1(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset1x4_1x3(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_5x5(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_5x1(),
+ datasets::LargeWinogradInputTransformDataset1x4_1x5()))))))));
+
+const auto LargeWinogradInputTransformDatasetNHWC =
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_3x3(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_5x5(),
+ framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_5x1(),
+ datasets::LargeWinogradInputTransformDataset1x4_1x5())));
+
+// Filter transform
+const auto SmallWinogradFilterTransformDatasetNCHW =
+ framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })),
+ framework::dataset::concat(combine(datasets::Small3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U), Size2D(4U, 1U) })),
+ framework::dataset::concat(combine(datasets::Small1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U), Size2D(1U, 4U) })),
+ framework::dataset::concat(combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
+ framework::dataset::concat(combine(datasets::Small5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
+ combine(datasets::Small1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })))))));
+
+const auto SmallWinogradFilterTransformDatasetNHWC =
+ framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
+ framework::dataset::concat(combine(datasets::Small3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
+ framework::dataset::concat(combine(datasets::Small1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
+ framework::dataset::concat(combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
+ framework::dataset::concat(combine(datasets::Small5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
+ combine(datasets::Small1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })))))));
+
+const auto LargeWinogradFilterTransformDatasetNCHW =
+ framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })),
+ framework::dataset::concat(combine(datasets::Large3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U), Size2D(4U, 1U) })),
+ framework::dataset::concat(combine(datasets::Large1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U), Size2D(1U, 4U) })),
+ framework::dataset::concat(combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
+ framework::dataset::concat(combine(datasets::Large5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
+ combine(datasets::Large1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })))))));
+
+const auto LargeWinogradFilterTransformDatasetNHWC =
+ framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
+ framework::dataset::concat(combine(datasets::Large3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
+ framework::dataset::concat(combine(datasets::Large1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
+ framework::dataset::concat(combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
+ framework::dataset::concat(combine(datasets::Large5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
+ combine(datasets::Large1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })))))));
+
+// Output transform
+const auto SmallWinogradOutputTransformDatasetNCHW = datasets::SmallWinogradOutputTransformDatasetNCHW();
+
+const auto SmallWinogradOutputTransformDatasetNHWC = datasets::SmallWinogradOutputTransformDatasetNHWC();
+
+const auto LargeWinogradOutputTransformDatasetNCHW = datasets::LargeWinogradOutputTransformDatasetNCHW();
+
+const auto LargeWinogradOutputTransformDatasetNHWC = datasets::LargeWinogradOutputTransformDatasetNHWC();
} // namespace
using namespace arm_compute::misc::shape_calculator;
@@ -61,9 +142,6 @@
TEST_SUITE(Winograd)
TEST_SUITE(InputTransform)
-
-// *INDENT-OFF*
-// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
framework::dataset::make("InputInfo",{
TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F16), // F16 not supported
@@ -97,20 +175,23 @@
{
ARM_COMPUTE_EXPECT(bool(CLWinogradInputTransform::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS);
}
-// clang-format on
-// *INDENT-ON*
using CLWinogradInputTransformFixture = WinogradInputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradInputTransform, float>;
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallWinogradInputTransformDataset(), datasets::LargeWinogradInputTransformDataset()),
+TEST_SUITE(NCHW)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(SmallWinogradInputTransformDatasetNCHW,
+ LargeWinogradInputTransformDatasetNCHW),
framework::dataset::make("DataLayout", { DataLayout::NCHW })),
- framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("DataType", { DataType::F32 })),
shape_in, winograd_info, data_layout, data_type)
{
- TensorShape shape_out = compute_winograd_input_transform_shape(TensorInfo(shape_in, 1, data_type), winograd_info);
+ TensorInfo tensor_info_in(shape_in, 1, data_type);
+ tensor_info_in.set_data_layout(data_layout);
+
+ TensorShape shape_out = compute_winograd_input_transform_shape(tensor_info_in, winograd_info);
// Create tensors
- CLTensor in = create_tensor<CLTensor>(shape_in, data_type, 1, 0, QuantizationInfo(), data_layout);
+ CLTensor in = create_tensor<CLTensor>(shape_in, data_type, 1, QuantizationInfo(), data_layout);
CLTensor out = create_tensor<CLTensor>(shape_out, data_type);
ARM_COMPUTE_EXPECT(in.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -123,24 +204,70 @@
winograd_input_transform.configure(&in, &out, winograd_info);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallWinogradInputTransformDataset(),
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixture, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNCHW,
framework::dataset::make("DataLayout", { DataLayout::NCHW })),
- framework::dataset::make("DataType", { DataType::F32 })))
+ framework::dataset::make("DataType", { DataType::F32 })))
{
validate(CLAccessor(_target), _reference, tolerance_f32);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradInputTransformFixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeWinogradInputTransformDataset(),
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradInputTransformFixture, framework::DatasetMode::NIGHTLY, combine(combine(LargeWinogradInputTransformDatasetNCHW,
framework::dataset::make("DataLayout", { DataLayout::NCHW })),
- framework::dataset::make("DataType", { DataType::F32 })))
+ framework::dataset::make("DataType", { DataType::F32 })))
{
validate(CLAccessor(_target), _reference, tolerance_f32);
}
+TEST_SUITE_END() // NCHW
+
+TEST_SUITE(NHWC)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(SmallWinogradInputTransformDatasetNHWC,
+ LargeWinogradInputTransformDatasetNHWC),
+ framework::dataset::make("DataLayout", { DataLayout::NHWC })),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ shape_in, winograd_info, data_layout, data_type)
+{
+ TensorShape shape_in_nhwc(shape_in);
+
+ // Convert the shape to NHWC
+ permute(shape_in_nhwc, PermutationVector(2U, 0U, 1U));
+
+ // TensorInfo
+ TensorInfo tensor_info_in(shape_in_nhwc, 1, data_type);
+ tensor_info_in.set_data_layout(data_layout);
+
+ TensorShape shape_out = compute_winograd_input_transform_shape(tensor_info_in, winograd_info);
+
+ // Create tensors
+ CLTensor in = create_tensor<CLTensor>(shape_in_nhwc, data_type, 1, QuantizationInfo(), data_layout);
+ CLTensor out = create_tensor<CLTensor>(shape_out, data_type);
+
+ ARM_COMPUTE_EXPECT(in.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(out.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create and configure function
+ CLWinogradInputTransform winograd_input_transform;
+
+ // Configure the function
+ winograd_input_transform.configure(&in, &out, winograd_info);
+}
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixture, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNHWC,
+ framework::dataset::make("DataLayout", { DataLayout::NHWC })),
+ framework::dataset::make("DataType", { DataType::F32 })))
+{
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradInputTransformFixture, framework::DatasetMode::NIGHTLY, combine(combine(LargeWinogradInputTransformDatasetNHWC,
+ framework::dataset::make("DataLayout", { DataLayout::NHWC })),
+ framework::dataset::make("DataType", { DataType::F32 })))
+{
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+TEST_SUITE_END() // NHWC
TEST_SUITE_END() // InputTransform
TEST_SUITE(FilterTransform)
-// *INDENT-OFF*
-// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
framework::dataset::make("InputInfo",{
TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F16), // F16 not supported
@@ -174,25 +301,25 @@
{
ARM_COMPUTE_EXPECT(bool(CLWinogradFilterTransformKernel::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS);
}
-// clang-format on
-// *INDENT-ON*
using CLWinogradFilterTransform = CLSynthetizeFunctionWithZeroConstantBorder<CLWinogradFilterTransformKernel, 0>;
using CLWinogradFilterTransformFixture = WinogradFilterTransformValidationFixture<CLTensor, CLAccessor, CLWinogradFilterTransform, float>;
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(framework::dataset::concat(datasets::Small3x3Shapes(), datasets::Large3x3Shapes()),
- framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })),
- framework::dataset::make("DataLayout", { DataLayout::NCHW })),
- framework::dataset::make("DataType", { DataType::F32 })),
+TEST_SUITE(NCHW)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL,
+ combine(combine(framework::dataset::concat(SmallWinogradFilterTransformDatasetNCHW,
+ LargeWinogradFilterTransformDatasetNCHW),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
+ framework::dataset::make("DataType", { DataType::F32 })),
shape_a, output_tile, data_layout, data_type)
{
- WinogradInfo winograd_info(output_tile, Size2D(shape_a[0], shape_a[1]), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */);
+ WinogradInfo winograd_info(output_tile, Size2D(shape_a[0], shape_a[1]), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, data_layout /* Not needed */);
TensorShape shape_b = compute_winograd_filter_transform_shape(TensorInfo(shape_a, 1, data_type), winograd_info);
// Create tensors
- CLTensor a = create_tensor<CLTensor>(shape_a, data_type, 1, 0, QuantizationInfo(), data_layout);
- CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, 0, QuantizationInfo(), data_layout);
+ CLTensor a = create_tensor<CLTensor>(shape_a, data_type, 1, QuantizationInfo(), data_layout);
+ CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, QuantizationInfo(), data_layout);
ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -202,33 +329,79 @@
winograd_filter_transform.configure(&a, &b, winograd_info);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixture, framework::DatasetMode::ALL,
- combine(combine(framework::dataset::concat(framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", Size2D(2U, 2U))), combine(datasets::Small3x3Shapes(),
- framework::dataset::make("OutputTile", Size2D(4U, 4U)))),
- combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", Size2D(4U, 4U)))),
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(SmallWinogradFilterTransformDatasetNCHW,
framework::dataset::make("DataLayout", { DataLayout::NCHW })),
- framework::dataset::make("DataType", { DataType::F32 })))
+ framework::dataset::make("DataType", { DataType::F32 })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f32);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradFilterTransformFixture, framework::DatasetMode::NIGHTLY,
- combine(combine(framework::dataset::concat(framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", Size2D(2U, 2U))), combine(datasets::Large3x3Shapes(),
- framework::dataset::make("OutputTile", Size2D(4U, 4U)))),
- combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", Size2D(4U, 4U)))),
+ combine(combine(LargeWinogradFilterTransformDatasetNCHW,
framework::dataset::make("DataLayout", { DataLayout::NCHW })),
- framework::dataset::make("DataType", { DataType::F32 })))
+ framework::dataset::make("DataType", { DataType::F32 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+TEST_SUITE_END() // NCHW
+
+TEST_SUITE(NHWC)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL,
+ combine(combine(framework::dataset::concat(SmallWinogradFilterTransformDatasetNHWC,
+ LargeWinogradFilterTransformDatasetNHWC),
+ framework::dataset::make("DataLayout", { DataLayout::NHWC })),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ shape_in, output_tile, data_layout, data_type)
+{
+ TensorShape shape_in_nhwc(shape_in);
+
+ // Convert the shape to NHWC
+ permute(shape_in_nhwc, PermutationVector(2U, 0U, 1U));
+
+ // TensorInfo
+ TensorInfo tensor_info_in(shape_in_nhwc, 1, data_type);
+ tensor_info_in.set_data_layout(data_layout);
+
+ WinogradInfo winograd_info(output_tile, Size2D(shape_in[0], shape_in[1]), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, data_layout /* Not needed */);
+
+ TensorShape shape_b = compute_winograd_filter_transform_shape(tensor_info_in, winograd_info);
+
+ // Create tensors
+ CLTensor a = create_tensor<CLTensor>(shape_in_nhwc, data_type, 1, QuantizationInfo(), data_layout);
+ CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, QuantizationInfo(), data_layout);
+
+ ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create and configure function
+ CLWinogradFilterTransform winograd_filter_transform;
+ winograd_filter_transform.configure(&a, &b, winograd_info);
+}
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradFilterTransformFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(SmallWinogradFilterTransformDatasetNHWC,
+ framework::dataset::make("DataLayout", { DataLayout::NHWC })),
+ framework::dataset::make("DataType", { DataType::F32 })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f32);
}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradFilterTransformFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(LargeWinogradFilterTransformDatasetNHWC,
+ framework::dataset::make("DataLayout", { DataLayout::NHWC })),
+ framework::dataset::make("DataType", { DataType::F32 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+TEST_SUITE_END() // NHWC
TEST_SUITE_END() // FilterTransform
TEST_SUITE(OutputTransform)
-// *INDENT-OFF*
-// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
framework::dataset::make("InputInfo",{
TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F16), // F16 not supported
@@ -279,21 +452,21 @@
{
ARM_COMPUTE_EXPECT(bool(CLWinogradOutputTransformKernel::validate(&input_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS);
}
-// clang-format on
-// *INDENT-ON*
using CLWinogradOutputTransform = CLSynthetizeFunctionWithZeroConstantBorder<CLWinogradOutputTransformKernel, 0>;
using CLWinogradOutputTransformFixture = WinogradOutputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradOutputTransform, float>;
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallWinogradOutputTransformDataset(), datasets::LargeWinogradOutputTransformDataset()),
- framework::dataset::make("DataType", { DataType::F32 })),
+TEST_SUITE(NCHW)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(SmallWinogradOutputTransformDatasetNCHW,
+ LargeWinogradOutputTransformDatasetNCHW),
+ framework::dataset::make("DataType", { DataType::F32 })),
shape_a, winograd_info, data_type)
{
TensorShape shape_b = compute_winograd_output_transform_shape(TensorInfo(shape_a, 1, data_type), winograd_info);
// Create tensors
CLTensor a = create_tensor<CLTensor>(shape_a, data_type);
- CLTensor b = create_tensor<CLTensor>(shape_b, data_type);
+ CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, QuantizationInfo(), winograd_info.output_data_layout);
ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -303,23 +476,62 @@
winograd_output_transform.configure(&a, nullptr, &b, winograd_info);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradOutputTransformFixture, framework::DatasetMode::ALL, combine(datasets::SmallWinogradOutputTransformDataset(), framework::dataset::make("DataType", { DataType::F32 })))
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradOutputTransformFixture, framework::DatasetMode::ALL,
+ combine(SmallWinogradOutputTransformDatasetNCHW,
+ framework::dataset::make("DataType", { DataType::F32 })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f32);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradOutputTransformFixture, framework::DatasetMode::NIGHTLY, combine(datasets::LargeWinogradOutputTransformDataset(), framework::dataset::make("DataType", { DataType::F32 })))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradOutputTransformFixture, framework::DatasetMode::NIGHTLY,
+ combine(LargeWinogradOutputTransformDatasetNCHW,
+ framework::dataset::make("DataType", { DataType::F32 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+TEST_SUITE_END() // NCHW
+
+TEST_SUITE(NHWC)
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(SmallWinogradOutputTransformDatasetNHWC,
+ LargeWinogradOutputTransformDatasetNHWC),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ shape_a, winograd_info, data_type)
+{
+ TensorShape shape_b = compute_winograd_output_transform_shape(TensorInfo(shape_a, 1, data_type), winograd_info);
+
+ // Create tensors
+ CLTensor a = create_tensor<CLTensor>(shape_a, data_type);
+ CLTensor b = create_tensor<CLTensor>(shape_b, data_type, 1, QuantizationInfo(), winograd_info.output_data_layout);
+
+ ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create and configure function
+ CLWinogradOutputTransform winograd_output_transform;
+ winograd_output_transform.configure(&a, nullptr, &b, winograd_info);
+}
+
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradOutputTransformFixture, framework::DatasetMode::ALL,
+ combine(SmallWinogradOutputTransformDatasetNHWC,
+ framework::dataset::make("DataType", { DataType::F32 })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_f32);
}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradOutputTransformFixture, framework::DatasetMode::NIGHTLY,
+ combine(LargeWinogradOutputTransformDatasetNHWC,
+ framework::dataset::make("DataType", { DataType::F32 })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_f32);
+}
+TEST_SUITE_END() // NHWC
TEST_SUITE_END() // OutputTransform
TEST_SUITE(ConvolutionLayer)
-// *INDENT-OFF*
-// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
framework::dataset::make("InputInfo", {
TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F16), // FP16 not supported
@@ -361,52 +573,147 @@
{
ARM_COMPUTE_EXPECT(bool(CLWinogradConvolutionLayer::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), conv_info)) == expected, framework::LogLevel::ERRORS);
}
-// clang-format on
-// *INDENT-ON*
using CLWinogradConvolutionLayerFastMathFixture = WinogradConvolutionLayerFastMathValidationFixture<CLTensor, CLAccessor, CLWinogradConvolutionLayer, float>;
TEST_SUITE(Conv3x3)
FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT,
- combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
- framework::dataset::make("DataType", { DataType::F32 })),
- framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
+ combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY,
- combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(),
- framework::dataset::make("DataType", { DataType::F32 })),
- framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
+ combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
}
TEST_SUITE_END() // Conv3x3
-TEST_SUITE(Conv5x5)
+TEST_SUITE(Conv3x1)
FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT,
- combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(),
+ combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(),
framework::dataset::make("DataType", { DataType::F32 })),
- framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY,
- combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(),
+ combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(),
framework::dataset::make("DataType", { DataType::F32 })),
- framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })))
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
+}
+TEST_SUITE_END() // Conv3x1
+
+TEST_SUITE(Conv1x3)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
+}
+TEST_SUITE_END() // Conv1x3
+
+TEST_SUITE(Conv5x5)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+
{
// Validate output
validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
}
TEST_SUITE_END() // Conv5x5
-TEST_SUITE_END() // ConvolutionLayer
+TEST_SUITE(Conv5x1)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
+}
+TEST_SUITE_END() // Conv5x1
+
+TEST_SUITE(Conv1x5)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ framework::dataset::make("ActivationLayerInfo", { ActivationLayerInfo() })),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
+}
+TEST_SUITE_END() // Conv1x5
+
+TEST_SUITE_END() // ConvolutionLayer
TEST_SUITE_END() // Winograd
TEST_SUITE_END() // CL
} // namespace validation
diff --git a/tests/validation/FixedPoint.h b/tests/validation/FixedPoint.h
deleted file mode 100644
index a573515..0000000
--- a/tests/validation/FixedPoint.h
+++ /dev/null
@@ -1,994 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_TEST_VALIDATION_FIXEDPOINT_H__
-#define __ARM_COMPUTE_TEST_VALIDATION_FIXEDPOINT_H__
-
-#include "support/ToolchainSupport.h"
-#include "tests/Utils.h"
-
-#include <cassert>
-#include <cstdint>
-#include <cstdlib>
-#include <limits>
-#include <string>
-#include <type_traits>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace fixed_point_arithmetic
-{
-namespace detail
-{
-// Forward declare structs
-struct functions;
-template <typename T>
-struct constant_expr;
-}
-
-/** Fixed point traits */
-namespace traits
-{
-// Promote types
-// *INDENT-OFF*
-// clang-format off
-/** Promote a type */
-template <typename T> struct promote { };
-/** Promote uint8_t to uint16_t */
-template <> struct promote<uint8_t> { using type = uint16_t; /**< Promoted type */ };
-/** Promote int8_t to int16_t */
-template <> struct promote<int8_t> { using type = int16_t; /**< Promoted type */ };
-/** Promote uint16_t to uint32_t */
-template <> struct promote<uint16_t> { using type = uint32_t; /**< Promoted type */ };
-/** Promote int16_t to int32_t */
-template <> struct promote<int16_t> { using type = int32_t; /**< Promoted type */ };
-/** Promote uint32_t to uint64_t */
-template <> struct promote<uint32_t> { using type = uint64_t; /**< Promoted type */ };
-/** Promote int32_t to int64_t */
-template <> struct promote<int32_t> { using type = int64_t; /**< Promoted type */ };
-/** Promote float to float */
-template <> struct promote<float> { using type = float; /**< Promoted type */ };
-/** Promote half to half */
-template <> struct promote<half> { using type = half; /**< Promoted type */ };
-
-/** Get promoted type */
-template <typename T>
-using promote_t = typename promote<T>::type;
-// clang-format on
-// *INDENT-ON*
-}
-
-/** Strongly typed enum class representing the overflow policy */
-enum class OverflowPolicy
-{
- WRAP, /**< Wrap policy */
- SATURATE /**< Saturate policy */
-};
-/** Strongly typed enum class representing the rounding policy */
-enum class RoundingPolicy
-{
- TO_ZERO, /**< Round to zero policy */
- TO_NEAREST_EVEN /**< Round to nearest even policy */
-};
-
-/** Arbitrary fixed-point arithmetic class */
-template <typename T>
-class fixed_point
-{
-public:
- // Static Checks
- static_assert(std::is_integral<T>::value, "Type is not an integer");
-
- /** Constructor (from different fixed point type)
- *
- * @param[in] val Fixed point
- * @param[in] p Fixed point precision
- */
- template <typename U>
- fixed_point(fixed_point<U> val, uint8_t p)
- : _value(0), _fixed_point_position(p)
- {
- assert(p > 0 && p < std::numeric_limits<T>::digits);
- T v = 0;
-
- if(std::numeric_limits<T>::digits < std::numeric_limits<U>::digits)
- {
- val.rescale(p);
- v = detail::constant_expr<T>::saturate_cast(val.raw());
- }
- else
- {
- auto v_cast = static_cast<fixed_point<T>>(val);
- v_cast.rescale(p);
- v = v_cast.raw();
- }
- _value = static_cast<T>(v);
- }
- /** Constructor (from integer)
- *
- * @param[in] val Integer value to be represented as fixed point
- * @param[in] p Fixed point precision
- * @param[in] is_raw If true val is a raw fixed point value else an integer
- */
- template <typename U, typename = typename std::enable_if<std::is_integral<U>::value>::type>
- fixed_point(U val, uint8_t p, bool is_raw = false)
- : _value(val << p), _fixed_point_position(p)
- {
- if(is_raw)
- {
- _value = val;
- }
- }
- /** Constructor (from float)
- *
- * @param[in] val Float value to be represented as fixed point
- * @param[in] p Fixed point precision
- */
- fixed_point(float val, uint8_t p)
- : _value(detail::constant_expr<T>::to_fixed(val, p)), _fixed_point_position(p)
- {
- assert(p > 0 && p < std::numeric_limits<T>::digits);
- }
- /** Constructor (from float string)
- *
- * @param[in] str Float string to be represented as fixed point
- * @param[in] p Fixed point precision
- */
- fixed_point(std::string str, uint8_t p)
- : _value(detail::constant_expr<T>::to_fixed(support::cpp11::stof(str), p)), _fixed_point_position(p)
- {
- assert(p > 0 && p < std::numeric_limits<T>::digits);
- }
- /** Default copy constructor */
- fixed_point &operator=(const fixed_point &) = default;
- /** Default move constructor */
- fixed_point &operator=(fixed_point &&) = default;
- /** Default copy assignment operator */
- fixed_point(const fixed_point &) = default;
- /** Default move assignment operator */
- fixed_point(fixed_point &&) = default;
-
- /** Float conversion operator
- *
- * @return Float representation of fixed point
- */
- operator float() const
- {
- return detail::constant_expr<T>::to_float(_value, _fixed_point_position);
- }
- /** Integer conversion operator
- *
- * @return Integer representation of fixed point
- */
- template <typename U, typename = typename std::enable_if<std::is_integral<T>::value>::type>
- operator U() const
- {
- return detail::constant_expr<T>::to_int(_value, _fixed_point_position);
- }
- /** Convert to different fixed point of different type but same precision
- *
- * @note Down-conversion might fail.
- */
- template <typename U>
- operator fixed_point<U>()
- {
- U val = static_cast<U>(_value);
- if(std::numeric_limits<U>::digits < std::numeric_limits<T>::digits)
- {
- val = detail::constant_expr<U>::saturate_cast(_value);
- }
- return fixed_point<U>(val, _fixed_point_position, true);
- }
-
- /** Arithmetic += assignment operator
- *
- * @param[in] rhs Fixed point operand
- *
- * @return Reference to this fixed point
- */
- template <typename U>
- fixed_point<T> &operator+=(const fixed_point<U> &rhs)
- {
- fixed_point<T> val(rhs, _fixed_point_position);
- _value += val.raw();
- return *this;
- }
- /** Arithmetic -= assignment operator
- *
- * @param[in] rhs Fixed point operand
- *
- * @return Reference to this fixed point
- */
- template <typename U>
- fixed_point<T> &operator-=(const fixed_point<U> &rhs)
- {
- fixed_point<T> val(rhs, _fixed_point_position);
- _value -= val.raw();
- return *this;
- }
-
- /** Raw value accessor
- *
- * @return Raw fixed point value
- */
- T raw() const
- {
- return _value;
- }
- /** Precision accessor
- *
- * @return Precision of fixed point
- */
- uint8_t precision() const
- {
- return _fixed_point_position;
- }
- /** Rescale a fixed point to a new precision
- *
- * @param[in] p New fixed point precision
- */
- void rescale(uint8_t p)
- {
- assert(p > 0 && p < std::numeric_limits<T>::digits);
-
- using promoted_T = typename traits::promote<T>::type;
- promoted_T val = _value;
- if(p > _fixed_point_position)
- {
- val <<= (p - _fixed_point_position);
- }
- else if(p < _fixed_point_position)
- {
- uint8_t pbar = _fixed_point_position - p;
- val += (pbar != 0) ? (1 << (pbar - 1)) : 0;
- val >>= pbar;
- }
-
- _value = detail::constant_expr<T>::saturate_cast(val);
- _fixed_point_position = p;
- }
-
-private:
- T _value; /**< Fixed point raw value */
- uint8_t _fixed_point_position; /**< Fixed point precision */
-};
-
-namespace detail
-{
-/** Count the number of leading zero bits in the given value.
- *
- * @param[in] value Input value.
- *
- * @return Number of leading zero bits.
- */
-template <typename T>
-constexpr int clz(T value)
-{
- using unsigned_T = typename std::make_unsigned<T>::type;
- // __builtin_clz is available for int. Need to correct reported number to
- // match the original type.
- return __builtin_clz(value) - (32 - std::numeric_limits<unsigned_T>::digits);
-}
-
-/** Constant expressions */
-template <typename T>
-struct constant_expr
-{
- /** Calculate representation of 1 in fixed point given a fixed point precision
- *
- * @param[in] p Fixed point precision
- *
- * @return Representation of value 1 in fixed point.
- */
- static constexpr T fixed_one(uint8_t p)
- {
- return (1 << p);
- }
- /** Calculate fixed point precision step given a fixed point precision
- *
- * @param[in] p Fixed point precision
- *
- * @return Fixed point precision step
- */
- static constexpr float fixed_step(uint8_t p)
- {
- return (1.0f / static_cast<float>(1 << p));
- }
-
- /** Convert a fixed point value to float given its precision.
- *
- * @param[in] val Fixed point value
- * @param[in] p Fixed point precision
- *
- * @return Float representation of the fixed point number
- */
- static constexpr float to_float(T val, uint8_t p)
- {
- return static_cast<float>(val * fixed_step(p));
- }
- /** Convert a fixed point value to integer given its precision.
- *
- * @param[in] val Fixed point value
- * @param[in] p Fixed point precision
- *
- * @return Integer of the fixed point number
- */
- static constexpr T to_int(T val, uint8_t p)
- {
- return val >> p;
- }
- /** Convert a single precision floating point value to a fixed point representation given its precision.
- *
- * @param[in] val Floating point value
- * @param[in] p Fixed point precision
- *
- * @return The raw fixed point representation
- */
- static constexpr T to_fixed(float val, uint8_t p)
- {
- return static_cast<T>(saturate_cast<float>(val * fixed_one(p) + ((val >= 0) ? 0.5 : -0.5)));
- }
- /** Clamp value between two ranges
- *
- * @param[in] val Value to clamp
- * @param[in] min Minimum value to clamp to
- * @param[in] max Maximum value to clamp to
- *
- * @return clamped value
- */
- static constexpr T clamp(T val, T min, T max)
- {
- return std::min(std::max(val, min), max);
- }
- /** Saturate given number
- *
- * @param[in] val Value to saturate
- *
- * @return Saturated value
- */
- template <typename U>
- static constexpr T saturate_cast(U val)
- {
- return static_cast<T>(std::min<U>(std::max<U>(val, static_cast<U>(std::numeric_limits<T>::min())), static_cast<U>(std::numeric_limits<T>::max())));
- }
-};
-/** Functions */
-struct functions
-{
- /** Output stream operator
- *
- * @param[in] s Output stream
- * @param[in] x Fixed point value
- *
- * @return Reference output to updated stream
- */
- template <typename T, typename U, typename traits>
- static std::basic_ostream<T, traits> &write(std::basic_ostream<T, traits> &s, fixed_point<U> &x)
- {
- return s << static_cast<float>(x);
- }
- /** Signbit of a fixed point number.
- *
- * @param[in] x Fixed point number
- *
- * @return True if negative else false.
- */
- template <typename T>
- static bool signbit(fixed_point<T> x)
- {
- return ((x.raw() >> std::numeric_limits<T>::digits) != 0);
- }
- /** Checks if two fixed point numbers are equal
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return True if fixed points are equal else false
- */
- template <typename T>
- static bool isequal(fixed_point<T> x, fixed_point<T> y)
- {
- uint8_t p = std::min(x.precision(), y.precision());
- x.rescale(p);
- y.rescale(p);
- return (x.raw() == y.raw());
- }
- /** Checks if two fixed point number are not equal
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return True if fixed points are not equal else false
- */
- template <typename T>
- static bool isnotequal(fixed_point<T> x, fixed_point<T> y)
- {
- return !isequal(x, y);
- }
- /** Checks if one fixed point is greater than the other
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return True if fixed point is greater than other
- */
- template <typename T>
- static bool isgreater(fixed_point<T> x, fixed_point<T> y)
- {
- uint8_t p = std::min(x.precision(), y.precision());
- x.rescale(p);
- y.rescale(p);
- return (x.raw() > y.raw());
- }
- /** Checks if one fixed point is greater or equal than the other
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return True if fixed point is greater or equal than other
- */
- template <typename T>
- static bool isgreaterequal(fixed_point<T> x, fixed_point<T> y)
- {
- uint8_t p = std::min(x.precision(), y.precision());
- x.rescale(p);
- y.rescale(p);
- return (x.raw() >= y.raw());
- }
- /** Checks if one fixed point is less than the other
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return True if fixed point is less than other
- */
- template <typename T>
- static bool isless(fixed_point<T> x, fixed_point<T> y)
- {
- uint8_t p = std::min(x.precision(), y.precision());
- x.rescale(p);
- y.rescale(p);
- return (x.raw() < y.raw());
- }
- /** Checks if one fixed point is less or equal than the other
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return True if fixed point is less or equal than other
- */
- template <typename T>
- static bool islessequal(fixed_point<T> x, fixed_point<T> y)
- {
- uint8_t p = std::min(x.precision(), y.precision());
- x.rescale(p);
- y.rescale(p);
- return (x.raw() <= y.raw());
- }
- /** Checks if one fixed point is less or greater than the other
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return True if fixed point is less or greater than other
- */
- template <typename T>
- static bool islessgreater(fixed_point<T> x, fixed_point<T> y)
- {
- return isnotequal(x, y);
- }
- /** Clamp fixed point to specific range.
- *
- * @param[in] x Fixed point operand
- * @param[in] min Minimum value to clamp to
- * @param[in] max Maximum value to clamp to
- *
- * @return Clamped result
- */
- template <typename T>
- static fixed_point<T> clamp(fixed_point<T> x, T min, T max)
- {
- return fixed_point<T>(constant_expr<T>::clamp(x.raw(), min, max), x.precision(), true);
- }
- /** Negate number
- *
- * @param[in] x Fixed point operand
- *
- * @return Negated fixed point result
- */
- template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
- static fixed_point<T> negate(fixed_point<T> x)
- {
- using promoted_T = typename traits::promote<T>::type;
- promoted_T val = -x.raw();
- if(OP == OverflowPolicy::SATURATE)
- {
- val = constant_expr<T>::saturate_cast(val);
- }
- return fixed_point<T>(static_cast<T>(val), x.precision(), true);
- }
- /** Perform addition among two fixed point numbers
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return Result fixed point with precision equal to minimum precision of both operands
- */
- template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
- static fixed_point<T> add(fixed_point<T> x, fixed_point<T> y)
- {
- uint8_t p = std::min(x.precision(), y.precision());
- x.rescale(p);
- y.rescale(p);
- if(OP == OverflowPolicy::SATURATE)
- {
- using type = typename traits::promote<T>::type;
- type val = static_cast<type>(x.raw()) + static_cast<type>(y.raw());
- val = constant_expr<T>::saturate_cast(val);
- return fixed_point<T>(static_cast<T>(val), p, true);
- }
- else
- {
- return fixed_point<T>(x.raw() + y.raw(), p, true);
- }
- }
- /** Perform subtraction among two fixed point numbers
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return Result fixed point with precision equal to minimum precision of both operands
- */
- template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
- static fixed_point<T> sub(fixed_point<T> x, fixed_point<T> y)
- {
- uint8_t p = std::min(x.precision(), y.precision());
- x.rescale(p);
- y.rescale(p);
- if(OP == OverflowPolicy::SATURATE)
- {
- using type = typename traits::promote<T>::type;
- type val = static_cast<type>(x.raw()) - static_cast<type>(y.raw());
- val = constant_expr<T>::saturate_cast(val);
- return fixed_point<T>(static_cast<T>(val), p, true);
- }
- else
- {
- return fixed_point<T>(x.raw() - y.raw(), p, true);
- }
- }
- /** Perform multiplication among two fixed point numbers
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return Result fixed point with precision equal to minimum precision of both operands
- */
- template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
- static fixed_point<T> mul(fixed_point<T> x, fixed_point<T> y)
- {
- using promoted_T = typename traits::promote<T>::type;
- uint8_t p_min = std::min(x.precision(), y.precision());
- uint8_t p_max = std::max(x.precision(), y.precision());
- promoted_T round_factor = (1 << (p_max - 1));
- promoted_T val = ((static_cast<promoted_T>(x.raw()) * static_cast<promoted_T>(y.raw())) + round_factor) >> p_max;
- if(OP == OverflowPolicy::SATURATE)
- {
- val = constant_expr<T>::saturate_cast(val);
- }
- return fixed_point<T>(static_cast<T>(val), p_min, true);
- }
- /** Perform division among two fixed point numbers
- *
- * @param[in] x First fixed point operand
- * @param[in] y Second fixed point operand
- *
- * @return Result fixed point with precision equal to minimum precision of both operands
- */
- template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
- static fixed_point<T> div(fixed_point<T> x, fixed_point<T> y)
- {
- using promoted_T = typename traits::promote<T>::type;
- uint8_t p = std::min(x.precision(), y.precision());
- promoted_T denom = static_cast<promoted_T>(y.raw());
- if(denom != 0)
- {
- promoted_T val = (static_cast<promoted_T>(x.raw()) << std::max(x.precision(), y.precision())) / denom;
- if(OP == OverflowPolicy::SATURATE)
- {
- val = constant_expr<T>::saturate_cast(val);
- }
- return fixed_point<T>(static_cast<T>(val), p, true);
- }
- else
- {
- T val = (x.raw() < 0) ? std::numeric_limits<T>::min() : std::numeric_limits<T>::max();
- return fixed_point<T>(val, p, true);
- }
- }
- /** Shift left
- *
- * @param[in] x Fixed point operand
- * @param[in] shift Shift value
- *
- * @return Shifted value
- */
- template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
- static fixed_point<T> shift_left(fixed_point<T> x, size_t shift)
- {
- using promoted_T = typename traits::promote<T>::type;
- promoted_T val = static_cast<promoted_T>(x.raw()) << shift;
- if(OP == OverflowPolicy::SATURATE)
- {
- val = constant_expr<T>::saturate_cast(val);
- }
- return fixed_point<T>(static_cast<T>(val), x.precision(), true);
- }
- /** Shift right
- *
- * @param[in] x Fixed point operand
- * @param[in] shift Shift value
- *
- * @return Shifted value
- */
- template <typename T>
- static fixed_point<T> shift_right(fixed_point<T> x, size_t shift)
- {
- return fixed_point<T>(x.raw() >> shift, x.precision(), true);
- }
- /** Calculate absolute value
- *
- * @param[in] x Fixed point operand
- *
- * @return Absolute value of operand
- */
- template <typename T>
- static fixed_point<T> abs(fixed_point<T> x)
- {
- using promoted_T = typename traits::promote<T>::type;
- T val = (x.raw() < 0) ? constant_expr<T>::saturate_cast(-static_cast<promoted_T>(x.raw())) : x.raw();
- return fixed_point<T>(val, x.precision(), true);
- }
- /** Calculate the logarithm of a fixed point number
- *
- * @param[in] x Fixed point operand
- *
- * @return Logarithm value of operand
- */
- template <typename T>
- static fixed_point<T> log(fixed_point<T> x)
- {
- uint8_t p = x.precision();
- auto const_one = fixed_point<T>(static_cast<T>(1), p);
-
- // Logarithm of 1 is zero and logarithm of negative values is not defined in R, so return 0.
- // Also, log(x) == -log(1/x) for 0 < x < 1.
- if(isequal(x, const_one) || islessequal(x, fixed_point<T>(static_cast<T>(0), p)))
- {
- return fixed_point<T>(static_cast<T>(0), p, true);
- }
- else if(isless(x, const_one))
- {
- return mul(log(div(const_one, x)), fixed_point<T>(-1, p));
- }
-
- // Remove even powers of 2
- T shift_val = 31 - __builtin_clz(x.raw() >> p);
- x = shift_right(x, shift_val);
- x = sub(x, const_one);
-
- // Constants
- auto ln2 = fixed_point<T>(0.6931471, p);
- auto A = fixed_point<T>(1.4384189, p);
- auto B = fixed_point<T>(-0.67719, p);
- auto C = fixed_point<T>(0.3218538, p);
- auto D = fixed_point<T>(-0.0832229, p);
-
- // Polynomial expansion
- auto sum = add(mul(x, D), C);
- sum = add(mul(x, sum), B);
- sum = add(mul(x, sum), A);
- sum = mul(x, sum);
-
- return mul(add(sum, fixed_point<T>(static_cast<T>(shift_val), p)), ln2);
- }
- /** Calculate the exponential of a fixed point number.
- *
- * exp(x) = exp(floor(x)) * exp(x - floor(x))
- * = pow(2, floor(x) / ln(2)) * exp(x - floor(x))
- * = exp(x - floor(x)) << (floor(x) / ln(2))
- *
- * @param[in] x Fixed point operand
- *
- * @return Exponential value of operand
- */
- template <typename T>
- static fixed_point<T> exp(fixed_point<T> x)
- {
- uint8_t p = x.precision();
- // Constants
- auto const_one = fixed_point<T>(1, p);
- auto ln2 = fixed_point<T>(0.6931471, p);
- auto inv_ln2 = fixed_point<T>(1.442695, p);
- auto A = fixed_point<T>(0.9978546, p);
- auto B = fixed_point<T>(0.4994721, p);
- auto C = fixed_point<T>(0.1763723, p);
- auto D = fixed_point<T>(0.0435108, p);
-
- T scaled_int_part = detail::constant_expr<T>::to_int(mul(x, inv_ln2).raw(), p);
-
- // Polynomial expansion
- auto frac_part = sub(x, mul(ln2, fixed_point<T>(scaled_int_part, p)));
- auto taylor = add(mul(frac_part, D), C);
- taylor = add(mul(frac_part, taylor), B);
- taylor = add(mul(frac_part, taylor), A);
- taylor = mul(frac_part, taylor);
- taylor = add(taylor, const_one);
-
- // Saturate value
- if(static_cast<T>(clz(taylor.raw())) <= scaled_int_part)
- {
- return fixed_point<T>(std::numeric_limits<T>::max(), p, true);
- }
-
- return (scaled_int_part < 0) ? shift_right(taylor, -scaled_int_part) : shift_left(taylor, scaled_int_part);
- }
- /** Calculate the inverse square root of a fixed point number
- *
- * @param[in] x Fixed point operand
- *
- * @return Inverse square root value of operand
- */
- template <typename T>
- static fixed_point<T> inv_sqrt(fixed_point<T> x)
- {
- const uint8_t p = x.precision();
- int8_t shift = std::numeric_limits<T>::digits - (p + detail::clz(x.raw()));
-
- shift += std::numeric_limits<T>::is_signed ? 1 : 0;
-
- // Use volatile to restrict compiler optimizations on shift as compiler reports maybe-uninitialized error on Android
- volatile int8_t *shift_ptr = &shift;
-
- auto const_three = fixed_point<T>(3, p);
- auto a = (*shift_ptr < 0) ? shift_left(x, -(shift)) : shift_right(x, shift);
- fixed_point<T> x2 = a;
-
- // We need three iterations to find the result for QS8 and five for QS16
- constexpr int num_iterations = std::is_same<T, int8_t>::value ? 3 : 5;
- for(int i = 0; i < num_iterations; ++i)
- {
- fixed_point<T> three_minus_dx = sub(const_three, mul(a, mul(x2, x2)));
- x2 = shift_right(mul(x2, three_minus_dx), 1);
- }
-
- return (shift < 0) ? shift_left(x2, (-shift) >> 1) : shift_right(x2, shift >> 1);
- }
- /** Calculate the hyperbolic tangent of a fixed point number
- *
- * @param[in] x Fixed point operand
- *
- * @return Hyperbolic tangent of the operand
- */
- template <typename T>
- static fixed_point<T> tanh(fixed_point<T> x)
- {
- uint8_t p = x.precision();
- // Constants
- auto const_one = fixed_point<T>(1, p);
- auto const_two = fixed_point<T>(2, p);
-
- auto exp2x = exp(const_two * x);
- auto num = exp2x - const_one;
- auto den = exp2x + const_one;
- auto tanh = num / den;
-
- return tanh;
- }
- /** Calculate the a-th power of a fixed point number.
- *
- * The power is computed as x^a = e^(log(x) * a)
- *
- * @param[in] x Fixed point operand
- * @param[in] a Fixed point exponent
- *
- * @return a-th power of the operand
- */
- template <typename T>
- static fixed_point<T> pow(fixed_point<T> x, fixed_point<T> a)
- {
- return exp(log(x) * a);
- }
-};
-
-template <typename T>
-bool operator==(const fixed_point<T> &lhs, const fixed_point<T> &rhs)
-{
- return functions::isequal(lhs, rhs);
-}
-template <typename T>
-bool operator!=(const fixed_point<T> &lhs, const fixed_point<T> &rhs)
-{
- return !operator==(lhs, rhs);
-}
-template <typename T>
-bool operator<(const fixed_point<T> &lhs, const fixed_point<T> &rhs)
-{
- return functions::isless(lhs, rhs);
-}
-template <typename T>
-bool operator>(const fixed_point<T> &lhs, const fixed_point<T> &rhs)
-{
- return operator<(rhs, lhs);
-}
-template <typename T>
-bool operator<=(const fixed_point<T> &lhs, const fixed_point<T> &rhs)
-{
- return !operator>(lhs, rhs);
-}
-template <typename T>
-bool operator>=(const fixed_point<T> &lhs, const fixed_point<T> &rhs)
-{
- return !operator<(lhs, rhs);
-}
-template <typename T>
-fixed_point<T> operator+(const fixed_point<T> &lhs, const fixed_point<T> &rhs)
-{
- return functions::add(lhs, rhs);
-}
-template <typename T>
-fixed_point<T> operator-(const fixed_point<T> &lhs, const fixed_point<T> &rhs)
-{
- return functions::sub(lhs, rhs);
-}
-template <typename T>
-fixed_point<T> operator-(const fixed_point<T> &rhs)
-{
- return functions::negate(rhs);
-}
-template <typename T>
-fixed_point<T> operator*(fixed_point<T> x, fixed_point<T> y)
-{
- return functions::mul(x, y);
-}
-template <typename T>
-fixed_point<T> operator/(fixed_point<T> x, fixed_point<T> y)
-{
- return functions::div(x, y);
-}
-template <typename T>
-fixed_point<T> operator>>(fixed_point<T> x, size_t shift)
-{
- return functions::shift_right(x, shift);
-}
-template <typename T>
-fixed_point<T> operator<<(fixed_point<T> x, size_t shift)
-{
- return functions::shift_left(x, shift);
-}
-template <typename T, typename U, typename traits>
-std::basic_ostream<T, traits> &operator<<(std::basic_ostream<T, traits> &s, fixed_point<U> x)
-{
- return functions::write(s, x);
-}
-template <typename T>
-inline fixed_point<T> min(fixed_point<T> x, fixed_point<T> y)
-{
- return x > y ? y : x;
-}
-template <typename T>
-inline fixed_point<T> max(fixed_point<T> x, fixed_point<T> y)
-{
- return x > y ? x : y;
-}
-template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
-inline fixed_point<T> add(fixed_point<T> x, fixed_point<T> y)
-{
- return functions::add<OP>(x, y);
-}
-template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
-inline fixed_point<T> sub(fixed_point<T> x, fixed_point<T> y)
-{
- return functions::sub<OP>(x, y);
-}
-template <OverflowPolicy OP = OverflowPolicy::SATURATE, typename T>
-inline fixed_point<T> mul(fixed_point<T> x, fixed_point<T> y)
-{
- return functions::mul<OP>(x, y);
-}
-template <typename T>
-inline fixed_point<T> div(fixed_point<T> x, fixed_point<T> y)
-{
- return functions::div(x, y);
-}
-template <typename T>
-inline fixed_point<T> abs(fixed_point<T> x)
-{
- return functions::abs(x);
-}
-template <typename T>
-inline fixed_point<T> clamp(fixed_point<T> x, T min, T max)
-{
- return functions::clamp(x, min, max);
-}
-template <typename T>
-inline fixed_point<T> exp(fixed_point<T> x)
-{
- return functions::exp(x);
-}
-template <typename T>
-inline fixed_point<T> log(fixed_point<T> x)
-{
- return functions::log(x);
-}
-template <typename T>
-inline fixed_point<T> inv_sqrt(fixed_point<T> x)
-{
- return functions::inv_sqrt(x);
-}
-template <typename T>
-inline fixed_point<T> tanh(fixed_point<T> x)
-{
- return functions::tanh(x);
-}
-template <typename T>
-inline fixed_point<T> pow(fixed_point<T> x, fixed_point<T> a)
-{
- return functions::pow(x, a);
-}
-} // namespace detail
-
-// Expose operators
-using detail::operator==;
-using detail::operator!=;
-using detail::operator<;
-using detail::operator>;
-using detail::operator<=;
-using detail::operator>=;
-using detail::operator+;
-using detail::operator-;
-using detail::operator*;
-using detail::operator/;
-using detail::operator>>;
-using detail::operator<<;
-
-// Expose additional functions
-using detail::min;
-using detail::max;
-using detail::add;
-using detail::sub;
-using detail::mul;
-using detail::div;
-using detail::abs;
-using detail::clamp;
-using detail::exp;
-using detail::log;
-using detail::inv_sqrt;
-using detail::tanh;
-using detail::pow;
-} // namespace fixed_point_arithmetic
-} // namespace test
-} // namespace arm_compute
-#endif /*__ARM_COMPUTE_TEST_VALIDATION_FIXEDPOINT_H__ */
diff --git a/tests/validation/GLES_COMPUTE/ActivationLayer.cpp b/tests/validation/GLES_COMPUTE/ActivationLayer.cpp
index 23821d3..7676b85 100644
--- a/tests/validation/GLES_COMPUTE/ActivationLayer.cpp
+++ b/tests/validation/GLES_COMPUTE/ActivationLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -61,35 +61,14 @@
case ActivationLayerInfo::ActivationFunction::SQUARE:
return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.1f : epsilon);
case ActivationLayerInfo::ActivationFunction::LOGISTIC:
- if(is_data_type_fixed_point(data_type))
- {
- return AbsoluteTolerance<float>(5.f);
- }
- else
- {
- return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : epsilon);
- }
+ return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : epsilon);
case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.00001f : epsilon);
case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
case ActivationLayerInfo::ActivationFunction::SQRT:
- if(is_data_type_fixed_point(data_type))
- {
- return AbsoluteTolerance<float>(5.f);
- }
- else
- {
- return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.01f : 0.00001f);
- }
+ return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.01f : 0.00001f);
case ActivationLayerInfo::ActivationFunction::TANH:
- if(is_data_type_fixed_point(data_type))
- {
- return AbsoluteTolerance<float>(5.f);
- }
- else
- {
- return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : 0.00001f);
- }
+ return AbsoluteTolerance<float>(data_type == DataType::F16 ? 0.001f : 0.00001f);
default:
return AbsoluteTolerance<float>(epsilon);
}
@@ -112,12 +91,9 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), CNNDataTypes), framework::dataset::make("InPlace", { false, true })),
shape, data_type, in_place)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = 0;
-
// Create tensors
- GCTensor src = create_tensor<GCTensor>(shape, data_type, 1, fixed_point_position);
- GCTensor dst = create_tensor<GCTensor>(shape, data_type, 1, fixed_point_position);
+ GCTensor src = create_tensor<GCTensor>(shape, data_type, 1);
+ GCTensor dst = create_tensor<GCTensor>(shape, data_type, 1);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
diff --git a/tests/validation/GLES_COMPUTE/BatchNormalizationLayer.cpp b/tests/validation/GLES_COMPUTE/BatchNormalizationLayer.cpp
index d22f1e9..3a3d1d7 100644
--- a/tests/validation/GLES_COMPUTE/BatchNormalizationLayer.cpp
+++ b/tests/validation/GLES_COMPUTE/BatchNormalizationLayer.cpp
@@ -67,9 +67,6 @@
framework::dataset::make("DataLayout", { DataLayout::NCHW })),
shape0, shape1, epsilon, use_beta, use_gamma, dt, data_layout)
{
- // Set fixed point position data type allowed
- int fixed_point_position = (arm_compute::is_data_type_fixed_point(dt)) ? 3 : 0;
-
TensorShape src_dst_shapes = shape0;
if(data_layout == DataLayout::NHWC)
{
@@ -77,12 +74,12 @@
}
// Create tensors
- GCTensor src = create_tensor<GCTensor>(src_dst_shapes, dt, 1, fixed_point_position, QuantizationInfo(), data_layout);
- GCTensor dst = create_tensor<GCTensor>(src_dst_shapes, dt, 1, fixed_point_position, QuantizationInfo(), data_layout);
- GCTensor mean = create_tensor<GCTensor>(shape1, dt, 1, fixed_point_position);
- GCTensor var = create_tensor<GCTensor>(shape1, dt, 1, fixed_point_position);
- GCTensor beta = create_tensor<GCTensor>(shape1, dt, 1, fixed_point_position);
- GCTensor gamma = create_tensor<GCTensor>(shape1, dt, 1, fixed_point_position);
+ GCTensor src = create_tensor<GCTensor>(src_dst_shapes, dt, 1, QuantizationInfo(), data_layout);
+ GCTensor dst = create_tensor<GCTensor>(src_dst_shapes, dt, 1, QuantizationInfo(), data_layout);
+ GCTensor mean = create_tensor<GCTensor>(shape1, dt, 1);
+ GCTensor var = create_tensor<GCTensor>(shape1, dt, 1);
+ GCTensor beta = create_tensor<GCTensor>(shape1, dt, 1);
+ GCTensor gamma = create_tensor<GCTensor>(shape1, dt, 1);
// Create and Configure function
GCBatchNormalizationLayer norm;
diff --git a/tests/validation/GLES_COMPUTE/ConvolutionLayer.cpp b/tests/validation/GLES_COMPUTE/ConvolutionLayer.cpp
index 722dd68..848bd8a 100644
--- a/tests/validation/GLES_COMPUTE/ConvolutionLayer.cpp
+++ b/tests/validation/GLES_COMPUTE/ConvolutionLayer.cpp
@@ -70,16 +70,13 @@
ActivationFunctionsDataset),
input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, act_info)
{
- // Set fixed point position data type allowed
- int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
auto bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
// Create tensors
- GCTensor src = create_tensor<GCTensor>(input_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- GCTensor weights = create_tensor<GCTensor>(weights_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- GCTensor bias = create_tensor<GCTensor>(bias_shape, bias_data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- GCTensor dst = create_tensor<GCTensor>(output_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
+ GCTensor src = create_tensor<GCTensor>(input_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ GCTensor weights = create_tensor<GCTensor>(weights_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ GCTensor bias = create_tensor<GCTensor>(bias_shape, bias_data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ GCTensor dst = create_tensor<GCTensor>(output_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -107,6 +104,8 @@
// Validate QuantizationInfo
ARM_COMPUTE_EXPECT(src.info()->quantization_info() == src_quantization_info, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->quantization_info() == weights_quantization_info, framework::LogLevel::ERRORS);
+
+ //Validate padding
}
template <typename T>
diff --git a/tests/validation/GLES_COMPUTE/DirectConvolutionLayerTensorShift.cpp b/tests/validation/GLES_COMPUTE/DirectConvolutionLayerTensorShift.cpp
index 45fb76c..0da90470 100644
--- a/tests/validation/GLES_COMPUTE/DirectConvolutionLayerTensorShift.cpp
+++ b/tests/validation/GLES_COMPUTE/DirectConvolutionLayerTensorShift.cpp
@@ -45,6 +45,7 @@
RelativeTolerance<half> tolerance_fp16(half(0.2)); /**< Tolerance for floating point tests */
RelativeTolerance<float> tolerance_fp32(0.02f); /**< Tolerance for floating point tests */
constexpr float tolerance_num = 0.07f; /**< Tolerance number */
+constexpr float abs_tolerance_fp32(0.02f); /**< Absolute tolerance for floating point tests */
/** Direct convolution data set. */
const auto data = combine(datasets::SmallDirectConvolutionTensorShiftShapes(),
@@ -78,7 +79,7 @@
FIXTURE_DATA_TEST_CASE(Run, GCDirectConvolutionLayerTensorShiftFixture<float>, framework::DatasetMode::ALL, combine(data, framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
- validate(GCAccessor(_target), _reference, tolerance_fp32);
+ validate(GCAccessor(_target), _reference, tolerance_fp32, 0.f, abs_tolerance_fp32);
}
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/GLES_COMPUTE/FullyConnectedLayer.cpp b/tests/validation/GLES_COMPUTE/FullyConnectedLayer.cpp
index 4040f46..53de8b9 100644
--- a/tests/validation/GLES_COMPUTE/FullyConnectedLayer.cpp
+++ b/tests/validation/GLES_COMPUTE/FullyConnectedLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -66,9 +66,6 @@
CNNDataTypes),
src_shape, weights_shape, bias_shape, dst_shape, transpose_weights, reshape_weights, data_type)
{
- // Set fixed point position data type allowed
- int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
TensorShape ws(weights_shape);
// Transpose weights if not done in the function
@@ -80,19 +77,24 @@
}
// Create tensors
- GCTensor src = create_tensor<GCTensor>(src_shape, data_type, 1, fixed_point_position);
- GCTensor weights = create_tensor<GCTensor>(ws, data_type, 1, fixed_point_position);
- GCTensor bias = create_tensor<GCTensor>(bias_shape, data_type, 1, fixed_point_position);
- GCTensor dst = create_tensor<GCTensor>(dst_shape, data_type, 1, fixed_point_position);
+ GCTensor src = create_tensor<GCTensor>(src_shape, data_type, 1);
+ GCTensor weights = create_tensor<GCTensor>(ws, data_type, 1);
+ GCTensor bias = create_tensor<GCTensor>(bias_shape, data_type, 1);
+ GCTensor dst = create_tensor<GCTensor>(dst_shape, data_type, 1);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+ // Create Fully Connected layer info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.transpose_weights = transpose_weights;
+ fc_info.are_weights_reshaped = !reshape_weights;
+
// Create and configure function.
GCFullyConnectedLayer fc;
- fc.configure(&src, &weights, &bias, &dst, transpose_weights, !reshape_weights);
+ fc.configure(&src, &weights, &bias, &dst, fc_info);
// Validate valid region
const ValidRegion dst_valid_region = shape_to_valid_region(dst_shape);
@@ -100,7 +102,7 @@
}
template <typename T>
-using GCFullyConnectedLayerFixture = FullyConnectedLayerValidationFixture<GCTensor, GCAccessor, GCFullyConnectedLayer, T, false>;
+using GCFullyConnectedLayerFixture = FullyConnectedLayerValidationFixture<GCTensor, GCAccessor, GCFullyConnectedLayer, T>;
TEST_SUITE(Float)
TEST_SUITE(FP16)
diff --git a/tests/validation/GLES_COMPUTE/GEMM.cpp b/tests/validation/GLES_COMPUTE/GEMM.cpp
index fe6de2d..1be2ea6 100644
--- a/tests/validation/GLES_COMPUTE/GEMM.cpp
+++ b/tests/validation/GLES_COMPUTE/GEMM.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -59,14 +59,11 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallGEMMDataset(), datasets::LargeGEMMDataset()), CNNDataTypes),
shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
// Create tensors
- GCTensor a = create_tensor<GCTensor>(shape_a, data_type, 1, fixed_point_position);
- GCTensor b = create_tensor<GCTensor>(shape_b, data_type, 1, fixed_point_position);
- GCTensor c = create_tensor<GCTensor>(shape_c, data_type, 1, fixed_point_position);
- GCTensor dst = create_tensor<GCTensor>(output_shape, data_type, 1, fixed_point_position);
+ GCTensor a = create_tensor<GCTensor>(shape_a, data_type, 1);
+ GCTensor b = create_tensor<GCTensor>(shape_b, data_type, 1);
+ GCTensor c = create_tensor<GCTensor>(shape_c, data_type, 1);
+ GCTensor dst = create_tensor<GCTensor>(output_shape, data_type, 1);
ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
diff --git a/tests/validation/GLES_COMPUTE/PoolingLayer.cpp b/tests/validation/GLES_COMPUTE/PoolingLayer.cpp
index ac1bd72..7679007 100644
--- a/tests/validation/GLES_COMPUTE/PoolingLayer.cpp
+++ b/tests/validation/GLES_COMPUTE/PoolingLayer.cpp
@@ -59,17 +59,17 @@
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
framework::dataset::make("InputInfo",
{
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid pad/size combination
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid pad/size combination
- TensorInfo(TensorShape(15U, 13U, 5U), 1, DataType::F32, 0), // Non-rectangular Global Pooling
- TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32, 0), // Invalid output Global Pooling
- TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32, 0),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid pad/size combination
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid pad/size combination
+ TensorInfo(TensorShape(15U, 13U, 5U), 1, DataType::F32), // Non-rectangular Global Pooling
+ TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32), // Invalid output Global Pooling
+ TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32),
}),
framework::dataset::make("OutputInfo",
{
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16, 0), TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0), TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32, 0), TensorInfo(TensorShape(25U, 16U, 2U), 1, DataType::F32, 0), TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32, 0), TensorInfo(TensorShape(2U, 2U, 5U), 1, DataType::F32, 0), TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32, 0),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16), TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32), TensorInfo(TensorShape(25U, 16U, 2U), 1, DataType::F32), TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32), TensorInfo(TensorShape(2U, 2U, 5U), 1, DataType::F32), TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32),
})),
framework::dataset::make("PoolInfo",
{
diff --git a/tests/validation/GLES_COMPUTE/SoftmaxLayer.cpp b/tests/validation/GLES_COMPUTE/SoftmaxLayer.cpp
index 2c28141..abc277a 100644
--- a/tests/validation/GLES_COMPUTE/SoftmaxLayer.cpp
+++ b/tests/validation/GLES_COMPUTE/SoftmaxLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -59,12 +59,9 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SoftmaxLayerSmallShapes(), datasets::SoftmaxLayerLargeShapes()), CNNDataTypes), shape, data_type)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
// Create tensors
- GCTensor src = create_tensor<GCTensor>(shape, data_type, 1, fixed_point_position);
- GCTensor dst = create_tensor<GCTensor>(shape, data_type, 1, fixed_point_position);
+ GCTensor src = create_tensor<GCTensor>(shape, data_type, 1);
+ GCTensor dst = create_tensor<GCTensor>(shape, data_type, 1);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
diff --git a/tests/validation/Helpers.cpp b/tests/validation/Helpers.cpp
index 25dc6c5..1044e32 100644
--- a/tests/validation/Helpers.cpp
+++ b/tests/validation/Helpers.cpp
@@ -131,10 +131,26 @@
return params;
}
+CannyEdgeParameters canny_edge_parameters()
+{
+ CannyEdgeParameters params;
+
+ std::mt19937 gen(library->seed());
+ std::uniform_int_distribution<uint8_t> int_dist(0, 255);
+ std::uniform_int_distribution<uint8_t> threshold_dist(2, 255);
+
+ params.constant_border_value = int_dist(gen);
+ params.upper_thresh = threshold_dist(gen); // upper_threshold >= 2
+ threshold_dist = std::uniform_int_distribution<uint8_t>(1, params.upper_thresh - 1);
+ params.lower_thresh = threshold_dist(gen); // lower_threshold >= 1 && lower_threshold < upper_threshold
+
+ return params;
+}
+
SimpleTensor<float> convert_from_asymmetric(const SimpleTensor<uint8_t> &src)
{
const QuantizationInfo &quantization_info = src.quantization_info();
- SimpleTensor<float> dst{ src.shape(), DataType::F32, 1, 0, QuantizationInfo(), src.data_layout() };
+ SimpleTensor<float> dst{ src.shape(), DataType::F32, 1, QuantizationInfo(), src.data_layout() };
for(int i = 0; i < src.num_elements(); ++i)
{
@@ -145,7 +161,7 @@
SimpleTensor<uint8_t> convert_to_asymmetric(const SimpleTensor<float> &src, const QuantizationInfo &quantization_info)
{
- SimpleTensor<uint8_t> dst{ src.shape(), DataType::QASYMM8, 1, 0, quantization_info };
+ SimpleTensor<uint8_t> dst{ src.shape(), DataType::QASYMM8, 1, quantization_info };
for(int i = 0; i < src.num_elements(); ++i)
{
dst[i] = quantization_info.quantize(src[i], RoundingPolicy::TO_NEAREST_UP);
@@ -199,7 +215,7 @@
template <typename T>
void get_tile(const SimpleTensor<T> &in, SimpleTensor<T> &tile, const Coordinates &coord)
{
- ARM_COMPUTE_ERROR_ON(tile.shape().num_dimensions() != 2);
+ ARM_COMPUTE_ERROR_ON(tile.shape().num_dimensions() > 2);
const int w_tile = tile.shape()[0];
const int h_tile = tile.shape()[1];
@@ -256,7 +272,36 @@
}
}
+template <typename T>
+void zeros(SimpleTensor<T> &in, const Coordinates &anchor, const TensorShape &shape)
+{
+ ARM_COMPUTE_ERROR_ON(anchor.num_dimensions() != shape.num_dimensions());
+ ARM_COMPUTE_ERROR_ON(in.shape().num_dimensions() > 2);
+ ARM_COMPUTE_ERROR_ON(shape.num_dimensions() > 2);
+
+ // Check if with the dimensions greater than 2 we could have out-of-bound reads
+ for(size_t d = 0; d < Coordinates::num_max_dimensions; ++d)
+ {
+ if(anchor[d] < 0 || ((anchor[d] + shape[d]) > in.shape()[d]))
+ {
+ ARM_COMPUTE_ERROR("anchor[d] < 0 || (anchor[d] + shape[d]) > in.shape()[d]");
+ }
+ }
+
+ // Get input pointer
+ auto in_ptr = static_cast<T *>(in(anchor[0] + anchor[1] * in.shape()[0]));
+
+ const unsigned int n = in.shape()[0];
+
+ for(unsigned int y = 0; y < shape[1]; ++y)
+ {
+ std::fill(in_ptr, in_ptr + shape[0], 0);
+ in_ptr += n;
+ }
+}
+
template void get_tile(const SimpleTensor<float> &in, SimpleTensor<float> &roi, const Coordinates &coord);
+template void zeros(SimpleTensor<float> &in, const Coordinates &anchor, const TensorShape &shape);
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/Helpers.h b/tests/validation/Helpers.h
index d07803f..e5ba148 100644
--- a/tests/validation/Helpers.h
+++ b/tests/validation/Helpers.h
@@ -52,14 +52,13 @@
/** Helper function to get the testing range for each activation layer.
*
- * @param[in] activation Activation function to test.
- * @param[in] data_type Data type.
- * @param[in] fixed_point_position Number of bits for the fractional part. Defaults to 1.
+ * @param[in] activation Activation function to test.
+ * @param[in] data_type Data type.
*
* @return A pair containing the lower upper testing bounds for a given function.
*/
template <typename T>
-std::pair<T, T> get_activation_layer_test_bounds(ActivationLayerInfo::ActivationFunction activation, DataType data_type, int fixed_point_position = 0)
+std::pair<T, T> get_activation_layer_test_bounds(ActivationLayerInfo::ActivationFunction activation, DataType data_type)
{
std::pair<T, T> bounds;
@@ -71,15 +70,16 @@
switch(activation)
{
+ case ActivationLayerInfo::ActivationFunction::TANH:
case ActivationLayerInfo::ActivationFunction::SQUARE:
case ActivationLayerInfo::ActivationFunction::LOGISTIC:
case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
// Reduce range as exponent overflows
- bounds = std::make_pair(-10._h, 10._h);
+ bounds = std::make_pair(-2._h, 2._h);
break;
case ActivationLayerInfo::ActivationFunction::SQRT:
// Reduce range as sqrt should take a non-negative number
- bounds = std::make_pair(0._h, 255._h);
+ bounds = std::make_pair(0._h, 128._h);
break;
default:
bounds = std::make_pair(-255._h, 255._h);
@@ -104,26 +104,6 @@
break;
}
break;
- case DataType::QS8:
- case DataType::QS16:
- switch(activation)
- {
- case ActivationLayerInfo::ActivationFunction::LOGISTIC:
- case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
- case ActivationLayerInfo::ActivationFunction::TANH:
- // Reduce range as exponent overflows
- bounds = std::make_pair(-(1 << fixed_point_position), 1 << fixed_point_position);
- break;
- case ActivationLayerInfo::ActivationFunction::SQRT:
- // Reduce range as sqrt should take a non-negative number
- // Can't be zero either as inv_sqrt is used in NEON.
- bounds = std::make_pair(1, std::numeric_limits<T>::max());
- break;
- default:
- bounds = std::make_pair(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max());
- break;
- }
- break;
default:
ARM_COMPUTE_ERROR("Unsupported data type");
}
@@ -168,6 +148,17 @@
/** Generate parameters for Harris Corners algorithm. */
HarrisCornersParameters harris_corners_parameters();
+/** Parameters of Canny edge algorithm. */
+struct CannyEdgeParameters
+{
+ int32_t upper_thresh{ 255 };
+ int32_t lower_thresh{ 0 };
+ uint8_t constant_border_value{ 0 };
+};
+
+/** Generate parameters for Canny edge algorithm. */
+CannyEdgeParameters canny_edge_parameters();
+
/** Helper function to fill the Lut random by a ILutAccessor.
*
* @param[in,out] table Accessor at the Lut.
@@ -187,12 +178,10 @@
/** Helper function to get the testing range for batch normalization layer.
*
- * @param[in] fixed_point_position (Optional) Number of bits for the fractional part. Defaults to 1.
- *
* @return A pair containing the lower upper testing bounds.
*/
template <typename T>
-std::pair<T, T> get_batchnormalization_layer_test_bounds(int fixed_point_position = 1)
+std::pair<T, T> get_batchnormalization_layer_test_bounds()
{
const bool is_float = std::is_floating_point<T>::value;
std::pair<T, T> bounds;
@@ -204,7 +193,7 @@
}
else
{
- bounds = std::make_pair(1, 1 << (fixed_point_position));
+ bounds = std::make_pair(1, 1);
}
return bounds;
@@ -268,6 +257,15 @@
*/
template <typename T>
void get_tile(const SimpleTensor<T> &in, SimpleTensor<T> &tile, const Coordinates &coord);
+
+/** Fill with zeros the input tensor in the area defined by anchor and shape
+ *
+ * @param[in] in Input tensor to fill with zeros
+ * @param[out] anchor Starting point of the zeros area
+ * @param[in] shape Ending point of the zeros area
+ */
+template <typename T>
+void zeros(SimpleTensor<T> &in, const Coordinates &anchor, const TensorShape &shape);
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/NEON/ActivationLayer.cpp b/tests/validation/NEON/ActivationLayer.cpp
index e77fe5a..5b16b06 100644
--- a/tests/validation/NEON/ActivationLayer.cpp
+++ b/tests/validation/NEON/ActivationLayer.cpp
@@ -43,14 +43,14 @@
{
namespace
{
-/** Define tolerance of the activation layer.
+/** Define relative tolerance of the activation layer.
*
* @param[in] data_type The data type used.
* @param[in] activation The activation function used.
*
- * @return Tolerance depending on the activation function.
+ * @return Relative tolerance depending on the activation function.
*/
-AbsoluteTolerance<float> tolerance(DataType data_type, ActivationLayerInfo::ActivationFunction activation)
+RelativeTolerance<float> relative_tolerance(DataType data_type, ActivationLayerInfo::ActivationFunction activation)
{
switch(activation)
{
@@ -60,10 +60,34 @@
case ActivationLayerInfo::ActivationFunction::TANH:
switch(data_type)
{
- case DataType::QS8:
- return AbsoluteTolerance<float>(5.f);
- case DataType::QS16:
- return AbsoluteTolerance<float>(11.f);
+ case DataType::F16:
+ return RelativeTolerance<float>(0.1f);
+ default:
+ return RelativeTolerance<float>(0.05f);
+ }
+ break;
+ default:
+ return RelativeTolerance<float>(0.f);
+ }
+}
+
+/** Define absolute tolerance of the activation layer.
+ *
+ * @param[in] data_type The data type used.
+ * @param[in] activation The activation function used.
+ *
+ * @return Absolute tolerance depending on the activation function.
+ */
+AbsoluteTolerance<float> absolute_tolerance(DataType data_type, ActivationLayerInfo::ActivationFunction activation)
+{
+ switch(activation)
+ {
+ case ActivationLayerInfo::ActivationFunction::LOGISTIC:
+ case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
+ case ActivationLayerInfo::ActivationFunction::SQRT:
+ case ActivationLayerInfo::ActivationFunction::TANH:
+ switch(data_type)
+ {
case DataType::F16:
return AbsoluteTolerance<float>(0.01f);
default:
@@ -82,8 +106,6 @@
DataType::F16,
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
DataType::F32,
- DataType::QS8,
- DataType::QS16,
});
/** Input data sets. */
@@ -96,12 +118,9 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), CNNDataTypes), framework::dataset::make("InPlace", { false, true })),
shape, data_type, in_place)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, data_type, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, data_type, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, data_type, 1);
+ Tensor dst = create_tensor<Tensor>(shape, data_type, 1);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -143,22 +162,16 @@
framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data types
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
}),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(),
})),
framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
})),
- framework::dataset::make("Expected", { false, true, false, false, true })),
+ framework::dataset::make("Expected", { false, true, false})),
input_info, output_info, act_info, expected)
{
bool is_valid = bool(NEActivationLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), act_info));
@@ -178,14 +191,14 @@
DataType::F16)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
+ validate(Accessor(_target), _reference, relative_tolerance(_data_type, _function), 0.f, absolute_tolerance(_data_type, _function));
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEActivationLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ActivationDataset),
framework::dataset::make("DataType",
DataType::F16)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
+ validate(Accessor(_target), _reference, relative_tolerance(_data_type, _function), 0.f, absolute_tolerance(_data_type, _function));
}
TEST_SUITE_END()
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
@@ -193,61 +206,16 @@
TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, NEActivationLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallShapes(), ActivationDataset), framework::dataset::make("DataType",
DataType::F32)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
-}
-FIXTURE_DATA_TEST_CASE(RunLarge, NEActivationLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ActivationDataset), framework::dataset::make("DataType",
- DataType::F32)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-template <typename T>
-using NEActivationLayerFixedPointFixture = ActivationValidationFixedPointFixture<Tensor, Accessor, NEActivationLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// We test for fixed point precision [3,5] because [1,2] and [6,7] ranges cause
-// overflowing issues in most of the transcendentals functions.
-FIXTURE_DATA_TEST_CASE(RunTiny, NEActivationLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(), ActivationDataset),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 3, 6)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
+ validate(Accessor(_target), _reference, relative_tolerance(_data_type, _function), 0.f, absolute_tolerance(_data_type, _function));
}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEActivationLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), ActivationDataset),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 3, 6)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NEActivationLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeShapes(), ActivationDataset),
+ framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14
-FIXTURE_DATA_TEST_CASE(RunTiny, NEActivationLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(), ActivationDataset),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEActivationLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), ActivationDataset),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
+ validate(Accessor(_target), _reference, relative_tolerance(_data_type, _function), 0.f, absolute_tolerance(_data_type, _function));
}
TEST_SUITE_END()
TEST_SUITE_END()
@@ -271,7 +239,7 @@
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.1f, 128.0f) })))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
+ validate(Accessor(_target), _reference, relative_tolerance(_data_type, _function), 0.f, absolute_tolerance(_data_type, _function));
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEActivationLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), QuantizedActivationDataset),
framework::dataset::make("DataType",
@@ -279,7 +247,7 @@
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.1f, 128.0f) })))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance(_data_type, _function));
+ validate(Accessor(_target), _reference, relative_tolerance(_data_type, _function), 0.f, absolute_tolerance(_data_type, _function));
}
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/NEON/ArithmeticAddition.cpp b/tests/validation/NEON/ArithmeticAddition.cpp
index 98eeaa2..3632c3c 100644
--- a/tests/validation/NEON/ArithmeticAddition.cpp
+++ b/tests/validation/NEON/ArithmeticAddition.cpp
@@ -48,10 +48,6 @@
DataType::U8));
const auto ArithmeticAdditionS16Dataset = combine(combine(framework::dataset::make("DataType", { DataType::U8, DataType::S16 }), framework::dataset::make("DataType", DataType::S16)),
framework::dataset::make("DataType", DataType::S16));
-const auto ArithmeticAdditionQS8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS8), framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("DataType", DataType::QS8));
-const auto ArithmeticAdditionQS16Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS16), framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("DataType", DataType::QS16));
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
const auto ArithmeticAdditionFP16Dataset = combine(combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::F16)),
framework::dataset::make("DataType", DataType::F16));
@@ -74,26 +70,20 @@
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Window shrink
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
}),
framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
- framework::dataset::make("Expected", { true, true, false, false, false, false, true })),
+ framework::dataset::make("Expected", { true, true, false, false, false})),
input1_info, input2_info, output_info, expected)
{
ARM_COMPUTE_EXPECT(bool(NEArithmeticAddition::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), ConvertPolicy::WRAP)) == expected, framework::LogLevel::ERRORS);
@@ -173,47 +163,6 @@
}
TEST_SUITE_END()
-template <typename T>
-using NEArithmeticAdditionFixedPointFixture = ArithmeticAdditionValidationFixedPointFixture<Tensor, Accessor, NEArithmeticAddition, T>;
-
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEArithmeticAdditionFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(), ArithmeticAdditionQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticAdditionFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), ArithmeticAdditionQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEArithmeticAdditionFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(), ArithmeticAdditionQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticAdditionFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(), ArithmeticAdditionQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE(Float)
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
TEST_SUITE(F16)
diff --git a/tests/validation/NEON/ArithmeticSubtraction.cpp b/tests/validation/NEON/ArithmeticSubtraction.cpp
index 01a107c..210ed45 100644
--- a/tests/validation/NEON/ArithmeticSubtraction.cpp
+++ b/tests/validation/NEON/ArithmeticSubtraction.cpp
@@ -55,10 +55,6 @@
framework::dataset::make("DataType", DataType::S16));
const auto ArithmeticSubtractionU8S16S16Dataset = combine(combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16)),
framework::dataset::make("DataType", DataType::S16));
-const auto ArithmeticSubtractionQS8Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS8), framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("DataType", DataType::QS8));
-const auto ArithmeticSubtractionQS16Dataset = combine(combine(framework::dataset::make("DataType", DataType::QS16), framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("DataType", DataType::QS16));
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
const auto ArithmeticSubtractionFP16Dataset = combine(combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::F16)),
framework::dataset::make("DataType", DataType::F16));
@@ -78,26 +74,20 @@
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Window shrink
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
}),
framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
})),
- framework::dataset::make("Expected", { true, true, false, false, false, false, true })),
+ framework::dataset::make("Expected", { true, true, false, false, false})),
input1_info, input2_info, output_info, expected)
{
ARM_COMPUTE_EXPECT(bool(NEArithmeticSubtraction::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), ConvertPolicy::WRAP)) == expected, framework::LogLevel::ERRORS);
@@ -243,51 +233,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-template <typename T1, typename T2 = T1, typename T3 = T1>
-using NEArithmeticSubtractionFixedPointFixture = ArithmeticSubtractionValidationFixedPointFixture<Tensor, Accessor, NEArithmeticSubtraction, T1, T2, T3>;
-
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEArithmeticSubtractionFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- ArithmeticSubtractionQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- ArithmeticSubtractionQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEArithmeticSubtractionFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- ArithmeticSubtractionQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-
-FIXTURE_DATA_TEST_CASE(RunSmall, NEArithmeticSubtractionFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- ArithmeticSubtractionQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE(Float)
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
TEST_SUITE(FP16)
diff --git a/tests/validation/NEON/BatchNormalizationLayer.cpp b/tests/validation/NEON/BatchNormalizationLayer.cpp
index 53fd016..ca13d26 100644
--- a/tests/validation/NEON/BatchNormalizationLayer.cpp
+++ b/tests/validation/NEON/BatchNormalizationLayer.cpp
@@ -48,9 +48,7 @@
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
constexpr AbsoluteTolerance<float> tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-constexpr AbsoluteTolerance<float> tolerance_qs8(3.0f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QS8 */
-constexpr AbsoluteTolerance<float> tolerance_qs16(6.0f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QS16 */
-const auto act_infos = framework::dataset::make("ActivationInfo",
+const auto act_infos = framework::dataset::make("ActivationInfo",
{
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f),
@@ -66,13 +64,10 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(datasets::RandomBatchNormalizationLayerDataset(),
combine(framework::dataset::make("UseBeta", { false, true }), framework::dataset::make("UseGamma", { false, true }))),
- framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F32 })),
+ framework::dataset::make("DataType", { DataType::F32 })),
framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
shape0, shape1, epsilon, use_beta, use_gamma, dt, data_layout)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = (arm_compute::is_data_type_fixed_point(dt)) ? 3 : 0;
-
TensorShape src_dst_shapes = shape0;
if(data_layout == DataLayout::NHWC)
{
@@ -80,12 +75,12 @@
}
// Create tensors
- Tensor src = create_tensor<Tensor>(src_dst_shapes, dt, 1, fixed_point_position, QuantizationInfo(), data_layout);
- Tensor dst = create_tensor<Tensor>(src_dst_shapes, dt, 1, fixed_point_position, QuantizationInfo(), data_layout);
- Tensor mean = create_tensor<Tensor>(shape1, dt, 1, fixed_point_position);
- Tensor var = create_tensor<Tensor>(shape1, dt, 1, fixed_point_position);
- Tensor beta = create_tensor<Tensor>(shape1, dt, 1, fixed_point_position);
- Tensor gamma = create_tensor<Tensor>(shape1, dt, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(src_dst_shapes, dt, 1, QuantizationInfo(), data_layout);
+ Tensor dst = create_tensor<Tensor>(src_dst_shapes, dt, 1, QuantizationInfo(), data_layout);
+ Tensor mean = create_tensor<Tensor>(shape1, dt, 1);
+ Tensor var = create_tensor<Tensor>(shape1, dt, 1);
+ Tensor beta = create_tensor<Tensor>(shape1, dt, 1);
+ Tensor gamma = create_tensor<Tensor>(shape1, dt, 1);
// Create and Configure function
NEBatchNormalizationLayer norm;
@@ -106,46 +101,30 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching data types
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching data types
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Invalid mean/var/beta/gamma shape
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point position
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Fused activation with fixed point not supported
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Fused activation's a < b
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
}),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 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::F16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
- TensorInfo(),
})),
framework::dataset::make("MVBGInfo",{ TensorInfo(TensorShape(2U), 1, DataType::F32),
TensorInfo(TensorShape(2U), 1, DataType::F32),
TensorInfo(TensorShape(2U), 1, DataType::F16),
TensorInfo(TensorShape(2U), 1, DataType::F32),
TensorInfo(TensorShape(5U), 1, DataType::F32),
- TensorInfo(TensorShape(2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(2U), 1, DataType::QS8, 2),
TensorInfo(TensorShape(2U), 1, DataType::F32),
- TensorInfo(TensorShape(2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(2U), 1, DataType::QS8, 2),
})),
framework::dataset::make("ActivationLayerInfo",{ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f, 2.f),
- ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f, 2.f),
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 2.f, 6.f),
- ActivationLayerInfo(),
- ActivationLayerInfo(),
})),
- framework::dataset::make("Expected", { true, false, false, false, false, false, false, false, true, true})),
+ framework::dataset::make("Expected", { true, false, false, false, false, false})),
input_info, output_info, mvbg_info, act_info, expected)
{
const auto &mean_info = mvbg_info;
@@ -191,42 +170,6 @@
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
TEST_SUITE_END()
-TEST_SUITE(Quantized)
-template <typename T>
-using NEBatchNormalizationLayerFixedPointFixture = BatchNormalizationLayerValidationFixedPointFixture<Tensor, Accessor, NEBatchNormalizationLayer, T>;
-
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(Random, NEBatchNormalizationLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(combine(combine(datasets::RandomBatchNormalizationLayerDataset(),
- framework::dataset::make("UseBeta", false)),
- framework::dataset::make("UseGamma", false)),
- framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
- framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs8, 0);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(Random, NEBatchNormalizationLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(combine(combine(datasets::RandomBatchNormalizationLayerDataset(),
- framework::dataset::make("UseBeta", false)),
- framework::dataset::make("UseGamma", false)),
- framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
- framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs16, 0);
-}
-TEST_SUITE_END()
-
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/NEON/CannyEdge.cpp b/tests/validation/NEON/CannyEdge.cpp
new file mode 100644
index 0000000..5697b62
--- /dev/null
+++ b/tests/validation/NEON/CannyEdge.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NECannyEdge.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/NEON/ArrayAccessor.h"
+#include "tests/PaddingCalculator.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ImageFileDatasets.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/CannyEdgeFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+/* Allowed ratio of mismatches between target and reference (1.0 = 100%) */
+const float allowed_mismatch_ratio = 0.1f;
+
+const auto use_fp16 = framework::dataset::make("UseFP16",
+{
+#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
+ true,
+#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
+ false
+});
+
+const auto data = combine(framework::dataset::make("GradientSize", { 3, 5, 7 }),
+ combine(framework::dataset::make("Normalization", { MagnitudeType::L1NORM, MagnitudeType::L2NORM }), combine(datasets::BorderModes(), use_fp16)));
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(CannyEdge)
+
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), data), framework::dataset::make("Format", Format::U8)),
+ shape, gradient_size, normalization, border_mode, use_fp16, format)
+{
+ CannyEdgeParameters params = canny_edge_parameters();
+ // Convert normalisation type to integer
+ const auto norm_type = static_cast<int>(normalization) + 1;
+
+ // Create tensors
+ Tensor src = create_tensor<Tensor>(shape, data_type_from_format(format));
+ Tensor dst = create_tensor<Tensor>(shape, data_type_from_format(format));
+ src.info()->set_format(format);
+ dst.info()->set_format(format);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create Canny edge configure function
+ NECannyEdge canny_edge;
+ canny_edge.configure(&src, &dst, params.upper_thresh, params.lower_thresh, gradient_size, norm_type, border_mode, params.constant_border_value, use_fp16);
+
+ // Validate valid region
+ validate(src.info()->valid_region(), shape_to_valid_region(shape, (BorderMode::UNDEFINED == border_mode)));
+ validate(dst.info()->valid_region(), shape_to_valid_region(shape, (BorderMode::UNDEFINED == border_mode)));
+
+ // Validate padding
+ PaddingCalculator calculator(shape.x(), 8);
+ calculator.set_border_mode(border_mode);
+ calculator.set_border_size(gradient_size / 2);
+ calculator.set_access_offset(-gradient_size / 2);
+ calculator.set_accessed_elements(16);
+
+ validate(src.info()->padding(), calculator.required_padding());
+ validate(dst.info()->padding(), PaddingSize{ 1 });
+}
+
+template <typename T>
+using NECannyEdgeFixture = CannyEdgeValidationFixture<Tensor, Accessor, KeyPointArray, NECannyEdge, T>;
+
+FIXTURE_DATA_TEST_CASE(RunSmall, NECannyEdgeFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallImageFiles(), data), framework::dataset::make("Format", Format::U8)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, AbsoluteTolerance<uint8_t>(0), allowed_mismatch_ratio);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NECannyEdgeFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeImageFiles(), data), framework::dataset::make("Format", Format::U8)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, AbsoluteTolerance<uint8_t>(0), allowed_mismatch_ratio);
+}
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/NEON/Col2Im.cpp b/tests/validation/NEON/Col2Im.cpp
index 9f2415d..e4a52f2 100644
--- a/tests/validation/NEON/Col2Im.cpp
+++ b/tests/validation/NEON/Col2Im.cpp
@@ -43,19 +43,17 @@
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
framework::dataset::make("InputInfo", { TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::S64), // Unsupported data type
TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32), // Mismatching data type
- TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32), // Invalid output shape
TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32),
}),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
- TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::QS8, 3),
TensorInfo(TensorShape(3U, 3U, 10U, 2U), 1, DataType::F32),
TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F32),
})),
framework::dataset::make("ConvolvedWidth", { 3, 3, 3, 3, 3 })),
framework::dataset::make("ConvolvedHeight", { 4, 4, 4, 4, 4 })),
- framework::dataset::make("Expected", { false, false, false, false, true })),
+ framework::dataset::make("Expected", { false, false, false, true })),
input_info, output_info, convolved_width, convolved_height, expected)
{
bool status = bool(NECol2Im::validate(&input_info, &output_info, Size2D(convolved_width, convolved_height)));
diff --git a/tests/validation/NEON/ColorConvert.cpp b/tests/validation/NEON/ColorConvert.cpp
new file mode 100644
index 0000000..c34df2b
--- /dev/null
+++ b/tests/validation/NEON/ColorConvert.cpp
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/runtime/MultiImage.h"
+#include "arm_compute/runtime/NEON/functions/NEColorConvert.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/ColorConvertFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+constexpr AbsoluteTolerance<uint8_t> tolerance_nv(2);
+
+// Input data sets
+const auto RGBDataset = framework::dataset::make("FormatType", { Format::RGB888, Format::RGBA8888 });
+const auto YUYVDataset = framework::dataset::make("FormatType", { Format::YUYV422, Format::UYVY422 });
+
+const auto ColorConvert_RGBA_to_RGB = combine(framework::dataset::make("FormatType", { Format::RGBA8888 }),
+ framework::dataset::make("FormatType", { Format::RGB888 }));
+
+const auto ColorConvert_RGB_to_RGBA = combine(framework::dataset::make("FormatType", { Format::RGB888 }),
+ framework::dataset::make("FormatType", { Format::RGBA8888 }));
+
+const auto ColorConvert_YUYVDataset_to_RGBDataset = combine(YUYVDataset,
+ RGBDataset);
+
+const auto ColorConvert_YUVPlanar_to_RGBDataset = combine(framework::dataset::make("FormatType", { Format::IYUV, Format::NV12, Format::NV21 }),
+ RGBDataset);
+
+const auto ColorConvert_RGBDataset_to_NVDataset = combine(RGBDataset,
+ framework::dataset::make("FormatType", { Format::NV12, Format::IYUV, Format::YUV444 }));
+
+const auto ColorConvert_YUYVDataset_to_NVDataset = combine(YUYVDataset,
+ framework::dataset::make("FormatType", { Format::NV12, Format::IYUV }));
+
+const auto ColorConvert_NVDataset_to_YUVDataset = combine(framework::dataset::make("FormatType", { Format::NV12, Format::NV21 }),
+ framework::dataset::make("FormatType", { Format::IYUV, Format::YUV444 }));
+
+inline void validate_configuration(const TensorShape &shape, Format src_format, Format dst_format)
+{
+ const unsigned int src_num_planes = num_planes_from_format(src_format);
+ const unsigned int dst_num_planes = num_planes_from_format(dst_format);
+
+ TensorShape input = adjust_odd_shape(shape, src_format);
+ input = adjust_odd_shape(input, dst_format);
+
+ // Create tensors
+ MultiImage ref_src = create_multi_image<MultiImage>(input, src_format);
+ MultiImage ref_dst = create_multi_image<MultiImage>(input, dst_format);
+
+ // Create and Configure function
+ NEColorConvert color_convert;
+
+ if(1U == src_num_planes)
+ {
+ const Tensor *src_plane = ref_src.plane(0);
+
+ if(1U == dst_num_planes)
+ {
+ Tensor *dst_plane = ref_dst.plane(0);
+ color_convert.configure(src_plane, dst_plane);
+ }
+ else
+ {
+ color_convert.configure(src_plane, &ref_dst);
+ }
+ }
+ else
+ {
+ if(1U == dst_num_planes)
+ {
+ Tensor *dst_plane = ref_dst.plane(0);
+ color_convert.configure(&ref_src, dst_plane);
+ }
+ else
+ {
+ color_convert.configure(&ref_src, &ref_dst);
+ }
+ }
+
+ for(unsigned int plane_idx = 0; plane_idx < src_num_planes; ++plane_idx)
+ {
+ const Tensor *src_plane = ref_src.plane(plane_idx);
+
+ ARM_COMPUTE_EXPECT(src_plane->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+ for(unsigned int plane_idx = 0; plane_idx < dst_num_planes; ++plane_idx)
+ {
+ const Tensor *dst_plane = ref_dst.plane(plane_idx);
+
+ ARM_COMPUTE_EXPECT(dst_plane->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+}
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(ColorConvert)
+
+template <typename T>
+using NEColorConvertFixture = ColorConvertValidationFixture<MultiImage, Tensor, Accessor, NEColorConvert, T>;
+
+TEST_SUITE(Configuration)
+DATA_TEST_CASE(RGBA, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_RGBA_to_RGB),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(RGB, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_RGB_to_RGBA),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(YUV, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_YUYVDataset_to_RGBDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(YUVPlanar, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_YUVPlanar_to_RGBDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(NV, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_RGBDataset_to_NVDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(YUYVtoNV, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_YUYVDataset_to_NVDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+
+DATA_TEST_CASE(NVtoYUV, framework::DatasetMode::ALL, combine(concat(datasets::Small2DShapes(), datasets::Large2DShapes()), ColorConvert_NVDataset_to_YUVDataset),
+ shape, src_format, dst_format)
+{
+ validate_configuration(shape, src_format, dst_format);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(RGBA)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBA_to_RGB))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBA_to_RGB))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(RGB)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGB_to_RGBA))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGB_to_RGBA))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(YUV)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_RGBDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_RGBDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(YUVPlanar)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUVPlanar_to_RGBDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(NV)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_RGBDataset_to_NVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx], tolerance_nv);
+ }
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_RGBDataset_to_NVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx], tolerance_nv);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(YUYVtoNV)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_YUYVDataset_to_NVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_YUYVDataset_to_NVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE(NVtoYUV)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEColorConvertFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), ColorConvert_NVDataset_to_YUVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEColorConvertFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::Large2DShapes(), ColorConvert_NVDataset_to_YUVDataset))
+{
+ // Validate output
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ validate(Accessor(*_target.plane(plane_idx)), _reference[plane_idx]);
+ }
+}
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/NEON/ConvolutionLayer.cpp b/tests/validation/NEON/ConvolutionLayer.cpp
index 776d1ae..3c39e2e 100644
--- a/tests/validation/NEON/ConvolutionLayer.cpp
+++ b/tests/validation/NEON/ConvolutionLayer.cpp
@@ -47,12 +47,14 @@
{
namespace
{
-const AbsoluteTolerance<float> tolerance_f32(0.002f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
+RelativeTolerance<float> rel_tolerance_f32(0.01f); /**< Relative tolerance for FP32 types */
+const AbsoluteTolerance<float> abs_tolerance_f32(0.002f); /**< Absolute tolerance for FP32 types */
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-const AbsoluteTolerance<float> tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
-#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-const AbsoluteTolerance<float> tolerance_q(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */
-constexpr AbsoluteTolerance<float> tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
+const RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.2f)); /**< Relative tolerance value for FP16 types */
+const AbsoluteTolerance<float> abs_tolerance_f16(0.2f); /**< Absolute tolerance for FP16 types */
+constexpr float tolerance_num = 0.07f; /**< Tolerance number for the FP16 implementation */
+#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
+constexpr AbsoluteTolerance<float> tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
/** CNN data types */
const auto CNNDataTypes = framework::dataset::make("DataType",
@@ -61,8 +63,6 @@
DataType::F16,
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
DataType::F32,
- DataType::QS8,
- DataType::QS16,
DataType::QASYMM8,
});
const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
@@ -77,20 +77,20 @@
TEST_SUITE(ConvolutionLayer)
DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(18U, 18U, 32U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(23U, 27U, 32U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32, 0)
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(18U, 18U, 32U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 32U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32),
+ TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32)
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 32U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 32U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16, 0)
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 32U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 32U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16)
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(16U, 16U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(19U, 23U, 21U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32, 0)
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(16U, 16U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(19U, 23U, 21U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32)
})),
framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
PadStrideInfo(1, 1, 0, 0),
@@ -120,24 +120,29 @@
using NEWinogradConvolutionLayerNoBiasFixture = WinogradConvolutionLayerFastMathValidationFixture<Tensor, Accessor, NEWinogradConvolutionLayer, T, false>;
TEST_SUITE(FP32)
+
FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
- combine(combine(framework::dataset::concat(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
- datasets::SmallWinogradConvolutionLayer5x5Dataset()),
- framework::dataset::make("DataType", { DataType::F32 })),
- ActivationFunctionsDataset))
+ combine(combine(combine(framework::dataset::concat(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
+ datasets::SmallWinogradConvolutionLayer5x5Dataset()),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ ActivationFunctionsDataset),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
+
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f32);
+ validate(Accessor(_target), _reference, abs_tolerance_f32);
}
FIXTURE_DATA_TEST_CASE(RunSmallNoBias, NEWinogradConvolutionLayerNoBiasFixture<float>, framework::DatasetMode::PRECOMMIT,
- combine(combine(framework::dataset::concat(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
- datasets::SmallWinogradConvolutionLayer5x5Dataset()),
- framework::dataset::make("DataType", { DataType::F32 })),
- ActivationFunctionsDataset))
+ combine(combine(combine(framework::dataset::concat(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
+ datasets::SmallWinogradConvolutionLayer5x5Dataset()),
+ framework::dataset::make("DataType", { DataType::F32 })),
+ ActivationFunctionsDataset),
+
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f32);
+ validate(Accessor(_target), _reference, abs_tolerance_f32);
}
TEST_SUITE_END()
@@ -151,16 +156,13 @@
{ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) })),
input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, act_info)
{
- // Set fixed point position data type allowed
- int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
auto bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
// Create tensors
- Tensor src = create_tensor<Tensor>(input_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- Tensor weights = create_tensor<Tensor>(weights_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- Tensor bias = create_tensor<Tensor>(bias_shape, bias_data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- Tensor dst = create_tensor<Tensor>(output_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
+ Tensor src = create_tensor<Tensor>(input_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ Tensor weights = create_tensor<Tensor>(weights_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ Tensor bias = create_tensor<Tensor>(bias_shape, bias_data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ Tensor dst = create_tensor<Tensor>(output_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -188,10 +190,12 @@
// Validate QuantizationInfo
ARM_COMPUTE_EXPECT(src.info()->quantization_info() == src_quantization_info, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->quantization_info() == weights_quantization_info, framework::LogLevel::ERRORS);
+
+ // Validate padding
}
template <typename T>
-using NEGEMMConvolutionLayerFixture = ConvolutionValidationFixture<Tensor, Accessor, NEConvolutionLayer, T>;
+using NEGEMMConvolutionLayerFixture = ConvolutionValidationFixture<Tensor, Accessor, NEGEMMConvolutionLayer, T>;
TEST_SUITE(Float)
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
@@ -203,7 +207,7 @@
ActivationFunctionsDataset))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16);
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
@@ -212,7 +216,7 @@
ActivationFunctionsDataset))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16);
}
TEST_SUITE_END()
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
@@ -225,7 +229,7 @@
ActivationFunctionsDataset))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f32);
+ validate(Accessor(_target), _reference, rel_tolerance_f32, 0.f, float(abs_tolerance_f32));
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
@@ -234,56 +238,7 @@
ActivationFunctionsDataset))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f32);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
-using NEGEMMConvolutionLayerFixedPointFixture = ConvolutionValidationFixedPointFixture<Tensor, Accessor, NEGEMMConvolutionLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// We test for fixed point precision [4,6]
-FIXTURE_DATA_TEST_CASE(RunTiny, NEGEMMConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::TinyConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEGEMMConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::TinyConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)),
- ActivationFunctionsDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
+ validate(Accessor(_target), _reference, rel_tolerance_f32, 0.f, float(abs_tolerance_f32));
}
TEST_SUITE_END()
TEST_SUITE_END()
@@ -299,18 +254,20 @@
});
TEST_SUITE(Quantized)
TEST_SUITE(QASYMM8)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
+FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
QuantizedActivationFunctionsDataset))
{
// Validate output
validate(Accessor(_target), _reference, tolerance_qasymm8);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(),
+FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
QuantizedActivationFunctionsDataset))
{
diff --git a/tests/validation/NEON/Copy.cpp b/tests/validation/NEON/Copy.cpp
new file mode 100644
index 0000000..36a1f62
--- /dev/null
+++ b/tests/validation/NEON/Copy.cpp
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NECopy.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/PaddingCalculator.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/CopyFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+TEST_SUITE(NEON)
+TEST_SUITE(Copy)
+
+template <typename T>
+using NECopyFixture = CopyFixture<Tensor, Accessor, NECopy, T>;
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Mismatching shapes
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
+ }),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
+ TensorInfo(TensorShape(32U, 11U, 2U), 1, DataType::U8),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
+ })),
+ framework::dataset::make("Expected", { false, false, true})),
+ input_info, output_info, expected)
+{
+ ARM_COMPUTE_EXPECT(bool(NECopy::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false))) == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE(F32)
+FIXTURE_DATA_TEST_CASE(RunSmall, NECopyFixture<float>, framework::DatasetMode::PRECOMMIT, combine(zip(datasets::SmallShapes(), datasets::SmallShapes()), framework::dataset::make("DataType",
+ DataType::F32)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NECopyFixture<float>, framework::DatasetMode::NIGHTLY, combine(zip(datasets::LargeShapes(), datasets::LargeShapes()), framework::dataset::make("DataType",
+ DataType::F32)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+TEST_SUITE_END() // F32
+
+TEST_SUITE(U8)
+FIXTURE_DATA_TEST_CASE(RunSmall, NECopyFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(zip(datasets::SmallShapes(), datasets::SmallShapes()), framework::dataset::make("DataType",
+ DataType::U8)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NECopyFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(zip(datasets::LargeShapes(), datasets::LargeShapes()), framework::dataset::make("DataType",
+ DataType::U8)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+TEST_SUITE_END() // U8
+
+TEST_SUITE(U16)
+FIXTURE_DATA_TEST_CASE(RunSmall, NECopyFixture<uint16_t>, framework::DatasetMode::PRECOMMIT, combine(zip(datasets::SmallShapes(), datasets::SmallShapes()), framework::dataset::make("DataType",
+ DataType::U16)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NECopyFixture<uint16_t>, framework::DatasetMode::NIGHTLY, combine(zip(datasets::LargeShapes(), datasets::LargeShapes()), framework::dataset::make("DataType",
+ DataType::U16)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+TEST_SUITE_END() // U16
+
+TEST_SUITE_END() // Copy
+TEST_SUITE_END() // NEON
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/NEON/DeconvolutionLayer.cpp b/tests/validation/NEON/DeconvolutionLayer.cpp
index 3bb6d6f..277953b 100644
--- a/tests/validation/NEON/DeconvolutionLayer.cpp
+++ b/tests/validation/NEON/DeconvolutionLayer.cpp
@@ -100,33 +100,33 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid weights shape
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 4), // Non supported data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 11), // Invalid bias shape
- TensorInfo(TensorShape(13U, 11U, 4U, 3U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights shape
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), // Non supported data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid bias shape
+ TensorInfo(TensorShape(13U, 11U, 4U, 3U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32),
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QS8, 5),
- TensorInfo(TensorShape(3U, 2U, 2U, 2U), 1, DataType::F32, 11),
- TensorInfo(TensorShape(3U, 3U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32, 0),
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 2U, 2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32),
})),
- framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(1U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(1U), 1, DataType::F32, 5),
- TensorInfo(TensorShape(25U, 11U), 1, DataType::F32, 11),
- TensorInfo(TensorShape(1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
+ framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(1U), 1, DataType::F16),
+ TensorInfo(TensorShape(1U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
})),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(25U, 10U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 5),
- TensorInfo(TensorShape(13U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 9U, 1U, 3U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(25U, 10U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(13U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 9U, 1U, 3U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32),
})),
framework::dataset::make("PadStrideInfo", { PadStrideInfo(1, 1, 0, 0),
PadStrideInfo(1, 1, 0, 0),
diff --git a/tests/validation/NEON/DepthConcatenateLayer.cpp b/tests/validation/NEON/DepthConcatenateLayer.cpp
index c3bb8a9..24e7649 100644
--- a/tests/validation/NEON/DepthConcatenateLayer.cpp
+++ b/tests/validation/NEON/DepthConcatenateLayer.cpp
@@ -42,6 +42,44 @@
TEST_SUITE(NEON)
TEST_SUITE(DepthConcatenateLayer)
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
+ framework::dataset::make("InputInfo1", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/output
+ TensorInfo(TensorShape(24U, 27U, 4U), 1, DataType::F32), // Mismatching x dimension
+ TensorInfo(TensorShape(23U, 27U, 3U), 1, DataType::F32), // Mismatching total depth
+ TensorInfo(TensorShape(16U, 27U, 6U), 1, DataType::F32)
+ }),
+ framework::dataset::make("InputInfo2", { TensorInfo(TensorShape(23U, 27U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 27U, 6U), 1, DataType::F32)
+ })),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(23U, 27U, 9U), 1, DataType::F16),
+ TensorInfo(TensorShape(25U, 12U, 9U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 8U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 27U, 12U), 1, DataType::F32)
+ })),
+ framework::dataset::make("Expected", { false, false, false, true })),
+ input_info1, input_info2, output_info,expected)
+{
+ std::vector<TensorInfo> inputs_vector_info;
+ inputs_vector_info.emplace_back(std::move(input_info1));
+ inputs_vector_info.emplace_back(std::move(input_info2));
+
+ std::vector<ITensorInfo *> inputs_vector_info_raw;
+ for(auto &input : inputs_vector_info)
+ {
+ inputs_vector_info_raw.emplace_back(&input);
+ }
+
+ bool is_valid = bool(NEDepthConcatenateLayer::validate(inputs_vector_info_raw,
+ &output_info.clone()->set_is_resizable(false)));
+ ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
TEST_CASE(Configuration, framework::DatasetMode::ALL)
{
// Create tensors
@@ -101,34 +139,15 @@
TEST_SUITE_END()
TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEDepthConcatenateLayerFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Tiny2DShapes(),
- framework::dataset::make("DataType",
- DataType::QS8)))
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConcatenateLayerFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType",
+ DataType::QASYMM8)))
{
// Validate output
validate(Accessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConcatenateLayerFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(),
- framework::dataset::make("DataType",
- DataType::QS8)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEDepthConcatenateLayerFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Tiny2DShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConcatenateLayerFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConcatenateLayerFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(), framework::dataset::make("DataType",
+ DataType::QASYMM8)))
{
// Validate output
validate(Accessor(_target), _reference);
diff --git a/tests/validation/NEON/DepthConvertLayer.cpp b/tests/validation/NEON/DepthConvertLayer.cpp
index ea63a5f..78070d0 100644
--- a/tests/validation/NEON/DepthConvertLayer.cpp
+++ b/tests/validation/NEON/DepthConvertLayer.cpp
@@ -44,19 +44,14 @@
namespace
{
/** Input data sets **/
-const auto DepthConvertLayerU8toU16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U16));
-const auto DepthConvertLayerU8toS16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16));
-const auto DepthConvertLayerU8toS32Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S32));
-const auto DepthConvertLayerU16toU8Dataset = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U8));
-const auto DepthConvertLayerU16toU32Dataset = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U32));
-const auto DepthConvertLayerS16toU8Dataset = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::U8));
-const auto DepthConvertLayerS16toS32Dataset = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::S32));
-const auto DepthConvertLayerQS8toFP32Dataset = combine(framework::dataset::make("DataType", DataType::QS8), framework::dataset::make("DataType", DataType::F32));
-const auto DepthConvertLayerQS16toFP32Dataset = combine(framework::dataset::make("DataType", DataType::QS16), framework::dataset::make("DataType", DataType::F32));
-const auto DepthConvertLayerFP32toQS8Dataset = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::QS8));
-const auto DepthConvertLayerFP32toQS16Dataset = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::QS16));
-const auto DepthConvertLayerShiftDataset = framework::dataset::make("Shift", 0, 7);
-const auto DepthConvertLayerFixedPointQuantizedDataset = framework::dataset::make("FractionalBits", 1, 7);
+const auto DepthConvertLayerU8toU16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U16));
+const auto DepthConvertLayerU8toS16Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16));
+const auto DepthConvertLayerU8toS32Dataset = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S32));
+const auto DepthConvertLayerU16toU8Dataset = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U8));
+const auto DepthConvertLayerU16toU32Dataset = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U32));
+const auto DepthConvertLayerS16toU8Dataset = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::U8));
+const auto DepthConvertLayerS16toS32Dataset = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::S32));
+const auto DepthConvertLayerShiftDataset = framework::dataset::make("Shift", 0, 7);
} // namespace
TEST_SUITE(NEON)
@@ -71,23 +66,15 @@
using NEDepthConvertLayerToU8Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, uint8_t>;
template <typename T>
using NEDepthConvertLayerToU32Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, uint32_t>;
-template <typename T>
-using NEDepthConvertLayerToFP32FixedPointFixture = DepthConvertLayerValidationFractionalBitsFixture<Tensor, Accessor, NEDepthConvertLayer, T, float>;
-template <typename T>
-using NEDepthConvertLayerToQS8FixedPointFixture = DepthConvertLayerValidationFractionalBitsFixture<Tensor, Accessor, NEDepthConvertLayer, T, int8_t>;
-template <typename T>
-using NEDepthConvertLayerToQS16FixedPointFixture = DepthConvertLayerValidationFractionalBitsFixture<Tensor, Accessor, NEDepthConvertLayer, T, int16_t>;
TEST_SUITE(U8_to_U16)
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, DataType::U8, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, DataType::U16, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, DataType::U8, 1);
+ Tensor dst = create_tensor<Tensor>(shape, DataType::U16, 1);
// Create and Configure function
NEDepthConvertLayer depth_convert;
@@ -125,11 +112,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, DataType::U8, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, DataType::S16, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, DataType::U8, 1);
+ Tensor dst = create_tensor<Tensor>(shape, DataType::S16, 1);
// Create and Configure function
NEDepthConvertLayer depth_convert;
@@ -166,11 +151,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, DataType::U8, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, DataType::S32, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, DataType::U8, 1);
+ Tensor dst = create_tensor<Tensor>(shape, DataType::S32, 1);
// Create and Configure function
NEDepthConvertLayer depth_convert;
@@ -208,11 +191,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, DataType::U16, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, DataType::U8, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, DataType::U16, 1);
+ Tensor dst = create_tensor<Tensor>(shape, DataType::U8, 1);
// Create and Configure function
NEDepthConvertLayer depth_convert;
@@ -249,11 +230,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, DataType::U16, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, DataType::U32, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, DataType::U16, 1);
+ Tensor dst = create_tensor<Tensor>(shape, DataType::U32, 1);
// Create and Configure function
NEDepthConvertLayer depth_convert;
@@ -290,11 +269,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, DataType::S16, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, DataType::U8, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, DataType::S16, 1);
+ Tensor dst = create_tensor<Tensor>(shape, DataType::U8, 1);
// Create and Configure function
NEDepthConvertLayer depth_convert;
@@ -331,11 +308,9 @@
DepthConvertLayerShiftDataset),
shape, policy, shift)
{
- int fixed_point_position = 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, DataType::S16, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, DataType::S32, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, DataType::S16, 1);
+ Tensor dst = create_tensor<Tensor>(shape, DataType::S32, 1);
// Create and Configure function
NEDepthConvertLayer depth_convert;
@@ -367,124 +342,6 @@
}
TEST_SUITE_END()
-TEST_SUITE(Quantized_to_FP32)
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::QS8, DataType::QS16 })),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset),
- shape, dt, policy, fixed_point_position)
-{
- int shift = 0;
-
- // Create tensors
- Tensor src = create_tensor<Tensor>(shape, dt, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, DataType::F32, 1, fixed_point_position);
-
- // Create and Configure function
- NEDepthConvertLayer depth_convert;
- depth_convert.configure(&src, &dst, policy, shift);
-
- // Validate valid region
- const ValidRegion valid_region = shape_to_valid_region(shape);
- validate(dst.info()->valid_region(), valid_region);
-
- // Validate padding
- const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding();
- validate(src.info()->padding(), padding);
- validate(dst.info()->padding(), padding);
-}
-FIXTURE_DATA_TEST_CASE(RunTinyQS8, NEDepthConvertLayerToFP32FixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- DepthConvertLayerQS8toFP32Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunTinyQS16, NEDepthConvertLayerToFP32FixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- DepthConvertLayerQS16toFP32Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmallQS8, NEDepthConvertLayerToFP32FixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- DepthConvertLayerQS8toFP32Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmallQS16, NEDepthConvertLayerToFP32FixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- DepthConvertLayerQS16toFP32Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(FP32_to_Quantized)
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(framework::dataset::concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", { DataType::QS8, DataType::QS16 })),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset),
- shape, dt, policy, fixed_point_position)
-{
- int shift = 0;
-
- // Create tensors
- Tensor src = create_tensor<Tensor>(shape, DataType::F32, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, dt, 1, fixed_point_position);
-
- // Create and Configure function
- NEDepthConvertLayer depth_convert;
- depth_convert.configure(&src, &dst, policy, shift);
-
- // Validate valid region
- const ValidRegion valid_region = shape_to_valid_region(shape);
- validate(dst.info()->valid_region(), valid_region);
-
- // Validate padding
- const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding();
- validate(src.info()->padding(), padding);
- validate(dst.info()->padding(), padding);
-}
-FIXTURE_DATA_TEST_CASE(RunTinyQS8, NEDepthConvertLayerToQS8FixedPointFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- DepthConvertLayerFP32toQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunTinyQS16, NEDepthConvertLayerToQS16FixedPointFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyShapes(),
- DepthConvertLayerFP32toQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmallQS8, NEDepthConvertLayerToQS8FixedPointFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- DepthConvertLayerFP32toQS8Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmallQS16, NEDepthConvertLayerToQS16FixedPointFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallShapes(),
- DepthConvertLayerFP32toQS16Dataset),
- framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
- DepthConvertLayerFixedPointQuantizedDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/NEON/DepthwiseConvolutionLayer.cpp b/tests/validation/NEON/DepthwiseConvolutionLayer.cpp
index b1cc491..fe7bba3 100644
--- a/tests/validation/NEON/DepthwiseConvolutionLayer.cpp
+++ b/tests/validation/NEON/DepthwiseConvolutionLayer.cpp
@@ -54,57 +54,140 @@
TEST_SUITE(NEON)
TEST_SUITE(DepthwiseConvLayer)
-DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
- datasets::LargeDepthwiseConvolutionLayerDataset3x3()),
- depth_multipliers),
- framework::dataset::make("DataType", DataType::F32)),
- input_shape, kernel_size, info, depth_multiplier, data_type)
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
+ TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Invalid stride
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ }),
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
+ })),
+ framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::S32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ })),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ })),
+ framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(4, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ })),
+ framework::dataset::make("DepthMultiplier", { 1,
+ 1,
+ 1,
+ 3,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ })),
+ framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, true })),
+ input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, expected)
{
- // Get shapes
- TensorShape weights_shape(kernel_size.width, kernel_size.height);
-
- const TensorInfo in_info(input_shape, 1, data_type);
- const TensorInfo we_info(weights_shape, 1, data_type);
- const TensorShape output_shape = compute_depthwise_convolution_shape(in_info, we_info, info, depth_multiplier);
-
- weights_shape.set(2, output_shape.z());
-
- // Create tensors
- Tensor src = create_tensor<Tensor>(input_shape, data_type);
- Tensor dst = create_tensor<Tensor>(output_shape, data_type);
- Tensor weights = create_tensor<Tensor>(weights_shape, data_type);
- const TensorShape bias_shape(weights_shape[2]);
- Tensor bias = create_tensor<Tensor>(bias_shape, data_type);
-
- ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
-
- // Create and configure function
- NEDepthwiseConvolutionLayer3x3 depthwise_layer;
- depthwise_layer.configure(&src, &weights, &bias, &dst, info, depth_multiplier);
-
- // Validate valid region
- const ValidRegion input_valid_region = shape_to_valid_region(input_shape);
- const ValidRegion output_valid_region = shape_to_valid_region(output_shape);
- const ValidRegion weights_valid_region = shape_to_valid_region(weights_shape);
- const ValidRegion bias_valid_region = shape_to_valid_region(bias_shape);
-
- validate(src.info()->valid_region(), input_valid_region);
- validate(dst.info()->valid_region(), output_valid_region);
- validate(weights.info()->valid_region(), weights_valid_region);
- validate(bias.info()->valid_region(), bias_valid_region);
-
- // Validate padding
- bool is_optimized_run = NEDepthwiseConvolutionLayer3x3Kernel::is_optimized_execution_possible(input_shape, info, data_type, depth_multiplier, DataLayout::NCHW);
- const int step_non_opt_dwc = 16 >> info.stride().first;
- const int step_bias_add = 16 / src.info()->element_size();
- const int step = is_optimized_run ? step_bias_add : std::max(step_non_opt_dwc, step_bias_add);
- const PaddingSize padding = PaddingCalculator(output_shape.x(), step).required_padding();
- validate(dst.info()->padding(), padding);
+ bool is_valid = bool(NEDepthwiseConvolutionLayer3x3::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, depth_multiplier));
+ ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
}
+DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
+ TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
+ TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8),
+ }),
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
+ })),
+ framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U), 1, DataType::F32),
+ TensorInfo(TensorShape(24U), 1, DataType::S32),
+ })),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8),
+ })),
+ framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 0, 0),
+ PadStrideInfo(1, 1, 1, 0),
+ })),
+ framework::dataset::make("DepthMultiplier", { 1,
+ 1,
+ 3,
+ 1,
+ 1,
+ 1,
+ 2,
+ 3,
+ })),
+ framework::dataset::make("Expected", { false, false, false, false, false, false, true, true })),
+ input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, expected)
+{
+ bool is_valid = bool(NEDepthwiseConvolutionLayer::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, depth_multiplier));
+ ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
TEST_SUITE(Float)
TEST_SUITE(F32)
TEST_SUITE(Generic)
@@ -114,7 +197,7 @@
depth_multipliers),
framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(Accessor(_target), _reference, tolerance_f32);
}
@@ -122,7 +205,7 @@
depth_multipliers),
framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(Accessor(_target), _reference, tolerance_f32);
}
@@ -135,7 +218,7 @@
depth_multipliers),
framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(Accessor(_target), _reference, tolerance_f32);
}
@@ -143,7 +226,7 @@
depth_multipliers),
framework::dataset::make("DataType",
DataType::F32)),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(Accessor(_target), _reference, tolerance_f32);
}
@@ -173,7 +256,7 @@
depth_multipliers),
framework::dataset::make("DataType", DataType::QASYMM8)),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(Accessor(_target), _reference, tolerance_qasymm8);
}
@@ -183,7 +266,7 @@
combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers),
framework::dataset::make("DataType", DataType::QASYMM8)),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(Accessor(_target), _reference, tolerance_qasymm8);
}
@@ -192,7 +275,7 @@
depth_multipliers),
framework::dataset::make("DataType", DataType::QASYMM8)),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
- framework::dataset::make("DataLayout", DataLayout::NCHW)))
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
validate(Accessor(_target), _reference, tolerance_qasymm8);
}
diff --git a/tests/validation/NEON/DilatedConvolutionLayer.cpp b/tests/validation/NEON/DilatedConvolutionLayer.cpp
index c65e993..e884830 100644
--- a/tests/validation/NEON/DilatedConvolutionLayer.cpp
+++ b/tests/validation/NEON/DilatedConvolutionLayer.cpp
@@ -45,10 +45,11 @@
{
const AbsoluteTolerance<float> tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-const AbsoluteTolerance<float> tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
-#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-const AbsoluteTolerance<float> tolerance_q(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */
-constexpr AbsoluteTolerance<float> tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
+const AbsoluteTolerance<float> abs_tolerance_f16(0.3f); /**< Absolute tolerance value for comparing reference's output against implementation's output for DataType::F16 */
+const RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.2f)); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType::F16 */
+constexpr float tolerance_num_f16 = 0.07f; /**< Tolerance number for FP16 */
+#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
+constexpr AbsoluteTolerance<float> tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
/** CNN data types */
const auto CNNDataTypes = framework::dataset::make("DataType",
@@ -57,8 +58,6 @@
DataType::F16,
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
DataType::F32,
- DataType::QS8,
- DataType::QS16,
DataType::QASYMM8,
});
} // namespace
@@ -67,20 +66,20 @@
TEST_SUITE(DilatedConvolutionLayer)
DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(8U, 8U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(23U, 27U, 5U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32, 0)
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(8U, 8U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(23U, 27U, 5U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32),
+ TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32)
}),
- framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16, 0)
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16)
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(6U, 6U, 1U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32, 0)
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(6U, 6U, 1U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32)
})),
framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
PadStrideInfo(1, 1, 0, 0),
@@ -109,16 +108,13 @@
CNNDataTypes),
input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type)
{
- // Set fixed point position data type allowed
- int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
auto bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
// Create tensors
- Tensor src = create_tensor<Tensor>(input_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- Tensor weights = create_tensor<Tensor>(weights_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- Tensor bias = create_tensor<Tensor>(bias_shape, bias_data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
- Tensor dst = create_tensor<Tensor>(output_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
+ Tensor src = create_tensor<Tensor>(input_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ Tensor weights = create_tensor<Tensor>(weights_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ Tensor bias = create_tensor<Tensor>(bias_shape, bias_data_type, 1, QuantizationInfo(2.f / 255.f, 127));
+ Tensor dst = create_tensor<Tensor>(output_shape, data_type, 1, QuantizationInfo(2.f / 255.f, 127));
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -146,6 +142,8 @@
// Validate QuantizationInfo
ARM_COMPUTE_EXPECT(src.info()->quantization_info() == src_quantization_info, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->quantization_info() == weights_quantization_info, framework::LogLevel::ERRORS);
+
+ // Validate padding
}
template <typename T>
@@ -161,7 +159,7 @@
framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num_f16, abs_tolerance_f16);
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMDilatedConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDilatedConvolutionLayerDataset(),
framework::dataset::make("ReshapeWeights", { true })),
@@ -170,7 +168,7 @@
framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num_f16, abs_tolerance_f16);
}
TEST_SUITE_END()
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
@@ -198,67 +196,15 @@
TEST_SUITE_END()
template <typename T>
-using NEGEMMDilatedConvolutionLayerFixedPointFixture = ConvolutionValidationFixedPointFixture<Tensor, Accessor, NEGEMMConvolutionLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// We test for fixed point precision [4,6]
-FIXTURE_DATA_TEST_CASE(RunTiny, NEGEMMDilatedConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(datasets::TinyDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMDilatedConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY,
- combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEGEMMDilatedConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(datasets::TinyDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)),
- framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMDilatedConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY,
- combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)),
- framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
using NEGEMMDilatedConvolutionLayerQuantizedFixture = ConvolutionValidationQuantizedFixture<Tensor, Accessor, NEGEMMConvolutionLayer, T>;
TEST_SUITE(Quantized)
TEST_SUITE(QASYMM8)
FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMDilatedConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
- combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QASYMM8)),
+ combine(combine(combine(combine(combine(datasets::SmallDilatedConvolutionLayerDataset(),
+ framework::dataset::make("ReshapeWeights", { true })),
+ framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
{
@@ -266,9 +212,10 @@
validate(Accessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMDilatedConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
- combine(combine(combine(combine(datasets::LargeDilatedConvolutionLayerDataset(),
- framework::dataset::make("ReshapeWeights", { true })),
- framework::dataset::make("DataType", DataType::QASYMM8)),
+ combine(combine(combine(combine(combine(datasets::LargeDilatedConvolutionLayerDataset(),
+ framework::dataset::make("ReshapeWeights", { true })),
+ framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW })),
framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
framework::dataset::make("ActivationLayerInfo", ActivationLayerInfo())))
{
diff --git a/tests/validation/NEON/DirectConvolutionLayer.cpp b/tests/validation/NEON/DirectConvolutionLayer.cpp
index f4c7693..c209e21 100644
--- a/tests/validation/NEON/DirectConvolutionLayer.cpp
+++ b/tests/validation/NEON/DirectConvolutionLayer.cpp
@@ -42,13 +42,14 @@
{
namespace
{
-constexpr AbsoluteTolerance<float> tolerance_qs(1.f); /**< Tolerance for fixed point tests */
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-constexpr AbsoluteTolerance<float> tolerance_fp16(0.01f); /**< Tolerance for half precision floating point tests */
-#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-constexpr AbsoluteTolerance<float> tolerance_fp32(0.001f); /**< Tolerance for floating point tests */
+const RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.2f)); /**< Relative tolerance value for FP16 types */
+const AbsoluteTolerance<float> abs_tolerance_f16(0.2f); /**< Absolute tolerance for FP16 types */
+constexpr float tolerance_num = 0.07f; /**< Tolerance number for the FP16 implementation */
+#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
+constexpr AbsoluteTolerance<float> tolerance_fp32(0.001f); /**< Tolerance for floating point tests */
-/** Direct convolution data set. */
+/** Direct convolution data set.for FP32 */
const auto data_pad_f32 = concat(concat(combine(framework::dataset::make("PadX", { 0, 1 }),
combine(framework::dataset::make("PadY", { 0, 1 }),
framework::dataset::make("KernelSize", 3))),
@@ -59,33 +60,26 @@
combine(framework::dataset::make("PadY", { 0, 3 }),
framework::dataset::make("KernelSize", 5))));
-const auto data_pad_qs8 = concat(combine(framework::dataset::make("PadX", 0),
- combine(framework::dataset::make("PadY", 0),
- framework::dataset::make("KernelSize", 1))),
- combine(framework::dataset::make("PadX", { 0, 2 }),
- combine(framework::dataset::make("PadY", { 0, 2 }),
- framework::dataset::make("KernelSize", 3))));
+/** Direct convolution data set.for FP16 */
+const auto data_pad_f16 = concat(combine(framework::dataset::make("PadX", { 0, 1 }),
+ combine(framework::dataset::make("PadY", { 0, 1 }),
+ framework::dataset::make("KernelSize", 3))),
+ combine(framework::dataset::make("PadX", { 0 }),
+ combine(framework::dataset::make("PadY", { 0 }),
+ framework::dataset::make("KernelSize", 1))));
const auto data_f32 = combine(datasets::SmallDirectConvolutionShapes(),
- combine(framework::dataset::make("StrideX", { 1, 3 }),
- combine(framework::dataset::make("StrideY", { 1, 3 }),
+ combine(framework::dataset::make("StrideX", { 1, 2, 3 }),
+ combine(framework::dataset::make("StrideY", { 1, 2, 3 }),
combine(data_pad_f32,
framework::dataset::make("NumKernels", { 1, 4, 8, 16 })))));
-const auto data_qs8 = combine(datasets::TinyDirectConvolutionShapes(),
- combine(framework::dataset::make("StrideX", { 1, 3 }),
- combine(framework::dataset::make("StrideY", { 1, 3 }),
- combine(data_pad_qs8,
+const auto data_f16 = combine(datasets::SmallDirectConvolutionShapes(),
+ combine(framework::dataset::make("StrideX", { 1, 2, 3 }),
+ combine(framework::dataset::make("StrideY", { 1, 2, 3 }),
+ combine(data_pad_f16,
framework::dataset::make("NumKernels", { 1, 4, 8, 16 })))));
-/** Direct convolution QS16 data set. */
-const auto data_qs16 = combine(datasets::TinyDirectConvolutionShapes(),
- combine(framework::dataset::make("StrideX", { 1, 3 }),
- combine(framework::dataset::make("StrideY", { 1, 3 }),
- combine(framework::dataset::make("PadX", 0),
- combine(framework::dataset::make("PadY", 0),
- combine(framework::dataset::make("KernelSize", 1),
- framework::dataset::make("NumKernels", { 1, 4, 8, 16 })))))));
/** Activation function Dataset*/
const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
{
@@ -102,45 +96,45 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type input/weights
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching input feature maps
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Unsupported kernel width
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Non-rectangular weights dimensions
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid weights dimensions
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid stride
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid biases size
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid biases dimensions
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid output size
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching input feature maps
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported kernel width
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Non-rectangular weights dimensions
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights dimensions
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid stride
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
}),
- framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(3U, 3U, 3U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(9U, 9U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(5U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U, 3U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, 0),
+ framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 3U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(9U, 9U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(5U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U, 3U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
})),
- framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U), 1, DataType::F32, 0),
+ framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U), 1, DataType::F32),
})),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(26U, 11U, 4U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(26U, 11U, 4U), 1, DataType::F32),
})),
framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
PadStrideInfo(1, 1, 0, 0),
@@ -172,12 +166,12 @@
TEST_SUITE(Float)
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
TEST_SUITE(FP16)
-FIXTURE_DATA_TEST_CASE(Run, NEDirectConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(data_f32, framework::dataset::make("DataType", DataType::F16)),
+FIXTURE_DATA_TEST_CASE(Run, NEDirectConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(data_f16, framework::dataset::make("DataType", DataType::F16)),
ActivationFunctionsDataset),
framework::dataset::make("DataLayout", DataLayout::NCHW)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_fp16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16);
}
TEST_SUITE_END()
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
@@ -193,9 +187,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-template <typename T>
-using NEDirectConvolutionLayerFixedPointFixture = DirectConvolutionValidationFixedPointFixture<Tensor, Accessor, NEDirectConvolutionLayer, T>;
-
const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
{
ActivationLayerInfo(),
@@ -203,30 +194,6 @@
ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f)
});
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-// We test for fixed point precision [4,6]
-FIXTURE_DATA_TEST_CASE(Run, NEDirectConvolutionLayerFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(data_qs8, framework::dataset::make("DataType", DataType::QS8)),
- framework::dataset::make("FractionalBits", 4, 7)),
- QuantizedActivationFunctionsDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// We test for fixed point precision [4,13]
-FIXTURE_DATA_TEST_CASE(Run, NEDirectConvolutionLayerFixedPointFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(data_qs16, framework::dataset::make("DataType", DataType::QS16)),
- framework::dataset::make("FractionalBits", 4, 14)),
- QuantizedActivationFunctionsDataset))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/NEON/FixedPoint/FixedPoint.cpp b/tests/validation/NEON/FixedPoint/FixedPoint.cpp
deleted file mode 100644
index a583b58..0000000
--- a/tests/validation/NEON/FixedPoint/FixedPoint.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "FixedPointTarget.h"
-
-#include "arm_compute/core/Types.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "arm_compute/runtime/TensorAllocator.h"
-#include "tests/NEON/Accessor.h"
-#include "tests/PaddingCalculator.h"
-#include "tests/datasets/ShapeDatasets.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "tests/validation/Validation.h"
-#include "tests/validation/fixtures/FixedPointFixture.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-constexpr AbsoluteTolerance<float> tolerance_exp_qs8(0.0f); /**< Tolerance value for comparing reference's output against implementation's output (exponential) for DataType::QS8 */
-constexpr AbsoluteTolerance<float> tolerance_exp_qs16(1.0f); /**< Tolerance value for comparing reference's output against implementation's output (exponential) for DataType::QS16 */
-constexpr AbsoluteTolerance<float> tolerance_invsqrt_qs8(4.0f); /**< Tolerance value for comparing reference's output against implementation's output (inverse square-root) for DataType::QS8 */
-constexpr AbsoluteTolerance<float> tolerance_invsqrt_qs16(5.0f); /**< Tolerance value for comparing reference's output against implementation's output (inverse square-root) for DataType::QS16 */
-constexpr AbsoluteTolerance<float> tolerance_log_qs8(5.0f); /**< Tolerance value for comparing reference's output against implementation's output (logarithm) for DataType::QS8 */
-constexpr AbsoluteTolerance<float> tolerance_log_qs16(7.0f); /**< Tolerance value for comparing reference's output against implementation's output (logarithm) for DataType::QS16 */
-} // namespace
-
-TEST_SUITE(NEON)
-TEST_SUITE(FixedPoint)
-template <typename T>
-using NEFixedPointFixture = FixedPointValidationFixture<Tensor, Accessor, T>;
-
-TEST_SUITE(QS8)
-TEST_SUITE(Exp)
-
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FixedPointOp", FixedPointOp::EXP)),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_exp_qs8, 0);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(Invsqrt)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FixedPointOp", FixedPointOp::INV_SQRT)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_invsqrt_qs8, 0);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(Log)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FixedPointOp", FixedPointOp::LOG)),
- framework::dataset::make("FractionalBits", 3, 6)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_log_qs8, 0);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-TEST_SUITE(Exp)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FixedPointOp", FixedPointOp::EXP)),
- framework::dataset::make("FractionalBits", 1, 15)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_exp_qs16, 0);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(Invsqrt)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(framework::dataset::make("Shape", TensorShape(8192U)),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FixedPointOp", FixedPointOp::INV_SQRT)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_invsqrt_qs16, 0);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(Log)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFixedPointFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::Small1DShapes(), framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FixedPointOp", FixedPointOp::LOG)),
- framework::dataset::make("FractionalBits", 4, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_log_qs16, 0);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/NEON/FixedPoint/FixedPointTarget.h b/tests/validation/NEON/FixedPoint/FixedPointTarget.h
deleted file mode 100644
index 31ccc08..0000000
--- a/tests/validation/NEON/FixedPoint/FixedPointTarget.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_FIXED_POINT_NEON_TARGET
-#define ARM_COMPUTE_TEST_FIXED_POINT_NEON_TARGET
-
-#include "arm_compute/core/NEON/NEFixedPoint.h"
-
-#include "tests/Globals.h"
-#include "tests/Types.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-template <typename TensorType, typename AccessorType, typename T>
-void compute_target_impl(const TensorShape &shape, DataType dt, FixedPointOp op, int fixed_point_position, TensorType &src, TensorType &dst)
-{
- Window window;
-
- switch(dt)
- {
- case DataType::QS8:
- {
- constexpr unsigned int num_elems_processed_per_iteration = 16;
- window = calculate_max_window(*src.info(), Steps(num_elems_processed_per_iteration));
- AccessWindowHorizontal input_access(src.info(), 0, num_elems_processed_per_iteration);
- AccessWindowHorizontal output_access(dst.info(), 0, num_elems_processed_per_iteration);
- update_window_and_padding(window, input_access, output_access);
- break;
- }
- case DataType::QS16:
- {
- constexpr unsigned int num_elems_processed_per_iteration = 8;
- window = calculate_max_window(*src.info(), Steps(num_elems_processed_per_iteration));
- AccessWindowHorizontal input_access(src.info(), 0, num_elems_processed_per_iteration);
- AccessWindowHorizontal output_access(dst.info(), 0, num_elems_processed_per_iteration);
- update_window_and_padding(window, input_access, output_access);
- break;
- }
- default:
- ARM_COMPUTE_ERROR("Not Supported");
- break;
- }
-
- int min;
- int max;
- switch(op)
- {
- case FixedPointOp::EXP:
- {
- // Fill tensors. Keep the range between [-1.0, 1.0) so the result won't
- // overflow.
- min = -(1 << (fixed_point_position - 1));
- max = (1 << (fixed_point_position - 1));
- break;
- }
- case FixedPointOp::INV_SQRT:
- {
- if(dt == DataType::QS8)
- {
- // Fill tensors. Keep the range between [1, 127).
- min = 1;
- max = 127;
- }
- else
- {
- // Fill tensors. Keep the range between [1, 0x7FFF)
- min = 1;
- max = 0x7FFF;
- }
- break;
- }
- case FixedPointOp::LOG:
- {
- if(dt == DataType::QS8)
- {
- // Fill tensors. Keep the range between [(1 << (fixed_point_position - 1), 63) so the result won't
- // overflow. E.g. for Q2.5 ln(0.001) = -6.9, which cannot be represented.
- min = (1 << (fixed_point_position - 1));
- max = 0x3F;
- }
- else
- {
- // Fill tensors. Keep the range between [(1 << (fixed_point_position - 1), 0x3FFF) so the result won't
- // overflow.
- min = (1 << (fixed_point_position - 1));
- max = 0x3FFF;
- }
- break;
- }
- case FixedPointOp::RECIPROCAL:
- {
- if(dt == DataType::QS8)
- {
- // Fill tensors. Keep the range between [15, 100) so the result won't
- // overflow. E.g. for Q2.5 reciprocal(0.001) = 1000, which cannot be represented.
- min = 15;
- max = 0x7F;
- }
- else
- {
- // Fill tensors. Keep the range between [15, 0x7FFF) so the result won't
- // overflow.
- min = 15;
- max = 0x7FFF;
- }
- break;
- }
- default:
- ARM_COMPUTE_ERROR("Not Supported");
- break;
- }
-
- std::uniform_int_distribution<> distribution(min, max);
- library->fill(AccessorType(src), distribution, 0);
-
- Iterator input(&src, window);
- Iterator output(&dst, window);
-
- const auto loop_function = [&](const Coordinates & id)
- {
- switch(dt)
- {
- case DataType::QS8:
- {
- const qint8x16_t qs8in = vld1q_s8(reinterpret_cast<const qint8_t *>(input.ptr()));
- switch(op)
- {
- case FixedPointOp::EXP:
- {
- // Use saturated exp
- vst1q_s8(reinterpret_cast<qint8_t *>(output.ptr()), vqexpq_qs8(qs8in, fixed_point_position));
- break;
- }
- case FixedPointOp::INV_SQRT:
- {
- vst1q_s8(reinterpret_cast<qint8_t *>(output.ptr()), vqinvsqrtq_qs8(qs8in, fixed_point_position));
- break;
- }
- case FixedPointOp::LOG:
- {
- vst1q_s8(reinterpret_cast<qint8_t *>(output.ptr()), vlogq_qs8(qs8in, fixed_point_position));
- break;
- }
- case FixedPointOp::RECIPROCAL:
- {
- vst1q_s8(reinterpret_cast<qint8_t *>(output.ptr()), vrecipq_qs8(qs8in, fixed_point_position));
- break;
- }
- default:
- ARM_COMPUTE_ERROR("Not Supported");
- break;
- }
- break;
- }
- case DataType::QS16:
- {
- const qint16x8_t qs16in = vld1q_qs16(reinterpret_cast<const qint16_t *>(input.ptr()));
- switch(op)
- {
- case FixedPointOp::EXP:
- {
- // Use saturated exp
- vst1q_qs16(reinterpret_cast<qint16_t *>(output.ptr()), vqexpq_qs16(qs16in, fixed_point_position));
- break;
- }
- case FixedPointOp::INV_SQRT:
- {
- vst1q_qs16(reinterpret_cast<qint16_t *>(output.ptr()), vqinvsqrtq_qs16(qs16in, fixed_point_position));
- break;
- }
- case FixedPointOp::LOG:
- {
- vst1q_qs16(reinterpret_cast<qint16_t *>(output.ptr()), vlogq_qs16(qs16in, fixed_point_position));
- break;
- }
- case FixedPointOp::RECIPROCAL:
- {
- vst1q_qs16(reinterpret_cast<qint16_t *>(output.ptr()), vqrecipq_qs16(qs16in, fixed_point_position));
- break;
- }
- default:
- ARM_COMPUTE_ERROR("Not Supported");
- break;
- }
- break;
- }
- default:
- ARM_COMPUTE_ERROR("Not Supported");
- break;
- }
- };
-
- execute_window_loop(window, loop_function, input, output);
-}
-} // namespace
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_FIXED_POINT_NEON_TARGET */
diff --git a/tests/validation/NEON/FixedPointPixelWiseMultiplication.cpp b/tests/validation/NEON/FixedPointPixelWiseMultiplication.cpp
deleted file mode 100644
index d7954de..0000000
--- a/tests/validation/NEON/FixedPointPixelWiseMultiplication.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2017-2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/NEON/functions/NEPixelWiseMultiplication.h"
-#include "tests/NEON/Accessor.h"
-#include "tests/datasets/ConvertPolicyDataset.h"
-#include "tests/datasets/ShapeDatasets.h"
-#include "tests/framework/Macros.h"
-#include "tests/validation/Validation.h"
-#include "tests/validation/fixtures/FixedPointPixelWiseMultiplicationFixture.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-const float tolerance = 1.f;
-const float scale_255 = 1.f / 255.f;
-const float scale_unity = 1.f;
-
-// *INDENT-OFF*
-// clang-format off
-#define FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, SHAPES, DT1, DT2, SCALE, RP, FPP_START, FPP_END) \
- FIXTURE_DATA_TEST_CASE(TEST_NAME, NEFixedPointPixelWiseMultiplication##FIXTURE, framework::DatasetMode::MODE, \
- combine(combine(combine(combine(combine(combine( \
- datasets::SHAPES, \
- framework::dataset::make("DataType1", DataType::DT1)), \
- framework::dataset::make("DataType2", DataType::DT2)), \
- framework::dataset::make("Scale", std::move(SCALE))), \
- datasets::ConvertPolicies()), \
- framework::dataset::make("RoundingPolicy", RoundingPolicy::RP)), \
- framework::dataset::make("FixedPointPosition", FPP_START, FPP_END))) \
- { \
- validate(Accessor(_target), _reference); \
- }
-
-#define FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(TEST_NAME, FIXTURE, MODE, SHAPES, DT1, DT2, RP, FPP, TOLERANCE) \
- FIXTURE_DATA_TEST_CASE(TEST_NAME, NEFixedPointPixelWiseMultiplication##FIXTURE, framework::DatasetMode::MODE, \
- combine(combine(combine(combine(combine(combine( \
- datasets::SHAPES, \
- framework::dataset::make("DataType1", DataType::DT1)), \
- framework::dataset::make("DataType2", DataType::DT2)), \
- framework::dataset::make("Scale", 1.f / static_cast<float>(1 << (FPP)))), \
- datasets::ConvertPolicies()), \
- framework::dataset::make("RoundingPolicy", RoundingPolicy::RP)), \
- framework::dataset::make("FixedPointPosition", FPP))) \
- { \
- validate(Accessor(_target), _reference, AbsoluteTolerance<float>(TOLERANCE), 0.f); \
- }
-// clang-format on
-// *INDENT-ON*
-} // namespace
-
-template <typename T>
-using NEFixedPointPixelWiseMultiplicationFixture = FixedPointPixelWiseMultiplicationValidationFixture<Tensor, Accessor, NEPixelWiseMultiplication, T>;
-
-TEST_SUITE(NEON)
-TEST_SUITE(FixedPointPixelWiseMultiplication)
-
-TEST_SUITE(QS8)
-
-TEST_SUITE(Scale255)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunTiny, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, scale_255, TO_NEAREST_UP, 1, 7)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmall, Fixture<qint8_t>, NIGHTLY, SmallShapes(), QS8, QS8, scale_255, TO_NEAREST_UP, 1, 7)
-TEST_SUITE_END() // Scale255
-
-TEST_SUITE(ScaleUnity)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunTiny, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, scale_unity, TO_ZERO, 1, 7)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmall, Fixture<qint8_t>, NIGHTLY, SmallShapes(), QS8, QS8, scale_unity, TO_ZERO, 1, 7)
-TEST_SUITE_END() // ScaleUnity
-
-TEST_SUITE(ScaleOther)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther1, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, TO_ZERO, 1, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther2, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, TO_ZERO, 2, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther3, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, TO_ZERO, 3, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther4, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, TO_ZERO, 4, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther5, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, TO_ZERO, 5, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther6, Fixture<qint8_t>, PRECOMMIT, TinyShapes(), QS8, QS8, TO_ZERO, 6, tolerance)
-
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunSmallOther1, Fixture<qint8_t>, NIGHTLY, SmallShapes(), QS8, QS8, TO_ZERO, 1, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunSmallOther2, Fixture<qint8_t>, NIGHTLY, SmallShapes(), QS8, QS8, TO_ZERO, 2, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunSmallOther3, Fixture<qint8_t>, NIGHTLY, SmallShapes(), QS8, QS8, TO_ZERO, 3, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunSmallOther4, Fixture<qint8_t>, NIGHTLY, SmallShapes(), QS8, QS8, TO_ZERO, 4, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunSmallOther5, Fixture<qint8_t>, NIGHTLY, SmallShapes(), QS8, QS8, TO_ZERO, 5, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunSmallOther6, Fixture<qint8_t>, NIGHTLY, SmallShapes(), QS8, QS8, TO_ZERO, 6, tolerance)
-TEST_SUITE_END() // ScaleOther
-
-TEST_SUITE_END() // QS8
-
-TEST_SUITE(QS16)
-
-TEST_SUITE(Scale255)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunTiny, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, scale_255, TO_NEAREST_UP, 1, 15)
-TEST_SUITE_END() // Scale255
-
-TEST_SUITE(ScaleUnity)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunTiny, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, scale_unity, TO_ZERO, 1, 15)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE(RunSmall, Fixture<qint16_t>, NIGHTLY, SmallShapes(), QS16, QS16, scale_unity, TO_ZERO, 1, 15)
-TEST_SUITE_END() // ScaleUnity
-
-TEST_SUITE(ScaleOther)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther1, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 1, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther2, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 2, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther3, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 3, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther4, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 4, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther5, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 5, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther6, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 6, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther7, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 7, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther8, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 8, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther9, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 9, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther10, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 10, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther11, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 11, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther12, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 12, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther13, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 13, tolerance)
-FP_PIXEL_WISE_MULTIPLICATION_FIXTURE_DATA_TEST_CASE_OTHER(RunTinyOther14, Fixture<qint16_t>, PRECOMMIT, TinyShapes(), QS16, QS16, TO_ZERO, 14, tolerance)
-TEST_SUITE_END() // ScaleOther
-
-TEST_SUITE_END() // QS16
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/NEON/Flatten.cpp b/tests/validation/NEON/Flatten.cpp
index 3327169..86f1a11 100644
--- a/tests/validation/NEON/Flatten.cpp
+++ b/tests/validation/NEON/Flatten.cpp
@@ -80,38 +80,6 @@
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
TEST_SUITE_END()
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEFlattenLayerFixture<int8_t>, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::Tiny3DShapes(), datasets::Tiny4DShapes()),
- framework::dataset::make("DataType", DataType::QS8)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFlattenLayerFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(framework::dataset::concat(datasets::Small3DShapes(), datasets::Small4DShapes()),
- framework::dataset::make("DataType", DataType::QS8)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEFlattenLayerFixture<int16_t>, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::Tiny3DShapes(), datasets::Tiny4DShapes()),
- framework::dataset::make("DataType", DataType::QS16)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFlattenLayerFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(framework::dataset::concat(datasets::Small3DShapes(), datasets::Small4DShapes()),
- framework::dataset::make("DataType", DataType::QS16)))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/NEON/FullyConnectedLayer.cpp b/tests/validation/NEON/FullyConnectedLayer.cpp
index ed0edcd..43ee99a 100644
--- a/tests/validation/NEON/FullyConnectedLayer.cpp
+++ b/tests/validation/NEON/FullyConnectedLayer.cpp
@@ -43,12 +43,16 @@
namespace
{
/** Tolerance for float operations */
-constexpr RelativeTolerance<float> tolerance_f32(0.01f);
+constexpr RelativeTolerance<float> rel_tolerance_f32(0.01f); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType::F32 */
+constexpr AbsoluteTolerance<float> abs_tolerance_f32(0.001f); /**< Absolute tolerance value for comparing reference's output against implementation's output for DataType::F32 */
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-constexpr RelativeTolerance<float> tolerance_f16(0.01f);
-#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC*/
-/** Tolerance for fixed point operations */
-constexpr AbsoluteTolerance<float> tolerance_fixed_point(1.f);
+const AbsoluteTolerance<float> abs_tolerance_f16(0.3f); /**< Absolute tolerance value for comparing reference's output against implementation's output for DataType::F16 */
+const RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.2f)); /**< Relative tolerance value for comparing reference's output against implementation's output for DataType::F16 */
+constexpr float tolerance_num_f16 = 0.07f; /**< Tolerance number for FP16 */
+#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC*/
+
+/** Tolerance for quantized asymmetric operations */
+constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1);
/** CNN data types */
const auto CNNDataTypes = framework::dataset::make("DataType",
@@ -57,8 +61,6 @@
DataType::F16,
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
DataType::F32,
- DataType::QS8,
- DataType::QS16,
});
const auto FullyConnectedParameters = combine(framework::dataset::make("TransposeWeights", { false, true }), framework::dataset::make("ReshapeWeights", { false, true }));
@@ -72,8 +74,8 @@
CNNDataTypes),
src_shape, weights_shape, bias_shape, dst_shape, transpose_weights, reshape_weights, data_type)
{
- // Set fixed point position data type allowed
- int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
+ const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
+ const QuantizationInfo quantization_info = is_data_type_quantized_asymmetric(data_type) ? QuantizationInfo(2.f / 255.f, 127) : QuantizationInfo();
TensorShape ws(weights_shape);
@@ -83,43 +85,44 @@
const size_t shape_x = ws.x();
ws.set(0, ws.y());
ws.set(1, shape_x);
-
- // Weights have to be passed reshaped
- // Transpose 1xW for batched version
- if(!reshape_weights && dst_shape.y() > 1)
- {
- const float transpose_width = 16.0f / data_size_from_type(data_type);
- const size_t shape_x = ws.x();
- ws.set(0, ws.y() * static_cast<unsigned int>(transpose_width));
- ws.set(1, static_cast<unsigned int>(std::ceil(shape_x / transpose_width)));
- }
}
// Create tensors
- Tensor src = create_tensor<Tensor>(src_shape, data_type, 1, fixed_point_position);
- Tensor weights = create_tensor<Tensor>(ws, data_type, 1, fixed_point_position);
- Tensor bias = create_tensor<Tensor>(bias_shape, data_type, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(dst_shape, data_type, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(src_shape, data_type, 1, quantization_info);
+ Tensor weights = create_tensor<Tensor>(ws, data_type, 1, quantization_info);
+ Tensor bias = create_tensor<Tensor>(bias_shape, bias_data_type, 1, quantization_info);
+ Tensor dst = create_tensor<Tensor>(dst_shape, data_type, 1, quantization_info);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+ // Create Fully Connected layer info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.transpose_weights = transpose_weights;
+ fc_info.are_weights_reshaped = !reshape_weights;
+
+ const QuantizationInfo src_quantization_info = src.info()->quantization_info();
+ const QuantizationInfo weights_quantization_info = weights.info()->quantization_info();
+
// Create and configure function.
NEFullyConnectedLayer fc;
- fc.configure(&src, &weights, &bias, &dst, transpose_weights, !reshape_weights);
+ fc.configure(&src, &weights, &bias, &dst, fc_info);
// Validate valid region
const ValidRegion dst_valid_region = shape_to_valid_region(dst_shape);
validate(dst.info()->valid_region(), dst_valid_region);
+
+ // Validate QuantizationInfo
+ ARM_COMPUTE_EXPECT(src.info()->quantization_info() == src_quantization_info, framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(weights.info()->quantization_info() == weights_quantization_info, framework::LogLevel::ERRORS);
}
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
framework::dataset::make("InputInfo", { TensorInfo(TensorShape(9U, 5U, 7U, 3U), 1, DataType::F32), // Mismatching data types
- TensorInfo(TensorShape(9U, 5U, 7U, 3U), 1, DataType::QS8, 2), // Mismatching fixed point position
TensorInfo(TensorShape(8U, 4U, 6U, 4U), 1, DataType::F32),
TensorInfo(TensorShape(8U, 4U, 6U, 4U), 1, DataType::F32),
TensorInfo(TensorShape(9U, 5U, 7U, 3U), 1, DataType::F32), // Invalid weights dimensions
@@ -127,7 +130,6 @@
TensorInfo(TensorShape(8U, 4U, 6U, 4U), 1, DataType::F32),
}),
framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(315U, 271U), 1, DataType::F16),
- TensorInfo(TensorShape(315U, 271U), 1, DataType::QS8, 3),
TensorInfo(TensorShape(192U, 192U), 1, DataType::F32),
TensorInfo(TensorShape(192U, 192U), 1, DataType::F32),
TensorInfo(TensorShape(217U, 315U), 1, DataType::F32),
@@ -135,7 +137,6 @@
TensorInfo(TensorShape(192U, 192U), 1, DataType::F32),
})),
framework::dataset::make("BiasInfo",{ TensorInfo(TensorShape(271U), 1, DataType::F32),
- TensorInfo(TensorShape(271U), 1, DataType::QS8, 2),
TensorInfo(TensorShape(192U), 1, DataType::F32),
TensorInfo(TensorShape(192U), 1, DataType::F32),
TensorInfo(TensorShape(271U), 1, DataType::F32),
@@ -143,26 +144,30 @@
TensorInfo(TensorShape(192U), 1, DataType::F32),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(271U, 3U), 1, DataType::F32),
- TensorInfo(TensorShape(271U, 3U), 1, DataType::QS8, 3),
TensorInfo(TensorShape(192U, 4U), 1, DataType::F32),
TensorInfo(TensorShape(192U, 4U), 1, DataType::F32),
TensorInfo(TensorShape(271U, 3U), 1, DataType::F32),
TensorInfo(TensorShape(271U, 3U), 1, DataType::F32),
TensorInfo(TensorShape(192U, 4U), 1, DataType::F32),
})),
- framework::dataset::make("TransposeWeights",{ true, true, true, false, true, true, true })),
- framework::dataset::make("ReshapedWeights",{ false, false, false, false, false, false , false})),
- framework::dataset::make("Expected", { false, false, true, true, false, false, true })),
+ framework::dataset::make("TransposeWeights",{ true, true, false, true, true, true })),
+ framework::dataset::make("ReshapedWeights",{ false, false, false, false, false , false})),
+ framework::dataset::make("Expected", { false, true, true, false, false, true })),
input_info, weights_info, bias_info, output_info, transpose_weights, reshaped_weights, expected)
{
- 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);
+ // Create Fully Connected layer info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.transpose_weights = transpose_weights;
+ fc_info.are_weights_reshaped = reshaped_weights;
+
+ 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);
ARM_COMPUTE_EXPECT(bool(status) == expected, framework::LogLevel::ERRORS);
}
// clang-format on
// *INDENT-ON*
template <typename T>
-using NEFullyConnectedLayerFixture = FullyConnectedLayerValidationFixture<Tensor, Accessor, NEFullyConnectedLayer, T, true>;
+using NEFullyConnectedLayerFixture = FullyConnectedLayerValidationFixture<Tensor, Accessor, NEFullyConnectedLayer, T>;
TEST_SUITE(Float)
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
@@ -172,14 +177,14 @@
framework::dataset::make("DataType", DataType::F16)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num_f16, abs_tolerance_f16);
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEFullyConnectedLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeFullyConnectedLayerDataset(),
FullyConnectedParameters),
framework::dataset::make("DataType", DataType::F16)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num_f16, abs_tolerance_f16);
}
TEST_SUITE_END()
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
@@ -189,62 +194,39 @@
framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f32);
+ validate(Accessor(_target), _reference, rel_tolerance_f32, 0, abs_tolerance_f32);
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEFullyConnectedLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeFullyConnectedLayerDataset(), FullyConnectedParameters),
framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f32);
+ validate(Accessor(_target), _reference, rel_tolerance_f32, 0, abs_tolerance_f32);
}
TEST_SUITE_END()
TEST_SUITE_END()
template <typename T>
-using NEFullyConnectedLayerFixedPointFixture = FullyConnectedLayerValidationFixedPointFixture<Tensor, Accessor, NEFullyConnectedLayer, T, true>;
+using NEFullyConnectedLayerQuantizedFixture = FullyConnectedLayerValidationQuantizedFixture<Tensor, Accessor, NEFullyConnectedLayer, T>;
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5
-FIXTURE_DATA_TEST_CASE(RunTiny, NEFullyConnectedLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyFullyConnectedLayerDataset(),
- FullyConnectedParameters),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
+TEST_SUITE(Quantized)
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEFullyConnectedLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(
+ combine(datasets::SmallFullyConnectedLayerDataset(),
+ FullyConnectedParameters),
+ framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f / 255.f, 10) })))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_fixed_point);
+ validate(Accessor(_target), _reference, tolerance_qasymm8);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFullyConnectedLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallFullyConnectedLayerDataset(),
- FullyConnectedParameters),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NEFullyConnectedLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(
+ combine(datasets::LargeFullyConnectedLayerDataset(),
+ FullyConnectedParameters),
+ framework::dataset::make("DataType", DataType::QASYMM8)),
+ framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.f / 256.f, 10) })))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_fixed_point);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14
-FIXTURE_DATA_TEST_CASE(RunTiny, NEFullyConnectedLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::TinyFullyConnectedLayerDataset(),
- FullyConnectedParameters),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_fixed_point);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEFullyConnectedLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::SmallFullyConnectedLayerDataset(),
- FullyConnectedParameters),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_fixed_point);
+ validate(Accessor(_target), _reference, tolerance_qasymm8);
}
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/NEON/GEMM.cpp b/tests/validation/NEON/GEMM.cpp
index 0c9f20c..661632b 100644
--- a/tests/validation/NEON/GEMM.cpp
+++ b/tests/validation/NEON/GEMM.cpp
@@ -49,9 +49,12 @@
{
namespace
{
-constexpr AbsoluteTolerance<float> tolerance_f(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */
-constexpr AbsoluteTolerance<float> tolerance_q(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */
-
+constexpr AbsoluteTolerance<float> tolerance_f(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for FP32 data types */
+#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
+RelativeTolerance<half_float::half> rel_tolerance_f16(half(0.2)); /**< Relative tolerance value for comparing reference's output against implementation's output for FP16 data types */
+const AbsoluteTolerance<float> abs_tolerance_f16(0.2f); /**< Absolute tolerance value for comparing reference's output against implementation's output for FP16 data types */
+constexpr float tolerance_num = 0.07f; /**< Tolerance number for FP16 data types */
+#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
/** CNN data types */
const auto CNNDataTypes = framework::dataset::make("DataType",
{
@@ -59,8 +62,6 @@
DataType::F16,
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
DataType::F32,
- DataType::QS8,
- DataType::QS16,
});
const auto data_interleave = framework::dataset::make("M", 8, 12) * framework::dataset::make("N", 8, 12);
@@ -82,33 +83,6 @@
}
TEST_SUITE_END() // FP32
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-using NEGEMMTranspose1xW = NESynthetizeFunctionWithZeroConstantBorder<NEGEMMTranspose1xWKernel, 16>;
-using NEGEMMTranspose1xWFixture = GEMMTranspose1xWValidationFixedPointFixture<Tensor, Accessor, NEGEMMTranspose1xW, int8_t>;
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMTranspose1xWFixture, framework::DatasetMode::PRECOMMIT, data_transpose *
- framework::dataset::make("DataType", DataType::QS8)
- * framework::dataset::make("FractionalBits", 1, 7))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-using NEGEMMTranspose1xW = NESynthetizeFunctionWithZeroConstantBorder<NEGEMMTranspose1xWKernel, 8>;
-using NEGEMMTranspose1xWFixture = GEMMTranspose1xWValidationFixedPointFixture<Tensor, Accessor, NEGEMMTranspose1xW, int16_t>;
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMTranspose1xWFixture, framework::DatasetMode::PRECOMMIT, data_transpose *
- framework::dataset::make("DataType", DataType::QS16)
- * framework::dataset::make("FractionalBits", 1, 14))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE_END()
-
TEST_SUITE_END() // TRANSPOSE_1XW
TEST_SUITE(INTERLEAVE_4X4)
@@ -123,44 +97,16 @@
}
TEST_SUITE_END() // FP32
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-using NEGEMMInterleave4x4Fixture = GEMMInterleave4x4ValidationFixedPointFixture<Tensor, Accessor, NEGEMMInterleave4x4, int8_t>;
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMInterleave4x4Fixture, framework::DatasetMode::PRECOMMIT, data_interleave *
- framework::dataset::make("DataType", DataType::QS8)
- * framework::dataset::make("FractionalBits", 1, 7))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-using NEGEMMInterleave4x4Fixture = GEMMInterleave4x4ValidationFixedPointFixture<Tensor, Accessor, NEGEMMInterleave4x4, int16_t>;
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMInterleave4x4Fixture, framework::DatasetMode::PRECOMMIT, data_interleave *
- framework::dataset::make("DataType", DataType::QS16)
- * framework::dataset::make("FractionalBits", 1, 14))
-{
- // Validate output
- validate(Accessor(_target), _reference);
-}
-TEST_SUITE_END()
-
-TEST_SUITE_END()
-
TEST_SUITE_END() // INTERLEAVE_4X4
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallGEMMDataset(), datasets::LargeGEMMDataset()), CNNDataTypes),
shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
// Create tensors
- Tensor a = create_tensor<Tensor>(shape_a, data_type, 1, fixed_point_position);
- Tensor b = create_tensor<Tensor>(shape_b, data_type, 1, fixed_point_position);
- Tensor c = create_tensor<Tensor>(shape_c, data_type, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(output_shape, data_type, 1, fixed_point_position);
+ Tensor a = create_tensor<Tensor>(shape_a, data_type, 1);
+ Tensor b = create_tensor<Tensor>(shape_b, data_type, 1);
+ Tensor c = create_tensor<Tensor>(shape_c, data_type, 1);
+ Tensor dst = create_tensor<Tensor>(output_shape, data_type, 1);
ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -181,13 +127,13 @@
FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMDataset(), framework::dataset::make("DataType", DataType::F16)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16);
}
FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMFixture<half>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType",
DataType::F16)))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16);
}
TEST_SUITE_END()
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
@@ -206,49 +152,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-template <typename T>
-using NEGEMMFixedPointFixture = GEMMValidationFixedPointFixture<Tensor, Accessor, NEGEMM, T>;
-
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEGEMMFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::TinyGEMMDataset(),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallGEMMDataset(),
- framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 7)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEGEMMFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::TinyGEMMDataset(),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallGEMMDataset(),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_q);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/NEON/GEMMLowp.cpp b/tests/validation/NEON/GEMMLowp.cpp
index ed24d61..9eba3c8 100644
--- a/tests/validation/NEON/GEMMLowp.cpp
+++ b/tests/validation/NEON/GEMMLowp.cpp
@@ -102,7 +102,7 @@
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
framework::dataset::make("InputAInfo", { TensorInfo(TensorShape(21U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Input not a multiple of 4
- TensorInfo(TensorShape(21U, 13U), 1, DataType::QS8, 2), // Mismatching data type
+ TensorInfo(TensorShape(21U, 13U), 1, DataType::S32), // Mismatching data type
TensorInfo(TensorShape(20U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Invalid dimensions
TensorInfo(TensorShape(21U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)), // Invalid dimensions
TensorInfo(TensorShape(16U, 32U), 1, DataType::QASYMM8, QuantizationInfo(1.f/255, 10)),
diff --git a/tests/validation/NEON/Im2Col.cpp b/tests/validation/NEON/Im2Col.cpp
index 50081f0..0ea68bf 100644
--- a/tests/validation/NEON/Im2Col.cpp
+++ b/tests/validation/NEON/Im2Col.cpp
@@ -39,9 +39,11 @@
{
namespace
{
-const auto conv_args = combine(combine(combine(framework::dataset::make("KernelDims", { Size2D(3U, 3U), Size2D(5U, 5U) }), framework::dataset::make("PadStride", { PadStrideInfo(1U, 1U, 0U, 0U), PadStrideInfo(1U, 1U, 1U, 1U), PadStrideInfo(2U, 2U, 0U, 2U) })),
- framework::dataset::make("QuantizationInfo", QuantizationInfo(0.5f, 10))),
- framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }));
+const auto conv_filter_sizes = framework::dataset::make("KernelDims", { Size2D(3U, 3U), Size2D(3U, 1U), Size2D(1U, 5U), Size2D(5U, 5U), Size2D(7U, 7U) });
+const auto conv_args = combine(combine(combine(combine(conv_filter_sizes, framework::dataset::make("PadStride", { PadStrideInfo(1U, 1U, 0U, 0U), PadStrideInfo(1U, 1U, 1U, 1U), PadStrideInfo(2U, 2U, 0U, 2U) })),
+ framework::dataset::make("QuantizationInfo", QuantizationInfo(0.5f, 10))),
+ framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
+ framework::dataset::make("NumGroups", { 1 }));
} // namespace
TEST_SUITE(NEON)
TEST_SUITE(Im2Col)
@@ -51,35 +53,41 @@
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
framework::dataset::make("InputInfo", { TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::U8), // Unsupported data type
TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::F32), // Mismatching data type
- TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::QASYMM8), // Bias not supported with QASYMM8
TensorInfo(TensorShape(10U, 12U, 2U), 1, DataType::QASYMM8), // Mismatching shapes
TensorInfo(TensorShape(10U, 12U, 2U, 2U), 1, DataType::QASYMM8),
}),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
- TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::QS8, 3),
TensorInfo(TensorShape(3U, 3U, 10U, 2U), 1, DataType::QASYMM8),
TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::QASYMM8),
TensorInfo(TensorShape(18U, 80U, 1U, 2U), 1, DataType::QASYMM8),
})),
- framework::dataset::make("HasBias", { true, true, true, true, false, false })),
- framework::dataset::make("Expected", { false, false, false, false, false, true })),
+ framework::dataset::make("HasBias", { true, true, true, false, false })),
+ framework::dataset::make("Expected", { false, false, false, false, true })),
input_info, output_info, has_bias, expected)
{
- bool status = bool(NEIm2Col::validate(&input_info, &output_info, Size2D(3U, 3U), PadStrideInfo(), has_bias, false, false));
+ bool status = bool(NEIm2Col::validate(&input_info, &output_info, Size2D(3U, 3U), PadStrideInfo(), has_bias));
ARM_COMPUTE_EXPECT(status == expected, framework::LogLevel::ERRORS);
}
// clang-format on
// *INDENT-ON*
template <typename T>
-using NEIm2ColFixture = Im2ColValidationFixture<Tensor, Accessor, NEIm2Col, T>;
+using NEIm2ColFixture = Im2ColValidationFixture<Tensor, Accessor, NEIm2Col, T, false>;
TEST_SUITE(Float)
TEST_SUITE(FP32)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)),
- conv_args))
+FIXTURE_DATA_TEST_CASE(RunSmall, NEIm2ColFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", false)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEIm2ColFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F32)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", false)))
{
// Validate output
validate(Accessor(_target), _reference);
@@ -89,8 +97,16 @@
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
TEST_SUITE(FP16)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEIm2ColFixture<half>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)),
- conv_args))
+FIXTURE_DATA_TEST_CASE(RunSmall, NEIm2ColFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", false)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEIm2ColFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::F16)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", false)))
{
// Validate output
validate(Accessor(_target), _reference);
@@ -102,8 +118,16 @@
TEST_SUITE_END()
TEST_SUITE(QASYMM8)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEIm2ColFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QASYMM8)),
- conv_args))
+FIXTURE_DATA_TEST_CASE(RunSmall, NEIm2ColFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::QASYMM8)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", false)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEIm2ColFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType", DataType::QASYMM8)),
+ conv_args),
+ framework::dataset::make("ChannelsFirstOutputNHWC", false)))
{
// Validate output
validate(Accessor(_target), _reference);
diff --git a/tests/validation/NEON/LaplacianPyramid.cpp b/tests/validation/NEON/LaplacianPyramid.cpp
new file mode 100644
index 0000000..456ae75
--- /dev/null
+++ b/tests/validation/NEON/LaplacianPyramid.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NELaplacianPyramid.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/LaplacianPyramidFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+const auto small_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 3);
+const auto large_laplacian_pyramid_levels = framework::dataset::make("NumLevels", 2, 5);
+
+const auto formats = combine(framework::dataset::make("FormatIn", Format::U8), framework::dataset::make("FormatOut", Format::S16));
+
+template <typename T>
+inline void validate_laplacian_pyramid(const Pyramid &target, const std::vector<SimpleTensor<T>> &reference, BorderMode border_mode)
+{
+ Tensor *level_image = target.get_pyramid_level(0);
+ ValidRegion valid_region = shape_to_valid_region(reference[0].shape(), border_mode == BorderMode::UNDEFINED, BorderSize(2));
+
+ // Validate lowest level
+ validate(Accessor(*level_image), reference[0], valid_region);
+
+ // Validate remaining levels
+ for(size_t lev = 1; lev < target.info()->num_levels(); lev++)
+ {
+ level_image = target.get_pyramid_level(lev);
+ Tensor *prev_level_image = target.get_pyramid_level(lev - 1);
+
+ valid_region = shape_to_valid_region_laplacian_pyramid(prev_level_image->info()->tensor_shape(),
+ prev_level_image->info()->valid_region(),
+ border_mode == BorderMode::UNDEFINED);
+
+ // Validate level
+ validate(Accessor(*level_image), reference[lev], valid_region);
+ }
+}
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(LaplacianPyramid)
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(
+ concat(datasets::Medium2DShapes(), datasets::Large2DShapes()),
+ datasets::BorderModes()),
+ large_laplacian_pyramid_levels),
+ shape, border_mode, num_levels)
+{
+ // Create pyramid info
+ PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, shape, Format::S16);
+ Pyramid dst_pyramid{};
+ dst_pyramid.init(pyramid_info);
+
+ // Create Tensors
+ Tensor src = create_tensor<Tensor>(shape, Format::U8);
+
+ // The first two dimensions of the output tensor must match the first two
+ // dimensions of the tensor in the last level of the pyramid
+ TensorShape dst_shape(shape);
+ dst_shape.set(0, dst_pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(0));
+ dst_shape.set(1, dst_pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(1));
+ Tensor dst = create_tensor<Tensor>(dst_shape, Format::S16);
+
+ // Create and configure function
+ NELaplacianPyramid laplacian_pyramid;
+ laplacian_pyramid.configure(&src, &dst_pyramid, &dst, border_mode, 0);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ for(size_t level = 0; level < pyramid_info.num_levels(); ++level)
+ {
+ ARM_COMPUTE_EXPECT(dst_pyramid.get_pyramid_level(level)->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+}
+
+using NELaplacianPyramidFixture = LaplacianPyramidValidationFixture<Tensor, Accessor, NELaplacianPyramid, uint8_t, int16_t, Pyramid>;
+
+FIXTURE_DATA_TEST_CASE(RunSmall, NELaplacianPyramidFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()),
+ small_laplacian_pyramid_levels),
+ formats))
+{
+ validate_laplacian_pyramid(_target, _reference, _border_mode);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NELaplacianPyramidFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ large_laplacian_pyramid_levels),
+ formats))
+{
+ validate_laplacian_pyramid(_target, _reference, _border_mode);
+}
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/NEON/LaplacianReconstruct.cpp b/tests/validation/NEON/LaplacianReconstruct.cpp
new file mode 100644
index 0000000..b41449e
--- /dev/null
+++ b/tests/validation/NEON/LaplacianReconstruct.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NELaplacianPyramid.h"
+#include "arm_compute/runtime/NEON/functions/NELaplacianReconstruct.h"
+#include "arm_compute/runtime/Pyramid.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/datasets/BorderModeDataset.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/LaplacianReconstructFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+const auto small_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 3);
+const auto large_laplacian_reconstruct_levels = framework::dataset::make("NumLevels", 2, 5);
+
+const auto formats = combine(framework::dataset::make("FormatIn", Format::S16), framework::dataset::make("FormatOut", Format::U8));
+
+template <typename T>
+void validate_laplacian_reconstruct(Tensor &target, const SimpleTensor<T> &reference, BorderMode border_mode, size_t num_levels)
+{
+ const unsigned int filter_size = 5;
+ const unsigned int border_size(filter_size / 2);
+
+ BorderSize border(std::pow(border_size, num_levels));
+
+ // Validate output
+ ValidRegion valid_region = shape_to_valid_region(reference.shape(), border_mode == BorderMode::UNDEFINED, border);
+ validate(Accessor(target), reference, valid_region);
+}
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(LaplacianReconstruct)
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(
+ concat(datasets::Medium2DShapes(), datasets::Large2DShapes()),
+ datasets::BorderModes()),
+ large_laplacian_reconstruct_levels),
+ shape, border_mode, num_levels)
+{
+ // Create pyramid info
+ PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, shape, Format::S16);
+ Pyramid dst_pyramid{};
+ dst_pyramid.init(pyramid_info);
+
+ // Create Tensors
+ Tensor src = create_tensor<Tensor>(shape, DataType::U8);
+
+ // The first two dimensions of the output tensor must match the first two
+ // dimensions of the tensor in the last level of the pyramid
+ TensorShape dst_shape(shape);
+ dst_shape.set(0, dst_pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(0));
+ dst_shape.set(1, dst_pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(1));
+ Tensor dst = create_tensor<Tensor>(dst_shape, DataType::S16);
+
+ // The dimensions of the reconstruct are the same as the src shape
+ Tensor rec_dst = create_tensor<Tensor>(shape, DataType::U8);
+
+ // Create and configure pyramid function
+ NELaplacianPyramid laplacian_pyramid;
+ laplacian_pyramid.configure(&src, &dst_pyramid, &dst, border_mode, 0);
+
+ // Create and configure reconstruct function
+ NELaplacianReconstruct laplacian_reconstruct;
+ laplacian_reconstruct.configure(&dst_pyramid, &dst, &rec_dst, border_mode, 0);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ for(size_t level = 0; level < pyramid_info.num_levels(); ++level)
+ {
+ ARM_COMPUTE_EXPECT(dst_pyramid.get_pyramid_level(level)->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+
+ ARM_COMPUTE_EXPECT(rec_dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+}
+
+using NELaplacianReconstructFixture = LaplacianReconstructValidationFixture<Tensor, Accessor, NELaplacianReconstruct, NELaplacianPyramid, int16_t, uint8_t, Pyramid>;
+
+FIXTURE_DATA_TEST_CASE(RunSmall, NELaplacianReconstructFixture, framework::DatasetMode::PRECOMMIT,
+ combine(combine(combine(
+ datasets::Medium2DShapes(),
+ datasets::BorderModes()),
+ small_laplacian_reconstruct_levels),
+ formats))
+{
+ validate_laplacian_reconstruct(_target, _reference, _border_mode, _pyramid_levels);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NELaplacianReconstructFixture, framework::DatasetMode::NIGHTLY,
+ combine(combine(combine(
+ datasets::Large2DShapes(),
+ datasets::BorderModes()),
+ large_laplacian_reconstruct_levels),
+ formats))
+{
+ validate_laplacian_reconstruct(_target, _reference, _border_mode, _pyramid_levels);
+}
+// clang-format on
+// *INDENT-ON*
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/NEON/LocallyConnected.cpp b/tests/validation/NEON/LocallyConnected.cpp
index 0c36ff6..bd0999d 100644
--- a/tests/validation/NEON/LocallyConnected.cpp
+++ b/tests/validation/NEON/LocallyConnected.cpp
@@ -51,41 +51,41 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching data type input/weights
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching data type input/bias
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching data type input/output
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching shape input/weights
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching shape input/bias
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Mismatching shape input/output
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0), // Asymmetric padding
- TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32, 0)
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/weights
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/bias
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/output
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching shape input/weights
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching shape input/bias
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching shape input/output
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Asymmetric padding
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32)
}),
- framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 274U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32, 0)
+ framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F16),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 274U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(3U, 3U, 5U, 21U, 275U), 1, DataType::F32)
})),
- framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 274U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(21U, 275U), 1, DataType::F32, 0)
+ framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F16),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 274U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32),
+ TensorInfo(TensorShape(21U, 275U), 1, DataType::F32)
})),
- framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 22U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32, 0)
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F16),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 22U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32)
})),
framework::dataset::make("PadStride", { PadStrideInfo(2, 1, 0, 0),
PadStrideInfo(2, 1, 0, 0),
diff --git a/tests/validation/NEON/Magnitude.cpp b/tests/validation/NEON/Magnitude.cpp
index 3b7562b..e1549a5 100644
--- a/tests/validation/NEON/Magnitude.cpp
+++ b/tests/validation/NEON/Magnitude.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -44,15 +44,6 @@
{
return AbsoluteTolerance<T>((MagnitudeType::L1NORM == magnitude_type) ? 0 : 1);
}
-
-#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-template <>
-AbsoluteTolerance<half_float::half> tolerance(MagnitudeType magnitude_type)
-{
- return AbsoluteTolerance<half_float::half>((MagnitudeType::L1NORM == magnitude_type) ? half(0.0) : half(1.0));
-}
-#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-
} // namespace
TEST_SUITE(NEON)
@@ -88,36 +79,22 @@
using NEMagnitudeFixture = MagnitudeValidationFixture<Tensor, Accessor, NEMagnitude, T>;
TEST_SUITE(S16)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", Format::S16)),
- framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })),
- framework::dataset::make("UseFP16", false)))
+FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format", Format::S16)),
+ framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })))
+
{
// Validate output
validate(Accessor(_target), _reference, tolerance<int16_t>(_magnitude_type));
}
-FIXTURE_DATA_TEST_CASE(RunLarge, NEMagnitudeFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S16)),
- framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })),
- framework::dataset::make("UseFP16", false)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NEMagnitudeFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), framework::dataset::make("Format", Format::S16)),
+ framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })))
{
// Validate output
validate(Accessor(_target), _reference, tolerance<int16_t>(_magnitude_type));
}
TEST_SUITE_END() // S16
-#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-TEST_SUITE(F16)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEMagnitudeFixture<half_float::half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), framework::dataset::make("Format",
- Format::S16)),
- framework::dataset::make("MagnitudeType", { MagnitudeType::L1NORM, MagnitudeType::L2NORM })),
- framework::dataset::make("UseFP16", true)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance<half_float::half>(_magnitude_type));
-}
-TEST_SUITE_END() // F16
-#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/NEON/NormalizationLayer.cpp b/tests/validation/NEON/NormalizationLayer.cpp
index f5918db..5ad82ce 100644
--- a/tests/validation/NEON/NormalizationLayer.cpp
+++ b/tests/validation/NEON/NormalizationLayer.cpp
@@ -45,17 +45,11 @@
{
/** Tolerance for float operations */
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-constexpr AbsoluteTolerance<float> tolerance_f16(0.001f);
+constexpr AbsoluteTolerance<float> tolerance_f16(0.1f);
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
constexpr AbsoluteTolerance<float> tolerance_f32(0.00001f);
-/** Tolerance for fixed point operations */
-constexpr AbsoluteTolerance<int8_t> tolerance_qs8(2);
-constexpr AbsoluteTolerance<int16_t> tolerance_qs16(4);
/** Input data set. */
-const auto NormalizationDatasetQS = combine(combine(combine(combine(datasets::TinyShapes(), datasets::NormalizationTypes()), framework::dataset::make("NormalizationSize", 3, 9, 2)),
- framework::dataset::make("Beta", { 0.5f, 1.f, 2.f })),
- framework::dataset::make("IsScaled", { true }));
const auto NormalizationDataset = combine(combine(combine(combine(datasets::SmallShapes(), datasets::NormalizationTypes()), framework::dataset::make("NormalizationSize", 3, 9, 2)),
framework::dataset::make("Beta", { 0.5f, 1.f, 2.f })),
framework::dataset::make("IsScaled", { true }));
@@ -70,31 +64,28 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type input/output
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching shapes
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Even normalization
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Non implemented IN_MAP_2D
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 4), // Mismatching fixed point position
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/output
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Even normalization
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Non implemented IN_MAP_2D
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
}),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
})),
framework::dataset::make("NormInfo", { NormalizationLayerInfo(NormType::IN_MAP_1D, 5),
NormalizationLayerInfo(NormType::IN_MAP_1D, 5),
NormalizationLayerInfo(NormType::IN_MAP_1D, 4),
NormalizationLayerInfo(NormType::IN_MAP_2D, 5),
NormalizationLayerInfo(NormType::IN_MAP_1D, 5),
- NormalizationLayerInfo(NormType::IN_MAP_1D, 5),
NormalizationLayerInfo(NormType::CROSS_MAP, 1),
})),
- framework::dataset::make("Expected", { false, false, false, false, false, false, true })),
+ framework::dataset::make("Expected", { false, false, false, false, false, true })),
input_info, output_info, norm_info, expected)
{
bool is_valid = bool(NENormalizationLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), norm_info));
@@ -136,47 +127,6 @@
TEST_SUITE_END()
TEST_SUITE_END()
-template <typename T>
-using NENormalizationLayerFixedPointFixture = NormalizationValidationFixedPointFixture<Tensor, Accessor, NENormalizationLayer, T>;
-
-TEST_SUITE(Quantized)
-TEST_SUITE(QS8)
-// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5
-FIXTURE_DATA_TEST_CASE(RunTiny, NENormalizationLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(NormalizationDatasetQS, framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs8);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NENormalizationLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(NormalizationDataset, framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs8);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14
-FIXTURE_DATA_TEST_CASE(RunTiny, NENormalizationLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(NormalizationDatasetQS, framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs16);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NENormalizationLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(NormalizationDataset, framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs16);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
TEST_SUITE_END()
TEST_SUITE_END()
} // namespace validation
diff --git a/tests/validation/NEON/PixelWiseMultiplication.cpp b/tests/validation/NEON/PixelWiseMultiplication.cpp
index 9304c8b..77da473 100644
--- a/tests/validation/NEON/PixelWiseMultiplication.cpp
+++ b/tests/validation/NEON/PixelWiseMultiplication.cpp
@@ -114,10 +114,6 @@
template <typename T>
using NEPixelWiseMultiplicationToF32Fixture = PixelWiseMultiplicationValidationFixture<Tensor, Accessor, NEPixelWiseMultiplication, T, float>;
template <typename T>
-using NEPixelWiseMultiplicationToQS8Fixture = PixelWiseMultiplicationValidationFixture<Tensor, Accessor, NEPixelWiseMultiplication, T, qint8_t>;
-template <typename T>
-using NEPixelWiseMultiplicationToQS16Fixture = PixelWiseMultiplicationValidationFixture<Tensor, Accessor, NEPixelWiseMultiplication, T, qint16_t>;
-template <typename T>
using NEPixelWiseMultiplicationBroadcastFixture = PixelWiseMultiplicationBroadcastValidationFixture<Tensor, Accessor, NEPixelWiseMultiplication, T, float>;
TEST_SUITE(NEON)
@@ -132,9 +128,7 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid scale
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8), // Invalid data type combination
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching data type
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2), // Invalid scale
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), // Mismatching data type
}),
framework::dataset::make("Input2Info",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
@@ -142,9 +136,7 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS16, 2),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
})),
framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
@@ -152,12 +144,10 @@
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
TensorInfo(TensorShape(48U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
- TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QS8, 2),
+ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
})),
- framework::dataset::make("Scale",{ scale_unity, scale_unity, scale_unity, -1.f, scale_unity, scale_unity, scale_unity, scale_unity, 3.f})),
- framework::dataset::make("Expected", { true, true, false, false, false, false, false, false, false })),
+ framework::dataset::make("Scale",{ scale_unity, scale_unity, scale_unity, -1.f, scale_unity, scale_unity, scale_unity})),
+ framework::dataset::make("Expected", { true, true, false, false, false, false, false })),
input1_info, input2_info, output_info, scale, expected)
{
bool has_error = bool(NEPixelWiseMultiplication::validate(&input1_info.clone()->set_is_resizable(false), &input2_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), scale, ConvertPolicy::WRAP, RoundingPolicy::TO_ZERO));
diff --git a/tests/validation/NEON/PoolingLayer.cpp b/tests/validation/NEON/PoolingLayer.cpp
index 165f4d6..d87cd76 100644
--- a/tests/validation/NEON/PoolingLayer.cpp
+++ b/tests/validation/NEON/PoolingLayer.cpp
@@ -50,11 +50,6 @@
framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(1, 2, 1, 1), PadStrideInfo(2, 2, 1, 0) })),
framework::dataset::make("ExcludePadding", { true, false }));
-/** Input data set for quantized data types */
-const auto PoolingLayerDatasetQS = combine(combine(combine(framework::dataset::make("PoolingType", { PoolingType::MAX, PoolingType::AVG }), framework::dataset::make("PoolingSize", { Size2D(2, 2), Size2D(3, 3) })),
- framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(1, 2, 1, 1), PadStrideInfo(2, 2, 1, 0) })),
- framework::dataset::make("ExcludePadding", { false }));
-
/** Input data set for asymmetric data type */
const auto PoolingLayerDatasetQASYMM8 = combine(combine(combine(framework::dataset::make("PoolingType", { PoolingType::MAX, PoolingType::AVG }), framework::dataset::make("PoolingSize", { Size2D(2, 2), Size2D(3, 3), Size2D(4, 4), Size2D(9, 9), Size2D(3, 7), Size2D(7, 8) })),
@@ -65,8 +60,6 @@
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
constexpr AbsoluteTolerance<float> tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for float types */
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
-constexpr AbsoluteTolerance<float> tolerance_qs8(0); /**< Tolerance value for comparing reference's output against implementation's output for quantized input */
-constexpr AbsoluteTolerance<float> tolerance_qs16(0); /**< Tolerance value for comparing reference's output against implementation's output for quantized input */
constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for 8-bit asymmetric type */
} // namespace
@@ -76,37 +69,31 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Mismatching data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Window shrink
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 4), // Mismatching fixed point position
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS16, 11), // Window shrink
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid pad/size combination
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Invalid pad/size combination
- TensorInfo(TensorShape(15U, 13U, 5U), 1, DataType::F32, 0), // Non-rectangular Global Pooling
- TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32, 0), // Invalid output Global Pooling
- TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid pad/size combination
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid pad/size combination
+ TensorInfo(TensorShape(15U, 13U, 5U), 1, DataType::F32), // Non-rectangular Global Pooling
+ TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32), // Invalid output Global Pooling
+ TensorInfo(TensorShape(13U, 13U, 5U), 1, DataType::F32),
}),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16, 0),
- TensorInfo(TensorShape(25U, 10U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::QS8, 5),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::QS16, 11),
- TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 16U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(2U, 2U, 5U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F16),
+ TensorInfo(TensorShape(25U, 10U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 16U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(1U, 1U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(2U, 2U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
})),
framework::dataset::make("PoolInfo", { PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 0, 0)),
PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 0, 0)),
- PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 0, 0)),
- PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 0, 0)),
PoolingLayerInfo(PoolingType::AVG, 2, PadStrideInfo(1, 1, 2, 0)),
PoolingLayerInfo(PoolingType::AVG, 2, PadStrideInfo(1, 1, 0, 2)),
PoolingLayerInfo(PoolingType::AVG),
PoolingLayerInfo(PoolingType::MAX),
PoolingLayerInfo(PoolingType::AVG),
})),
- framework::dataset::make("Expected", { false, false, false, false, false, false, true, false, false, true })),
+ framework::dataset::make("Expected", { false, false, false, false, true, false, false, true })),
input_info, output_info, pool_info, expected)
{
bool is_valid = bool(NEPoolingLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), pool_info));
@@ -165,45 +152,6 @@
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
TEST_SUITE_END() // Float
-template <typename T>
-using NEPoolingLayerFixedPointFixture = PoolingLayerValidationFixedPointFixture<Tensor, Accessor, NEPoolingLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEPoolingLayerFixedPointFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(datasets::TinyShapes(), combine(PoolingLayerDatasetQS,
- framework::dataset::make("DataType", DataType::QS8))),
- framework::dataset::make("FractionalBits", 1, 5)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs8);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEPoolingLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), combine(PoolingLayerDatasetQS,
- framework::dataset::make("DataType", DataType::QS8))),
- framework::dataset::make("FractionalBits", 1, 5)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs8);
-}
-TEST_SUITE_END() // QS8
-
-TEST_SUITE(QS16)
-FIXTURE_DATA_TEST_CASE(RunTiny, NEPoolingLayerFixedPointFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(datasets::TinyShapes(), combine(PoolingLayerDatasetQS,
- framework::dataset::make("DataType", DataType::QS16))),
- framework::dataset::make("FractionalBits", 1, 13)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs16);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NEPoolingLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SmallShapes(), combine(PoolingLayerDatasetQS,
- framework::dataset::make("DataType", DataType::QS16))),
- framework::dataset::make("FractionalBits", 1, 13)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_qs16);
-}
-TEST_SUITE_END() // QS16
-TEST_SUITE_END() // FixedPoint
-
TEST_SUITE(Quantized)
template <typename T>
diff --git a/tests/validation/NEON/RNNLayer.cpp b/tests/validation/NEON/RNNLayer.cpp
new file mode 100644
index 0000000..a5f8499
--- /dev/null
+++ b/tests/validation/NEON/RNNLayer.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/runtime/NEON/functions/NERNNLayer.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/PaddingCalculator.h"
+#include "tests/datasets/RNNLayerDataset.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/RNNLayerFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+RelativeTolerance<float> tolerance_f32(0.001f);
+RelativeTolerance<half> tolerance_f16(half(0.1));
+} // namespace
+
+TEST_SUITE(NEON)
+TEST_SUITE(RNNLayer)
+
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::U8), // Wrong data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Wrong input size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong weights size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong recurrent weights size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong bias size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong output size
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Wrong hidden output size
+ TensorInfo(TensorShape(32U, 32U), 1, DataType::F32),
+ }),
+ framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 32U), 1, DataType::F32),
+ })),
+ framework::dataset::make("RecurrentWeightsInfo", { TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 32U), 1, DataType::F32),
+ })),
+ framework::dataset::make("BiasInfo", { TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(30U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U), 1, DataType::F32),
+ })),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 32U), 1, DataType::F32),
+ })),
+ framework::dataset::make("HiddenStateInfo", { TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 13U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 32U), 1, DataType::F32),
+ })),
+ framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
+ })),
+ framework::dataset::make("Expected", { false, false, false, false, false, false, false, true })),
+ input_info, weights_info, recurrent_weights_info, bias_info, output_info, hidden_output_info, info, expected)
+{
+ ARM_COMPUTE_EXPECT(bool(NERNNLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &recurrent_weights_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), &hidden_output_info.clone()->set_is_resizable(false), info)) == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
+template <typename T>
+using NERNNLayerFixture = RNNLayerValidationFixture<Tensor, Accessor, NERNNLayer, T>;
+
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, NERNNLayerFixture<float>, framework::DatasetMode::ALL, combine(datasets::SmallRNNLayerDataset(), framework::dataset::make("DataType", DataType::F32)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_f32);
+}
+TEST_SUITE_END() // FP32
+
+#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
+TEST_SUITE(FP16)
+FIXTURE_DATA_TEST_CASE(RunSmall, NERNNLayerFixture<half>, framework::DatasetMode::ALL, combine(datasets::SmallRNNLayerDataset(), framework::dataset::make("DataType", DataType::F16)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference, tolerance_f16);
+}
+TEST_SUITE_END() // FP16
+#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
+TEST_SUITE_END() // RNNLayer
+TEST_SUITE_END() // NEON
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/NEON/SYSTEM/AlexNet.cpp b/tests/validation/NEON/SYSTEM/AlexNet.cpp
deleted file mode 100644
index 3fa19e4..0000000
--- a/tests/validation/NEON/SYSTEM/AlexNet.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/NEON/functions/NEActivationLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEDirectConvolutionLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h"
-#include "arm_compute/runtime/NEON/functions/NENormalizationLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h"
-#include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h"
-#include "arm_compute/runtime/SubTensor.h"
-#include "tests/NEON/Accessor.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/networks/AlexNetNetwork.h"
-#include "tests/validation/Validation.h"
-
-#include <string>
-#include <vector>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-using NEAlexNetModel = networks::AlexNetNetwork<ITensor,
- Tensor,
- SubTensor,
- Accessor,
- NEActivationLayer,
- NEConvolutionLayer,
- NEDirectConvolutionLayer,
- NEFullyConnectedLayer,
- NENormalizationLayer,
- NEPoolingLayer,
- NESoftmaxLayer>;
-std::vector<unsigned int> compute_alexnet(DataType dt, unsigned int batches, std::string input_file)
-{
- std::vector<std::string> weight_files = { "cnn_data/alexnet_model/conv1_w.npy",
- "cnn_data/alexnet_model/conv2_w.npy",
- "cnn_data/alexnet_model/conv3_w.npy",
- "cnn_data/alexnet_model/conv4_w.npy",
- "cnn_data/alexnet_model/conv5_w.npy",
- "cnn_data/alexnet_model/fc6_w.npy",
- "cnn_data/alexnet_model/fc7_w.npy",
- "cnn_data/alexnet_model/fc8_w.npy"
- };
-
- std::vector<std::string> bias_files = { "cnn_data/alexnet_model/conv1_b.npy",
- "cnn_data/alexnet_model/conv2_b.npy",
- "cnn_data/alexnet_model/conv3_b.npy",
- "cnn_data/alexnet_model/conv4_b.npy",
- "cnn_data/alexnet_model/conv5_b.npy",
- "cnn_data/alexnet_model/fc6_b.npy",
- "cnn_data/alexnet_model/fc7_b.npy",
- "cnn_data/alexnet_model/fc8_b.npy"
- };
- NEAlexNetModel network{};
-
- network.init(dt, 4, batches);
- network.build();
- network.allocate();
- network.fill(weight_files, bias_files);
- network.feed(std::move(input_file));
- network.run();
-
- return network.get_classifications();
-}
-} // namespace
-
-TEST_SUITE(NEON)
-TEST_SUITE(SYSTEM_TESTS)
-
-TEST_CASE(AlexNet, framework::DatasetMode::PRECOMMIT)
-{
- // Compute alexnet
- std::vector<unsigned int> classified_labels = compute_alexnet(DataType::F32, 1, "cnn_data/imagenet_data/cat.npy");
-
- // Expected labels
- std::vector<unsigned int> expected_labels = { 281 };
-
- // Validate labels
- validate(classified_labels, expected_labels);
-}
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/NEON/SYSTEM/LeNet5.cpp b/tests/validation/NEON/SYSTEM/LeNet5.cpp
deleted file mode 100644
index 95a82a6..0000000
--- a/tests/validation/NEON/SYSTEM/LeNet5.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/NEON/functions/NEActivationLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h"
-#include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h"
-#include "tests/NEON/Accessor.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/networks/LeNet5Network.h"
-#include "tests/validation/Validation.h"
-
-#include <string>
-#include <vector>
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-using NELeNet5Model = networks::LeNet5Network<Tensor,
- Accessor,
- NEActivationLayer,
- NEConvolutionLayer,
- NEFullyConnectedLayer,
- NEPoolingLayer,
- NESoftmaxLayer>;
-std::vector<unsigned int> compute_lenet5(unsigned int batches, std::string input_file)
-{
- std::vector<std::string> weight_files = { "cnn_data/lenet_model/conv1_w.npy",
- "cnn_data/lenet_model/conv2_w.npy",
- "cnn_data/lenet_model/ip1_w.npy",
- "cnn_data/lenet_model/ip2_w.npy"
- };
-
- std::vector<std::string> bias_files = { "cnn_data/lenet_model/conv1_b.npy",
- "cnn_data/lenet_model/conv2_b.npy",
- "cnn_data/lenet_model/ip1_b.npy",
- "cnn_data/lenet_model/ip2_b.npy"
- };
- NELeNet5Model network{};
- network.init(batches);
- network.build();
- network.allocate();
- network.fill(weight_files, bias_files);
- network.feed(std::move(input_file));
- network.run();
-
- return network.get_classifications();
-}
-} // namespace
-
-TEST_SUITE(NEON)
-TEST_SUITE(SYSTEM_TESTS)
-
-TEST_CASE(LeNet5, framework::DatasetMode::PRECOMMIT)
-{
- // Compute alexnet
- std::vector<unsigned int> classified_labels = compute_lenet5(10, "cnn_data/mnist_data/input10.npy");
-
- // Expected labels
- std::vector<unsigned int> expected_labels = { 7, 2, 1, 0, 4, 1, 4, 9, 5, 9 };
-
- // Validate labels
- validate(classified_labels, expected_labels);
-}
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/NEON/Scale.cpp b/tests/validation/NEON/Scale.cpp
index 8940259..0d4a86e 100644
--- a/tests/validation/NEON/Scale.cpp
+++ b/tests/validation/NEON/Scale.cpp
@@ -77,17 +77,17 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8, 0), // Mismatching data type
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Unsupported sampling point
- TensorInfo(TensorShape(4U, 27U, 13U), 1, DataType::F32, 0), // Invalid policy
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, 0), // Insufficient padding
- TensorInfo(TensorShape(4U, 27U, 13U), 1, DataType::F32, 0),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Mismatching data type
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported sampling point
+ TensorInfo(TensorShape(4U, 27U, 13U), 1, DataType::F32), // Invalid policy
+ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Insufficient padding
+ TensorInfo(TensorShape(4U, 27U, 13U), 1, DataType::F32),
}),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U, 132U, 25U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32, 0),
- TensorInfo(TensorShape(4U, 132U, 25U), 1, DataType::F32, 0),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U, 132U, 25U), 1, DataType::F32),
+ TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(4U, 132U, 25U), 1, DataType::F32),
})),
framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR,
InterpolationPolicy::NEAREST_NEIGHBOR,
@@ -159,8 +159,8 @@
shape_scaled.set(idx_height, src_shape[idx_height] * scale_y);
// Create tensors
- Tensor src = create_tensor<Tensor>(src_shape, data_type, 1, 0, QuantizationInfo(), data_layout);
- Tensor dst = create_tensor<Tensor>(shape_scaled, data_type, 1, 0, QuantizationInfo(), data_layout);
+ Tensor src = create_tensor<Tensor>(src_shape, data_type, 1, QuantizationInfo(), data_layout);
+ Tensor dst = create_tensor<Tensor>(shape_scaled, data_type, 1, QuantizationInfo(), data_layout);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
diff --git a/tests/validation/NEON/SoftmaxLayer.cpp b/tests/validation/NEON/SoftmaxLayer.cpp
index e091c02..a5d6344 100644
--- a/tests/validation/NEON/SoftmaxLayer.cpp
+++ b/tests/validation/NEON/SoftmaxLayer.cpp
@@ -45,10 +45,9 @@
/** Tolerance for float operations */
constexpr AbsoluteTolerance<float> tolerance_f32(0.000001f);
#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
-constexpr AbsoluteTolerance<float> tolerance_f16(0.0001f);
+constexpr RelativeTolerance<float> rel_tolerance_f16(0.1f);
+constexpr AbsoluteTolerance<float> abs_tolerance_f16(0.01f);
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC*/
-/** Tolerance for fixed point operations */
-constexpr AbsoluteTolerance<int16_t> tolerance_fixed_point(2);
/** Tolerance for quantized operations */
constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1);
@@ -60,8 +59,6 @@
DataType::F16,
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
DataType::F32,
- DataType::QS8,
- DataType::QS16,
});
} // namespace
@@ -70,12 +67,9 @@
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SoftmaxLayerSmallShapes(), datasets::SoftmaxLayerLargeShapes()), CNNDataTypes), shape, data_type)
{
- // Set fixed point position data type allowed
- const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
-
// Create tensors
- Tensor src = create_tensor<Tensor>(shape, data_type, 1, fixed_point_position);
- Tensor dst = create_tensor<Tensor>(shape, data_type, 1, fixed_point_position);
+ Tensor src = create_tensor<Tensor>(shape, data_type, 1);
+ Tensor dst = create_tensor<Tensor>(shape, data_type, 1);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -99,15 +93,15 @@
// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(
- framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data types
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 2), // Mismatching fixed point
- TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32),
+ framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching data types
+ TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching shapes
+ TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // Invalid input dimensionality
+ TensorInfo(TensorShape(32U, 16U), 1, DataType::F32),
}),
- framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16),
- TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32),
- TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QS8, 3),
- TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32),
+ framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U), 1, DataType::F16),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(27U, 11U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 16U), 1, DataType::F32),
})),
framework::dataset::make("Expected", { false, false, false, true })),
input_info, output_info, expected)
@@ -129,14 +123,14 @@
framework::dataset::make("Beta", { 1.0f, 2.0f })))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
}
FIXTURE_DATA_TEST_CASE(RunLarge, NESoftmaxLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SoftmaxLayerSmallShapes(),
framework::dataset::make("DataType", DataType::F16)),
framework::dataset::make("Beta", { 1.0f, 2.0f })))
{
// Validate output
- validate(Accessor(_target), _reference, tolerance_f16);
+ validate(Accessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16);
}
TEST_SUITE_END()
#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
@@ -160,49 +154,6 @@
TEST_SUITE_END()
template <typename T>
-using NESoftmaxLayerFixedPointFixture = SoftmaxValidationFixedPointFixture<Tensor, Accessor, NESoftmaxLayer, T>;
-
-TEST_SUITE(FixedPoint)
-TEST_SUITE(QS8)
-// Testing for fixed point position [1,6) as reciprocal limits the maximum fixed point position to 5
-FIXTURE_DATA_TEST_CASE(RunTiny, NESoftmaxLayerFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SoftmaxLayerTinyShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_fixed_point);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NESoftmaxLayerFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SoftmaxLayerSmallShapes(), framework::dataset::make("DataType",
- DataType::QS8)),
- framework::dataset::make("FractionalBits", 1, 6)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_fixed_point);
-}
-TEST_SUITE_END()
-
-TEST_SUITE(QS16)
-// Testing for fixed point position [1,14) as reciprocal limits the maximum fixed point position to 14
-FIXTURE_DATA_TEST_CASE(RunTiny, NESoftmaxLayerFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SoftmaxLayerTinyShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_fixed_point);
-}
-FIXTURE_DATA_TEST_CASE(RunSmall, NESoftmaxLayerFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::SoftmaxLayerSmallShapes(),
- framework::dataset::make("DataType",
- DataType::QS16)),
- framework::dataset::make("FractionalBits", 1, 14)))
-{
- // Validate output
- validate(Accessor(_target), _reference, tolerance_fixed_point);
-}
-TEST_SUITE_END()
-TEST_SUITE_END()
-
-template <typename T>
using NESoftmaxLayerQuantizedFixture = SoftmaxValidationQuantizedFixture<Tensor, Accessor, NESoftmaxLayer, T>;
TEST_SUITE(Quantized)
diff --git a/tests/validation/NEON/UNIT/TensorAllocator.cpp b/tests/validation/NEON/UNIT/TensorAllocator.cpp
index 872054f..7781107 100644
--- a/tests/validation/NEON/UNIT/TensorAllocator.cpp
+++ b/tests/validation/NEON/UNIT/TensorAllocator.cpp
@@ -23,9 +23,12 @@
*/
#include "arm_compute/runtime/TensorAllocator.h"
+#include "arm_compute/core/utils/misc/Utility.h"
#include "arm_compute/runtime/MemoryGroup.h"
#include "arm_compute/runtime/MemoryRegion.h"
+
#include "support/ToolchainSupport.h"
+
#include "tests/Utils.h"
#include "tests/framework/Asserts.h"
#include "tests/framework/Macros.h"
@@ -82,6 +85,22 @@
ARM_COMPUTE_EXPECT(t4.buffer() == nullptr, framework::LogLevel::ERRORS);
}
+TEST_CASE(AlignedAlloc, framework::DatasetMode::ALL)
+{
+ // Init tensor info
+ TensorInfo info(TensorShape(24U, 16U, 3U), 1, DataType::F32);
+ const size_t requested_alignment = 1024;
+
+ Tensor t;
+ t.allocator()->init(info, requested_alignment);
+ t.allocator()->allocate();
+
+ ARM_COMPUTE_EXPECT(t.buffer() != nullptr, framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(t.allocator()->alignment() == requested_alignment, framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(arm_compute::utility::check_aligned(reinterpret_cast<void *>(t.buffer()), requested_alignment),
+ framework::LogLevel::ERRORS);
+}
+
TEST_SUITE_END()
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/NEON/WarpAffine.cpp b/tests/validation/NEON/WarpAffine.cpp
index 8c83507..6180d69 100644
--- a/tests/validation/NEON/WarpAffine.cpp
+++ b/tests/validation/NEON/WarpAffine.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -64,8 +64,8 @@
uint8_t constant_border_value = distribution_u8(gen);
// Create the matrix
- std::array<float, 6> matrix{ {} };
- fill_warp_matrix<6>(matrix);
+ std::array<float, 9> matrix{ {} };
+ fill_warp_matrix<9>(matrix);
// Create tensors
Tensor src = create_tensor<Tensor>(shape, data_type);
@@ -76,7 +76,7 @@
// Create and configure function
NEWarpAffine warp_affine;
- warp_affine.configure(&src, &dst, matrix.data(), policy, border_mode, constant_border_value);
+ warp_affine.configure(&src, &dst, matrix, policy, border_mode, constant_border_value);
// Validate valid region
const ValidRegion valid_region = shape_to_valid_region(shape);
diff --git a/tests/validation/NEON/WarpPerspective.cpp b/tests/validation/NEON/WarpPerspective.cpp
index 804c080..6ec8bc2 100644
--- a/tests/validation/NEON/WarpPerspective.cpp
+++ b/tests/validation/NEON/WarpPerspective.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -78,7 +78,7 @@
// Create and configure function
NEWarpPerspective warp_perspective;
- warp_perspective.configure(&src, &dst, matrix.data(), policy, border_mode, constant_border_value);
+ warp_perspective.configure(&src, &dst, matrix, policy, border_mode, constant_border_value);
// Validate valid region
const ValidRegion valid_region = shape_to_valid_region(shape);
diff --git a/tests/validation/NEON/WidthConcatenateLayer.cpp b/tests/validation/NEON/WidthConcatenateLayer.cpp
new file mode 100644
index 0000000..6f3abe1
--- /dev/null
+++ b/tests/validation/NEON/WidthConcatenateLayer.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/NEON/functions/NEWidthConcatenateLayer.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/TensorAllocator.h"
+#include "tests/NEON/Accessor.h"
+#include "tests/datasets/ShapeDatasets.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "tests/validation/fixtures/WidthConcatenateLayerFixture.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+TEST_SUITE(NEON)
+TEST_SUITE(WidthConcatenateLayer)
+// *INDENT-OFF*
+// clang-format off
+DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
+ framework::dataset::make("InputInfo1", { TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching data type input/output
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching y dimension
+ TensorInfo(TensorShape(23U, 27U, 5U), 1, DataType::F32), // Mismatching total width
+ TensorInfo(TensorShape(16U, 27U, 5U), 1, DataType::F32)
+ }),
+ framework::dataset::make("InputInfo2", { TensorInfo(TensorShape(24U, 27U, 4U), 1, DataType::F32),
+ TensorInfo(TensorShape(52U, 27U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(52U, 27U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(16U, 27U, 5U), 1, DataType::F32)
+ })),
+ framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(47U, 27U, 5U), 1, DataType::F16),
+ TensorInfo(TensorShape(75U, 12U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(11U, 27U, 5U), 1, DataType::F32),
+ TensorInfo(TensorShape(32U, 27U, 5U), 1, DataType::F32)
+ })),
+ framework::dataset::make("Expected", { false, false, false, true })),
+ input_info1, input_info2, output_info,expected)
+{
+ std::vector<TensorInfo> inputs_vector_info;
+ inputs_vector_info.emplace_back(std::move(input_info1));
+ inputs_vector_info.emplace_back(std::move(input_info2));
+
+ std::vector<ITensorInfo *> inputs_vector_info_raw;
+ for(auto &input : inputs_vector_info)
+ {
+ inputs_vector_info_raw.emplace_back(&input);
+ }
+
+ bool is_valid = bool(NEWidthConcatenateLayer::validate(inputs_vector_info_raw,
+ &output_info.clone()->set_is_resizable(false)));
+ ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
+}
+// clang-format on
+// *INDENT-ON*
+
+TEST_CASE(Configuration, framework::DatasetMode::ALL)
+{
+ // Create tensors
+ Tensor src1 = create_tensor<Tensor>(TensorShape(128U, 32U, 32U), DataType::F32, 1);
+ Tensor src2 = create_tensor<Tensor>(TensorShape(32U, 32U, 32U), DataType::F32, 1);
+ Tensor src3 = create_tensor<Tensor>(TensorShape(15U, 32U, 32U), DataType::F32, 1);
+ Tensor dst;
+
+ ARM_COMPUTE_EXPECT(src1.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(src2.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(src3.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create and configure function
+ NEWidthConcatenateLayer concat_layer;
+
+ concat_layer.configure({ &src1, &src2, &src3 }, &dst);
+}
+
+template <typename T>
+using NEWidthConcatenateLayerFixture = WidthConcatenateLayerValidationFixture<Tensor, ITensor, Accessor, NEWidthConcatenateLayer, T>;
+
+TEST_SUITE(Float)
+TEST_SUITE(FP32)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEWidthConcatenateLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType",
+ DataType::F32)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEWidthConcatenateLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::WidthConcatenateLayerShapes(), framework::dataset::make("DataType",
+ DataType::F32)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+TEST_SUITE_END()
+TEST_SUITE_END()
+
+TEST_SUITE(Quantized)
+TEST_SUITE(QASYMM8)
+FIXTURE_DATA_TEST_CASE(RunSmall, NEWidthConcatenateLayerFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType",
+ DataType::QASYMM8)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NEWidthConcatenateLayerFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::WidthConcatenateLayerShapes(), framework::dataset::make("DataType",
+ DataType::QASYMM8)))
+{
+ // Validate output
+ validate(Accessor(_target), _reference);
+}
+TEST_SUITE_END()
+TEST_SUITE_END()
+
+TEST_SUITE_END()
+TEST_SUITE_END()
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/UNIT/FixedPoint.cpp b/tests/validation/UNIT/FixedPoint.cpp
deleted file mode 100644
index 5c39b20..0000000
--- a/tests/validation/UNIT/FixedPoint.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "tests/validation/FixedPoint.h"
-
-#include "tests/Globals.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/framework/datasets/Datasets.h"
-#include "tests/validation/Validation.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace
-{
-const auto FuncNamesDataset = framework::dataset::make("FunctionNames", { FixedPointOp::ADD,
- FixedPointOp::SUB,
- FixedPointOp::MUL,
- FixedPointOp::EXP,
- FixedPointOp::LOG,
- FixedPointOp::INV_SQRT
- });
-
-template <typename T>
-void load_array_from_numpy(const std::string &file, std::vector<unsigned long> &shape, std::vector<T> &data) // NOLINT
-{
- try
- {
- npy::LoadArrayFromNumpy(file, shape, data);
- }
- catch(const std::runtime_error &e)
- {
- throw framework::FileNotFound("Could not load npy file: " + file + " (" + e.what() + ")");
- }
-}
-} // namespace
-
-TEST_SUITE(UNIT)
-TEST_SUITE(FixedPoint)
-
-// *INDENT-OFF*
-// clang-format off
-DATA_TEST_CASE(FixedPointQS8Inputs, framework::DatasetMode::ALL, combine(
- FuncNamesDataset,
- framework::dataset::make("FractionalBits", 1, 7)),
- func_name, frac_bits)
-// clang-format on
-// *INDENT-ON*
-{
- std::vector<double> data;
- std::vector<unsigned long> shape; //NOLINT
-
- std::string func_name_lower = to_string(func_name);
- std::transform(func_name_lower.begin(), func_name_lower.end(), func_name_lower.begin(), ::tolower);
-
- const std::string inputs_file = library->path()
- + "fixed_point/"
- + func_name_lower
- + "_Q8."
- + support::cpp11::to_string(frac_bits)
- + ".in.npy";
-
- load_array_from_numpy(inputs_file, shape, data);
-
- // Values stored as doubles so reinterpret as floats
- const auto *float_val = reinterpret_cast<float *>(&data[0]);
- const size_t num_elements = data.size() * sizeof(double) / sizeof(float);
-
- for(unsigned int i = 0; i < num_elements; ++i)
- {
- // Convert to fixed point
- fixed_point_arithmetic::fixed_point<int8_t> in_val(float_val[i], frac_bits);
-
- // Check that the value didn't change
- ARM_COMPUTE_EXPECT(static_cast<float>(in_val) == float_val[i], framework::LogLevel::ERRORS);
- }
-}
-
-// *INDENT-OFF*
-// clang-format off
-DATA_TEST_CASE(FixedPointQS8Outputs, framework::DatasetMode::ALL, zip(combine(
- FuncNamesDataset,
- framework::dataset::make("FractionalBits", 1, 7)),
- framework::dataset::make("ExpectedFailures", { 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 7, 8, 13, 2, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 5, 33, 96 })),
- func_name, frac_bits, expected_failures)
-// clang-format on
-// *INDENT-ON*
-{
- std::vector<double> in_data;
- std::vector<unsigned long> in_shape; //NOLINT
-
- std::vector<double> out_data;
- std::vector<unsigned long> out_shape; //NOLINT
-
- std::string func_name_lower = to_string(func_name);
- std::transform(func_name_lower.begin(), func_name_lower.end(), func_name_lower.begin(), ::tolower);
-
- const std::string base_file_name = library->path()
- + "fixed_point/"
- + func_name_lower
- + "_Q8."
- + support::cpp11::to_string(frac_bits);
-
- const std::string inputs_file = base_file_name + ".in.npy";
- const std::string reference_file = base_file_name + ".out.npy";
-
- load_array_from_numpy(inputs_file, in_shape, in_data);
- load_array_from_numpy(reference_file, out_shape, out_data);
-
- ARM_COMPUTE_EXPECT(in_shape.front() == out_shape.front(), framework::LogLevel::ERRORS);
-
- const float step_size = std::pow(2.f, -frac_bits);
- int64_t num_mismatches = 0;
-
- // Values stored as doubles so reinterpret as floats
- const auto *float_val = reinterpret_cast<float *>(&in_data[0]);
- const auto *ref_val = reinterpret_cast<float *>(&out_data[0]);
-
- const size_t num_elements = in_data.size() * sizeof(double) / sizeof(float);
-
- for(unsigned int i = 0; i < num_elements; ++i)
- {
- fixed_point_arithmetic::fixed_point<int8_t> in_val(float_val[i], frac_bits);
- fixed_point_arithmetic::fixed_point<int8_t> out_val(0.f, frac_bits);
-
- float tolerance = 0.f;
-
- if(func_name == FixedPointOp::ADD)
- {
- out_val = in_val + in_val;
- }
- else if(func_name == FixedPointOp::SUB)
- {
- out_val = in_val - in_val; //NOLINT
- }
- else if(func_name == FixedPointOp::MUL)
- {
- tolerance = 1.f * step_size;
- out_val = in_val * in_val;
- }
- else if(func_name == FixedPointOp::EXP)
- {
- tolerance = 2.f * step_size;
- out_val = fixed_point_arithmetic::exp(in_val);
- }
- else if(func_name == FixedPointOp::LOG)
- {
- tolerance = 4.f * step_size;
- out_val = fixed_point_arithmetic::log(in_val);
- }
- else if(func_name == FixedPointOp::INV_SQRT)
- {
- tolerance = 5.f * step_size;
- out_val = fixed_point_arithmetic::inv_sqrt(in_val);
- }
-
- if(std::abs(static_cast<float>(out_val) - ref_val[i]) > tolerance)
- {
- ARM_COMPUTE_TEST_INFO("input = " << in_val);
- ARM_COMPUTE_TEST_INFO("output = " << out_val);
- ARM_COMPUTE_TEST_INFO("reference = " << ref_val[i]);
- ARM_COMPUTE_TEST_INFO("tolerance = " << tolerance);
-
- ARM_COMPUTE_TEST_INFO((std::abs(static_cast<float>(out_val) - ref_val[i]) <= tolerance));
-
- ++num_mismatches;
- }
- }
-
- ARM_COMPUTE_EXPECT(num_mismatches == expected_failures, framework::LogLevel::ERRORS);
-}
-
-TEST_SUITE_END()
-TEST_SUITE_END()
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/UNIT/GPUTarget.cpp b/tests/validation/UNIT/GPUTarget.cpp
index 62e0b1d..eabfa1f 100644
--- a/tests/validation/UNIT/GPUTarget.cpp
+++ b/tests/validation/UNIT/GPUTarget.cpp
@@ -47,7 +47,7 @@
ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G51") == GPUTarget::G51, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G51BIG") == GPUTarget::G51BIG, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G51LIT") == GPUTarget::G51LIT, framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(get_target_from_name("Mali-TNOX") == GPUTarget::TNOX, framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(get_target_from_name("Mali-G76") == GPUTarget::G76, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(get_target_from_name("Mali-TTRX") == GPUTarget::TTRX, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(get_target_from_name("Mali-TBOX") == GPUTarget::TBOX, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(get_target_from_name("Mali-T000") == GPUTarget::MIDGARD, framework::LogLevel::ERRORS);
diff --git a/tests/validation/UNIT/TensorInfo.cpp b/tests/validation/UNIT/TensorInfo.cpp
index dd7ae6d..b78f656 100644
--- a/tests/validation/UNIT/TensorInfo.cpp
+++ b/tests/validation/UNIT/TensorInfo.cpp
@@ -112,12 +112,6 @@
ARM_COMPUTE_EXPECT(info.data_type() == DataType::S32, framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(info.num_channels() == 3, framework::LogLevel::ERRORS);
- // Update data type channels and set fixed point position
- info.set_data_type(DataType::QS8).set_num_channels(1).set_fixed_point_position(3);
- ARM_COMPUTE_EXPECT(info.data_type() == DataType::QS8, framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(info.num_channels() == 1, framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(info.fixed_point_position() == 3, framework::LogLevel::ERRORS);
-
// Update data type and set quantization info
info.set_data_type(DataType::QASYMM8).set_quantization_info(QuantizationInfo(0.5f, 15));
ARM_COMPUTE_EXPECT(info.data_type() == DataType::QASYMM8, framework::LogLevel::ERRORS);
diff --git a/tests/validation/UNIT/WindowIterator.cpp b/tests/validation/UNIT/WindowIterator.cpp
new file mode 100644
index 0000000..402cab4
--- /dev/null
+++ b/tests/validation/UNIT/WindowIterator.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "arm_compute/core/WindowIterator.h"
+#include "tests/Utils.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Macros.h"
+#include "tests/framework/datasets/Datasets.h"
+#include "tests/validation/Validation.h"
+#include "utils/TypePrinter.h"
+
+#include <stdexcept>
+
+using namespace arm_compute;
+using namespace arm_compute::test;
+using namespace arm_compute::test::validation;
+
+TEST_SUITE(UNIT)
+TEST_SUITE(WindowIterator)
+
+template <typename Dim, typename... Dims>
+Window create_window(Dim &&dim0, Dims &&... dims)
+{
+ Window win;
+ const std::array < Dim, 1 + sizeof...(Dims) > dimensions{ { dim0, std::forward<Dims>(dims)... } };
+ for(size_t i = 0; i < dimensions.size(); i++)
+ {
+ win.set(i, dimensions[i]);
+ }
+ return win;
+}
+
+template <typename T>
+std::vector<T> create_vector(std::initializer_list<T> list_objs)
+{
+ std::vector<T> vec_objs;
+ for(auto it : list_objs)
+ {
+ vec_objs.push_back(it);
+ }
+ return vec_objs;
+}
+
+DATA_TEST_CASE(WholeWindow, framework::DatasetMode::ALL, zip(framework::dataset::make("Window", { create_window(Window::Dimension(0, 1)),
+ create_window(Window::Dimension(1, 5, 2), Window::Dimension(3, 5)),
+ create_window(Window::Dimension(4, 16, 4), Window::Dimension(3, 13, 5), Window::Dimension(1, 3, 2))
+ }),
+ framework::dataset::make("Expected", { create_vector({ Coordinates(0, 0) }),
+ create_vector({ Coordinates(1, 3), Coordinates(3, 3), Coordinates(1, 4), Coordinates(3, 4) }),
+ create_vector({ Coordinates(4, 3, 1), Coordinates(8, 3, 1), Coordinates(12, 3, 1), Coordinates(4, 8, 1), Coordinates(8, 8, 1), Coordinates(12, 8, 1) })
+ })),
+ window, expected)
+{
+ unsigned int i = 0;
+ int row_size = 0;
+ TensorShape window_shape = window.shape();
+ Coordinates start_offset = index2coords(window_shape, 0);
+ Coordinates end_offset = index2coords(window_shape, window.num_iterations_total() - 1);
+ auto window_iterator = create_window_iterator(window, start_offset, end_offset, [&](const Coordinates & id)
+ {
+ ARM_COMPUTE_EXPECT_EQUAL(row_size, (window[0].end() - window[0].start()), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_ASSERT(i < expected.size());
+ Coordinates expected_coords = expected[i++];
+ //Set number of dimensions to the maximum (To match the number of dimensions used by the id passed to the lambda function)
+ expected_coords.set_num_dimensions(Coordinates::num_max_dimensions);
+ ARM_COMPUTE_EXPECT_EQUAL(id, expected_coords, framework::LogLevel::ERRORS);
+ });
+ window_iterator.iterate_3D([&](int start, int end)
+ {
+ ARM_COMPUTE_EXPECT_EQUAL(window[0].start(), start, framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT_EQUAL(window[0].end(), end, framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(end > start, framework::LogLevel::ERRORS);
+ row_size = end - start;
+ });
+ ARM_COMPUTE_EXPECT_EQUAL(i, expected.size(), framework::LogLevel::ERRORS);
+}
+
+DATA_TEST_CASE(PartialWindow2D, framework::DatasetMode::ALL, zip(zip(zip(combine(framework::dataset::make("Window",
+ create_window(Window::Dimension(4, 20, 4), Window::Dimension(3, 32, 5), Window::Dimension(1, 2, 1))),
+ framework::dataset::make("Start", { 0, 1, 3, 2, 4 })),
+ framework::dataset::make("End", { 0, 2, 5, 8, 7 })),
+ framework::dataset::make("RowSize",
+{
+ create_vector({ 4 }),
+ create_vector({ 8, 8 }),
+ create_vector({ 4, 8, 8 }),
+ create_vector({ 8, 8, 16, 16, 16, 16, 4 }),
+ create_vector({ 16, 16, 16, 16 }),
+})),
+framework::dataset::make("Expected", { create_vector({ Coordinates(4, 3, 1) }), create_vector({ Coordinates(8, 3, 1), Coordinates(12, 3, 1) }), create_vector({ Coordinates(16, 3, 1), Coordinates(4, 8, 1), Coordinates(8, 8, 1) }), create_vector({ Coordinates(12, 3, 1), Coordinates(16, 3, 1), Coordinates(4, 8, 1), Coordinates(8, 8, 1), Coordinates(12, 8, 1), Coordinates(16, 8, 1), Coordinates(4, 13, 1) }), create_vector({ Coordinates(4, 8, 1), Coordinates(8, 8, 1), Coordinates(12, 8, 1), Coordinates(16, 8, 1) }) })),
+window, start, end, expected_row_size, expected)
+{
+ unsigned int i = 0;
+ int row_size = 0;
+ TensorShape window_shape = window.shape();
+ Coordinates start_offset = index2coords(window_shape, start);
+ Coordinates end_offset = index2coords(window_shape, end);
+ auto window_iterator = create_window_iterator(window, start_offset, end_offset, [&](const Coordinates & id)
+ {
+ ARM_COMPUTE_ASSERT(i < expected.size());
+ ARM_COMPUTE_EXPECT_EQUAL(expected_row_size[i], row_size, framework::LogLevel::ERRORS);
+ Coordinates expected_coords = expected[i++];
+ //Set number of dimensions to the maximum (To match the number of dimensions used by the id passed to the lambda function)
+ expected_coords.set_num_dimensions(Coordinates::num_max_dimensions);
+ ARM_COMPUTE_EXPECT_EQUAL(id, expected_coords, framework::LogLevel::ERRORS);
+ });
+ window_iterator.iterate_3D([&](int start, int end)
+ {
+ ARM_COMPUTE_EXPECT(start >= window[0].start(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(end <= window[0].end(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(end > start, framework::LogLevel::ERRORS);
+ row_size = end - start;
+ });
+ ARM_COMPUTE_EXPECT_EQUAL(i, expected.size(), framework::LogLevel::ERRORS);
+}
+
+TEST_SUITE_END()
+TEST_SUITE_END()
diff --git a/tests/validation/Validation.cpp b/tests/validation/Validation.cpp
index d01ac12..0bc1d96 100644
--- a/tests/validation/Validation.cpp
+++ b/tests/validation/Validation.cpp
@@ -62,14 +62,10 @@
return *reinterpret_cast<const uint8_t *>(ptr);
case DataType::S8:
return *reinterpret_cast<const int8_t *>(ptr);
- case DataType::QS8:
- return *reinterpret_cast<const qint8_t *>(ptr);
case DataType::U16:
return *reinterpret_cast<const uint16_t *>(ptr);
case DataType::S16:
return *reinterpret_cast<const int16_t *>(ptr);
- case DataType::QS16:
- return *reinterpret_cast<const qint16_t *>(ptr);
case DataType::U32:
return *reinterpret_cast<const uint32_t *>(ptr);
case DataType::S32:
diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h
index ac3643e..9ce597b 100644
--- a/tests/validation/Validation.h
+++ b/tests/validation/Validation.h
@@ -24,7 +24,6 @@
#ifndef __ARM_COMPUTE_TEST_VALIDATION_H__
#define __ARM_COMPUTE_TEST_VALIDATION_H__
-#include "arm_compute/core/FixedPoint.h"
#include "arm_compute/core/IArray.h"
#include "arm_compute/core/Types.h"
#include "support/ToolchainSupport.h"
@@ -448,7 +447,7 @@
const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches
- << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)");
+ << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number * 100 << "%)");
ARM_COMPUTE_EXPECT(num_mismatches <= absolute_tolerance_number, framework::LogLevel::ERRORS);
}
}
@@ -536,7 +535,7 @@
const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches
- << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)");
+ << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number * 100 << "%)");
ARM_COMPUTE_EXPECT(num_mismatches <= absolute_tolerance_number, framework::LogLevel::ERRORS);
}
}
@@ -615,7 +614,7 @@
const float percent_mismatches = static_cast<float>(num_mismatches) / num_elements * 100.f;
ARM_COMPUTE_TEST_INFO(num_mismatches << " values (" << std::fixed << std::setprecision(2) << percent_mismatches
- << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number << "%)");
+ << "%) mismatched (maximum tolerated " << std::setprecision(2) << tolerance_number * 100 << "%)");
ARM_COMPUTE_EXPECT(num_mismatches <= absolute_tolerance_number, framework::LogLevel::ERRORS);
}
}
diff --git a/tests/validation/fixtures/ActivationLayerFixture.h b/tests/validation/fixtures/ActivationLayerFixture.h
index e212c7b..d29d67c 100644
--- a/tests/validation/fixtures/ActivationLayerFixture.h
+++ b/tests/validation/fixtures/ActivationLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -47,17 +47,16 @@
{
public:
template <typename...>
- void setup(TensorShape shape, bool in_place, ActivationLayerInfo::ActivationFunction function, float alpha_beta, DataType data_type, int fractional_bits, QuantizationInfo quantization_info)
+ void setup(TensorShape shape, bool in_place, ActivationLayerInfo::ActivationFunction function, float alpha_beta, DataType data_type, QuantizationInfo quantization_info)
{
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
_data_type = data_type;
_function = function;
ActivationLayerInfo info(function, alpha_beta, alpha_beta);
- _target = compute_target(shape, in_place, info, data_type, fractional_bits, quantization_info);
- _reference = compute_reference(shape, info, data_type, fractional_bits, quantization_info);
+ _target = compute_target(shape, in_place, info, data_type, quantization_info);
+ _reference = compute_reference(shape, info, data_type, quantization_info);
}
protected:
@@ -80,17 +79,17 @@
{
int min_bound = 0;
int max_bound = 0;
- std::tie(min_bound, max_bound) = get_activation_layer_test_bounds<T>(_function, _data_type, _fractional_bits);
+ std::tie(min_bound, max_bound) = get_activation_layer_test_bounds<T>(_function, _data_type);
std::uniform_int_distribution<> distribution(min_bound, max_bound);
library->fill(tensor, distribution, 0);
}
}
- TensorType compute_target(const TensorShape &shape, bool in_place, ActivationLayerInfo info, DataType data_type, int fixed_point_position, QuantizationInfo quantization_info)
+ TensorType compute_target(const TensorShape &shape, bool in_place, ActivationLayerInfo info, DataType data_type, QuantizationInfo quantization_info)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, quantization_info);
- TensorType dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, quantization_info);
+ TensorType src = create_tensor<TensorType>(shape, data_type, 1, quantization_info);
+ TensorType dst = create_tensor<TensorType>(shape, data_type, 1, quantization_info);
// Create and configure function
FunctionType act_layer;
@@ -128,10 +127,10 @@
}
}
- SimpleTensor<T> compute_reference(const TensorShape &shape, ActivationLayerInfo info, DataType data_type, int fixed_point_position, QuantizationInfo quantization_info)
+ SimpleTensor<T> compute_reference(const TensorShape &shape, ActivationLayerInfo info, DataType data_type, QuantizationInfo quantization_info)
{
// Create reference
- SimpleTensor<T> src{ shape, data_type, 1, fixed_point_position, quantization_info };
+ SimpleTensor<T> src{ shape, data_type, 1, quantization_info };
// Fill reference
fill(src);
@@ -141,7 +140,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
QuantizationInfo _quantization_info{};
DataType _data_type{};
ActivationLayerInfo::ActivationFunction _function{};
@@ -154,18 +152,7 @@
template <typename...>
void setup(TensorShape shape, bool in_place, ActivationLayerInfo::ActivationFunction function, float alpha_beta, DataType data_type)
{
- ActivationValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, in_place, function, alpha_beta, data_type, 0, QuantizationInfo());
- }
-};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class ActivationValidationFixedPointFixture : public ActivationValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape shape, bool in_place, ActivationLayerInfo::ActivationFunction function, float alpha_beta, DataType data_type, int fractional_bits)
- {
- ActivationValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, in_place, function, alpha_beta, data_type, fractional_bits, QuantizationInfo());
+ ActivationValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, in_place, function, alpha_beta, data_type, QuantizationInfo());
}
};
@@ -176,7 +163,7 @@
template <typename...>
void setup(TensorShape shape, bool in_place, ActivationLayerInfo::ActivationFunction function, float alpha_beta, DataType data_type, QuantizationInfo quantization_info)
{
- ActivationValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, in_place, function, alpha_beta, data_type, 0, quantization_info);
+ ActivationValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, in_place, function, alpha_beta, data_type, quantization_info);
}
};
diff --git a/tests/validation/fixtures/ArithmeticAdditionFixture.h b/tests/validation/fixtures/ArithmeticAdditionFixture.h
index f3888ae..6687593 100644
--- a/tests/validation/fixtures/ArithmeticAdditionFixture.h
+++ b/tests/validation/fixtures/ArithmeticAdditionFixture.h
@@ -41,14 +41,15 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class ArithmeticAdditionBroadcastValidationFixedPointFixture : public framework::Fixture
+class ArithmeticAdditionGenericFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy, int fractional_bits)
+ void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy,
+ QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out)
{
- _target = compute_target(shape0, shape1, data_type0, data_type1, output_data_type, convert_policy, fractional_bits);
- _reference = compute_reference(shape0, shape1, data_type0, data_type1, output_data_type, convert_policy, fractional_bits);
+ _target = compute_target(shape0, shape1, data_type0, data_type1, output_data_type, convert_policy, qinfo0, qinfo1, qinfo_out);
+ _reference = compute_reference(shape0, shape1, data_type0, data_type1, output_data_type, convert_policy, qinfo0, qinfo1, qinfo_out);
}
protected:
@@ -59,12 +60,12 @@
}
TensorType compute_target(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy,
- int fixed_point_position)
+ QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out)
{
// Create tensors
- TensorType ref_src1 = create_tensor<TensorType>(shape0, data_type0, 1, fixed_point_position);
- TensorType ref_src2 = create_tensor<TensorType>(shape1, data_type1, 1, fixed_point_position);
- TensorType dst = create_tensor<TensorType>(TensorShape::broadcast_shape(shape0, shape1), output_data_type, 1, fixed_point_position);
+ TensorType ref_src1 = create_tensor<TensorType>(shape0, data_type0, 1, qinfo0);
+ TensorType ref_src2 = create_tensor<TensorType>(shape1, data_type1, 1, qinfo1);
+ TensorType dst = create_tensor<TensorType>(TensorShape::broadcast_shape(shape0, shape1), output_data_type, 1, qinfo_out);
// Create and configure function
FunctionType add;
@@ -93,18 +94,20 @@
return dst;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy,
- int fixed_point_position)
+ SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1,
+ DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy,
+ QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out)
{
// Create reference
- SimpleTensor<T> ref_src1{ shape0, data_type0, 1, fixed_point_position };
- SimpleTensor<T> ref_src2{ shape1, data_type1, 1, fixed_point_position };
+ SimpleTensor<T> ref_src1{ shape0, data_type0, 1, qinfo0 };
+ SimpleTensor<T> ref_src2{ shape1, data_type1, 1, qinfo1 };
+ SimpleTensor<T> ref_dst{ TensorShape::broadcast_shape(shape0, shape1), output_data_type, 1, qinfo_out };
// Fill reference
fill(ref_src1, 0);
fill(ref_src2, 1);
- return reference::arithmetic_addition<T>(ref_src1, ref_src2, output_data_type, convert_policy);
+ return reference::arithmetic_addition<T>(ref_src1, ref_src2, ref_dst, convert_policy);
}
TensorType _target{};
@@ -112,35 +115,40 @@
};
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class ArithmeticAdditionBroadcastValidationFixture : public ArithmeticAdditionBroadcastValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
+class ArithmeticAdditionBroadcastValidationFixture : public ArithmeticAdditionGenericFixture<TensorType, AccessorType, FunctionType, T>
{
public:
template <typename...>
void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy)
{
- ArithmeticAdditionBroadcastValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape0, shape1, data_type0, data_type1, output_data_type, convert_policy, 0);
+ ArithmeticAdditionGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape0, shape1, data_type0, data_type1,
+ output_data_type, convert_policy, QuantizationInfo(), QuantizationInfo(), QuantizationInfo());
}
};
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class ArithmeticAdditionValidationFixedPointFixture : public ArithmeticAdditionBroadcastValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy, int fractional_bits)
- {
- ArithmeticAdditionBroadcastValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, shape, data_type0, data_type1, output_data_type, convert_policy, fractional_bits);
- }
-};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class ArithmeticAdditionValidationFixture : public ArithmeticAdditionValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
+class ArithmeticAdditionValidationFixture : public ArithmeticAdditionGenericFixture<TensorType, AccessorType, FunctionType, T>
{
public:
template <typename...>
void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy)
{
- ArithmeticAdditionValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type0, data_type1, output_data_type, convert_policy, 0);
+ ArithmeticAdditionGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, shape, data_type0, data_type1,
+ output_data_type, convert_policy, QuantizationInfo(), QuantizationInfo(), QuantizationInfo());
+ }
+};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class ArithmeticAdditionValidationQuantizedFixture : public ArithmeticAdditionGenericFixture<TensorType, AccessorType, FunctionType, T>
+{
+public:
+ template <typename...>
+ void setup(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy,
+ QuantizationInfo qinfo0, QuantizationInfo qinfo1, QuantizationInfo qinfo_out)
+
+ {
+ ArithmeticAdditionGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, shape, data_type0, data_type1,
+ output_data_type, convert_policy, qinfo0, qinfo1, qinfo_out);
}
};
} // namespace validation
diff --git a/tests/validation/fixtures/ArithmeticDivisionFixture.h b/tests/validation/fixtures/ArithmeticDivisionFixture.h
new file mode 100644
index 0000000..cf9db95
--- /dev/null
+++ b/tests/validation/fixtures/ArithmeticDivisionFixture.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_ARITHMETIC_DIVISION_FIXTURE
+#define ARM_COMPUTE_TEST_ARITHMETIC_DIVISION_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/Helpers.h"
+#include "tests/validation/reference/ArithmeticDivision.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class ArithmeticDivisionBroadcastValidationFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(const TensorShape &shape0, const TensorShape &shape1, DataType data_type)
+ {
+ _target = compute_target(shape0, shape1, data_type);
+ _reference = compute_reference(shape0, shape1, data_type);
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, int i)
+ {
+ std::uniform_real_distribution<> distribution(1.0f, 5.0f);
+ library->fill(tensor, distribution, i);
+ }
+
+ TensorType compute_target(const TensorShape &shape0, const TensorShape &shape1, DataType data_type)
+ {
+ // Create tensors
+ TensorType ref_src1 = create_tensor<TensorType>(shape0, data_type, 1);
+ TensorType ref_src2 = create_tensor<TensorType>(shape1, data_type, 1);
+ TensorType dst = create_tensor<TensorType>(TensorShape::broadcast_shape(shape0, shape1), data_type);
+
+ // Create and configure function
+ FunctionType add;
+ add.configure(&ref_src1, &ref_src2, &dst);
+
+ ARM_COMPUTE_EXPECT(ref_src1.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(ref_src2.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Allocate tensors
+ ref_src1.allocator()->allocate();
+ ref_src2.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ ARM_COMPUTE_EXPECT(!ref_src1.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!ref_src2.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Fill tensors
+ fill(AccessorType(ref_src1), 0);
+ fill(AccessorType(ref_src2), 1);
+
+ // Compute function
+ add.run();
+
+ return dst;
+ }
+
+ SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, DataType data_type)
+ {
+ // Create reference
+ SimpleTensor<T> ref_src1{ shape0, data_type, 1 };
+ SimpleTensor<T> ref_src2{ shape1, data_type, 1 };
+
+ // Fill reference
+ fill(ref_src1, 0);
+ fill(ref_src2, 1);
+
+ return reference::arithmetic_division<T>(ref_src1, ref_src2, data_type);
+ }
+
+ TensorType _target{};
+ SimpleTensor<T> _reference{};
+};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class ArithmeticDivisionValidationFixture : public ArithmeticDivisionBroadcastValidationFixture<TensorType, AccessorType, FunctionType, T>
+{
+public:
+ template <typename...>
+ void setup(const TensorShape &shape, DataType data_type)
+ {
+ ArithmeticDivisionBroadcastValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, shape, data_type);
+ }
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_ARITHMETIC_DIVISION_FIXTURE */
diff --git a/tests/validation/fixtures/ArithmeticSubtractionFixture.h b/tests/validation/fixtures/ArithmeticSubtractionFixture.h
index ba0dd14..9897677 100644
--- a/tests/validation/fixtures/ArithmeticSubtractionFixture.h
+++ b/tests/validation/fixtures/ArithmeticSubtractionFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -41,15 +41,14 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T1, typename T2 = T1, typename T3 = T1>
-class ArithmeticSubtractionValidationFixedPointFixture : public framework::Fixture
+class ArithmeticSubtractionValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy, int fractional_bits)
+ void setup(TensorShape shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy)
{
- _fractional_bits = fractional_bits;
- _target = compute_target(shape, data_type0, data_type1, output_data_type, convert_policy, fractional_bits);
- _reference = compute_reference(shape, data_type0, data_type1, output_data_type, convert_policy, fractional_bits);
+ _target = compute_target(shape, data_type0, data_type1, output_data_type, convert_policy);
+ _reference = compute_reference(shape, data_type0, data_type1, output_data_type, convert_policy);
}
protected:
@@ -59,12 +58,12 @@
library->fill_tensor_uniform(tensor, i);
}
- TensorType compute_target(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy, int fixed_point_position)
+ TensorType compute_target(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy)
{
// Create tensors
- TensorType ref_src1 = create_tensor<TensorType>(shape, data_type0, 1, fixed_point_position);
- TensorType ref_src2 = create_tensor<TensorType>(shape, data_type1, 1, fixed_point_position);
- TensorType dst = create_tensor<TensorType>(shape, output_data_type, 1, fixed_point_position);
+ TensorType ref_src1 = create_tensor<TensorType>(shape, data_type0, 1);
+ TensorType ref_src2 = create_tensor<TensorType>(shape, data_type1, 1);
+ TensorType dst = create_tensor<TensorType>(shape, output_data_type, 1);
// Create and configure function
FunctionType sub;
@@ -93,11 +92,11 @@
return dst;
}
- SimpleTensor<T3> compute_reference(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy, int fixed_point_position)
+ SimpleTensor<T3> compute_reference(const TensorShape &shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy)
{
// Create reference
- SimpleTensor<T1> ref_src1{ shape, data_type0, 1, fixed_point_position };
- SimpleTensor<T2> ref_src2{ shape, data_type1, 1, fixed_point_position };
+ SimpleTensor<T1> ref_src1{ shape, data_type0, 1 };
+ SimpleTensor<T2> ref_src2{ shape, data_type1, 1 };
// Fill reference
fill(ref_src1, 0);
@@ -108,17 +107,6 @@
TensorType _target{};
SimpleTensor<T3> _reference{};
- int _fractional_bits{};
-};
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T1, typename T2 = T1, typename T3 = T1>
-class ArithmeticSubtractionValidationFixture : public ArithmeticSubtractionValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T1, T2, T3>
-{
-public:
- template <typename...>
- void setup(TensorShape shape, DataType data_type0, DataType data_type1, DataType output_data_type, ConvertPolicy convert_policy)
- {
- ArithmeticSubtractionValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T1, T2, T3>::setup(shape, data_type0, data_type1, output_data_type, convert_policy, 0);
- }
};
} // namespace validation
} // namespace test
diff --git a/tests/validation/fixtures/BatchNormalizationLayerFixture.h b/tests/validation/fixtures/BatchNormalizationLayerFixture.h
index b7e32a6..65e89b9 100644
--- a/tests/validation/fixtures/BatchNormalizationLayerFixture.h
+++ b/tests/validation/fixtures/BatchNormalizationLayerFixture.h
@@ -41,19 +41,18 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class BatchNormalizationLayerValidationFixedPointFixture : public framework::Fixture
+class BatchNormalizationLayerValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape0, TensorShape shape1, float epsilon, bool use_beta, bool use_gamma, ActivationLayerInfo act_info, DataType dt, DataLayout data_layout, int fractional_bits)
+ void setup(TensorShape shape0, TensorShape shape1, float epsilon, bool use_beta, bool use_gamma, ActivationLayerInfo act_info, DataType dt, DataLayout data_layout)
{
- _fractional_bits = fractional_bits;
- _data_type = dt;
- _use_beta = use_beta;
- _use_gamma = use_gamma;
+ _data_type = dt;
+ _use_beta = use_beta;
+ _use_gamma = use_gamma;
- _target = compute_target(shape0, shape1, epsilon, act_info, dt, data_layout, fractional_bits);
- _reference = compute_reference(shape0, shape1, epsilon, act_info, dt, fractional_bits);
+ _target = compute_target(shape0, shape1, epsilon, act_info, dt, data_layout);
+ _reference = compute_reference(shape0, shape1, epsilon, act_info, dt);
}
protected:
@@ -93,7 +92,7 @@
{
int min_bound = 0;
int max_bound = 0;
- std::tie(min_bound, max_bound) = get_batchnormalization_layer_test_bounds<T>(_fractional_bits);
+ std::tie(min_bound, max_bound) = get_batchnormalization_layer_test_bounds<T>();
std::uniform_int_distribution<> distribution(min_bound, max_bound);
std::uniform_int_distribution<> distribution_var(0, max_bound);
library->fill(src_tensor, distribution, 0);
@@ -115,12 +114,12 @@
else
{
// Fill with default value 1
- library->fill_tensor_value(gamma_tensor, static_cast<T>(1 << (_fractional_bits)));
+ library->fill_tensor_value(gamma_tensor, static_cast<T>(1));
}
}
}
- TensorType compute_target(TensorShape shape0, const TensorShape &shape1, float epsilon, ActivationLayerInfo act_info, DataType dt, DataLayout data_layout, int fixed_point_position)
+ TensorType compute_target(TensorShape shape0, const TensorShape &shape1, float epsilon, ActivationLayerInfo act_info, DataType dt, DataLayout data_layout)
{
if(data_layout == DataLayout::NHWC)
{
@@ -128,12 +127,12 @@
}
// Create tensors
- TensorType src = create_tensor<TensorType>(shape0, dt, 1, fixed_point_position, QuantizationInfo(), data_layout);
- TensorType dst = create_tensor<TensorType>(shape0, dt, 1, fixed_point_position, QuantizationInfo(), data_layout);
- TensorType mean = create_tensor<TensorType>(shape1, dt, 1, fixed_point_position);
- TensorType var = create_tensor<TensorType>(shape1, dt, 1, fixed_point_position);
- TensorType beta = create_tensor<TensorType>(shape1, dt, 1, fixed_point_position);
- TensorType gamma = create_tensor<TensorType>(shape1, dt, 1, fixed_point_position);
+ TensorType src = create_tensor<TensorType>(shape0, dt, 1, QuantizationInfo(), data_layout);
+ TensorType dst = create_tensor<TensorType>(shape0, dt, 1, QuantizationInfo(), data_layout);
+ TensorType mean = create_tensor<TensorType>(shape1, dt, 1);
+ TensorType var = create_tensor<TensorType>(shape1, dt, 1);
+ TensorType beta = create_tensor<TensorType>(shape1, dt, 1);
+ TensorType gamma = create_tensor<TensorType>(shape1, dt, 1);
// Create and configure function
FunctionType norm;
@@ -172,39 +171,27 @@
return dst;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, float epsilon, ActivationLayerInfo act_info, DataType dt, int fixed_point_position)
+ SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, float epsilon, ActivationLayerInfo act_info, DataType dt)
{
// Create reference
- SimpleTensor<T> ref_src{ shape0, dt, 1, fixed_point_position };
- SimpleTensor<T> ref_mean{ shape1, dt, 1, fixed_point_position };
- SimpleTensor<T> ref_var{ shape1, dt, 1, fixed_point_position };
- SimpleTensor<T> ref_beta{ shape1, dt, 1, fixed_point_position };
- SimpleTensor<T> ref_gamma{ shape1, dt, 1, fixed_point_position };
+ SimpleTensor<T> ref_src{ shape0, dt, 1 };
+ SimpleTensor<T> ref_mean{ shape1, dt, 1 };
+ SimpleTensor<T> ref_var{ shape1, dt, 1 };
+ SimpleTensor<T> ref_beta{ shape1, dt, 1 };
+ SimpleTensor<T> ref_gamma{ shape1, dt, 1 };
// Fill reference
fill(ref_src, ref_mean, ref_var, ref_beta, ref_gamma);
- return reference::batch_normalization_layer(ref_src, ref_mean, ref_var, ref_beta, ref_gamma, epsilon, act_info, fixed_point_position);
+ return reference::batch_normalization_layer(ref_src, ref_mean, ref_var, ref_beta, ref_gamma, epsilon, act_info);
}
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
DataType _data_type{};
bool _use_beta{};
bool _use_gamma{};
};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class BatchNormalizationLayerValidationFixture : public BatchNormalizationLayerValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape shape0, TensorShape shape1, float epsilon, bool use_beta, bool use_gamma, ActivationLayerInfo act_info, DataType dt, DataLayout data_layout)
- {
- BatchNormalizationLayerValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape0, shape1, epsilon, use_beta, use_gamma, act_info, dt, data_layout, 0);
- }
-};
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/CannyEdgeFixture.h b/tests/validation/fixtures/CannyEdgeFixture.h
new file mode 100644
index 0000000..a51ee5c
--- /dev/null
+++ b/tests/validation/fixtures/CannyEdgeFixture.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE
+#define ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/Helpers.h"
+#include "tests/validation/reference/CannyEdgeDetector.h"
+
+namespace arm_compute
+{
+class CLCannyEdge;
+class NECannyEdge;
+
+namespace test
+{
+namespace validation
+{
+template <typename TensorType, typename AccessorType, typename ArrayType, typename FunctionType, typename T>
+class CannyEdgeValidationFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(std::string image, int gradient_size, MagnitudeType norm_type, BorderMode border_mode, bool use_fp16, Format format)
+ {
+ CannyEdgeParameters params = canny_edge_parameters();
+
+ _target = compute_target(image, gradient_size, norm_type, border_mode, use_fp16, format, params);
+ _reference = compute_reference(image, gradient_size, norm_type, border_mode, format, params);
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, RawTensor raw)
+ {
+ library->fill(tensor, raw);
+ }
+
+ template <typename F, typename std::enable_if<std::is_same<F, NECannyEdge>::value, int>::type = 0>
+ void configure_target(F &func, TensorType &src, TensorType &dst, int gradient_size, int norm_type, BorderMode border_mode, bool use_fp16, const CannyEdgeParameters ¶ms)
+ {
+ func.configure(&src, &dst, params.upper_thresh, params.lower_thresh, gradient_size, norm_type, border_mode, params.constant_border_value, use_fp16);
+ }
+
+ template <typename F, typename std::enable_if<std::is_same<F, CLCannyEdge>::value, int>::type = 0>
+ void configure_target(F &func, TensorType &src, TensorType &dst, int gradient_size, int norm_type, BorderMode border_mode, bool use_fp16, const CannyEdgeParameters ¶ms)
+ {
+ ARM_COMPUTE_UNUSED(use_fp16);
+ ARM_COMPUTE_ERROR_ON(use_fp16);
+ func.configure(&src, &dst, params.upper_thresh, params.lower_thresh, gradient_size, norm_type, border_mode, params.constant_border_value);
+ }
+
+ TensorType compute_target(const std::string &image, int gradient_size, MagnitudeType norm_type, BorderMode border_mode, bool use_fp16, Format format, const CannyEdgeParameters ¶ms)
+ {
+ // Load the image (cached by the library if loaded before)
+ const RawTensor &raw = library->get(image, format);
+
+ // Create tensors
+ TensorType src = create_tensor<TensorType>(raw.shape(), format);
+ TensorType dst = create_tensor<TensorType>(raw.shape(), format);
+ src.info()->set_format(format);
+ dst.info()->set_format(format);
+
+ // Create Canny edge configure function
+ FunctionType canny_edge;
+ configure_target<FunctionType>(canny_edge, src, dst, gradient_size, static_cast<int>(norm_type) + 1, border_mode, use_fp16, params);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Fill tensors
+ fill(AccessorType(src), raw);
+
+ // Compute function
+ canny_edge.run();
+
+ return dst;
+ }
+
+ SimpleTensor<T> compute_reference(const std::string &image, int gradient_size, MagnitudeType norm_type, BorderMode border_mode, Format format, const CannyEdgeParameters ¶ms)
+ {
+ ARM_COMPUTE_ERROR_ON(format != Format::U8);
+
+ // Load the image (cached by the library if loaded before)
+ const RawTensor &raw = library->get(image, format);
+
+ // Create reference
+ SimpleTensor<T> src{ raw.shape(), format };
+
+ // Fill reference
+ fill(src, raw);
+
+ return reference::canny_edge_detector<T>(src, params.upper_thresh, params.lower_thresh, gradient_size, norm_type, border_mode, params.constant_border_value);
+ }
+
+ TensorType _target{};
+ SimpleTensor<T> _reference{};
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE */
diff --git a/tests/validation/fixtures/Col2ImFixture.h b/tests/validation/fixtures/Col2ImFixture.h
new file mode 100644
index 0000000..ddc78a5
--- /dev/null
+++ b/tests/validation/fixtures/Col2ImFixture.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_COL2IM_FIXTURE
+#define ARM_COMPUTE_TEST_COL2IM_FIXTURE
+
+#include "arm_compute/core/Helpers.h"
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "arm_compute/core/utils/misc/ShapeCalculator.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/reference/Col2Im.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+using namespace arm_compute::misc::shape_calculator;
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class Col2ImValidationFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape input_shape, const unsigned int convolved_width, unsigned int convolved_height, unsigned int num_groups, DataType data_type)
+ {
+ const std::pair<unsigned int, unsigned int> convolved_dims(convolved_width, convolved_height);
+
+ const TensorShape output_shape = compute_col2im_shape(TensorInfo(input_shape, 1, data_type), convolved_dims, num_groups);
+
+ _target = compute_target(input_shape, output_shape, convolved_dims, num_groups, data_type);
+ _reference = compute_reference(input_shape, output_shape, num_groups, data_type);
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, const int seed)
+ {
+ library->fill_tensor_uniform(tensor, seed);
+ }
+
+ TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, std::pair<unsigned int, unsigned int> convolved_dims, unsigned int num_groups, DataType data_type)
+ {
+ // Create tensors
+ TensorType src = create_tensor<TensorType>(input_shape, data_type);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type);
+
+ // Create and configure function
+ FunctionType col2im_func;
+ col2im_func.configure(&src, &dst, convolved_dims, num_groups);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Fill tensors
+ fill(AccessorType(src), 0);
+
+ // Compute function
+ col2im_func.run();
+
+ return dst;
+ }
+
+ SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, unsigned int num_groups, DataType data_type)
+ {
+ // Create reference
+ SimpleTensor<T> src{ input_shape, data_type };
+
+ // Fill reference
+ fill(src, 0);
+
+ return reference::col2im<T>(src, output_shape, num_groups);
+ }
+ TensorType _target{};
+ SimpleTensor<T> _reference{};
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_COL2IM_FIXTURE */
diff --git a/tests/validation/fixtures/ColorConvertFixture.h b/tests/validation/fixtures/ColorConvertFixture.h
new file mode 100644
index 0000000..cbaff6d
--- /dev/null
+++ b/tests/validation/fixtures/ColorConvertFixture.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE
+#define ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/Helpers.h"
+#include "tests/validation/reference/ColorConvert.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace
+{
+}
+template <typename MultiImageType, typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class ColorConvertValidationFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape shape, Format src_format, Format dst_format)
+ {
+ shape = adjust_odd_shape(shape, src_format);
+ shape = adjust_odd_shape(shape, dst_format);
+
+ _target = compute_target(shape, src_format, dst_format);
+ _reference = compute_reference(shape, src_format, dst_format);
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, int i)
+ {
+ library->fill_tensor_uniform(tensor, i);
+ }
+
+ std::vector<SimpleTensor<T>> create_tensor_planes_reference(const TensorShape &shape, Format format)
+ {
+ std::vector<SimpleTensor<T>> tensor_planes;
+
+ switch(format)
+ {
+ case Format::RGB888:
+ case Format::RGBA8888:
+ case Format::YUYV422:
+ case Format::UYVY422:
+ {
+ tensor_planes.emplace_back(shape, format);
+ break;
+ }
+ case Format::NV12:
+ case Format::NV21:
+ {
+ const TensorShape shape_uv88 = calculate_subsampled_shape(shape, Format::UV88);
+
+ tensor_planes.emplace_back(shape, Format::U8);
+ tensor_planes.emplace_back(shape_uv88, Format::UV88);
+ break;
+ }
+ case Format::IYUV:
+ {
+ const TensorShape shape_sub2 = calculate_subsampled_shape(shape, Format::IYUV);
+
+ tensor_planes.emplace_back(shape, Format::U8);
+ tensor_planes.emplace_back(shape_sub2, Format::U8);
+ tensor_planes.emplace_back(shape_sub2, Format::U8);
+ break;
+ }
+ case Format::YUV444:
+ {
+ tensor_planes.emplace_back(shape, Format::U8);
+ tensor_planes.emplace_back(shape, Format::U8);
+ tensor_planes.emplace_back(shape, Format::U8);
+ break;
+ }
+ default:
+ ARM_COMPUTE_ERROR("Not supported");
+ break;
+ }
+
+ return tensor_planes;
+ }
+
+ MultiImageType compute_target(const TensorShape &shape, Format src_format, Format dst_format)
+ {
+ _src_num_planes = num_planes_from_format(src_format);
+ _dst_num_planes = num_planes_from_format(dst_format);
+
+ // Create tensors
+ MultiImageType ref_src = create_multi_image<MultiImageType>(shape, src_format);
+ MultiImageType ref_dst = create_multi_image<MultiImageType>(shape, dst_format);
+
+ // Create and configure function
+ FunctionType color_convert;
+
+ if(1U == _src_num_planes)
+ {
+ const TensorType *plane_src = static_cast<TensorType *>(ref_src.plane(0));
+
+ if(1U == _dst_num_planes)
+ {
+ TensorType *plane_dst = static_cast<TensorType *>(ref_dst.plane(0));
+ color_convert.configure(plane_src, plane_dst);
+ }
+ else
+ {
+ color_convert.configure(plane_src, &ref_dst);
+ }
+ }
+ else
+ {
+ if(1U == _dst_num_planes)
+ {
+ TensorType *plane_dst = static_cast<TensorType *>(ref_dst.plane(0));
+ color_convert.configure(&ref_src, plane_dst);
+ }
+ else
+ {
+ color_convert.configure(&ref_src, &ref_dst);
+ }
+ }
+
+ for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx)
+ {
+ const TensorType *src_plane = static_cast<const TensorType *>(ref_src.plane(plane_idx));
+
+ ARM_COMPUTE_EXPECT(src_plane->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ const TensorType *dst_plane = static_cast<const TensorType *>(ref_dst.plane(plane_idx));
+
+ ARM_COMPUTE_EXPECT(dst_plane->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+
+ // Allocate tensors
+ ref_src.allocate();
+ ref_dst.allocate();
+
+ for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx)
+ {
+ const TensorType *src_plane = static_cast<const TensorType *>(ref_src.plane(plane_idx));
+ ARM_COMPUTE_EXPECT(!src_plane->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+
+ for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx)
+ {
+ const TensorType *dst_plane = static_cast<const TensorType *>(ref_dst.plane(plane_idx));
+ ARM_COMPUTE_EXPECT(!dst_plane->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+
+ // Fill tensor planes
+ for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx)
+ {
+ TensorType *src_plane = static_cast<TensorType *>(ref_src.plane(plane_idx));
+
+ fill(AccessorType(*src_plane), plane_idx);
+ }
+
+ // Compute function
+ color_convert.run();
+
+ return ref_dst;
+ }
+
+ std::vector<SimpleTensor<T>> compute_reference(const TensorShape &shape, Format src_format, Format dst_format)
+ {
+ // Create reference
+ std::vector<SimpleTensor<T>> ref_src = create_tensor_planes_reference(shape, src_format);
+
+ // Fill references
+ for(unsigned int plane_idx = 0; plane_idx < ref_src.size(); ++plane_idx)
+ {
+ fill(ref_src[plane_idx], plane_idx);
+ }
+
+ return reference::color_convert<T>(shape, ref_src, src_format, dst_format);
+ }
+
+ unsigned int _src_num_planes{};
+ unsigned int _dst_num_planes{};
+ MultiImageType _target{};
+ std::vector<SimpleTensor<T>> _reference{};
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE */
diff --git a/tests/validation/fixtures/ConvolutionFixture.h b/tests/validation/fixtures/ConvolutionFixture.h
index 8ebb924..741ebe5 100644
--- a/tests/validation/fixtures/ConvolutionFixture.h
+++ b/tests/validation/fixtures/ConvolutionFixture.h
@@ -66,56 +66,17 @@
if(is_separable)
{
- create_separable_conv(conv.data());
+ init_separable_conv(conv.data(), width, height, library->seed());
}
else
{
- create_conv(conv.data());
+ init_conv(conv.data(), width, height, library->seed());
}
_target = compute_target(shape, output_data_type, conv.data(), scale, border_mode, constant_border_value);
_reference = compute_reference(shape, output_data_type, conv.data(), scale, border_mode, constant_border_value);
}
- void
- create_conv(int16_t *conv)
- {
- std::mt19937 gen(library->seed());
- std::uniform_int_distribution<int16_t> distribution_int16(-32768, 32767);
-
- for(unsigned int i = 0; i < _width * _height; ++i)
- {
- conv[i] = distribution_int16(gen);
- }
- }
-
- void
- create_separable_conv(int16_t *conv)
- {
- std::mt19937 gen(library->seed());
- // Set it between -128 and 127 to ensure the matrix does not overflow
- std::uniform_int_distribution<int16_t> distribution_int16(-128, 127);
-
- int16_t conv_row[_width];
- int16_t conv_col[_height];
-
- conv_row[0] = conv_col[0] = 1;
- for(unsigned int i = 1; i < _width; ++i)
- {
- conv_row[i] = distribution_int16(gen);
- conv_col[i] = distribution_int16(gen);
- }
-
- // Multiply two matrices
- for(unsigned int i = 0; i < _width; ++i)
- {
- for(unsigned int j = 0; j < _height; ++j)
- {
- conv[i * _width + j] = conv_col[i] * conv_row[j];
- }
- }
- }
-
template <typename U>
void fill(U &&tensor, int i)
{
diff --git a/tests/validation/fixtures/ConvolutionLayerFixture.h b/tests/validation/fixtures/ConvolutionLayerFixture.h
index 93de24d..3b420ea 100644
--- a/tests/validation/fixtures/ConvolutionLayerFixture.h
+++ b/tests/validation/fixtures/ConvolutionLayerFixture.h
@@ -57,12 +57,11 @@
public:
template <typename...>
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, bool reshape_weights,
- DataType data_type, DataLayout data_layout, int fractional_bits, QuantizationInfo quantization_info, ActivationLayerInfo act_info)
+ DataType data_type, DataLayout data_layout, QuantizationInfo quantization_info, ActivationLayerInfo act_info)
{
_data_type = data_type;
_is_quantized = is_data_type_quantized_asymmetric(data_type);
_bias_data_type = _is_quantized ? DataType::S32 : data_type;
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
_data_layout = data_layout;
@@ -103,6 +102,10 @@
TensorType compute_target(TensorShape input_shape, TensorShape weights_shape, const TensorShape &bias_shape, TensorShape output_shape, const PadStrideInfo &info,
bool reshape_weights, const Size2D &dilation, const ActivationLayerInfo act_info)
{
+ ARM_COMPUTE_ERROR_ON((input_shape[2] % weights_shape[2]) != 0);
+
+ const unsigned int num_groups = input_shape[2] / weights_shape[2];
+
if(_data_layout == DataLayout::NHWC)
{
permute(input_shape, PermutationVector(2U, 0U, 1U));
@@ -117,14 +120,14 @@
TensorShape reshaped_weights_shape(weights_shape);
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, _data_type, 1, _fractional_bits, _quantization_info, _data_layout);
- TensorType weights = create_tensor<TensorType>(reshaped_weights_shape, _data_type, 1, _fractional_bits, _quantization_info, _data_layout);
- TensorType bias = create_tensor<TensorType>(bias_shape, _bias_data_type, 1, _fractional_bits, _quantization_info, _data_layout);
- TensorType dst = create_tensor<TensorType>(output_shape, _data_type, 1, _fractional_bits, _quantization_info, _data_layout);
+ TensorType src = create_tensor<TensorType>(input_shape, _data_type, 1, _quantization_info, _data_layout);
+ TensorType weights = create_tensor<TensorType>(reshaped_weights_shape, _data_type, 1, _quantization_info, _data_layout);
+ TensorType bias = create_tensor<TensorType>(bias_shape, _bias_data_type, 1, _quantization_info, _data_layout);
+ TensorType dst = create_tensor<TensorType>(output_shape, _data_type, 1, _quantization_info, _data_layout);
// Create and configure function
FunctionType conv;
- conv.configure(&src, &weights, &bias, &dst, info, weights_info, dilation, act_info);
+ conv.configure(&src, &weights, &bias, &dst, info, weights_info, dilation, act_info, num_groups);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -156,19 +159,23 @@
SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, const PadStrideInfo &info,
const Size2D &dilation, const ActivationLayerInfo act_info)
{
+ ARM_COMPUTE_ERROR_ON((input_shape[2] % weights_shape[2]) != 0);
+
+ const unsigned int num_groups = input_shape[2] / weights_shape[2];
+
// Create reference
- SimpleTensor<T> src{ input_shape, _data_type, 1, _fractional_bits, _quantization_info };
- SimpleTensor<T> weights{ weights_shape, _data_type, 1, _fractional_bits, _quantization_info };
- SimpleTensor<TBias> bias{ bias_shape, _bias_data_type, 1, _fractional_bits, _quantization_info };
+ SimpleTensor<T> src{ input_shape, _data_type, 1, _quantization_info };
+ SimpleTensor<T> weights{ weights_shape, _data_type, 1, _quantization_info };
+ SimpleTensor<TBias> bias{ bias_shape, _bias_data_type, 1, _quantization_info };
// Fill reference
fill(src, 0);
fill(weights, 1);
fill(bias, 2);
- return (act_info.enabled()) ? reference::activation_layer<T>(reference::convolution_layer<T>(src, weights, bias, output_shape, info, dilation),
+ return (act_info.enabled()) ? reference::activation_layer<T>(reference::convolution_layer<T>(src, weights, bias, output_shape, info, dilation, num_groups),
act_info) :
- reference::convolution_layer<T>(src, weights, bias, output_shape, info, dilation);
+ reference::convolution_layer<T>(src, weights, bias, output_shape, info, dilation, num_groups);
}
TensorType _target{};
@@ -176,7 +183,6 @@
DataType _data_type{};
DataType _bias_data_type{};
DataLayout _data_layout{};
- int _fractional_bits{};
QuantizationInfo _quantization_info{};
bool _is_quantized = false;
};
@@ -189,36 +195,22 @@
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, bool reshape_weights, DataType data_type,
DataLayout data_layout, ActivationLayerInfo act_info)
{
- ConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, reshape_weights, data_type, data_layout, 0,
+ ConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, reshape_weights,
+ data_type, data_layout,
QuantizationInfo(), act_info);
}
};
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class ConvolutionValidationFixedPointFixture : public ConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, bool reshape_weights, DataType data_type,
- int fractional_bits, ActivationLayerInfo act_info)
- {
- ConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, reshape_weights, data_type,
- DataLayout::NCHW,
- fractional_bits, QuantizationInfo(), act_info);
- }
-};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
class ConvolutionValidationQuantizedFixture : public ConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
{
public:
template <typename...>
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, bool reshape_weights, DataType data_type,
- QuantizationInfo quantization_info, ActivationLayerInfo act_info)
+ DataLayout data_layout, QuantizationInfo quantization_info, ActivationLayerInfo act_info)
{
- ConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, reshape_weights, data_type,
- DataLayout::NCHW, 0,
- quantization_info, act_info);
+ ConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, reshape_weights,
+ data_type, data_layout, quantization_info, act_info);
}
};
} // namespace validation
diff --git a/tests/validation/fixtures/DeconvolutionLayerFixture.h b/tests/validation/fixtures/DeconvolutionLayerFixture.h
index f2455f3..12ce9ce 100644
--- a/tests/validation/fixtures/DeconvolutionLayerFixture.h
+++ b/tests/validation/fixtures/DeconvolutionLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -45,40 +45,37 @@
public:
template <typename...>
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info,
- const std::pair<unsigned int, unsigned int> &inner_border, DataType data_type, int fractional_bits)
+ const std::pair<unsigned int, unsigned int> &inner_border, DataType data_type)
{
- _fractional_bits = fractional_bits;
- _data_type = data_type;
+ _data_type = data_type;
- _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, inner_border, data_type, fractional_bits);
- _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, inner_border, data_type, fractional_bits);
+ _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, inner_border, data_type);
+ _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, inner_border, data_type);
}
protected:
template <typename U>
void fill(U &&tensor, int i)
{
- switch(tensor.data_type())
+ if(is_data_type_float(tensor.data_type()))
{
- case DataType::F32:
- {
- std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
- library->fill(tensor, distribution, i);
- break;
- }
- default:
- library->fill_tensor_uniform(tensor, i);
+ std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
+ library->fill(tensor, distribution, i);
+ }
+ else
+ {
+ library->fill_tensor_uniform(tensor, i);
}
}
TensorType compute_target(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape,
- const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> &inner_border, DataType data_type, int fixed_point_position)
+ const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> &inner_border, DataType data_type)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, fixed_point_position);
- TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position);
- TensorType bias = create_tensor<TensorType>(bias_shape, data_type, 1, fixed_point_position);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, fixed_point_position);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type, 1);
+ TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1);
+ TensorType bias = create_tensor<TensorType>(bias_shape, data_type, 1);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1);
// Create and configure function
FunctionType conv;
@@ -112,12 +109,12 @@
}
SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape,
- const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> inner_border, DataType data_type, int fixed_point_position)
+ const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> inner_border, DataType data_type)
{
// Create reference
- SimpleTensor<T> src{ input_shape, data_type, 1, fixed_point_position };
- SimpleTensor<T> weights{ weights_shape, data_type, 1, fixed_point_position };
- SimpleTensor<T> bias{ bias_shape, data_type, 1, fixed_point_position };
+ SimpleTensor<T> src{ input_shape, data_type, 1 };
+ SimpleTensor<T> weights{ weights_shape, data_type, 1 };
+ SimpleTensor<T> bias{ bias_shape, data_type, 1 };
// Fill reference
fill(src, 0);
@@ -129,7 +126,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
DataType _data_type{};
};
@@ -148,7 +144,7 @@
const std::pair<unsigned int, unsigned int> inner_border(inner_border_right, inner_border_top);
auto out_dim = deconvolution_output_dimensions(input_shape.x(), input_shape.y(), kernel_size_x, kernel_size_y, padx, pady, inner_border.first, inner_border.second, sx, sy);
TensorShape output_shape = deconvolution_output_shape(out_dim, input_shape, weights_shape);
- DeconvolutionLayerFixtureBase<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, inner_border, data_type, 0);
+ DeconvolutionLayerFixtureBase<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, inner_border, data_type);
}
};
diff --git a/tests/validation/fixtures/DepthConcatenateLayerFixture.h b/tests/validation/fixtures/DepthConcatenateLayerFixture.h
index 6e112c7..5fdfacb 100644
--- a/tests/validation/fixtures/DepthConcatenateLayerFixture.h
+++ b/tests/validation/fixtures/DepthConcatenateLayerFixture.h
@@ -26,6 +26,7 @@
#include "arm_compute/core/TensorShape.h"
#include "arm_compute/core/Types.h"
+#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "tests/AssetsLibrary.h"
#include "tests/Globals.h"
#include "tests/IAccessor.h"
@@ -102,12 +103,12 @@
for(const auto &shape : shapes)
{
- srcs.emplace_back(create_tensor<TensorType>(shape, data_type, 1, _fractional_bits));
+ srcs.emplace_back(create_tensor<TensorType>(shape, data_type, 1));
src_ptrs.emplace_back(&srcs.back());
}
- TensorShape dst_shape = calculate_depth_concatenate_shape(shapes);
- TensorType dst = create_tensor<TensorType>(dst_shape, data_type, 1, _fractional_bits);
+ TensorShape dst_shape = misc::shape_calculator::calculate_depth_concatenate_shape(src_ptrs);
+ TensorType dst = create_tensor<TensorType>(dst_shape, data_type, 1);
// Create and configure function
FunctionType depth_concat;
@@ -151,7 +152,7 @@
int i = 0;
for(const auto &shape : shapes)
{
- srcs.emplace_back(shape, data_type, 1, _fractional_bits);
+ srcs.emplace_back(shape, data_type, 1);
fill(srcs.back(), i++);
}
@@ -160,9 +161,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
-
-private:
- int _fractional_bits{ 1 };
};
} // namespace validation
} // namespace test
diff --git a/tests/validation/fixtures/DepthConvertLayerFixture.h b/tests/validation/fixtures/DepthConvertLayerFixture.h
index 4b4e959..29034c5 100644
--- a/tests/validation/fixtures/DepthConvertLayerFixture.h
+++ b/tests/validation/fixtures/DepthConvertLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -41,16 +41,15 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T1, typename T2>
-class DepthConvertLayerValidationFixedPointFixture : public framework::Fixture
+class DepthConvertLayerValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, uint32_t fractional_bits)
+ void setup(TensorShape shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift)
{
- _shift = shift;
- _fractional_bits = fractional_bits;
- _target = compute_target(shape, dt_in, dt_out, policy, shift, fractional_bits);
- _reference = compute_reference(shape, dt_in, dt_out, policy, shift, fractional_bits);
+ _shift = shift;
+ _target = compute_target(shape, dt_in, dt_out, policy, shift);
+ _reference = compute_reference(shape, dt_in, dt_out, policy, shift);
}
protected:
@@ -60,11 +59,11 @@
library->fill_tensor_uniform(tensor, i);
}
- TensorType compute_target(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, uint32_t fixed_point_position)
+ TensorType compute_target(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, dt_in, 1, static_cast<int>(fixed_point_position));
- TensorType dst = create_tensor<TensorType>(shape, dt_out, 1, static_cast<int>(fixed_point_position));
+ TensorType src = create_tensor<TensorType>(shape, dt_in, 1);
+ TensorType dst = create_tensor<TensorType>(shape, dt_out, 1);
// Create and configure function
FunctionType depth_convert;
@@ -89,10 +88,10 @@
return dst;
}
- SimpleTensor<T2> compute_reference(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, uint32_t fixed_point_position)
+ SimpleTensor<T2> compute_reference(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift)
{
// Create reference
- SimpleTensor<T1> src{ shape, dt_in, 1, static_cast<int>(fixed_point_position) };
+ SimpleTensor<T1> src{ shape, dt_in, 1 };
// Fill reference
fill(src, 0);
@@ -102,29 +101,8 @@
TensorType _target{};
SimpleTensor<T2> _reference{};
- int _fractional_bits{};
int _shift{};
};
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T1, typename T2>
-class DepthConvertLayerValidationFixture : public DepthConvertLayerValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T1, T2>
-{
-public:
- template <typename...>
- void setup(TensorShape shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift)
- {
- DepthConvertLayerValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T1, T2>::setup(shape, dt_in, dt_out, policy, shift, 0);
- }
-};
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T1, typename T2>
-class DepthConvertLayerValidationFractionalBitsFixture : public DepthConvertLayerValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T1, T2>
-{
-public:
- template <typename...>
- void setup(TensorShape shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t fractional_bits)
- {
- DepthConvertLayerValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T1, T2>::setup(shape, dt_in, dt_out, policy, 0, fractional_bits);
- }
-};
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h b/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h
index 2f01f43..5428154 100644
--- a/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h
+++ b/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h
@@ -115,10 +115,10 @@
}
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, 0, quantization_info, data_layout);
- TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, 0, quantization_info, data_layout);
- TensorType biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1, 0, quantization_info, data_layout);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, 0, quantization_info, data_layout);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, quantization_info, data_layout);
+ TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, quantization_info, data_layout);
+ TensorType biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1, quantization_info, data_layout);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, quantization_info, data_layout);
// Create Depthwise Convolution configure function
FunctionType dwc;
@@ -155,9 +155,9 @@
unsigned int depth_multiplier,
const DataType data_type, const DataType bias_data_type, const QuantizationInfo quantization_info)
{
- SimpleTensor<T> src{ in_shape, data_type, 1, 0, quantization_info };
- SimpleTensor<T> weights{ weights_shape, data_type, 1, 0, quantization_info };
- SimpleTensor<TBias> biases{ biases_shape, bias_data_type, 1, 0, quantization_info };
+ SimpleTensor<T> src{ in_shape, data_type, 1, quantization_info };
+ SimpleTensor<T> weights{ weights_shape, data_type, 1, quantization_info };
+ SimpleTensor<TBias> biases{ biases_shape, bias_data_type, 1, quantization_info };
fill(src, 0);
fill(weights, 1);
diff --git a/tests/validation/fixtures/DequantizationLayerFixture.h b/tests/validation/fixtures/DequantizationLayerFixture.h
index 5855820..0bf3522 100644
--- a/tests/validation/fixtures/DequantizationLayerFixture.h
+++ b/tests/validation/fixtures/DequantizationLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -43,7 +43,7 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class DequantizationValidationFixedPointFixture : public framework::Fixture
+class DequantizationValidationFixture : public framework::Fixture
{
public:
template <typename...>
@@ -164,17 +164,6 @@
TensorType _target{};
SimpleTensor<float> _reference{};
};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class DequantizationValidationFixture : public DequantizationValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape shape, DataType data_type)
- {
- DequantizationValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type);
- }
-};
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/DirectConvolutionLayerFixture.h b/tests/validation/fixtures/DirectConvolutionLayerFixture.h
index 38ddf33..e2f9554 100644
--- a/tests/validation/fixtures/DirectConvolutionLayerFixture.h
+++ b/tests/validation/fixtures/DirectConvolutionLayerFixture.h
@@ -54,11 +54,10 @@
public:
template <typename...>
void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels,
- DataType data_type, int fractional_bits, QuantizationInfo quantization_info, ActivationLayerInfo act_info, DataLayout data_layout)
+ DataType data_type, QuantizationInfo quantization_info, ActivationLayerInfo act_info, DataLayout data_layout)
{
ARM_COMPUTE_ERROR_ON(data_layout == DataLayout::UNKNOWN);
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
_data_type = data_type;
@@ -67,30 +66,29 @@
const PadStrideInfo info(stride_x, stride_y, pad_x, pad_y, DimensionRoundingType::FLOOR);
const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
- TensorInfo input_info = TensorInfo(input_shape, 1, data_type, _fractional_bits);
- TensorInfo weights_info = TensorInfo(weights_shape, 1, data_type, _fractional_bits);
+ TensorInfo input_info = TensorInfo(input_shape, 1, data_type);
+ TensorInfo weights_info = TensorInfo(weights_shape, 1, data_type);
const TensorShape output_shape = compute_deep_convolution_shape(input_info, weights_info, info);
- _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info, act_info, data_layout);
- _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info, act_info);
+ _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, quantization_info, act_info, data_layout);
+ _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, quantization_info, act_info);
}
template <typename...>
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation,
- DataType data_type, int fractional_bits, QuantizationInfo quantization_info, ActivationLayerInfo act_info, DataLayout data_layout)
+ DataType data_type, QuantizationInfo quantization_info, ActivationLayerInfo act_info, DataLayout data_layout)
{
ARM_COMPUTE_ERROR_ON(data_layout == DataLayout::UNKNOWN);
ARM_COMPUTE_UNUSED(dilation);
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
_data_type = data_type;
const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
- _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info, act_info, data_layout);
- _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info, act_info);
+ _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, quantization_info, act_info, data_layout);
+ _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, quantization_info, act_info);
}
protected:
@@ -108,7 +106,7 @@
case DataType::F16:
case DataType::F32:
{
- std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
+ std::uniform_real_distribution<> distribution(-1.f, 1.f);
library->fill(tensor, distribution, i);
break;
}
@@ -124,7 +122,7 @@
}
TensorType compute_target(TensorShape input_shape, TensorShape weights_shape, const TensorShape &bias_shape, TensorShape output_shape, const PadStrideInfo &info,
- DataType data_type, DataType bias_data_type, int fixed_point_position, QuantizationInfo quantization_info, ActivationLayerInfo act_info, const DataLayout &data_layout)
+ DataType data_type, DataType bias_data_type, QuantizationInfo quantization_info, ActivationLayerInfo act_info, const DataLayout &data_layout)
{
if(data_layout == DataLayout::NHWC)
{
@@ -134,10 +132,10 @@
}
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, fixed_point_position, quantization_info, data_layout);
- TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position, quantization_info, data_layout);
- TensorType bias = create_tensor<TensorType>(bias_shape, bias_data_type, 1, fixed_point_position, quantization_info);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, fixed_point_position, quantization_info, data_layout);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, quantization_info, data_layout);
+ TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, quantization_info, data_layout);
+ TensorType bias = create_tensor<TensorType>(bias_shape, bias_data_type, 1, quantization_info);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, quantization_info, data_layout);
// Create and configure function
FunctionType conv;
@@ -171,12 +169,12 @@
}
SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, const PadStrideInfo &info,
- DataType data_type, DataType bias_data_type, int fixed_point_position, QuantizationInfo quantization_info, ActivationLayerInfo act_info)
+ DataType data_type, DataType bias_data_type, QuantizationInfo quantization_info, ActivationLayerInfo act_info)
{
// Create reference
- SimpleTensor<T> src{ input_shape, data_type, 1, fixed_point_position, quantization_info };
- SimpleTensor<T> weights{ weights_shape, data_type, 1, fixed_point_position, quantization_info };
- SimpleTensor<TBias> bias{ bias_shape, bias_data_type, 1, fixed_point_position, quantization_info };
+ SimpleTensor<T> src{ input_shape, data_type, 1, quantization_info };
+ SimpleTensor<T> weights{ weights_shape, data_type, 1, quantization_info };
+ SimpleTensor<TBias> bias{ bias_shape, bias_data_type, 1, quantization_info };
// Fill reference
fill(src, 0);
@@ -184,13 +182,10 @@
fill(bias, 2);
SimpleTensor<T> dst = reference::convolution_layer<T>(src, weights, bias, output_shape, info);
-
return (act_info.enabled()) ? reference::activation_layer<T>(dst, act_info) : dst;
}
-
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
QuantizationInfo _quantization_info{};
DataType _data_type{};
};
@@ -203,25 +198,12 @@
void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type, ActivationLayerInfo act_info,
DataLayout data_layout)
{
- DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, 0, QuantizationInfo(),
+ DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, QuantizationInfo(),
act_info, data_layout);
}
};
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class DirectConvolutionValidationFixedPointFixture : public DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type, int fractional_bits,
- ActivationLayerInfo act_info)
- {
- DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, fractional_bits,
- QuantizationInfo(), act_info, DataLayout::NCHW);
- }
-};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
class DirectConvolutionValidationQuantizedFixture : public DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
{
public:
@@ -229,7 +211,7 @@
void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type, QuantizationInfo quantization_info,
ActivationLayerInfo act_info)
{
- DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, 0, quantization_info,
+ DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, quantization_info,
act_info, DataLayout::NCHW);
}
};
@@ -242,7 +224,7 @@
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation,
DataType data_type, QuantizationInfo quantization_info, ActivationLayerInfo act_info)
{
- DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, 0, quantization_info,
+ DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, quantization_info,
act_info, DataLayout::NCHW);
}
};
@@ -255,7 +237,7 @@
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation,
DataType data_type, ActivationLayerInfo act_info)
{
- DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, 0, QuantizationInfo(),
+ DirectConvolutionValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation, data_type, QuantizationInfo(),
act_info, DataLayout::NCHW);
}
};
diff --git a/tests/validation/fixtures/DirectConvolutionLayerTensorShiftFixture.h b/tests/validation/fixtures/DirectConvolutionLayerTensorShiftFixture.h
index 09b6d83..bf6f3e2 100644
--- a/tests/validation/fixtures/DirectConvolutionLayerTensorShiftFixture.h
+++ b/tests/validation/fixtures/DirectConvolutionLayerTensorShiftFixture.h
@@ -50,9 +50,8 @@
public:
template <typename...>
void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels,
- DataType data_type, int fractional_bits, QuantizationInfo quantization_info)
+ DataType data_type, QuantizationInfo quantization_info)
{
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
_data_type = data_type;
@@ -62,24 +61,23 @@
const TensorShape output_shape = get_output_shape(input_shape, weights_shape, info);
const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
- _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info);
- _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info);
+ _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, quantization_info);
+ _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, quantization_info);
}
template <typename...>
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, unsigned int dilation_x, unsigned int dilation_y,
- DataType data_type, int fractional_bits, QuantizationInfo quantization_info)
+ DataType data_type, QuantizationInfo quantization_info)
{
ARM_COMPUTE_UNUSED(dilation_x, dilation_y);
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
_data_type = data_type;
const DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
- _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info);
- _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, fractional_bits, quantization_info);
+ _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, quantization_info);
+ _reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, bias_data_type, quantization_info);
}
protected:
@@ -113,16 +111,16 @@
}
TensorType compute_target(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, const PadStrideInfo &info,
- DataType data_type, DataType bias_data_type, int fixed_point_position, QuantizationInfo quantization_info)
+ DataType data_type, DataType bias_data_type, QuantizationInfo quantization_info)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, fixed_point_position, quantization_info);
- TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, fixed_point_position, quantization_info);
- TensorType bias = create_tensor<TensorType>(bias_shape, bias_data_type, 1, fixed_point_position, quantization_info);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, fixed_point_position, quantization_info);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, quantization_info);
+ TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, quantization_info);
+ TensorType bias = create_tensor<TensorType>(bias_shape, bias_data_type, 1, quantization_info);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, quantization_info);
TensorShape output_shape1 = get_output_shape(output_shape, weights_shape, info);
- TensorType dst1 = create_tensor<TensorType>(output_shape1, data_type, 1, fixed_point_position, quantization_info);
+ TensorType dst1 = create_tensor<TensorType>(output_shape1, data_type, 1, quantization_info);
// Create and configure function
FunctionType conv;
@@ -164,14 +162,14 @@
}
SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, const PadStrideInfo &info,
- DataType data_type, DataType bias_data_type, int fixed_point_position, QuantizationInfo quantization_info)
+ DataType data_type, DataType bias_data_type, QuantizationInfo quantization_info)
{
// Create reference
- SimpleTensor<T> src{ input_shape, data_type, 1, fixed_point_position, quantization_info };
- SimpleTensor<T> weights{ weights_shape, data_type, 1, fixed_point_position, quantization_info };
- SimpleTensor<TBias> bias{ bias_shape, bias_data_type, 1, fixed_point_position, quantization_info };
+ SimpleTensor<T> src{ input_shape, data_type, 1, quantization_info };
+ SimpleTensor<T> weights{ weights_shape, data_type, 1, quantization_info };
+ SimpleTensor<TBias> bias{ bias_shape, bias_data_type, 1, quantization_info };
- SimpleTensor<T> dst{ output_shape, data_type, 1, fixed_point_position, quantization_info };
+ SimpleTensor<T> dst{ output_shape, data_type, 1, quantization_info };
TensorShape output_shape1 = get_output_shape(output_shape, weights_shape, info);
// Fill reference
@@ -185,7 +183,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
QuantizationInfo _quantization_info{};
DataType _data_type{};
@@ -212,20 +209,7 @@
template <typename...>
void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type)
{
- DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, 0,
- QuantizationInfo());
- }
-};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class DirectConvolutionValidationFixedPointTensorShiftFixture : public DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type, int fractional_bits)
- {
DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type,
- fractional_bits,
QuantizationInfo());
}
};
@@ -237,7 +221,7 @@
template <typename...>
void setup(TensorShape input_shape, int stride_x, int stride_y, int pad_x, int pad_y, unsigned int kernel_size, unsigned int num_kernels, DataType data_type, QuantizationInfo quantization_info)
{
- DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type, 0,
+ DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, stride_x, stride_y, pad_x, pad_y, kernel_size, num_kernels, data_type,
quantization_info);
}
};
@@ -250,7 +234,7 @@
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, unsigned int dilation_x, unsigned int dilation_y,
DataType data_type, QuantizationInfo quantization_info)
{
- DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation_x, dilation_y, data_type, 0,
+ DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation_x, dilation_y, data_type,
quantization_info);
}
};
@@ -263,7 +247,7 @@
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, unsigned int dilation_x, unsigned int dilation_y,
DataType data_type)
{
- DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation_x, dilation_y, data_type, 0,
+ DirectConvolutionValidationGenericTensorShiftFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, info, dilation_x, dilation_y, data_type,
QuantizationInfo());
}
};
diff --git a/tests/validation/fixtures/DropoutLayerFixture.h b/tests/validation/fixtures/DropoutLayerFixture.h
index 3a077db..771de30 100644
--- a/tests/validation/fixtures/DropoutLayerFixture.h
+++ b/tests/validation/fixtures/DropoutLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -97,7 +97,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
};
} // namespace validation
} // namespace test
diff --git a/tests/validation/fixtures/FixedPointFixture.h b/tests/validation/fixtures/FixedPointFixture.h
deleted file mode 100644
index 3f3bb6e..0000000
--- a/tests/validation/fixtures/FixedPointFixture.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_FIXED_POINT_FIXTURE
-#define ARM_COMPUTE_TEST_FIXED_POINT_FIXTURE
-
-#include "arm_compute/core/TensorShape.h"
-#include "arm_compute/core/Types.h"
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/IAccessor.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Fixture.h"
-#include "tests/validation/Helpers.h"
-#include "tests/validation/reference/FixedPoint.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-template <typename TensorType, typename AccessorType, typename T>
-class FixedPointValidationFixture : public framework::Fixture
-{
-public:
- template <typename...>
- void setup(TensorShape shape, DataType dt, FixedPointOp op, int fractional_bits)
- {
- _fractional_bits = fractional_bits;
- _target = compute_target(shape, dt, op, fractional_bits);
- _reference = compute_reference(shape, dt, op, fractional_bits);
- }
-
-protected:
- template <typename U>
- void fill(U &&tensor, int min, int max, int i)
- {
- std::uniform_int_distribution<> distribution(min, max);
- library->fill(tensor, distribution, i);
- }
-
- TensorType compute_target(const TensorShape &shape, DataType dt, FixedPointOp op, int fixed_point_position)
- {
- // Create tensors
- TensorType src = create_tensor<TensorType>(shape, dt, 1, fixed_point_position);
- TensorType dst = create_tensor<TensorType>(shape, dt, 1, fixed_point_position);
-
- // Allocate tensors
- src.allocator()->allocate();
- dst.allocator()->allocate();
-
- ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
-
- compute_target_impl<TensorType, AccessorType, T>(shape, dt, op, fixed_point_position, src, dst);
-
- return dst;
- }
-
- SimpleTensor<T> compute_reference(const TensorShape &shape, DataType dt, FixedPointOp op, int fixed_point_position)
- {
- // Create reference
- SimpleTensor<T> src{ shape, dt, 1, fixed_point_position };
-
- // Fill reference
- int min = 0;
- int max = 0;
- switch(op)
- {
- case FixedPointOp::EXP:
- min = -(1 << (fixed_point_position - 1));
- max = (1 << (fixed_point_position - 1));
- break;
- case FixedPointOp::INV_SQRT:
- min = 1;
- max = (dt == DataType::QS8) ? 0x7F : 0x7FFF;
- break;
- case FixedPointOp::LOG:
- min = (1 << (fixed_point_position - 1));
- max = (dt == DataType::QS8) ? 0x3F : 0x3FFF;
- break;
- case FixedPointOp::RECIPROCAL:
- min = 15;
- max = (dt == DataType::QS8) ? 0x7F : 0x7FFF;
- break;
- default:
- ARM_COMPUTE_ERROR("Fixed point operation not supported");
- break;
- }
- fill(src, min, max, 0);
-
- return reference::fixed_point_operation<T>(src, op);
- }
-
- TensorType _target{};
- SimpleTensor<T> _reference{};
- int _fractional_bits{};
-};
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_FIXED_POINT_FIXTURE */
diff --git a/tests/validation/fixtures/FixedPointPixelWiseMultiplicationFixture.h b/tests/validation/fixtures/FixedPointPixelWiseMultiplicationFixture.h
deleted file mode 100644
index 73386df..0000000
--- a/tests/validation/fixtures/FixedPointPixelWiseMultiplicationFixture.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef ARM_COMPUTE_TEST_FIXED_POINT_PIXEL_WISE_MULTIPLICATION_FIXTURE
-#define ARM_COMPUTE_TEST_FIXED_POINT_PIXEL_WISE_MULTIPLICATION_FIXTURE
-
-#include "arm_compute/core/TensorShape.h"
-#include "arm_compute/core/Types.h"
-#include "tests/AssetsLibrary.h"
-#include "tests/Globals.h"
-#include "tests/IAccessor.h"
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Fixture.h"
-#include "tests/validation/reference/FixedPointPixelWiseMultiplication.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class FixedPointPixelWiseMultiplicationValidationFixture : public framework::Fixture
-{
-public:
- template <typename...>
- void setup(TensorShape shape,
- DataType dt_in1,
- DataType dt_in2,
- float scale,
- ConvertPolicy convert_policy,
- RoundingPolicy rounding_policy,
- int fixed_point_position)
- {
- _target = compute_target(shape, dt_in1, dt_in2, scale, convert_policy, rounding_policy, fixed_point_position);
- _reference = compute_reference(shape, dt_in1, dt_in2, scale, convert_policy, fixed_point_position);
- }
-
-protected:
- template <typename U>
- void fill(U &&tensor, unsigned int seed_offset)
- {
- library->fill_tensor_uniform(tensor, seed_offset);
- }
-
- TensorType compute_target(const TensorShape &shape, DataType dt_in1, DataType dt_in2, float scale, ConvertPolicy convert_policy, RoundingPolicy rounding_policy, int fixed_point_position)
- {
- // Create tensors
- TensorType src1 = create_tensor<TensorType>(shape, dt_in1, 1, fixed_point_position);
- TensorType src2 = create_tensor<TensorType>(shape, dt_in2, 1, fixed_point_position);
- TensorType dst = create_tensor<TensorType>(shape, dt_in2, 1, fixed_point_position);
-
- // Create and configure function
- FunctionType multiply;
- multiply.configure(&src1, &src2, &dst, scale, convert_policy, rounding_policy);
-
- ARM_COMPUTE_EXPECT(src1.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(src2.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
-
- // Allocate tensors
- src1.allocator()->allocate();
- src2.allocator()->allocate();
- dst.allocator()->allocate();
-
- ARM_COMPUTE_EXPECT(!src1.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(!src2.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
-
- // Fill tensors
- fill(AccessorType(src1), 0);
- fill(AccessorType(src2), 1);
-
- // Compute function
- multiply.run();
-
- return dst;
- }
-
- SimpleTensor<T> compute_reference(const TensorShape &shape, DataType dt_in1, DataType dt_in2, float scale, ConvertPolicy convert_policy, int fixed_point_position)
- {
- // Create reference
- SimpleTensor<T> src1{ shape, dt_in1, 1, fixed_point_position };
- SimpleTensor<T> src2{ shape, dt_in2, 1, fixed_point_position };
-
- // Fill reference
- fill(src1, 0);
- fill(src2, 1);
-
- return reference::fixed_point_pixel_wise_multiplication<T>(src1, src2, scale, convert_policy);
- }
-
- TensorType _target{};
- SimpleTensor<T> _reference{};
-};
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_FIXED_POINT_PIXEL_WISE_MULTIPLICATION_FIXTURE */
diff --git a/tests/validation/fixtures/FlattenLayerFixture.h b/tests/validation/fixtures/FlattenLayerFixture.h
index ef94ea8..d170806 100644
--- a/tests/validation/fixtures/FlattenLayerFixture.h
+++ b/tests/validation/fixtures/FlattenLayerFixture.h
@@ -53,11 +53,9 @@
template <typename...>
void setup(TensorShape shape, DataType data_type)
{
- _fractional_bits = is_data_type_fixed_point(data_type) ? 4 : 0;
-
TensorShape shape_flatten;
- TensorInfo input_info(shape, 1, data_type, _fractional_bits);
- shape_flatten = compute_im2col_flatten_shape(&input_info);
+ TensorInfo input_info(shape, 1, data_type);
+ shape_flatten = compute_flatten_shape(&input_info);
_target = compute_target(shape, shape_flatten, data_type);
_reference = compute_reference(shape, shape_flatten, data_type);
@@ -68,24 +66,15 @@
template <typename U>
void fill(U &&tensor)
{
- if(_fractional_bits == 0)
- {
- std::uniform_real_distribution<> distribution(-1.f, 1.f);
- library->fill(tensor, distribution, 0);
- }
- else
- {
- const int one_fixed = 1 << _fractional_bits;
- std::uniform_int_distribution<> distribution(-one_fixed, one_fixed);
- library->fill(tensor, distribution, 0);
- }
+ std::uniform_real_distribution<> distribution(-1.f, 1.f);
+ library->fill(tensor, distribution, 0);
}
TensorType compute_target(const TensorShape &shape, const TensorShape &shape_flatten, DataType data_type)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, data_type, 1, _fractional_bits);
- TensorType dst = create_tensor<TensorType>(shape_flatten, data_type, 1, _fractional_bits);
+ TensorType src = create_tensor<TensorType>(shape, data_type, 1);
+ TensorType dst = create_tensor<TensorType>(shape_flatten, data_type, 1);
// Create and configure function
FunctionType flatten_layer;
@@ -113,7 +102,7 @@
SimpleTensor<T> compute_reference(const TensorShape &shape, const TensorShape &shape_flatten, DataType data_type)
{
// Create reference
- SimpleTensor<T> src{ shape, data_type, 1, _fractional_bits };
+ SimpleTensor<T> src{ shape, data_type, 1 };
// Fill reference
fill(src);
@@ -123,7 +112,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
};
} // namespace validation
} // namespace test
diff --git a/tests/validation/fixtures/FullyConnectedLayerFixture.h b/tests/validation/fixtures/FullyConnectedLayerFixture.h
index f23fc20..1e4a744 100644
--- a/tests/validation/fixtures/FullyConnectedLayerFixture.h
+++ b/tests/validation/fixtures/FullyConnectedLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -45,7 +45,7 @@
{
namespace validation
{
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T, bool run_interleave>
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
class FullyConnectedLayerValidationGenericFixture : public framework::Fixture
{
public:
@@ -54,14 +54,13 @@
public:
template <typename...>
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, bool transpose_weights, bool reshape_weights,
- DataType data_type, int fractional_bits, QuantizationInfo quantization_info)
+ DataType data_type, QuantizationInfo quantization_info)
{
ARM_COMPUTE_UNUSED(weights_shape);
ARM_COMPUTE_UNUSED(bias_shape);
_data_type = data_type;
_bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
_target = compute_target(input_shape, weights_shape, bias_shape, output_shape, transpose_weights, reshape_weights);
@@ -84,7 +83,7 @@
}
else if(is_data_type_float(_data_type))
{
- std::uniform_real_distribution<> distribution(0.5f, 1.f);
+ std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
library->fill(tensor, distribution, i);
}
else
@@ -104,8 +103,8 @@
// -----------+-----------+---------------------------
// transpose | | ***
// -----------+-----------+---------------------------
- // !transpose | transpose | transpose &
- // | | transpose1xW (if required)
+ // !transpose | transpose | transpose
+ // | |
//
// ***: That combination is invalid. But we can ignore the transpose flag and handle all !reshape the same
if(!reshape_weights || !transpose_weights)
@@ -113,27 +112,22 @@
const size_t shape_x = reshaped_weights_shape.x();
reshaped_weights_shape.set(0, reshaped_weights_shape.y());
reshaped_weights_shape.set(1, shape_x);
-
- // Weights have to be passed reshaped
- // Transpose 1xW for batched version
- if(!reshape_weights && output_shape.y() > 1 && run_interleave)
- {
- const int transpose_width = 16 / data_size_from_type(_data_type);
- const float shape_x = reshaped_weights_shape.x();
- reshaped_weights_shape.set(0, reshaped_weights_shape.y() * transpose_width);
- reshaped_weights_shape.set(1, static_cast<unsigned int>(std::ceil(shape_x / transpose_width)));
- }
}
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, _data_type, 1, _fractional_bits, _quantization_info);
- TensorType weights = create_tensor<TensorType>(reshaped_weights_shape, _data_type, 1, _fractional_bits, _quantization_info);
- TensorType bias = create_tensor<TensorType>(bias_shape, _bias_data_type, 1, _fractional_bits, _quantization_info);
- TensorType dst = create_tensor<TensorType>(output_shape, _data_type, 1, _fractional_bits, _quantization_info);
+ TensorType src = create_tensor<TensorType>(input_shape, _data_type, 1, _quantization_info);
+ TensorType weights = create_tensor<TensorType>(reshaped_weights_shape, _data_type, 1, _quantization_info);
+ TensorType bias = create_tensor<TensorType>(bias_shape, _bias_data_type, 1, _quantization_info);
+ TensorType dst = create_tensor<TensorType>(output_shape, _data_type, 1, _quantization_info);
+
+ // Create Fully Connected layer info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.transpose_weights = transpose_weights;
+ fc_info.are_weights_reshaped = !reshape_weights;
// Create and configure function.
FunctionType fc;
- fc.configure(&src, &weights, &bias, &dst, transpose_weights, !reshape_weights);
+ fc.configure(&src, &weights, &bias, &dst, fc_info);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -158,7 +152,7 @@
if(!reshape_weights || !transpose_weights)
{
TensorShape tmp_shape(weights_shape);
- RawTensor tmp(tmp_shape, _data_type, 1, _fractional_bits);
+ RawTensor tmp(tmp_shape, _data_type, 1);
// Fill with original shape
fill(tmp, 1);
@@ -166,14 +160,6 @@
// Transpose elementwise
tmp = transpose(tmp);
- // Reshape weights for batched runs
- if(!reshape_weights && output_shape.y() > 1 && run_interleave)
- {
- // Transpose with interleave
- const int interleave_size = 16 / tmp.element_size();
- tmp = transpose(tmp, interleave_size);
- }
-
AccessorType weights_accessor(weights);
for(int i = 0; i < tmp.num_elements(); ++i)
@@ -199,9 +185,9 @@
bool reshape_weights)
{
// Create reference
- SimpleTensor<T> src{ input_shape, _data_type, 1, _fractional_bits, _quantization_info };
- SimpleTensor<T> weights{ weights_shape, _data_type, 1, _fractional_bits, _quantization_info };
- SimpleTensor<TBias> bias{ bias_shape, _bias_data_type, 1, _fractional_bits, _quantization_info };
+ SimpleTensor<T> src{ input_shape, _data_type, 1, _quantization_info };
+ SimpleTensor<T> weights{ weights_shape, _data_type, 1, _quantization_info };
+ SimpleTensor<TBias> bias{ bias_shape, _bias_data_type, 1, _quantization_info };
// Fill reference
fill(src, 0);
@@ -215,47 +201,33 @@
SimpleTensor<T> _reference{};
DataType _data_type{};
DataType _bias_data_type{};
- int _fractional_bits{};
QuantizationInfo _quantization_info{};
};
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T, bool run_interleave>
-class FullyConnectedLayerValidationFixture : public FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T, run_interleave>
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class FullyConnectedLayerValidationFixture : public FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
{
public:
template <typename...>
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, bool transpose_weights, bool reshape_weights, DataType data_type)
{
- FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T, run_interleave>::setup(input_shape, weights_shape, bias_shape, output_shape, transpose_weights,
- reshape_weights, data_type,
- 0, QuantizationInfo());
+ FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, transpose_weights,
+ reshape_weights, data_type,
+ QuantizationInfo());
}
};
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T, bool run_interleave>
-class FullyConnectedLayerValidationFixedPointFixture : public FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T, run_interleave>
-{
-public:
- template <typename...>
- void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, bool transpose_weights, bool reshape_weights, DataType data_type, int fractional_bits)
- {
- FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T, run_interleave>::setup(input_shape, weights_shape, bias_shape, output_shape, transpose_weights,
- reshape_weights, data_type,
- fractional_bits, QuantizationInfo());
- }
-};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T, bool run_interleave>
-class FullyConnectedLayerValidationQuantizedFixture : public FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T, run_interleave>
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class FullyConnectedLayerValidationQuantizedFixture : public FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
{
public:
template <typename...>
void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, bool transpose_weights, bool reshape_weights, DataType data_type,
QuantizationInfo quantization_info)
{
- FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T, run_interleave>::setup(input_shape, weights_shape, bias_shape, output_shape, transpose_weights,
- reshape_weights, data_type,
- 0, quantization_info);
+ FullyConnectedLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(input_shape, weights_shape, bias_shape, output_shape, transpose_weights,
+ reshape_weights, data_type,
+ quantization_info);
}
};
} // namespace validation
diff --git a/tests/validation/fixtures/GEMMFixture.h b/tests/validation/fixtures/GEMMFixture.h
index e807ad8..255b12c 100644
--- a/tests/validation/fixtures/GEMMFixture.h
+++ b/tests/validation/fixtures/GEMMFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -42,18 +42,17 @@
{
namespace validation
{
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class GEMMValidationFixedPointFixture : public framework::Fixture
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T, bool reinterpret_input_as_3d = false, bool reinterpret_ouput_as_3d = false>
+class GEMMValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape_a, TensorShape shape_b, TensorShape shape_c, TensorShape output_shape, float alpha, float beta, DataType data_type, int fractional_bits)
+ void setup(TensorShape shape_a, TensorShape shape_b, TensorShape shape_c, TensorShape output_shape, float alpha, float beta, DataType data_type)
{
- _fractional_bits = fractional_bits;
- _data_type = data_type;
+ _data_type = data_type;
- _target = compute_target(shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type, fractional_bits);
- _reference = compute_reference(shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type, fractional_bits);
+ _target = compute_target(shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type);
+ _reference = compute_reference(shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type);
}
protected:
@@ -75,18 +74,20 @@
}
TensorType compute_target(const TensorShape &shape_a, const TensorShape &shape_b, const TensorShape &shape_c, const TensorShape &output_shape, float alpha, float beta,
- DataType data_type, int fixed_point_position)
+ DataType data_type)
{
// Create tensors
- TensorType a = create_tensor<TensorType>(shape_a, data_type, 1, fixed_point_position);
- TensorType b = create_tensor<TensorType>(shape_b, data_type, 1, fixed_point_position);
- TensorType c = create_tensor<TensorType>(shape_c, data_type, 1, fixed_point_position);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, fixed_point_position);
+ TensorType a = create_tensor<TensorType>(shape_a, data_type, 1);
+ TensorType b = create_tensor<TensorType>(shape_b, data_type, 1);
+ TensorType c = create_tensor<TensorType>(shape_c, data_type, 1);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1);
// Create and configure function
FunctionType gemm;
- gemm.configure(&a, &b, &c, &dst, alpha, beta);
-
+ // The GEMMinfo includes the values of the depth in case of reinterpreted 3d output.
+ // If the output shape has the same number of dimensions of the input the method called is a 2D matrix multiplication (depth_output_reinterpreted_as_3D = 1),
+ // in the other case we have to use the reinterpreted version of GEMM (depth_output_reinterpreted_as_3D = depth of the 3D output).
+ gemm.configure(&a, &b, &c, &dst, alpha, beta, GEMMInfo(false, false, false, (reinterpret_ouput_as_3d ? output_shape[2] : 1), reinterpret_input_as_3d));
ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(c.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -115,12 +116,19 @@
}
SimpleTensor<T> compute_reference(const TensorShape &shape_a, const TensorShape &shape_b, const TensorShape &shape_c, const TensorShape &output_shape, float alpha, float beta,
- DataType data_type, int fixed_point_position)
+ DataType data_type)
{
+ TensorShape shape_a_to_use = shape_a;
+ if(reinterpret_input_as_3d)
+ {
+ // Collapse the second and third dimension if the input is 3D
+ shape_a_to_use.collapse(2U, 1U);
+ }
+
// Create reference
- SimpleTensor<T> a{ shape_a, data_type, 1, fixed_point_position };
- SimpleTensor<T> b{ shape_b, data_type, 1, fixed_point_position };
- SimpleTensor<T> c{ shape_c, data_type, 1, fixed_point_position };
+ SimpleTensor<T> a{ shape_a_to_use, data_type, 1 };
+ SimpleTensor<T> b{ shape_b, data_type, 1 };
+ SimpleTensor<T> c{ shape_c, data_type, 1 };
// Fill reference
fill(a, 0);
@@ -132,20 +140,9 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
DataType _data_type{};
};
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class GEMMValidationFixture : public GEMMValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape shape_a, TensorShape shape_b, TensorShape shape_c, TensorShape output_shape, float alpha, float beta, DataType data_type)
- {
- GEMMValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type, 0);
- }
-};
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/GEMMInterleave4x4Fixture.h b/tests/validation/fixtures/GEMMInterleave4x4Fixture.h
index 1f0a742..26ffd36 100644
--- a/tests/validation/fixtures/GEMMInterleave4x4Fixture.h
+++ b/tests/validation/fixtures/GEMMInterleave4x4Fixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -43,18 +43,17 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class GEMMInterleave4x4ValidationFixedPointFixture : public framework::Fixture
+class GEMMInterleave4x4ValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(size_t x, size_t y, DataType data_type, int fractional_bits)
+ void setup(size_t x, size_t y, DataType data_type)
{
- _fractional_bits = fractional_bits;
- _data_type = data_type;
+ _data_type = data_type;
const TensorShape shape_a(x, y);
const TensorShape shape_b(static_cast<size_t>(x * 4.f), static_cast<size_t>(std::ceil(y / 4.f)));
- _target = compute_target(shape_a, shape_b, data_type, fractional_bits);
- _reference = compute_reference(shape_a, shape_b, data_type, fractional_bits);
+ _target = compute_target(shape_a, shape_b, data_type);
+ _reference = compute_reference(shape_a, shape_b, data_type);
}
protected:
@@ -76,11 +75,11 @@
}
}
- TensorType compute_target(const TensorShape &shape_a, const TensorShape &shape_b, DataType data_type, int fixed_point_position)
+ TensorType compute_target(const TensorShape &shape_a, const TensorShape &shape_b, DataType data_type)
{
// Create tensors
- TensorType a = create_tensor<TensorType>(shape_a, data_type, 1, fixed_point_position);
- TensorType b = create_tensor<TensorType>(shape_b, data_type, 1, fixed_point_position);
+ TensorType a = create_tensor<TensorType>(shape_a, data_type, 1);
+ TensorType b = create_tensor<TensorType>(shape_b, data_type, 1);
// Create and configure function
FunctionType f;
@@ -105,11 +104,11 @@
return b;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape_a, const TensorShape &shape_b, DataType data_type, int fixed_point_position)
+ SimpleTensor<T> compute_reference(const TensorShape &shape_a, const TensorShape &shape_b, DataType data_type)
{
// Create reference
- SimpleTensor<T> a{ shape_a, data_type, 1, fixed_point_position };
- SimpleTensor<T> b{ shape_b, data_type, 1, fixed_point_position };
+ SimpleTensor<T> a{ shape_a, data_type, 1 };
+ SimpleTensor<T> b{ shape_b, data_type, 1 };
// Fill reference
fill(a, 0);
@@ -120,21 +119,8 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
DataType _data_type{};
};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class GEMMInterleave4x4ValidationFixture : public GEMMInterleave4x4ValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(size_t x, size_t y, DataType data_type)
- {
- GEMMInterleave4x4ValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(x, y, data_type, 0);
- }
-};
-
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/GEMMTranspose1xWFixture.h b/tests/validation/fixtures/GEMMTranspose1xWFixture.h
index d83d5e9..af2a3b2 100644
--- a/tests/validation/fixtures/GEMMTranspose1xWFixture.h
+++ b/tests/validation/fixtures/GEMMTranspose1xWFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -43,19 +43,18 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class GEMMTranspose1xWValidationFixedPointFixture : public framework::Fixture
+class GEMMTranspose1xWValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(size_t x, size_t y, DataType data_type, int fractional_bits)
+ void setup(size_t x, size_t y, DataType data_type)
{
- _fractional_bits = fractional_bits;
- _data_type = data_type;
+ _data_type = data_type;
const TensorShape shape_a(x, y);
const unsigned int transpose_w = 16 / data_size_from_type(data_type);
const TensorShape shape_b(static_cast<size_t>(y * transpose_w), static_cast<size_t>(std::ceil(x / static_cast<float>(transpose_w))));
- _target = compute_target(shape_a, shape_b, data_type, fractional_bits);
- _reference = compute_reference(shape_a, shape_b, data_type, fractional_bits);
+ _target = compute_target(shape_a, shape_b, data_type);
+ _reference = compute_reference(shape_a, shape_b, data_type);
}
protected:
@@ -77,11 +76,11 @@
}
}
- TensorType compute_target(const TensorShape &shape_a, const TensorShape &shape_b, DataType data_type, int fixed_point_position)
+ TensorType compute_target(const TensorShape &shape_a, const TensorShape &shape_b, DataType data_type)
{
// Create tensors
- TensorType a = create_tensor<TensorType>(shape_a, data_type, 1, fixed_point_position);
- TensorType b = create_tensor<TensorType>(shape_b, data_type, 1, fixed_point_position);
+ TensorType a = create_tensor<TensorType>(shape_a, data_type, 1);
+ TensorType b = create_tensor<TensorType>(shape_b, data_type, 1);
// Create and configure function
FunctionType f;
@@ -107,10 +106,10 @@
return b;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape_a, const TensorShape &shape_b, DataType data_type, int fixed_point_position)
+ SimpleTensor<T> compute_reference(const TensorShape &shape_a, const TensorShape &shape_b, DataType data_type)
{
// Create reference
- SimpleTensor<T> a{ shape_a, data_type, 1, fixed_point_position };
+ SimpleTensor<T> a{ shape_a, data_type, 1 };
// Fill reference
fill(a, 0);
@@ -120,21 +119,8 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
DataType _data_type{};
};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class GEMMTranspose1xWValidationFixture : public GEMMTranspose1xWValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(size_t x, size_t y, DataType data_type)
- {
- GEMMTranspose1xWValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(x, y, data_type, 0);
- }
-};
-
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/Im2ColFixture.h b/tests/validation/fixtures/Im2ColFixture.h
index 7ef3cdc..b5e83a9 100644
--- a/tests/validation/fixtures/Im2ColFixture.h
+++ b/tests/validation/fixtures/Im2ColFixture.h
@@ -44,18 +44,20 @@
{
using namespace arm_compute::misc::shape_calculator;
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T, bool batch_size_on_z>
class Im2ColValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape input_shape, DataType data_type, const Size2D &kernel_dims, const PadStrideInfo &conv_info, const QuantizationInfo &quant_info, const DataLayout &data_layout)
+ void setup(TensorShape input_shape, DataType data_type, const Size2D &kernel_dims, const PadStrideInfo &conv_info, const QuantizationInfo &quant_info, const DataLayout &data_layout,
+ unsigned int num_groups, bool channels_first_output_nhwc)
{
_kernel_dims = kernel_dims;
_conv_info = conv_info;
_quant_info = quant_info;
_data_layout = data_layout;
_has_bias = data_type != DataType::QASYMM8;
+ _num_groups = num_groups;
if(_data_layout == DataLayout::NHWC)
{
@@ -65,11 +67,10 @@
TensorInfo input_info(input_shape, 1, data_type);
input_info.set_data_layout(_data_layout);
- const TensorShape output_shape = compute_im2col_conv_shape(&input_info, _kernel_dims, _conv_info, _has_bias, Size2D(1U, 1U));
+ const TensorShape output_shape = compute_im2col_conv_shape(&input_info, _kernel_dims, _conv_info, _has_bias, Size2D(1U, 1U), batch_size_on_z && _num_groups == 1, _num_groups);
+ _target = compute_target(input_shape, output_shape, data_type);
- _target = compute_target(input_shape, output_shape, data_type);
-
- compute_reference(input_shape, output_shape, data_type);
+ compute_reference(input_shape, output_shape, data_type, channels_first_output_nhwc);
}
protected:
@@ -82,12 +83,12 @@
TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, DataType data_type)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, 0, _quant_info, _data_layout);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, 0, _quant_info);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, _quant_info, _data_layout);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, _quant_info);
// Create and configure function
FunctionType im2col_func;
- im2col_func.configure(&src, &dst, _kernel_dims, _conv_info, _has_bias);
+ im2col_func.configure(&src, &dst, _kernel_dims, _conv_info, _has_bias, Size2D(1U, 1U), _num_groups);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -108,14 +109,16 @@
return dst;
}
- void compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, DataType data_type)
+ void compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, DataType data_type, bool channels_first_output_nhwc)
{
// Create reference
- SimpleTensor<T> src{ input_shape, data_type, 1, 0, _quant_info, _data_layout };
- _reference = SimpleTensor<T>(output_shape, data_type, 1, 0, _quant_info, DataLayout::NCHW);
+ SimpleTensor<T> src{ input_shape, data_type, 1, _quant_info, _data_layout };
+ _reference = SimpleTensor<T>(output_shape, data_type, 1, _quant_info, DataLayout::NCHW);
+
// Fill reference
fill(src);
- reference::im2col<T>(src, _reference, _kernel_dims, _conv_info, _has_bias);
+
+ reference::im2col<T>(src, _reference, _kernel_dims, _conv_info, _has_bias, _num_groups, channels_first_output_nhwc);
}
TensorType _target{};
SimpleTensor<T> _reference{};
@@ -124,6 +127,7 @@
DataLayout _data_layout{};
QuantizationInfo _quant_info{};
bool _has_bias{};
+ unsigned int _num_groups{};
};
} // namespace validation
} // namespace test
diff --git a/tests/validation/fixtures/LSTMLayerFixture.h b/tests/validation/fixtures/LSTMLayerFixture.h
index b7e43b3..20df855 100644
--- a/tests/validation/fixtures/LSTMLayerFixture.h
+++ b/tests/validation/fixtures/LSTMLayerFixture.h
@@ -72,9 +72,8 @@
const TensorShape &output_cell_shape, const TensorShape &output_shape, const TensorShape &scratch_shape, ActivationLayerInfo info, float cell_threshold,
float projection_threshold, DataType data_type, bool projection_opt, bool peephole_opt)
{
- // Create projection bias shape
- TensorShape projection_bias_shape{};
- projection_bias_shape.set(0, output_shape.x());
+ const unsigned int num_cells = input_weights_shape.y();
+ const unsigned int num_outputs = recurrent_weights_shape.x();
// Create tensors
TensorType input = create_tensor<TensorType>(input_shape, data_type);
@@ -87,9 +86,11 @@
TensorType forget_gate_bias = create_tensor<TensorType>(cell_bias_shape, data_type);
TensorType cell_bias = create_tensor<TensorType>(cell_bias_shape, data_type);
TensorType output_gate_bias = create_tensor<TensorType>(cell_bias_shape, data_type);
- TensorType output_state = create_tensor<TensorType>(output_shape, data_type);
- TensorType cell_state = create_tensor<TensorType>(output_cell_shape, data_type);
+ TensorType output_state_in = create_tensor<TensorType>(output_shape, data_type);
+ TensorType cell_state_in = create_tensor<TensorType>(output_cell_shape, data_type);
TensorType scratch = create_tensor<TensorType>(scratch_shape, data_type);
+ TensorType output_state_out = create_tensor<TensorType>(output_shape, data_type);
+ TensorType cell_state_out = create_tensor<TensorType>(output_cell_shape, data_type);
TensorType output = create_tensor<TensorType>(output_shape, data_type);
TensorType input_to_input_w;
TensorType recurrent_to_input_w;
@@ -108,34 +109,35 @@
{
input_to_input_w = create_tensor<TensorType>(input_weights_shape, data_type);
recurrent_to_input_w = create_tensor<TensorType>(recurrent_weights_shape, data_type);
- cell_to_input_w = create_tensor<TensorType>(cell_bias_shape, data_type);
- input_gate_bias = create_tensor<TensorType>(cell_bias_shape, data_type);
+ if(peephole_opt)
+ {
+ cell_to_input_w = create_tensor<TensorType>(cell_bias_shape, data_type);
+ }
+ input_gate_bias = create_tensor<TensorType>(cell_bias_shape, data_type);
lstm_params.set_cifg_params(&input_to_input_w, &recurrent_to_input_w, &cell_to_input_w, &input_gate_bias);
}
if(peephole_opt)
{
- if(cifg_opt)
- {
- cell_to_input_w = create_tensor<TensorType>(cell_bias_shape, data_type);
- }
cell_to_forget_w = create_tensor<TensorType>(cell_bias_shape, data_type);
cell_to_output_w = create_tensor<TensorType>(cell_bias_shape, data_type);
- lstm_params.set_peephole_params(&cell_to_input_w, &cell_to_forget_w, &cell_to_output_w);
+ lstm_params.set_peephole_params(&cell_to_forget_w, &cell_to_output_w);
}
if(projection_opt)
{
- projection_w = create_tensor<TensorType>(recurrent_weights_shape, data_type);
- projection_bias = create_tensor<TensorType>(projection_bias_shape, data_type);
+ projection_w = create_tensor<TensorType>(TensorShape(num_cells, num_outputs), data_type);
+ projection_bias = create_tensor<TensorType>(TensorShape(num_outputs), data_type);
lstm_params.set_projection_params(&projection_w, &projection_bias);
}
// Create and configure function
FunctionType lstm;
lstm.configure(&input, &input_to_forget_w, &input_to_cell_w, &input_to_output_w, &recurrent_to_forget_w,
- &recurrent_to_cell_w, &recurrent_to_output_w, &forget_gate_bias, &cell_bias, &output_gate_bias, &output_state, &cell_state,
- &scratch, &output, lstm_params, info, cell_threshold, projection_threshold);
+ &recurrent_to_cell_w, &recurrent_to_output_w, &forget_gate_bias, &cell_bias, &output_gate_bias,
+ &output_state_in, &cell_state_in,
+ &scratch, &output_state_out, &cell_state_out, &output,
+ lstm_params, info, cell_threshold, projection_threshold);
ARM_COMPUTE_EXPECT(input.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(input_to_forget_w.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -147,9 +149,11 @@
ARM_COMPUTE_EXPECT(forget_gate_bias.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(cell_bias.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(output_gate_bias.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(output_state.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(cell_state.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(output_state_in.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(cell_state_in.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(scratch.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(output_state_out.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(cell_state_out.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(output.info()->is_resizable(), framework::LogLevel::ERRORS);
// Allocate tensors
@@ -163,9 +167,11 @@
forget_gate_bias.allocator()->allocate();
cell_bias.allocator()->allocate();
output_gate_bias.allocator()->allocate();
- output_state.allocator()->allocate();
- cell_state.allocator()->allocate();
+ output_state_in.allocator()->allocate();
+ cell_state_in.allocator()->allocate();
scratch.allocator()->allocate();
+ output_state_out.allocator()->allocate();
+ cell_state_out.allocator()->allocate();
output.allocator()->allocate();
ARM_COMPUTE_EXPECT(!input.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -178,9 +184,11 @@
ARM_COMPUTE_EXPECT(!forget_gate_bias.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(!cell_bias.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(!output_gate_bias.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(!output_state.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(!cell_state.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!output_state_in.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!cell_state_in.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(!scratch.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!output_state_out.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!cell_state_out.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(!output.info()->is_resizable(), framework::LogLevel::ERRORS);
// Fill tensors
@@ -194,8 +202,8 @@
fill(AccessorType(forget_gate_bias), 7);
fill(AccessorType(cell_bias), 8);
fill(AccessorType(output_gate_bias), 9);
- fill(AccessorType(output_state), 10);
- fill(AccessorType(cell_state), 11);
+ fill(AccessorType(output_state_in), 10);
+ fill(AccessorType(cell_state_in), 11);
fill(AccessorType(scratch), 12);
if(!cifg_opt)
@@ -214,20 +222,16 @@
ARM_COMPUTE_EXPECT(!input_gate_bias.info()->is_resizable(), framework::LogLevel::ERRORS);
fill(AccessorType(input_to_input_w), 13);
fill(AccessorType(recurrent_to_input_w), 14);
- fill(AccessorType(cell_to_input_w), 15);
+ if(peephole_opt)
+ {
+ fill(AccessorType(cell_to_input_w), 15);
+ }
fill(AccessorType(recurrent_to_input_w), 16);
fill(AccessorType(input_gate_bias), 17);
}
if(peephole_opt)
{
- if(cifg_opt)
- {
- ARM_COMPUTE_EXPECT(cell_to_input_w.info()->is_resizable(), framework::LogLevel::ERRORS);
- cell_to_input_w.allocator()->allocate();
- ARM_COMPUTE_EXPECT(!cell_to_input_w.info()->is_resizable(), framework::LogLevel::ERRORS);
- fill(AccessorType(cell_to_input_w), 15);
- }
ARM_COMPUTE_EXPECT(cell_to_forget_w.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(cell_to_output_w.info()->is_resizable(), framework::LogLevel::ERRORS);
cell_to_forget_w.allocator()->allocate();
@@ -262,9 +266,14 @@
const TensorShape &output_cell_shape, const TensorShape &output_shape, const TensorShape &scratch_shape, ActivationLayerInfo info, float cell_threshold,
float projection_threshold, DataType data_type, bool projection_opt, bool peephole_opt)
{
+ const unsigned int num_cells = input_weights_shape.y();
+ const unsigned int num_outputs = recurrent_weights_shape.x();
+
+ // Create projection weights shape
+ TensorShape projection_weights_shape(num_cells, num_outputs);
+
// Create projection bias shape
- TensorShape projection_bias_shape{};
- projection_bias_shape.set(0, output_shape.x());
+ TensorShape projection_bias_shape(num_outputs);
TensorShape gemm_shape{ 1, output_shape.y() };
SimpleTensor<T> gemm_out{ gemm_shape, data_type };
@@ -286,11 +295,13 @@
SimpleTensor<T> forget_gate_bias{ cell_bias_shape, data_type };
SimpleTensor<T> cell_bias{ cell_bias_shape, data_type };
SimpleTensor<T> output_gate_bias{ cell_bias_shape, data_type };
- SimpleTensor<T> projection_w{ recurrent_weights_shape, data_type };
+ SimpleTensor<T> projection_w{ projection_weights_shape, data_type };
SimpleTensor<T> projection_bias{ projection_bias_shape, data_type };
- SimpleTensor<T> output_state{ output_shape, data_type };
- SimpleTensor<T> cell_state{ output_cell_shape, data_type };
+ SimpleTensor<T> output_state_in{ output_shape, data_type };
+ SimpleTensor<T> cell_state_in{ output_cell_shape, data_type };
SimpleTensor<T> scratch{ scratch_shape, data_type };
+ SimpleTensor<T> output_state_out{ output_shape, data_type };
+ SimpleTensor<T> cell_state_out{ output_cell_shape, data_type };
SimpleTensor<T> output{ output_shape, data_type };
// Fill reference
@@ -304,8 +315,8 @@
fill(forget_gate_bias, 7);
fill(cell_bias, 8);
fill(output_gate_bias, 9);
- fill(output_state, 10);
- fill(cell_state, 11);
+ fill(output_state_in, 10);
+ fill(cell_state_in, 11);
fill(scratch, 12);
fill(input_to_input_w, 13);
fill(recurrent_to_input_w, 14);
@@ -321,14 +332,13 @@
// Compute forget_gate
SimpleTensor<T> fully_connected_forget = reference::fully_connected_layer(input, input_to_forget_w, forget_gate_bias, output_cell_shape);
SimpleTensor<T> transposed_weights = reference::transpose(recurrent_to_forget_w);
- SimpleTensor<T> gemm = reference::gemm(output_state, transposed_weights, cell_state, 1.f, 0.f);
+ SimpleTensor<T> gemm = reference::gemm(output_state_in, transposed_weights, cell_state_in, 1.f, 0.f);
SimpleTensor<T> forget_gate = reference::arithmetic_addition(fully_connected_forget, gemm, data_type, ConvertPolicy::SATURATE);
if(peephole_opt)
{
- transposed_weights = reference::transpose(cell_to_forget_w);
- gemm = reference::gemm(cell_state, transposed_weights, gemm_out, 1.f, 0.f);
- forget_gate = reference::arithmetic_addition(forget_gate, gemm, data_type, ConvertPolicy::SATURATE);
+ SimpleTensor<T> pixelwise_mul_forget_gate = reference::pixel_wise_multiplication(cell_state_in, cell_to_forget_w, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
+ forget_gate = reference::arithmetic_addition(forget_gate, pixelwise_mul_forget_gate, data_type, ConvertPolicy::SATURATE);
}
forget_gate = reference::activation_layer(forget_gate, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC));
@@ -345,54 +355,55 @@
{
SimpleTensor<T> fully_connected_input = reference::fully_connected_layer(input, input_to_input_w, input_gate_bias, output_cell_shape);
transposed_weights = reference::transpose(recurrent_to_input_w);
- gemm = reference::gemm(output_state, transposed_weights, cell_state, 1.f, 0.f);
+ gemm = reference::gemm(output_state_in, transposed_weights, cell_state_in, 1.f, 0.f);
input_gate = reference::arithmetic_addition(fully_connected_input, gemm, data_type, ConvertPolicy::SATURATE);
- transposed_weights = reference::transpose(cell_to_input_w);
- gemm = reference::gemm(cell_state, transposed_weights, gemm_out, 1.f, 0.f);
- input_gate = reference::arithmetic_addition(input_gate, gemm, data_type, ConvertPolicy::SATURATE);
- input_gate = reference::activation_layer(input_gate, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC));
+ if(peephole_opt)
+ {
+ SimpleTensor<T> pixelwise_mul_input_gate = reference::pixel_wise_multiplication(cell_state_in, cell_to_input_w, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
+ input_gate = reference::arithmetic_addition(input_gate, pixelwise_mul_input_gate, data_type, ConvertPolicy::SATURATE);
+ }
+ input_gate = reference::activation_layer(input_gate, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC));
}
// Compute cell_state
SimpleTensor<T> fully_connected_cell_state = reference::fully_connected_layer(input, input_to_cell_w, cell_bias, output_cell_shape);
transposed_weights = reference::transpose(recurrent_to_cell_w);
- gemm = reference::gemm(output_state, transposed_weights, cell_state, 1.f, 0.f);
- SimpleTensor<T> pixelwise_mul = reference::pixel_wise_multiplication(cell_state, forget_gate, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
- cell_state = reference::arithmetic_addition(fully_connected_cell_state, gemm, data_type, ConvertPolicy::SATURATE);
- cell_state = reference::activation_layer(cell_state, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC));
- cell_state = reference::pixel_wise_multiplication(cell_state, input_gate, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
- cell_state = reference::arithmetic_addition(cell_state, pixelwise_mul, data_type, ConvertPolicy::SATURATE);
+ gemm = reference::gemm(output_state_in, transposed_weights, cell_state_out, 1.f, 0.f);
+ SimpleTensor<T> pixelwise_mul = reference::pixel_wise_multiplication(cell_state_in, forget_gate, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
+ cell_state_out = reference::arithmetic_addition(fully_connected_cell_state, gemm, data_type, ConvertPolicy::SATURATE);
+ cell_state_out = reference::activation_layer(cell_state_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC));
+ cell_state_out = reference::pixel_wise_multiplication(cell_state_out, input_gate, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
+ cell_state_out = reference::arithmetic_addition(cell_state_out, pixelwise_mul, data_type, ConvertPolicy::SATURATE);
if(cell_threshold != 0.f)
{
- cell_state = reference::activation_layer(cell_state, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, -cell_threshold, cell_threshold));
+ cell_state_out = reference::activation_layer(cell_state_out, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, -cell_threshold, cell_threshold));
}
// Compute output
SimpleTensor<T> fully_connected_output = reference::fully_connected_layer(input, input_to_output_w, output_gate_bias, output_cell_shape);
transposed_weights = reference::transpose(recurrent_to_output_w);
- gemm = reference::gemm(output_state, transposed_weights, cell_state, 1.f, 0.f);
+ gemm = reference::gemm(output_state_in, transposed_weights, cell_state_out, 1.f, 0.f);
output = reference::arithmetic_addition(fully_connected_output, gemm, data_type, ConvertPolicy::SATURATE);
if(peephole_opt)
{
- transposed_weights = reference::transpose(cell_to_output_w);
- gemm = reference::gemm(cell_state, transposed_weights, gemm_out, 1.f, 0.f);
- output = reference::arithmetic_addition(output, gemm, data_type, ConvertPolicy::SATURATE);
+ pixelwise_mul = reference::pixel_wise_multiplication(cell_state_out, cell_to_output_w, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
+ output = reference::arithmetic_addition(output, pixelwise_mul, data_type, ConvertPolicy::SATURATE);
}
output = reference::activation_layer(output, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC));
// Compute output state
- SimpleTensor<T> cell_state_activation = reference::activation_layer(cell_state, info);
- output_state = reference::pixel_wise_multiplication(output, cell_state_activation, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
+ SimpleTensor<T> cell_state_activation = reference::activation_layer(cell_state_out, info);
+ output_state_out = reference::pixel_wise_multiplication(output, cell_state_activation, 1, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_EVEN);
if(projection_opt)
{
- SimpleTensor<T> fully_connected_projection = reference::fully_connected_layer(output_state, projection_w, projection_bias, output_cell_shape);
+ SimpleTensor<T> fully_connected_projection = reference::fully_connected_layer(output_state_out, projection_w, projection_bias, output_cell_shape);
if(projection_threshold != 0.f)
{
- output_state = reference::activation_layer(fully_connected_projection, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, -projection_threshold, projection_threshold));
+ output_state_out = reference::activation_layer(fully_connected_projection, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, -projection_threshold, projection_threshold));
}
}
- return output_state;
+ return output_state_out;
}
TensorType _target{};
diff --git a/tests/validation/fixtures/LaplacianPyramidFixture.h b/tests/validation/fixtures/LaplacianPyramidFixture.h
new file mode 100644
index 0000000..6344272
--- /dev/null
+++ b/tests/validation/fixtures/LaplacianPyramidFixture.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE
+#define ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE
+
+#include "arm_compute/core/IPyramid.h"
+#include "arm_compute/core/PyramidInfo.h"
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/reference/LaplacianPyramid.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T, typename U, typename PyramidType>
+class LaplacianPyramidValidationFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape input_shape, BorderMode border_mode, size_t num_levels, Format format_in, Format format_out)
+ {
+ std::mt19937 generator(library->seed());
+ std::uniform_int_distribution<T> distribution_u8(0, 255);
+ const T constant_border_value = distribution_u8(generator);
+
+ _pyramid_levels = num_levels;
+ _border_mode = border_mode;
+
+ _target = compute_target(input_shape, border_mode, constant_border_value, format_in, format_out);
+ _reference = compute_reference(input_shape, border_mode, constant_border_value, format_in, format_out);
+ }
+
+protected:
+ template <typename V>
+ void fill(V &&tensor)
+ {
+ library->fill_tensor_uniform(tensor, 0);
+ }
+
+ PyramidType compute_target(const TensorShape &input_shape, BorderMode border_mode, T constant_border_value,
+ Format format_in, Format format_out)
+ {
+ // Create pyramid
+ PyramidType pyramid{};
+
+ // Create Pyramid Info
+ PyramidInfo pyramid_info(_pyramid_levels, SCALE_PYRAMID_HALF, input_shape, format_out);
+
+ // Use conservative padding strategy to fit all subsequent kernels
+ pyramid.init_auto_padding(pyramid_info);
+
+ // Create tensors
+ TensorType src = create_tensor<TensorType>(input_shape, format_in);
+
+ // The first two dimensions of the output tensor must match the first
+ // two dimensions of the tensor in the last level of the pyramid
+ TensorShape dst_shape(input_shape);
+ dst_shape.set(0, pyramid.get_pyramid_level(_pyramid_levels - 1)->info()->dimension(0));
+ dst_shape.set(1, pyramid.get_pyramid_level(_pyramid_levels - 1)->info()->dimension(1));
+
+ // The lowest resolution tensor necessary to reconstruct the input
+ // tensor from the pyramid.
+ _dst_target = create_tensor<TensorType>(dst_shape, format_out);
+
+ // Create and configure function
+ FunctionType laplacian_pyramid;
+ laplacian_pyramid.configure(&src, &pyramid, &_dst_target, border_mode, constant_border_value);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(_dst_target.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ _dst_target.allocator()->allocate();
+
+ ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!_dst_target.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ pyramid.allocate();
+
+ for(size_t i = 0; i < pyramid_info.num_levels(); ++i)
+ {
+ ARM_COMPUTE_EXPECT(!pyramid.get_pyramid_level(i)->info()->is_resizable(), framework::LogLevel::ERRORS);
+ }
+
+ // Fill tensors
+ fill(AccessorType(src));
+
+ // Compute function
+ laplacian_pyramid.run();
+
+ return pyramid;
+ }
+
+ std::vector<SimpleTensor<U>> compute_reference(const TensorShape &shape, BorderMode border_mode, T constant_border_value,
+ Format format_in, Format format_out)
+ {
+ // Create reference
+ SimpleTensor<T> src{ shape, format_in };
+
+ // The first two dimensions of the output tensor must match the first
+ // two dimensions of the tensor in the last level of the pyramid
+ TensorShape dst_shape(shape);
+ dst_shape.set(0, static_cast<float>(shape[0] + 1) / static_cast<float>(std::pow(2, _pyramid_levels - 1)));
+ dst_shape.set(1, static_cast<float>(shape[1] + 1) / static_cast<float>(std::pow(2, _pyramid_levels - 1)));
+
+ _dst_reference = SimpleTensor<U>(dst_shape, format_out);
+
+ // Fill reference
+ fill(src);
+
+ return reference::laplacian_pyramid<T, U>(src, _dst_reference, _pyramid_levels, border_mode, constant_border_value);
+ }
+
+ size_t _pyramid_levels{};
+ BorderMode _border_mode{};
+ SimpleTensor<U> _dst_reference{};
+ TensorType _dst_target{};
+ PyramidType _target{};
+ std::vector<SimpleTensor<U>> _reference{};
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE */
diff --git a/tests/validation/fixtures/LaplacianReconstructFixture.h b/tests/validation/fixtures/LaplacianReconstructFixture.h
new file mode 100644
index 0000000..dfa3023
--- /dev/null
+++ b/tests/validation/fixtures/LaplacianReconstructFixture.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE
+#define ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE
+
+#include "arm_compute/core/IPyramid.h"
+#include "arm_compute/core/PyramidInfo.h"
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/fixtures/LaplacianPyramidFixture.h"
+#include "tests/validation/reference/LaplacianPyramid.h"
+#include "tests/validation/reference/LaplacianReconstruct.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+template <typename TensorType, typename AccessorType, typename FunctionType, typename LaplacianPyramidType, typename T, typename U, typename PyramidType>
+class LaplacianReconstructValidationFixture : public LaplacianPyramidValidationFixture<TensorType, AccessorType, LaplacianPyramidType, U, T, PyramidType>
+{
+public:
+ template <typename...>
+ void setup(TensorShape input_shape, BorderMode border_mode, size_t num_levels, Format format_in, Format format_out)
+ {
+ std::mt19937 generator(library->seed());
+ std::uniform_int_distribution<U> distribution_u8(0, 255);
+ const U constant_border_value = distribution_u8(generator);
+
+ using LPF = LaplacianPyramidValidationFixture<TensorType, AccessorType, LaplacianPyramidType, U, T, PyramidType>;
+ LPF::setup(input_shape, border_mode, num_levels, format_out, format_in);
+
+ // Compute target and reference values using the pyramid and lowest
+ // resolution tensor output from Laplacian Pyramid kernel
+ _target = compute_target(input_shape, LPF::_target, LPF::_dst_target, border_mode, constant_border_value);
+ _reference = compute_reference(LPF::_reference, LPF::_dst_reference, border_mode, constant_border_value);
+ }
+
+protected:
+ template <typename V>
+ void fill(V &&tensor)
+ {
+ library->fill_tensor_uniform(tensor, 0);
+ }
+
+ TensorType compute_target(const TensorShape &input_shape, PyramidType &pyramid, TensorType &low_res, BorderMode border_mode, U constant_border_value)
+ {
+ // Create tensors
+ TensorType dst = create_tensor<TensorType>(input_shape, DataType::U8);
+
+ // Create and configure function
+ FunctionType laplacian_reconstruct;
+ laplacian_reconstruct.configure(&pyramid, &low_res, &dst, border_mode, constant_border_value);
+
+ // Allocate tensors
+ dst.allocator()->allocate();
+ ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Compute function
+ laplacian_reconstruct.run();
+
+ return dst;
+ }
+
+ SimpleTensor<U> compute_reference(const std::vector<SimpleTensor<T>> &pyramid,
+ const SimpleTensor<T> &low_res, BorderMode border_mode, U constant_border_value)
+ {
+ return reference::laplacian_reconstruct<T, U>(pyramid, low_res, border_mode, constant_border_value);
+ }
+
+ TensorType _target{};
+ SimpleTensor<U> _reference{};
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE */
diff --git a/tests/validation/fixtures/MagnitudeFixture.h b/tests/validation/fixtures/MagnitudeFixture.h
index 1c52907..0930fb4 100644
--- a/tests/validation/fixtures/MagnitudeFixture.h
+++ b/tests/validation/fixtures/MagnitudeFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -43,9 +43,9 @@
{
public:
template <typename...>
- void setup(TensorShape shape, Format format, MagnitudeType magnitude_type, bool use_fp16)
+ void setup(TensorShape shape, Format format, MagnitudeType magnitude_type)
{
- _target = compute_target(shape, format, magnitude_type, use_fp16);
+ _target = compute_target(shape, format, magnitude_type);
_reference = compute_reference(shape, format, magnitude_type);
_magnitude_type = magnitude_type;
}
@@ -57,7 +57,7 @@
library->fill_tensor_uniform(tensor, seed_offset);
}
- TensorType compute_target(const TensorShape &shape, Format format, MagnitudeType magnitude_type, bool use_fp16)
+ TensorType compute_target(const TensorShape &shape, Format format, MagnitudeType magnitude_type)
{
DataType data_type = data_type_from_format(format);
@@ -73,7 +73,7 @@
// Create and configure function
FunctionType magnitude;
- magnitude.configure(&src1, &src2, &dst, magnitude_type, use_fp16);
+ magnitude.configure(&src1, &src2, &dst, magnitude_type);
ARM_COMPUTE_EXPECT(src1.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(src2.info()->is_resizable(), framework::LogLevel::ERRORS);
diff --git a/tests/validation/fixtures/MeanStdDevFixture.h b/tests/validation/fixtures/MeanStdDevFixture.h
index 17dfe78..58d4644 100644
--- a/tests/validation/fixtures/MeanStdDevFixture.h
+++ b/tests/validation/fixtures/MeanStdDevFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -50,7 +50,15 @@
template <typename U>
void fill(U &&tensor)
{
- library->fill_tensor_uniform(tensor, 0);
+ if(is_data_type_float(tensor.data_type()))
+ {
+ std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
+ library->fill(tensor, distribution, 0);
+ }
+ else
+ {
+ library->fill_tensor_uniform(tensor, 0);
+ }
}
std::pair<float, float> compute_target(const TensorShape &shape, DataType data_type)
diff --git a/tests/validation/fixtures/NormalizationLayerFixture.h b/tests/validation/fixtures/NormalizationLayerFixture.h
index e7d83c7..318b77e 100644
--- a/tests/validation/fixtures/NormalizationLayerFixture.h
+++ b/tests/validation/fixtures/NormalizationLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -43,40 +43,31 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class NormalizationValidationFixedPointFixture : public framework::Fixture
+class NormalizationValidationGenericFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape, NormType norm_type, int norm_size, float beta, bool is_scaled, DataType data_type, int fractional_bits)
+ void setup(TensorShape shape, NormType norm_type, int norm_size, float beta, bool is_scaled, DataType data_type)
{
- _fractional_bits = fractional_bits;
NormalizationLayerInfo info(norm_type, norm_size, 5, beta, 1.f, is_scaled);
- _target = compute_target(shape, info, data_type, fractional_bits);
- _reference = compute_reference(shape, info, data_type, fractional_bits);
+ _target = compute_target(shape, info, data_type);
+ _reference = compute_reference(shape, info, data_type);
}
protected:
template <typename U>
void fill(U &&tensor)
{
- if(_fractional_bits == 0)
- {
- library->fill_tensor_uniform(tensor, 0);
- }
- else
- {
- const int one_fixed = 1 << _fractional_bits;
- std::uniform_int_distribution<> distribution(-one_fixed, one_fixed);
- library->fill(tensor, distribution, 0);
- }
+ std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
+ library->fill(tensor, distribution, 0);
}
- TensorType compute_target(const TensorShape &shape, NormalizationLayerInfo info, DataType data_type, int fixed_point_position = 0)
+ TensorType compute_target(const TensorShape &shape, NormalizationLayerInfo info, DataType data_type)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position);
- TensorType dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position);
+ TensorType src = create_tensor<TensorType>(shape, data_type, 1);
+ TensorType dst = create_tensor<TensorType>(shape, data_type, 1);
// Create and configure function
FunctionType norm_layer;
@@ -101,10 +92,10 @@
return dst;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape, NormalizationLayerInfo info, DataType data_type, int fixed_point_position = 0)
+ SimpleTensor<T> compute_reference(const TensorShape &shape, NormalizationLayerInfo info, DataType data_type)
{
// Create reference
- SimpleTensor<T> src{ shape, data_type, 1, fixed_point_position };
+ SimpleTensor<T> src{ shape, data_type, 1 };
// Fill reference
fill(src);
@@ -114,17 +105,16 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
};
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class NormalizationValidationFixture : public NormalizationValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
+class NormalizationValidationFixture : public NormalizationValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
{
public:
template <typename...>
void setup(TensorShape shape, NormType norm_type, int norm_size, float beta, bool is_scaled, DataType data_type)
{
- NormalizationValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, norm_type, norm_size, beta, is_scaled, data_type, 0);
+ NormalizationValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, norm_type, norm_size, beta, is_scaled, data_type);
}
};
} // namespace validation
diff --git a/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h b/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h
index 4ec4ae6..09905cf 100644
--- a/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h
+++ b/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h
@@ -41,7 +41,7 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class NormalizePlanarYUVLayerValidationFixedPointFixture : public framework::Fixture
+class NormalizePlanarYUVLayerValidationFixture : public framework::Fixture
{
public:
template <typename...>
@@ -123,17 +123,6 @@
SimpleTensor<T> _reference{};
DataType _data_type{};
};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class NormalizePlanarYUVLayerValidationFixture : public NormalizePlanarYUVLayerValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape shape0, TensorShape shape1, DataType dt)
- {
- NormalizePlanarYUVLayerValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape0, shape1, dt);
- }
-};
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/PoolingLayerFixture.h b/tests/validation/fixtures/PoolingLayerFixture.h
index 27b033a..3e34f98 100644
--- a/tests/validation/fixtures/PoolingLayerFixture.h
+++ b/tests/validation/fixtures/PoolingLayerFixture.h
@@ -47,14 +47,13 @@
{
public:
template <typename...>
- void setup(TensorShape shape, PoolingLayerInfo pool_info, DataType data_type, DataLayout data_layout, int fractional_bits, QuantizationInfo quantization_info)
+ void setup(TensorShape shape, PoolingLayerInfo pool_info, DataType data_type, DataLayout data_layout, QuantizationInfo quantization_info)
{
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
_pool_info = pool_info;
- _target = compute_target(shape, pool_info, data_type, data_layout, fractional_bits, quantization_info);
- _reference = compute_reference(shape, pool_info, data_type, fractional_bits, quantization_info);
+ _target = compute_target(shape, pool_info, data_type, data_layout, quantization_info);
+ _reference = compute_reference(shape, pool_info, data_type, quantization_info);
}
protected:
@@ -66,20 +65,14 @@
std::uniform_real_distribution<> distribution(-1.f, 1.f);
library->fill(tensor, distribution, 0);
}
- else if(is_data_type_quantized_asymmetric(tensor.data_type()))
+ else // data type is quantized_asymmetric
{
library->fill_tensor_uniform(tensor, 0);
}
- else
- {
- const int one_fixed = 1 << _fractional_bits;
- std::uniform_int_distribution<> distribution(-one_fixed, one_fixed);
- library->fill(tensor, distribution, 0);
- }
}
TensorType compute_target(TensorShape shape, PoolingLayerInfo info,
- DataType data_type, DataLayout data_layout, int fixed_point_position, QuantizationInfo quantization_info)
+ DataType data_type, DataLayout data_layout, QuantizationInfo quantization_info)
{
// Change shape in case of NHWC.
if(data_layout == DataLayout::NHWC)
@@ -88,7 +81,7 @@
}
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, quantization_info, data_layout);
+ TensorType src = create_tensor<TensorType>(shape, data_type, 1, quantization_info, data_layout);
TensorType dst;
// Create and configure function
@@ -115,10 +108,10 @@
}
SimpleTensor<T> compute_reference(const TensorShape &shape, PoolingLayerInfo info,
- DataType data_type, int fixed_point_position, QuantizationInfo quantization_info)
+ DataType data_type, QuantizationInfo quantization_info)
{
// Create reference
- SimpleTensor<T> src{ shape, data_type, 1, fixed_point_position, quantization_info };
+ SimpleTensor<T> src{ shape, data_type, 1, quantization_info };
// Fill reference
fill(src);
@@ -128,7 +121,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
QuantizationInfo _quantization_info{};
PoolingLayerInfo _pool_info{};
};
@@ -141,19 +133,7 @@
void setup(TensorShape shape, PoolingType pool_type, Size2D pool_size, PadStrideInfo pad_stride_info, bool exclude_padding, DataType data_type, DataLayout data_layout)
{
PoolingLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, PoolingLayerInfo(pool_type, pool_size, pad_stride_info, exclude_padding),
- data_type, data_layout, 0, QuantizationInfo());
- }
-};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class PoolingLayerValidationFixedPointFixture : public PoolingLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape shape, PoolingType pool_type, Size2D pool_size, PadStrideInfo pad_stride_info, bool exclude_padding, DataType data_type, int fractional_bits)
- {
- PoolingLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, PoolingLayerInfo(pool_type, pool_size, pad_stride_info, exclude_padding),
- data_type, DataLayout::NCHW, fractional_bits, QuantizationInfo());
+ data_type, data_layout, QuantizationInfo());
}
};
@@ -166,7 +146,7 @@
QuantizationInfo quantization_info, DataLayout data_layout = DataLayout::NCHW)
{
PoolingLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, PoolingLayerInfo(pool_type, pool_size, pad_stride_info, exclude_padding),
- data_type, data_layout, 0, quantization_info);
+ data_type, data_layout, quantization_info);
}
};
@@ -177,7 +157,7 @@
template <typename...>
void setup(TensorShape src_shape, PoolingLayerInfo pool_info, DataType data_type)
{
- PoolingLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(src_shape, pool_info, data_type, DataLayout::NCHW, 0, QuantizationInfo());
+ PoolingLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(src_shape, pool_info, data_type, DataLayout::NCHW, QuantizationInfo());
}
};
@@ -188,7 +168,7 @@
template <typename...>
void setup(TensorShape shape, PoolingType pool_type, DataType data_type, DataLayout data_layout = DataLayout::NCHW)
{
- PoolingLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, PoolingLayerInfo(pool_type), data_type, DataLayout::NCHW, 0, QuantizationInfo());
+ PoolingLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, PoolingLayerInfo(pool_type), data_type, DataLayout::NCHW, QuantizationInfo());
}
};
diff --git a/tests/validation/fixtures/QuantizationLayerFixture.h b/tests/validation/fixtures/QuantizationLayerFixture.h
index 6ce673a..8590b71 100644
--- a/tests/validation/fixtures/QuantizationLayerFixture.h
+++ b/tests/validation/fixtures/QuantizationLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -43,7 +43,7 @@
namespace validation
{
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class QuantizationValidationFixedPointFixture : public framework::Fixture
+class QuantizationValidationFixture : public framework::Fixture
{
public:
template <typename...>
@@ -103,17 +103,6 @@
TensorType _target{};
SimpleTensor<uint8_t> _reference{};
};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class QuantizationValidationFixture : public QuantizationValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape shape, DataType data_type)
- {
- QuantizationValidationFixedPointFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type);
- }
-};
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/ReductionOperationFixture.h b/tests/validation/fixtures/ReductionOperationFixture.h
index 6fa5f0c..0dee7eb 100644
--- a/tests/validation/fixtures/ReductionOperationFixture.h
+++ b/tests/validation/fixtures/ReductionOperationFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -56,7 +56,8 @@
template <typename U>
void fill(U &&tensor)
{
- library->fill_tensor_uniform(tensor, 0);
+ std::uniform_real_distribution<> distribution(-1.0f, 1.0f);
+ library->fill(tensor, distribution, 0);
}
TensorType compute_target(const TensorShape &src_shape, const TensorShape &dst_shape, DataType data_type, unsigned int axis, ReductionOperation op)
diff --git a/tests/validation/fixtures/ScaleFixture.h b/tests/validation/fixtures/ScaleFixture.h
index ec10231..5413147 100644
--- a/tests/validation/fixtures/ScaleFixture.h
+++ b/tests/validation/fixtures/ScaleFixture.h
@@ -31,6 +31,7 @@
#include "tests/IAccessor.h"
#include "tests/framework/Asserts.h"
#include "tests/framework/Fixture.h"
+#include "tests/validation/reference/Permute.h"
#include "tests/validation/reference/Scale.h"
namespace arm_compute
@@ -99,7 +100,7 @@
}
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, _data_type, 1, 0, QuantizationInfo(), data_layout);
+ TensorType src = create_tensor<TensorType>(shape, _data_type, 1, QuantizationInfo(), data_layout);
const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
@@ -107,7 +108,7 @@
TensorShape shape_scaled(shape);
shape_scaled.set(idx_width, shape[idx_width] * scale_x);
shape_scaled.set(idx_height, shape[idx_height] * scale_y);
- TensorType dst = create_tensor<TensorType>(shape_scaled, _data_type, 1, 0, QuantizationInfo(), data_layout);
+ TensorType dst = create_tensor<TensorType>(shape_scaled, _data_type, 1, QuantizationInfo(), data_layout);
// Create and configure function
FunctionType scale;
@@ -136,7 +137,7 @@
InterpolationPolicy policy, BorderMode border_mode, T constant_border_value, SamplingPolicy sampling_policy)
{
// Create reference
- SimpleTensor<T> src{ shape, _data_type, 1, 0, QuantizationInfo() };
+ SimpleTensor<T> src{ shape, _data_type, 1, QuantizationInfo() };
// Fill reference
fill(src);
diff --git a/tests/validation/fixtures/SoftmaxLayerFixture.h b/tests/validation/fixtures/SoftmaxLayerFixture.h
index c2ab2e2..99c0710 100644
--- a/tests/validation/fixtures/SoftmaxLayerFixture.h
+++ b/tests/validation/fixtures/SoftmaxLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -47,13 +47,12 @@
{
public:
template <typename...>
- void setup(TensorShape shape, DataType data_type, int fractional_bits, QuantizationInfo quantization_info, float beta)
+ void setup(TensorShape shape, DataType data_type, QuantizationInfo quantization_info, float beta)
{
- _fractional_bits = fractional_bits;
_quantization_info = quantization_info;
- _target = compute_target(shape, data_type, fractional_bits, quantization_info, beta);
- _reference = compute_reference(shape, data_type, fractional_bits, quantization_info, beta);
+ _target = compute_target(shape, data_type, quantization_info, beta);
+ _reference = compute_reference(shape, data_type, quantization_info, beta);
}
protected:
@@ -65,25 +64,19 @@
std::uniform_real_distribution<> distribution(-1000.f, 1000.f);
library->fill(tensor, distribution, 0);
}
- else if(is_data_type_quantized_asymmetric(tensor.data_type()))
+ else // data type is quantized_asymmetric
{
std::uniform_int_distribution<> distribution(0, 100);
library->fill(tensor, distribution, 0);
}
- else
- {
- const int one_fixed = 1 << _fractional_bits;
- std::uniform_int_distribution<> distribution(-one_fixed, one_fixed);
- library->fill(tensor, distribution, 0);
- }
}
- TensorType compute_target(const TensorShape &shape, DataType data_type, int fixed_point_position,
+ TensorType compute_target(const TensorShape &shape, DataType data_type,
QuantizationInfo quantization_info, float beta)
{
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, quantization_info);
- TensorType dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, QuantizationInfo(1.f / 256, 0));
+ TensorType src = create_tensor<TensorType>(shape, data_type, 1, quantization_info);
+ TensorType dst = create_tensor<TensorType>(shape, data_type, 1, QuantizationInfo(1.f / 256, 0));
// Create and configure function
FunctionType smx_layer;
@@ -108,11 +101,11 @@
return dst;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape, DataType data_type, int fixed_point_position,
+ SimpleTensor<T> compute_reference(const TensorShape &shape, DataType data_type,
QuantizationInfo quantization_info, float beta)
{
// Create reference
- SimpleTensor<T> src{ shape, data_type, 1, fixed_point_position, quantization_info };
+ SimpleTensor<T> src{ shape, data_type, 1, quantization_info };
// Fill reference
fill(src);
@@ -122,7 +115,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
- int _fractional_bits{};
QuantizationInfo _quantization_info{};
};
@@ -135,28 +127,12 @@
{
SoftmaxValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape,
data_type,
- 0,
QuantizationInfo(),
beta);
}
};
template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
-class SoftmaxValidationFixedPointFixture : public SoftmaxValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
-{
-public:
- template <typename...>
- void setup(TensorShape shape, DataType data_type, int fixed_point_position)
- {
- SoftmaxValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape,
- data_type,
- fixed_point_position,
- QuantizationInfo(),
- 1.0f);
- }
-};
-
-template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
class SoftmaxValidationQuantizedFixture : public SoftmaxValidationGenericFixture<TensorType, AccessorType, FunctionType, T>
{
public:
@@ -165,7 +141,6 @@
{
SoftmaxValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape,
data_type,
- 0,
quantization_info,
beta);
}
diff --git a/tests/validation/fixtures/UNIT/MemoryManagerFixture.h b/tests/validation/fixtures/UNIT/MemoryManagerFixture.h
index 21ad42b..d8e2b0b 100644
--- a/tests/validation/fixtures/UNIT/MemoryManagerFixture.h
+++ b/tests/validation/fixtures/UNIT/MemoryManagerFixture.h
@@ -239,9 +239,13 @@
dst.allocator()->info().set_tensor_shape(TensorShape(24U, _cur_batches)).set_is_resizable(true).extend_padding(new_dst_padding);
dst.allocator()->info().set_is_resizable(false);
+ // Configure FC info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.retain_internal_weights = true;
+
// Configure functions (2nd iteration)
- fc_layer_1.configure(&src, &w1, &b1, &fc1, true, false, true);
- fc_layer_2.configure(&fc1, &w2, &b2, &dst, true, false, true);
+ fc_layer_1.configure(&src, &w1, &b1, &fc1, fc_info);
+ fc_layer_2.configure(&fc1, &w2, &b2, &dst, fc_info);
// Fill tensors (2nd iteration)
fill(AccessorType(src), 5);
@@ -357,6 +361,10 @@
// Get padding requirements
auto fc_padding = fc.allocator()->info().padding();
+ // Configure FC info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.retain_internal_weights = true;
+
// Run rest iterations
for(int i = _max_batches; i >= static_cast<int>(_cur_batches); --i)
{
@@ -368,7 +376,7 @@
dst.allocator()->info().set_tensor_shape(TensorShape(8U, i));
// Configure functions
- fc_layer.configure(&src, &w, &b, &fc, true, false, true);
+ fc_layer.configure(&src, &w, &b, &fc, fc_info);
smx_layer.configure(&fc, &dst);
// Fill tensors
diff --git a/tests/validation/fixtures/UNIT/WeightsRetentionFixture.h b/tests/validation/fixtures/UNIT/WeightsRetentionFixture.h
new file mode 100644
index 0000000..b17c003
--- /dev/null
+++ b/tests/validation/fixtures/UNIT/WeightsRetentionFixture.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_UNIT_WEIGHTS_RETENTION
+#define ARM_COMPUTE_TEST_UNIT_WEIGHTS_RETENTION
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/Helpers.h"
+#include "tests/validation/reference/FullyConnectedLayer.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+/** Test case to run a fully connected layer with weights retention, reconfigure
+ * with different shapes and rerun making sure the weights are retained.
+ *
+ * Runs a fully connected layer stimulating is_interleaved_transpose CLGEMM,
+ * then reconfigures with different batch size and reruns.
+ */
+template <typename TensorType, typename AccessorType, typename FullyConnectedFunction>
+class WeightsRetentionReconfigureTestCaseFixture : public framework::Fixture
+{
+ using T = float;
+
+public:
+ void setup()
+ {
+ _max_batches = 8;
+ _cur_batches = 6;
+ _target = compute_target();
+ _reference = compute_reference();
+ };
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, int i)
+ {
+ std::uniform_real_distribution<> distribution(0.5f, 1.f);
+ library->fill(tensor, distribution, i);
+ }
+
+ TensorType compute_target()
+ {
+ // Create tensors
+ TensorType w1 = create_tensor<TensorType>(TensorShape(180000U, 150U), DataType::F32, 1);
+ TensorType b1 = create_tensor<TensorType>(TensorShape(150U), DataType::F32, 1);
+ TensorType src = create_tensor<TensorType>(TensorShape(1U, 150U, 1200U, _max_batches), DataType::F32, 1);
+ TensorType dst = create_tensor<TensorType>(TensorShape(150U, _max_batches), DataType::F32, 1);
+
+ // Create and configure function
+ FullyConnectedFunction fc_layer_1;
+ fc_layer_1.configure(&src, &w1, &b1, &dst);
+
+ // Allocate persistent tensors
+ w1.allocator()->allocate();
+ b1.allocator()->allocate();
+
+ // Allocate tensors (1st iteration)
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ // Fill tensors (1st iteration)
+ fill(AccessorType(src), 0);
+ fill(AccessorType(w1), 1);
+ fill(AccessorType(b1), 2);
+
+ // Compute functions (1st iteration)
+ fc_layer_1.run();
+
+ // Update tensor shapes (2nd iteration)
+ auto src_padding = src.allocator()->info().padding();
+ auto dst_padding = dst.allocator()->info().padding();
+ int diff = _max_batches - _cur_batches;
+ auto new_src_padding = PaddingSize(src_padding.top, src_padding.right, src_padding.bottom + diff, src_padding.left);
+ auto new_dst_padding = PaddingSize(dst_padding.top, dst_padding.right, dst_padding.bottom + diff, dst_padding.left);
+ src.allocator()->info().set_tensor_shape(TensorShape(1U, 150U, 1200U, _cur_batches)).set_is_resizable(true).extend_padding(new_src_padding);
+ src.allocator()->info().set_is_resizable(false);
+ dst.allocator()->info().set_tensor_shape(TensorShape(150U, _cur_batches)).set_is_resizable(true).extend_padding(new_dst_padding);
+ dst.allocator()->info().set_is_resizable(false);
+
+ // Configure FC info
+ FullyConnectedLayerInfo fc_info;
+ fc_info.retain_internal_weights = true;
+
+ // Configure functions (2nd iteration)
+ fc_layer_1.configure(&src, &w1, &b1, &dst, fc_info);
+
+ // Fill tensors (2nd iteration)
+ fill(AccessorType(src), 5);
+
+ // Compute functions (2nd iteration)
+ fc_layer_1.run();
+
+ return dst;
+ }
+
+ SimpleTensor<T> compute_reference()
+ {
+ // Create reference
+ SimpleTensor<T> w1{ TensorShape(180000U, 150U), DataType::F32 };
+ SimpleTensor<T> b1{ TensorShape(150U), DataType::F32 };
+ SimpleTensor<T> src{ TensorShape(1U, 150U, 1200U, _cur_batches), DataType::F32 };
+
+ // Fill reference
+ fill(src, 5);
+ fill(w1, 1);
+ fill(b1, 2);
+
+ return reference::fully_connected_layer(src, w1, b1, TensorShape(150U, _cur_batches));
+ }
+
+protected:
+ TensorType _target{};
+ SimpleTensor<T> _reference{};
+ unsigned int _max_batches{};
+ unsigned int _cur_batches{};
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_UNIT_WEIGHTS_RETENTION */
diff --git a/tests/validation/fixtures/WarpAffineFixture.h b/tests/validation/fixtures/WarpAffineFixture.h
index c027072..3cbf86f 100644
--- a/tests/validation/fixtures/WarpAffineFixture.h
+++ b/tests/validation/fixtures/WarpAffineFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -55,11 +55,11 @@
uint8_t constant_border_value = distribution_u8(gen);
// Create the matrix
- std::array<float, 6> matrix{ {} };
- fill_warp_matrix<6>(matrix);
+ std::array<float, 9> matrix{ {} };
+ fill_warp_matrix<9>(matrix);
- _target = compute_target(shape, data_type, matrix.data(), policy, border_mode, constant_border_value);
- _reference = compute_reference(shape, data_type, matrix.data(), policy, border_mode, constant_border_value);
+ _target = compute_target(shape, data_type, matrix, policy, border_mode, constant_border_value);
+ _reference = compute_reference(shape, data_type, matrix, policy, border_mode, constant_border_value);
}
protected:
@@ -69,7 +69,7 @@
library->fill_tensor_uniform(tensor, 0);
}
- TensorType compute_target(const TensorShape &shape, DataType data_type, const float *matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value)
+ TensorType compute_target(const TensorShape &shape, DataType data_type, const std::array<float, 9> &matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value)
{
// Create tensors
TensorType src = create_tensor<TensorType>(shape, data_type);
@@ -97,7 +97,7 @@
return dst;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape, DataType data_type, const float *matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value)
+ SimpleTensor<T> compute_reference(const TensorShape &shape, DataType data_type, const std::array<float, 9> &matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value)
{
// Create reference
SimpleTensor<T> src{ shape, data_type };
@@ -108,7 +108,7 @@
// Fill reference
fill(src);
- return reference::warp_affine<T>(src, _valid_mask, matrix, policy, border_mode, constant_border_value);
+ return reference::warp_affine<T>(src, _valid_mask, matrix.data(), policy, border_mode, constant_border_value);
}
TensorType _target{};
diff --git a/tests/validation/fixtures/WarpPerspectiveFixture.h b/tests/validation/fixtures/WarpPerspectiveFixture.h
index c804fa6..0eba97c 100644
--- a/tests/validation/fixtures/WarpPerspectiveFixture.h
+++ b/tests/validation/fixtures/WarpPerspectiveFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -64,8 +64,8 @@
std::array<float, 9> matrix = { { 0 } };
fill_warp_matrix<9>(matrix);
- _target = compute_target(input_shape, vmask_shape, matrix.data(), policy, border_mode, constant_border_value, data_type);
- _reference = compute_reference(input_shape, vmask_shape, matrix.data(), policy, border_mode, constant_border_value, data_type);
+ _target = compute_target(input_shape, vmask_shape, matrix, policy, border_mode, constant_border_value, data_type);
+ _reference = compute_reference(input_shape, vmask_shape, matrix, policy, border_mode, constant_border_value, data_type);
}
protected:
@@ -75,7 +75,8 @@
library->fill_tensor_uniform(tensor, 0);
}
- TensorType compute_target(const TensorShape &shape, const TensorShape &vmask_shape, const float *matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value,
+ TensorType compute_target(const TensorShape &shape, const TensorShape &vmask_shape, const std::array<float, 9> &matrix, InterpolationPolicy policy, BorderMode border_mode,
+ uint8_t constant_border_value,
DataType data_type)
{
// Create tensors
@@ -105,7 +106,8 @@
return dst;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape, const TensorShape &vmask_shape, const float *matrix, InterpolationPolicy policy, BorderMode border_mode, uint8_t constant_border_value,
+ SimpleTensor<T> compute_reference(const TensorShape &shape, const TensorShape &vmask_shape, const std::array<float, 9> &matrix, InterpolationPolicy policy, BorderMode border_mode,
+ uint8_t constant_border_value,
DataType data_type)
{
ARM_COMPUTE_ERROR_ON(data_type != DataType::U8);
@@ -120,7 +122,7 @@
fill(src);
// Compute reference
- return reference::warp_perspective<T>(src, _valid_mask, matrix, policy, border_mode, constant_border_value);
+ return reference::warp_perspective<T>(src, _valid_mask, matrix.data(), policy, border_mode, constant_border_value);
}
TensorType _target{};
diff --git a/tests/validation/fixtures/WeightsReshapeFixture.h b/tests/validation/fixtures/WeightsReshapeFixture.h
new file mode 100644
index 0000000..06765f6
--- /dev/null
+++ b/tests/validation/fixtures/WeightsReshapeFixture.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef ARM_COMPUTE_TEST_WEIGHTS_RESHAPE_FIXTURE
+#define ARM_COMPUTE_TEST_WEIGHTS_RESHAPE_FIXTURE
+
+#include "arm_compute/core/Helpers.h"
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "arm_compute/core/utils/misc/ShapeCalculator.h"
+#include "arm_compute/runtime/Tensor.h"
+#include "tests/AssetsLibrary.h"
+#include "tests/Globals.h"
+#include "tests/IAccessor.h"
+#include "tests/framework/Asserts.h"
+#include "tests/framework/Fixture.h"
+#include "tests/validation/reference/WeightsReshape.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+using namespace arm_compute::misc::shape_calculator;
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class WeightsReshapeValidationFixture : public framework::Fixture
+{
+public:
+ template <typename...>
+ void setup(TensorShape input_shape, DataType data_type, bool has_bias, unsigned int num_groups)
+ {
+ const TensorShape output_shape = compute_weights_reshaped_shape(TensorInfo(input_shape, 1, data_type), has_bias, num_groups);
+
+ _target = compute_target(input_shape, output_shape, has_bias, num_groups, data_type);
+ _reference = compute_reference(input_shape, output_shape, has_bias, num_groups, data_type);
+ }
+
+protected:
+ template <typename U>
+ void fill(U &&tensor, const int seed)
+ {
+ library->fill_tensor_uniform(tensor, seed);
+ }
+
+ TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, const bool has_bias, const unsigned int num_groups, DataType data_type)
+ {
+ // Create tensors
+ TensorType src = create_tensor<TensorType>(input_shape, data_type);
+ TensorType bias = create_tensor<TensorType>(TensorShape(input_shape[3]), data_type);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type);
+
+ // Create and configure function
+ FunctionType weights_reshape_func;
+ weights_reshape_func.configure(&src, (has_bias ? &bias : nullptr), &dst, num_groups);
+
+ ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Allocate tensors
+ src.allocator()->allocate();
+ dst.allocator()->allocate();
+
+ ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Fill tensors
+ fill(AccessorType(src), 0);
+
+ if(has_bias)
+ {
+ ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ bias.allocator()->allocate();
+
+ ARM_COMPUTE_EXPECT(!bias.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ fill(AccessorType(bias), 1);
+ }
+
+ // Compute function
+ weights_reshape_func.run();
+
+ return dst;
+ }
+
+ SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, const bool has_bias, const unsigned int num_groups, DataType data_type)
+ {
+ // Create reference
+ SimpleTensor<T> src{ input_shape, data_type };
+ SimpleTensor<T> bias{ TensorShape(has_bias ? input_shape[3] : 0), data_type };
+
+ // Fill reference
+ fill(src, 0);
+ if(has_bias)
+ {
+ fill(bias, 1);
+ }
+
+ return reference::weights_reshape(src, bias, output_shape, num_groups);
+ }
+
+ TensorType _target{};
+ SimpleTensor<T> _reference{};
+};
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_WEIGHTS_RESHAPE_FIXTURE */
diff --git a/tests/validation/fixtures/WidthConcatenateLayerFixture.h b/tests/validation/fixtures/WidthConcatenateLayerFixture.h
index cf9b12e..caad0fe 100644
--- a/tests/validation/fixtures/WidthConcatenateLayerFixture.h
+++ b/tests/validation/fixtures/WidthConcatenateLayerFixture.h
@@ -92,12 +92,12 @@
for(const auto &shape : shapes)
{
- srcs.emplace_back(create_tensor<TensorType>(shape, data_type, 1, _fractional_bits));
+ srcs.emplace_back(create_tensor<TensorType>(shape, data_type, 1));
src_ptrs.emplace_back(&srcs.back());
}
TensorShape dst_shape = misc::shape_calculator::calculate_width_concatenate_shape(src_ptrs);
- TensorType dst = create_tensor<TensorType>(dst_shape, data_type, 1, _fractional_bits);
+ TensorType dst = create_tensor<TensorType>(dst_shape, data_type, 1);
// Create and configure function
FunctionType width_concat;
@@ -141,7 +141,7 @@
int i = 0;
for(const auto &shape : shapes)
{
- srcs.emplace_back(shape, data_type, 1, _fractional_bits);
+ srcs.emplace_back(shape, data_type, 1);
fill(srcs.back(), i++);
}
@@ -150,9 +150,6 @@
TensorType _target{};
SimpleTensor<T> _reference{};
-
-private:
- int _fractional_bits{ 1 };
};
} // namespace validation
} // namespace test
diff --git a/tests/validation/fixtures/WinogradConvolutionLayerFixture.h b/tests/validation/fixtures/WinogradConvolutionLayerFixture.h
index ef596e0..aba3eff 100644
--- a/tests/validation/fixtures/WinogradConvolutionLayerFixture.h
+++ b/tests/validation/fixtures/WinogradConvolutionLayerFixture.h
@@ -36,6 +36,7 @@
#include "tests/validation/reference/ActivationLayer.h"
#include "tests/validation/reference/ConvolutionLayer.h"
#include "tests/validation/reference/GEMM.h"
+#include "tests/validation/reference/Permute.h"
#include "tests/validation/reference/Utils.h"
#include "tests/validation/reference/Winograd.h"
@@ -54,7 +55,8 @@
{
public:
template <typename...>
- void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, DataType data_type, ActivationLayerInfo act_info)
+ void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation,
+ DataType data_type, ActivationLayerInfo act_info)
{
ARM_COMPUTE_UNUSED(dilation);
@@ -83,7 +85,7 @@
}
}
- TensorType compute_target(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, const PadStrideInfo &info,
+ TensorType compute_target(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, const PadStrideInfo &info,
DataType data_type, ActivationLayerInfo act_info)
{
// Create tensors
@@ -158,11 +160,12 @@
{
public:
template <typename...>
- void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation, DataType data_type, ActivationLayerInfo act_info)
+ void setup(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, PadStrideInfo info, Size2D dilation,
+ DataType data_type, ActivationLayerInfo act_info, const DataLayout &data_layout)
+
{
ARM_COMPUTE_UNUSED(dilation);
-
- _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, act_info);
+ _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, info, data_type, act_info, data_layout);
_reference = compute_reference(input_shape, weights_shape, bias_shape, output_shape, info, data_type, act_info);
}
@@ -187,14 +190,21 @@
}
}
- TensorType compute_target(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &bias_shape, const TensorShape &output_shape, const PadStrideInfo &info,
- DataType data_type, ActivationLayerInfo act_info)
+ TensorType compute_target(TensorShape input_shape, TensorShape weights_shape, TensorShape bias_shape, TensorShape output_shape, const PadStrideInfo &info,
+ DataType data_type, ActivationLayerInfo act_info, const DataLayout data_layout)
{
+ if(data_layout == DataLayout::NHWC)
+ {
+ permute(input_shape, PermutationVector(2U, 0U, 1U));
+ permute(weights_shape, PermutationVector(2U, 0U, 1U));
+ permute(output_shape, PermutationVector(2U, 0U, 1U));
+ }
+
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, data_type, 1);
- TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1);
- TensorType bias = create_tensor<TensorType>(bias_shape, data_type, 1);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, QuantizationInfo(), data_layout);
+ TensorType weights = create_tensor<TensorType>(weights_shape, data_type, 1, QuantizationInfo(), data_layout);
+ TensorType bias = create_tensor<TensorType>(bias_shape, data_type, 1, QuantizationInfo(), data_layout);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, QuantizationInfo(), data_layout);
// Create and configure function
FunctionType conv;
@@ -249,7 +259,18 @@
fill(bias, 2, 0.f, 0.f);
}
- WinogradInfo winograd_info(Size2D(4U, 4U),
+ // Set output tile
+ Size2D output_tile(4U, 4U);
+ if(weights_shape[0] == 1)
+ {
+ output_tile.width = 1;
+ }
+ else if(weights_shape[1] == 1)
+ {
+ output_tile.height = 1;
+ }
+
+ WinogradInfo winograd_info(output_tile,
Size2D(weights_shape[0], weights_shape[1]),
Size2D(input_shape[0], input_shape[1]),
info,
@@ -312,10 +333,15 @@
}
}
- TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, const WinogradInfo &winograd_info, DataLayout data_layout, DataType data_type)
+ TensorType compute_target(TensorShape input_shape, const TensorShape &output_shape, const WinogradInfo &winograd_info, DataLayout data_layout, DataType data_type)
{
- TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, 0, QuantizationInfo(), data_layout);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, 0, QuantizationInfo(), data_layout);
+ if(data_layout == DataLayout::NHWC)
+ {
+ permute(input_shape, PermutationVector(2U, 0U, 1U));
+ }
+
+ TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, QuantizationInfo(), data_layout);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, QuantizationInfo());
// Create and configure function
FunctionType transf;
@@ -343,7 +369,7 @@
SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, const WinogradInfo &winograd_info, DataLayout data_layout, DataType data_type)
{
// Create reference
- SimpleTensor<T> src{ input_shape, data_type, 1, 0, QuantizationInfo(), data_layout };
+ SimpleTensor<T> src{ input_shape, data_type, 1, QuantizationInfo() };
// Fill reference
fill(src, 0, -1.f, 1.f);
@@ -390,11 +416,16 @@
}
}
- TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, const WinogradInfo &winograd_info, DataLayout data_layout, DataType data_type)
+ TensorType compute_target(TensorShape input_shape, const TensorShape &output_shape, const WinogradInfo &winograd_info, DataLayout data_layout, DataType data_type)
{
+ if(data_layout == DataLayout::NHWC)
+ {
+ permute(input_shape, PermutationVector(2U, 0U, 1U));
+ }
+
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, 0, QuantizationInfo(), data_layout);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, 0, QuantizationInfo(), data_layout);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type, 1, QuantizationInfo(), data_layout);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, QuantizationInfo());
// Create and configure function
FunctionType filter_transform;
@@ -421,7 +452,7 @@
SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, const WinogradInfo &winograd_info, DataLayout data_layout, DataType data_type)
{
// Create reference
- SimpleTensor<T> src{ input_shape, data_type, 1, 0, QuantizationInfo(), data_layout };
+ SimpleTensor<T> src{ input_shape, data_type, 1, QuantizationInfo() };
// Fill reference
fill(src, 0, -1.f, 1.f);
@@ -440,10 +471,8 @@
template <typename...>
void setup(TensorShape input_shape, WinogradInfo winograd_info, DataType data_type)
{
- TensorShape output_shape = compute_winograd_output_transform_shape(TensorInfo(input_shape, 1, data_type), winograd_info);
-
- _target = compute_target(input_shape, output_shape, winograd_info, data_type);
- _reference = compute_reference(input_shape, output_shape, winograd_info, data_type);
+ _target = compute_target(input_shape, winograd_info, data_type);
+ _reference = compute_reference(input_shape, winograd_info, data_type);
}
protected:
@@ -467,43 +496,53 @@
}
}
- TensorType compute_target(const TensorShape &input_shape, const TensorShape &output_shape, const WinogradInfo &winograd_info, DataType data_type)
+ TensorType compute_target(const TensorShape &input_shape, const WinogradInfo &winograd_info, DataType data_type)
{
+ TensorShape output_shape = compute_winograd_output_transform_shape(TensorInfo(input_shape, 1, data_type), winograd_info);
+
// Create tensors
- TensorType src = create_tensor<TensorType>(input_shape, data_type);
- TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, 0, QuantizationInfo(), winograd_info.output_data_layout);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type);
+ TensorType bias = create_tensor<TensorType>(output_shape[get_data_layout_dimension_index(winograd_info.output_data_layout, DataLayoutDimension::CHANNEL)], data_type);
+ TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, QuantizationInfo(), winograd_info.output_data_layout);
// Create and configure function
FunctionType output_transform;
- output_transform.configure(&src, nullptr, &dst, winograd_info);
+ output_transform.configure(&src, &bias, &dst, winograd_info);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
// Allocate tensors
src.allocator()->allocate();
+ bias.allocator()->allocate();
dst.allocator()->allocate();
ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!bias.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
// Fill tensors
fill(AccessorType(src), 0, -1.f, 1.f);
+ fill(AccessorType(bias), 1, -1.f, 1.f);
output_transform.run();
return dst;
}
- SimpleTensor<T> compute_reference(const TensorShape &input_shape, const TensorShape &output_shape, const WinogradInfo &winograd_info, DataType data_type)
+ SimpleTensor<T> compute_reference(const TensorShape &input_shape, WinogradInfo winograd_info, DataType data_type)
{
+ winograd_info.output_data_layout = DataLayout::NCHW;
+ TensorShape output_shape = compute_winograd_output_transform_shape(TensorInfo(input_shape, 1, data_type), winograd_info);
+
// Create reference
SimpleTensor<T> src{ input_shape, data_type };
SimpleTensor<T> bias{ TensorShape(input_shape[0]), data_type };
// Fill reference
fill(src, 0, -1.f, 1.f);
- fill(bias, 1, 0.0f, 0.0f); // Fill with zeros as we validate just the output transform without bias contribution
+ fill(bias, 1, -1.f, 1.f);
return reference::winograd_output_transform<T>(src, bias, output_shape, winograd_info);
}
diff --git a/tests/validation/reference/AbsoluteDifference.cpp b/tests/validation/reference/AbsoluteDifference.cpp
index f518e67..f9fce5b 100644
--- a/tests/validation/reference/AbsoluteDifference.cpp
+++ b/tests/validation/reference/AbsoluteDifference.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "AbsoluteDifference.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
diff --git a/tests/validation/reference/Accumulate.cpp b/tests/validation/reference/Accumulate.cpp
index 29a2007..7f34be9 100644
--- a/tests/validation/reference/Accumulate.cpp
+++ b/tests/validation/reference/Accumulate.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "Accumulate.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
diff --git a/tests/validation/reference/ActivationLayer.cpp b/tests/validation/reference/ActivationLayer.cpp
index df7f653..9455eff 100644
--- a/tests/validation/reference/ActivationLayer.cpp
+++ b/tests/validation/reference/ActivationLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "ActivationLayer.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
@@ -39,7 +38,7 @@
SimpleTensor<T> activation_layer(const SimpleTensor<T> &src, ActivationLayerInfo info)
{
// Create reference
- SimpleTensor<T> dst{ src.shape(), src.data_type(), 1, src.fixed_point_position() };
+ SimpleTensor<T> dst{ src.shape(), src.data_type(), 1 };
// Compute reference
const T a(info.a());
@@ -92,68 +91,6 @@
return dst;
}
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type>
-SimpleTensor<T> activation_layer(const SimpleTensor<T> &src, ActivationLayerInfo info)
-{
- using namespace fixed_point_arithmetic;
-
- // Create reference
- SimpleTensor<T> dst{ src.shape(), src.data_type(), 1, src.fixed_point_position() };
-
- // Compute reference
- const int fixed_point_position = src.fixed_point_position();
- const fixed_point<T> a(info.a(), fixed_point_position);
- const fixed_point<T> b(info.b(), fixed_point_position);
- const fixed_point<T> const_0(0, fixed_point_position);
- const fixed_point<T> const_1(1, fixed_point_position);
-
- for(int i = 0; i < src.num_elements(); ++i)
- {
- fixed_point<T> x(src[i], fixed_point_position, true);
-
- switch(info.activation())
- {
- case ActivationLayerInfo::ActivationFunction::ABS:
- dst[i] = abs(x).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::LINEAR:
- dst[i] = add(b, mul(a, x)).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::LOGISTIC:
- dst[i] = (const_1 / (const_1 + exp(-x))).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::RELU:
- dst[i] = max(const_0, x).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
- dst[i] = min(a, max(const_0, x)).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
- dst[i] = min(a, max(b, x)).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
- dst[i] = (x > const_0) ? x.raw() : mul(a, x).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
- dst[i] = log(const_1 + exp(x)).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::SQRT:
- dst[i] = (const_1 / inv_sqrt(x)).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::SQUARE:
- dst[i] = mul(x, x).raw();
- break;
- case ActivationLayerInfo::ActivationFunction::TANH:
- dst[i] = mul(a, tanh(mul(b, x))).raw();
- break;
- default:
- ARM_COMPUTE_ERROR("Unsupported activation function");
- }
- }
-
- return dst;
-}
-
template <>
SimpleTensor<uint8_t> activation_layer<uint8_t>(const SimpleTensor<uint8_t> &src, ActivationLayerInfo info)
{
@@ -165,8 +102,6 @@
template SimpleTensor<float> activation_layer(const SimpleTensor<float> &src, ActivationLayerInfo info);
template SimpleTensor<half> activation_layer(const SimpleTensor<half> &src, ActivationLayerInfo info);
-template SimpleTensor<qint8_t> activation_layer(const SimpleTensor<qint8_t> &src, ActivationLayerInfo info);
-template SimpleTensor<qint16_t> activation_layer(const SimpleTensor<qint16_t> &src, ActivationLayerInfo info);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/ArithmeticAddition.cpp b/tests/validation/reference/ArithmeticAddition.cpp
index 17020a6..c68c6d4 100644
--- a/tests/validation/reference/ArithmeticAddition.cpp
+++ b/tests/validation/reference/ArithmeticAddition.cpp
@@ -24,7 +24,6 @@
#include "ArithmeticAddition.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
@@ -86,10 +85,8 @@
} // namespace
template <typename T>
-SimpleTensor<T> arithmetic_addition(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, DataType dst_data_type, ConvertPolicy convert_policy)
+SimpleTensor<T> arithmetic_addition(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, SimpleTensor<T> &dst, ConvertPolicy convert_policy)
{
- SimpleTensor<T> dst(TensorShape::broadcast_shape(src1.shape(), src2.shape()), dst_data_type);
-
Coordinates id_src1, id_src2, id_dst;
BroadcastUnroll<Coordinates::num_max_dimensions>::unroll(src1, src2, dst, convert_policy, id_src1, id_src2, id_dst);
@@ -97,11 +94,53 @@
return dst;
}
-template SimpleTensor<uint8_t> arithmetic_addition(const SimpleTensor<uint8_t> &src1, const SimpleTensor<uint8_t> &src2, DataType dst_data_type, ConvertPolicy convert_policy);
+template <>
+SimpleTensor<uint8_t> arithmetic_addition(const SimpleTensor<uint8_t> &src1, const SimpleTensor<uint8_t> &src2, SimpleTensor<uint8_t> &dst, ConvertPolicy convert_policy)
+{
+ if(dst.data_type() == DataType::QASYMM8)
+ {
+ SimpleTensor<float> src1_tmp = convert_from_asymmetric(src1);
+ SimpleTensor<float> src2_tmp = convert_from_asymmetric(src2);
+ SimpleTensor<float> dst_tmp(TensorShape::broadcast_shape(src1.shape(), src2.shape()), dst.data_type());
+
+ Coordinates id_src1, id_src2, id_dst;
+
+ BroadcastUnroll<Coordinates::num_max_dimensions>::unroll(src1_tmp, src2_tmp, dst_tmp, convert_policy, id_src1, id_src2, id_dst);
+
+ dst = convert_to_asymmetric(dst_tmp, dst.quantization_info());
+ return dst;
+ }
+ else
+ {
+ // DataType::U8
+ Coordinates id_src1, id_src2, id_dst;
+
+ BroadcastUnroll<Coordinates::num_max_dimensions>::unroll(src1, src2, dst, convert_policy, id_src1, id_src2, id_dst);
+
+ return dst;
+ }
+}
+
+template SimpleTensor<int16_t> arithmetic_addition(const SimpleTensor<int16_t> &src1, const SimpleTensor<int16_t> &src2, SimpleTensor<int16_t> &dst, ConvertPolicy convert_policy);
+template SimpleTensor<int8_t> arithmetic_addition(const SimpleTensor<int8_t> &src1, const SimpleTensor<int8_t> &src2, SimpleTensor<int8_t> &dst, ConvertPolicy convert_policy);
+template SimpleTensor<half> arithmetic_addition(const SimpleTensor<half> &src1, const SimpleTensor<half> &src2, SimpleTensor<half> &dst, ConvertPolicy convert_policy);
+template SimpleTensor<float> arithmetic_addition(const SimpleTensor<float> &src1, const SimpleTensor<float> &src2, SimpleTensor<float> &dst, ConvertPolicy convert_policy);
+
+template <typename T>
+SimpleTensor<T> arithmetic_addition(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, DataType dst_data_type, ConvertPolicy convert_policy)
+{
+ ARM_COMPUTE_ERROR_ON_MSG(dst_data_type == DataType::QASYMM8, "For QASYMM8, the quantized output tensor should be passed directly.");
+
+ SimpleTensor<T> dst(TensorShape::broadcast_shape(src1.shape(), src2.shape()), dst_data_type);
+ arithmetic_addition<T>(src1, src2, dst, convert_policy);
+ return dst;
+}
+
template SimpleTensor<int16_t> arithmetic_addition(const SimpleTensor<int16_t> &src1, const SimpleTensor<int16_t> &src2, DataType dst_data_type, ConvertPolicy convert_policy);
template SimpleTensor<int8_t> arithmetic_addition(const SimpleTensor<int8_t> &src1, const SimpleTensor<int8_t> &src2, DataType dst_data_type, ConvertPolicy convert_policy);
template SimpleTensor<half> arithmetic_addition(const SimpleTensor<half> &src1, const SimpleTensor<half> &src2, DataType dst_data_type, ConvertPolicy convert_policy);
template SimpleTensor<float> arithmetic_addition(const SimpleTensor<float> &src1, const SimpleTensor<float> &src2, DataType dst_data_type, ConvertPolicy convert_policy);
+
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/ArithmeticAddition.h b/tests/validation/reference/ArithmeticAddition.h
index 5902a6f..faeabd7 100644
--- a/tests/validation/reference/ArithmeticAddition.h
+++ b/tests/validation/reference/ArithmeticAddition.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -36,7 +36,11 @@
namespace reference
{
template <typename T>
+SimpleTensor<T> arithmetic_addition(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, SimpleTensor<T> &dst, ConvertPolicy convert_policy);
+
+template <typename T>
SimpleTensor<T> arithmetic_addition(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, DataType dst_data_type, ConvertPolicy convert_policy);
+
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/ArithmeticDivision.cpp b/tests/validation/reference/ArithmeticDivision.cpp
new file mode 100644
index 0000000..0102231
--- /dev/null
+++ b/tests/validation/reference/ArithmeticDivision.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "ArithmeticDivision.h"
+
+#include "arm_compute/core/Types.h"
+#include "tests/validation/Helpers.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+namespace
+{
+template <size_t dim>
+struct BroadcastUnroll
+{
+ template <typename T>
+ static void unroll(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, SimpleTensor<T> &dst,
+ Coordinates &id_src1, Coordinates &id_src2, Coordinates &id_dst)
+ {
+ const bool src1_is_broadcast = (src1.shape()[dim - 1] != dst.shape()[dim - 1]);
+ const bool src2_is_broadcast = (src2.shape()[dim - 1] != dst.shape()[dim - 1]);
+
+ id_src1.set(dim - 1, 0);
+ id_src2.set(dim - 1, 0);
+ id_dst.set(dim - 1, 0);
+
+ for(size_t i = 0; i < dst.shape()[dim - 1]; ++i, ++id_dst[dim - 1])
+ {
+ BroadcastUnroll < dim - 1 >::unroll(src1, src2, dst, id_src1, id_src2, id_dst);
+
+ id_src1[dim - 1] += !src1_is_broadcast;
+ id_src2[dim - 1] += !src2_is_broadcast;
+ }
+ }
+};
+
+template <>
+struct BroadcastUnroll<0>
+{
+ template <typename T>
+ static void unroll(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, SimpleTensor<T> &dst,
+ Coordinates &id_src1, Coordinates &id_src2, Coordinates &id_dst)
+ {
+ dst[coord2index(dst.shape(), id_dst)] = src1[coord2index(src1.shape(), id_src1)] / src2[coord2index(src2.shape(), id_src2)];
+ }
+};
+} // namespace
+
+template <typename T>
+SimpleTensor<T> arithmetic_division(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, DataType data_type)
+{
+ SimpleTensor<T> dst(TensorShape::broadcast_shape(src1.shape(), src2.shape()), data_type);
+
+ Coordinates id_src1, id_src2, id_dst;
+
+ BroadcastUnroll<Coordinates::num_max_dimensions>::unroll(src1, src2, dst, id_src1, id_src2, id_dst);
+
+ return dst;
+}
+
+template SimpleTensor<half> arithmetic_division(const SimpleTensor<half> &src1, const SimpleTensor<half> &src2, DataType data_type);
+template SimpleTensor<float> arithmetic_division(const SimpleTensor<float> &src1, const SimpleTensor<float> &src2, DataType data_type);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/reference/FixedPoint.h b/tests/validation/reference/ArithmeticDivision.h
similarity index 79%
copy from tests/validation/reference/FixedPoint.h
copy to tests/validation/reference/ArithmeticDivision.h
index f0117f9..5459dab 100644
--- a/tests/validation/reference/FixedPoint.h
+++ b/tests/validation/reference/ArithmeticDivision.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
-#define __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
+#ifndef __ARM_COMPUTE_TEST_ARITHMETIC_DIVISION_H__
+#define __ARM_COMPUTE_TEST_ARITHMETIC_DIVISION_H__
#include "tests/SimpleTensor.h"
-#include "tests/Types.h"
+#include "tests/validation/Helpers.h"
namespace arm_compute
{
@@ -36,9 +36,9 @@
namespace reference
{
template <typename T>
-SimpleTensor<T> fixed_point_operation(const SimpleTensor<T> &src, FixedPointOp op);
+SimpleTensor<T> arithmetic_division(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, DataType data_type);
} // namespace reference
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__ */
+#endif /* __ARM_COMPUTE_TEST_ARITHMETIC_DIVISION_H__ */
diff --git a/tests/validation/reference/ArithmeticSubtraction.cpp b/tests/validation/reference/ArithmeticSubtraction.cpp
index bed2d37..f39d01f 100644
--- a/tests/validation/reference/ArithmeticSubtraction.cpp
+++ b/tests/validation/reference/ArithmeticSubtraction.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,7 +23,6 @@
*/
#include "ArithmeticSubtraction.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
diff --git a/tests/validation/reference/BatchNormalizationLayer.cpp b/tests/validation/reference/BatchNormalizationLayer.cpp
index c8badac..4ea3769 100644
--- a/tests/validation/reference/BatchNormalizationLayer.cpp
+++ b/tests/validation/reference/BatchNormalizationLayer.cpp
@@ -25,7 +25,6 @@
#include "ActivationLayer.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
@@ -36,56 +35,11 @@
{
namespace reference
{
-// Batch Normalization Layer for fixed point type
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type *>
-SimpleTensor<T> batch_normalization_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &mean, const SimpleTensor<T> &var, const SimpleTensor<T> &beta, const SimpleTensor<T> &gamma, float epsilon,
- ActivationLayerInfo act_info, int fixed_point_position)
-{
- ARM_COMPUTE_UNUSED(act_info);
- SimpleTensor<T> result(src.shape(), src.data_type());
-
- const auto cols = static_cast<int>(src.shape()[0]);
- const auto rows = static_cast<int>(src.shape()[1]);
- const auto depth = static_cast<int>(src.shape()[2]);
- const int upper_dims = src.shape().total_size() / (cols * rows * depth);
-
- for(int r = 0; r < upper_dims; ++r)
- {
- for(int i = 0; i < depth; ++i)
- {
- for(int k = 0; k < rows; ++k)
- {
- for(int l = 0; l < cols; ++l)
- {
- const int pos = l + k * cols + i * rows * cols + r * cols * rows * depth;
-
- fixed_point_arithmetic::fixed_point<T> src_qs(src[pos], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> var_qs(var[i], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> mean_qs(mean[i], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> beta_qs(beta[i], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> gamma_qs(gamma[i], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> epsilon_qs(epsilon, fixed_point_position);
-
- auto denominator = fixed_point_arithmetic::inv_sqrt(var_qs + epsilon_qs);
- auto numerator = src_qs - mean_qs;
- auto x_bar = numerator * denominator;
- x_bar = beta_qs + x_bar * gamma_qs;
- result[pos] = x_bar.raw();
- }
- }
- }
- }
-
- return result;
-}
-
// Batch Normalization Layer for floating point type
template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type *>
SimpleTensor<T> batch_normalization_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &mean, const SimpleTensor<T> &var, const SimpleTensor<T> &beta, const SimpleTensor<T> &gamma, float epsilon,
- ActivationLayerInfo act_info, int fixed_point_position)
+ ActivationLayerInfo act_info)
{
- ARM_COMPUTE_UNUSED(fixed_point_position);
-
SimpleTensor<T> result(src.shape(), src.data_type());
const auto cols = static_cast<int>(src.shape()[0]);
@@ -119,14 +73,10 @@
return result;
}
template SimpleTensor<float> batch_normalization_layer(const SimpleTensor<float> &src, const SimpleTensor<float> &mean, const SimpleTensor<float> &var, const SimpleTensor<float> &beta,
- const SimpleTensor<float> &gamma, float epsilon, ActivationLayerInfo act_info, int fixed_point_position);
-template SimpleTensor<int8_t> batch_normalization_layer(const SimpleTensor<int8_t> &src, const SimpleTensor<int8_t> &mean, const SimpleTensor<int8_t> &var, const SimpleTensor<int8_t> &beta,
- const SimpleTensor<int8_t> &gamma, float epsilon, ActivationLayerInfo act_info, int fixed_point_position);
-template SimpleTensor<int16_t> batch_normalization_layer(const SimpleTensor<int16_t> &src, const SimpleTensor<int16_t> &mean, const SimpleTensor<int16_t> &var, const SimpleTensor<int16_t> &beta,
- const SimpleTensor<int16_t> &gamma, float epsilon, ActivationLayerInfo act_info, int fixed_point_position);
+ const SimpleTensor<float> &gamma, float epsilon, ActivationLayerInfo act_info);
template SimpleTensor<half> batch_normalization_layer(const SimpleTensor<half> &src, const SimpleTensor<half> &mean, const SimpleTensor<half> &var,
const SimpleTensor<half> &beta,
- const SimpleTensor<half> &gamma, float epsilon, ActivationLayerInfo act_info, int fixed_point_position);
+ const SimpleTensor<half> &gamma, float epsilon, ActivationLayerInfo act_info);
} // namespace reference
} // namespace validation
diff --git a/tests/validation/reference/BatchNormalizationLayer.h b/tests/validation/reference/BatchNormalizationLayer.h
index 329909d..b45d820 100644
--- a/tests/validation/reference/BatchNormalizationLayer.h
+++ b/tests/validation/reference/BatchNormalizationLayer.h
@@ -37,13 +37,11 @@
{
template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type * = nullptr>
SimpleTensor<T> batch_normalization_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &mean, const SimpleTensor<T> &var, const SimpleTensor<T> &beta, const SimpleTensor<T> &gamma, float epsilon,
- ActivationLayerInfo act_info,
- int fixed_point_position);
+ ActivationLayerInfo act_info);
template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type * = nullptr>
SimpleTensor<T> batch_normalization_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &mean, const SimpleTensor<T> &var, const SimpleTensor<T> &beta, const SimpleTensor<T> &gamma, float epsilon,
- ActivationLayerInfo act_info,
- int fixed_point_position);
+ ActivationLayerInfo act_info);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/CannyEdgeDetector.cpp b/tests/validation/reference/CannyEdgeDetector.cpp
new file mode 100644
index 0000000..cfe8ae8
--- /dev/null
+++ b/tests/validation/reference/CannyEdgeDetector.cpp
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "CannyEdgeDetector.h"
+
+#include "Utils.h"
+#include "support/ToolchainSupport.h"
+#include "tests/validation/Helpers.h"
+#include "tests/validation/reference/Magnitude.h"
+#include "tests/validation/reference/NonMaximaSuppression.h"
+#include "tests/validation/reference/Phase.h"
+#include "tests/validation/reference/Sobel.h"
+
+#include "tests/SimpleTensorPrinter.h"
+
+#include <cmath>
+#include <stack>
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+namespace
+{
+const auto MARK_ZERO = 0u;
+const auto MARK_MAYBE = 127u;
+const auto MARK_EDGE = 255u;
+
+template <typename T>
+void trace_edge(SimpleTensor<T> &dst, const ValidRegion &valid_region)
+{
+ std::stack<Coordinates> pixels_stack;
+ for(auto i = 0; i < dst.num_elements(); ++i)
+ {
+ if(dst[i] == MARK_EDGE)
+ {
+ pixels_stack.push(index2coord(dst.shape(), i));
+ }
+ }
+
+ while(!pixels_stack.empty())
+ {
+ const Coordinates pixel_coord = pixels_stack.top();
+ pixels_stack.pop();
+
+ std::array<Coordinates, 8> neighbours =
+ {
+ {
+ Coordinates(pixel_coord.x() - 1, pixel_coord.y() + 0),
+ Coordinates(pixel_coord.x() + 1, pixel_coord.y() + 0),
+ Coordinates(pixel_coord.x() - 1, pixel_coord.y() - 1),
+ Coordinates(pixel_coord.x() + 1, pixel_coord.y() + 1),
+ Coordinates(pixel_coord.x() + 0, pixel_coord.y() - 1),
+ Coordinates(pixel_coord.x() + 0, pixel_coord.y() + 1),
+ Coordinates(pixel_coord.x() + 1, pixel_coord.y() - 1),
+ Coordinates(pixel_coord.x() - 1, pixel_coord.y() + 1)
+ }
+ };
+
+ // Mark MAYBE neighbours as edges since they are next to an EDGE
+ std::for_each(neighbours.begin(), neighbours.end(), [&](Coordinates & coord)
+ {
+ if(is_in_valid_region(valid_region, coord))
+ {
+ const size_t pixel_index = coord2index(dst.shape(), coord);
+ const T pixel = dst[pixel_index];
+ if(pixel == MARK_MAYBE)
+ {
+ dst[pixel_index] = MARK_EDGE;
+ pixels_stack.push(coord);
+ }
+ }
+ });
+ }
+
+ // Mark all remaining MAYBE pixels as ZERO (not edges)
+ for(auto i = 0; i < dst.num_elements(); ++i)
+ {
+ if(dst[i] == MARK_MAYBE)
+ {
+ dst[i] = MARK_ZERO;
+ }
+ }
+}
+
+template <typename U, typename T>
+SimpleTensor<T> canny_edge_detector_impl(const SimpleTensor<T> &src, int32_t upper, int32_t lower, int gradient_size, MagnitudeType norm_type,
+ BorderMode border_mode, T constant_border_value)
+{
+ ARM_COMPUTE_ERROR_ON(gradient_size != 3 && gradient_size != 5 && gradient_size != 7);
+ ARM_COMPUTE_ERROR_ON(lower < 0 || lower >= upper);
+
+ // Output: T == uint8_t
+ SimpleTensor<T> dst{ src.shape(), src.data_type() };
+ ValidRegion valid_region = shape_to_valid_region(src.shape(), border_mode == BorderMode::UNDEFINED, BorderSize(gradient_size / 2 + 1));
+
+ // Sobel computation: U == int16_t or int32_t
+ SimpleTensor<U> gx, gy;
+ std::tie(gx, gy) = sobel<U>(src, gradient_size, border_mode, constant_border_value, GradientDimension::GRAD_XY);
+
+ using unsigned_U = typename traits::make_unsigned_conditional_t<U>::type;
+ using promoted_U = typename common_promoted_signed_type<U>::intermediate_type;
+
+ // Gradient magnitude and phase (edge direction)
+ const DataType mag_data_type = gx.data_type() == DataType::S16 ? DataType::U16 : DataType::U32;
+ SimpleTensor<unsigned_U> grad_mag{ gx.shape(), mag_data_type };
+ SimpleTensor<uint8_t> grad_dir{ gy.shape(), DataType::U8 };
+
+ for(auto i = 0; i < grad_mag.num_elements(); ++i)
+ {
+ double mag = 0.f;
+
+ if(norm_type == MagnitudeType::L2NORM)
+ {
+ mag = support::cpp11::round(std::sqrt(static_cast<promoted_U>(gx[i]) * gx[i] + static_cast<promoted_U>(gy[i]) * gy[i]));
+ }
+ else // MagnitudeType::L1NORM
+ {
+ mag = static_cast<promoted_U>(std::abs(gx[i])) + static_cast<promoted_U>(std::abs(gy[i]));
+ }
+
+ float angle = 180.f * std::atan2(static_cast<float>(gy[i]), static_cast<float>(gx[i])) / M_PI;
+ grad_dir[i] = support::cpp11::round(angle < 0.f ? 180 + angle : angle);
+ grad_mag[i] = saturate_cast<unsigned_U>(mag);
+ }
+
+ /*
+ Quantise the phase into 4 directions
+ 0° dir=0 0.0 <= p < 22.5 or 157.5 <= p < 180
+ 45° dir=1 22.5 <= p < 67.5
+ 90° dir=2 67.5 <= p < 112.5
+ 135° dir=3 112.5 <= p < 157.5
+ */
+ for(auto i = 0; i < grad_dir.num_elements(); ++i)
+ {
+ const auto direction = std::fabs(grad_dir[i]);
+ grad_dir[i] = (direction < 22.5 || direction >= 157.5) ? 0 : (direction < 67.5) ? 1 : (direction < 112.5) ? 2 : 3;
+ }
+
+ // Non-maximum suppression
+ std::vector<int> strong_edges;
+ const auto upper_thresh = static_cast<uint32_t>(upper);
+ const auto lower_thresh = static_cast<uint32_t>(lower);
+
+ const auto pixel_at_offset = [&](const SimpleTensor<unsigned_U> &tensor, const Coordinates & coord, int xoffset, int yoffset)
+ {
+ return tensor_elem_at(tensor, Coordinates{ coord.x() + xoffset, coord.y() + yoffset }, border_mode, static_cast<unsigned_U>(constant_border_value));
+ };
+
+ for(auto i = 0; i < dst.num_elements(); ++i)
+ {
+ const auto coord = index2coord(dst.shape(), i);
+ if(!is_in_valid_region(valid_region, coord) || grad_mag[i] <= lower_thresh)
+ {
+ dst[i] = MARK_ZERO;
+ continue;
+ }
+
+ unsigned_U mag_90, mag90;
+ switch(grad_dir[i])
+ {
+ case 0: // North/South edge direction, compare against East/West pixels (left & right)
+ mag_90 = pixel_at_offset(grad_mag, coord, -1, 0);
+ mag90 = pixel_at_offset(grad_mag, coord, 1, 0);
+ break;
+ case 1: // NE/SW edge direction, compare against NW/SE pixels (top-left & bottom-right)
+ mag_90 = pixel_at_offset(grad_mag, coord, -1, -1);
+ mag90 = pixel_at_offset(grad_mag, coord, +1, +1);
+ break;
+ case 2: // East/West edge direction, compare against North/South pixels (top & bottom)
+ mag_90 = pixel_at_offset(grad_mag, coord, 0, -1);
+ mag90 = pixel_at_offset(grad_mag, coord, 0, +1);
+ break;
+ case 3: // NW/SE edge direction, compare against NE/SW pixels (top-right & bottom-left)
+ mag_90 = pixel_at_offset(grad_mag, coord, +1, -1);
+ mag90 = pixel_at_offset(grad_mag, coord, -1, +1);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Invalid gradient phase provided");
+ break;
+ }
+
+ // Potential edge if greater than both pixels at +/-90° on either side
+ if(grad_mag[i] > mag_90 && grad_mag[i] > mag90)
+ {
+ // Double thresholding and edge tracing
+ if(grad_mag[i] > upper_thresh)
+ {
+ dst[i] = MARK_EDGE; // Definite edge pixel
+ strong_edges.emplace_back(i);
+ }
+ else
+ {
+ dst[i] = MARK_MAYBE;
+ }
+ }
+ else
+ {
+ dst[i] = MARK_ZERO; // Since not greater than neighbours
+ }
+ }
+
+ // Final edge tracing
+ trace_edge<T>(dst, valid_region);
+ return dst;
+}
+} // namespace
+
+template <typename T>
+SimpleTensor<T> canny_edge_detector(const SimpleTensor<T> &src, int32_t upper_thresh, int32_t lower_thresh, int gradient_size, MagnitudeType norm_type,
+ BorderMode border_mode, T constant_border_value)
+{
+ if(gradient_size < 7)
+ {
+ return canny_edge_detector_impl<int16_t>(src, upper_thresh, lower_thresh, gradient_size, norm_type, border_mode, constant_border_value);
+ }
+ else
+ {
+ return canny_edge_detector_impl<int32_t>(src, upper_thresh, lower_thresh, gradient_size, norm_type, border_mode, constant_border_value);
+ }
+}
+
+template SimpleTensor<uint8_t> canny_edge_detector(const SimpleTensor<uint8_t> &src, int32_t upper_thresh, int32_t lower_thresh, int gradient_size, MagnitudeType norm_type,
+ BorderMode border_mode, uint8_t constant_border_value);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/reference/FixedPointPixelWiseMultiplication.h b/tests/validation/reference/CannyEdgeDetector.h
similarity index 73%
rename from tests/validation/reference/FixedPointPixelWiseMultiplication.h
rename to tests/validation/reference/CannyEdgeDetector.h
index 124a33c..a46c145 100644
--- a/tests/validation/reference/FixedPointPixelWiseMultiplication.h
+++ b/tests/validation/reference/CannyEdgeDetector.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,9 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef __ARM_COMPUTE_TEST_FIXED_POINT_PIXEL_WISE_MULTIPLICATION_H__
-#define __ARM_COMPUTE_TEST_FIXED_POINT_PIXEL_WISE_MULTIPLICATION_H__
+#ifndef __ARM_COMPUTE_TEST_CANNY_EDGE_DETECTOR_H__
+#define __ARM_COMPUTE_TEST_CANNY_EDGE_DETECTOR_H__
+#include "arm_compute/core/Types.h"
#include "tests/SimpleTensor.h"
namespace arm_compute
@@ -35,9 +36,10 @@
namespace reference
{
template <typename T>
-SimpleTensor<T> fixed_point_pixel_wise_multiplication(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, float scale, ConvertPolicy convert_policy);
+SimpleTensor<T> canny_edge_detector(const SimpleTensor<T> &src, int32_t upper_thresh, int32_t lower_thresh, int gradient_size, MagnitudeType norm_type,
+ BorderMode border_mode, T constant_border_value = 0);
} // namespace reference
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_FIXED_POINT_PIXEL_WISE_MULTIPLICATION_H__ */
+#endif /* __ARM_COMPUTE_TEST_CANNY_EDGE_DETECTOR_H__ */
diff --git a/tests/validation/reference/ChannelCombine.cpp b/tests/validation/reference/ChannelCombine.cpp
index c1ec3ec..b76dcac 100644
--- a/tests/validation/reference/ChannelCombine.cpp
+++ b/tests/validation/reference/ChannelCombine.cpp
@@ -24,7 +24,6 @@
#include "ChannelCombine.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
diff --git a/tests/validation/reference/ChannelExtract.cpp b/tests/validation/reference/ChannelExtract.cpp
index 595bb13..6f17fc0 100644
--- a/tests/validation/reference/ChannelExtract.cpp
+++ b/tests/validation/reference/ChannelExtract.cpp
@@ -24,7 +24,6 @@
#include "ChannelExtract.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
diff --git a/tests/validation/reference/ChannelShuffle.cpp b/tests/validation/reference/ChannelShuffle.cpp
index c4d8d50..b8aa920 100644
--- a/tests/validation/reference/ChannelShuffle.cpp
+++ b/tests/validation/reference/ChannelShuffle.cpp
@@ -39,7 +39,7 @@
SimpleTensor<T> channel_shuffle(const SimpleTensor<T> &src, int num_groups)
{
// Create reference
- SimpleTensor<T> dst{ src.shape(), src.data_type(), src.num_channels(), src.fixed_point_position(), src.quantization_info() };
+ SimpleTensor<T> dst{ src.shape(), src.data_type(), src.num_channels(), src.quantization_info() };
const int M = src.shape()[0];
const int N = src.shape()[1];
diff --git a/tests/validation/reference/Col2Im.cpp b/tests/validation/reference/Col2Im.cpp
new file mode 100644
index 0000000..90e488f
--- /dev/null
+++ b/tests/validation/reference/Col2Im.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "Col2Im.h"
+
+#include "tests/validation/Helpers.h"
+#include "tests/validation/reference/Utils.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T>
+SimpleTensor<T> col2im(const SimpleTensor<T> &src, const TensorShape &dst_shape, unsigned int num_groups)
+{
+ SimpleTensor<T> dst{ dst_shape, src.data_type(), 1 };
+
+ // Compute reference
+ const size_t batches = dst_shape[3];
+ const size_t src_width = src.shape().x();
+ const size_t src_height = src.shape().y();
+
+ if(num_groups == 1)
+ {
+ // Batches are on the 3rd dimension of the input tensor
+ int dst_idx = 0;
+ for(size_t b = 0; b < batches; ++b)
+ {
+ for(size_t x = 0; x < src_width; ++x)
+ {
+ for(size_t y = 0; y < src_height; ++y)
+ {
+ dst[dst_idx++] = src[coord2index(src.shape(), Coordinates(x, y, b))];
+ }
+ }
+ }
+ }
+ else
+ {
+ int dst_idx = 0;
+ for(size_t b = 0; b < batches; ++b)
+ {
+ for(size_t g = 0; g < num_groups; ++g)
+ {
+ for(size_t x = 0; x < src_width; ++x)
+ {
+ for(size_t y = 0; y < src_height; ++y)
+ {
+ dst[dst_idx++] = src[coord2index(src.shape(), Coordinates(x, y, g, b))];
+ }
+ }
+ }
+ }
+ }
+ return dst;
+}
+
+template SimpleTensor<float> col2im(const SimpleTensor<float> &src, const TensorShape &dst_shape, unsigned int num_groups);
+template SimpleTensor<half> col2im(const SimpleTensor<half> &src, const TensorShape &dst_shape, unsigned int num_groups);
+template SimpleTensor<uint8_t> col2im(const SimpleTensor<uint8_t> &src, const TensorShape &dst_shape, unsigned int num_groups);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/reference/FixedPoint.h b/tests/validation/reference/Col2Im.h
similarity index 81%
rename from tests/validation/reference/FixedPoint.h
rename to tests/validation/reference/Col2Im.h
index f0117f9..6082610 100644
--- a/tests/validation/reference/FixedPoint.h
+++ b/tests/validation/reference/Col2Im.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
-#define __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
+#ifndef __ARM_COMPUTE_TEST_COL2IM_H__
+#define __ARM_COMPUTE_TEST_COL2IM_H__
#include "tests/SimpleTensor.h"
-#include "tests/Types.h"
+#include "tests/validation/Helpers.h"
namespace arm_compute
{
@@ -36,9 +36,9 @@
namespace reference
{
template <typename T>
-SimpleTensor<T> fixed_point_operation(const SimpleTensor<T> &src, FixedPointOp op);
+SimpleTensor<T> col2im(const SimpleTensor<T> &src, const TensorShape &dst_shape, unsigned int num_groups);
} // namespace reference
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__ */
+#endif /* __ARM_COMPUTE_TEST_COL2IM_H__ */
diff --git a/tests/validation/reference/ColorConvert.cpp b/tests/validation/reference/ColorConvert.cpp
new file mode 100644
index 0000000..8047b34
--- /dev/null
+++ b/tests/validation/reference/ColorConvert.cpp
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "ColorConvert.h"
+
+#include "arm_compute/core/Types.h"
+#include "tests/validation/Helpers.h"
+#include "tests/validation/reference/ColorConvertHelper.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+namespace
+{
+template <typename T>
+inline std::vector<SimpleTensor<T>> create_image_planes(const TensorShape &shape, Format format)
+{
+ TensorShape image_shape = adjust_odd_shape(shape, format);
+
+ std::vector<SimpleTensor<T>> image_planes;
+
+ switch(format)
+ {
+ case Format::RGB888:
+ case Format::RGBA8888:
+ case Format::YUYV422:
+ case Format::UYVY422:
+ {
+ image_planes.emplace_back(image_shape, format);
+ break;
+ }
+ case Format::NV12:
+ case Format::NV21:
+ {
+ TensorShape shape_uv88 = calculate_subsampled_shape(image_shape, Format::UV88);
+
+ image_planes.emplace_back(image_shape, Format::U8);
+ image_planes.emplace_back(shape_uv88, Format::UV88);
+ break;
+ }
+ case Format::IYUV:
+ {
+ TensorShape shape_sub2 = calculate_subsampled_shape(image_shape, Format::IYUV);
+
+ image_planes.emplace_back(image_shape, Format::U8);
+ image_planes.emplace_back(shape_sub2, Format::U8);
+ image_planes.emplace_back(shape_sub2, Format::U8);
+ break;
+ }
+ case Format::YUV444:
+ {
+ image_planes.emplace_back(image_shape, Format::U8);
+ image_planes.emplace_back(image_shape, Format::U8);
+ image_planes.emplace_back(image_shape, Format::U8);
+ break;
+ }
+ default:
+ ARM_COMPUTE_ERROR("Not supported");
+ break;
+ }
+
+ return image_planes;
+}
+} // namespace
+
+template <typename T>
+std::vector<SimpleTensor<T>> color_convert(const TensorShape &shape, const std::vector<SimpleTensor<T>> &tensor_planes, Format src_format, Format dst_format)
+{
+ std::vector<SimpleTensor<T>> dst = create_image_planes<T>(shape, dst_format);
+
+ switch(src_format)
+ {
+ case Format::RGB888:
+ {
+ switch(dst_format)
+ {
+ case Format::RGBA8888:
+ colorconvert_helper::detail::colorconvert_rgb_to_rgbx(tensor_planes[0], dst[0]);
+ break;
+ case Format::NV12:
+ colorconvert_helper::detail::colorconvert_rgb_to_nv12(tensor_planes[0], dst);
+ break;
+ case Format::IYUV:
+ colorconvert_helper::detail::colorconvert_rgb_to_iyuv(tensor_planes[0], dst);
+ break;
+ case Format::YUV444:
+ colorconvert_helper::detail::colorconvert_rgb_to_yuv4(tensor_planes[0], dst);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Not Supported");
+ break;
+ }
+ break;
+ }
+ case Format::RGBA8888:
+ {
+ switch(dst_format)
+ {
+ case Format::RGB888:
+ colorconvert_helper::detail::colorconvert_rgbx_to_rgb(tensor_planes[0], dst[0]);
+ break;
+ case Format::NV12:
+ colorconvert_helper::detail::colorconvert_rgb_to_nv12(tensor_planes[0], dst);
+ break;
+ case Format::IYUV:
+ colorconvert_helper::detail::colorconvert_rgb_to_iyuv(tensor_planes[0], dst);
+ break;
+ case Format::YUV444:
+ colorconvert_helper::detail::colorconvert_rgb_to_yuv4(tensor_planes[0], dst);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Not Supported");
+ break;
+ }
+ break;
+ }
+ case Format::UYVY422:
+ case Format::YUYV422:
+ {
+ switch(dst_format)
+ {
+ case Format::RGB888:
+ case Format::RGBA8888:
+ colorconvert_helper::detail::colorconvert_yuyv_to_rgb(tensor_planes[0], src_format, dst[0]);
+ break;
+ case Format::NV12:
+ colorconvert_helper::detail::colorconvert_yuyv_to_nv12(tensor_planes[0], src_format, dst);
+ break;
+ case Format::IYUV:
+ colorconvert_helper::detail::colorconvert_yuyv_to_iyuv(tensor_planes[0], src_format, dst);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Not Supported");
+ break;
+ }
+ break;
+ }
+ case Format::IYUV:
+ {
+ switch(dst_format)
+ {
+ case Format::RGB888:
+ case Format::RGBA8888:
+ colorconvert_helper::detail::colorconvert_iyuv_to_rgb(shape, tensor_planes, dst[0]);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Not Supported");
+ break;
+ }
+ break;
+ }
+ case Format::NV12:
+ case Format::NV21:
+ {
+ switch(dst_format)
+ {
+ case Format::RGB888:
+ case Format::RGBA8888:
+ colorconvert_helper::detail::colorconvert_nv12_to_rgb(shape, src_format, tensor_planes, dst[0]);
+ break;
+ case Format::IYUV:
+ colorconvert_helper::detail::colorconvert_nv_to_iyuv(tensor_planes, src_format, dst);
+ break;
+ case Format::YUV444:
+ colorconvert_helper::detail::colorconvert_nv_to_yuv4(tensor_planes, src_format, dst);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Not Supported");
+ break;
+ }
+ break;
+ }
+ default:
+ ARM_COMPUTE_ERROR("Not supported");
+ break;
+ }
+ return dst;
+}
+
+template std::vector<SimpleTensor<uint8_t>> color_convert(const TensorShape &shape, const std::vector<SimpleTensor<uint8_t>> &tensor_planes, Format src_format, Format dst_format);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/reference/FixedPoint.h b/tests/validation/reference/ColorConvert.h
similarity index 79%
copy from tests/validation/reference/FixedPoint.h
copy to tests/validation/reference/ColorConvert.h
index f0117f9..a49bbba 100644
--- a/tests/validation/reference/FixedPoint.h
+++ b/tests/validation/reference/ColorConvert.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,11 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
-#define __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
+#ifndef __ARM_COMPUTE_TEST_COLOR_CONVERT_H__
+#define __ARM_COMPUTE_TEST_COLOR_CONVERT_H__
#include "tests/SimpleTensor.h"
-#include "tests/Types.h"
namespace arm_compute
{
@@ -36,9 +35,9 @@
namespace reference
{
template <typename T>
-SimpleTensor<T> fixed_point_operation(const SimpleTensor<T> &src, FixedPointOp op);
+std::vector<SimpleTensor<T>> color_convert(const TensorShape &shape, const std::vector<SimpleTensor<T>> &tensor_planes, Format src_format, Format dst_format);
} // namespace reference
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__ */
+#endif /* __ARM_COMPUTE_TEST_COLOR_CONVERT_H__ */
diff --git a/tests/validation/reference/ColorConvertHelper.h b/tests/validation/reference/ColorConvertHelper.h
new file mode 100644
index 0000000..7a8b547
--- /dev/null
+++ b/tests/validation/reference/ColorConvertHelper.h
@@ -0,0 +1,851 @@
+/*
+ * Copyright (c) 2017-2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *asymm_int_mult
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, asymm_int_multDAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_TEST_VALIDATION_COLOR_CONVERT_H__
+#define __ARM_COMPUTE_TEST_VALIDATION_COLOR_CONVERT_H__
+
+#include "Utils.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace colorconvert_helper
+{
+namespace detail
+{
+constexpr float red_coef_bt709 = 1.5748F;
+constexpr float green_coef_bt709 = -0.1873f;
+constexpr float green_coef2_bt709 = -0.4681f;
+constexpr float blue_coef_bt709 = 1.8556f;
+
+constexpr float rgb2yuv_bt709_kr = 0.2126f;
+constexpr float rgb2yuv_bt709_kb = 0.0722f;
+// K_g = 1 - K_r - K_b
+constexpr float rgb2yuv_bt709_kg = 0.7152f;
+// C_u = 1 / (2 * (1 - K_b))
+constexpr float rgb2yuv_bt709_cu = 0.5389f;
+// C_v = 1 / (2 * (1 - K_r))
+constexpr float rgb2yuv_bt709_cv = 0.6350f;
+
+template <typename T>
+inline void store_rgb_from_src(const SimpleTensor<T> src, SimpleTensor<T> &rvec, SimpleTensor<T> &gvec, SimpleTensor<T> &bvec)
+{
+ int width = src.shape().x();
+ int height = src.shape().y();
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; ++x)
+ {
+ const Coordinates src_coord{ x, y };
+ const Coordinates vec_coord{ x, y };
+
+ const auto *src_pixel = reinterpret_cast<const T *>(src(src_coord));
+ auto *rvec_pixel = reinterpret_cast<T *>(rvec(vec_coord));
+ auto *gvec_pixel = reinterpret_cast<T *>(gvec(vec_coord));
+ auto *bvec_pixel = reinterpret_cast<T *>(bvec(vec_coord));
+
+ rvec_pixel[0] = src_pixel[0];
+ gvec_pixel[0] = src_pixel[1];
+ bvec_pixel[0] = src_pixel[2];
+ }
+ }
+}
+
+template <typename T>
+inline void rgb_to_yuv_calculation(const SimpleTensor<T> rvec, const SimpleTensor<T> gvec, const SimpleTensor<T> bvec, SimpleTensor<T> &yvec, SimpleTensor<T> &uvec_top, SimpleTensor<T> &uvec_bottom,
+ SimpleTensor<T> &vvec_top, SimpleTensor<T> &vvec_bottom)
+{
+ int width = rvec.shape().x();
+ int height = rvec.shape().y();
+
+ int uvec_coord_x = 0;
+ int uvec_coord_y = 0;
+ Coordinates uvec_coord{ uvec_coord_x, uvec_coord_y };
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; x += 2)
+ {
+ Coordinates coord{ x, y };
+ auto *yvec_pixel = reinterpret_cast<T *>(yvec(coord));
+ auto *uvec_top_pixel = reinterpret_cast<T *>(uvec_top(uvec_coord));
+ auto *uvec_bottom_pixel = reinterpret_cast<T *>(uvec_bottom(uvec_coord));
+ auto *vvec_top_pixel = reinterpret_cast<T *>(vvec_top(uvec_coord));
+ auto *vvec_bottom_pixel = reinterpret_cast<T *>(vvec_bottom(uvec_coord));
+
+ T border_value(0);
+ int rvec_val = validation::tensor_elem_at(rvec, coord, BorderMode::CONSTANT, border_value);
+ int gvec_val = validation::tensor_elem_at(gvec, coord, BorderMode::CONSTANT, border_value);
+ int bvec_val = validation::tensor_elem_at(bvec, coord, BorderMode::CONSTANT, border_value);
+ float result = rvec_val * rgb2yuv_bt709_kr + gvec_val * rgb2yuv_bt709_kg + bvec_val * rgb2yuv_bt709_kb;
+
+ yvec_pixel[0] = result;
+ uvec_top_pixel[0] = (bvec_val - result) * rgb2yuv_bt709_cu + 128.f;
+ vvec_top_pixel[0] = (rvec_val - result) * rgb2yuv_bt709_cv + 128.f;
+
+ coord.set(0, x + 1);
+ rvec_val = validation::tensor_elem_at(rvec, coord, BorderMode::CONSTANT, border_value);
+ gvec_val = validation::tensor_elem_at(gvec, coord, BorderMode::CONSTANT, border_value);
+ bvec_val = validation::tensor_elem_at(bvec, coord, BorderMode::CONSTANT, border_value);
+ result = rvec_val * rgb2yuv_bt709_kr + gvec_val * rgb2yuv_bt709_kg + bvec_val * rgb2yuv_bt709_kb;
+
+ yvec_pixel[1] = result;
+ uvec_bottom_pixel[0] = (bvec_val - result) * rgb2yuv_bt709_cu + 128.f;
+ vvec_bottom_pixel[0] = (rvec_val - result) * rgb2yuv_bt709_cv + 128.f;
+
+ uvec_coord.set(0, ++uvec_coord_x);
+ }
+ }
+}
+inline float compute_rgb_value(int y_value, int v_value, int u_value, unsigned char channel_idx)
+{
+ float result = 0.f;
+ switch(channel_idx)
+ {
+ case 0:
+ {
+ const float red = (v_value - 128.f) * red_coef_bt709;
+ result = y_value + red;
+ break;
+ }
+ case 1:
+ {
+ const float green = (u_value - 128.f) * green_coef_bt709 + (v_value - 128.f) * green_coef2_bt709;
+ result = y_value + green;
+ break;
+ }
+ case 2:
+ {
+ const float blue = (u_value - 128.f) * blue_coef_bt709;
+ result = y_value + blue;
+ break;
+ }
+ default:
+ {
+ //Assuming Alpha channel
+ return 255;
+ }
+ }
+ return std::min(std::max(0.f, result), 255.f);
+}
+
+template <typename T>
+inline void yuyv_to_rgb_calculation(const SimpleTensor<T> yvec, const SimpleTensor<T> vvec, const SimpleTensor<T> yyvec, const SimpleTensor<T> uvec, SimpleTensor<T> &dst)
+{
+ const int dst_width = dst.shape().x();
+ const int dst_height = dst.shape().y();
+ for(int y = 0; y < dst_height; ++y)
+ {
+ int x_coord = 0;
+ for(int x = 0; x < dst_width; x += 2, ++x_coord)
+ {
+ const Coordinates dst_coord{ x, y };
+ auto *dst_pixel = reinterpret_cast<T *>(dst(dst_coord));
+ const T border_value(0);
+ const int yvec_val = validation::tensor_elem_at(yvec, { x_coord, y }, BorderMode::CONSTANT, border_value);
+ const int vvec_val = validation::tensor_elem_at(vvec, { x_coord, y }, BorderMode::CONSTANT, border_value);
+ const int yyvec_val = validation::tensor_elem_at(yyvec, { x_coord, y }, BorderMode::CONSTANT, border_value);
+ const int uvec_val = validation::tensor_elem_at(uvec, { x_coord, y }, BorderMode::CONSTANT, border_value);
+ //Compute first RGB value using Y plane
+ for(int channel_idx = 0; channel_idx < dst.num_channels(); ++channel_idx)
+ {
+ const float channel_value = compute_rgb_value(yvec_val, vvec_val, uvec_val, channel_idx);
+ dst_pixel[channel_idx] = channel_value;
+ }
+ //Compute second RGB value using YY plane
+ const Coordinates dst_coord2
+ {
+ x + 1, y
+ };
+ dst_pixel = reinterpret_cast<T *>(dst(dst_coord2));
+ for(int channel_idx = 0; channel_idx < dst.num_channels(); ++channel_idx)
+ {
+ const float channel_value = compute_rgb_value(yyvec_val, vvec_val, uvec_val, channel_idx);
+ dst_pixel[channel_idx] = channel_value;
+ }
+ }
+ }
+}
+
+template <typename T>
+inline void colorconvert_rgb_to_rgbx(const SimpleTensor<T> src, SimpleTensor<T> &dst)
+{
+ for(int channel_idx = 0; channel_idx < dst.num_channels(); ++channel_idx)
+ {
+ const int width = dst.shape().x();
+ const int height = dst.shape().y();
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; ++x)
+ {
+ const Coordinates src_coord{ x, y };
+ const Coordinates dst_coord{ x, y };
+
+ const auto *src_pixel = reinterpret_cast<const T *>(src(src_coord));
+ auto *dst_pixel = reinterpret_cast<T *>(dst(dst_coord));
+ if(channel_idx == 3)
+ {
+ dst_pixel[channel_idx] = 255;
+ continue;
+ }
+
+ dst_pixel[channel_idx] = src_pixel[channel_idx];
+ }
+ }
+ }
+}
+
+template <typename T>
+inline void colorconvert_rgbx_to_rgb(const SimpleTensor<T> src, SimpleTensor<T> &dst)
+{
+ for(int channel_idx = 0; channel_idx < dst.num_channels(); ++channel_idx)
+ {
+ const int width = dst.shape().x();
+ const int height = dst.shape().y();
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; ++x)
+ {
+ const Coordinates src_coord{ x, y };
+ const Coordinates dst_coord{ x, y };
+
+ const auto *src_pixel = reinterpret_cast<const T *>(src(src_coord));
+ auto *dst_pixel = reinterpret_cast<T *>(dst(dst_coord));
+
+ dst_pixel[channel_idx] = src_pixel[channel_idx];
+ }
+ }
+ }
+}
+
+template <typename T>
+inline void colorconvert_yuyv_to_rgb(const SimpleTensor<T> src, const Format format, SimpleTensor<T> &dst)
+{
+ SimpleTensor<T> yvec(TensorShape{ src.shape().x() / 2, src.shape().y() }, Format::U8);
+ SimpleTensor<T> uvec(TensorShape{ src.shape().x() / 2, src.shape().y() }, Format::U8);
+ SimpleTensor<T> yyvec(TensorShape{ src.shape().x() / 2, src.shape().y() }, Format::U8);
+ SimpleTensor<T> vvec(TensorShape{ src.shape().x() / 2, src.shape().y() }, Format::U8);
+
+ const int step_x = (Format::YUYV422 == format || Format::UYVY422 == format) ? 2 : 1;
+ const int offset = (Format::YUYV422 == format) ? 0 : 1;
+
+ Coordinates elem_coord{ 0, 0 };
+ const int width = yvec.shape().x();
+ const int height = yvec.shape().y();
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; ++x)
+ {
+ const Coordinates src_coord{ x * step_x, y };
+ const auto *src_pixel = reinterpret_cast<const T *>(src(src_coord));
+ auto *yvec_pixel = reinterpret_cast<T *>(yvec(elem_coord));
+ auto *uvec_pixel = reinterpret_cast<T *>(uvec(elem_coord));
+ auto *yyvec_pixel = reinterpret_cast<T *>(yyvec(elem_coord));
+ auto *vvec_pixel = reinterpret_cast<T *>(vvec(elem_coord));
+ yvec_pixel[x] = src_pixel[0 + offset];
+ uvec_pixel[x] = src_pixel[1 - offset];
+ yyvec_pixel[x] = src_pixel[2 + offset];
+ vvec_pixel[x] = src_pixel[3 - offset];
+ }
+ elem_coord.set(1, y + 1);
+ }
+
+ yuyv_to_rgb_calculation(yvec, vvec, yyvec, uvec, dst);
+}
+
+template <typename T>
+inline void colorconvert_iyuv_to_rgb(const TensorShape &shape, const std::vector<SimpleTensor<T>> &tensor_planes, SimpleTensor<T> &dst)
+{
+ SimpleTensor<T> yvec(TensorShape{ tensor_planes[0].shape().x() / 2, tensor_planes[0].shape().y() }, Format::U8);
+ SimpleTensor<T> uvec(TensorShape{ tensor_planes[0].shape().x() / 2, tensor_planes[0].shape().y() }, Format::U8);
+ SimpleTensor<T> yyvec(TensorShape{ tensor_planes[0].shape().x() / 2, tensor_planes[0].shape().y() }, Format::U8);
+ SimpleTensor<T> vvec(TensorShape{ tensor_planes[0].shape().x() / 2, tensor_planes[0].shape().y() }, Format::U8);
+
+ Coordinates elem_coord{ 0, 0 };
+ const int yvec_width = yvec.shape().x();
+ const int yvec_height = yvec.shape().y();
+
+ for(int y = 0; y < yvec_height; ++y)
+ {
+ for(int x = 0; x < yvec_width; ++x)
+ {
+ const Coordinates src_coord{ x, y };
+ const auto *src_pixel = reinterpret_cast<const T *>(tensor_planes[0](src_coord));
+ auto *yvec_pixel = reinterpret_cast<T *>(yvec(elem_coord));
+ auto *yyvec_pixel = reinterpret_cast<T *>(yyvec(elem_coord));
+ yvec_pixel[x] = src_pixel[x];
+ yyvec_pixel[x] = src_pixel[x + 1];
+ }
+ elem_coord.set(1, y + 1);
+ }
+
+ const int uvec_width = uvec.shape().x();
+ const int uvec_height = uvec.shape().y();
+
+ Coordinates top_elem_coord{ 0, 0 };
+ Coordinates bottom_elem_coord{ 0, 1 };
+ for(int y = 0; y < uvec_height; y += 2)
+ {
+ for(int x = 0; x < uvec_width; ++x)
+ {
+ const Coordinates src_coord{ x, y / 2 };
+ const auto *u_pixel = reinterpret_cast<const T *>(tensor_planes[1](src_coord));
+ const auto *v_pixel = reinterpret_cast<const T *>(tensor_planes[2](src_coord));
+ auto *uvec_pixel_top = reinterpret_cast<T *>(uvec(top_elem_coord));
+ auto *vvec_pixel_top = reinterpret_cast<T *>(vvec(top_elem_coord));
+
+ auto *uvec_pixel_bottom = reinterpret_cast<T *>(uvec(bottom_elem_coord));
+ auto *vvec_pixel_bottom = reinterpret_cast<T *>(vvec(bottom_elem_coord));
+ uvec_pixel_top[x] = u_pixel[0];
+ vvec_pixel_top[x] = v_pixel[0];
+ uvec_pixel_bottom[x] = u_pixel[0];
+ vvec_pixel_bottom[x] = v_pixel[0];
+ }
+ top_elem_coord.set(1, y + 2);
+ bottom_elem_coord.set(1, top_elem_coord.y() + 1);
+ }
+
+ yuyv_to_rgb_calculation(yvec, vvec, yyvec, uvec, dst);
+}
+
+template <typename T>
+inline void colorconvert_nv12_to_rgb(const TensorShape &shape, const Format format, const std::vector<SimpleTensor<T>> &tensor_planes, SimpleTensor<T> &dst)
+{
+ SimpleTensor<T> yvec(TensorShape{ tensor_planes[0].shape().x() / 2, tensor_planes[0].shape().y() }, Format::U8);
+ SimpleTensor<T> uvec(TensorShape{ tensor_planes[0].shape().x() / 2, tensor_planes[0].shape().y() }, Format::U8);
+ SimpleTensor<T> yyvec(TensorShape{ tensor_planes[0].shape().x() / 2, tensor_planes[0].shape().y() }, Format::U8);
+ SimpleTensor<T> vvec(TensorShape{ tensor_planes[0].shape().x() / 2, tensor_planes[0].shape().y() }, Format::U8);
+
+ const int offset = (Format::NV12 == format) ? 0 : 1;
+
+ Coordinates elem_coord{ 0, 0 };
+ const int yvec_width = yvec.shape().x();
+ const int yvec_height = yvec.shape().y();
+
+ for(int y = 0; y < yvec_height; ++y)
+ {
+ for(int x = 0; x < yvec_width; ++x)
+ {
+ const Coordinates src_coord{ x, y };
+ const auto *src_pixel = reinterpret_cast<const T *>(tensor_planes[0](src_coord));
+ auto *yvec_pixel = reinterpret_cast<T *>(yvec(elem_coord));
+ auto *yyvec_pixel = reinterpret_cast<T *>(yyvec(elem_coord));
+ yvec_pixel[x] = src_pixel[x];
+ yyvec_pixel[x] = src_pixel[x + 1];
+ }
+ elem_coord.set(1, y + 1);
+ }
+
+ const int uvec_width = uvec.shape().x();
+ const int uvec_height = uvec.shape().y();
+
+ Coordinates top_elem_coord{ 0, 0 };
+ Coordinates bottom_elem_coord{ 0, 1 };
+ for(int y = 0; y < uvec_height; y += 2)
+ {
+ for(int x = 0; x < uvec_width; ++x)
+ {
+ const Coordinates src_coord{ x, y / 2 };
+ const auto *src_pixel = reinterpret_cast<const T *>(tensor_planes[1](src_coord));
+ auto *uvec_pixel_top = reinterpret_cast<T *>(uvec(top_elem_coord));
+ auto *vvec_pixel_top = reinterpret_cast<T *>(vvec(top_elem_coord));
+
+ auto *uvec_pixel_bottom = reinterpret_cast<T *>(uvec(bottom_elem_coord));
+ auto *vvec_pixel_bottom = reinterpret_cast<T *>(vvec(bottom_elem_coord));
+ uvec_pixel_top[x] = src_pixel[0 + offset];
+ vvec_pixel_top[x] = src_pixel[1 - offset];
+ uvec_pixel_bottom[x] = src_pixel[0 + offset];
+ vvec_pixel_bottom[x] = src_pixel[1 - offset];
+ }
+ top_elem_coord.set(1, y + 2);
+ bottom_elem_coord.set(1, top_elem_coord.y() + 1);
+ }
+
+ yuyv_to_rgb_calculation(yvec, vvec, yyvec, uvec, dst);
+}
+
+template <typename T>
+inline void colorconvert_rgb_to_nv12(const SimpleTensor<T> src, std::vector<SimpleTensor<T>> &dst)
+{
+ SimpleTensor<T> rvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> gvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> bvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> yvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+
+ int vec_shape_x = src.shape().x() * src.shape().y();
+
+ SimpleTensor<T> uvec_top(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> uvec_bottom(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> vvec_top(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> vvec_bottom(TensorShape{ vec_shape_x, 1U }, Format::U8);
+
+ store_rgb_from_src(src, rvec, gvec, bvec);
+ rgb_to_yuv_calculation(rvec, gvec, bvec, dst[0], uvec_top, uvec_bottom, vvec_top, vvec_bottom);
+
+ SimpleTensor<T> utmp(TensorShape{ src.shape().x() / 2, src.shape().y() }, Format::U8);
+ SimpleTensor<T> vtmp(TensorShape{ src.shape().x() / 2, src.shape().y() }, Format::U8);
+
+ int utmp_width = utmp.shape().x();
+ int utmp_height = utmp.shape().y();
+
+ int uvec_coord_x = 0;
+ int uvec_coord_y = 0;
+ Coordinates uvec_coord{ uvec_coord_x, uvec_coord_y };
+ for(int y = 0; y < utmp_height; y++)
+ {
+ for(int x = 0; x < utmp_width; x++)
+ {
+ Coordinates coord{ x, y };
+ auto *utmp_pixel = reinterpret_cast<T *>(utmp(coord));
+ auto *vtmp_pixel = reinterpret_cast<T *>(vtmp(coord));
+
+ T border_value(0);
+ int uvec_top_val = validation::tensor_elem_at(uvec_top, uvec_coord, BorderMode::CONSTANT, border_value);
+ int uvec_bottom_val = validation::tensor_elem_at(uvec_bottom, uvec_coord, BorderMode::CONSTANT, border_value);
+ int vvec_top_val = validation::tensor_elem_at(vvec_top, uvec_coord, BorderMode::CONSTANT, border_value);
+ int vvec_bottom_val = validation::tensor_elem_at(vvec_bottom, uvec_coord, BorderMode::CONSTANT, border_value);
+
+ utmp_pixel[0] = std::ceil(float(uvec_top_val + uvec_bottom_val) / 2);
+ vtmp_pixel[0] = std::ceil(float(vvec_top_val + vvec_bottom_val) / 2);
+
+ uvec_coord.set(0, ++uvec_coord_x);
+ }
+ }
+
+ int second_plane_x = dst[1].shape().x();
+ int second_plane_y = dst[1].shape().y();
+
+ int utmp_coord_x = 0;
+ int utmp_coord_y = 0;
+
+ for(int y = 0; y < second_plane_y; y++)
+ {
+ for(int x = 0; x < second_plane_x; x++)
+ {
+ Coordinates coord{ x, y };
+ Coordinates utmp_top_coord{ utmp_coord_x, utmp_coord_y };
+ Coordinates utmp_bottom_coord{ utmp_coord_x, utmp_coord_y + 1 };
+
+ auto *dst_pixel = reinterpret_cast<T *>(dst[1](coord));
+
+ T border_value(0);
+ int utmp_top_val = validation::tensor_elem_at(utmp, utmp_top_coord, BorderMode::CONSTANT, border_value);
+ int utmp_bottom_val = validation::tensor_elem_at(utmp, utmp_bottom_coord, BorderMode::CONSTANT, border_value);
+
+ int result = (utmp_top_val + utmp_bottom_val) / 2;
+ dst_pixel[0] = result;
+
+ int vtmp_top_val = validation::tensor_elem_at(vtmp, utmp_top_coord, BorderMode::CONSTANT, border_value);
+ int vtmp_bottom_val = validation::tensor_elem_at(vtmp, utmp_bottom_coord, BorderMode::CONSTANT, border_value);
+
+ result = (vtmp_top_val + vtmp_bottom_val) / 2;
+ dst_pixel[1] = result;
+
+ utmp_coord_x++;
+
+ if(utmp_coord_x >= utmp_width)
+ {
+ utmp_coord_x = 0;
+ utmp_coord_y += 2;
+ }
+ }
+ }
+}
+
+template <typename T>
+inline void colorconvert_rgb_to_iyuv(const SimpleTensor<T> src, std::vector<SimpleTensor<T>> &dst)
+{
+ SimpleTensor<T> rvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> gvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> bvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> yvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+
+ int vec_shape_x = src.shape().x() * src.shape().y();
+
+ SimpleTensor<T> uvec_top(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> uvec_bottom(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> vvec_top(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> vvec_bottom(TensorShape{ vec_shape_x, 1U }, Format::U8);
+
+ store_rgb_from_src(src, rvec, gvec, bvec);
+ rgb_to_yuv_calculation(rvec, gvec, bvec, dst[0], uvec_top, uvec_bottom, vvec_top, vvec_bottom);
+
+ SimpleTensor<T> utmp(TensorShape{ src.shape().x() / 2, src.shape().y() }, Format::U8);
+ SimpleTensor<T> vtmp(TensorShape{ src.shape().x() / 2, src.shape().y() }, Format::U8);
+ int utmp_width = utmp.shape().x();
+ int utmp_height = utmp.shape().y();
+
+ int uvec_coord_x = 0;
+ int uvec_coord_y = 0;
+ Coordinates uvec_coord{ uvec_coord_x, uvec_coord_y };
+ for(int y = 0; y < utmp_height; y++)
+ {
+ for(int x = 0; x < utmp_width; x++)
+ {
+ Coordinates coord{ x, y };
+ auto *utmp_pixel = reinterpret_cast<T *>(utmp(coord));
+ auto *vtmp_pixel = reinterpret_cast<T *>(vtmp(coord));
+
+ T border_value(0);
+ int uvec_top_val = validation::tensor_elem_at(uvec_top, uvec_coord, BorderMode::CONSTANT, border_value);
+ int uvec_bottom_val = validation::tensor_elem_at(uvec_bottom, uvec_coord, BorderMode::CONSTANT, border_value);
+ int vvec_top_val = validation::tensor_elem_at(vvec_top, uvec_coord, BorderMode::CONSTANT, border_value);
+ int vvec_bottom_val = validation::tensor_elem_at(vvec_bottom, uvec_coord, BorderMode::CONSTANT, border_value);
+
+ utmp_pixel[0] = std::ceil(float(uvec_top_val + uvec_bottom_val) / 2);
+ vtmp_pixel[0] = std::ceil(float(vvec_top_val + vvec_bottom_val) / 2);
+
+ uvec_coord.set(0, ++uvec_coord_x);
+ }
+ }
+
+ int second_plane_x = dst[1].shape().x();
+ int second_plane_y = dst[1].shape().y();
+
+ int utmp_coord_x = 0;
+ int utmp_coord_y = 0;
+
+ for(int y = 0; y < second_plane_y; y++)
+ {
+ for(int x = 0; x < second_plane_x; x++)
+ {
+ Coordinates coord{ x, y };
+ Coordinates utmp_top_coord{ utmp_coord_x, utmp_coord_y };
+ Coordinates utmp_bottom_coord{ utmp_coord_x, utmp_coord_y + 1 };
+
+ auto *u_pixel = reinterpret_cast<T *>(dst[1](coord));
+ auto *v_pixel = reinterpret_cast<T *>(dst[2](coord));
+
+ T border_value(0);
+ int utmp_top_val = validation::tensor_elem_at(utmp, utmp_top_coord, BorderMode::CONSTANT, border_value);
+ int utmp_bottom_val = validation::tensor_elem_at(utmp, utmp_bottom_coord, BorderMode::CONSTANT, border_value);
+
+ int result = (utmp_top_val + utmp_bottom_val) / 2;
+ u_pixel[0] = result;
+
+ int vtmp_top_val = validation::tensor_elem_at(vtmp, utmp_top_coord, BorderMode::CONSTANT, border_value);
+ int vtmp_bottom_val = validation::tensor_elem_at(vtmp, utmp_bottom_coord, BorderMode::CONSTANT, border_value);
+
+ result = (vtmp_top_val + vtmp_bottom_val) / 2;
+ v_pixel[0] = result;
+
+ utmp_coord_x++;
+
+ if(utmp_coord_x >= utmp_width)
+ {
+ utmp_coord_x = 0;
+ utmp_coord_y += 2;
+ }
+ }
+ }
+}
+
+template <typename T>
+inline void colorconvert_rgb_to_yuv4(const SimpleTensor<T> src, std::vector<SimpleTensor<T>> &dst)
+{
+ SimpleTensor<T> rvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> gvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> bvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+ SimpleTensor<T> yvec(TensorShape{ dst[0].shape().x(), dst[0].shape().y() }, Format::U8);
+
+ int vec_shape_x = src.shape().x() * src.shape().y();
+
+ SimpleTensor<T> uvec_top(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> uvec_bottom(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> vvec_top(TensorShape{ vec_shape_x, 1U }, Format::U8);
+ SimpleTensor<T> vvec_bottom(TensorShape{ vec_shape_x, 1U }, Format::U8);
+
+ int width = src.shape().x();
+ int height = src.shape().y();
+
+ store_rgb_from_src(src, rvec, gvec, bvec);
+
+ rgb_to_yuv_calculation(rvec, gvec, bvec, dst[0], uvec_top, uvec_bottom, vvec_top, vvec_bottom);
+
+ int uvec_coord_x = 0;
+ int uvec_coord_y = 0;
+ Coordinates uvec_coord{ uvec_coord_x, uvec_coord_y };
+ for(int y = 0; y < height; y++)
+ {
+ for(int x = 0; x < width; x += 2)
+ {
+ Coordinates coord{ x, y };
+ auto *plane_1_pixel = reinterpret_cast<T *>(dst[1](coord));
+ auto *plane_2_pixel = reinterpret_cast<T *>(dst[2](coord));
+
+ T border_value(0);
+ int uvec_top_val = validation::tensor_elem_at(uvec_top, uvec_coord, BorderMode::CONSTANT, border_value);
+ int uvec_bottom_val = validation::tensor_elem_at(uvec_bottom, uvec_coord, BorderMode::CONSTANT, border_value);
+
+ plane_1_pixel[0] = uvec_top_val;
+ plane_1_pixel[1] = uvec_bottom_val;
+
+ int vvec_top_val = validation::tensor_elem_at(vvec_top, uvec_coord, BorderMode::CONSTANT, border_value);
+ int vvec_bottom_val = validation::tensor_elem_at(vvec_bottom, uvec_coord, BorderMode::CONSTANT, border_value);
+
+ plane_2_pixel[0] = vvec_top_val;
+ plane_2_pixel[1] = vvec_bottom_val;
+
+ uvec_coord.set(0, ++uvec_coord_x);
+ }
+ }
+}
+
+template <typename T>
+inline void colorconvert_yuyv_to_nv12(const SimpleTensor<T> src, const Format format, std::vector<SimpleTensor<T>> &dst)
+{
+ SimpleTensor<T> uvvec_top(TensorShape{ dst[0].shape().x(), dst[0].shape().y() / 2 }, Format::U8);
+ SimpleTensor<T> uvvec_bottom(TensorShape{ dst[0].shape().x(), dst[0].shape().y() / 2 }, Format::U8);
+
+ const int offset = (Format::YUYV422 == format) ? 0 : 1;
+
+ int width = dst[0].shape().x();
+ int height = dst[0].shape().y();
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ const Coordinates dst_coord{ x, y };
+ const Coordinates uv_coord{ x, y / 2 };
+
+ const auto *src_pixel = reinterpret_cast<const T *>(src(dst_coord));
+ auto *y_pixel = reinterpret_cast<T *>(dst[0](dst_coord));
+ auto *uvvec_top_pixel = reinterpret_cast<T *>(uvvec_top(uv_coord));
+ auto *uvvec_bottom_pixel = reinterpret_cast<T *>(uvvec_bottom(uv_coord));
+
+ y_pixel[0] = src_pixel[0 + offset];
+
+ if(y % 2 == 0)
+ {
+ uvvec_top_pixel[0] = src_pixel[1 - offset];
+ }
+ else
+ {
+ uvvec_bottom_pixel[0] = src_pixel[1 - offset];
+ }
+ }
+ }
+
+ width = dst[1].shape().x();
+ height = dst[1].shape().y();
+
+ int uv_coord_x = 0;
+ int uv_coord_y = 0;
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ const Coordinates dst_coord{ x, y };
+ const Coordinates uv_coord{ uv_coord_x, uv_coord_y };
+
+ auto *uv_pixel = reinterpret_cast<T *>(dst[1](dst_coord));
+ const auto *uvvec_top_pixel = reinterpret_cast<T *>(uvvec_top(uv_coord));
+ const auto *uvvec_bottom_pixel = reinterpret_cast<T *>(uvvec_bottom(uv_coord));
+
+ uv_pixel[0] = (uvvec_top_pixel[0] + uvvec_bottom_pixel[0]) / 2;
+ uv_pixel[1] = (uvvec_top_pixel[1] + uvvec_bottom_pixel[1]) / 2;
+ uv_coord_x += 2;
+ }
+ uv_coord_x = 0;
+ uv_coord_y++;
+ }
+}
+
+template <typename T>
+inline void colorconvert_yuyv_to_iyuv(const SimpleTensor<T> src, const Format format, std::vector<SimpleTensor<T>> &dst)
+{
+ SimpleTensor<T> uvvec_top(TensorShape{ dst[0].shape().x(), dst[0].shape().y() / 2 }, Format::U8);
+ SimpleTensor<T> uvvec_bottom(TensorShape{ dst[0].shape().x(), dst[0].shape().y() / 2 }, Format::U8);
+
+ const int offset = (Format::YUYV422 == format) ? 0 : 1;
+
+ int width = dst[0].shape().x();
+ int height = dst[0].shape().y();
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ const Coordinates dst_coord{ x, y };
+ const Coordinates uv_coord{ x, y / 2 };
+
+ const auto *src_pixel = reinterpret_cast<const T *>(src(dst_coord));
+ auto *y_pixel = reinterpret_cast<T *>(dst[0](dst_coord));
+ auto *uvvec_top_pixel = reinterpret_cast<T *>(uvvec_top(uv_coord));
+ auto *uvvec_bottom_pixel = reinterpret_cast<T *>(uvvec_bottom(uv_coord));
+
+ y_pixel[0] = src_pixel[0 + offset];
+
+ if(y % 2 == 0)
+ {
+ uvvec_top_pixel[0] = src_pixel[1 - offset];
+ }
+ else
+ {
+ uvvec_bottom_pixel[0] = src_pixel[1 - offset];
+ }
+ }
+ }
+
+ width = dst[1].shape().x();
+ height = dst[1].shape().y();
+
+ int uv_coord_x = 0;
+ int uv_coord_y = 0;
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ const Coordinates dst_coord{ x, y };
+ const Coordinates uv_coord{ uv_coord_x, uv_coord_y };
+
+ auto *u_pixel = reinterpret_cast<T *>(dst[1](dst_coord));
+ auto *v_pixel = reinterpret_cast<T *>(dst[2](dst_coord));
+ const auto *uvvec_top_pixel = reinterpret_cast<T *>(uvvec_top(uv_coord));
+ const auto *uvvec_bottom_pixel = reinterpret_cast<T *>(uvvec_bottom(uv_coord));
+
+ u_pixel[0] = (uvvec_top_pixel[0] + uvvec_bottom_pixel[0]) / 2;
+ v_pixel[0] = (uvvec_top_pixel[1] + uvvec_bottom_pixel[1]) / 2;
+ uv_coord_x += 2;
+ }
+ uv_coord_x = 0;
+ uv_coord_y++;
+ }
+}
+
+template <typename T>
+inline void nv_to_iyuv(const SimpleTensor<T> src, const Format src_format, SimpleTensor<T> &nv1, SimpleTensor<T> &nv2)
+{
+ int width = src.shape().x();
+ int height = src.shape().y();
+
+ const int offset = (Format::NV12 == src_format) ? 1 : 0;
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ const Coordinates src_coord{ x, y };
+ const auto *src_pixel = reinterpret_cast<const T *>(src(src_coord));
+ auto *u_pixel = reinterpret_cast<T *>(nv1(src_coord));
+ auto *v_pixel = reinterpret_cast<T *>(nv2(src_coord));
+
+ u_pixel[0] = src_pixel[1 - offset];
+ v_pixel[0] = src_pixel[0 + offset];
+ }
+ }
+}
+
+template <typename T>
+inline void nv_to_yuv4(const SimpleTensor<T> src, const Format src_format, SimpleTensor<T> &nv1, SimpleTensor<T> &nv2)
+{
+ int width = src.shape().x();
+ int height = src.shape().y();
+
+ const int offset = (Format::NV12 == src_format) ? 1 : 0;
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; x++)
+ {
+ const Coordinates src_coord{ x, y };
+ Coordinates dst_coord{ x * 2, y * 2 };
+ const auto *src_pixel = reinterpret_cast<const T *>(src(src_coord));
+ auto *u_pixel = reinterpret_cast<T *>(nv1(dst_coord));
+ auto *v_pixel = reinterpret_cast<T *>(nv2(dst_coord));
+
+ u_pixel[0] = src_pixel[1 - offset];
+ u_pixel[1] = src_pixel[1 - offset];
+
+ v_pixel[0] = src_pixel[0 + offset];
+ v_pixel[1] = src_pixel[0 + offset];
+
+ dst_coord.set(1, y * 2 + 1);
+ u_pixel = reinterpret_cast<T *>(nv1(dst_coord));
+ v_pixel = reinterpret_cast<T *>(nv2(dst_coord));
+ u_pixel[0] = src_pixel[1 - offset];
+ u_pixel[1] = src_pixel[1 - offset];
+
+ v_pixel[0] = src_pixel[0 + offset];
+ v_pixel[1] = src_pixel[0 + offset];
+ }
+ }
+}
+
+template <typename T>
+inline void colorconvert_nv_to_iyuv(const std::vector<SimpleTensor<T>> src, const Format src_format, std::vector<SimpleTensor<T>> &dst)
+{
+ int width = dst[0].shape().x();
+ int height = dst[0].shape().y();
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; ++x)
+ {
+ const Coordinates dst_coord{ x, y };
+
+ const auto *src_pixel = reinterpret_cast<const T *>(src[0](dst_coord));
+ auto *y_pixel = reinterpret_cast<T *>(dst[0](dst_coord));
+
+ y_pixel[0] = src_pixel[0];
+ }
+ }
+
+ nv_to_iyuv(src[1], src_format, dst[1], dst[2]);
+}
+
+template <typename T>
+inline void colorconvert_nv_to_yuv4(const std::vector<SimpleTensor<T>> src, const Format src_format, std::vector<SimpleTensor<T>> &dst)
+{
+ int width = dst[0].shape().x();
+ int height = dst[0].shape().y();
+
+ for(int y = 0; y < height; ++y)
+ {
+ for(int x = 0; x < width; ++x)
+ {
+ const Coordinates dst_coord{ x, y };
+
+ const auto *src_pixel = reinterpret_cast<const T *>(src[0](dst_coord));
+ auto *y_pixel = reinterpret_cast<T *>(dst[0](dst_coord));
+
+ y_pixel[0] = src_pixel[0];
+ }
+ }
+
+ nv_to_yuv4(src[1], src_format, dst[1], dst[2]);
+}
+
+} // namespace detail
+} // color_convert_helper
+} // namespace test
+} // namespace arm_compute
+#endif /*__ARM_COMPUTE_TEST_VALIDATION_COLOR_CONVERT_H__ */
diff --git a/tests/validation/reference/ConvertFullyConnectedWeights.cpp b/tests/validation/reference/ConvertFullyConnectedWeights.cpp
index b0f537f..e27846c 100644
--- a/tests/validation/reference/ConvertFullyConnectedWeights.cpp
+++ b/tests/validation/reference/ConvertFullyConnectedWeights.cpp
@@ -36,9 +36,15 @@
{
SimpleTensor<T> dst(src.shape(), src.data_type());
+ const DataLayout original_input_data_layout = (training_data_layout == DataLayout::NCHW) ? DataLayout::NHWC : DataLayout::NCHW;
+
+ const int width_idx = get_data_layout_dimension_index(original_input_data_layout, DataLayoutDimension::WIDTH);
+ const int height_idx = get_data_layout_dimension_index(original_input_data_layout, DataLayoutDimension::HEIGHT);
+ const int channel_idx = get_data_layout_dimension_index(original_input_data_layout, DataLayoutDimension::CHANNEL);
+
const bool is_nchw_to_nhwc = training_data_layout == DataLayout::NCHW;
- const unsigned int num_elems_per_input_plane = original_input_shape.x() * original_input_shape.y();
- const unsigned int num_channels = original_input_shape.z();
+ const unsigned int num_elems_per_input_plane = original_input_shape[width_idx] * original_input_shape[height_idx];
+ const unsigned int num_channels = original_input_shape[channel_idx];
const unsigned int factor_1 = is_nchw_to_nhwc ? num_elems_per_input_plane : num_channels;
const unsigned int factor_2 = is_nchw_to_nhwc ? num_channels : num_elems_per_input_plane;
diff --git a/tests/validation/reference/Convolution3d.h b/tests/validation/reference/Convolution3d.h
index 7001758..2e5fefd 100644
--- a/tests/validation/reference/Convolution3d.h
+++ b/tests/validation/reference/Convolution3d.h
@@ -25,7 +25,6 @@
#define __ARM_COMPUTE_TEST_VALIDATION_CONVOLUTION_H__
#include "arm_compute/core/utils/quantization/AsymmHelpers.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
#include "tests/validation/reference/UtilsQuantizedAsymm.h"
@@ -91,74 +90,16 @@
*out_ptr = acc + (*b_ptr);
}
-// 3D convolution for fixed point type
-template < typename T, typename TB, typename std::enable_if < std::is_integral<T>::value &&std::is_integral<TB>::value, int >::type = 0 >
+// 3D convolution for QASYMM8 type
+template < typename T, typename TB, typename std::enable_if < std::is_same<T, uint8_t>::value &&std::is_same<TB, int32_t>::value, int >::type = 0 >
inline void convolution3d(const SimpleTensor<T> &in, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, SimpleTensor<T> &out,
int i_offset, int w_offset, int b_offset, int o_offset,
int xi, int yi, int width_in, int height_in, int depth_in, int width_weights, int height_weights, int dilation_x = 1, int dilation_y = 1)
{
- const T *in_ptr = in.data() + i_offset;
- const T *w_ptr = weights.data() + w_offset;
- const T *b_ptr = bias.data() + b_offset;
- T *out_ptr = out.data() + o_offset;
- int fixed_point_position = in.fixed_point_position();
-
- const int half_width_weights_start = width_weights / 2;
- const int half_width_weights_end = ((width_weights % 2) == 0) ? (half_width_weights_start - 1) : half_width_weights_start;
- const int half_height_weights_start = height_weights / 2;
- const int half_height_weights_end = ((height_weights % 2) == 0) ? (half_height_weights_start - 1) : half_height_weights_start;
-
- using namespace fixed_point_arithmetic;
- using promoted_type = fixed_point_arithmetic::traits::promote_t<T>;
-
- // Reset accumulator
- fixed_point<promoted_type> acc(0, fixed_point_position);
-
- // Compute a 2D convolution for each IFM and accumulate the result
- for(int ifm = 0; ifm < depth_in; ++ifm)
- {
- // Compute the offset for the input slice
- const int offset_slice_in = xi + yi * width_in + ifm * width_in * height_in;
-
- // Compute 2D convolution
- for(int yk = -half_height_weights_start; yk <= half_height_weights_end; ++yk)
- {
- for(int xk = -half_width_weights_start; xk <= half_width_weights_end; ++xk)
- {
- // Check if the pixel is out-of-bound
- if(is_valid_pixel(xi + xk * dilation_x, 0, width_in) && is_valid_pixel(yi + yk * dilation_y, 0, height_in))
- {
- const int idx = xk + half_width_weights_start;
- const int idy = yk + half_height_weights_start;
-
- const fixed_point<promoted_type> i_value(in_ptr[offset_slice_in + xk * dilation_x + yk * dilation_y * width_in], fixed_point_position, true);
- const fixed_point<promoted_type> w_value(w_ptr[idx + idy * width_weights + ifm * width_weights * height_weights], fixed_point_position, true);
- const fixed_point<promoted_type> iw = i_value * w_value;
- acc = iw + acc;
- }
- }
- }
- }
-
- // Get the bias
- const fixed_point<promoted_type> b(*b_ptr, fixed_point_position, true);
-
- // Accumulate the bias and covert back
- acc = acc + b;
- fixed_point<T> res(acc);
- *out_ptr = res.raw();
-}
-
-// 3D convolution for QASYMM8 type
-template <>
-inline void convolution3d(const SimpleTensor<uint8_t> &in, const SimpleTensor<uint8_t> &weights, const SimpleTensor<int32_t> &bias, SimpleTensor<uint8_t> &out,
- int i_offset, int w_offset, int b_offset, int o_offset,
- int xi, int yi, int width_in, int height_in, int depth_in, int width_weights, int height_weights, int dilation_x, int dilation_y)
-{
- const uint8_t *in_ptr = in.data() + i_offset;
- const uint8_t *w_ptr = weights.data() + w_offset;
- const int32_t *b_ptr = bias.data() + b_offset;
- uint8_t *out_ptr = out.data() + o_offset;
+ const T *in_ptr = in.data() + i_offset;
+ const T *w_ptr = weights.data() + w_offset;
+ const TB *b_ptr = bias.data() + b_offset;
+ T *out_ptr = out.data() + o_offset;
const int input_offset = -in.quantization_info().offset;
const float input_scale = in.quantization_info().scale;
diff --git a/tests/validation/reference/ConvolutionLayer.cpp b/tests/validation/reference/ConvolutionLayer.cpp
index fe558ba..7dbdba9 100644
--- a/tests/validation/reference/ConvolutionLayer.cpp
+++ b/tests/validation/reference/ConvolutionLayer.cpp
@@ -23,7 +23,6 @@
*/
#include "ConvolutionLayer.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
#include "tests/validation/reference/Convolution3d.h"
#include "tests/validation/reference/Permute.h"
@@ -48,8 +47,10 @@
template <typename T, typename TB>
SimpleTensor<T> convolution_layer_nchw(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, SimpleTensor<T> &dst, const PadStrideInfo &info,
- const Size2D &dilation)
+ const Size2D &dilation, unsigned int num_groups)
{
+ ARM_COMPUTE_ERROR_ON((src.shape()[2] / num_groups) != weights.shape()[2]);
+
// Compute reference
const int width_in = src.shape().x();
const int height_in = src.shape().y();
@@ -79,23 +80,28 @@
{
for(int xi = start_xi; xi < start_xi + end_xi; xi += stride_xi)
{
- for(int ofm = 0; ofm < depth_out; ++ofm)
+ for(int group = 0; group < static_cast<int>(num_groups); ++group)
{
- // Compute input and output offsets
- const int offset_in = r * width_in * height_in * depth_in;
- const int xo = (xi - start_xi) / stride_xi;
- const int yo = (yi - start_yi) / stride_yi;
- const int offset_out = xo + yo * width_out + ofm * width_out * height_out + r * width_out * height_out * depth_out;
+ for(int ofm = 0; ofm < static_cast<int>(depth_out / num_groups); ++ofm)
+ {
+ // Compute input and output offsets
+ const int offset_in = r * width_in * height_in * depth_in + (group * (depth_in / num_groups) * width_in * height_in);
+ const int xo = (xi - start_xi) / stride_xi;
+ const int yo = (yi - start_yi) / stride_yi;
+ const int offset_out = xo + yo * width_out + ((ofm + group * (depth_out / num_groups)) * width_out * height_out) + (r * width_out * height_out * depth_out);
+ const int offset_w = (ofm + group * (depth_out / num_groups)) * width_weights * height_weights * depth_weights;
+ const int offset_b = (ofm + group * (depth_out / num_groups));
- ARM_COMPUTE_ASSERT(xo < width_out);
- ARM_COMPUTE_ASSERT(yo < height_out);
+ ARM_COMPUTE_ASSERT(xo < width_out);
+ ARM_COMPUTE_ASSERT(yo < height_out);
- // Compute 3D convolution
- convolution_3d::detail::convolution3d(src, weights, bias, dst,
- offset_in, ofm * width_weights * height_weights * depth_weights, ofm, offset_out,
- xi, yi,
- width_in, height_in, depth_in,
- width_weights, height_weights, dilation.x(), dilation.y());
+ // Compute 3D convolution
+ convolution_3d::detail::convolution3d(src, weights, bias, dst,
+ offset_in, offset_w, offset_b, offset_out,
+ xi, yi,
+ width_in, height_in, (depth_in / num_groups),
+ width_weights, height_weights, dilation.x(), dilation.y());
+ }
}
}
}
@@ -105,10 +111,10 @@
}
template <typename T, typename TB>
SimpleTensor<T> convolution_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, const TensorShape &output_shape, const PadStrideInfo &info,
- const Size2D &dilation)
+ const Size2D &dilation, unsigned int num_groups)
{
// Create reference
- SimpleTensor<T> dst{ output_shape, src.data_type(), 1, src.fixed_point_position(), src.quantization_info() };
+ SimpleTensor<T> dst{ output_shape, src.data_type(), 1, src.quantization_info() };
if(src.data_layout() == DataLayout::NHWC)
{
@@ -116,24 +122,20 @@
SimpleTensor<T> weights_nchw = reference::permute<T>(weights, PermutationVector(1U, 2U, 0U));
SimpleTensor<T> dst_nchw = reference::permute<T>(dst, PermutationVector(1U, 2U, 0U));
- return reference::permute<T>(convolution_layer_nchw(src_nchw, weights_nchw, bias, dst_nchw, info, dilation), PermutationVector(2U, 0U, 1U));
+ return reference::permute<T>(convolution_layer_nchw(src_nchw, weights_nchw, bias, dst_nchw, info, dilation, num_groups), PermutationVector(2U, 0U, 1U));
}
else
{
- return convolution_layer_nchw(src, weights, bias, dst, info, dilation);
+ return convolution_layer_nchw(src, weights, bias, dst, info, dilation, num_groups);
}
}
template SimpleTensor<float> convolution_layer(const SimpleTensor<float> &src, const SimpleTensor<float> &weights, const SimpleTensor<float> &bias, const TensorShape &output_shape,
- const PadStrideInfo &info, const Size2D &dilation);
+ const PadStrideInfo &info, const Size2D &dilation, unsigned int num_groups);
template SimpleTensor<half> convolution_layer(const SimpleTensor<half> &src, const SimpleTensor<half> &weights, const SimpleTensor<half> &bias, const TensorShape &output_shape,
- const PadStrideInfo &info, const Size2D &dilation);
-template SimpleTensor<qint8_t> convolution_layer(const SimpleTensor<qint8_t> &src, const SimpleTensor<qint8_t> &weights, const SimpleTensor<qint8_t> &bias, const TensorShape &output_shape,
- const PadStrideInfo &info, const Size2D &dilation);
-template SimpleTensor<qint16_t> convolution_layer(const SimpleTensor<qint16_t> &src, const SimpleTensor<qint16_t> &weights, const SimpleTensor<qint16_t> &bias, const TensorShape &output_shape,
- const PadStrideInfo &info, const Size2D &dilation);
+ const PadStrideInfo &info, const Size2D &dilation, unsigned int num_groups);
template SimpleTensor<uint8_t> convolution_layer(const SimpleTensor<uint8_t> &src, const SimpleTensor<uint8_t> &weights, const SimpleTensor<int32_t> &bias, const TensorShape &output_shape,
- const PadStrideInfo &info, const Size2D &dilation);
+ const PadStrideInfo &info, const Size2D &dilation, unsigned int num_groups);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/ConvolutionLayer.h b/tests/validation/reference/ConvolutionLayer.h
index ff3b153..ccce53a 100644
--- a/tests/validation/reference/ConvolutionLayer.h
+++ b/tests/validation/reference/ConvolutionLayer.h
@@ -37,7 +37,7 @@
{
template <typename T, typename TB>
SimpleTensor<T> convolution_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, const TensorShape &output_shape, const PadStrideInfo &info,
- const Size2D &dilation = Size2D(1U, 1U));
+ const Size2D &dilation = Size2D(1U, 1U), unsigned int num_groups = 1);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/DeconvolutionLayer.cpp b/tests/validation/reference/DeconvolutionLayer.cpp
index 617f690..e73023e 100644
--- a/tests/validation/reference/DeconvolutionLayer.cpp
+++ b/tests/validation/reference/DeconvolutionLayer.cpp
@@ -23,7 +23,6 @@
*/
#include "ConvolutionLayer.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
@@ -46,7 +45,7 @@
int out_y = src.shape().y() + (src.shape().y() - 1) * (stride_y - 1) + a.second + 2 * info.pad().second;
scaled_shape.set(0, out_x);
scaled_shape.set(1, out_y);
- SimpleTensor<T> scaled{ scaled_shape, src.data_type(), 1, src.fixed_point_position() };
+ SimpleTensor<T> scaled{ scaled_shape, src.data_type(), 1 };
const int width_in = src.shape().x();
const int height_in = src.shape().y();
@@ -91,6 +90,8 @@
template SimpleTensor<float> deconvolution_layer(const SimpleTensor<float> &src, const SimpleTensor<float> &weights, const SimpleTensor<float> &bias, const TensorShape &output_shape,
const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> &a);
+template SimpleTensor<half> deconvolution_layer(const SimpleTensor<half> &src, const SimpleTensor<half> &weights, const SimpleTensor<half> &bias, const TensorShape &output_shape,
+ const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> &a);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/DepthConcatenateLayer.cpp b/tests/validation/reference/DepthConcatenateLayer.cpp
index 9a72484..90fbd91 100644
--- a/tests/validation/reference/DepthConcatenateLayer.cpp
+++ b/tests/validation/reference/DepthConcatenateLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,7 +23,6 @@
*/
#include "DepthConcatenateLayer.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
@@ -93,10 +92,9 @@
return dst;
}
+template SimpleTensor<uint8_t> depthconcatenate_layer(const std::vector<SimpleTensor<uint8_t>> &srcs);
template SimpleTensor<float> depthconcatenate_layer(const std::vector<SimpleTensor<float>> &srcs);
template SimpleTensor<half> depthconcatenate_layer(const std::vector<SimpleTensor<half>> &srcs);
-template SimpleTensor<qint8_t> depthconcatenate_layer(const std::vector<SimpleTensor<qint8_t>> &srcs);
-template SimpleTensor<qint16_t> depthconcatenate_layer(const std::vector<SimpleTensor<qint16_t>> &srcs);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/DepthConvertLayer.cpp b/tests/validation/reference/DepthConvertLayer.cpp
index dd095b8..fd2e0ae 100644
--- a/tests/validation/reference/DepthConvertLayer.cpp
+++ b/tests/validation/reference/DepthConvertLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,7 +23,6 @@
*/
#include "DepthConvertLayer.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
#include "tests/Types.h"
@@ -36,44 +35,6 @@
{
namespace reference
{
-template < typename T1, typename T2, typename std::enable_if < std::is_integral<T1>::value &&std::is_floating_point<T2>::value, int >::type >
-SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift)
-{
- ARM_COMPUTE_UNUSED(policy);
- ARM_COMPUTE_UNUSED(shift);
-
- using namespace fixed_point_arithmetic;
- SimpleTensor<T2> result(src.shape(), dt_out);
-
- const int fixed_point_position = src.fixed_point_position();
-
- for(int i = 0; i < src.num_elements(); ++i)
- {
- result[i] = static_cast<float>(fixed_point<T1>(src[i], fixed_point_position, true));
- }
-
- return result;
-}
-
-template < typename T1, typename T2, typename std::enable_if < std::is_floating_point<T1>::value &&std::is_integral<T2>::value, int >::type >
-SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift)
-{
- ARM_COMPUTE_UNUSED(policy);
- ARM_COMPUTE_UNUSED(shift);
-
- using namespace fixed_point_arithmetic;
- SimpleTensor<T2> result(src.shape(), dt_out, 1, src.fixed_point_position());
-
- const int fixed_point_position = result.fixed_point_position();
-
- for(int i = 0; i < src.num_elements(); ++i)
- {
- result[i] = fixed_point<T2>(src[i], fixed_point_position).raw();
- }
-
- return result;
-}
-
template < typename T1, typename T2, typename std::enable_if < std::is_integral<T1>::value &&std::is_integral<T2>::value &&!std::is_same<T1, T2>::value, int >::type >
SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift)
{
@@ -99,45 +60,31 @@
return result;
}
-template < typename T1, typename T2, typename std::enable_if < std::is_integral<T1>::value &&std::is_integral<T2>::value &&std::is_same<T1, T2>::value, int >::type >
+template < typename T1, typename T2, typename std::enable_if < is_floating_point<T1>::value &&is_floating_point<T2>::value &&!std::is_same<T1, T2>::value, int >::type >
SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift)
{
- ARM_COMPUTE_UNUSED(policy);
-
- using namespace fixed_point_arithmetic;
-
SimpleTensor<T2> result(src.shape(), dt_out);
- bool is_in_place = (&src == &result);
+ const uint32_t scale = 1 << shift;
- const int fixed_point_position_in = src.fixed_point_position();
- const int fixed_point_position_out = (is_in_place) ? static_cast<int>(shift) : result.fixed_point_position();
-
- if(!is_in_place || (fixed_point_position_in != fixed_point_position_out))
+ // Up-casting
+ if(src.data_type() <= dt_out)
{
for(int i = 0; i < src.num_elements(); ++i)
{
- auto x = fixed_point<T2>(src[i], fixed_point_position_in, true);
- x.resacle(fixed_point_position_out);
- result[i] = x.raw();
+ result[i] = src[i] * static_cast<T2>(scale);
}
}
-
- return result;
-}
-
-template < typename T1, typename T2, typename std::enable_if < std::is_floating_point<T1>::value &&is_floating_point<T2>::value, int >::type >
-SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift)
-{
- ARM_COMPUTE_UNUSED(policy);
- ARM_COMPUTE_UNUSED(shift);
-
- SimpleTensor<T2> result(src.shape(), dt_out);
-
- for(int i = 0; i < src.num_elements(); ++i)
+ // Down-casting
+ else
{
- result[i] = static_cast<T2>(src[i]);
+ for(int i = 0; i < src.num_elements(); ++i)
+ {
+ T1 val = src[i] / static_cast<T1>(scale);
+ result[i] = (policy == ConvertPolicy::SATURATE) ? saturate_cast<T2>(val) : static_cast<T2>(val);
+ }
}
+ return result;
}
template SimpleTensor<uint16_t> depth_convert(const SimpleTensor<uint8_t> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
@@ -147,10 +94,8 @@
template SimpleTensor<uint32_t> depth_convert(const SimpleTensor<uint16_t> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
template SimpleTensor<uint8_t> depth_convert(const SimpleTensor<int16_t> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
template SimpleTensor<int32_t> depth_convert(const SimpleTensor<int16_t> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
-template SimpleTensor<float> depth_convert(const SimpleTensor<int8_t> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
-template SimpleTensor<float> depth_convert(const SimpleTensor<int16_t> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
-template SimpleTensor<int8_t> depth_convert(const SimpleTensor<float> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
-template SimpleTensor<int16_t> depth_convert(const SimpleTensor<float> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
+template SimpleTensor<half> depth_convert(const SimpleTensor<float> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
+template SimpleTensor<float> depth_convert(const SimpleTensor<half> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/DepthConvertLayer.h b/tests/validation/reference/DepthConvertLayer.h
index 1446bfd..5d97c73 100644
--- a/tests/validation/reference/DepthConvertLayer.h
+++ b/tests/validation/reference/DepthConvertLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -35,19 +35,10 @@
{
namespace reference
{
-template < typename T1, typename T2, typename std::enable_if < std::is_integral<T1>::value &&std::is_floating_point<T2>::value, int >::type = 0 >
-SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
-
-template < typename T1, typename T2, typename std::enable_if < std::is_floating_point<T1>::value &&std::is_integral<T2>::value, int >::type = 0 >
-SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
-
template < typename T1, typename T2, typename std::enable_if < std::is_integral<T1>::value &&std::is_integral<T2>::value &&!std::is_same<T1, T2>::value, int >::type = 0 >
SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
-template < typename T1, typename T2, typename std::enable_if < std::is_integral<T1>::value &&std::is_integral<T2>::value &&std::is_same<T1, T2>::value, int >::type = 0 >
-SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
-
-template < typename T1, typename T2, typename std::enable_if < std::is_floating_point<T1>::value &&is_floating_point<T2>::value, int >::type = 0 >
+template < typename T1, typename T2, typename std::enable_if < is_floating_point<T1>::value &&is_floating_point<T2>::value &&!std::is_same<T1, T2>::value, int >::type = 0 >
SimpleTensor<T2> depth_convert(const SimpleTensor<T1> &src, DataType dt_out, ConvertPolicy policy, uint32_t shift);
} // namespace reference
} // namespace validation
diff --git a/tests/validation/reference/DepthwiseConvolutionLayer.cpp b/tests/validation/reference/DepthwiseConvolutionLayer.cpp
index 10c617e..39429e2 100644
--- a/tests/validation/reference/DepthwiseConvolutionLayer.cpp
+++ b/tests/validation/reference/DepthwiseConvolutionLayer.cpp
@@ -26,7 +26,6 @@
#include "ConvolutionLayer.h"
#include "Utils.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
#include "tests/validation/reference/Utils.h"
#include "tests/validation/reference/UtilsQuantizedAsymm.h"
@@ -53,7 +52,7 @@
SimpleTensor<T> depthwise_convolution(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &biases, const TensorShape &dst_shape, const PadStrideInfo &conv_info,
unsigned int depth_multiplier)
{
- SimpleTensor<T> dst{ dst_shape, src.data_type(), 1, src.fixed_point_position() };
+ SimpleTensor<T> dst{ dst_shape, src.data_type(), 1 };
// Compute reference
const int filter_width = weights.shape().x();
@@ -122,7 +121,7 @@
SimpleTensor<uint8_t> depthwise_convolution(const SimpleTensor<uint8_t> &src, const SimpleTensor<uint8_t> &weights, const SimpleTensor<int32_t> &biases, const TensorShape &dst_shape,
const PadStrideInfo &conv_info, unsigned int depth_multiplier)
{
- SimpleTensor<uint8_t> dst{ dst_shape, src.data_type(), 1, src.fixed_point_position(), src.quantization_info() };
+ SimpleTensor<uint8_t> dst{ dst_shape, src.data_type(), 1, src.quantization_info() };
// Create reference
const int input_offset = -src.quantization_info().offset;
diff --git a/tests/validation/reference/FixedPoint.cpp b/tests/validation/reference/FixedPoint.cpp
deleted file mode 100644
index a016093..0000000
--- a/tests/validation/reference/FixedPoint.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "FixedPoint.h"
-
-#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
-#include "tests/validation/Helpers.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace reference
-{
-template <typename T>
-SimpleTensor<T> fixed_point_operation(const SimpleTensor<T> &src, FixedPointOp op)
-{
- SimpleTensor<T> result(src.shape(), src.data_type());
-
- const int p = src.fixed_point_position();
- switch(op)
- {
- case FixedPointOp::EXP:
- for(int i = 0; i < src.num_elements(); ++i)
- {
- result[i] = fixed_point_arithmetic::exp(fixed_point_arithmetic::fixed_point<T>(src[i], p, true)).raw();
- }
- break;
- case FixedPointOp::LOG:
- for(int i = 0; i < src.num_elements(); ++i)
- {
- result[i] = fixed_point_arithmetic::log(fixed_point_arithmetic::fixed_point<T>(src[i], p, true)).raw();
- }
- break;
- case FixedPointOp::INV_SQRT:
- for(int i = 0; i < src.num_elements(); ++i)
- {
- result[i] = fixed_point_arithmetic::inv_sqrt(fixed_point_arithmetic::fixed_point<T>(src[i], p, true)).raw();
- }
- break;
- case FixedPointOp::RECIPROCAL:
- for(int i = 0; i < src.num_elements(); ++i)
- {
- result[i] = fixed_point_arithmetic::div(fixed_point_arithmetic::fixed_point<T>(1, p), fixed_point_arithmetic::fixed_point<T>(src[i], p, true)).raw();
- }
- break;
- default:
- ARM_COMPUTE_ERROR("Fixed point operation not supported");
- break;
- }
-
- return result;
-}
-
-template SimpleTensor<int8_t> fixed_point_operation(const SimpleTensor<int8_t> &src, FixedPointOp op);
-template SimpleTensor<int16_t> fixed_point_operation(const SimpleTensor<int16_t> &src, FixedPointOp op);
-} // namespace reference
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/reference/FixedPointPixelWiseMultiplication.cpp b/tests/validation/reference/FixedPointPixelWiseMultiplication.cpp
deleted file mode 100644
index 636919b..0000000
--- a/tests/validation/reference/FixedPointPixelWiseMultiplication.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * dst OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "FixedPointPixelWiseMultiplication.h"
-
-#include "tests/validation/FixedPoint.h"
-
-namespace arm_compute
-{
-namespace test
-{
-namespace validation
-{
-namespace reference
-{
-template <typename T>
-SimpleTensor<T> fixed_point_pixel_wise_multiplication(const SimpleTensor<T> &src1, const SimpleTensor<T> &src2, float scale, ConvertPolicy convert_policy)
-{
- using namespace fixed_point_arithmetic;
-
- SimpleTensor<T> dst(src2.shape(), src2.data_type(), 1, src2.fixed_point_position());
-
- const int fixed_point_position = src1.fixed_point_position();
-
- ARM_COMPUTE_ERROR_ON_MSG(src1.data_type() != src2.data_type() || src1.data_type() != dst.data_type(),
- "Tensors must all have the same DataType");
- ARM_COMPUTE_ERROR_ON_MSG(fixed_point_position != src2.fixed_point_position() || fixed_point_position != dst.fixed_point_position(),
- "Fixed-point position must be the same for both inputs and outputs");
-
- // Validate fixed_point_position
- ARM_COMPUTE_ERROR_ON((src1.data_type() == DataType::QS8) && (fixed_point_position == 0 || fixed_point_position > 7));
- ARM_COMPUTE_ERROR_ON((src1.data_type() == DataType::QS16) && (fixed_point_position == 0 || fixed_point_position > 15));
-
- const fixed_point<T> fp_scale(scale, fixed_point_position);
- const bool is_sat = convert_policy == ConvertPolicy::SATURATE;
-
- for(int i = 0; i < src1.num_elements(); ++i)
- {
- const fixed_point<T> val1(src1[i], fixed_point_position, true);
- fixed_point<T> res(src2[i], fixed_point_position, true);
- if(is_sat)
- {
- res = mul(mul(res, val1), fp_scale);
- }
- else
- {
- res = mul<OverflowPolicy::WRAP>(mul<OverflowPolicy::WRAP>(res, val1), fp_scale);
- }
- dst[i] = res.raw();
- }
-
- return dst;
-}
-
-// *INDENT-OFF*
-// clang-format off
-template SimpleTensor<qint8_t> fixed_point_pixel_wise_multiplication(const SimpleTensor<qint8_t> &src1, const SimpleTensor<qint8_t> &src2, float scale, ConvertPolicy convert_policy);
-template SimpleTensor<qint16_t> fixed_point_pixel_wise_multiplication(const SimpleTensor<qint16_t> &src1, const SimpleTensor<qint16_t> &src2, float scale, ConvertPolicy convert_policy);
-// *INDENT-ON*
-// clang-format on
-
-} // namespace reference
-} // namespace validation
-} // namespace test
-} // namespace arm_compute
diff --git a/tests/validation/reference/FlattenLayer.cpp b/tests/validation/reference/FlattenLayer.cpp
index 44f4d93..381ce37 100644
--- a/tests/validation/reference/FlattenLayer.cpp
+++ b/tests/validation/reference/FlattenLayer.cpp
@@ -23,8 +23,6 @@
*/
#include "FlattenLayer.h"
-#include "tests/validation/FixedPoint.h"
-
namespace arm_compute
{
namespace test
@@ -36,7 +34,7 @@
template <typename T>
SimpleTensor<T> flatten_layer(const SimpleTensor<T> &src, const TensorShape &shape_flatten)
{
- SimpleTensor<T> dst(shape_flatten, src.data_type(), 1, src.fixed_point_position());
+ SimpleTensor<T> dst(shape_flatten, src.data_type(), 1);
// Note: Since the reference implementation does not use padding bytes, we can copy directly the content of the source tensor
std::copy(src.data(), src.data() + src.num_elements(), dst.data());
@@ -46,8 +44,6 @@
template SimpleTensor<float> flatten_layer(const SimpleTensor<float> &src, const TensorShape &shape_flatten);
template SimpleTensor<half> flatten_layer(const SimpleTensor<half> &src, const TensorShape &shape_flatten);
-template SimpleTensor<qint8_t> flatten_layer(const SimpleTensor<qint8_t> &src, const TensorShape &shape_flatten);
-template SimpleTensor<qint16_t> flatten_layer(const SimpleTensor<qint16_t> &src, const TensorShape &shape_flatten);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/FullyConnectedLayer.cpp b/tests/validation/reference/FullyConnectedLayer.cpp
index 5384715..d65d0ca 100644
--- a/tests/validation/reference/FullyConnectedLayer.cpp
+++ b/tests/validation/reference/FullyConnectedLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "FullyConnectedLayer.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/reference/UtilsQuantizedAsymm.h"
#include "arm_compute/core/utils/quantization/AsymmHelpers.h"
@@ -44,10 +43,8 @@
// Vector matrix multiply for floating point
template < typename T, typename TB, typename std::enable_if < is_floating_point<T>::value &&is_floating_point<TB>::value, int >::type = 0 >
void vector_matrix_multiply(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, SimpleTensor<T> &dst, int offset_src, int offset_dst, int cols_weights,
- int rows_weights, uint8_t fixed_point_position)
+ int rows_weights)
{
- ARM_COMPUTE_UNUSED(fixed_point_position);
-
const T *src_ptr = src.data() + offset_src;
const T *weights_ptr = weights.data();
const TB *bias_ptr = bias.data();
@@ -60,57 +57,16 @@
}
}
-// Vector matrix multiply for fixed point type
-template < typename T, typename TB, typename std::enable_if < std::is_integral<T>::value &&std::is_integral<TB>::value, int >::type = 0 >
-void vector_matrix_multiply(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, SimpleTensor<T> &dst, int offset_src, int offset_dst, int cols_weights,
- int rows_weights, uint8_t fixed_point_position)
+// Vector matrix multiply for quantized type
+template < typename T, typename TB, typename std::enable_if < std::is_same<T, uint8_t>::value &&std::is_same<TB, int32_t>::value, int >::type = 0 >
+void vector_matrix_multiply(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, SimpleTensor<T> &dst, int offset_src, int offset_dst,
+ int cols_weights, int rows_weights)
{
const T *src_ptr = src.data() + offset_src;
const T *weights_ptr = weights.data();
const TB *bias_ptr = bias.data();
T *dst_ptr = dst.data() + offset_dst;
- using namespace fixed_point_arithmetic;
- using promoted_type = fixed_point_arithmetic::traits::promote_t<T>;
-
- for(int y = 0; y < rows_weights; ++y)
- {
- // Reset accumulator
- fixed_point<promoted_type> acc(0, fixed_point_position);
-
- for(int x = 0; x < cols_weights; ++x)
- {
- const fixed_point<promoted_type> i_value(src_ptr[x], fixed_point_position, true);
- const fixed_point<promoted_type> w_value(weights_ptr[x], fixed_point_position, true);
- acc = acc + i_value * w_value;
- }
-
- // Get the bias
- const fixed_point<T> b(bias_ptr[y], fixed_point_position, true);
-
- // Convert back and accumulate the bias
- fixed_point<T> res(acc);
- res = res + b;
-
- // Store the result
- dst_ptr[y] = res.raw();
-
- weights_ptr += cols_weights;
- }
-}
-
-// Vector matrix multiply for quantized type
-template <>
-void vector_matrix_multiply(const SimpleTensor<uint8_t> &src, const SimpleTensor<uint8_t> &weights, const SimpleTensor<int32_t> &bias, SimpleTensor<uint8_t> &dst, int offset_src, int offset_dst,
- int cols_weights, int rows_weights, uint8_t fixed_point_position)
-{
- ARM_COMPUTE_UNUSED(fixed_point_position);
-
- const uint8_t *src_ptr = src.data() + offset_src;
- const uint8_t *weights_ptr = weights.data();
- const int32_t *bias_ptr = bias.data();
- uint8_t *dst_ptr = dst.data() + offset_dst;
-
const int input_offset = -src.quantization_info().offset;
const float input_scale = src.quantization_info().scale;
const int weights_offset = -weights.quantization_info().offset;
@@ -141,7 +97,7 @@
acc = utility::clamp<int32_t>(acc, 0, 255);
// Store the result
- dst_ptr[y] = static_cast<uint8_t>(acc);
+ dst_ptr[y] = static_cast<T>(acc);
weights_ptr += cols_weights;
}
@@ -152,7 +108,7 @@
SimpleTensor<T> fully_connected_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, const TensorShape &dst_shape)
{
// Create reference
- SimpleTensor<T> dst{ TensorShape{ dst_shape }, src.data_type(), 1, src.fixed_point_position(), src.quantization_info() };
+ SimpleTensor<T> dst{ TensorShape{ dst_shape }, src.data_type(), 1, src.quantization_info() };
// Sanity checks
const int num_batch_dimensions = std::max(0, static_cast<int>(dst_shape.num_dimensions()) - 1);
@@ -183,8 +139,7 @@
offset_in,
offset_out,
cols_weights,
- rows_weights,
- src.fixed_point_position());
+ rows_weights);
}
return dst;
@@ -192,8 +147,6 @@
template SimpleTensor<float> fully_connected_layer(const SimpleTensor<float> &src, const SimpleTensor<float> &weights, const SimpleTensor<float> &bias, const TensorShape &dst_shape);
template SimpleTensor<half> fully_connected_layer(const SimpleTensor<half> &src, const SimpleTensor<half> &weights, const SimpleTensor<half> &bias, const TensorShape &dst_shape);
-template SimpleTensor<qint8_t> fully_connected_layer(const SimpleTensor<qint8_t> &src, const SimpleTensor<qint8_t> &weights, const SimpleTensor<qint8_t> &bias, const TensorShape &dst_shape);
-template SimpleTensor<qint16_t> fully_connected_layer(const SimpleTensor<qint16_t> &src, const SimpleTensor<qint16_t> &weights, const SimpleTensor<qint16_t> &bias, const TensorShape &dst_shape);
template SimpleTensor<uint8_t> fully_connected_layer(const SimpleTensor<uint8_t> &src, const SimpleTensor<uint8_t> &weights, const SimpleTensor<int32_t> &bias, const TensorShape &dst_shape);
} // namespace reference
} // namespace validation
diff --git a/tests/validation/reference/GEMM.cpp b/tests/validation/reference/GEMM.cpp
index f9dcfcb..2feab89 100644
--- a/tests/validation/reference/GEMM.cpp
+++ b/tests/validation/reference/GEMM.cpp
@@ -24,7 +24,6 @@
#include "GEMM.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
namespace arm_compute
{
@@ -38,7 +37,7 @@
SimpleTensor<T> gemm(const SimpleTensor<T> &a, const SimpleTensor<T> &b, const SimpleTensor<T> &c, float alpha, float beta)
{
// Create reference
- SimpleTensor<T> dst{ c.shape(), c.data_type(), 1, c.fixed_point_position() };
+ SimpleTensor<T> dst{ c.shape(), c.data_type(), 1 };
// Compute reference
const int M = a.shape().y();
@@ -85,79 +84,8 @@
return dst;
}
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type>
-SimpleTensor<T> gemm(const SimpleTensor<T> &a, const SimpleTensor<T> &b, const SimpleTensor<T> &c, float alpha, float beta)
-{
- using namespace fixed_point_arithmetic;
-
- // Create reference
- SimpleTensor<T> dst{ c.shape(), c.data_type(), 1, c.fixed_point_position() };
-
- // Compute reference
- using promoted_type = fixed_point_arithmetic::traits::promote_t<T>;
-
- const int M = dst.shape().y();
- const int N = dst.shape().x();
- const int K = a.shape().x();
- const int D = a.shape().z(); // Number of matrices in a batch
- const int W = a.shape()[3]; // Number of batched-gemm (Winograd case)
-
- const int a_stride_z = K * M;
- const int a_stride_w = K * M * D;
-
- const int b_stride_z = b.shape().num_dimensions() > 2 ? N * K : 0; // Do not slide the matrix B along the 3th dimension in case matrix B has less than 3 dimensions
- const int b_stride_w = b.shape().num_dimensions() > 3 ? K * N * D : 0; // Do not slide the matrix B along the 4th dimension in case matrix B has less than 4 dimensions
-
- const int c_stride_z = N * M;
- const int c_stride_w = N * M * D;
-
- const int fixed_point_position = a.fixed_point_position();
- const fixed_point<T> alpha_q(alpha, fixed_point_position);
- const fixed_point<T> beta_q(beta, fixed_point_position);
-
- for(int w = 0; w < W; ++w)
- {
- for(int depth = 0; depth < D; ++depth)
- {
- const int base_addr_a = depth * a_stride_z + w * a_stride_w;
- const int base_addr_b = depth * b_stride_z + w * b_stride_w;
- const int base_addr_c = depth * c_stride_z + w * c_stride_w;
-
- for(int row = 0; row < M; ++row)
- {
- for(int col = 0; col < N; ++col)
- {
- fixed_point<promoted_type> acc_q(0, fixed_point_position);
-
- for(int k = 0; k < K; ++k)
- {
- const fixed_point<promoted_type> a0_q(a[base_addr_a + row * K + k], fixed_point_position, true);
- const fixed_point<promoted_type> b0_q(b[base_addr_b + k * N + col], fixed_point_position, true);
-
- acc_q = acc_q + (a0_q * b0_q);
- }
-
- // Finalize the result: alpha * A * B + beta * C
- const fixed_point<T> c0_q(c[base_addr_c + col + row * N], fixed_point_position, true);
-
- fixed_point<T> res_q(acc_q);
- res_q = alpha_q * res_q;
- res_q = res_q + (beta_q * c0_q);
-
- // Store the result
- dst[base_addr_c + col + row * N] = res_q.raw();
- }
- }
- }
- }
-
- return dst;
-}
-
template SimpleTensor<float> gemm(const SimpleTensor<float> &a, const SimpleTensor<float> &b, const SimpleTensor<float> &c, float alpha, float beta);
template SimpleTensor<half> gemm(const SimpleTensor<half> &a, const SimpleTensor<half> &b, const SimpleTensor<half> &c, float alpha, float beta);
-template SimpleTensor<qint8_t> gemm(const SimpleTensor<qint8_t> &a, const SimpleTensor<qint8_t> &b, const SimpleTensor<qint8_t> &c, float alpha, float beta);
-template SimpleTensor<qint16_t> gemm(const SimpleTensor<qint16_t> &a, const SimpleTensor<qint16_t> &b, const SimpleTensor<qint16_t> &c, float alpha, float beta);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/GEMM.h b/tests/validation/reference/GEMM.h
index cda792b..39007c6 100644
--- a/tests/validation/reference/GEMM.h
+++ b/tests/validation/reference/GEMM.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -38,8 +38,6 @@
template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type = 0>
SimpleTensor<T> gemm(const SimpleTensor<T> &a, const SimpleTensor<T> &b, const SimpleTensor<T> &c, float alpha, float beta);
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
-SimpleTensor<T> gemm(const SimpleTensor<T> &a, const SimpleTensor<T> &b, const SimpleTensor<T> &c, float alpha, float beta);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/GEMMInterleave4x4.h b/tests/validation/reference/GEMMInterleave4x4.h
index e6b09af..e3d72d9 100644
--- a/tests/validation/reference/GEMMInterleave4x4.h
+++ b/tests/validation/reference/GEMMInterleave4x4.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "GEMM.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
namespace arm_compute
{
diff --git a/tests/validation/reference/GEMMInterleaveBlocked.h b/tests/validation/reference/GEMMInterleaveBlocked.h
index ff5a0d6..d649a51 100644
--- a/tests/validation/reference/GEMMInterleaveBlocked.h
+++ b/tests/validation/reference/GEMMInterleaveBlocked.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "GEMM.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
namespace arm_compute
{
diff --git a/tests/validation/reference/GEMMTranspose1xW.h b/tests/validation/reference/GEMMTranspose1xW.h
index d6a2e89..6ec70b1 100644
--- a/tests/validation/reference/GEMMTranspose1xW.h
+++ b/tests/validation/reference/GEMMTranspose1xW.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "GEMM.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
namespace arm_compute
{
diff --git a/tests/validation/reference/Im2Col.cpp b/tests/validation/reference/Im2Col.cpp
index 5685b60..0c41d88 100644
--- a/tests/validation/reference/Im2Col.cpp
+++ b/tests/validation/reference/Im2Col.cpp
@@ -23,8 +23,6 @@
*/
#include "Im2Col.h"
-#include "Permute.h"
-
#include "arm_compute/core/Types.h"
#include "tests/validation/Helpers.h"
#include "tests/validation/reference/Utils.h"
@@ -38,36 +36,46 @@
namespace reference
{
template <typename T>
-void im2col_nchw(const SimpleTensor<T> &src, SimpleTensor<T> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias)
+void im2col_nchw(const SimpleTensor<T> &src, SimpleTensor<T> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, unsigned int num_groups)
{
ARM_COMPUTE_ERROR_ON(src.data_layout() != DataLayout::NCHW);
- // Create reference
- const int pad_x = conv_info.pad().first;
- const int pad_y = conv_info.pad().second;
const int stride_x = conv_info.stride().first;
const int stride_y = conv_info.stride().second;
const int kernel_width = kernel_dims.width;
const int kernel_height = kernel_dims.height;
+ const int pad_x = conv_info.pad().first;
+ const int pad_y = conv_info.pad().second;
const int src_width = src.shape().x();
const int src_height = src.shape().y();
- const int src_depth = src.shape().z();
+ const int src_channels = src.shape().z();
const int batches = src.shape().total_size_upper(3);
+ const int dst_height = dst.shape().y();
const int pad_val = is_data_type_quantized_asymmetric(src.data_type()) ? src.quantization_info().offset : 0;
+ int dst_idx = 0;
- int dst_idx = 0;
+ // Compute width and height of the convolved tensors
+ std::pair<unsigned int, unsigned int> convolved_dims = scaled_dimensions(src_width, src_height, kernel_dims.width, kernel_dims.height, conv_info);
+
for(int b = 0; b < batches; ++b)
{
- for(int y = -pad_y; y <= (src_height + pad_y - kernel_height); y += stride_y)
+ for(int g = 0; g < static_cast<int>(num_groups); ++g)
{
- for(int x = -pad_x; x <= (src_width + pad_x - kernel_width); x += stride_x)
+ const int first_group_ch = g * (src_channels / num_groups);
+ const int last_group_ch = (g + 1) * (src_channels / num_groups);
+
+ for(int yo = 0; yo < dst_height; ++yo)
{
- for(int z = 0; z < src_depth; ++z)
+ // Compute input spatial coordinates
+ const int xi = (yo % convolved_dims.first) * stride_x;
+ const int yi = (yo / convolved_dims.first) * stride_y;
+
+ for(int ci = first_group_ch; ci < last_group_ch; ++ci)
{
- for(int patch_y = y; patch_y < (y + kernel_height); ++patch_y)
+ for(int yk = 0; yk < kernel_height; ++yk)
{
- for(int patch_x = x; patch_x < (x + kernel_width); ++patch_x)
+ for(int xk = 0; xk < kernel_width; ++xk)
{
- dst[dst_idx++] = tensor_elem_at(src, Coordinates(patch_x, patch_y, z, b), BorderMode::CONSTANT, static_cast<T>(pad_val));
+ dst[dst_idx++] = tensor_elem_at(src, Coordinates(xi + xk - pad_x, yi + yk - pad_y, ci, b), BorderMode::CONSTANT, static_cast<T>(pad_val));
}
}
}
@@ -97,11 +105,15 @@
const int batches = src.shape().total_size_upper(3);
const int pad_val = is_data_type_quantized_asymmetric(src.data_type()) ? src.quantization_info().offset : 0;
int dst_idx = 0;
+
+ const int lasty = src_height + (kernel_height > 1 ? pad_y : 0) - kernel_height;
+ const int lastx = src_width + (kernel_width > 1 ? pad_x : 0) - kernel_width;
+
for(int b = 0; b < batches; ++b)
{
- for(int y = -pad_y; y <= (src_height + pad_y - kernel_height); y += stride_y)
+ for(int y = -pad_y; y <= lasty; y += stride_y)
{
- for(int x = -pad_x; x <= (src_width + pad_x - kernel_width); x += stride_x)
+ for(int x = -pad_x; x <= lastx; x += stride_x)
{
for(int z = 0; z < src_depth; ++z)
{
@@ -124,18 +136,74 @@
}
template <typename T>
-void im2col(const SimpleTensor<T> &src, SimpleTensor<T> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias)
+void im2col_nhwc_channel_first(const SimpleTensor<T> &src, SimpleTensor<T> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias)
+{
+ ARM_COMPUTE_ERROR_ON(src.data_layout() != DataLayout::NHWC);
+ const int stride_x = conv_info.stride().first;
+ const int stride_y = conv_info.stride().second;
+ const int kernel_width = kernel_dims.width;
+ const int kernel_height = kernel_dims.height;
+ const int pad_x = conv_info.pad().first;
+ const int pad_y = conv_info.pad().second;
+ const int src_width = src.shape().y();
+ const int src_height = src.shape().z();
+ const int src_channels = src.shape().x();
+ const int batches = src.shape().total_size_upper(3);
+ const int dst_width = has_bias ? dst.shape().x() - 1 : dst.shape().x();
+ const int dst_height = dst.shape().y();
+ const int pad_val = is_data_type_quantized_asymmetric(src.data_type()) ? src.quantization_info().offset : 0;
+
+ // Compute width and height of the convolved tensors
+ std::pair<unsigned int, unsigned int> convolved_dims = scaled_dimensions(src_width, src_height, kernel_dims.width, kernel_dims.height, conv_info);
+
+ for(int b = 0; b < batches; ++b)
+ {
+ for(int yo = 0; yo < dst_height; ++yo)
+ {
+ // Compute input spatial coordinates
+ const int xi = (yo % convolved_dims.first) * stride_x;
+ const int yi = (yo / convolved_dims.first) * stride_y;
+
+ for(int ci = 0; ci < src_channels; ++ci)
+ {
+ for(int yk = 0; yk < kernel_height; ++yk)
+ {
+ for(int xk = 0; xk < kernel_width; ++xk)
+ {
+ dst[ci + (xk + yk * kernel_width) * src_channels + yo * dst.shape().x() + b * dst.shape().x() * dst.shape().y()] = tensor_elem_at(src, Coordinates(ci, xi + xk - pad_x, yi + yk - pad_y, b),
+ BorderMode::CONSTANT, static_cast<T>(pad_val));
+ }
+ }
+ }
+
+ if(has_bias)
+ {
+ dst[dst_width + yo * dst.shape().x() + b * dst.shape().x() * dst.shape().y()] = static_cast<T>(1);
+ }
+ }
+ }
+}
+
+template <typename T>
+void im2col(const SimpleTensor<T> &src, SimpleTensor<T> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const unsigned int num_groups, bool channels_first_output_nhwc)
{
switch(src.data_layout())
{
case DataLayout::NCHW:
{
- im2col_nchw(src, dst, kernel_dims, conv_info, has_bias);
+ im2col_nchw(src, dst, kernel_dims, conv_info, has_bias, num_groups);
break;
}
case DataLayout::NHWC:
{
- im2col_nhwc(src, dst, kernel_dims, conv_info, has_bias);
+ if(channels_first_output_nhwc)
+ {
+ im2col_nhwc_channel_first(src, dst, kernel_dims, conv_info, has_bias);
+ }
+ else
+ {
+ im2col_nhwc(src, dst, kernel_dims, conv_info, has_bias);
+ }
break;
}
default:
@@ -146,9 +214,12 @@
}
}
-template void im2col(const SimpleTensor<uint8_t> &src, SimpleTensor<uint8_t> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias);
-template void im2col(const SimpleTensor<half> &src, SimpleTensor<half> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias);
-template void im2col(const SimpleTensor<float> &src, SimpleTensor<float> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias);
+template void im2col(const SimpleTensor<uint8_t> &src, SimpleTensor<uint8_t> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, unsigned int num_groups,
+ bool channels_first_output_nhwc);
+template void im2col(const SimpleTensor<half> &src, SimpleTensor<half> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, unsigned int num_groups,
+ bool channels_first_output_nhwc);
+template void im2col(const SimpleTensor<float> &src, SimpleTensor<float> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, unsigned int num_groups,
+ bool channels_first_output_nhwc);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/Im2Col.h b/tests/validation/reference/Im2Col.h
index 5277171..84ee237 100644
--- a/tests/validation/reference/Im2Col.h
+++ b/tests/validation/reference/Im2Col.h
@@ -35,7 +35,8 @@
namespace reference
{
template <typename T>
-void im2col(const SimpleTensor<T> &src, SimpleTensor<T> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias);
+void im2col(const SimpleTensor<T> &src, SimpleTensor<T> &dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const unsigned int num_groups,
+ bool channels_first_output_nhwc = false);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/LaplacianPyramid.cpp b/tests/validation/reference/LaplacianPyramid.cpp
new file mode 100644
index 0000000..5668474
--- /dev/null
+++ b/tests/validation/reference/LaplacianPyramid.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "LaplacianPyramid.h"
+
+#include "tests/validation/reference/ArithmeticSubtraction.h"
+#include "tests/validation/reference/DepthConvertLayer.h"
+#include "tests/validation/reference/Gaussian5x5.h"
+#include "tests/validation/reference/GaussianPyramidHalf.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T, typename U>
+std::vector<SimpleTensor<U>> laplacian_pyramid(const SimpleTensor<T> &src, SimpleTensor<U> &dst, size_t num_levels, BorderMode border_mode, uint8_t constant_border_value)
+{
+ std::vector<SimpleTensor<T>> pyramid_conv;
+ std::vector<SimpleTensor<U>> pyramid_dst;
+
+ // First, a Gaussian pyramid with SCALE_PYRAMID_HALF is created
+ std::vector<SimpleTensor<T>> gaussian_level_pyramid = reference::gaussian_pyramid_half(src, border_mode, constant_border_value, num_levels);
+
+ // For each level i, the corresponding image Ii is blurred with Gaussian 5x5
+ // filter, and the difference between the two images is the corresponding
+ // level Li of the Laplacian pyramid
+ for(size_t i = 0; i < num_levels; ++i)
+ {
+ const SimpleTensor<T> level_filtered = reference::gaussian5x5(gaussian_level_pyramid[i], border_mode, constant_border_value);
+ pyramid_conv.push_back(level_filtered);
+
+ const SimpleTensor<U> level_sub = reference::arithmetic_subtraction<T, T, U>(gaussian_level_pyramid[i], level_filtered, dst.data_type(), ConvertPolicy::WRAP);
+ pyramid_dst.push_back(level_sub);
+ }
+
+ // Return the lowest resolution image and the pyramid
+ dst = depth_convert<T, U>(pyramid_conv[num_levels - 1], DataType::S16, ConvertPolicy::WRAP, 0);
+
+ return pyramid_dst;
+}
+
+template std::vector<SimpleTensor<int16_t>> laplacian_pyramid(const SimpleTensor<uint8_t> &src, SimpleTensor<int16_t> &dst, size_t num_levels, BorderMode border_mode, uint8_t constant_border_value);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/reference/FixedPoint.h b/tests/validation/reference/LaplacianPyramid.h
similarity index 77%
copy from tests/validation/reference/FixedPoint.h
copy to tests/validation/reference/LaplacianPyramid.h
index f0117f9..aa76f56 100644
--- a/tests/validation/reference/FixedPoint.h
+++ b/tests/validation/reference/LaplacianPyramid.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,11 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
-#define __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
+#ifndef __ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_H__
+#define __ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_H__
#include "tests/SimpleTensor.h"
-#include "tests/Types.h"
namespace arm_compute
{
@@ -35,10 +34,10 @@
{
namespace reference
{
-template <typename T>
-SimpleTensor<T> fixed_point_operation(const SimpleTensor<T> &src, FixedPointOp op);
+template <typename T, typename U>
+std::vector<SimpleTensor<U>> laplacian_pyramid(const SimpleTensor<T> &src, SimpleTensor<U> &dst, size_t num_levels, BorderMode border_mode, uint8_t constant_border_value);
} // namespace reference
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__ */
+#endif /* __ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_H__ */
diff --git a/tests/validation/reference/LaplacianReconstruct.cpp b/tests/validation/reference/LaplacianReconstruct.cpp
new file mode 100644
index 0000000..2346828
--- /dev/null
+++ b/tests/validation/reference/LaplacianReconstruct.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "LaplacianReconstruct.h"
+
+#include "arm_compute/core/Types.h"
+#include "tests/validation/reference/ArithmeticAddition.h"
+#include "tests/validation/reference/DepthConvertLayer.h"
+#include "tests/validation/reference/Scale.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T, typename U>
+SimpleTensor<U> laplacian_reconstruct(const std::vector<SimpleTensor<T>> &pyramid, const SimpleTensor<T> &low_res, BorderMode border_mode, T constant_border_value)
+{
+ std::vector<SimpleTensor<T>> tmp_pyramid(pyramid);
+
+ const size_t last_level = pyramid.size() - 1;
+ const DataType data_type = low_res.data_type();
+
+ // input + L(n-1)
+ tmp_pyramid[last_level] = reference::arithmetic_addition(low_res, pyramid[last_level], data_type, ConvertPolicy::SATURATE);
+
+ // Scale levels n-1 to 1, and add levels n-2 to 0
+ for(size_t i = last_level; i-- > 0;)
+ {
+ const float scale_x = static_cast<float>(tmp_pyramid[i].shape().x()) / tmp_pyramid[i + 1].shape().x();
+ const float scale_y = static_cast<float>(tmp_pyramid[i].shape().y()) / tmp_pyramid[i + 1].shape().y();
+
+ tmp_pyramid[i] = reference::scale(tmp_pyramid[i + 1], scale_x, scale_y, InterpolationPolicy::NEAREST_NEIGHBOR,
+ border_mode, constant_border_value, SamplingPolicy::CENTER, false);
+
+ tmp_pyramid[i] = reference::arithmetic_addition(tmp_pyramid[i], pyramid[i], data_type, ConvertPolicy::SATURATE);
+ }
+
+ return reference::depth_convert<T, U>(tmp_pyramid[0], DataType::U8, ConvertPolicy::SATURATE, 0);
+}
+
+template SimpleTensor<uint8_t> laplacian_reconstruct(const std::vector<SimpleTensor<int16_t>> &pyramid, const SimpleTensor<int16_t> &low_res, BorderMode border_mode, int16_t constant_border_value);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/reference/FixedPoint.h b/tests/validation/reference/LaplacianReconstruct.h
similarity index 76%
copy from tests/validation/reference/FixedPoint.h
copy to tests/validation/reference/LaplacianReconstruct.h
index f0117f9..76851c6 100644
--- a/tests/validation/reference/FixedPoint.h
+++ b/tests/validation/reference/LaplacianReconstruct.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,11 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
-#define __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
+#ifndef __ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_H__
+#define __ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_H__
#include "tests/SimpleTensor.h"
-#include "tests/Types.h"
namespace arm_compute
{
@@ -35,10 +34,10 @@
{
namespace reference
{
-template <typename T>
-SimpleTensor<T> fixed_point_operation(const SimpleTensor<T> &src, FixedPointOp op);
+template <typename T, typename U>
+SimpleTensor<U> laplacian_reconstruct(const std::vector<SimpleTensor<T>> &pyramid, const SimpleTensor<T> &low_res, BorderMode border_mode, T constant_border_value);
} // namespace reference
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__ */
+#endif /* __ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_H__ */
diff --git a/tests/validation/reference/LocallyConnected.cpp b/tests/validation/reference/LocallyConnected.cpp
index 08e3f02..ecc582b 100644
--- a/tests/validation/reference/LocallyConnected.cpp
+++ b/tests/validation/reference/LocallyConnected.cpp
@@ -41,7 +41,7 @@
SimpleTensor<T> locally_connected(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, const TensorShape &output_shape, const PadStrideInfo &info)
{
// Create reference
- SimpleTensor<T> dst{ output_shape, src.data_type(), 1, src.fixed_point_position(), src.quantization_info() };
+ SimpleTensor<T> dst{ output_shape, src.data_type(), 1, src.quantization_info() };
// Compute reference
const int width_in = src.shape().x();
diff --git a/tests/validation/reference/MeanStdDev.cpp b/tests/validation/reference/MeanStdDev.cpp
index 4a39b13..f48fcb1 100644
--- a/tests/validation/reference/MeanStdDev.cpp
+++ b/tests/validation/reference/MeanStdDev.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -51,6 +51,8 @@
}
template std::pair<float, float> mean_and_standard_deviation(const SimpleTensor<uint8_t> &in);
+template std::pair<float, float> mean_and_standard_deviation(const SimpleTensor<half> &in);
+template std::pair<float, float> mean_and_standard_deviation(const SimpleTensor<float> &in);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/NormalizationLayer.cpp b/tests/validation/reference/NormalizationLayer.cpp
index 226af96..2ae68c6 100644
--- a/tests/validation/reference/NormalizationLayer.cpp
+++ b/tests/validation/reference/NormalizationLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "NormalizationLayer.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
namespace arm_compute
{
@@ -38,7 +37,7 @@
SimpleTensor<T> normalization_layer(const SimpleTensor<T> &src, NormalizationLayerInfo info)
{
// Create reference
- SimpleTensor<T> dst{ src.shape(), src.data_type(), 1, src.fixed_point_position() };
+ SimpleTensor<T> dst{ src.shape(), src.data_type(), 1 };
// Compute reference
const uint32_t norm_size = info.norm_size();
@@ -146,129 +145,8 @@
return dst;
}
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type>
-SimpleTensor<T> normalization_layer(const SimpleTensor<T> &src, NormalizationLayerInfo info)
-{
- using namespace fixed_point_arithmetic;
-
- // Create reference
- SimpleTensor<T> dst{ src.shape(), src.data_type(), 1, src.fixed_point_position() };
-
- // Compute reference
- const int fixed_point_position = src.fixed_point_position();
-
- const uint32_t norm_size = info.norm_size();
- NormType type = info.type();
- fixed_point<T> beta(info.beta(), fixed_point_position);
- fixed_point<T> kappa(info.kappa(), fixed_point_position);
-
- const int cols = src.shape()[0];
- const int rows = src.shape()[1];
- const int depth = src.shape()[2];
- int upper_dims = src.shape().total_size() / (cols * rows);
-
- fixed_point<T> coeff(info.scale_coeff(), fixed_point_position);
- int radius_cols = norm_size / 2;
-
- // IN_MAP_1D and CROSS_MAP normalize over a single axis only
- int radius_rows = (NormType::IN_MAP_2D == type) ? norm_size / 2 : 0;
-
- if(type == NormType::CROSS_MAP)
- {
- // Remove also depth from upper dimensions since it is the dimension we
- // want to use for normalization
- upper_dims /= depth;
-
- for(int r = 0; r < upper_dims; ++r)
- {
- for(int i = 0; i < rows; ++i)
- {
- for(int k = 0; k < cols; ++k)
- {
- for(int l = 0; l < depth; ++l)
- {
- fixed_point<T> accumulated_scale(0.f, fixed_point_position);
-
- for(int j = -radius_cols; j <= radius_cols; ++j)
- {
- const int z = l + j;
-
- if(z >= 0 && z < depth)
- {
- const T value = src[k + i * cols + z * rows * cols + r * cols * rows * depth];
- const fixed_point<T> fp_value(value, fixed_point_position, true);
- accumulated_scale = add(accumulated_scale, mul(fp_value, fp_value));
- }
- }
-
- accumulated_scale = add(kappa, mul(accumulated_scale, coeff));
- dst[k + i * cols + l * rows * cols + r * cols * rows * depth] = accumulated_scale.raw();
- }
- }
- }
- }
- }
- else
- {
- for(int r = 0; r < upper_dims; ++r)
- {
- for(int i = 0; i < rows; ++i)
- {
- for(int k = 0; k < cols; ++k)
- {
- fixed_point<T> accumulated_scale(0.f, fixed_point_position);
-
- for(int j = -radius_rows; j <= radius_rows; ++j)
- {
- const int y = i + j;
-
- for(int l = -radius_cols; l <= radius_cols; ++l)
- {
- const int x = k + l;
-
- if((x >= 0 && y >= 0) && (x < cols && y < rows))
- {
- const T value = src[x + y * cols + r * cols * rows];
- const fixed_point<T> fp_value(value, fixed_point_position, true);
- accumulated_scale = add(accumulated_scale, mul(fp_value, fp_value));
- }
- }
- }
-
- accumulated_scale = add(kappa, mul(accumulated_scale, coeff));
- dst[k + i * cols + r * cols * rows] = accumulated_scale.raw();
- }
- }
- }
- }
-
- if(info.beta() == 1.f)
- {
- for(int i = 0; i < dst.num_elements(); ++i)
- {
- fixed_point<T> res = div(fixed_point<T>(src[i], fixed_point_position, true), fixed_point<T>(dst[i], fixed_point_position, true));
- dst[i] = res.raw();
- }
- }
- else
- {
- const fixed_point<T> beta(info.beta(), fixed_point_position);
-
- for(int i = 0; i < dst.num_elements(); ++i)
- {
- fixed_point<T> res = pow(fixed_point<T>(dst[i], fixed_point_position, true), beta);
- res = div(fixed_point<T>(src[i], fixed_point_position, true), res);
- dst[i] = res.raw();
- }
- }
-
- return dst;
-}
-
template SimpleTensor<float> normalization_layer(const SimpleTensor<float> &src, NormalizationLayerInfo info);
template SimpleTensor<half> normalization_layer(const SimpleTensor<half> &src, NormalizationLayerInfo info);
-template SimpleTensor<qint8_t> normalization_layer(const SimpleTensor<qint8_t> &src, NormalizationLayerInfo info);
-template SimpleTensor<qint16_t> normalization_layer(const SimpleTensor<qint16_t> &src, NormalizationLayerInfo info);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/NormalizationLayer.h b/tests/validation/reference/NormalizationLayer.h
index 3f624ff..3448baf 100644
--- a/tests/validation/reference/NormalizationLayer.h
+++ b/tests/validation/reference/NormalizationLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -38,8 +38,6 @@
template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type = 0>
SimpleTensor<T> normalization_layer(const SimpleTensor<T> &src, NormalizationLayerInfo info);
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
-SimpleTensor<T> normalization_layer(const SimpleTensor<T> &src, NormalizationLayerInfo info);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/Permute.cpp b/tests/validation/reference/Permute.cpp
index bbb2e8d..29c3c5c 100644
--- a/tests/validation/reference/Permute.cpp
+++ b/tests/validation/reference/Permute.cpp
@@ -42,7 +42,7 @@
permute(dst_shape, perm);
// Create reference
- SimpleTensor<T> dst{ dst_shape, src.data_type(), src.num_channels(), src.fixed_point_position(), src.quantization_info() };
+ SimpleTensor<T> dst{ dst_shape, src.data_type(), src.num_channels(), src.quantization_info() };
// Compute reference
for(int i = 0; i < src.num_elements(); ++i)
diff --git a/tests/validation/reference/PixelWiseMultiplication.cpp b/tests/validation/reference/PixelWiseMultiplication.cpp
index 546a886..859da5c 100644
--- a/tests/validation/reference/PixelWiseMultiplication.cpp
+++ b/tests/validation/reference/PixelWiseMultiplication.cpp
@@ -23,8 +23,6 @@
*/
#include "PixelWiseMultiplication.h"
-#include "tests/validation/FixedPoint.h"
-
namespace arm_compute
{
namespace test
@@ -45,10 +43,10 @@
{
/** Compute the result of `src1 * src2 * scale`. The result type always matches the type of @p src2.
*
- * @param[in] src1 An input value. Data types supported: U8/QS8/QS16/S16/F16/F32.
+ * @param[in] src1 An input value. Data types supported: U8/S16/F16/F32.
* @param[in] src2 An input value. Data types supported: same as @p src1.
* @param[in] scale Scale to apply after multiplication.
- * Scale must be positive and its value must be either 1/255 or 1/2^n where n is between 0 and 15. For QS8 and QS16 scale must be 1.
+ * Scale must be positive and its value must be either 1/255 or 1/2^n where n is between 0 and 15.
* @param[in] convert_policy Overflow policy. Supported overflow policies: Wrap, Saturate
* @param[in] rounding_policy Rounding policy. Supported rounding modes: to zero, to nearest even.
*/
diff --git a/tests/validation/reference/PoolingLayer.cpp b/tests/validation/reference/PoolingLayer.cpp
index 6973454..02c430a 100644
--- a/tests/validation/reference/PoolingLayer.cpp
+++ b/tests/validation/reference/PoolingLayer.cpp
@@ -25,7 +25,6 @@
#include "arm_compute/core/Types.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
@@ -44,7 +43,7 @@
ARM_COMPUTE_ERROR_ON(info.is_global_pooling() && (src.shape().x() != src.shape().y()));
// Create reference
- SimpleTensor<T> dst{ compute_pool_shape(TensorInfo(src.shape(), 1, src.data_type(), src.fixed_point_position()), info), src.data_type(), 1, src.fixed_point_position() };
+ SimpleTensor<T> dst{ compute_pool_shape(TensorInfo(src.shape(), 1, src.data_type()), info), src.data_type(), 1 };
const int pool_size_x = info.is_global_pooling() ? src.shape().x() : info.pool_size().width;
const int pool_size_y = info.is_global_pooling() ? src.shape().y() : info.pool_size().height;
@@ -152,128 +151,6 @@
return dst;
}
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type>
-SimpleTensor<T> pooling_layer(const SimpleTensor<T> &src, const PoolingLayerInfo &info)
-{
- ARM_COMPUTE_ERROR_ON(info.is_global_pooling() && (src.shape().x() != src.shape().y()));
-
- const auto w_src = static_cast<int>(src.shape()[0]);
- const auto h_src = static_cast<int>(src.shape()[1]);
- const int upper_dims = src.shape().total_size() / (w_src * h_src);
-
- const int pool_size_x = info.is_global_pooling() ? src.shape().x() : info.pool_size().width;
- const int pool_size_y = info.is_global_pooling() ? src.shape().y() : info.pool_size().height;
- PoolingType type = info.pool_type();
- int pool_stride_x = info.pad_stride_info().stride().first;
- int pool_stride_y = info.pad_stride_info().stride().second;
- int pad_left = info.pad_stride_info().pad_left();
- int pad_top = info.pad_stride_info().pad_top();
- int pad_right = info.pad_stride_info().pad_right();
- int pad_bottom = info.pad_stride_info().pad_bottom();
- bool exclude_padding = info.exclude_padding();
-
- // Create reference
- SimpleTensor<T> dst{ compute_pool_shape(TensorInfo(src.shape(), 1, src.data_type(), src.fixed_point_position()), info), src.data_type(), 1, src.fixed_point_position() };
-
- const auto w_dst = static_cast<int>(dst.shape()[0]);
- const auto h_dst = static_cast<int>(dst.shape()[1]);
-
- if(type == PoolingType::MAX)
- {
- for(int r = 0; r < upper_dims; ++r)
- {
- for(int h = 0; h < h_dst; ++h)
- {
- for(int w = 0; w < w_dst; ++w)
- {
- int wstart = w * pool_stride_x - pad_left;
- int hstart = h * pool_stride_y - pad_top;
- int wend = std::min(wstart + pool_size_x, w_src);
- int hend = std::min(hstart + pool_size_y, h_src);
- wstart = std::max(wstart, 0);
- hstart = std::max(hstart, 0);
-
- T max_val = std::numeric_limits<T>::lowest();
- for(int y = hstart; y < hend; ++y)
- {
- for(int x = wstart; x < wend; ++x)
- {
- const T val = src[r * h_src * w_src + y * w_src + x];
- if(val > max_val)
- {
- max_val = val;
- }
- }
- }
-
- dst[r * h_dst * w_dst + h * w_dst + w] = max_val;
- }
- }
- }
- }
- else // Average or l2 pooling
- {
- for(int r = 0; r < upper_dims; ++r)
- {
- for(int h = 0; h < h_dst; ++h)
- {
- for(int w = 0; w < w_dst; ++w)
- {
- int wstart = w * pool_stride_x - pad_left;
- int hstart = h * pool_stride_y - pad_top;
- int wend = std::min(wstart + pool_size_x, w_src + pad_right);
- int hend = std::min(hstart + pool_size_y, h_src + pad_bottom);
- int pool = (hend - hstart) * (wend - wstart);
- wstart = std::max(wstart, 0);
- hstart = std::max(hstart, 0);
- wend = std::min(wend, w_src);
- hend = std::min(hend, h_src);
- // Exclude padding pixels from the average
- if(exclude_padding)
- {
- pool = (hend - hstart) * (wend - wstart);
- }
-
- using namespace fixed_point_arithmetic;
-
- const int fixed_point_position = src.fixed_point_position();
- const fixed_point<T> const_1(1, fixed_point_position);
- const fixed_point<T> invpool_fp(1.f / static_cast<float>(pool), fixed_point_position);
- fixed_point<T> avg_val(0, fixed_point_position, true);
-
- if(type == PoolingType::AVG)
- {
- for(int y = hstart; y < hend; ++y)
- {
- for(int x = wstart; x < wend; ++x)
- {
- const fixed_point<T> in_fp(src[r * h_src * w_src + y * w_src + x], fixed_point_position, true);
- avg_val = add(avg_val, in_fp);
- }
- }
- dst[r * h_dst * w_dst + h * w_dst + w] = mul(avg_val, invpool_fp).raw();
- }
- else
- {
- for(int y = hstart; y < hend; ++y)
- {
- for(int x = wstart; x < wend; ++x)
- {
- const fixed_point<T> in_fp(src[r * h_src * w_src + y * w_src + x], fixed_point_position, true);
- avg_val = add(avg_val, mul(in_fp, in_fp));
- }
- }
- auto res = div(const_1, (inv_sqrt(mul(avg_val, invpool_fp))));
- dst[r * h_dst * w_dst + h * w_dst + w] = res.raw();
- }
- }
- }
- }
- }
-
- return dst;
-}
-
template <>
SimpleTensor<uint8_t> pooling_layer<uint8_t>(const SimpleTensor<uint8_t> &src, const PoolingLayerInfo &info)
{
@@ -285,8 +162,6 @@
template SimpleTensor<float> pooling_layer(const SimpleTensor<float> &src, const PoolingLayerInfo &info);
template SimpleTensor<half> pooling_layer(const SimpleTensor<half> &src, const PoolingLayerInfo &info);
-template SimpleTensor<qint8_t> pooling_layer(const SimpleTensor<qint8_t> &src, const PoolingLayerInfo &info);
-template SimpleTensor<qint16_t> pooling_layer(const SimpleTensor<qint16_t> &src, const PoolingLayerInfo &info);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/ReductionOperation.cpp b/tests/validation/reference/ReductionOperation.cpp
index acfcc09..871a761 100644
--- a/tests/validation/reference/ReductionOperation.cpp
+++ b/tests/validation/reference/ReductionOperation.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -53,7 +53,7 @@
switch(op)
{
case ReductionOperation::SUM_SQUARE:
- return std::accumulate(ptr, ptr + reduce_elements, 0.f, square<T>());
+ return std::accumulate(ptr, ptr + reduce_elements, static_cast<T>(0), square<T>());
default:
ARM_COMPUTE_ERROR("Unsupported reduction operation");
}
@@ -87,6 +87,7 @@
}
template SimpleTensor<float> reduction_operation(const SimpleTensor<float> &src, const TensorShape &dst_shape, unsigned int axis, ReductionOperation op);
+template SimpleTensor<half> reduction_operation(const SimpleTensor<half> &src, const TensorShape &dst_shape, unsigned int axis, ReductionOperation op);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/SoftmaxLayer.cpp b/tests/validation/reference/SoftmaxLayer.cpp
index 90b9b1f..aa640ad 100644
--- a/tests/validation/reference/SoftmaxLayer.cpp
+++ b/tests/validation/reference/SoftmaxLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "SoftmaxLayer.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
namespace arm_compute
{
@@ -38,7 +37,7 @@
SimpleTensor<T> softmax_layer(const SimpleTensor<T> &src, float beta)
{
// Create reference
- SimpleTensor<T> dst{ src.shape(), src.data_type(), 1, src.fixed_point_position() };
+ SimpleTensor<T> dst{ src.shape(), src.data_type(), 1 };
// Compute reference
const int cols = src.shape()[0];
@@ -71,65 +70,21 @@
return dst;
}
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type>
+template <typename T, typename std::enable_if<std::is_same<T, uint8_t>::value, int>::type>
SimpleTensor<T> softmax_layer(const SimpleTensor<T> &src, float beta)
{
- ARM_COMPUTE_UNUSED(beta);
-
- using namespace fixed_point_arithmetic;
-
- // Create reference
- SimpleTensor<T> dst{ src.shape(), src.data_type(), 1, src.fixed_point_position() };
-
- // Compute reference
- const int cols = src.shape()[0];
- const int upper_dims = src.num_elements() / cols;
-
- for(int r = 0; r < upper_dims; ++r)
- {
- const T *src_row_ptr = src.data() + r * cols;
- T *dst_row_ptr = dst.data() + r * cols;
-
- // Find max
- const fixed_point<T> max(*std::max_element(src_row_ptr, src_row_ptr + cols), src.fixed_point_position(), true);
-
- // Regularize
- using promoted_type = fixed_point_arithmetic::traits::promote_t<T>;
- fixed_point<promoted_type> sum(0, src.fixed_point_position(), true);
- std::transform(src_row_ptr, src_row_ptr + cols, dst_row_ptr, [&](T val)
- {
- const fixed_point<T> res = exp(fixed_point<T>(val, src.fixed_point_position(), true) - max);
- sum = add(sum, fixed_point<promoted_type>(res.raw(), src.fixed_point_position(), true));
- return res.raw();
- });
-
- // Normalize
- fixed_point<T> saturated_sum(sum);
- std::transform(dst_row_ptr, dst_row_ptr + cols, dst_row_ptr, [&](T val)
- {
- return div(fixed_point<T>(val, src.fixed_point_position(), true), saturated_sum).raw();
- });
- }
-
- return dst;
-}
-
-template <>
-SimpleTensor<uint8_t> softmax_layer<uint8_t>(const SimpleTensor<uint8_t> &src, float beta)
-{
// Note: Output quantization info should always have scale = 1/256 and offset = 0
const QuantizationInfo output_quantization_info = QuantizationInfo(1.f / 256, 0);
- SimpleTensor<float> src_tmp = convert_from_asymmetric(src);
- SimpleTensor<float> dst_tmp = softmax_layer<float>(src_tmp, beta);
- SimpleTensor<uint8_t> dst = convert_to_asymmetric(dst_tmp, output_quantization_info);
+ SimpleTensor<float> src_tmp = convert_from_asymmetric(src);
+ SimpleTensor<float> dst_tmp = softmax_layer<float>(src_tmp, beta);
+ SimpleTensor<T> dst = convert_to_asymmetric(dst_tmp, output_quantization_info);
return dst;
}
template SimpleTensor<float> softmax_layer(const SimpleTensor<float> &src, float beta);
template SimpleTensor<half> softmax_layer(const SimpleTensor<half> &src, float beta);
-template SimpleTensor<qint8_t> softmax_layer(const SimpleTensor<qint8_t> &src, float beta);
-template SimpleTensor<qint16_t> softmax_layer(const SimpleTensor<qint16_t> &src, float beta);
+template SimpleTensor<uint8_t> softmax_layer(const SimpleTensor<uint8_t> &src, float beta);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/SoftmaxLayer.h b/tests/validation/reference/SoftmaxLayer.h
index a6d4c3b..21dca1e 100644
--- a/tests/validation/reference/SoftmaxLayer.h
+++ b/tests/validation/reference/SoftmaxLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -38,7 +38,7 @@
template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type = 0>
SimpleTensor<T> softmax_layer(const SimpleTensor<T> &src, float beta);
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
+template <typename T, typename std::enable_if<std::is_same<T, uint8_t>::value, int>::type = 0>
SimpleTensor<T> softmax_layer(const SimpleTensor<T> &src, float beta);
} // namespace reference
} // namespace validation
diff --git a/tests/validation/reference/Transpose.cpp b/tests/validation/reference/Transpose.cpp
index 736f37e..348c703 100644
--- a/tests/validation/reference/Transpose.cpp
+++ b/tests/validation/reference/Transpose.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#include "Transpose.h"
#include "arm_compute/core/Types.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
diff --git a/tests/validation/reference/WeightsReshape.cpp b/tests/validation/reference/WeightsReshape.cpp
new file mode 100644
index 0000000..fc02395
--- /dev/null
+++ b/tests/validation/reference/WeightsReshape.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "WeightsReshape.h"
+
+#include "tests/validation/Helpers.h"
+#include "tests/validation/reference/Utils.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T>
+SimpleTensor<T> weights_reshape(const SimpleTensor<T> &src, const SimpleTensor<T> &biases, const TensorShape &dst_shape, const unsigned int num_groups)
+{
+ SimpleTensor<T> dst{ dst_shape, src.data_type(), 1 };
+
+ // Compute reference
+ const bool has_bias = biases.size() > 0;
+ const size_t linear_sz = src.shape().total_size_lower(3);
+ const size_t group_sz = src.shape()[3] / num_groups;
+
+ for(size_t g = 0; g < num_groups; ++g)
+ {
+ for(size_t w = 0; w < group_sz; ++w)
+ {
+ const size_t curr_weight = g * group_sz + w;
+
+ size_t i = 0;
+ for(; i < linear_sz; ++i)
+ {
+ dst[coord2index(dst.shape(), Coordinates(w, i, g))] = src[curr_weight * linear_sz + i];
+ }
+ if(has_bias)
+ {
+ dst[coord2index(dst.shape(), Coordinates(w, i, g))] = static_cast<T>(biases[curr_weight]);
+ }
+ }
+ }
+
+ return dst;
+}
+
+template SimpleTensor<float> weights_reshape(const SimpleTensor<float> &src, const SimpleTensor<float> &biases, const TensorShape &dst_shape, const unsigned int num_groups);
+template SimpleTensor<half> weights_reshape(const SimpleTensor<half> &src, const SimpleTensor<half> &biases, const TensorShape &dst_shape, const unsigned int num_groups);
+template SimpleTensor<uint8_t> weights_reshape(const SimpleTensor<uint8_t> &src, const SimpleTensor<uint8_t> &biases, const TensorShape &dst_shape, const unsigned int num_groups);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
diff --git a/tests/validation/reference/FixedPoint.h b/tests/validation/reference/WeightsReshape.h
similarity index 78%
copy from tests/validation/reference/FixedPoint.h
copy to tests/validation/reference/WeightsReshape.h
index f0117f9..629f1e5 100644
--- a/tests/validation/reference/FixedPoint.h
+++ b/tests/validation/reference/WeightsReshape.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
-#define __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__
+#ifndef __ARM_COMPUTE_TEST_WEIGHTS_RESHAPE_H__
+#define __ARM_COMPUTE_TEST_WEIGHTS_RESHAPE_H__
#include "tests/SimpleTensor.h"
-#include "tests/Types.h"
+#include "tests/validation/Helpers.h"
namespace arm_compute
{
@@ -36,9 +36,9 @@
namespace reference
{
template <typename T>
-SimpleTensor<T> fixed_point_operation(const SimpleTensor<T> &src, FixedPointOp op);
+SimpleTensor<T> weights_reshape(const SimpleTensor<T> &src, const SimpleTensor<T> &biases, const TensorShape &dst_shape, const unsigned int num_groups);
} // namespace reference
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_FIXED_POINT_OPERATION_H__ */
+#endif /* __ARM_COMPUTE_TEST_WEIGHTS_RESHAPE_H__ */
diff --git a/tests/validation/reference/WidthConcatenateLayer.cpp b/tests/validation/reference/WidthConcatenateLayer.cpp
index fe79b4a..8662199 100644
--- a/tests/validation/reference/WidthConcatenateLayer.cpp
+++ b/tests/validation/reference/WidthConcatenateLayer.cpp
@@ -23,7 +23,6 @@
*/
#include "WidthConcatenateLayer.h"
-#include "tests/validation/FixedPoint.h"
#include "tests/validation/Helpers.h"
namespace arm_compute
@@ -85,8 +84,7 @@
template SimpleTensor<float> widthconcatenate_layer(const std::vector<SimpleTensor<float>> &srcs);
template SimpleTensor<half> widthconcatenate_layer(const std::vector<SimpleTensor<half>> &srcs);
-template SimpleTensor<qint8_t> widthconcatenate_layer(const std::vector<SimpleTensor<qint8_t>> &srcs);
-template SimpleTensor<qint16_t> widthconcatenate_layer(const std::vector<SimpleTensor<qint16_t>> &srcs);
+template SimpleTensor<uint8_t> widthconcatenate_layer(const std::vector<SimpleTensor<uint8_t>> &srcs);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/reference/Winograd.cpp b/tests/validation/reference/Winograd.cpp
index 194a78e..132d252 100644
--- a/tests/validation/reference/Winograd.cpp
+++ b/tests/validation/reference/Winograd.cpp
@@ -29,6 +29,7 @@
#include "arm_compute/core/Types.h"
#include <algorithm>
+#include <cmath>
namespace arm_compute
{
@@ -142,13 +143,31 @@
{
{ WinogradKey(std::pair<int, int>(2, 2), std::pair<int, int>(3, 3), WinogradTransformType::INPUT), imatrix2x2_3x3 },
{ WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(3, 3), WinogradTransformType::INPUT), imatrix4x4_3x3 },
+ { WinogradKey(std::pair<int, int>(2, 1), std::pair<int, int>(3, 1), WinogradTransformType::INPUT), imatrix2x2_3x3 },
+ { WinogradKey(std::pair<int, int>(4, 1), std::pair<int, int>(3, 1), WinogradTransformType::INPUT), imatrix4x4_3x3 },
+ { WinogradKey(std::pair<int, int>(1, 2), std::pair<int, int>(1, 3), WinogradTransformType::INPUT), imatrix2x2_3x3 },
+ { WinogradKey(std::pair<int, int>(1, 4), std::pair<int, int>(1, 3), WinogradTransformType::INPUT), imatrix4x4_3x3 },
{ WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(5, 5), WinogradTransformType::INPUT), imatrix4x4_5x5 },
+ { WinogradKey(std::pair<int, int>(4, 1), std::pair<int, int>(5, 1), WinogradTransformType::INPUT), imatrix4x4_5x5 },
+ { WinogradKey(std::pair<int, int>(1, 4), std::pair<int, int>(1, 5), WinogradTransformType::INPUT), imatrix4x4_5x5 },
{ WinogradKey(std::pair<int, int>(2, 2), std::pair<int, int>(3, 3), WinogradTransformType::FILTER), fmatrix2x2_3x3 },
{ WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(3, 3), WinogradTransformType::FILTER), fmatrix4x4_3x3 },
+ { WinogradKey(std::pair<int, int>(2, 1), std::pair<int, int>(3, 1), WinogradTransformType::FILTER), fmatrix2x2_3x3 },
+ { WinogradKey(std::pair<int, int>(4, 1), std::pair<int, int>(3, 1), WinogradTransformType::FILTER), fmatrix4x4_3x3 },
+ { WinogradKey(std::pair<int, int>(1, 2), std::pair<int, int>(1, 3), WinogradTransformType::FILTER), fmatrix2x2_3x3 },
+ { WinogradKey(std::pair<int, int>(1, 4), std::pair<int, int>(1, 3), WinogradTransformType::FILTER), fmatrix4x4_3x3 },
{ WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(5, 5), WinogradTransformType::FILTER), fmatrix4x4_5x5 },
+ { WinogradKey(std::pair<int, int>(4, 1), std::pair<int, int>(5, 1), WinogradTransformType::FILTER), fmatrix4x4_5x5 },
+ { WinogradKey(std::pair<int, int>(1, 4), std::pair<int, int>(1, 5), WinogradTransformType::FILTER), fmatrix4x4_5x5 },
{ WinogradKey(std::pair<int, int>(2, 2), std::pair<int, int>(3, 3), WinogradTransformType::OUTPUT), omatrix2x2_3x3 },
{ WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(3, 3), WinogradTransformType::OUTPUT), omatrix4x4_3x3 },
+ { WinogradKey(std::pair<int, int>(2, 1), std::pair<int, int>(3, 1), WinogradTransformType::OUTPUT), omatrix2x2_3x3 },
+ { WinogradKey(std::pair<int, int>(4, 1), std::pair<int, int>(3, 1), WinogradTransformType::OUTPUT), omatrix4x4_3x3 },
+ { WinogradKey(std::pair<int, int>(1, 2), std::pair<int, int>(1, 3), WinogradTransformType::OUTPUT), omatrix2x2_3x3 },
+ { WinogradKey(std::pair<int, int>(1, 4), std::pair<int, int>(1, 3), WinogradTransformType::OUTPUT), omatrix4x4_3x3 },
{ WinogradKey(std::pair<int, int>(4, 4), std::pair<int, int>(5, 5), WinogradTransformType::OUTPUT), omatrix4x4_5x5 },
+ { WinogradKey(std::pair<int, int>(4, 1), std::pair<int, int>(5, 1), WinogradTransformType::OUTPUT), omatrix4x4_5x5 },
+ { WinogradKey(std::pair<int, int>(1, 4), std::pair<int, int>(1, 5), WinogradTransformType::OUTPUT), omatrix4x4_5x5 },
};
// Find transformation matrix
@@ -189,7 +208,10 @@
const unsigned int tile_w = output_tile_size.width + kernel_size.width - 1;
const unsigned int tile_h = output_tile_size.height + kernel_size.height - 1;
- TensorShape tile_dims(tile_w, tile_h);
+ // Get the maximum dimension from the tile size
+ const unsigned int tile_max_dim = std::max(tile_w, tile_h);
+
+ TensorShape tile_dims(tile_max_dim, tile_max_dim);
// Simple tensor for the input tile
SimpleTensor<T> src_tile{ tile_dims, in.data_type() };
@@ -217,11 +239,46 @@
const int in_d = in.shape().z();
const int out_d = out.shape().z();
const int num_batches = in.shape().total_size() / (in_w * in_h * in_d);
- const int num_tiles_x = std::ceil((in_w - (kernel_size.width - 1) + conv_info.pad_left() + conv_info.pad_right()) / static_cast<float>(output_tile_size.width));
- const int num_tiles_y = std::ceil((in_h - (kernel_size.height - 1) + conv_info.pad_top() + conv_info.pad_bottom()) / static_cast<float>(output_tile_size.height));
const int step_x = output_tile_size.width;
const int step_y = output_tile_size.height;
+ // Compute the number of output tiles along the x and y direction of size "output_tile_size"
+ const Size2D num_tiles = compute_winograd_convolution_tiles(Size2D(in_w, in_h),
+ kernel_size,
+ output_tile_size,
+ conv_info);
+
+ const int num_tiles_x = num_tiles.width;
+ const int num_tiles_y = num_tiles.height;
+
+ // In case of 1D convolution, the input tile has to be partially filled with zeros
+ int start_x_zero = 0;
+ int start_y_zero = 0;
+ int end_x_zero = 0;
+ int end_y_zero = 0;
+
+ if(output_tile_size.width == 1)
+ {
+ start_x_zero = 1;
+ start_y_zero = 0;
+ end_x_zero = tile_max_dim - 1;
+ end_y_zero = tile_max_dim;
+ }
+ else if(output_tile_size.height == 1)
+ {
+ start_x_zero = 0;
+ start_y_zero = 1;
+ end_x_zero = tile_max_dim;
+ end_y_zero = tile_max_dim - 1;
+ }
+
+ // Set the anchor and shape of the zeros area
+ const Coordinates anchor_zeros(start_x_zero, start_y_zero);
+ const TensorShape shape_zeros(end_x_zero, end_y_zero);
+
+ // If we have a vertical filter (i.e. 1x3, 1x5,..), we need to take the elements along the y direction (step = width of the output tile)
+ const int step_y_transf_tile = kernel_size.width == 1 ? tile_max_dim : 1;
+
ARM_COMPUTE_ERROR_ON((num_tiles_x * num_tiles_y) != static_cast<int>(out.shape().y()));
for(int b = 0; b < num_batches; ++b)
@@ -238,6 +295,9 @@
// Get the tile from the input tensor
get_tile(in, src_tile, Coordinates(xi, yi, z, b));
+ // Fill partially with zeros in case of 1D convolution
+ zeros(src_tile, anchor_zeros, shape_zeros);
+
// Compute the transformation
matrix_multiply(matrix, src_tile, tmp_tile);
matrix_multiply(tmp_tile, matrix_transposed, dst_tile);
@@ -247,7 +307,7 @@
{
int xo = z;
int yo = x + y * num_tiles_x;
- out[coords2index(out.shape(), Coordinates(xo, yo, i, b))] = dst_tile[i];
+ out[coords2index(out.shape(), Coordinates(xo, yo, i, b))] = dst_tile[i * step_y_transf_tile];
}
}
}
@@ -268,27 +328,31 @@
const Size2D output_tile_size = winograd_info.output_tile_size;
const Size2D kernel_size = winograd_info.kernel_size;
- TensorShape kernel_tile_dims(kernel_size.width, kernel_size.height);
-
// Calculate dimensions for the tile
const unsigned int input_tile_w = output_tile_size.width + kernel_size.width - 1;
const unsigned int input_tile_h = output_tile_size.height + kernel_size.height - 1;
const unsigned int input_tile_area = input_tile_w * input_tile_h;
+ // Get the maximum dimension from the filter size
+ const unsigned int kernel_max_dim = std::max(kernel_size.width, kernel_size.height);
+
+ // Get the maximum dimension from the input tile
+ const unsigned int input_tile_max_dim = std::max(input_tile_w, input_tile_h);
+
// Simple tensor for the input tile
- SimpleTensor<T> input_tile{ kernel_tile_dims, in.data_type(), 1 };
+ SimpleTensor<T> input_tile{ TensorShape(kernel_max_dim, kernel_max_dim), in.data_type(), 1 };
// Simple tensor for the transformation matrix
- SimpleTensor<T> trans_matrix{ TensorShape(kernel_tile_dims[0], input_tile_w), in.data_type(), 1 };
+ SimpleTensor<T> trans_matrix{ TensorShape(kernel_max_dim, input_tile_max_dim), in.data_type(), 1 };
// Simple tensor for the transformation matrix transpose
- SimpleTensor<T> trans_matrix_transposed{ TensorShape(input_tile_w, kernel_tile_dims[0]), in.data_type(), 1 };
+ SimpleTensor<T> trans_matrix_transposed{ TensorShape(input_tile_max_dim, kernel_max_dim), in.data_type(), 1 };
// Simple tensor for the temporary tile
- SimpleTensor<T> tmp_tile{ TensorShape(kernel_tile_dims[0], input_tile_w), in.data_type(), 1 };
+ SimpleTensor<T> tmp_tile{ TensorShape(kernel_max_dim, input_tile_max_dim), in.data_type(), 1 };
// Simple tensor for the output tile
- SimpleTensor<T> transf_tile{ TensorShape(input_tile_w, input_tile_w), in.data_type(), 1 };
+ SimpleTensor<T> transf_tile{ TensorShape(input_tile_max_dim, input_tile_max_dim), in.data_type(), 1 };
// Initialize matrix for the filter transform
initialize_matrix_transform(trans_matrix, output_tile_size, kernel_size, WinogradTransformType::FILTER);
@@ -300,6 +364,9 @@
const int num_filters = in.shape()[3];
const int num_batches = in.shape().total_size() / (kernel_size.area() * num_channels * num_filters);
+ // If we have a vertical filter (i.e. 1x3, 1x5,..), we need to take the elements along the y direction (step_y_transf_tile = width of the output tile)
+ const int step_y_transf_tile = kernel_size.width == 1 ? input_tile_max_dim : 1;
+
for(int n = 0; n < num_batches; ++n)
{
for(int w = 0; w < num_filters; ++w)
@@ -321,7 +388,7 @@
// Store the values across the channels
for(unsigned int i = 0; i < input_tile_area; ++i)
{
- out[output_offset + i * num_filters * num_channels] = transf_tile[i];
+ out[output_offset + i * num_filters * num_channels] = transf_tile[i * step_y_transf_tile];
}
}
}
@@ -333,8 +400,6 @@
template <typename T>
SimpleTensor<T> winograd_output_transform(const SimpleTensor<T> &in, const SimpleTensor<T> &b, const TensorShape &output_shape, const WinogradInfo &winograd_info)
{
- ARM_COMPUTE_ERROR_ON_MSG(winograd_info.output_data_layout != DataLayout::NCHW, "Only supported NCHW data format");
-
const PadStrideInfo conv_info = winograd_info.convolution_info;
const Size2D input_dimensions = winograd_info.input_dimensions;
const Size2D output_tile_size = winograd_info.output_tile_size;
@@ -350,17 +415,21 @@
const unsigned int out_tile_h = output_tile_size.height;
ARM_COMPUTE_ERROR_ON(in.shape()[2] != (in_tile_w * in_tile_h));
- ARM_COMPUTE_ERROR_ON(in.shape()[0] != out.shape()[2]);
+ ARM_COMPUTE_ERROR_ON(in.shape()[0] != out.shape()[get_data_layout_dimension_index(winograd_info.output_data_layout, DataLayoutDimension::CHANNEL)]);
+
+ // Get the maximum dimension from the tile size
+ const unsigned int in_tile_max_dim = std::max(in_tile_w, in_tile_h);
+ const unsigned int out_tile_max_dim = std::max(output_tile_size.width, output_tile_size.height);
// Compute tile dimensions
// Input tile dimensions
- TensorShape in_tile_dims(in_tile_w, in_tile_h);
+ TensorShape in_tile_dims(in_tile_max_dim, in_tile_max_dim);
// Output tile dimensions
- TensorShape out_tile_dims(output_tile_size.width, output_tile_size.height);
+ TensorShape out_tile_dims(out_tile_max_dim, out_tile_max_dim);
// Transformation matrix dimensions
- TensorShape tr_tile_dims(in_tile_w, output_tile_size.width);
+ TensorShape tr_tile_dims(in_tile_max_dim, out_tile_max_dim);
// Create tensors
// Simple tensor for the input tile
@@ -402,15 +471,24 @@
const int stridez_out = stridey_out * h_out;
const int stridew_out = stridez_out * c_out;
- // Compute number of elements to process in the X and Y direction
- const int num_elements_x = input_dimensions.width - (kernel_size.width - 1) + conv_info.pad_left() + conv_info.pad_right();
- const int num_elements_y = input_dimensions.height - (kernel_size.height - 1) + conv_info.pad_top() + conv_info.pad_bottom();
- const int num_tiles_x = std::ceil(num_elements_x / static_cast<float>(output_tile_size.width));
- const int num_tiles_y = std::ceil(num_elements_y / static_cast<float>(output_tile_size.height));
+ // Compute the number of output tiles along the x and y direction of size "output_tile_size"
+ const Size2D num_tiles = compute_winograd_convolution_tiles(Size2D(input_dimensions.width, input_dimensions.height),
+ kernel_size,
+ output_tile_size,
+ conv_info);
+
+ const int num_tiles_x = num_tiles.width;
+ const int num_tiles_y = num_tiles.height;
ARM_COMPUTE_UNUSED(num_tiles_y);
ARM_COMPUTE_ERROR_ON(in.shape()[1] != static_cast<unsigned int>(num_tiles_x * num_tiles_y));
+ // If we have a vertical filter (i.e. 1x3, 1x5,..), we still need to take the elements along the x direction (step_y_transf_tile = 1)
+ const int step_y_transf_tile = kernel_size.width == 1 ? 1 : output_tile.shape()[0];
+
+ // Initialize with zeros the input tile
+ zeros(input_tile, Coordinates(0, 0), input_tile.shape());
+
for(int n = 0; n < num_batches; ++n)
{
for(int y = 0; y < h_in; ++y)
@@ -443,7 +521,7 @@
// Check out-of-bound writes
if((xo + xi < w_out) && (yo + yi < h_out))
{
- out[output_offset + yi * stridey_out + xi] = output_tile[xi + yi * out_tile_w];
+ out[output_offset + yi * stridey_out + xi] = output_tile[xi + yi * step_y_transf_tile];
// Add bias
out[output_offset + yi * stridey_out + xi] += b[zo];