diff options
author | Adnan AlSinan <adnan.alsinan@arm.com> | 2021-09-01 15:32:03 +0100 |
---|---|---|
committer | Adnan AlSinan <adnan.alsinan@arm.com> | 2021-09-15 15:12:09 +0000 |
commit | e4563a032aaa71de5efdb83fc04ff2933338e02d (patch) | |
tree | f722dbea27753e0da68485df0592a128b72f747b /arm_compute/core/Size3D.h | |
parent | e42a87ffd23a334b802b47a52ec28ad6c90bfbf0 (diff) | |
download | ComputeLibrary-e4563a032aaa71de5efdb83fc04ff2933338e02d.tar.gz |
Adds Conv3d reference implementation support.
Expands the interface with the following items:
- Size3D Class.
- Conv3dInfo Struct.
- Padding3D Struct.
- Add 'NDHWC' to supported Tensor Data Layouts.
- Add function to compute expected size of Conv3d.
Resolves COMPMID-4658 & COMPMID-4657
Signed-off-by: Adnan AlSinan <adnan.alsinan@arm.com>
Change-Id: Ic7452c48461eedaa38eaf3ac458f54b031e7dfa8
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6187
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/Size3D.h')
-rw-r--r-- | arm_compute/core/Size3D.h | 106 |
1 files changed, 106 insertions, 0 deletions
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 */ |