aboutsummaryrefslogtreecommitdiff
path: root/tests/datasets
diff options
context:
space:
mode:
authorUsama Arif <usama.arif@arm.com>2019-04-08 17:30:48 +0100
committerPablo Marquez <pablo.tello@arm.com>2019-04-18 10:07:37 +0000
commite73686ac797be2d19cd9bed26d690e1431e3d848 (patch)
tree84a65c520b3a7b3e0abef03b48f8bbc0882e1fa4 /tests/datasets
parent6631ac22efdb75438e8f35e836ae9f17cfd40c86 (diff)
downloadComputeLibrary-e73686ac797be2d19cd9bed26d690e1431e3d848.tar.gz
COMPMID-2047: Add support for dilation in CLDepthwiseConvolution.
Change-Id: I3106aa34bd168985a56791613d95072756be6e9b Signed-off-by: Usama Arif <usama.arif@arm.com> Reviewed-on: https://review.mlplatform.org/c/958 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez <pablo.tello@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/datasets')
-rw-r--r--tests/datasets/DepthwiseConvolutionLayerDataset.h23
-rw-r--r--tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h139
2 files changed, 154 insertions, 8 deletions
diff --git a/tests/datasets/DepthwiseConvolutionLayerDataset.h b/tests/datasets/DepthwiseConvolutionLayerDataset.h
index 8a1f3b6f39..4c78eb87ea 100644
--- a/tests/datasets/DepthwiseConvolutionLayerDataset.h
+++ b/tests/datasets/DepthwiseConvolutionLayerDataset.h
@@ -38,16 +38,18 @@ namespace datasets
class DepthwiseConvolutionLayerDataset
{
public:
- using type = std::tuple<TensorShape, Size2D, PadStrideInfo>;
+ using type = std::tuple<TensorShape, Size2D, PadStrideInfo, Size2D>;
struct iterator
{
iterator(std::vector<TensorShape>::const_iterator src_it,
std::vector<Size2D>::const_iterator weights_it,
- std::vector<PadStrideInfo>::const_iterator infos_it)
+ std::vector<PadStrideInfo>::const_iterator infos_it,
+ std::vector<Size2D>::const_iterator dilation_it)
: _src_it{ std::move(src_it) },
_weights_it{ std::move(weights_it) },
- _infos_it{ std::move(infos_it) }
+ _infos_it{ std::move(infos_it) },
+ _dilation_it{ std::move(dilation_it) }
{
}
@@ -56,13 +58,14 @@ public:
std::stringstream description;
description << "In=" << *_src_it << ":";
description << "Weights=" << *_weights_it << ":";
- description << "Info=" << *_infos_it;
+ description << "Info=" << *_infos_it << ":";
+ description << "Dilation=" << *_dilation_it;
return description.str();
}
DepthwiseConvolutionLayerDataset::type operator*() const
{
- return std::make_tuple(*_src_it, *_weights_it, *_infos_it);
+ return std::make_tuple(*_src_it, *_weights_it, *_infos_it, *_dilation_it);
}
iterator &operator++()
@@ -70,6 +73,7 @@ public:
++_src_it;
++_weights_it;
++_infos_it;
+ ++_dilation_it;
return *this;
}
@@ -78,23 +82,25 @@ public:
std::vector<TensorShape>::const_iterator _src_it;
std::vector<Size2D>::const_iterator _weights_it;
std::vector<PadStrideInfo>::const_iterator _infos_it;
+ std::vector<Size2D>::const_iterator _dilation_it;
};
iterator begin() const
{
- return iterator(_src_shapes.begin(), _weight_shapes.begin(), _infos.begin());
+ return iterator(_src_shapes.begin(), _weight_shapes.begin(), _infos.begin(), _dilations.begin());
}
int size() const
{
- return std::min(_src_shapes.size(), std::min(_weight_shapes.size(), _infos.size()));
+ return std::min(_src_shapes.size(), std::min(_weight_shapes.size(), std::min(_infos.size(), _dilations.size())));
}
- void add_config(TensorShape src, Size2D weights, PadStrideInfo info)
+ void add_config(TensorShape src, Size2D weights, PadStrideInfo info, Size2D dilation = Size2D(1U, 1U))
{
_src_shapes.emplace_back(std::move(src));
_weight_shapes.emplace_back(std::move(weights));
_infos.emplace_back(std::move(info));
+ _dilations.emplace_back(std::move(dilation));
}
protected:
@@ -105,6 +111,7 @@ private:
std::vector<TensorShape> _src_shapes{};
std::vector<Size2D> _weight_shapes{};
std::vector<PadStrideInfo> _infos{};
+ std::vector<Size2D> _dilations{};
};
/** Dataset containing small, generic depthwise convolution shapes. */
diff --git a/tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h b/tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h
new file mode 100644
index 0000000000..df054de501
--- /dev/null
+++ b/tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2019 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_DILATED_CONVOLUTION_LAYER_DATASET
+#define ARM_COMPUTE_TEST_DILATED_CONVOLUTION_LAYER_DATASET
+
+#include "utils/TypePrinter.h"
+
+#include "arm_compute/core/TensorShape.h"
+#include "arm_compute/core/Types.h"
+#include "tests/datasets/DepthwiseConvolutionLayerDataset.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace datasets
+{
+/** Dataset containing small, generic depthwise convolution shapes with dilation. */
+class SmallDepthwiseDilatedConvolutionLayerDataset final : public DepthwiseConvolutionLayerDataset
+{
+public:
+ SmallDepthwiseDilatedConvolutionLayerDataset()
+ {
+ // Different strides and dilations
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 2U), PadStrideInfo(1, 1, 0, 0), Size2D(2U, 2U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 2U), PadStrideInfo(1, 2, 0, 0), Size2D(2U, 1U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 2U), PadStrideInfo(1, 1, 0, 0), Size2D(2U, 1U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 2U), PadStrideInfo(2, 1, 0, 0), Size2D(2U, 2U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 2U), PadStrideInfo(2, 2, 0, 0), Size2D(1U, 2U));
+
+ add_config(TensorShape(7U, 8U, 1U), Size2D(2U, 3U), PadStrideInfo(1, 2, 0, 0), Size2D(2U, 2U));
+ add_config(TensorShape(23U, 27U, 5U), Size2D(3U, 5U), PadStrideInfo(2, 1, 0, 0), Size2D(2U, 1U));
+ add_config(TensorShape(33U, 27U, 7U), Size2D(7U, 3U), PadStrideInfo(3, 2, 1, 0), Size2D(1U, 2U));
+ // Asymmetric padding
+ add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR), Size2D(2U, 2U));
+ add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 1, 0, 2, DimensionRoundingType::FLOOR), Size2D(2U, 2U));
+ }
+};
+
+/** Dataset containing small, 3x3 depthwise convolution shapes with dilation. */
+class SmallDepthwiseDilatedConvolutionLayerDataset3x3 final : public DepthwiseConvolutionLayerDataset
+{
+public:
+ SmallDepthwiseDilatedConvolutionLayerDataset3x3()
+ {
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 0), Size2D(2U, 2U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 3U), PadStrideInfo(1, 1, 2, 0), Size2D(2U, 2U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 3U), PadStrideInfo(1, 1, 3, 0), Size2D(2U, 2U));
+
+ // Different strides and dilations
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0), Size2D(2U, 2U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 3U), PadStrideInfo(1, 2, 0, 0), Size2D(2U, 1U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 3U), PadStrideInfo(2, 1, 0, 0), Size2D(2U, 2U));
+ add_config(TensorShape(7U, 7U, 1U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 0), Size2D(1U, 2U));
+
+ add_config(TensorShape(11U, 11U, 1U), Size2D(3U, 3U), PadStrideInfo(3, 3, 0, 0), Size2D(2U, 2U));
+ add_config(TensorShape(7U, 7U, 3U, 2U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 0), Size2D(2U, 2U));
+
+ add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 0), Size2D(1U, 1U));
+
+ add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 0), Size2D(2U, 2U));
+ // Asymmetric padding
+ add_config(TensorShape(33U, 27U, 11U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), Size2D(2U, 2U));
+ }
+};
+
+/** Dataset containing large, generic depthwise convolution shapes with dilation. */
+class LargeDepthwiseDilatedConvolutionLayerDataset final : public DepthwiseConvolutionLayerDataset
+{
+public:
+ LargeDepthwiseDilatedConvolutionLayerDataset()
+ {
+ add_config(TensorShape(33U, 27U, 11U), Size2D(3U, 3U), PadStrideInfo(1, 2, 0, 1), Size2D(2U, 1U));
+ add_config(TensorShape(17U, 31U, 2U), Size2D(5U, 9U), PadStrideInfo(1, 2, 1, 1), Size2D(1U, 2U));
+ add_config(TensorShape(23U, 27U, 5U), Size2D(11U, 3U), PadStrideInfo(1, 2, 0, 0), Size2D(3U, 3U));
+ add_config(TensorShape(17U, 31U, 2U, 3U), Size2D(5U, 9U), PadStrideInfo(1, 2, 1, 1), Size2D(2U, 2U));
+ add_config(TensorShape(233U, 277U, 55U), Size2D(3U, 3U), PadStrideInfo(2, 1, 0, 0), Size2D(2U, 2U));
+ add_config(TensorShape(333U, 277U, 77U), Size2D(3U, 3U), PadStrideInfo(3, 2, 1, 0), Size2D(3U, 2U));
+ add_config(TensorShape(177U, 311U, 22U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 1), Size2D(2U, 2U));
+ add_config(TensorShape(233U, 277U, 55U), Size2D(3U, 3U), PadStrideInfo(1, 2, 0, 0), Size2D(5U, 2U));
+ add_config(TensorShape(333U, 277U, 77U), Size2D(3U, 3U), PadStrideInfo(2, 3, 0, 1), Size2D(2U, 2U));
+ add_config(TensorShape(177U, 311U, 22U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 1), Size2D(2U, 5U));
+ // Asymmetric padding
+ add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 2, 1, 2, 0, DimensionRoundingType::FLOOR), Size2D(3U, 2U));
+ add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 3, 0, 2, DimensionRoundingType::FLOOR), Size2D(4U, 4U));
+ add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 1, 0, 1, 0, DimensionRoundingType::FLOOR), Size2D(2U, 2U));
+ add_config(TensorShape(33U, 27U, 7U), Size2D(5U, 7U), PadStrideInfo(3, 2, 0, 1, 0, 1, DimensionRoundingType::FLOOR), Size2D(3U, 3U));
+ }
+};
+
+/** Dataset containing large, 3x3 depthwise convolution shapes with dilation. */
+class LargeDepthwiseDilatedConvolutionLayerDataset3x3 final : public DepthwiseConvolutionLayerDataset
+{
+public:
+ LargeDepthwiseDilatedConvolutionLayerDataset3x3()
+ {
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 1, 0, 1), Size2D(2U, 1U));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 1, 1, 1), Size2D(2U, 2U));
+ add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 0), Size2D(2U, 2U));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 2, 0, 1), Size2D(2U, 1U));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 1), Size2D(2U, 3U));
+ add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 0), Size2D(2U, 1U));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 1, 0, 1), Size2D(3U, 3U));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 1), Size2D(2U, 2U));
+ add_config(TensorShape(21U, 31U, 9U, 4U), Size2D(3U, 3U), PadStrideInfo(2, 2, 1, 0), Size2D(2U, 2U));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 2, 0, 1), Size2D(4U, 4U));
+ add_config(TensorShape(33U, 27U, 11U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 2, 1, 1), Size2D(2U, 5U));
+ add_config(TensorShape(233U, 277U, 55U, 3U), Size2D(3U, 3U), PadStrideInfo(2, 1, 0, 0), Size2D(3U, 3U));
+ add_config(TensorShape(177U, 311U, 22U), Size2D(3U, 3U), PadStrideInfo(1, 2, 1, 1), Size2D(4U, 4U));
+ add_config(TensorShape(233U, 277U, 55U), Size2D(3U, 3U), PadStrideInfo(1, 2, 0, 0), Size2D(5U, 5U));
+ add_config(TensorShape(333U, 277U, 77U, 5U), Size2D(3U, 3U), PadStrideInfo(2, 3, 0, 1), Size2D(4U, 4U));
+ add_config(TensorShape(177U, 311U, 22U), Size2D(3U, 3U), PadStrideInfo(2, 1, 1, 1), Size2D(3U, 3U));
+ }
+};
+} // namespace datasets
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_DILATED_CONVOLUTION_LAYER_DATASET */