aboutsummaryrefslogtreecommitdiff
path: root/tests/datasets
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2018-02-22 16:17:20 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:16 +0000
commit7e4b23953e885e58d655a7d9f35a1afcc38365e4 (patch)
tree4f5a3f6535aae10a36482bd4f996d3427ac77080 /tests/datasets
parent66c656a1d10831d8311f7797b285faa2c30bcb3f (diff)
downloadComputeLibrary-7e4b23953e885e58d655a7d9f35a1afcc38365e4.tar.gz
COMPMID-935 - Implementing Convolution with Winograd on OpenCL (part 2)
Implemented Winograd Filter Transform 3x3 on OpenCL Change-Id: I8f2b2dd938c5c000ef7ce392a37fb7b8b4202a4e Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/122708 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/datasets')
-rw-r--r--tests/datasets/ShapeDatasets.h32
-rw-r--r--tests/datasets/WinogradFilterTransformDataset.h128
2 files changed, 160 insertions, 0 deletions
diff --git a/tests/datasets/ShapeDatasets.h b/tests/datasets/ShapeDatasets.h
index 4b563708e1..e939a6f5a7 100644
--- a/tests/datasets/ShapeDatasets.h
+++ b/tests/datasets/ShapeDatasets.h
@@ -238,6 +238,38 @@ public:
}
};
+/** Data set containing medium 3D tensor shapes. */
+class Medium3DShapes final : public ShapeDataset
+{
+public:
+ Medium3DShapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 42U, 37U, 8U },
+ TensorShape{ 57U, 60U, 13U },
+ TensorShape{ 128U, 64U, 21U },
+ TensorShape{ 83U, 72U, 14U }
+ })
+ {
+ }
+};
+
+/** Data set containing medium 4D tensor shapes. */
+class Medium4DShapes final : public ShapeDataset
+{
+public:
+ Medium4DShapes()
+ : ShapeDataset("Shape",
+ {
+ TensorShape{ 42U, 37U, 8U, 15U },
+ TensorShape{ 57U, 60U, 13U, 8U },
+ TensorShape{ 128U, 64U, 21U, 13U },
+ TensorShape{ 83U, 72U, 14U, 5U }
+ })
+ {
+ }
+};
+
/** Data set containing large tensor shapes. */
class LargeShapes final : public ShapeDataset
{
diff --git a/tests/datasets/WinogradFilterTransformDataset.h b/tests/datasets/WinogradFilterTransformDataset.h
new file mode 100644
index 0000000000..07d0283b55
--- /dev/null
+++ b/tests/datasets/WinogradFilterTransformDataset.h
@@ -0,0 +1,128 @@
+/*
+ * 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_WINOGRAD_FILTER_TRANSFORM_DATASET
+#define ARM_COMPUTE_TEST_WINOGRAD_FILTER_TRANSFORM_DATASET
+
+#include "utils/TypePrinter.h"
+
+#include "arm_compute/core/TensorShape.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace datasets
+{
+class WinogradFilterTransformDataset
+{
+public:
+ using type = std::tuple<TensorShape, bool>;
+
+ struct iterator
+ {
+ iterator(std::vector<TensorShape>::const_iterator a_it,
+ std::vector<bool>::const_iterator is_nchw_it)
+ : _a_it{ std::move(a_it) },
+ _is_nchw_it{ std::move(is_nchw_it) }
+ {
+ }
+
+ std::string description() const
+ {
+ std::stringstream description;
+ description << "Input=" << *_a_it << ":";
+ description << "IsNCHW=" << *_is_nchw_it << ":";
+ return description.str();
+ }
+
+ WinogradFilterTransformDataset::type operator*() const
+ {
+ return std::make_tuple(*_a_it, *_is_nchw_it);
+ }
+
+ iterator &operator++()
+ {
+ ++_a_it;
+ ++_is_nchw_it;
+
+ return *this;
+ }
+
+ private:
+ std::vector<TensorShape>::const_iterator _a_it;
+ std::vector<bool>::const_iterator _is_nchw_it;
+ };
+
+ iterator begin() const
+ {
+ return iterator(_a_shapes.begin(), _is_nchw.begin());
+ }
+
+ int size() const
+ {
+ return std::min(_a_shapes.size(), _is_nchw.size());
+ }
+
+ void add_config(TensorShape a, bool is_nchw)
+ {
+ _a_shapes.emplace_back(std::move(a));
+ _is_nchw.emplace_back(std::move(is_nchw));
+ }
+
+protected:
+ WinogradFilterTransformDataset() = default;
+ WinogradFilterTransformDataset(WinogradFilterTransformDataset &&) = default;
+
+private:
+ std::vector<TensorShape> _a_shapes{};
+ std::vector<bool> _is_nchw{};
+};
+
+class SmallWinogradFilterTransformDataset final : public WinogradFilterTransformDataset
+{
+public:
+ SmallWinogradFilterTransformDataset()
+ {
+ add_config(TensorShape(3U, 3U, 7U, 4U), true);
+ add_config(TensorShape(3U, 3U, 4U, 13U), true);
+ add_config(TensorShape(3U, 3U, 9U, 2U), true);
+ add_config(TensorShape(3U, 3U, 3U, 5U), true);
+ }
+};
+
+class LargeWinogradFilterTransformDataset final : public WinogradFilterTransformDataset
+{
+public:
+ LargeWinogradFilterTransformDataset()
+ {
+ add_config(TensorShape(3U, 3U, 32U, 64U), true);
+ add_config(TensorShape(3U, 3U, 51U, 13U), true);
+ add_config(TensorShape(3U, 3U, 53U, 47U), true);
+ add_config(TensorShape(3U, 3U, 128U, 384U), true);
+ }
+};
+} // namespace datasets
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_WINOGRAD_FILTER_TRANSFORM_DATASET */