From 6ff3b19ee6120edf015fad8caab2991faa3070af Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Mon, 4 Sep 2017 18:44:23 +0100 Subject: COMPMID-344 Updated doxygen Change-Id: I32f7b84daa560e460b77216add529c8fa8b327ae --- arm_compute/core/SubTensorInfo.h | 184 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 arm_compute/core/SubTensorInfo.h (limited to 'arm_compute/core/SubTensorInfo.h') diff --git a/arm_compute/core/SubTensorInfo.h b/arm_compute/core/SubTensorInfo.h new file mode 100644 index 0000000000..e2532fd487 --- /dev/null +++ b/arm_compute/core/SubTensorInfo.h @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2017 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_SUBTENSORINFO_H__ +#define __ARM_COMPUTE_SUBTENSORINFO_H__ + +#include "arm_compute/core/ITensorInfo.h" + +#include "arm_compute/core/Coordinates.h" +#include "arm_compute/core/Strides.h" +#include "arm_compute/core/TensorInfo.h" +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Validate.h" + +#include + +namespace arm_compute +{ +/** Store the sub tensor's metadata */ +class SubTensorInfo final : public ITensorInfo +{ +public: + /** Default constructor */ + SubTensorInfo(); + /** Default constructor + * + * @param[in] parent Metadata of parent tensor. + * @param[in] tensor_shape Tensor shape. Shape must fit inside parent's shape. + * X and Y dimensions must match the parent's ones. + * @param[in] coords Coordinates of starting element inside parent tensor. + */ + SubTensorInfo(ITensorInfo *parent, const TensorShape &tensor_shape, const Coordinates &coords); + /** Default destructor */ + ~SubTensorInfo() = default; + /** Allow instances of this class to be copy constructed */ + SubTensorInfo(const SubTensorInfo &) = default; + /** Allow instances of this class to be copied */ + SubTensorInfo &operator=(const SubTensorInfo &) = default; + /** Allow instances of this class to be move constructed */ + SubTensorInfo(SubTensorInfo &&) = default; + /** Allow instances of this class to be moved */ + SubTensorInfo &operator=(SubTensorInfo &&) = default; + + // Inherited methods overridden: + void set_data_type(DataType data_type) override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + _parent->set_data_type(data_type); + }; + void set_num_channels(int num_channels) override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + _parent->set_num_channels(num_channels); + }; + void set_format(Format format) override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + _parent->set_format(format); + }; + void set_fixed_point_position(int fixed_point_position) override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + _parent->set_fixed_point_position(fixed_point_position); + }; + void set_tensor_shape(TensorShape shape) override; + bool auto_padding() override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->auto_padding(); + }; + bool extend_padding(const PaddingSize &padding) override; + size_t dimension(size_t index) const override + { + return _tensor_shape[index]; + } + const Strides &strides_in_bytes() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->strides_in_bytes(); + } + size_t offset_first_element_in_bytes() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->offset_element_in_bytes(_coords); + } + size_t offset_element_in_bytes(const Coordinates &pos) const override; + int fixed_point_position() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->fixed_point_position(); + } + size_t element_size() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->element_size(); + } + size_t num_dimensions() const override + { + return _tensor_shape.num_dimensions(); + } + size_t num_channels() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->num_channels(); + } + const TensorShape &tensor_shape() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _tensor_shape; + } + DataType data_type() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->data_type(); + } + Format format() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->format(); + } + size_t total_size() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->total_size(); + } + PaddingSize padding() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->padding(); + } + bool has_padding() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->has_padding(); + } + bool is_resizable() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _parent->is_resizable(); + } + void set_is_resizable(bool is_resizable) override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + _parent->set_is_resizable(is_resizable); + } + ValidRegion valid_region() const override + { + return _valid_region; + } + void set_valid_region(ValidRegion valid_region) override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + ARM_COMPUTE_ERROR_ON_INVALID_SUBTENSOR_VALID_REGION(_parent->valid_region(), valid_region); + _valid_region = std::move(valid_region); + } + +private: + ITensorInfo *_parent; + TensorShape _tensor_shape; + Coordinates _coords; + ValidRegion _valid_region; +}; +} +#endif /*__ARM_COMPUTE_SUBTENSORINFO_H__ */ -- cgit v1.2.1