aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp1
-rw-r--r--arm_compute/core/Size3D.h106
-rw-r--r--arm_compute/core/Types.h15
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h66
-rw-r--r--arm_compute/runtime/FunctionDescriptors.h28
-rw-r--r--src/core/Size3D.cpp43
-rw-r--r--tests/validation/reference/Conv3D.cpp175
-rw-r--r--tests/validation/reference/Conv3D.h47
-rw-r--r--utils/TypePrinter.h3
9 files changed, 481 insertions, 3 deletions
diff --git a/Android.bp b/Android.bp
index 44ae82562d..fb400e8830 100644
--- a/Android.bp
+++ b/Android.bp
@@ -240,6 +240,7 @@ cc_library_static {
"src/core/NEON/kernels/convolution/winograd/winograd_transforms/weights_6_3_fp32_fp32_integers.cpp",
"src/core/Rounding.cpp",
"src/core/Size2D.cpp",
+ "src/core/Size3D.cpp",
"src/core/SubTensorInfo.cpp",
"src/core/TensorInfo.cpp",
"src/core/Utils.cpp",
diff --git a/arm_compute/core/Size3D.h b/arm_compute/core/Size3D.h
new file mode 100644
index 0000000000..1d8febe3ce
--- /dev/null
+++ b/arm_compute/core/Size3D.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2021 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_SIZE3D_H
+#define ARM_COMPUTE_SIZE3D_H
+
+#include <string>
+
+namespace arm_compute
+{
+/** Class for specifying the size of a 3D shape or object */
+class Size3D
+{
+public:
+ /** Default constructor */
+ Size3D() = default;
+ /** Constructor. Initializes "width", "height" and "depth" respectively with "w", "h" and "d"
+ *
+ * @param[in] w Width of the 3D shape or object
+ * @param[in] h Height of the 3D shape or object
+ * @param[in] d Depth of the 3D shape or object
+ */
+ Size3D(size_t w, size_t h, size_t d)
+ : width(w), height(h), depth(d)
+ {
+ }
+
+ /** Convert the values stored to string
+ *
+ * @return string of (width x height x depth).
+ */
+ std::string to_string() const;
+
+ /** Semantic accessor for width as x.
+ *
+ * @return x.
+ */
+ size_t x() const
+ {
+ return width;
+ }
+
+ /** Semantic accessor for height as y.
+ *
+ * @return y.
+ */
+ size_t y() const
+ {
+ return height;
+ }
+
+ /** Semantic accessor for depth as z.
+ *
+ * @return z.
+ */
+ size_t z() const
+ {
+ return depth;
+ }
+
+public:
+ size_t width = {}; /**< Width of the 3D shape or object */
+ size_t height = {}; /**< Height of the 3D shape or object */
+ size_t depth = {}; /**< Depth of the 3D shape or object */
+};
+
+/** Operator to compare two Size3D objects to be equal
+ *
+ * @param[in] lhs Left-hand side Size3D object.
+ * @param[in] rhs Right-hand side Size3D object.
+ *
+ * @return True if two instances have the same width, height and depth
+ */
+bool operator==(const Size3D &lhs, const Size3D &rhs);
+
+/** Operator to compare two Size3D objects to be different
+ *
+ * @param[in] lhs Left-hand side Size3D object.
+ * @param[in] rhs Right-hand side Size3D object.
+ *
+ * @return True if two instances have a difference in width, height or depth
+ */
+bool operator!=(const Size3D &lhs, const Size3D &rhs);
+
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_SIZE3D_H */
diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h
index 36b77b8224..31199e138b 100644
--- a/arm_compute/core/Types.h
+++ b/arm_compute/core/Types.h
@@ -27,6 +27,7 @@
#include "arm_compute/core/Coordinates.h"
#include "arm_compute/core/QuantizationInfo.h"
#include "arm_compute/core/Size2D.h"
+#include "arm_compute/core/Size3D.h"
#include "arm_compute/core/Strides.h"
#include "arm_compute/core/TensorShape.h"
#include "arm_compute/core/utils/misc/Macros.h"
@@ -112,7 +113,8 @@ enum class DataLayout
{
UNKNOWN, /**< Unknown data layout */
NCHW, /**< Num samples, channels, height, width */
- NHWC /**< Num samples, height, width, channels */
+ NHWC, /**< Num samples, height, width, channels */
+ NDHWC /**< Num samples, depth, height, width, channels */
};
/** [DataLayout enum definition] **/
@@ -760,6 +762,17 @@ private:
DimensionRoundingType _round_type;
};
+/** Padding information for 3D operations like Conv3d */
+struct Padding3D
+{
+ size_t left = { 0 }; /**< Padding across the width dimenstion on the left, in elements. */
+ size_t right = { 0 }; /**< Padding across the width dimenstion on the right, in elements. */
+ size_t top = { 0 }; /**< Padding across the height dimenstion on the top, in elements. */
+ size_t bottom = { 0 }; /**< Padding across the height dimenstion on the bottom, in elements. */
+ size_t front = { 0 }; /**< Padding across the depth dimenstion on the front, in elements. */
+ size_t back = { 0 }; /**< Padding across the depth dimenstion on the back, in elements. */
+};
+
/** PriorBox layer info */
class PriorBoxLayerInfo final
{
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index d0dc202f91..f18f5b7a42 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -28,6 +28,7 @@
#include "arm_compute/core/ITensorInfo.h"
#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/Utils.h"
+#include "arm_compute/runtime/FunctionDescriptors.h"
#include "arm_compute/core/utils/helpers/tensor_transform.h"
@@ -1383,6 +1384,71 @@ inline TensorShape compute_stack_shape(const ITensorInfo &a, unsigned int axis,
return shape_out;
}
+/** Calculate the output shape of 3d Convolution
+ *
+ * @param[in] src Input tensor shape
+ * @param[in] weights Weights tensor shape
+ * @param[in] conv3d_info 3d Convolution Parameters object
+ *
+ * @return the calculated shape
+ */
+inline TensorShape compute_conv3d_shape(const TensorShape &src, const TensorShape &weights, const Conv3dInfo &conv3d_info)
+{
+ // Weight tensor shape indices (D H W Cin Cout)
+ constexpr unsigned int weights_depth_dim = 4u;
+ constexpr unsigned int weights_height_dim = 3u;
+ constexpr unsigned int weights_width_dim = 2u;
+ constexpr unsigned int weights_CHout_dim = 0u;
+
+ // Source/Destination Tensor shape indices (N D H W C)
+ constexpr unsigned int batch_dim = 4u;
+ constexpr unsigned int depth_dim = 3u;
+ constexpr unsigned int height_dim = 2u;
+ constexpr unsigned int width_dim = 1u;
+ constexpr unsigned int channel_dim = 0u;
+
+ TensorShape output_shape{ src };
+ const size_t pad_left = conv3d_info.padding.left;
+ const size_t pad_right = conv3d_info.padding.right;
+ const size_t pad_top = conv3d_info.padding.top;
+ const size_t pad_bottom = conv3d_info.padding.bottom;
+ const size_t pad_front = conv3d_info.padding.front;
+ const size_t pad_back = conv3d_info.padding.back;
+ const size_t dilation_x = conv3d_info.dilation.width;
+ const size_t dilation_y = conv3d_info.dilation.height;
+ const size_t dilation_z = conv3d_info.dilation.depth;
+ const size_t stride_x = conv3d_info.stride.x();
+ const size_t stride_y = conv3d_info.stride.y();
+ const size_t stride_z = conv3d_info.stride.z();
+
+ int output_width_size = 0;
+ int output_height_size = 0;
+ int output_depth_size = 0;
+
+ switch(conv3d_info.round_type)
+ {
+ case DimensionRoundingType::FLOOR:
+ output_width_size = static_cast<int>(std::floor((static_cast<float>(src[width_dim] + pad_left + pad_right - (dilation_x * (weights[weights_width_dim] - 1) + 1)) / stride_x) + 1));
+ output_height_size = static_cast<int>(std::floor((static_cast<float>(src[height_dim] + pad_top + pad_bottom - (dilation_y * (weights[weights_height_dim] - 1) + 1)) / stride_y) + 1));
+ output_depth_size = static_cast<int>(std::floor((static_cast<float>(src[depth_dim] + pad_front + pad_back - (dilation_z * (weights[weights_depth_dim] - 1) + 1)) / stride_z) + 1));
+ break;
+ case DimensionRoundingType::CEIL:
+ output_width_size = static_cast<int>(std::ceil((static_cast<float>(src[width_dim] + pad_left + pad_right - (dilation_x * (weights[weights_width_dim] - 1) + 1)) / stride_x) + 1));
+ output_height_size = static_cast<int>(std::ceil((static_cast<float>(src[height_dim] + pad_top + pad_bottom - (dilation_y * (weights[weights_height_dim] - 1) + 1)) / stride_y) + 1));
+ output_depth_size = static_cast<int>(std::ceil((static_cast<float>(src[depth_dim] + pad_front + pad_back - (dilation_z * (weights[weights_depth_dim] - 1) + 1)) / stride_z) + 1));
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Unsupported rounding type");
+ }
+
+ output_shape.set(batch_dim, src[batch_dim]);
+ output_shape.set(width_dim, output_width_size);
+ output_shape.set(height_dim, output_height_size);
+ output_shape.set(depth_dim, output_depth_size);
+ output_shape.set(channel_dim, weights[weights_CHout_dim]);
+ return output_shape;
+}
+
inline TensorShape compute_gather_shape(const TensorShape &input_shape, const TensorShape &indices_shape, uint32_t actual_axis)
{
ARM_COMPUTE_ERROR_ON(indices_shape.num_dimensions() > 1);
diff --git a/arm_compute/runtime/FunctionDescriptors.h b/arm_compute/runtime/FunctionDescriptors.h
index 1f4216eb21..07a8f6600e 100644
--- a/arm_compute/runtime/FunctionDescriptors.h
+++ b/arm_compute/runtime/FunctionDescriptors.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020 Arm Limited.
+ * Copyright (c) 2019-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -52,7 +52,7 @@ struct FFT2DInfo
FFTDirection direction{ FFTDirection::Forward }; /**< Direction of the FFT. */
};
-/** Descriptor used by the Convolution function */
+/** Descriptor used by the 2d Convolution function */
struct Conv2dInfo
{
Conv2dInfo() = default;
@@ -72,5 +72,29 @@ struct Conv2dInfo
bool enable_fast_math{ false };
unsigned int num_groups{ 1 };
};
+
+/** Descriptor used by the 3d Convolution function */
+struct Conv3dInfo
+{
+ Conv3dInfo() = default;
+
+ Conv3dInfo(const Size3D &stride,
+ const Padding3D &padding,
+ const ActivationLayerInfo &act_info,
+ const Size3D &dilation,
+ const DimensionRoundingType &round_type,
+ bool enable_fast_math)
+ : stride(stride), padding(padding), act_info(act_info), dilation(dilation), round_type(round_type), enable_fast_math(enable_fast_math)
+ {
+ }
+
+ Size3D stride{ 1U, 1U, 1U };
+ Padding3D padding{};
+ ActivationLayerInfo act_info{};
+ Size3D dilation{ 1U, 1U, 1U };
+ DimensionRoundingType round_type{};
+ bool enable_fast_math{ false };
+};
+
} // namespace arm_compute
#endif /* ARM_COMPUTE_RUNTIME_FUNCTION_DESCRIPTORS_H */
diff --git a/src/core/Size3D.cpp b/src/core/Size3D.cpp
new file mode 100644
index 0000000000..4b7850bf38
--- /dev/null
+++ b/src/core/Size3D.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2021 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/Size3D.h"
+#include "support/StringSupport.h"
+
+namespace arm_compute
+{
+std::string Size3D::to_string() const
+{
+ return support::cpp11::to_string(width) + std::string("x") + support::cpp11::to_string(height) + std::string("x") + support::cpp11::to_string(depth);
+}
+
+bool operator!=(const Size3D &lhs, const Size3D &rhs)
+{
+ return !(lhs == rhs);
+}
+
+bool operator==(const Size3D &lhs, const Size3D &rhs)
+{
+ return (lhs.width == rhs.width) && (lhs.height == rhs.height) && (lhs.depth == rhs.depth);
+}
+} \ No newline at end of file
diff --git a/tests/validation/reference/Conv3D.cpp b/tests/validation/reference/Conv3D.cpp
new file mode 100644
index 0000000000..6f9ce9e2ac
--- /dev/null
+++ b/tests/validation/reference/Conv3D.cpp
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2021 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 "Conv3D.h"
+#include "arm_compute/core/utils/misc/ShapeCalculator.h"
+
+// Source/Destination Tensor shape indices (N D H W C)
+constexpr unsigned int batch_dim = 4u;
+constexpr unsigned int depth_dim = 3u;
+constexpr unsigned int height_dim = 2u;
+constexpr unsigned int width_dim = 1u;
+constexpr unsigned int channel_dim = 0u;
+
+// Weight tensor shape indices (D H W Cin Cout)
+constexpr unsigned int weights_depth_dim = 4u;
+constexpr unsigned int weights_height_dim = 3u;
+constexpr unsigned int weights_width_dim = 2u;
+constexpr unsigned int weights_CHin_dim = 1u;
+constexpr unsigned int weights_CHout_dim = 0u;
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+namespace
+{
+inline bool is_valid_pixel(int i, int min, int max)
+{
+ return (i >= min && i < max);
+}
+// Evaluate the weights against an element in a given tensor.
+template <typename T>
+T calculate_conv3d(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const Size3D &dilation, int batch,
+ int z_start, int y_start, int x_start, int ch_out)
+{
+ const unsigned int weights_width = weights.shape()[weights_width_dim];
+ const unsigned int weights_height = weights.shape()[weights_height_dim];
+ const unsigned int weights_depth = weights.shape()[weights_depth_dim];
+
+ const unsigned int src_channels = src.shape()[channel_dim];
+ const unsigned int src_width = src.shape()[width_dim];
+ const unsigned int src_height = src.shape()[height_dim];
+ const unsigned int src_depth = src.shape()[depth_dim];
+
+ T total(0);
+ for(unsigned int weight_d = 0; weight_d < weights_depth; ++weight_d)
+ {
+ const int idx_z = z_start + dilation.depth * weight_d;
+ for(unsigned int weight_y = 0; weight_y < weights_height; ++weight_y)
+ {
+ const int idx_y = y_start + dilation.height * weight_y;
+ for(unsigned int weight_x = 0; weight_x < weights_width; ++weight_x)
+ {
+ const int idx_x = x_start + dilation.width * weight_x;
+
+ //Check if the point is within padding
+ const bool is_x_valid = is_valid_pixel(idx_x, 0, src_width);
+ const bool is_y_valid = is_valid_pixel(idx_y, 0, src_height);
+ const bool is_z_valid = is_valid_pixel(idx_z, 0, src_depth);
+ const bool is_invalid_pixel = !(is_x_valid && is_y_valid && is_z_valid);
+ if(is_invalid_pixel)
+ {
+ continue;
+ }
+
+ for(unsigned int ch_in = 0; ch_in < src_channels; ++ch_in)
+ {
+ const T *in_ptr = src.data();
+ const T *w_ptr = weights.data();
+
+ const int in_offset = coord2index(src.shape(), Coordinates{ ch_in, idx_x, idx_y, idx_z, batch });
+ const int weight_offset = coord2index(weights.shape(), Coordinates{ ch_out, ch_in, weight_x, weight_y, weight_d });
+ T input_value = in_ptr[in_offset];
+ T weight_value = w_ptr[weight_offset];
+ total += (input_value * weight_value);
+ }
+ }
+ }
+ }
+ return total;
+}
+}
+
+template <typename T>
+SimpleTensor<T> conv3d(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<T> &bias, SimpleTensor<T> &dst, const Conv3dInfo &conv3d_info)
+{
+ // Compute reference
+ const unsigned int batch_size = src.shape()[batch_dim];
+ const unsigned int dst_width = dst.shape()[width_dim];
+ const unsigned int dst_height = dst.shape()[height_dim];
+ const unsigned int dst_depth = dst.shape()[depth_dim];
+ const unsigned int src_channels = src.shape()[channel_dim];
+ const unsigned int weights_out_ch = weights.shape()[weights_CHout_dim];
+ const unsigned int dst_channels = dst.shape()[channel_dim];
+ const size_t pad_left = conv3d_info.padding.left;
+ const size_t pad_top = conv3d_info.padding.top;
+ const size_t pad_front = conv3d_info.padding.front;
+ const size_t stride_x = conv3d_info.stride.x();
+ const size_t stride_y = conv3d_info.stride.y();
+ const size_t stride_z = conv3d_info.stride.z();
+
+ const TensorShape dst_shape = arm_compute::misc::shape_calculator::compute_conv3d_shape(src.shape(), weights.shape(), conv3d_info);
+
+ // Number of batches of source and destination tensors must match.
+ ARM_COMPUTE_ERROR_ON(src.shape()[batch_dim] != dst.shape()[batch_dim]);
+ // Input channels in the source and weights must match.
+ ARM_COMPUTE_ERROR_ON(src_channels != weights.shape()[weights_CHin_dim]);
+ // Weight channels in the destination and weights must match.
+ ARM_COMPUTE_ERROR_ON(weights_out_ch != dst_channels);
+ // Bias must match the number of destination channels.
+ ARM_COMPUTE_ERROR_ON(bias.shape()[0] != dst_channels);
+ // Compare given dst tensor shape with expected shape.
+ ARM_COMPUTE_ERROR_ON(dst.shape() != dst_shape);
+
+ for(unsigned int batch = 0; batch < batch_size; ++batch)
+ {
+ for(unsigned int z_out = 0; z_out < dst_depth; ++z_out)
+ {
+ const int z_start = (z_out * stride_z) - pad_left;
+ for(unsigned int y_out = 0; y_out < dst_height; ++y_out)
+ {
+ const int y_start = (y_out * stride_y) - pad_top;
+ for(unsigned int x_out = 0; x_out < dst_width; ++x_out)
+ {
+ const int x_start = (x_out * stride_x) - pad_front;
+ for(unsigned int ch_out = 0; ch_out < dst_channels; ++ch_out)
+ {
+ T weighted_value = calculate_conv3d<T>(src, weights, conv3d_info.dilation, batch, z_start,
+ y_start, x_start, ch_out);
+ T *out_ptr = dst.data();
+ const T *b_ptr = bias.data();
+ T bias_value(0);
+ const int out_offset = coord2index(dst.shape(), Coordinates{ ch_out, x_out, y_out, z_out, batch });
+ bias_value = b_ptr[ch_out];
+ out_ptr[out_offset] = weighted_value + bias_value;
+ }
+ }
+ }
+ }
+ }
+ return dst;
+}
+
+template SimpleTensor<float> conv3d(const SimpleTensor<float> &src, const SimpleTensor<float> &weights, const SimpleTensor<float> &bias, SimpleTensor<float> &dst,
+ const Conv3dInfo &conv3d_info);
+template SimpleTensor<half> conv3d(const SimpleTensor<half> &src, const SimpleTensor<half> &weights, const SimpleTensor<half> &bias, SimpleTensor<half> &dst,
+ const Conv3dInfo &conv3d_info);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute \ No newline at end of file
diff --git a/tests/validation/reference/Conv3D.h b/tests/validation/reference/Conv3D.h
new file mode 100644
index 0000000000..ade8a2c242
--- /dev/null
+++ b/tests/validation/reference/Conv3D.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2021 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_CONV3D_LAYER_H
+#define ARM_COMPUTE_TEST_CONV3D_LAYER_H
+
+#include "Utils.h"
+#include "arm_compute/runtime/FunctionDescriptors.h"
+#include "tests/SimpleTensor.h"
+#include "tests/validation/Helpers.h"
+
+namespace arm_compute
+{
+namespace test
+{
+namespace validation
+{
+namespace reference
+{
+template <typename T>
+SimpleTensor<T> conv3d(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<T> &bias, SimpleTensor<T> &dst,
+ const Conv3dInfo &conv3d_info);
+} // namespace reference
+} // namespace validation
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_CONV3D_LAYER_H */
diff --git a/utils/TypePrinter.h b/utils/TypePrinter.h
index 248c973b68..ee0135cce7 100644
--- a/utils/TypePrinter.h
+++ b/utils/TypePrinter.h
@@ -568,6 +568,9 @@ inline ::std::ostream &operator<<(::std::ostream &os, const DataLayout &data_lay
case DataLayout::NCHW:
os << "NCHW";
break;
+ case DataLayout::NDHWC:
+ os << "NDHWC";
+ break;
default:
ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
}