Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 ARM Limited. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #ifndef __ARM_COMPUTE_GRAPH2_NESUBTENSORHANDLE_H__ |
| 25 | #define __ARM_COMPUTE_GRAPH2_NESUBTENSORHANDLE_H__ |
| 26 | |
| 27 | #include "arm_compute/graph2/ITensorHandle.h" |
| 28 | |
| 29 | #include "arm_compute/runtime/SubTensor.h" |
| 30 | |
| 31 | namespace arm_compute |
| 32 | { |
| 33 | namespace graph2 |
| 34 | { |
| 35 | namespace backends |
| 36 | { |
| 37 | /** NEON Sub-Tensor handle interface object **/ |
| 38 | class NESubTensorHandle final : public ITensorHandle |
| 39 | { |
| 40 | public: |
| 41 | /** Default constructor |
| 42 | * |
| 43 | * @param[in] parent_handle Parent tensor handle |
| 44 | * @param[in] shape Sub-Tensor shape |
| 45 | * @param[in] coords Starting coordinates |
Georgios Pinitas | ee33ea5 | 2018-03-08 16:01:29 +0000 | [diff] [blame^] | 46 | * @param[in] extend_parent Extends parent shape if true |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 47 | */ |
Georgios Pinitas | ee33ea5 | 2018-03-08 16:01:29 +0000 | [diff] [blame^] | 48 | NESubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent = false); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 49 | /** Destructor: free the tensor's memory */ |
| 50 | ~NESubTensorHandle() = default; |
| 51 | /** Allow instances of this class to be move constructed */ |
| 52 | NESubTensorHandle(NESubTensorHandle &&) = default; |
| 53 | /** Allow instances of this class to be moved */ |
| 54 | NESubTensorHandle &operator=(NESubTensorHandle &&) = default; |
| 55 | |
| 56 | // Inherited overridden methods |
| 57 | void allocate() override; |
| 58 | arm_compute::ITensor &tensor() override; |
| 59 | const arm_compute::ITensor &tensor() const override; |
| 60 | void map(bool blocking) override; |
| 61 | void unmap() override; |
| 62 | bool is_subtensor() const override; |
| 63 | |
| 64 | private: |
| 65 | arm_compute::SubTensor _sub_tensor; /**< Backend Sub-Tensor */ |
| 66 | }; |
| 67 | } // namespace backends |
| 68 | } // namespace graph2 |
| 69 | } // namespace arm_compute |
| 70 | #endif /* __ARM_COMPUTE_GRAPH2_NESUBTENSORHANDLE_H__ */ |