Compute Library
 21.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 {
35  ARM_COMPUTE_ERROR_ON(!parent_handle);
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
Memory group interface.
Definition: IMemoryGroup.h:37
Arm® Neon™ capable target device.
void unmap() override
Un-maps a backend tensor object.
Shape of a tensor.
Definition: TensorShape.h:39
bool is_subtensor() const override
Checks if a backing tensor is a sub-tensor object or not.
virtual ITensorHandle * parent_handle()=0
Return the parent tensor handle if is a subtensor else this.
virtual arm_compute::ITensor & tensor()=0
Backend tensor object accessor.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
arm_compute::ITensor & tensor() override
Backend tensor object accessor.
Interface for CPU tensor.
Definition: ITensor.h:36
ITensorHandle * parent_handle() override
Return the parent tensor handle if is a subtensor else this.
Copyright (c) 2017-2021 Arm Limited.
Basic implementation of the sub-tensor interface.
Definition: SubTensor.h:37
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
Coordinates of an item.
Definition: Coordinates.h:37
Tensor handle interface object.
Definition: ITensorHandle.h:38
NESubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent=false)
Default constructor.
void allocate() override
Allocates backend memory for the handle.
Target target() const override
Returns target type.
void map(bool blocking) override
Maps backend tensor object.
void release_if_unused() override
Releases backend tensor if is marked as unused.
void manage(IMemoryGroup *mg) override
Set backend tensor to be managed by a memory group.
void free() override
Allocates backend memory for the handle.