aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core
diff options
context:
space:
mode:
authorSiCong Li <sicong.li@arm.com>2023-07-21 18:16:13 +0100
committerSiCong Li <sicong.li@arm.com>2023-07-28 15:25:06 +0000
commit9129549110527fd53655d3e6b61e8e59bed6f97f (patch)
treec42e6c7bf2928897b82b7f8457ea540cf2b74a2e /arm_compute/core
parent0b23e0e6402cb18ddf621d36454cadbb73959518 (diff)
downloadComputeLibrary-9129549110527fd53655d3e6b61e8e59bed6f97f.tar.gz
Retain back-compatibility for arm_compute/core/Types.h
* Some symbols have been moved from core/Types.h. This patch retains back compatibility so that the user can still include this header for those symbols * A new header core/CoreTypes.h is created to avoid circular dependency. This header includes essential small types that are used across functions * Move all function info types into function_info folder for easier tracking Resolves COMPMID-6330 Related to https://review.mlplatform.org/c/ml/ComputeLibrary/+/9757 Signed-off-by: SiCong Li <sicong.li@arm.com> Change-Id: I4739175c2d4d184a9bc8e28b881b497fab03ca60 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9979 Reviewed-by: Jakub Sujak <jakub.sujak@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core')
-rw-r--r--arm_compute/core/ActivationLayerInfo.h111
-rw-r--r--arm_compute/core/ConvolutionInfo.h45
-rw-r--r--arm_compute/core/CoreTypes.h346
-rw-r--r--arm_compute/core/FullyConnectedLayerInfo.h71
-rw-r--r--arm_compute/core/GEMMInfo.h314
-rw-r--r--arm_compute/core/KernelDescriptors.h2
-rw-r--r--arm_compute/core/MatMulInfo.h79
-rw-r--r--arm_compute/core/Types.h401
-rw-r--r--arm_compute/core/experimental/PostOps.h2
-rw-r--r--arm_compute/core/utils/FormatUtils.h4
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h12
11 files changed, 396 insertions, 991 deletions
diff --git a/arm_compute/core/ActivationLayerInfo.h b/arm_compute/core/ActivationLayerInfo.h
deleted file mode 100644
index d9dc0a0702..0000000000
--- a/arm_compute/core/ActivationLayerInfo.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2016-2023 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_ACTIVATIONLAYERINFO_H
-#define ARM_COMPUTE_ACTIVATIONLAYERINFO_H
-
-#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/Types.h"
-#include "arm_compute/core/experimental/IPostOp.h"
-#include "arm_compute/core/utils/misc/Macros.h"
-#include "support/Bfloat16.h"
-#include "support/Half.h"
-
-#include <cmath>
-#include <cstddef>
-#include <cstdint>
-#include <map>
-#include <string>
-#include <utility>
-
-namespace arm_compute
-{
-/** Activation Layer Information class */
-class ActivationLayerInfo
-{
-public:
- typedef arm_compute::ActivationFunction ActivationFunction;
-
- /** Lookup table */
- using LookupTable256 = std::array<qasymm8_t, 256>;
-
- ActivationLayerInfo() = default;
- /** Default Constructor
- *
- * @param[in] f The activation function to use.
- * @param[in] a (Optional) The alpha parameter used by some activation functions
- * (@ref ActivationFunction::BOUNDED_RELU, @ref ActivationFunction::LU_BOUNDED_RELU, @ref ActivationFunction::LINEAR, @ref ActivationFunction::TANH).
- * @param[in] b (Optional) The beta parameter used by some activation functions (@ref ActivationFunction::LINEAR, @ref ActivationFunction::LU_BOUNDED_RELU, @ref ActivationFunction::TANH).
- */
- ActivationLayerInfo(ActivationFunction f, float a = 0.0f, float b = 0.0f)
- : _act(f), _a(a), _b(b), _enabled(true)
- {
- }
- /** Get the type of activation function */
- ActivationFunction activation() const
- {
- return _act;
- }
- /** Get the alpha value */
- float a() const
- {
- return _a;
- }
- /** Get the beta value */
- float b() const
- {
- return _b;
- }
- /** Check if initialised */
- bool enabled() const
- {
- return _enabled;
- }
-
-#ifdef __aarch64__
- const LookupTable256 &lut() const
- {
- return _lut;
- }
- void setLookupTable256(LookupTable256 &lut)
- {
- _lut = std::move(lut);
- }
-#endif // __aarch64__
-private:
- ActivationFunction _act = { ActivationLayerInfo::ActivationFunction::IDENTITY };
- float _a = {};
- float _b = {};
- bool _enabled = { false };
-
-#ifdef __aarch64__
- LookupTable256 _lut = {};
-#endif // __aarch64__
-};
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_ACTIVATIONLAYERINFO_H */
diff --git a/arm_compute/core/ConvolutionInfo.h b/arm_compute/core/ConvolutionInfo.h
deleted file mode 100644
index 1b5e5d197b..0000000000
--- a/arm_compute/core/ConvolutionInfo.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2016-2023 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_CONVOLUTIONINFO_H
-#define ARM_COMPUTE_CONVOLUTIONINFO_H
-
-#include "arm_compute/core/ActivationLayerInfo.h"
-#include "arm_compute/core/Types.h"
-
-namespace arm_compute
-{
-struct ConvolutionInfo
-{
- ConvolutionInfo() = default;
- ConvolutionInfo(const PadStrideInfo &pad_stride_info, unsigned int depth_multiplier, const ActivationLayerInfo &act_info, const Size2D &dilation)
- : pad_stride_info(pad_stride_info), depth_multiplier(depth_multiplier), act_info(act_info), dilation(dilation)
- {
- }
- PadStrideInfo pad_stride_info{}; /**< Convolution info (Pads, strides,...) */
- unsigned int depth_multiplier{ 1 }; /**< Multiplier to apply to input's depth to retrieve the output depth. Defaults to 1 */
- ActivationLayerInfo act_info{}; /**< Fused activation to apply after convolution. */
- Size2D dilation{ Size2D(1, 1) }; /**< Dilation, in elements, across x and y. Defaults to (1, 1). */
-};
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_CONVOLUTIONINFO_H */
diff --git a/arm_compute/core/CoreTypes.h b/arm_compute/core/CoreTypes.h
new file mode 100644
index 0000000000..4a48a36651
--- /dev/null
+++ b/arm_compute/core/CoreTypes.h
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2016-2023 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 ACL_ARM_COMPUTE_CORE_CORETYPES
+#define ACL_ARM_COMPUTE_CORE_CORETYPES
+
+#include "arm_compute/core/Strides.h"
+#include "support/Half.h"
+
+/** CoreTypes.h groups together essential small types that are used across functions */
+
+namespace arm_compute
+{
+/** 16-bit floating point type */
+using half = half_float::half;
+/** Permutation vector */
+using PermutationVector = Strides;
+
+/** Available channels */
+enum class Channel
+{
+ UNKNOWN, /** Unknown channel format */
+ C0, /**< First channel (used by formats with unknown channel types). */
+ C1, /**< Second channel (used by formats with unknown channel types). */
+ C2, /**< Third channel (used by formats with unknown channel types). */
+ C3, /**< Fourth channel (used by formats with unknown channel types). */
+ R, /**< Red channel. */
+ G, /**< Green channel. */
+ B, /**< Blue channel. */
+ A, /**< Alpha channel. */
+ Y, /**< Luma channel. */
+ U, /**< Cb/U channel. */
+ V /**< Cr/V/Value channel. */
+};
+
+/** Image colour formats */
+enum class Format
+{
+ UNKNOWN, /**< Unknown image format */
+ U8, /**< 1 channel, 1 U8 per channel */
+ S16, /**< 1 channel, 1 S16 per channel */
+ U16, /**< 1 channel, 1 U16 per channel */
+ S32, /**< 1 channel, 1 S32 per channel */
+ U32, /**< 1 channel, 1 U32 per channel */
+ S64, /**< 1 channel, 1 S64 per channel */
+ U64, /**< 1 channel, 1 U64 per channel */
+ BFLOAT16, /**< 16-bit brain floating-point number */
+ F16, /**< 1 channel, 1 F16 per channel */
+ F32, /**< 1 channel, 1 F32 per channel */
+ UV88, /**< 2 channel, 1 U8 per channel */
+ RGB888, /**< 3 channels, 1 U8 per channel */
+ RGBA8888, /**< 4 channels, 1 U8 per channel */
+ YUV444, /**< A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes */
+ YUYV422, /**< A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes */
+ NV12, /**< A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling */
+ NV21, /**< A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling */
+ IYUV, /**< A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes */
+ UYVY422 /**< A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte */
+};
+
+/** Available data types */
+enum class DataType
+{
+ UNKNOWN, /**< Unknown data type */
+ U8, /**< unsigned 8-bit number */
+ S8, /**< signed 8-bit number */
+ QSYMM8, /**< quantized, symmetric fixed-point 8-bit number */
+ QASYMM8, /**< quantized, asymmetric fixed-point 8-bit number unsigned */
+ QASYMM8_SIGNED, /**< quantized, asymmetric fixed-point 8-bit number signed */
+ QSYMM8_PER_CHANNEL, /**< quantized, symmetric per channel fixed-point 8-bit number */
+ U16, /**< unsigned 16-bit number */
+ S16, /**< signed 16-bit number */
+ QSYMM16, /**< quantized, symmetric fixed-point 16-bit number */
+ QASYMM16, /**< quantized, asymmetric fixed-point 16-bit number */
+ U32, /**< unsigned 32-bit number */
+ S32, /**< signed 32-bit number */
+ U64, /**< unsigned 64-bit number */
+ S64, /**< signed 64-bit number */
+ BFLOAT16, /**< 16-bit brain floating-point number */
+ F16, /**< 16-bit floating-point number */
+ F32, /**< 32-bit floating-point number */
+ F64, /**< 64-bit floating-point number */
+ SIZET /**< size_t */
+};
+
+/** [DataLayout enum definition] **/
+
+/** Supported tensor data layouts */
+enum class DataLayout
+{
+ UNKNOWN, /**< Unknown data layout */
+ NCHW, /**< Num samples, channels, height, width */
+ NHWC, /**< Num samples, height, width, channels */
+ NCDHW, /**< Num samples, channels, depth, height, width */
+ NDHWC /**< Num samples, depth, height, width, channels */
+};
+/** [DataLayout enum definition] **/
+
+/** Supported tensor data layout dimensions */
+enum class DataLayoutDimension
+{
+ CHANNEL, /**< channel */
+ HEIGHT, /**< height */
+ WIDTH, /**< width */
+ DEPTH, /**< depth */
+ BATCHES /**< batches */
+};
+
+/** Dimension rounding type when down-scaling on CNNs
+ * @note Used in pooling and convolution layer
+ */
+enum class DimensionRoundingType
+{
+ FLOOR, /**< Floor rounding */
+ CEIL /**< Ceil rounding */
+};
+
+class PadStrideInfo
+{
+public:
+ /** Constructor
+ *
+ * @param[in] stride_x (Optional) Stride, in elements, across x. Defaults to 1.
+ * @param[in] stride_y (Optional) Stride, in elements, across y. Defaults to 1.
+ * @param[in] pad_x (Optional) Padding, in elements, across x. Defaults to 0.
+ * @param[in] pad_y (Optional) Padding, in elements, across y. Defaults to 0.
+ * @param[in] round (Optional) Dimensions rounding. Defaults to @ref DimensionRoundingType::FLOOR.
+ */
+ PadStrideInfo(unsigned int stride_x = 1, unsigned int stride_y = 1,
+ unsigned int pad_x = 0, unsigned int pad_y = 0,
+ DimensionRoundingType round = DimensionRoundingType::FLOOR)
+ : _stride(std::make_pair(stride_x, stride_y)),
+ _pad_left(pad_x),
+ _pad_top(pad_y),
+ _pad_right(pad_x),
+ _pad_bottom(pad_y),
+ _round_type(round)
+ {
+ }
+ /** Constructor
+ *
+ * @param[in] stride_x Stride, in elements, across x.
+ * @param[in] stride_y Stride, in elements, across y.
+ * @param[in] pad_left Padding across x on the left, in elements.
+ * @param[in] pad_right Padding across x on the right, in elements.
+ * @param[in] pad_top Padding across y on the top, in elements.
+ * @param[in] pad_bottom Padding across y on the bottom, in elements.
+ * @param[in] round Dimensions rounding.
+ */
+ PadStrideInfo(unsigned int stride_x, unsigned int stride_y,
+ unsigned int pad_left, unsigned int pad_right,
+ unsigned int pad_top, unsigned int pad_bottom,
+ DimensionRoundingType round)
+ : _stride(std::make_pair(stride_x, stride_y)),
+ _pad_left(pad_left),
+ _pad_top(pad_top),
+ _pad_right(pad_right),
+ _pad_bottom(pad_bottom),
+ _round_type(round)
+ {
+ }
+ /** Get the stride.
+ *
+ * @return a pair: stride x, stride y.
+ */
+ std::pair<unsigned int, unsigned int> stride() const
+ {
+ return _stride;
+ }
+ /** Check whether the padding is symmetric.
+ *
+ * @return True if the padding is symmetric.
+ */
+ bool padding_is_symmetric() const
+ {
+ return (_pad_left == _pad_right) && (_pad_top == _pad_bottom);
+ }
+ /** Get the padding.
+ *
+ * @note This should only be used when the padding is symmetric.
+ *
+ * @return a pair: padding left/right, padding top/bottom
+ */
+ std::pair<unsigned int, unsigned int> pad() const
+ {
+ //this accessor should be used only when padding is symmetric
+ ARM_COMPUTE_ERROR_ON(!padding_is_symmetric());
+ return std::make_pair(_pad_left, _pad_top);
+ }
+
+ /** Get the left padding */
+ unsigned int pad_left() const
+ {
+ return _pad_left;
+ }
+ /** Get the right padding */
+ unsigned int pad_right() const
+ {
+ return _pad_right;
+ }
+ /** Get the top padding */
+ unsigned int pad_top() const
+ {
+ return _pad_top;
+ }
+ /** Get the bottom padding */
+ unsigned int pad_bottom() const
+ {
+ return _pad_bottom;
+ }
+
+ /** Get the rounding type */
+ DimensionRoundingType round() const
+ {
+ return _round_type;
+ }
+
+ /** Check whether this has any padding */
+ bool has_padding() const
+ {
+ return (_pad_left != 0 || _pad_top != 0 || _pad_right != 0 || _pad_bottom != 0);
+ }
+
+private:
+ std::pair<unsigned int, unsigned int> _stride;
+ unsigned int _pad_left;
+ unsigned int _pad_top;
+ unsigned int _pad_right;
+ unsigned int _pad_bottom;
+
+ DimensionRoundingType _round_type;
+};
+
+/** Memory layouts for the weights tensor.
+ *
+ * * UNSPECIFIED is used to select kernels that do not run in
+ * variable weights mode.
+ *
+ * * ANY is used to query the kernel database to retrieve any of the
+ * kernels that runs in variable weights mode. Once a kernel is
+ * found, the specific format expected by the kernel can be
+ * retrieved by the user for reordering the weights tensor
+ * accordingly.
+ *
+ * The other values OHWIo{interleave_by}i{block_by} describe the
+ * memory layout of a 4D tensor with layout OHWI that has been
+ * transformed into a 4D tensor with dimensions O'HWI' where:
+ *
+ * O' = first multiple of {interleave_by} s.t. O<=O'
+ * I' = first multiple of {block_by} s.t. I<=I'
+ *
+ * The total size of the dst tensor is O' x H x W x I'
+ *
+ * The access function of the tensor with layout
+ * OHWIo{interleave_by}i{block_by} and size O'HWI' is a 6-parameter
+ * access function, where the 6 parameters are computed as follows:
+ *
+ * x5 = floor(o/{interleave_by}) RANGE [0, O'/{interleave_by} -1] SIZE: O'/{interleave_by}
+ *
+ * x4 = h RANGE [0, H-1] SIZE: H
+ * x3 = w RANGE [0, W-1] SIZE: W
+ * x2 = floor(i/{block_by}) RANGE [0, I'/{block_by} -1] SIZE: I'/{block_by}
+ * x1 = o%{interleave_by} RANGE [0, {interleave_by} -1] SIZE: {interleave_by}
+ * x0 = i%{block_by} RANGE [0, {block_by} -1] SIZE: {block_by}
+ * TOTAL SIZE: O' * H * W * I'
+ *
+ * 4D 6D
+ * ----------------- -----------------------------------
+ * value(o, h, w, i) = x5 * H * W * I' * {interleave_by}
+ * + x4 * W * I' * {interleave_by}
+ * + x3 * I' * {interleave_by}
+ * + x2 * {interleave_by} * {block_by}
+ * + x1 * {block_by}
+ * + x0
+ *
+ * Notice that in arm_gemm the 4D tensor of dimension O'HWI' created
+ * for the OHWIo{interleave_by}i{block_by} format is in reality seen
+ * as a 2D tensor, where the number of rows is O'/{interleave_by}
+ * and the number of columns is {interleave_by} * H * W * I'.
+ *
+ * The postfix *_bf16 is for the memory layout needed for the
+ * fast-mode kernels, in which the weights are passed in bfloat16
+ * format.
+ */
+enum class WeightFormat
+{
+ UNSPECIFIED = 0x1,
+ ANY = 0x2,
+ OHWI = 0x100100,
+ OHWIo2 = 0x100200,
+ OHWIo4 = 0x100400,
+ OHWIo8 = 0x100800,
+ OHWIo16 = 0x101000,
+ OHWIo32 = 0x102000,
+ OHWIo64 = 0x104000,
+ OHWIo128 = 0x108000,
+ OHWIo4i2 = 0x200400,
+ OHWIo4i2_bf16 = 0x200410,
+ OHWIo8i2 = 0x200800,
+ OHWIo8i2_bf16 = 0x200810,
+ OHWIo16i2 = 0x201000,
+ OHWIo16i2_bf16 = 0x201010,
+ OHWIo32i2 = 0x202000,
+ OHWIo32i2_bf16 = 0x202010,
+ OHWIo64i2 = 0x204000,
+ OHWIo64i2_bf16 = 0x204010,
+ OHWIo4i4 = 0x400400,
+ OHWIo4i4_bf16 = 0x400410,
+ OHWIo8i4 = 0x400800,
+ OHWIo8i4_bf16 = 0x400810,
+ OHWIo16i4 = 0x401000,
+ OHWIo16i4_bf16 = 0x401010,
+ OHWIo32i4 = 0x402000,
+ OHWIo32i4_bf16 = 0x402010,
+ OHWIo64i4 = 0x404000,
+ OHWIo64i4_bf16 = 0x404010,
+ OHWIo2i8 = 0x800200,
+ OHWIo4i8 = 0x800400,
+ OHWIo8i8 = 0x800800,
+ OHWIo16i8 = 0x801000,
+ OHWIo32i8 = 0x802000,
+ OHWIo64i8 = 0x804000
+};
+
+} // namespace arm_compute
+#endif /* ACL_ARM_COMPUTE_CORE_CORETYPES */
diff --git a/arm_compute/core/FullyConnectedLayerInfo.h b/arm_compute/core/FullyConnectedLayerInfo.h
deleted file mode 100644
index f699cb2792..0000000000
--- a/arm_compute/core/FullyConnectedLayerInfo.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2016-2023 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_FULLYCONNECTEDLAYERINFO_H
-#define ARM_COMPUTE_FULLYCONNECTEDLAYERINFO_H
-
-#include "arm_compute/core/ActivationLayerInfo.h"
-#include "arm_compute/core/Types.h"
-
-namespace arm_compute
-{
-/** Fully connected layer info */
-struct FullyConnectedLayerInfo
-{
- /* Fused-activation parameters */
- ActivationLayerInfo activation_info{}; /**< Fused activation to apply after the matrix multiplication. */
- /* Information about weights */
- DataLayout weights_trained_layout{ DataLayout::NCHW }; /**< Layout that the weights have been trained with. */
- bool transpose_weights{ true }; /**< Transpose weights if true. */
- bool are_weights_reshaped{ false }; /**< @deprecated Reshape the weights tensor if false. */
- bool retain_internal_weights{ false }; /**< Retain internal reshaped weights. */
- bool enable_fast_math{ false }; /**< Enable fast math computation. */
- /* Other parameters */
- bool fp_mixed_precision{ false }; /**< Use wider accumulators (32 bit instead of 16 for FP16) to improve accuracy. */
-
- /** Sets the weights trained data layout
- *
- * @param[in] layout Data layout that the weights were trained with
- *
- * @return Updated object
- */
- FullyConnectedLayerInfo &set_weights_trained_layout(DataLayout layout)
- {
- weights_trained_layout = layout;
- return *this;
- }
- /** Sets the transpose weights flag
- *
- * @param[in] should_transpose_weights Boolean flag indicating if weights should be transposed
- *
- * @return Updated object
- */
- FullyConnectedLayerInfo &set_transpose_weights(bool should_transpose_weights)
- {
- transpose_weights = should_transpose_weights;
- return *this;
- }
-};
-
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_FULLYCONNECTEDLAYERINFO_H */
diff --git a/arm_compute/core/GEMMInfo.h b/arm_compute/core/GEMMInfo.h
deleted file mode 100644
index 4c8e94a315..0000000000
--- a/arm_compute/core/GEMMInfo.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Copyright (c) 2016-2023 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_GEMMINFO_H
-#define ARM_COMPUTE_GEMMINFO_H
-
-#include "arm_compute/core/ActivationLayerInfo.h"
-#include "arm_compute/core/Types.h"
-
-namespace arm_compute
-{
-/** GEMM information class. This class stores the necessary information to compute GEMM functions
- *
- * This object also contains the information about how matrix A and matrix B have been reshaped
- *
- */
-class GEMMInfo
-{
-public:
- /** Default constructor */
- GEMMInfo() noexcept
- : _is_a_reshaped(false),
- _is_b_reshaped(false),
- _reshape_b_only_on_first_run(true),
- _depth_output_gemm3d(0),
- _reinterpret_input_as_3d(false),
- _retain_internal_weights(false),
- _gemmlowp_output_stage(),
- _fast_math(false),
- _fp_mixed_precision(false),
- _broadcast_bias(false),
- _pretranspose_A(false),
- _pretranspose_B(false),
- _activation_info(),
- _post_ops(),
- _fixed_format(false),
- _weight_format(arm_compute::WeightFormat::UNSPECIFIED)
- {
- }
- /** Constructor
- *
- * @param[in] is_a_reshaped True if the matrix A has been reshaped
- * @param[in] is_b_reshaped True if the matrix B has been reshaped
- * @param[in] reshape_b_only_on_first_run Reshape matrix B only for the first run
- * @param[in] depth_output_gemm3d (Optional) Depth (third dimension) of the output tensor to be used with the GEMM3D kernel
- * If 0 the output will not be reinterpreted as 3D. Default 0
- * @param[in] reinterpret_input_as_3d (Optional) Reinterpret the input as 3D tensor. (i.e. this flag should be set to true when GEMM is used
- * to perform 1x1 convolutions with the NHWC data layout)
- * @param[in] retain_internal_weights (Optional) Retain the weights tensor from previous run
- * @param[in] gemmlowp_output_stage (Optional) GEMMLowp Output stage info
- * @param[in] fp_mixed_precision (Optional) Use wider accumulators (32 bit instead of 16 for FP16) to improve accuracy.
- * @param[in] fast_math (Optional) Use a data type of shorter width to improve performance
- * @param[in] broadcast_bias (Optional) Broadcast the shape of the bias tensor from a vector to a matrix.
- * @param[in] activation_info (Optional) Activation to apply after the matrix multiplication
- * @param[in] post_ops (Optional) A sequence of post operations that are performed after the main operation.
- * @param[in] fixed_format (Optional) Specify the selection of fixed format kernels for variable weights support in GEMM. These kernels expect the weights tensor to be in amemory format that is fixed by the kernel itself. For more information, see arm_compute::WeightFormat.
- * @param[in] weight_format (Optional) arm_gemm:WeightFormat enumeration requested by the user. Default is arm_compute::WeightFormat::UNSPECIFIED.
- */
- GEMMInfo(bool is_a_reshaped, bool is_b_reshaped, bool reshape_b_only_on_first_run, int depth_output_gemm3d = 0, bool reinterpret_input_as_3d = false, bool retain_internal_weights = false,
- GEMMLowpOutputStageInfo gemmlowp_output_stage = GEMMLowpOutputStageInfo(), bool fp_mixed_precision = false, bool fast_math = false, bool broadcast_bias = false,
- const ActivationLayerInfo &activation_info = ActivationLayerInfo(), const experimental::PostOpList<ITensorInfo *> &post_ops = experimental::PostOpList<ITensorInfo *>(),
- bool fixed_format = false, arm_compute::WeightFormat weight_format = arm_compute::WeightFormat::UNSPECIFIED) noexcept
- : _is_a_reshaped(is_a_reshaped),
- _is_b_reshaped(is_b_reshaped),
- _reshape_b_only_on_first_run(reshape_b_only_on_first_run),
- _depth_output_gemm3d(depth_output_gemm3d),
- _reinterpret_input_as_3d(reinterpret_input_as_3d),
- _retain_internal_weights(retain_internal_weights),
- _gemmlowp_output_stage(gemmlowp_output_stage),
- _fast_math(fast_math),
- _fp_mixed_precision(fp_mixed_precision),
- _broadcast_bias(broadcast_bias),
- _pretranspose_A(false),
- _pretranspose_B(false),
- _activation_info(activation_info),
- _post_ops(post_ops),
- _fixed_format(fixed_format),
- _weight_format(weight_format)
- {
- }
- /** Flag which specifies if the matrix A has been reshaped
- *
- * @return True if the matrix A has been reshaped
- */
- bool is_a_reshaped() const
- {
- return _is_a_reshaped;
- };
- /** Flag which specifies if the matrix B has been reshaped
- *
- * @return True if the matrix B has been reshaped
- */
- bool is_b_reshaped() const
- {
- return _is_b_reshaped;
- };
- /** Flag which specifies if the reshape of matrix B should executed only for the first
- *
- * @note This flag could be set to TRUE when GEMM is used to accelerate convolution layer
- *
- * @return True if the reshaped of matrix B happens only for the first run
- */
- bool reshape_b_only_on_first_run() const
- {
- return _reshape_b_only_on_first_run;
- };
- /** Depth of the output when GEMM output is reinterpreted as 3D tensor
- *
- * @return the depth of the output tensor
- */
- int depth_output_gemm3d() const
- {
- return _depth_output_gemm3d;
- };
- /** Flag which specifies if the input tensor has to be reinterpreted as 3D
- *
- * @return True if the input tensor has to be reinterpreted as 3D tensor
- */
- bool reinterpret_input_as_3d() const
- {
- return _reinterpret_input_as_3d;
- };
- /** Flag which specifies if the weights tensor has to be retained from previous run
- *
- * @return True if the weights tensor has to be retained
- */
- bool retain_internal_weights() const
- {
- return _retain_internal_weights;
- };
- /** GEMMLowp output stage
- *
- * @return the GEMMLowp output stage info
- */
- GEMMLowpOutputStageInfo gemmlowp_output_stage() const
- {
- return _gemmlowp_output_stage;
- };
- /** Sets GEMMLowp output stage
- *
- * @param[in] output_stage Output stage to set
- */
- void set_gemmlowp_output_stage(GEMMLowpOutputStageInfo &output_stage)
- {
- _gemmlowp_output_stage = output_stage;
- };
- /** Flag which specifies if a wider accumulator should be used.
- *
- * @return True if a wider accumulator has to be used
- */
- bool fp_mixed_precision() const
- {
- return _fp_mixed_precision;
- };
- /** Flag which specifies if a shorter accumulator to be used.
- *
- * @return True if a shorter accumulator has to be used
- */
- bool fast_math() const
- {
- return _fast_math;
- };
- /** Set fast math flag
- *
- * @param[in] fast_math Flag to set
- */
- void set_fast_math(bool fast_math)
- {
- _fast_math = fast_math;
- }
- /** Flag which specifies whether to broadcast the shape of the bias tensor.
- *
- * @return True if the shape of the bias tensor is to be broadcasted.
- */
- bool broadcast_bias() const
- {
- return _broadcast_bias;
- };
- /** Flag which specifies whether A should be pre-transposed if supported.
- *
- * @return True if A should be pre-transposed else false.
- */
- bool pretranspose_A() const
- {
- return _pretranspose_A;
- };
- /** Set pre-transpose A flag
- *
- * @param[in] flag Flag to set
- */
- void set_pretranspose_A(bool flag)
- {
- _pretranspose_A = flag;
- }
- /** Flag which specifies whether b should be pre-transposed if supported.
- *
- * @return True if b should be pre-transposed else false.
- */
- bool pretranspose_B() const
- {
- return _pretranspose_B;
- };
- /** Set pre-transpose b flag
- *
- * @param[in] flag Flag to set
- */
- void set_pretranspose_B(bool flag)
- {
- _pretranspose_B = flag;
- }
- /** Activation layer to apply after the matrix multiplication
- *
- * @return ActivationLayerInfo object
- */
- ActivationLayerInfo activation_info() const
- {
- return _activation_info;
- }
- /** Set activation layer info
- *
- * @param[in] activation_info ActivationLayerInfo object to set
- */
- void set_activation_info(const ActivationLayerInfo &activation_info)
- {
- _activation_info = activation_info;
- }
- /** Post operations to apply after the matrix multiplication
- *
- * @return experimental::PostOpList object
- */
- const experimental::PostOpList<ITensorInfo *> &post_ops() const
- {
- return _post_ops;
- }
- /** Set post ops
- *
- * @param[in] post_ops experimental::PostOpList object to set
- */
- void set_post_ops(const experimental::PostOpList<ITensorInfo *> &post_ops)
- {
- _post_ops = post_ops;
- }
- /** Flag which specifies if the GEMM operation is running fixed-format kernels.
- *
- * @return True if the GEMM operation is running fixed-format kernel else false.
- */
- bool fixed_format() const
- {
- return _fixed_format;
- }
-
- /** Set fixed-format flag
- *
- * @param[in] fixed_format sets whether or not to use fixed-format kernels
- */
- void set_fixed_format(bool fixed_format)
- {
- _fixed_format = fixed_format;
- }
-
- arm_compute::WeightFormat weight_format() const
- {
- return _weight_format;
- }
-
- /** Set weight format to be used
- *
- * @param[in] weight_format arm_compute::WeightFormat enumeration
- */
- void set_weight_format(arm_compute::WeightFormat weight_format)
- {
- _weight_format = weight_format;
- }
-
-private:
- bool _is_a_reshaped;
- bool _is_b_reshaped;
- bool _reshape_b_only_on_first_run;
- int _depth_output_gemm3d;
- bool _reinterpret_input_as_3d;
- bool _retain_internal_weights;
- GEMMLowpOutputStageInfo _gemmlowp_output_stage;
- bool _fast_math;
- bool _fp_mixed_precision;
- bool _broadcast_bias;
- bool _pretranspose_A;
- bool _pretranspose_B;
- ActivationLayerInfo _activation_info;
- experimental::PostOpList<ITensorInfo *> _post_ops;
- bool _fixed_format;
- arm_compute::WeightFormat _weight_format;
-};
-} //namespace arm_compute
-#endif /* ARM_COMPUTE_GEMMINFO_H */
diff --git a/arm_compute/core/KernelDescriptors.h b/arm_compute/core/KernelDescriptors.h
index 1ce37d31c1..305766e825 100644
--- a/arm_compute/core/KernelDescriptors.h
+++ b/arm_compute/core/KernelDescriptors.h
@@ -26,8 +26,8 @@
#include "arm_compute/core/PixelValue.h"
#include "arm_compute/core/Types.h"
-#include "arm_compute/core/ActivationLayerInfo.h"
#include "arm_compute/core/experimental/IPostOp.h"
+#include "arm_compute/function_info/ActivationLayerInfo.h"
namespace arm_compute
{
diff --git a/arm_compute/core/MatMulInfo.h b/arm_compute/core/MatMulInfo.h
deleted file mode 100644
index 01b9b47761..0000000000
--- a/arm_compute/core/MatMulInfo.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2016-2023 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_MATMULINFO_H
-#define ARM_COMPUTE_MATMULINFO_H
-
-#include "arm_compute/core/Coordinates.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/experimental/IPostOp.h"
-#include "arm_compute/core/utils/misc/Macros.h"
-#include "support/Bfloat16.h"
-#include "support/Half.h"
-
-#include <cmath>
-#include <cstddef>
-#include <cstdint>
-#include <map>
-#include <string>
-#include <utility>
-
-namespace arm_compute
-{
-/** Class for holding information related to matrix multiplication function
- */
-class MatMulInfo
-{
-public:
- /* Get Adjoint LHS flag value */
- bool adj_lhs() const
- {
- return _adj_lhs;
- }
- /* Get Adjoint RHS flag value */
- bool adj_rhs() const
- {
- return _adj_rhs;
- }
- /* Set Adjoint LHS flag */
- MatMulInfo &adj_lhs(bool adj_lhs)
- {
- _adj_lhs = adj_lhs;
- return *this;
- }
- /* Set Adjoint RHS flag */
- MatMulInfo &adj_rhs(bool adj_rhs)
- {
- _adj_rhs = adj_rhs;
- return *this;
- }
-
-private:
- bool _adj_lhs{ false };
- bool _adj_rhs{ false };
-};
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_MATMULINFO_H */
diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h
index a69177ed80..12d860205e 100644
--- a/arm_compute/core/Types.h
+++ b/arm_compute/core/Types.h
@@ -21,18 +21,53 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_TYPES_H
-#define ARM_COMPUTE_TYPES_H
+#ifndef ACL_ARM_COMPUTE_CORE_TYPES
+#define ACL_ARM_COMPUTE_CORE_TYPES
+
+/** The following symbols have been moved to:
+ * half
+ * PermutationVector
+ * Format
+ * DataType
+ * DataLayout
+ * DataLayoutDimension
+ * PadStrideInfo
+ * WeightFormat
+ * Channel
+ * DimensionRoundingType
+ */
+#include "arm_compute/core/CoreTypes.h"
+/** The following symbols have been moved to:
+ * ActivationFunction
+ * ActivationLayerInfo
+ */
+#include "arm_compute/function_info/ActivationLayerInfo.h"
+/** The following symbols have been moved to:
+ * ConvolutionInfo
+ */
+#include "arm_compute/function_info/ConvolutionInfo.h"
+/** The following symbols have been moved to:
+ * FullyConnectedLayerInfo
+ */
+#include "arm_compute/function_info/FullyConnectedLayerInfo.h"
+/** The following symbols have been moved to:
+ * GEMMLowpOutputStageType
+ * GEMMLowpOutputStageInfo
+ * GEMMInfo
+ */
+#include "arm_compute/function_info/GEMMInfo.h"
+/** The following symbols have been moved to:
+ * MatMulInfo
+ */
+#include "arm_compute/function_info/MatMulInfo.h"
#include "arm_compute/core/Coordinates.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/experimental/IPostOp.h"
#include "arm_compute/core/utils/misc/Macros.h"
#include "support/Bfloat16.h"
-#include "support/Half.h"
#include <cmath>
#include <cstddef>
@@ -43,85 +78,9 @@
namespace arm_compute
{
-/** 16-bit floating point type */
-using half = half_float::half;
-
-/** Permutation vector */
-using PermutationVector = Strides;
/** Bidirectional strides */
using BiStrides = Coordinates;
-/** Available activation functions */
-enum class ActivationFunction
-{
- LOGISTIC, /**< Logistic ( \f$ f(x) = \frac{1}{1 + e^{-x}} \f$ ) */
- TANH, /**< Hyperbolic tangent ( \f$ f(x) = a \cdot tanh(b \cdot x) \f$ ) */
- RELU, /**< Rectifier ( \f$ f(x) = max(0,x) \f$ ) */
- BOUNDED_RELU, /**< Upper Bounded Rectifier ( \f$ f(x) = min(a, max(0,x)) \f$ ) */
- LU_BOUNDED_RELU, /**< Lower and Upper Bounded Rectifier ( \f$ f(x) = min(a, max(b,x)) \f$ ) */
- LEAKY_RELU, /**< Leaky Rectifier ( \f$ f(x) = \begin{cases} \alpha x & \quad \text{if } x \text{ < 0}\\ x & \quad \text{if } x \geq \text{ 0 } \end{cases} \f$ ) */
- SOFT_RELU, /**< Soft Rectifier ( \f$ f(x)= log(1+e^x) \f$ ) */
- ELU, /**< Exponential Linear Unit ( \f$ f(x) = \begin{cases} \alpha (exp(x) - 1) & \quad \text{if } x \text{ < 0}\\ x & \quad \text{if } x \geq \text{ 0 } \end{cases} \f$ ) */
- ABS, /**< Absolute ( \f$ f(x)= |x| \f$ ) */
- SQUARE, /**< Square ( \f$ f(x)= x^2 \f$ )*/
- SQRT, /**< Square root ( \f$ f(x) = \sqrt{x} \f$ )*/
- LINEAR, /**< Linear ( \f$ f(x)= ax + b \f$ ) */
- IDENTITY, /**< Identity ( \f$ f(x)= x \f$ ) */
- HARD_SWISH, /**< Hard-swish ( \f$ f(x) = (x \text{ReLU6}(x+3))/6 = x \min(\max(0,x+3),6)/6 \f$ ) */
- SWISH, /**< Swish ( \f$ f(x) = \frac{x}{1 + e^{-ax}} = x \text{logistic}(ax) \f$ ) */
- GELU /**< GELU ( \f$ f(x) = x * 1/2 * 1 + erf(x / \sqrt{2}) \f$ ) */
-};
-
-/** Image colour formats */
-enum class Format
-{
- UNKNOWN, /**< Unknown image format */
- U8, /**< 1 channel, 1 U8 per channel */
- S16, /**< 1 channel, 1 S16 per channel */
- U16, /**< 1 channel, 1 U16 per channel */
- S32, /**< 1 channel, 1 S32 per channel */
- U32, /**< 1 channel, 1 U32 per channel */
- S64, /**< 1 channel, 1 S64 per channel */
- U64, /**< 1 channel, 1 U64 per channel */
- BFLOAT16, /**< 16-bit brain floating-point number */
- F16, /**< 1 channel, 1 F16 per channel */
- F32, /**< 1 channel, 1 F32 per channel */
- UV88, /**< 2 channel, 1 U8 per channel */
- RGB888, /**< 3 channels, 1 U8 per channel */
- RGBA8888, /**< 4 channels, 1 U8 per channel */
- YUV444, /**< A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes */
- YUYV422, /**< A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes */
- NV12, /**< A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling */
- NV21, /**< A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling */
- IYUV, /**< A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes */
- UYVY422 /**< A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte */
-};
-
-/** Available data types */
-enum class DataType
-{
- UNKNOWN, /**< Unknown data type */
- U8, /**< unsigned 8-bit number */
- S8, /**< signed 8-bit number */
- QSYMM8, /**< quantized, symmetric fixed-point 8-bit number */
- QASYMM8, /**< quantized, asymmetric fixed-point 8-bit number unsigned */
- QASYMM8_SIGNED, /**< quantized, asymmetric fixed-point 8-bit number signed */
- QSYMM8_PER_CHANNEL, /**< quantized, symmetric per channel fixed-point 8-bit number */
- U16, /**< unsigned 16-bit number */
- S16, /**< signed 16-bit number */
- QSYMM16, /**< quantized, symmetric fixed-point 16-bit number */
- QASYMM16, /**< quantized, asymmetric fixed-point 16-bit number */
- U32, /**< unsigned 32-bit number */
- S32, /**< signed 32-bit number */
- U64, /**< unsigned 64-bit number */
- S64, /**< signed 64-bit number */
- BFLOAT16, /**< 16-bit brain floating-point number */
- F16, /**< 16-bit floating-point number */
- F32, /**< 32-bit floating-point number */
- F64, /**< 64-bit floating-point number */
- SIZET /**< size_t */
-};
-
/** Available Sampling Policies */
enum class SamplingPolicy
{
@@ -129,29 +88,6 @@ enum class SamplingPolicy
TOP_LEFT /**< Samples are taken at pixel top left corner */
};
-/** [DataLayout enum definition] **/
-
-/** Supported tensor data layouts */
-enum class DataLayout
-{
- UNKNOWN, /**< Unknown data layout */
- NCHW, /**< Num samples, channels, height, width */
- NHWC, /**< Num samples, height, width, channels */
- NCDHW, /**< Num samples, channels, depth, height, width */
- NDHWC /**< Num samples, depth, height, width, channels */
-};
-/** [DataLayout enum definition] **/
-
-/** Supported tensor data layout dimensions */
-enum class DataLayoutDimension
-{
- CHANNEL, /**< channel */
- HEIGHT, /**< height */
- WIDTH, /**< width */
- DEPTH, /**< depth */
- BATCHES /**< batches */
-};
-
/** Available ConvolutionMethod*/
enum class ConvolutionMethod
{
@@ -479,23 +415,6 @@ using PaddingList = std::vector<PaddingInfo>;
/** Information to produce a tiled version of a Tensor */
using Multiples = std::vector<uint32_t>;
-/** Available channels */
-enum class Channel
-{
- UNKNOWN, /** Unknown channel format */
- C0, /**< First channel (used by formats with unknown channel types). */
- C1, /**< Second channel (used by formats with unknown channel types). */
- C2, /**< Third channel (used by formats with unknown channel types). */
- C3, /**< Fourth channel (used by formats with unknown channel types). */
- R, /**< Red channel. */
- G, /**< Green channel. */
- B, /**< Blue channel. */
- A, /**< Alpha channel. */
- Y, /**< Luma channel. */
- U, /**< Cb/U channel. */
- V /**< Cr/V/Value channel. */
-};
-
/** Available reduction operations */
enum class ReductionOperation
{
@@ -568,15 +487,6 @@ struct DetectionWindow
float score{ 0.f }; /**< Confidence value for the detection window */
};
-/** Dimension rounding type when down-scaling on CNNs
- * @note Used in pooling and convolution layer
- */
-enum class DimensionRoundingType
-{
- FLOOR, /**< Floor rounding */
- CEIL /**< Ceil rounding */
-};
-
/** Available pooling types */
enum class PoolingType
{
@@ -690,122 +600,6 @@ private:
};
/** Padding and stride information class */
-class PadStrideInfo
-{
-public:
- /** Constructor
- *
- * @param[in] stride_x (Optional) Stride, in elements, across x. Defaults to 1.
- * @param[in] stride_y (Optional) Stride, in elements, across y. Defaults to 1.
- * @param[in] pad_x (Optional) Padding, in elements, across x. Defaults to 0.
- * @param[in] pad_y (Optional) Padding, in elements, across y. Defaults to 0.
- * @param[in] round (Optional) Dimensions rounding. Defaults to @ref DimensionRoundingType::FLOOR.
- */
- PadStrideInfo(unsigned int stride_x = 1, unsigned int stride_y = 1,
- unsigned int pad_x = 0, unsigned int pad_y = 0,
- DimensionRoundingType round = DimensionRoundingType::FLOOR)
- : _stride(std::make_pair(stride_x, stride_y)),
- _pad_left(pad_x),
- _pad_top(pad_y),
- _pad_right(pad_x),
- _pad_bottom(pad_y),
- _round_type(round)
- {
- }
- /** Constructor
- *
- * @param[in] stride_x Stride, in elements, across x.
- * @param[in] stride_y Stride, in elements, across y.
- * @param[in] pad_left Padding across x on the left, in elements.
- * @param[in] pad_right Padding across x on the right, in elements.
- * @param[in] pad_top Padding across y on the top, in elements.
- * @param[in] pad_bottom Padding across y on the bottom, in elements.
- * @param[in] round Dimensions rounding.
- */
- PadStrideInfo(unsigned int stride_x, unsigned int stride_y,
- unsigned int pad_left, unsigned int pad_right,
- unsigned int pad_top, unsigned int pad_bottom,
- DimensionRoundingType round)
- : _stride(std::make_pair(stride_x, stride_y)),
- _pad_left(pad_left),
- _pad_top(pad_top),
- _pad_right(pad_right),
- _pad_bottom(pad_bottom),
- _round_type(round)
- {
- }
- /** Get the stride.
- *
- * @return a pair: stride x, stride y.
- */
- std::pair<unsigned int, unsigned int> stride() const
- {
- return _stride;
- }
- /** Check whether the padding is symmetric.
- *
- * @return True if the padding is symmetric.
- */
- bool padding_is_symmetric() const
- {
- return (_pad_left == _pad_right) && (_pad_top == _pad_bottom);
- }
- /** Get the padding.
- *
- * @note This should only be used when the padding is symmetric.
- *
- * @return a pair: padding left/right, padding top/bottom
- */
- std::pair<unsigned int, unsigned int> pad() const
- {
- //this accessor should be used only when padding is symmetric
- ARM_COMPUTE_ERROR_ON(!padding_is_symmetric());
- return std::make_pair(_pad_left, _pad_top);
- }
-
- /** Get the left padding */
- unsigned int pad_left() const
- {
- return _pad_left;
- }
- /** Get the right padding */
- unsigned int pad_right() const
- {
- return _pad_right;
- }
- /** Get the top padding */
- unsigned int pad_top() const
- {
- return _pad_top;
- }
- /** Get the bottom padding */
- unsigned int pad_bottom() const
- {
- return _pad_bottom;
- }
-
- /** Get the rounding type */
- DimensionRoundingType round() const
- {
- return _round_type;
- }
-
- /** Check whether this has any padding */
- bool has_padding() const
- {
- return (_pad_left != 0 || _pad_top != 0 || _pad_right != 0 || _pad_bottom != 0);
- }
-
-private:
- std::pair<unsigned int, unsigned int> _stride;
- unsigned int _pad_left;
- unsigned int _pad_top;
- unsigned int _pad_right;
- unsigned int _pad_bottom;
-
- DimensionRoundingType _round_type;
-};
-
/** Padding information for 2D operations like Conv2d */
struct Padding2D
{
@@ -1795,96 +1589,6 @@ private:
int32_t _shrink_axis_mask;
};
-/** Memory layouts for the weights tensor.
- *
- * * UNSPECIFIED is used to select kernels that do not run in
- * variable weights mode.
- *
- * * ANY is used to query the kernel database to retrieve any of the
- * kernels that runs in variable weights mode. Once a kernel is
- * found, the specific format expected by the kernel can be
- * retrieved by the user for reordering the weights tensor
- * accordingly.
- *
- * The other values OHWIo{interleave_by}i{block_by} describe the
- * memory layout of a 4D tensor with layout OHWI that has been
- * transformed into a 4D tensor with dimensions O'HWI' where:
- *
- * O' = first multiple of {interleave_by} s.t. O<=O'
- * I' = first multiple of {block_by} s.t. I<=I'
- *
- * The total size of the dst tensor is O' x H x W x I'
- *
- * The access function of the tensor with layout
- * OHWIo{interleave_by}i{block_by} and size O'HWI' is a 6-parameter
- * access function, where the 6 parameters are computed as follows:
- *
- * x5 = floor(o/{interleave_by}) RANGE [0, O'/{interleave_by} -1] SIZE: O'/{interleave_by}
- *
- * x4 = h RANGE [0, H-1] SIZE: H
- * x3 = w RANGE [0, W-1] SIZE: W
- * x2 = floor(i/{block_by}) RANGE [0, I'/{block_by} -1] SIZE: I'/{block_by}
- * x1 = o%{interleave_by} RANGE [0, {interleave_by} -1] SIZE: {interleave_by}
- * x0 = i%{block_by} RANGE [0, {block_by} -1] SIZE: {block_by}
- * TOTAL SIZE: O' * H * W * I'
- *
- * 4D 6D
- * ----------------- -----------------------------------
- * value(o, h, w, i) = x5 * H * W * I' * {interleave_by}
- * + x4 * W * I' * {interleave_by}
- * + x3 * I' * {interleave_by}
- * + x2 * {interleave_by} * {block_by}
- * + x1 * {block_by}
- * + x0
- *
- * Notice that in arm_gemm the 4D tensor of dimension O'HWI' created
- * for the OHWIo{interleave_by}i{block_by} format is in reality seen
- * as a 2D tensor, where the number of rows is O'/{interleave_by}
- * and the number of columns is {interleave_by} * H * W * I'.
- *
- * The postfix *_bf16 is for the memory layout needed for the
- * fast-mode kernels, in which the weights are passed in bfloat16
- * format.
- */
-enum class WeightFormat
-{
- UNSPECIFIED = 0x1,
- ANY = 0x2,
- OHWI = 0x100100,
- OHWIo2 = 0x100200,
- OHWIo4 = 0x100400,
- OHWIo8 = 0x100800,
- OHWIo16 = 0x101000,
- OHWIo32 = 0x102000,
- OHWIo64 = 0x104000,
- OHWIo128 = 0x108000,
- OHWIo4i2 = 0x200400,
- OHWIo4i2_bf16 = 0x200410,
- OHWIo8i2 = 0x200800,
- OHWIo8i2_bf16 = 0x200810,
- OHWIo16i2 = 0x201000,
- OHWIo16i2_bf16 = 0x201010,
- OHWIo32i2 = 0x202000,
- OHWIo32i2_bf16 = 0x202010,
- OHWIo64i2 = 0x204000,
- OHWIo64i2_bf16 = 0x204010,
- OHWIo4i4 = 0x400400,
- OHWIo4i4_bf16 = 0x400410,
- OHWIo8i4 = 0x400800,
- OHWIo8i4_bf16 = 0x400810,
- OHWIo16i4 = 0x401000,
- OHWIo16i4_bf16 = 0x401010,
- OHWIo32i4 = 0x402000,
- OHWIo32i4_bf16 = 0x402010,
- OHWIo64i4 = 0x404000,
- OHWIo64i4_bf16 = 0x404010,
- OHWIo2i8 = 0x800200,
- OHWIo4i8 = 0x800400,
- OHWIo8i8 = 0x800800,
- OHWIo16i8 = 0x801000,
- OHWIo32i8 = 0x802000,
- OHWIo64i8 = 0x804000
-};
// OHWIo<interleave_by>i<block_by>
inline int interleave_by(const WeightFormat wf)
{
@@ -2095,31 +1799,6 @@ private:
bool _broadcast_bias;
};
-/** GEMMLowp output stage type */
-enum class GEMMLowpOutputStageType
-{
- NONE, /**< No quantization */
- QUANTIZE_DOWN, /**< Quantize using an integer multiplication */
- QUANTIZE_DOWN_FIXEDPOINT, /**< Quantize using a fixed point multiplication */
- QUANTIZE_DOWN_FLOAT /**< Quantize using a floating point multiplication */
-};
-
-/** GEMMLowp output stage info */
-struct GEMMLowpOutputStageInfo
-{
- GEMMLowpOutputStageType type{ GEMMLowpOutputStageType::NONE }; /**< GEMMLowp output stage type */
- int32_t gemmlowp_offset{ 0 }; /**< GEMMLowp output stage offset used for quantizing to QASYMM8 */
- int32_t gemmlowp_multiplier{ 0 }; /**< GEMMLowp output stage multiplier used for quantizing to QASYMM8 */
- int32_t gemmlowp_shift{ 0 }; /**< GEMMLowp output stage shift used for quantizing to uint8 */
- int32_t gemmlowp_min_bound{ std::numeric_limits<int32_t>::lowest() }; /**< GEMMLowp min value used to saturate down the output result before converting back to QASYMM8 */
- int32_t gemmlowp_max_bound{ std::numeric_limits<int32_t>::max() }; /**< GEMMLowp max value used to saturate down the output result before converting back to QASYMM8 */
- std::vector<int32_t> gemmlowp_multipliers{}; /**< GEMMLowp output stage multiplier used for quantizing to QASYMM8 */
- std::vector<int32_t> gemmlowp_shifts{}; /**< GEMMLowp output stage multiplier used for quantizing to QASYMM8 */
- float gemmlowp_real_multiplier{ 0 }; /**< GEMMLowp output stage real multiplier used for quantizing to QASYMM8 */
- bool is_quantized_per_channel{ false }; /**< GEMMLowp quantized per-channel flag */
- DataType output_data_type{ DataType::UNKNOWN }; /**< Output tensor data type to use if the output is not initialized */
-};
-
/** GEMM LHS (Left Hand Side) matrix information */
struct GEMMLHSMatrixInfo
{
@@ -2236,4 +1915,4 @@ struct IOFormatInfo
/** Class for holding information related to cropping */
using CropInfo = Padding2D;
} // namespace arm_compute
-#endif /* ARM_COMPUTE_TYPES_H */
+#endif /* ACL_ARM_COMPUTE_CORE_TYPES */
diff --git a/arm_compute/core/experimental/PostOps.h b/arm_compute/core/experimental/PostOps.h
index c70df841b8..a5585bab5d 100644
--- a/arm_compute/core/experimental/PostOps.h
+++ b/arm_compute/core/experimental/PostOps.h
@@ -26,8 +26,8 @@
#include "arm_compute/core/experimental/IPostOp.h"
-#include "arm_compute/core/ActivationLayerInfo.h"
#include "arm_compute/core/Types.h"
+#include "arm_compute/function_info/ActivationLayerInfo.h"
#include <vector>
diff --git a/arm_compute/core/utils/FormatUtils.h b/arm_compute/core/utils/FormatUtils.h
index 10e6f747f2..afb0f78255 100644
--- a/arm_compute/core/utils/FormatUtils.h
+++ b/arm_compute/core/utils/FormatUtils.h
@@ -24,7 +24,8 @@
#ifndef ARM_COMPUTE_CORE_UTILS_FORMATUTILS_H
#define ARM_COMPUTE_CORE_UTILS_FORMATUTILS_H
-#include "arm_compute/core/Types.h"
+#include "arm_compute/core/CoreTypes.h"
+#include "arm_compute/core/Error.h"
namespace arm_compute
{
@@ -339,6 +340,5 @@ inline size_t num_channels_from_format(Format format)
* @return The string describing the format.
*/
const std::string &string_from_format(Format format);
-
}
#endif /*ARM_COMPUTE_CORE_UTILS_FORMATUTILS_H */
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index 2a4aa4d7db..77ad33910b 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -24,11 +24,11 @@
#ifndef ACL_ARM_COMPUTE_CORE_UTILS_MISC_SHAPECALCULATOR
#define ACL_ARM_COMPUTE_CORE_UTILS_MISC_SHAPECALCULATOR
-#include "arm_compute/core/ConvolutionInfo.h"
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/ITensorInfo.h"
#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/Utils.h"
+#include "arm_compute/function_info/ConvolutionInfo.h"
#include "arm_compute/runtime/FunctionDescriptors.h"
#include "arm_compute/core/utils/helpers/tensor_transform.h"
@@ -433,8 +433,8 @@ inline TensorShape compute_depthwise_convolution_shape(const ITensorInfo &input,
const int weights_width_idx = get_data_layout_dimension_index(weights_data_layout, DataLayoutDimension::WIDTH);
const int weights_height_idx = get_data_layout_dimension_index(weights_data_layout, DataLayoutDimension::HEIGHT);
- unsigned int output_width = 0;
- unsigned int output_height = 0;
+ unsigned int output_width = 0;
+ unsigned int output_height = 0;
std::tie(output_width, output_height) = scaled_dimensions(input_shape[width_idx], input_shape[height_idx],
weights_shape[weights_width_idx], weights_shape[weights_height_idx],
info.pad_stride_info, info.dilation);
@@ -684,8 +684,8 @@ inline TensorShape compute_winograd_output_transform_shape(const ITensorInfo &in
const DataLayout data_layout = winograd_info.output_data_layout;
// Compute output shape
- unsigned int output_width = 0;
- unsigned int output_height = 0;
+ unsigned int output_width = 0;
+ unsigned int output_height = 0;
std::tie(output_width, output_height) = scaled_dimensions(input_dimensions.width, input_dimensions.height,
kernel_size.width, kernel_size.height, conv_info);
@@ -725,7 +725,7 @@ inline TensorShape compute_deep_convolution_shape(const TensorShape &input_shape
const unsigned int weights_out_channel = weights_shape[3];
unsigned int output_width = 0;
unsigned int output_height = 0;
- std::tie(output_width, output_height) = scaled_dimensions(input_width, input_height, weights_width, weights_height, conv_info);
+ std::tie(output_width, output_height) = scaled_dimensions(input_width, input_height, weights_width, weights_height, conv_info);
TensorShape output_shape{ input_shape };
output_shape.set(idx_width, output_width);