Compute Library
 23.08
NESubTensorHandle.cpp
Go to the documentation of this file.
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  */
25 
26 namespace arm_compute
27 {
28 namespace graph
29 {
30 namespace backends
31 {
32 NESubTensorHandle::NESubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent)
33  : _sub_tensor(), _parent_handle(nullptr)
34 {
36  _sub_tensor = arm_compute::SubTensor(&parent_handle->tensor(), shape, coords, extend_parent);
37  _parent_handle = parent_handle;
38 }
39 
41 {
42  // noop
43 }
44 
46 {
47  // noop
48 }
49 
51 {
53  // noop
54 }
55 
56 void NESubTensorHandle::map(bool blocking)
57 {
58  ARM_COMPUTE_UNUSED(blocking);
59 }
60 
62 {
63  // noop
64 }
65 
67 {
68  // noop
69 }
70 
72 {
73  return _sub_tensor;
74 }
75 
77 {
78  return _sub_tensor;
79 }
80 
82 {
83  ARM_COMPUTE_ERROR_ON(_parent_handle == nullptr);
84  return _parent_handle->parent_handle();
85 }
86 
88 {
89  return true;
90 }
91 
93 {
94  return Target::NEON;
95 }
96 } // namespace backends
97 } // namespace graph
98 } // namespace arm_compute
arm_compute::graph::backends::NESubTensorHandle::unmap
void unmap() override
Un-maps a backend tensor object.
Definition: NESubTensorHandle.cpp:61
arm_compute::graph::backends::NESubTensorHandle::free
void free() override
Allocates backend memory for the handle.
Definition: NESubTensorHandle.cpp:45
arm_compute::TensorShape
Shape of a tensor.
Definition: TensorShape.h:39
NESubTensorHandle.h
arm_compute::graph::Target::NEON
@ NEON
Arm® Neon™ capable target device.
arm_compute::graph::backends::NESubTensorHandle::allocate
void allocate() override
Allocates backend memory for the handle.
Definition: NESubTensorHandle.cpp:40
arm_compute::SubTensor
Basic implementation of the sub-tensor interface.
Definition: SubTensor.h:37
arm_compute::graph::ITensorHandle::tensor
virtual arm_compute::ITensor & tensor()=0
Backend tensor object accessor.
arm_compute::ITensor
Interface for CPU tensor.
Definition: ITensor.h:36
arm_compute::IMemoryGroup
Memory group interface.
Definition: IMemoryGroup.h:37
arm_compute::test::validation::shape
shape
Definition: DFT.cpp:115
ARM_COMPUTE_ERROR_ON
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:467
arm_compute::graph::Target
Target
Definition: Types.h:104
arm_compute::graph::backends::NESubTensorHandle::is_subtensor
bool is_subtensor() const override
Checks if a backing tensor is a sub-tensor object or not.
Definition: NESubTensorHandle.cpp:87
arm_compute::graph::backends::NESubTensorHandle::target
Target target() const override
Returns target type.
Definition: NESubTensorHandle.cpp:92
arm_compute::graph::backends::NESubTensorHandle::parent_handle
ITensorHandle * parent_handle() override
Return the parent tensor handle if is a subtensor else this.
Definition: NESubTensorHandle.cpp:81
ARM_COMPUTE_UNUSED
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
arm_compute::graph::backends::NESubTensorHandle::tensor
arm_compute::ITensor & tensor() override
Backend tensor object accessor.
Definition: NESubTensorHandle.cpp:71
arm_compute::Coordinates
Coordinates of an item.
Definition: Coordinates.h:37
arm_compute::graph::backends::NESubTensorHandle::NESubTensorHandle
NESubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent=false)
Default constructor.
Definition: NESubTensorHandle.cpp:32
arm_compute::graph::backends::NESubTensorHandle::map
void map(bool blocking) override
Maps backend tensor object.
Definition: NESubTensorHandle.cpp:56
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::graph::backends::NESubTensorHandle::release_if_unused
void release_if_unused() override
Releases backend tensor if is marked as unused.
Definition: NESubTensorHandle.cpp:66
arm_compute::graph::backends::NESubTensorHandle::manage
void manage(IMemoryGroup *mg) override
Set backend tensor to be managed by a memory group.
Definition: NESubTensorHandle.cpp:50
arm_compute::graph::ITensorHandle
Tensor handle interface object.
Definition: ITensorHandle.h:38
arm_compute::graph::ITensorHandle::parent_handle
virtual ITensorHandle * parent_handle()=0
Return the parent tensor handle if is a subtensor else this.