blob: 101d3e66443b8af5915149b00d7956a6ffebf01d [file] [log] [blame]
Georgios Pinitasd8734b52017-12-22 15:27:52 +00001/*
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 */
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010024#ifndef __ARM_COMPUTE_GRAPH_NESUBTENSORHANDLE_H__
25#define __ARM_COMPUTE_GRAPH_NESUBTENSORHANDLE_H__
Georgios Pinitasd8734b52017-12-22 15:27:52 +000026
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010027#include "arm_compute/graph/ITensorHandle.h"
Georgios Pinitasd8734b52017-12-22 15:27:52 +000028
29#include "arm_compute/runtime/SubTensor.h"
30
31namespace arm_compute
32{
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010033namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +000034{
35namespace backends
36{
37/** NEON Sub-Tensor handle interface object **/
38class NESubTensorHandle final : public ITensorHandle
39{
40public:
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 Pinitasee33ea52018-03-08 16:01:29 +000046 * @param[in] extend_parent Extends parent shape if true
Georgios Pinitasd8734b52017-12-22 15:27:52 +000047 */
Georgios Pinitasee33ea52018-03-08 16:01:29 +000048 NESubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent = false);
Georgios Pinitasd8734b52017-12-22 15:27:52 +000049 /** 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;
Georgios Pinitas3d1489d2018-05-03 20:47:16 +010055 /** Prevent instances of this class from being copied (As this class contains pointers) */
56 NESubTensorHandle(const NESubTensorHandle &) = delete;
57 /** Prevent instances of this class from being copied (As this class contains pointers) */
58 NESubTensorHandle &operator=(const NESubTensorHandle &) = delete;
Georgios Pinitasd8734b52017-12-22 15:27:52 +000059
60 // Inherited overridden methods
Georgios Pinitas3d1489d2018-05-03 20:47:16 +010061 void allocate() override;
62 void free() override;
63 void manage(IMemoryGroup *mg) override;
64 void map(bool blocking) override;
65 void unmap() override;
66 void release_if_unused() override;
Georgios Pinitasd8734b52017-12-22 15:27:52 +000067 arm_compute::ITensor &tensor() override;
68 const arm_compute::ITensor &tensor() const override;
Georgios Pinitas3d1489d2018-05-03 20:47:16 +010069 ITensorHandle *parent_handle() override;
70 bool is_subtensor() const override;
71 Target target() const override;
Georgios Pinitasd8734b52017-12-22 15:27:52 +000072
73private:
Georgios Pinitas3d1489d2018-05-03 20:47:16 +010074 arm_compute::SubTensor _sub_tensor; /**< Backend Sub-Tensor */
75 ITensorHandle *_parent_handle; /**< Parent handle */
Georgios Pinitasd8734b52017-12-22 15:27:52 +000076};
77} // namespace backends
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010078} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +000079} // namespace arm_compute
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010080#endif /* __ARM_COMPUTE_GRAPH_NESUBTENSORHANDLE_H__ */