blob: bf11d0d3329d1f30404fc388da3c3db592bc9626 [file] [log] [blame]
Viet-Hoa Do0b23e0e2023-07-25 14:00:46 +01001/*
2 * Copyright (c) 2023 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
25#include "ckw/TensorOperand.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010026
Viet-Hoa Do0b23e0e2023-07-25 14:00:46 +010027#include "src/ITensor.h"
28
29namespace ckw
30{
31
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010032TensorOperand::TensorOperand(ITensor &tensor) : _tensor(tensor)
Viet-Hoa Do0b23e0e2023-07-25 14:00:46 +010033{
34}
35
36const TensorInfo &TensorOperand::info() const
37{
38 return _tensor.info();
39}
40
41TileOperand TensorOperand::stride0()
42{
43 return TileOperand(_tensor.component(TensorComponentType::Stride0));
44}
45
46TileOperand TensorOperand::stride1()
47{
48 return TileOperand(_tensor.component(TensorComponentType::Stride1));
49}
50
51TileOperand TensorOperand::stride2()
52{
53 return TileOperand(_tensor.component(TensorComponentType::Stride2));
54}
55
56TileOperand TensorOperand::stride3()
57{
58 return TileOperand(_tensor.component(TensorComponentType::Stride3));
59}
60
61TileOperand TensorOperand::stride4()
62{
63 return TileOperand(_tensor.component(TensorComponentType::Stride4));
64}
65
66TileOperand TensorOperand::dim0()
67{
68 return TileOperand(_tensor.component(TensorComponentType::Dim0));
69}
70
71TileOperand TensorOperand::dim1()
72{
73 return TileOperand(_tensor.component(TensorComponentType::Dim1));
74}
75
76TileOperand TensorOperand::dim2()
77{
78 return TileOperand(_tensor.component(TensorComponentType::Dim2));
79}
80
81TileOperand TensorOperand::dim3()
82{
83 return TileOperand(_tensor.component(TensorComponentType::Dim3));
84}
85
86TileOperand TensorOperand::dim4()
87{
88 return TileOperand(_tensor.component(TensorComponentType::Dim4));
89}
90
91TileOperand TensorOperand::dim1_dim2()
92{
93 return TileOperand(_tensor.component(TensorComponentType::Dim1xDim2));
94}
95
96TileOperand TensorOperand::dim1_dim2_dim3()
97{
98 return TileOperand(_tensor.component(TensorComponentType::Dim1xDim2xDim3));
99}
100
101TileOperand TensorOperand::dim2_dim3()
102{
103 return TileOperand(_tensor.component(TensorComponentType::Dim2xDim3));
104}
105
106TileOperand TensorOperand::offset_first_element_in_bytes()
107{
108 return TileOperand(_tensor.component(TensorComponentType::OffsetFirstElement));
109}
110
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100111} // namespace ckw