aboutsummaryrefslogtreecommitdiff
path: root/tests/datasets/ChannelShuffleLayerDataset.h
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2018-05-01 16:52:00 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:50:48 +0000
commit721756352e68602fe6aaf90b3ca031c947cd2176 (patch)
tree33921f257424524e82d8aeaec62447f4dbc5b440 /tests/datasets/ChannelShuffleLayerDataset.h
parentc0f54434383f945d95f95549c1c4b0d5f5d2caff (diff)
downloadComputeLibrary-721756352e68602fe6aaf90b3ca031c947cd2176.tar.gz
COMPMID-1107: Add support for ChannelShuffle in CL
Change-Id: I56d2a02b316f0c69ff1fd7220e732f775414fe69 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/129709 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Giorgio Arena <giorgio.arena@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Diffstat (limited to 'tests/datasets/ChannelShuffleLayerDataset.h')
-rw-r--r--tests/datasets/ChannelShuffleLayerDataset.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/tests/datasets/ChannelShuffleLayerDataset.h b/tests/datasets/ChannelShuffleLayerDataset.h
new file mode 100644
index 0000000000..a47513958a
--- /dev/null
+++ b/tests/datasets/ChannelShuffleLayerDataset.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_CHANNEL_SHUFFLE_LAYER_DATASET
+#define ARM_COMPUTE_TEST_CHANNEL_SHUFFLE_LAYER_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 ChannelShuffleLayerDataset
+{
+public:
+ using type = std::tuple<TensorShape, int>;
+
+ struct iterator
+ {
+ iterator(std::vector<TensorShape>::const_iterator tensor_it,
+ std::vector<int>::const_iterator num_groups_it)
+ : _tensor_it{ std::move(tensor_it) },
+ _num_groups_it{ std::move(num_groups_it) }
+ {
+ }
+
+ std::string description() const
+ {
+ std::stringstream description;
+ description << "In=" << *_tensor_it << ":";
+ description << "NumGroups=" << *_num_groups_it;
+ return description.str();
+ }
+
+ ChannelShuffleLayerDataset::type operator*() const
+ {
+ return std::make_tuple(*_tensor_it, *_num_groups_it);
+ }
+
+ iterator &operator++()
+ {
+ ++_tensor_it;
+ ++_num_groups_it;
+
+ return *this;
+ }
+
+ private:
+ std::vector<TensorShape>::const_iterator _tensor_it;
+ std::vector<int>::const_iterator _num_groups_it;
+ };
+
+ iterator begin() const
+ {
+ return iterator(_tensor_shapes.begin(), _num_groups.begin());
+ }
+
+ int size() const
+ {
+ return std::min(_tensor_shapes.size(), _num_groups.size());
+ }
+
+ void add_config(TensorShape tensor, int num_groups)
+ {
+ _tensor_shapes.emplace_back(std::move(tensor));
+ _num_groups.emplace_back(std::move(num_groups));
+ }
+
+protected:
+ ChannelShuffleLayerDataset() = default;
+ ChannelShuffleLayerDataset(ChannelShuffleLayerDataset &&) = default;
+
+private:
+ std::vector<TensorShape> _tensor_shapes{};
+ std::vector<int> _num_groups{};
+};
+
+class SmallRandomChannelShuffleLayerDataset final : public ChannelShuffleLayerDataset
+{
+public:
+ SmallRandomChannelShuffleLayerDataset()
+ {
+ add_config(TensorShape(15U, 16U, 4U, 12U), 2);
+ add_config(TensorShape(21U, 11U, 12U, 7U), 4);
+ add_config(TensorShape(21U, 11U, 12U, 7U), 6);
+ add_config(TensorShape(7U, 3U, 6U, 11U), 3);
+ }
+};
+
+class LargeRandomChannelShuffleLayerDataset final : public ChannelShuffleLayerDataset
+{
+public:
+ LargeRandomChannelShuffleLayerDataset()
+ {
+ add_config(TensorShape(210U, 43U, 20U, 3U), 5);
+ add_config(TensorShape(283U, 213U, 15U, 3U), 3);
+ add_config(TensorShape(500U, 115U, 16U, 2U), 4);
+ }
+};
+} // namespace datasets
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_CHANNEL_SHUFFLE_LAYER_DATASET */