telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
Teresa Charlin | 8398edc | 2020-07-20 14:23:02 +0100 | [diff] [blame] | 2 | // Copyright © 2017 Arm Ltd and Contributors. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 6 | #include "ClLayerSupport.hpp" |
David Beck | 3e9e115 | 2018-10-17 14:17:50 +0100 | [diff] [blame] | 7 | #include "ClBackendId.hpp" |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 8 | #include "ClBackendModelContext.hpp" |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 9 | |
David Beck | 3cc9a62 | 2018-10-12 10:38:31 +0100 | [diff] [blame] | 10 | #include <armnn/Descriptors.hpp> |
Matteo Martincigh | c601aa6 | 2019-10-29 15:03:22 +0000 | [diff] [blame] | 11 | #include <armnn/BackendRegistry.hpp> |
| 12 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 13 | #include <InternalTypes.hpp> |
| 14 | #include <LayerSupportCommon.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 15 | |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 16 | #include <armnn/utility/IgnoreUnused.hpp> |
| 17 | #include <armnn/utility/PolymorphicDowncast.hpp> |
| 18 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 19 | #if defined(ARMCOMPUTECL_ENABLED) |
Narumol Prangnawarat | 7413583 | 2019-05-23 15:07:33 +0100 | [diff] [blame] | 20 | #include <aclCommon/ArmComputeUtils.hpp> |
Aron Virginas-Tar | 710f664 | 2019-11-27 14:48:32 +0000 | [diff] [blame] | 21 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 22 | #include "workloads/ClAbsWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 23 | #include "workloads/ClAdditionWorkload.hpp" |
Nattapat Chaimanowong | e06757e | 2018-10-11 15:39:18 +0100 | [diff] [blame] | 24 | #include "workloads/ClActivationWorkload.hpp" |
James Conroy | 2dc0572 | 2019-09-19 17:00:31 +0100 | [diff] [blame] | 25 | #include "workloads/ClArgMinMaxWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 26 | #include "workloads/ClBatchNormalizationFloatWorkload.hpp" |
Mike Kelly | 831faed | 2018-11-28 11:52:08 +0000 | [diff] [blame] | 27 | #include "workloads/ClBatchToSpaceNdWorkload.hpp" |
Teresa Charlin | 2b030d9 | 2020-03-27 16:40:56 +0000 | [diff] [blame] | 28 | #include "workloads/ClComparisonWorkload.hpp" |
Mike Kelly | 0886ac4 | 2020-04-27 09:55:40 +0100 | [diff] [blame] | 29 | #include "workloads/ClConstantWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 30 | #include "workloads/ClConvertFp16ToFp32Workload.hpp" |
| 31 | #include "workloads/ClConvertFp32ToFp16Workload.hpp" |
Matthew Bentham | d806792 | 2018-10-03 17:18:04 +0100 | [diff] [blame] | 32 | #include "workloads/ClConvolution2dWorkload.hpp" |
Aron Virginas-Tar | b280196 | 2019-09-30 11:24:53 +0100 | [diff] [blame] | 33 | #include "workloads/ClDepthToSpaceWorkload.hpp" |
Matthew Bentham | d877739 | 2018-10-08 09:38:55 +0100 | [diff] [blame] | 34 | #include "workloads/ClDepthwiseConvolutionWorkload.hpp" |
Aron Virginas-Tar | b280196 | 2019-09-30 11:24:53 +0100 | [diff] [blame] | 35 | #include "workloads/ClDequantizeWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 36 | #include "workloads/ClDivisionFloatWorkload.hpp" |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 37 | #include "workloads/ClExpWorkload.hpp" |
Sadik Armagan | 66aecb0 | 2020-06-24 11:42:20 +0100 | [diff] [blame] | 38 | #include "workloads/ClFillWorkload.hpp" |
Sadik Armagan | 9be4916 | 2019-10-30 16:15:26 +0000 | [diff] [blame] | 39 | #include "workloads/ClFloorFloatWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 40 | #include "workloads/ClFullyConnectedWorkload.hpp" |
Teresa Charlin | 9ad2e5b | 2020-04-10 22:34:48 +0100 | [diff] [blame] | 41 | #include "workloads/ClGatherWorkload.hpp" |
Aron Virginas-Tar | 8168f40 | 2019-10-04 13:10:16 +0100 | [diff] [blame] | 42 | #include "workloads/ClInstanceNormalizationWorkload.hpp" |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 43 | #include "workloads/ClL2NormalizationFloatWorkload.hpp" |
Teresa Charlin | 8398edc | 2020-07-20 14:23:02 +0100 | [diff] [blame] | 44 | #include "workloads/ClLogSoftmaxWorkload.hpp" |
James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 45 | #include "workloads/ClLogicalAndWorkload.hpp" |
| 46 | #include "workloads/ClLogicalNotWorkload.hpp" |
| 47 | #include "workloads/ClLogicalOrWorkload.hpp" |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 48 | #include "workloads/ClLstmFloatWorkload.hpp" |
keidav01 | a959ee5 | 2018-12-19 10:04:58 +0000 | [diff] [blame] | 49 | #include "workloads/ClMaximumWorkload.hpp" |
Matteo Martincigh | 28dcab6 | 2018-10-19 16:40:03 +0100 | [diff] [blame] | 50 | #include "workloads/ClMeanWorkload.hpp" |
Jim Flynn | 6905941 | 2019-05-17 13:03:57 +0100 | [diff] [blame] | 51 | #include "workloads/ClConcatWorkload.hpp" |
saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 52 | #include "workloads/ClMinimumWorkload.hpp" |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 53 | #include "workloads/ClMultiplicationWorkload.hpp" |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 54 | #include "workloads/ClNegWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 55 | #include "workloads/ClNormalizationFloatWorkload.hpp" |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 56 | #include "workloads/ClPadWorkload.hpp" |
| 57 | #include "workloads/ClPermuteWorkload.hpp" |
Nattapat Chaimanowong | ac9e096 | 2018-10-10 17:18:35 +0100 | [diff] [blame] | 58 | #include "workloads/ClPooling2dWorkload.hpp" |
Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 59 | #include "workloads/ClPreluWorkload.hpp" |
Ryan OShea | 2323af4 | 2020-05-13 16:36:19 +0100 | [diff] [blame] | 60 | #include "workloads/ClQLstmWorkload.hpp" |
| 61 | #include "workloads/ClQuantizedLstmWorkload.hpp" |
| 62 | #include "workloads/ClQuantizeWorkload.hpp" |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 63 | #include "workloads/ClReshapeWorkload.hpp" |
Aron Virginas-Tar | cc0cefb | 2019-07-02 17:25:47 +0100 | [diff] [blame] | 64 | #include "workloads/ClResizeWorkload.hpp" |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 65 | #include "workloads/ClRsqrtWorkload.hpp" |
Aron Virginas-Tar | 94c4fef | 2019-11-25 15:37:08 +0000 | [diff] [blame] | 66 | #include "workloads/ClSliceWorkload.hpp" |
Teresa Charlin | c1f6b09 | 2020-05-11 16:10:38 +0100 | [diff] [blame] | 67 | #include "workloads/ClSoftmaxWorkload.hpp" |
Sadik Armagan | f446432 | 2018-12-20 16:19:12 +0000 | [diff] [blame] | 68 | #include "workloads/ClSpaceToBatchNdWorkload.hpp" |
James Conroy | d2aa85e | 2019-07-01 17:12:40 +0100 | [diff] [blame] | 69 | #include "workloads/ClSpaceToDepthWorkload.hpp" |
Narumol Prangnawarat | 7413583 | 2019-05-23 15:07:33 +0100 | [diff] [blame] | 70 | #include "workloads/ClSplitterWorkload.hpp" |
Matthew Jackson | d516610 | 2019-07-31 14:06:28 +0100 | [diff] [blame] | 71 | #include "workloads/ClStackWorkload.hpp" |
keidav01 | d74dc91 | 2018-12-10 18:16:07 +0000 | [diff] [blame] | 72 | #include "workloads/ClStridedSliceWorkload.hpp" |
David Beck | ac42efd | 2018-09-26 17:41:13 +0100 | [diff] [blame] | 73 | #include "workloads/ClSubtractionWorkload.hpp" |
Aron Virginas-Tar | 7a3e2fe | 2019-06-27 18:54:47 +0100 | [diff] [blame] | 74 | #include "workloads/ClTransposeConvolution2dWorkload.hpp" |
Mike Kelly | c9ea45a | 2020-02-28 18:11:58 +0000 | [diff] [blame] | 75 | #include "workloads/ClTransposeWorkload.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 76 | #endif |
| 77 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 78 | |
| 79 | namespace armnn |
| 80 | { |
arovir01 | 7c22c70 | 2018-10-09 11:16:46 +0100 | [diff] [blame] | 81 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 82 | namespace |
| 83 | { |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 84 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 85 | template<unsigned int FilterSize> |
| 86 | bool IsMatchingSize2d(const TensorInfo& weightInfo) |
| 87 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 88 | // Width & Height must match. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 89 | return (weightInfo.GetShape()[3] == FilterSize) && (weightInfo.GetShape()[2] == FilterSize); |
| 90 | } |
| 91 | |
| 92 | template<uint32_t ValidStride> |
| 93 | bool IsMatchingStride(uint32_t actualStride) |
| 94 | { |
| 95 | return ValidStride == actualStride; |
| 96 | } |
| 97 | |
| 98 | template<uint32_t FirstStride, uint32_t SecondStride, uint32_t... ValidStrides> |
| 99 | bool IsMatchingStride(uint32_t actualStride) |
| 100 | { |
| 101 | return IsMatchingStride<FirstStride>(actualStride) || IsMatchingStride<SecondStride, ValidStrides...>(actualStride); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 102 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 103 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 104 | template<typename ... Args> |
| 105 | bool IsClBackendSupported(Optional<std::string&> reasonIfUnsupported, Args... args) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 106 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 107 | IgnoreUnused(reasonIfUnsupported, (args)...); |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 108 | #if defined(ARMCOMPUTECL_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 109 | return true; |
| 110 | #else |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 111 | if (reasonIfUnsupported) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 112 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 113 | reasonIfUnsupported.value() = "The armnn library has been built without CL support"; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 114 | } |
| 115 | return false; |
| 116 | #endif |
| 117 | } |
| 118 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 119 | #if defined(ARMCOMPUTECL_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 120 | #define FORWARD_CL_LAYER_SUPPORT_FUNC(expr) (expr) |
| 121 | #else |
| 122 | #define FORWARD_CL_LAYER_SUPPORT_FUNC(expr) IsClBackendSupported(reasonIfUnsupported) |
| 123 | #endif |
| 124 | |
Matteo Martincigh | d95e906 | 2019-01-31 15:35:59 +0000 | [diff] [blame] | 125 | #if defined(ARMCOMPUTECL_ENABLED) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 126 | template<class FuncType, class... Args> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 127 | inline bool IsWorkloadSupported(FuncType&& func, Optional<std::string&> reasonIfUnsupported, Args&&... args) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 128 | { |
| 129 | arm_compute::Status aclStatus = func(std::forward<Args>(args)...); |
| 130 | const bool supported = (aclStatus.error_code() == arm_compute::ErrorCode::OK); |
| 131 | if (!supported && reasonIfUnsupported) |
| 132 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 133 | reasonIfUnsupported.value() = aclStatus.error_description(); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 134 | } |
| 135 | return supported; |
| 136 | } |
| 137 | |
| 138 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
| 139 | return IsWorkloadSupported(func, reasonIfUnsupported, __VA_ARGS__); |
| 140 | #else |
| 141 | #define FORWARD_WORKLOAD_VALIDATE_FUNC(func, reasonIfUnsupported, ...) \ |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 142 | return IsClBackendSupported(reasonIfUnsupported, __VA_ARGS__); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 143 | #endif |
| 144 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 145 | template<typename FloatFunc, typename Uint8Func, typename ... Params> |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 146 | bool IsSupportedForDataTypeCl(Optional<std::string&> reasonIfUnsupported, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 147 | DataType dataType, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 148 | FloatFunc floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 149 | Uint8Func uint8FuncPtr, |
| 150 | Params&&... params) |
| 151 | { |
| 152 | return IsClBackendSupported(reasonIfUnsupported) && |
| 153 | IsSupportedForDataTypeGeneric(reasonIfUnsupported, |
| 154 | dataType, |
| 155 | floatFuncPtr, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 156 | floatFuncPtr, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 157 | uint8FuncPtr, |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 158 | &FalseFunc<>, |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 159 | &FalseFunc<>, |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 160 | std::forward<Params>(params)...); |
| 161 | } |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 162 | } // anonymous namespace |
| 163 | |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 164 | ClLayerSupport::ClLayerSupport(const IBackendInternal::IBackendSpecificModelContextPtr& modelContextPtr) |
| 165 | : m_ModelContextPtr(modelContextPtr) |
| 166 | { |
| 167 | } |
| 168 | |
| 169 | ClLayerSupport::ClLayerSupport() |
| 170 | : m_ModelContextPtr(nullptr) |
| 171 | { |
| 172 | } |
| 173 | |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 174 | bool ClLayerSupport::IsAbsSupported(const TensorInfo& input, |
| 175 | const TensorInfo& output, |
| 176 | Optional<std::string&> reasonIfUnsupported) const |
| 177 | { |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 178 | ElementwiseUnaryDescriptor descriptor(UnaryOperation::Abs); |
| 179 | return IsElementwiseUnarySupported(input, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | 8204694 | 2019-09-09 15:18:29 +0100 | [diff] [blame] | 180 | } |
| 181 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 182 | bool ClLayerSupport::IsActivationSupported(const TensorInfo& input, |
| 183 | const TensorInfo& output, |
| 184 | const ActivationDescriptor& descriptor, |
| 185 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 186 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 187 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClActivationWorkloadValidate, |
| 188 | reasonIfUnsupported, |
| 189 | input, |
| 190 | output, |
| 191 | descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 192 | } |
| 193 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 194 | bool ClLayerSupport::IsAdditionSupported(const TensorInfo& input0, |
| 195 | const TensorInfo& input1, |
| 196 | const TensorInfo& output, |
| 197 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 198 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 199 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClAdditionValidate, |
| 200 | reasonIfUnsupported, |
| 201 | input0, |
| 202 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 203 | output, |
| 204 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 205 | } |
| 206 | |
James Conroy | 2dc0572 | 2019-09-19 17:00:31 +0100 | [diff] [blame] | 207 | bool ClLayerSupport::IsArgMinMaxSupported(const TensorInfo& input, |
| 208 | const TensorInfo& output, |
| 209 | const ArgMinMaxDescriptor& descriptor, |
| 210 | Optional<std::string&> reasonIfUnsupported) const |
| 211 | { |
Francis Murtagh | 52ec346 | 2019-11-19 12:24:19 +0000 | [diff] [blame] | 212 | |
James Conroy | 2dc0572 | 2019-09-19 17:00:31 +0100 | [diff] [blame] | 213 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClArgMinMaxWorkloadValidate, |
| 214 | reasonIfUnsupported, |
| 215 | input, |
| 216 | output, |
| 217 | descriptor); |
| 218 | } |
| 219 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 220 | bool ClLayerSupport::IsBatchNormalizationSupported(const TensorInfo& input, |
| 221 | const TensorInfo& output, |
| 222 | const TensorInfo& mean, |
| 223 | const TensorInfo& var, |
| 224 | const TensorInfo& beta, |
| 225 | const TensorInfo& gamma, |
| 226 | const BatchNormalizationDescriptor& descriptor, |
| 227 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 228 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 229 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClBatchNormalizationValidate, |
| 230 | reasonIfUnsupported, |
| 231 | input, |
| 232 | output, |
| 233 | mean, |
| 234 | var, |
| 235 | beta, |
| 236 | gamma, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 237 | descriptor, |
| 238 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 239 | } |
| 240 | |
Mike Kelly | 831faed | 2018-11-28 11:52:08 +0000 | [diff] [blame] | 241 | bool ClLayerSupport::IsBatchToSpaceNdSupported(const TensorInfo& input, |
| 242 | const TensorInfo& output, |
| 243 | const BatchToSpaceNdDescriptor& descriptor, |
| 244 | Optional<std::string&> reasonIfUnsupported) const |
| 245 | { |
| 246 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClBatchToSpaceNdWorkloadValidate, |
| 247 | reasonIfUnsupported, |
| 248 | input, |
| 249 | output, |
| 250 | descriptor); |
| 251 | } |
| 252 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 253 | bool ClLayerSupport::IsComparisonSupported(const TensorInfo& input0, |
| 254 | const TensorInfo& input1, |
| 255 | const TensorInfo& output, |
| 256 | const ComparisonDescriptor& descriptor, |
| 257 | Optional<std::string&> reasonIfUnsupported) const |
| 258 | { |
Teresa Charlin | 2b030d9 | 2020-03-27 16:40:56 +0000 | [diff] [blame] | 259 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClComparisonWorkloadValidate, |
| 260 | reasonIfUnsupported, |
| 261 | input0, |
| 262 | input1, |
| 263 | output, |
| 264 | descriptor); |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 265 | } |
| 266 | |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 267 | bool ClLayerSupport::IsConcatSupported(const std::vector<const TensorInfo*> inputs, |
| 268 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 269 | const ConcatDescriptor& descriptor, |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 270 | Optional<std::string&> reasonIfUnsupported) const |
| 271 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 272 | if (descriptor.GetNumDimensions() <= descriptor.GetConcatAxis()) |
| 273 | { |
| 274 | SetValueChecked(reasonIfUnsupported, "Cl Concat: Concat axis > Number of dimensions."); |
| 275 | return false; |
| 276 | } |
| 277 | |
| 278 | unsigned int concatInnerAxis = (descriptor.GetNumDimensions() - descriptor.GetConcatAxis()) - 1; |
| 279 | if(concatInnerAxis < 3) // Width, height, or channels |
| 280 | { |
| 281 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClConcatWorkloadValidate, |
| 282 | reasonIfUnsupported, |
| 283 | inputs, |
| 284 | output, |
| 285 | descriptor); |
| 286 | } |
| 287 | else if (concatInnerAxis == 3) |
| 288 | { |
| 289 | // We rely on the sub-tensor optimization to handle the batch dimension for 4D tensors. If we can't use |
| 290 | // sub-tensors for this then we can't support it. Here is where we check that the sub-tensors will work. |
| 291 | for (auto& input : inputs) |
| 292 | { |
| 293 | if (input && !output.IsTypeSpaceMatch(*input)) // Cannot use sub-tensors if the types are not same space |
| 294 | { |
| 295 | SetValueChecked(reasonIfUnsupported, "Cl Concat: Types and quantization parameters must match."); |
| 296 | return false; |
| 297 | } |
| 298 | } |
| 299 | return true; // Sub-tensors support concat along batch |
| 300 | } |
| 301 | else // > 4 dimensions not supported. |
| 302 | { |
| 303 | SetValueChecked(reasonIfUnsupported, "Cl Concat: Maximum of 4 dimensions supported."); |
| 304 | return false; |
| 305 | } |
Jim Flynn | 906f946 | 2019-05-10 13:55:21 +0100 | [diff] [blame] | 306 | } |
| 307 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 308 | bool ClLayerSupport::IsConstantSupported(const TensorInfo& output, |
| 309 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 310 | { |
Mike Kelly | 0886ac4 | 2020-04-27 09:55:40 +0100 | [diff] [blame] | 311 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClConstantWorkloadValidate, |
| 312 | reasonIfUnsupported, |
| 313 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 314 | } |
| 315 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 316 | bool ClLayerSupport::IsConvertFp16ToFp32Supported(const TensorInfo& input, |
| 317 | const TensorInfo& output, |
| 318 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 319 | { |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 320 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClConvertFp16ToFp32WorkloadValidate, |
| 321 | reasonIfUnsupported, |
| 322 | input, |
| 323 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 324 | } |
| 325 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 326 | bool ClLayerSupport::IsConvertFp32ToFp16Supported(const TensorInfo& input, |
| 327 | const TensorInfo& output, |
| 328 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 329 | { |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 330 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClConvertFp32ToFp16WorkloadValidate, |
| 331 | reasonIfUnsupported, |
| 332 | input, |
| 333 | output); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 334 | } |
| 335 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 336 | bool ClLayerSupport::IsConvolution2dSupported(const TensorInfo& input, |
| 337 | const TensorInfo& output, |
| 338 | const Convolution2dDescriptor& descriptor, |
| 339 | const TensorInfo& weights, |
| 340 | const Optional<TensorInfo>& biases, |
| 341 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 342 | { |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 343 | bool isFastMathEnabled = false; |
| 344 | #if defined(ARMCOMPUTECL_ENABLED) |
| 345 | if (m_ModelContextPtr) |
| 346 | { |
| 347 | if (m_ModelContextPtr.get() != nullptr) |
| 348 | { |
| 349 | auto modelOptions = dynamic_cast<ClBackendModelContext*>(m_ModelContextPtr.get()); |
| 350 | if (modelOptions) |
| 351 | { |
| 352 | isFastMathEnabled = modelOptions->IsFastMathEnabled(); |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | #endif |
| 357 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 358 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClConvolution2dWorkloadValidate, |
| 359 | reasonIfUnsupported, |
| 360 | input, |
| 361 | output, |
| 362 | descriptor, |
| 363 | weights, |
Sadik Armagan | 045f6be | 2020-09-10 13:37:32 +0100 | [diff] [blame] | 364 | biases, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 365 | isFastMathEnabled, |
| 366 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 367 | } |
| 368 | |
Jim Flynn | 983daec | 2019-05-29 16:20:16 +0100 | [diff] [blame] | 369 | bool ClLayerSupport::IsDequantizeSupported(const TensorInfo& input, |
| 370 | const TensorInfo& output, |
| 371 | Optional<std::string&> reasonIfUnsupported) const |
| 372 | { |
| 373 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClDequantizeWorkloadValidate, |
| 374 | reasonIfUnsupported, |
| 375 | input, |
| 376 | output); |
| 377 | } |
| 378 | |
Aron Virginas-Tar | b280196 | 2019-09-30 11:24:53 +0100 | [diff] [blame] | 379 | bool ClLayerSupport::IsDepthToSpaceSupported(const TensorInfo& input, |
| 380 | const TensorInfo& output, |
| 381 | const DepthToSpaceDescriptor& descriptor, |
| 382 | Optional<std::string&> reasonIfUnsupported) const |
| 383 | { |
| 384 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClDepthToSpaceWorkloadValidate, |
| 385 | reasonIfUnsupported, |
| 386 | input, |
| 387 | output, |
| 388 | descriptor); |
| 389 | } |
| 390 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 391 | bool ClLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, |
| 392 | const TensorInfo& output, |
| 393 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 394 | const TensorInfo& weights, |
| 395 | const Optional<TensorInfo>& biases, |
| 396 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 397 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 398 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClDepthwiseConvolutionWorkloadValidate, |
| 399 | reasonIfUnsupported, |
| 400 | input, |
| 401 | output, |
| 402 | descriptor, |
| 403 | weights, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 404 | biases, |
| 405 | nullptr); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 406 | } |
| 407 | |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 408 | bool ClLayerSupport::IsDilatedDepthwiseConvolutionSupported(const TensorInfo& input, |
| 409 | const TensorInfo& output, |
| 410 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 411 | const TensorInfo& weights, |
| 412 | const Optional<TensorInfo>& biases, |
| 413 | Optional<std::string&> reasonIfUnsupported) const |
| 414 | { |
| 415 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClDepthwiseConvolutionWorkloadValidate, |
| 416 | reasonIfUnsupported, |
| 417 | input, |
| 418 | output, |
| 419 | descriptor, |
| 420 | weights, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 421 | biases, |
| 422 | nullptr); |
Pablo Tello | f0bd683 | 2019-04-26 17:58:13 +0100 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 426 | bool ClLayerSupport::IsDivisionSupported(const TensorInfo& input0, |
| 427 | const TensorInfo& input1, |
| 428 | const TensorInfo& output, |
| 429 | Optional<std::string&> reasonIfUnsupported) const |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 430 | { |
| 431 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClDivisionWorkloadValidate, |
| 432 | reasonIfUnsupported, |
| 433 | input0, |
| 434 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 435 | output, |
| 436 | nullptr); |
Francis Murtagh | e7a86a4 | 2018-08-29 12:42:10 +0100 | [diff] [blame] | 437 | } |
| 438 | |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 439 | bool ClLayerSupport::IsElementwiseUnarySupported(const TensorInfo& input, |
| 440 | const TensorInfo& output, |
| 441 | const ElementwiseUnaryDescriptor& descriptor, |
| 442 | Optional<std::string&> reasonIfUnsupported) const |
| 443 | { |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 444 | switch(descriptor.m_Operation) |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 445 | { |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 446 | case UnaryOperation::Abs: |
| 447 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClAbsWorkloadValidate, |
| 448 | reasonIfUnsupported, |
| 449 | input, |
| 450 | output); |
| 451 | case UnaryOperation::Exp: |
| 452 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClExpWorkloadValidate, |
| 453 | reasonIfUnsupported, |
| 454 | input, |
| 455 | output); |
| 456 | case UnaryOperation::Neg: |
| 457 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClNegWorkloadValidate, |
| 458 | reasonIfUnsupported, |
| 459 | input, |
| 460 | output); |
| 461 | case UnaryOperation::Rsqrt: |
| 462 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClRsqrtWorkloadValidate, |
| 463 | reasonIfUnsupported, |
| 464 | input, |
| 465 | output); |
James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 466 | case UnaryOperation::LogicalNot: |
| 467 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClLogicalNotWorkloadValidate, |
| 468 | reasonIfUnsupported, |
| 469 | input, |
| 470 | output); |
Sadik Armagan | 9fabf43 | 2020-05-27 13:40:58 +0100 | [diff] [blame] | 471 | default: |
| 472 | return false; |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 473 | } |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 474 | } |
| 475 | |
Teresa Charlin | 4b10fef | 2020-07-29 09:36:41 +0100 | [diff] [blame] | 476 | bool ClLayerSupport::IsFillSupported(const TensorInfo& input, |
| 477 | const TensorInfo& output, |
| 478 | const FillDescriptor& descriptor, |
| 479 | Optional<std::string&> reasonIfUnsupported) const |
Sadik Armagan | 66aecb0 | 2020-06-24 11:42:20 +0100 | [diff] [blame] | 480 | { |
Teresa Charlin | 4b10fef | 2020-07-29 09:36:41 +0100 | [diff] [blame] | 481 | armnn::IgnoreUnused(input); |
| 482 | armnn::IgnoreUnused(output); |
| 483 | armnn::IgnoreUnused(descriptor); |
| 484 | |
| 485 | return IsClBackendSupported(reasonIfUnsupported); |
Sadik Armagan | 66aecb0 | 2020-06-24 11:42:20 +0100 | [diff] [blame] | 486 | } |
| 487 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 488 | bool ClLayerSupport::IsFloorSupported(const TensorInfo& input, |
| 489 | const TensorInfo& output, |
| 490 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 491 | { |
Sadik Armagan | 9be4916 | 2019-10-30 16:15:26 +0000 | [diff] [blame] | 492 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClFloorWorkloadValidate, |
| 493 | reasonIfUnsupported, |
| 494 | input, |
| 495 | output); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 496 | } |
| 497 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 498 | bool ClLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, |
| 499 | const TensorInfo& output, |
| 500 | const TensorInfo& weights, |
| 501 | const TensorInfo& biases, |
| 502 | const FullyConnectedDescriptor& descriptor, |
| 503 | Optional<std::string&> reasonIfUnsupported) const |
| 504 | { |
| 505 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClFullyConnectedWorkloadValidate, |
| 506 | reasonIfUnsupported, |
| 507 | input, |
| 508 | output, |
| 509 | weights, |
| 510 | biases, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 511 | descriptor, |
| 512 | nullptr); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 513 | } |
| 514 | |
Teresa Charlin | 9ad2e5b | 2020-04-10 22:34:48 +0100 | [diff] [blame] | 515 | bool ClLayerSupport::IsGatherSupported(const TensorInfo& input0, |
| 516 | const TensorInfo& input1, |
| 517 | const TensorInfo& output, |
Teresa Charlin | 5266473 | 2020-06-29 16:27:03 +0100 | [diff] [blame] | 518 | const GatherDescriptor& descriptor, |
Teresa Charlin | 9ad2e5b | 2020-04-10 22:34:48 +0100 | [diff] [blame] | 519 | Optional<std::string&> reasonIfUnsupported) const |
| 520 | { |
| 521 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClGatherWorkloadValidate, |
| 522 | reasonIfUnsupported, |
| 523 | input0, |
| 524 | input1, |
Teresa Charlin | 5266473 | 2020-06-29 16:27:03 +0100 | [diff] [blame] | 525 | output, |
| 526 | descriptor); |
Teresa Charlin | 9ad2e5b | 2020-04-10 22:34:48 +0100 | [diff] [blame] | 527 | } |
| 528 | |
Nattapat Chaimanowong | c6a41ff | 2019-01-29 09:56:02 +0000 | [diff] [blame] | 529 | bool ClLayerSupport::IsGreaterSupported(const TensorInfo& input0, |
| 530 | const TensorInfo& input1, |
| 531 | const TensorInfo& output, |
| 532 | Optional<std::string&> reasonIfUnsupported) const |
| 533 | { |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 534 | ComparisonDescriptor descriptor(ComparisonOperation::Greater); |
| 535 | return IsComparisonSupported(input0, input1, output, descriptor, reasonIfUnsupported); |
Nattapat Chaimanowong | c6a41ff | 2019-01-29 09:56:02 +0000 | [diff] [blame] | 536 | } |
| 537 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 538 | bool ClLayerSupport::IsInputSupported(const TensorInfo& input, |
| 539 | Optional<std::string&> reasonIfUnsupported) const |
| 540 | { |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 541 | return IsClBackendSupported(reasonIfUnsupported, input); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 542 | } |
| 543 | |
Aron Virginas-Tar | 8168f40 | 2019-10-04 13:10:16 +0100 | [diff] [blame] | 544 | bool ClLayerSupport::IsInstanceNormalizationSupported(const TensorInfo& input, |
| 545 | const TensorInfo& output, |
| 546 | const InstanceNormalizationDescriptor& descriptor, |
| 547 | Optional<std::string&> reasonIfUnsupported) const |
| 548 | { |
| 549 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClInstanceNormalizationWorkloadValidate, |
| 550 | reasonIfUnsupported, |
| 551 | input, |
| 552 | output, |
| 553 | descriptor); |
| 554 | } |
| 555 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 556 | bool ClLayerSupport::IsL2NormalizationSupported(const TensorInfo& input, |
| 557 | const TensorInfo& output, |
| 558 | const L2NormalizationDescriptor& descriptor, |
| 559 | Optional<std::string&> reasonIfUnsupported) const |
| 560 | { |
| 561 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClL2NormalizationWorkloadValidate, |
| 562 | reasonIfUnsupported, |
| 563 | input, |
| 564 | output, |
| 565 | descriptor); |
| 566 | } |
| 567 | |
James Conroy | fe3ec94 | 2020-11-18 14:20:53 +0000 | [diff] [blame] | 568 | bool ClLayerSupport::IsLogicalBinarySupported(const TensorInfo& input0, |
| 569 | const TensorInfo& input1, |
| 570 | const TensorInfo& output, |
| 571 | const LogicalBinaryDescriptor& descriptor, |
| 572 | Optional<std::string&> reasonIfUnsupported) const |
| 573 | { |
| 574 | IgnoreUnused(output); |
| 575 | |
| 576 | switch(descriptor.m_Operation) |
| 577 | { |
| 578 | case LogicalBinaryOperation::LogicalAnd: |
| 579 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClLogicalAndWorkloadValidate, |
| 580 | reasonIfUnsupported, |
| 581 | input0, |
| 582 | input1, |
| 583 | output); |
| 584 | case LogicalBinaryOperation::LogicalOr: |
| 585 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClLogicalOrWorkloadValidate, |
| 586 | reasonIfUnsupported, |
| 587 | input0, |
| 588 | input1, |
| 589 | output); |
| 590 | default: |
| 591 | return false; |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | |
Teresa Charlin | 8398edc | 2020-07-20 14:23:02 +0100 | [diff] [blame] | 596 | bool ClLayerSupport::IsLogSoftmaxSupported(const TensorInfo& input, |
| 597 | const TensorInfo& output, |
| 598 | const LogSoftmaxDescriptor& descriptor, |
| 599 | Optional<std::string&> reasonIfUnsupported) const |
| 600 | { |
| 601 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClLogSoftmaxWorkloadValidate, |
| 602 | reasonIfUnsupported, |
| 603 | input, |
| 604 | output, |
| 605 | descriptor); |
| 606 | } |
| 607 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 608 | bool ClLayerSupport::IsLstmSupported(const TensorInfo& input, |
| 609 | const TensorInfo& outputStateIn, |
| 610 | const TensorInfo& cellStateIn, |
| 611 | const TensorInfo& scratchBuffer, |
| 612 | const TensorInfo& outputStateOut, |
| 613 | const TensorInfo& cellStateOut, |
| 614 | const TensorInfo& output, |
| 615 | const LstmDescriptor& descriptor, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 616 | const LstmInputParamsInfo& paramsInfo, |
| 617 | Optional<std::string&> reasonIfUnsupported) const |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 618 | { |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 619 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClLstmFloatWorkloadValidate, |
| 620 | reasonIfUnsupported, |
| 621 | input, |
| 622 | outputStateIn, |
| 623 | cellStateIn, |
| 624 | scratchBuffer, |
| 625 | outputStateOut, |
| 626 | cellStateOut, |
| 627 | output, |
| 628 | descriptor, |
Jan Eilers | d01a83c | 2019-07-03 18:20:40 +0100 | [diff] [blame] | 629 | paramsInfo); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 630 | } |
| 631 | |
keidav01 | a959ee5 | 2018-12-19 10:04:58 +0000 | [diff] [blame] | 632 | bool ClLayerSupport::IsMaximumSupported(const TensorInfo& input0, |
| 633 | const TensorInfo& input1, |
| 634 | const TensorInfo& output, |
| 635 | Optional<std::string&> reasonIfUnsupported) const |
| 636 | { |
| 637 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClMaximumWorkloadValidate, |
| 638 | reasonIfUnsupported, |
| 639 | input0, |
| 640 | input1, |
| 641 | output); |
| 642 | } |
| 643 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 644 | bool ClLayerSupport::IsMeanSupported(const TensorInfo& input, |
| 645 | const TensorInfo& output, |
| 646 | const MeanDescriptor& descriptor, |
| 647 | Optional<std::string&> reasonIfUnsupported) const |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 648 | { |
Matteo Martincigh | 28dcab6 | 2018-10-19 16:40:03 +0100 | [diff] [blame] | 649 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClMeanValidate, |
| 650 | reasonIfUnsupported, |
| 651 | input, |
| 652 | output, |
| 653 | descriptor); |
narpra01 | 32b9046 | 2018-09-13 11:07:48 +0100 | [diff] [blame] | 654 | } |
| 655 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 656 | bool ClLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> inputs, |
Nikhil Raj | 8599a41 | 2018-11-19 14:51:07 +0000 | [diff] [blame] | 657 | const TensorInfo& output, |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 658 | const MergerDescriptor& descriptor, |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 659 | Optional<std::string&> reasonIfUnsupported) const |
| 660 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 661 | return IsConcatSupported(inputs, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 662 | } |
| 663 | |
saoste01 | 9292aa3 | 2019-01-08 13:55:59 +0000 | [diff] [blame] | 664 | bool ClLayerSupport::IsMinimumSupported(const TensorInfo& input0, |
| 665 | const TensorInfo& input1, |
| 666 | const TensorInfo& output, |
| 667 | Optional<std::string&> reasonIfUnsupported) const |
| 668 | { |
| 669 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClMinimumWorkloadValidate, |
| 670 | reasonIfUnsupported, |
| 671 | input0, |
| 672 | input1, |
| 673 | output); |
| 674 | } |
| 675 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 676 | bool ClLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, |
| 677 | const TensorInfo& input1, |
| 678 | const TensorInfo& output, |
| 679 | Optional<std::string&> reasonIfUnsupported) const |
| 680 | { |
| 681 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClMultiplicationWorkloadValidate, |
| 682 | reasonIfUnsupported, |
| 683 | input0, |
| 684 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 685 | output, |
| 686 | nullptr); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 687 | } |
| 688 | |
| 689 | bool ClLayerSupport::IsNormalizationSupported(const TensorInfo& input, |
| 690 | const TensorInfo& output, |
| 691 | const NormalizationDescriptor& descriptor, |
| 692 | Optional<std::string&> reasonIfUnsupported) const |
| 693 | { |
| 694 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClNormalizationWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 695 | } |
| 696 | |
| 697 | bool ClLayerSupport::IsOutputSupported(const TensorInfo& output, |
| 698 | Optional<std::string&> reasonIfUnsupported) const |
| 699 | { |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 700 | return IsClBackendSupported(reasonIfUnsupported, output); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 701 | } |
| 702 | |
| 703 | bool ClLayerSupport::IsPadSupported(const TensorInfo& input, |
| 704 | const TensorInfo& output, |
| 705 | const PadDescriptor& descriptor, |
| 706 | Optional<std::string&> reasonIfUnsupported) const |
arovir01 | 085f0a4 | 2018-10-08 14:48:19 +0100 | [diff] [blame] | 707 | { |
| 708 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClPadValidate, |
| 709 | reasonIfUnsupported, |
| 710 | input, |
| 711 | output, |
| 712 | descriptor); |
| 713 | } |
| 714 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 715 | bool ClLayerSupport::IsPermuteSupported(const TensorInfo& input, |
| 716 | const TensorInfo& output, |
| 717 | const PermuteDescriptor& descriptor, |
| 718 | Optional<std::string&> reasonIfUnsupported) const |
| 719 | { |
Matthew Bentham | 9820d30 | 2019-11-27 17:24:47 +0000 | [diff] [blame] | 720 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClPermuteWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 721 | } |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 722 | |
| 723 | bool ClLayerSupport::IsPooling2dSupported(const TensorInfo& input, |
| 724 | const TensorInfo& output, |
| 725 | const Pooling2dDescriptor& descriptor, |
| 726 | Optional<std::string&> reasonIfUnsupported) const |
| 727 | { |
| 728 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClPooling2dWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 729 | } |
| 730 | |
Nikhil Raj | 91e4c6d | 2019-07-05 12:22:58 +0100 | [diff] [blame] | 731 | bool ClLayerSupport::IsPreluSupported(const armnn::TensorInfo &input, |
| 732 | const armnn::TensorInfo &alpha, |
| 733 | const armnn::TensorInfo &output, |
| 734 | armnn::Optional<std::string &> reasonIfUnsupported) const |
| 735 | { |
| 736 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClPreluWorkloadValidate, reasonIfUnsupported, input, alpha, output); |
| 737 | } |
| 738 | |
Ryan OShea | 2323af4 | 2020-05-13 16:36:19 +0100 | [diff] [blame] | 739 | bool ClLayerSupport::IsQLstmSupported(const TensorInfo& input, |
| 740 | const TensorInfo& previousOutputIn, |
| 741 | const TensorInfo& previousCellStateIn, |
| 742 | const TensorInfo& outputStateOut, |
| 743 | const TensorInfo& cellStateOut, |
| 744 | const TensorInfo& output, |
| 745 | const QLstmDescriptor& descriptor, |
| 746 | const LstmInputParamsInfo& paramsInfo, |
| 747 | Optional<std::string&> reasonIfUnsupported) const |
| 748 | { |
| 749 | if (input.GetDataType() == armnn::DataType::QAsymmS8 && |
| 750 | previousOutputIn.GetDataType() == armnn::DataType::QAsymmS8 && |
| 751 | previousCellStateIn.GetDataType() == armnn::DataType::QSymmS16 && |
| 752 | outputStateOut.GetDataType() == armnn::DataType::QAsymmS8 && |
| 753 | cellStateOut.GetDataType() == armnn::DataType::QSymmS16 && |
| 754 | output.GetDataType() == armnn::DataType::QAsymmS8) |
| 755 | { |
| 756 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClQLstmWorkloadValidate, |
| 757 | reasonIfUnsupported, |
| 758 | input, |
| 759 | previousCellStateIn, |
| 760 | previousOutputIn, |
| 761 | cellStateOut, |
| 762 | outputStateOut, |
| 763 | output, |
| 764 | descriptor, |
| 765 | paramsInfo); |
| 766 | } |
| 767 | else |
| 768 | { |
| 769 | return false; |
| 770 | } |
| 771 | } |
| 772 | |
Ferran Balaguer | 737d9ff | 2019-08-01 09:58:08 +0100 | [diff] [blame] | 773 | bool ClLayerSupport::IsQuantizedLstmSupported(const TensorInfo& input, |
| 774 | const TensorInfo& previousCellStateIn, |
| 775 | const TensorInfo& previousOutputIn, |
| 776 | const TensorInfo& cellStateOut, |
| 777 | const TensorInfo& output, |
| 778 | const QuantizedLstmInputParamsInfo& paramsInfo, |
| 779 | Optional<std::string&> reasonIfUnsupported) const |
| 780 | { |
| 781 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClQuantizedLstmWorkloadValidate, |
| 782 | reasonIfUnsupported, |
| 783 | input, |
| 784 | previousCellStateIn, |
| 785 | previousOutputIn, |
| 786 | cellStateOut, |
| 787 | output, |
| 788 | paramsInfo); |
| 789 | } |
| 790 | |
Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 791 | bool ClLayerSupport::IsQuantizeSupported(const TensorInfo& input, |
| 792 | const TensorInfo& output, |
| 793 | Optional<std::string&> reasonIfUnsupported) const |
| 794 | { |
| 795 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClQuantizeWorkloadValidate, |
| 796 | reasonIfUnsupported, |
| 797 | input, |
| 798 | output); |
| 799 | } |
| 800 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 801 | bool ClLayerSupport::IsReshapeSupported(const TensorInfo& input, |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 802 | const TensorInfo& output, |
Matteo Martincigh | 992d6dc | 2019-01-10 17:34:20 +0000 | [diff] [blame] | 803 | const ReshapeDescriptor& descriptor, |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 804 | Optional<std::string&> reasonIfUnsupported) const |
| 805 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 806 | IgnoreUnused(descriptor); |
Kevin May | a023c40 | 2019-12-12 17:28:05 +0000 | [diff] [blame] | 807 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClReshapeWorkloadValidate, reasonIfUnsupported, input, output); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 808 | } |
| 809 | |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 810 | bool ClLayerSupport::IsResizeSupported(const TensorInfo& input, |
| 811 | const TensorInfo& output, |
| 812 | const ResizeDescriptor& descriptor, |
| 813 | Optional<std::string&> reasonIfUnsupported) const |
| 814 | { |
Aron Virginas-Tar | cc0cefb | 2019-07-02 17:25:47 +0100 | [diff] [blame] | 815 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClResizeWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
Aron Virginas-Tar | 169d2f1 | 2019-07-01 19:01:44 +0100 | [diff] [blame] | 816 | } |
| 817 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 818 | bool ClLayerSupport::IsResizeBilinearSupported(const TensorInfo& input, |
Sadik Armagan | c625f00 | 2018-12-17 11:32:16 +0000 | [diff] [blame] | 819 | const TensorInfo& output, |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 820 | Optional<std::string&> reasonIfUnsupported) const |
| 821 | { |
Aron Virginas-Tar | cc0cefb | 2019-07-02 17:25:47 +0100 | [diff] [blame] | 822 | ResizeDescriptor descriptor; |
| 823 | descriptor.m_Method = ResizeMethod::Bilinear; |
| 824 | descriptor.m_DataLayout = DataLayout::NCHW; |
| 825 | |
| 826 | const TensorShape& outputShape = output.GetShape(); |
| 827 | descriptor.m_TargetHeight = outputShape[2]; |
| 828 | descriptor.m_TargetWidth = outputShape[3]; |
| 829 | |
| 830 | return IsResizeSupported(input, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 831 | } |
| 832 | |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 833 | bool ClLayerSupport::IsRsqrtSupported(const TensorInfo& input, |
| 834 | const TensorInfo& output, |
| 835 | Optional<std::string&> reasonIfUnsupported) const |
| 836 | { |
josh minor | 4a3c610 | 2020-01-06 16:40:46 -0600 | [diff] [blame] | 837 | ElementwiseUnaryDescriptor descriptor(UnaryOperation::Rsqrt); |
| 838 | return IsElementwiseUnarySupported(input, output, descriptor, reasonIfUnsupported); |
Aron Virginas-Tar | 1a763dd | 2019-09-10 12:32:08 +0100 | [diff] [blame] | 839 | } |
| 840 | |
Aron Virginas-Tar | 94c4fef | 2019-11-25 15:37:08 +0000 | [diff] [blame] | 841 | bool ClLayerSupport::IsSliceSupported(const TensorInfo& input, |
| 842 | const TensorInfo& output, |
| 843 | const SliceDescriptor& descriptor, |
| 844 | Optional<std::string&> reasonIfUnsupported) const |
| 845 | { |
| 846 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClSliceWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 847 | } |
| 848 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 849 | bool ClLayerSupport::IsSoftmaxSupported(const TensorInfo& input, |
| 850 | const TensorInfo& output, |
| 851 | const SoftmaxDescriptor& descriptor, |
| 852 | Optional<std::string&> reasonIfUnsupported) const |
| 853 | { |
Francis Murtagh | 3b93835 | 2019-07-26 15:44:17 +0100 | [diff] [blame] | 854 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClSoftmaxWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 855 | } |
| 856 | |
Sadik Armagan | f446432 | 2018-12-20 16:19:12 +0000 | [diff] [blame] | 857 | bool ClLayerSupport::IsSpaceToBatchNdSupported(const TensorInfo& input, |
| 858 | const TensorInfo& output, |
| 859 | const SpaceToBatchNdDescriptor& descriptor, |
| 860 | Optional<std::string&> reasonIfUnsupported) const |
| 861 | { |
| 862 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClSpaceToBatchNdWorkloadValidate, |
| 863 | reasonIfUnsupported, |
| 864 | input, |
| 865 | output, |
| 866 | descriptor); |
| 867 | } |
| 868 | |
James Conroy | d2aa85e | 2019-07-01 17:12:40 +0100 | [diff] [blame] | 869 | bool ClLayerSupport::IsSpaceToDepthSupported(const TensorInfo& input, |
| 870 | const TensorInfo& output, |
| 871 | const SpaceToDepthDescriptor& descriptor, |
| 872 | Optional<std::string&> reasonIfUnsupported) const |
| 873 | { |
| 874 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClSpaceToDepthWorkloadValidate, |
| 875 | reasonIfUnsupported, |
| 876 | input, |
| 877 | output, |
| 878 | descriptor); |
| 879 | } |
| 880 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 881 | bool ClLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 882 | const ViewsDescriptor& descriptor, |
| 883 | Optional<std::string&> reasonIfUnsupported) const |
| 884 | { |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 885 | IgnoreUnused(descriptor); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 886 | return IsSupportedForDataTypeCl(reasonIfUnsupported, |
| 887 | input.GetDataType(), |
| 888 | &TrueFunc<>, |
| 889 | &TrueFunc<>); |
| 890 | } |
| 891 | |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 892 | bool ClLayerSupport::IsSplitterSupported(const TensorInfo& input, |
| 893 | const std::vector<std::reference_wrapper<TensorInfo>>& outputs, |
| 894 | const ViewsDescriptor& descriptor, |
| 895 | Optional<std::string&> reasonIfUnsupported) const |
| 896 | { |
Narumol Prangnawarat | 7413583 | 2019-05-23 15:07:33 +0100 | [diff] [blame] | 897 | #if defined(ARMCOMPUTECL_ENABLED) |
| 898 | // Split along the last dimension, cannot use sub-tensors |
| 899 | // as width and height of the sub-tensors do not match |
| 900 | // the width and height of the parent tensor |
| 901 | // in case of input with more than 2D. |
| 902 | std::set<unsigned int> splitAxis = ComputeSplitAxis(descriptor, input.GetShape()); |
| 903 | if (descriptor.GetNumDimensions() > 2 && splitAxis.size() == 1 && |
| 904 | *splitAxis.begin() == descriptor.GetNumDimensions() - 1 ) |
| 905 | { |
| 906 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClSplitterWorkloadValidate, |
| 907 | reasonIfUnsupported, |
| 908 | input, |
| 909 | outputs, |
| 910 | *splitAxis.begin()); |
| 911 | } |
| 912 | #endif |
Jan Eilers | 8eb2560 | 2020-03-09 12:13:48 +0000 | [diff] [blame] | 913 | IgnoreUnused(descriptor); |
Narumol Prangnawarat | 7413583 | 2019-05-23 15:07:33 +0100 | [diff] [blame] | 914 | for (auto output : outputs) |
| 915 | { |
| 916 | if (!input.IsTypeSpaceMatch(output)) // Cannot use sub-tensors if the types are not same space |
| 917 | { |
| 918 | SetValueChecked(reasonIfUnsupported, "Cl Splitter: Types and quantization parameters must match."); |
| 919 | return false; |
| 920 | } |
| 921 | } |
| 922 | return true; |
Narumol Prangnawarat | 15eb583 | 2019-05-20 15:31:05 +0100 | [diff] [blame] | 923 | } |
| 924 | |
Matthew Jackson | d516610 | 2019-07-31 14:06:28 +0100 | [diff] [blame] | 925 | bool ClLayerSupport::IsStackSupported(const std::vector<const TensorInfo*>& inputs, |
| 926 | const TensorInfo& output, |
| 927 | const StackDescriptor& descriptor, |
| 928 | Optional<std::string&> reasonIfUnsupported) const |
| 929 | { |
| 930 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClStackWorkloadValidate, |
| 931 | reasonIfUnsupported, |
| 932 | inputs, |
| 933 | output, |
| 934 | descriptor); |
| 935 | } |
| 936 | |
keidav01 | d74dc91 | 2018-12-10 18:16:07 +0000 | [diff] [blame] | 937 | bool ClLayerSupport::IsStridedSliceSupported(const TensorInfo& input, |
| 938 | const TensorInfo& output, |
| 939 | const StridedSliceDescriptor& descriptor, |
| 940 | Optional<std::string&> reasonIfUnsupported) const |
| 941 | { |
| 942 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClStridedSliceWorkloadValidate, |
| 943 | reasonIfUnsupported, |
| 944 | input, |
| 945 | output, |
| 946 | descriptor); |
| 947 | } |
| 948 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 949 | bool ClLayerSupport::IsSubtractionSupported(const TensorInfo& input0, |
| 950 | const TensorInfo& input1, |
| 951 | const TensorInfo& output, |
| 952 | Optional<std::string&> reasonIfUnsupported) const |
| 953 | { |
| 954 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClSubtractionValidate, |
| 955 | reasonIfUnsupported, |
| 956 | input0, |
| 957 | input1, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 958 | output, |
| 959 | nullptr); |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 960 | } |
| 961 | |
Aron Virginas-Tar | 7a3e2fe | 2019-06-27 18:54:47 +0100 | [diff] [blame] | 962 | bool ClLayerSupport::IsTransposeConvolution2dSupported(const TensorInfo& input, |
| 963 | const TensorInfo& output, |
| 964 | const TransposeConvolution2dDescriptor& descriptor, |
| 965 | const TensorInfo& weights, |
| 966 | const Optional<TensorInfo>& biases, |
| 967 | Optional<std::string&> reasonIfUnsupported) const |
| 968 | { |
| 969 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClTransposeConvolution2dWorkloadValidate, |
| 970 | reasonIfUnsupported, |
| 971 | input, |
| 972 | output, |
| 973 | descriptor, |
| 974 | weights, |
| 975 | biases); |
| 976 | } |
| 977 | |
Mike Kelly | c9ea45a | 2020-02-28 18:11:58 +0000 | [diff] [blame] | 978 | bool ClLayerSupport::IsTransposeSupported(const TensorInfo& input, |
| 979 | const TensorInfo& output, |
| 980 | const TransposeDescriptor& descriptor, |
| 981 | Optional<std::string&> reasonIfUnsupported) const |
| 982 | { |
| 983 | FORWARD_WORKLOAD_VALIDATE_FUNC(ClTransposeWorkloadValidate, reasonIfUnsupported, input, output, descriptor); |
| 984 | } |
| 985 | |
Aron Virginas-Tar | bcf9f16 | 2018-10-15 11:47:37 +0100 | [diff] [blame] | 986 | } // namespace armnn |