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