giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 1 | /* |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2019 ARM Limited. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 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 |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 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 | #include "arm_compute/runtime/NEON/functions/NEElementwiseOperations.h" |
| 25 | #include <arm_compute/core/NEON/kernels/NEElementwiseOperationKernel.h> |
| 26 | |
| 27 | #include "arm_compute/core/ITensor.h" |
| 28 | #include "support/ToolchainSupport.h" |
| 29 | |
| 30 | #include <utility> |
| 31 | |
| 32 | namespace arm_compute |
| 33 | { |
| 34 | void NEElementwiseMax::configure(ITensor *input1, ITensor *input2, ITensor *output) |
| 35 | { |
| 36 | auto k = arm_compute::support::cpp14::make_unique<NEArithmeticOperationKernel>(); |
| 37 | k->configure(ArithmeticOperation::MAX, input1, input2, output); |
| 38 | _kernel = std::move(k); |
| 39 | } |
| 40 | |
| 41 | Status NEElementwiseMax::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) |
| 42 | { |
| 43 | return NEArithmeticOperationKernel::validate(ArithmeticOperation::MAX, input1, input2, output); |
| 44 | } |
| 45 | |
| 46 | void NEElementwiseMin::configure(ITensor *input1, ITensor *input2, ITensor *output) |
| 47 | { |
| 48 | auto k = arm_compute::support::cpp14::make_unique<NEArithmeticOperationKernel>(); |
| 49 | k->configure(ArithmeticOperation::MIN, input1, input2, output); |
| 50 | _kernel = std::move(k); |
| 51 | } |
| 52 | |
| 53 | Status NEElementwiseMin::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) |
| 54 | { |
| 55 | return NEArithmeticOperationKernel::validate(ArithmeticOperation::MIN, input1, input2, output); |
| 56 | } |
| 57 | |
| 58 | void NEElementwiseSquaredDiff::configure(ITensor *input1, ITensor *input2, ITensor *output) |
| 59 | { |
| 60 | auto k = arm_compute::support::cpp14::make_unique<NEArithmeticOperationKernel>(); |
| 61 | k->configure(ArithmeticOperation::SQUARED_DIFF, input1, input2, output); |
| 62 | _kernel = std::move(k); |
| 63 | } |
| 64 | |
| 65 | Status NEElementwiseSquaredDiff::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) |
| 66 | { |
| 67 | return NEArithmeticOperationKernel::validate(ArithmeticOperation::SQUARED_DIFF, input1, input2, output); |
| 68 | } |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 69 | |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 70 | void NEElementwiseDivision::configure(ITensor *input1, ITensor *input2, ITensor *output) |
| 71 | { |
| 72 | auto k = arm_compute::support::cpp14::make_unique<NEDivisionOperationKernel>(); |
| 73 | k->configure(input1, input2, output); |
| 74 | _kernel = std::move(k); |
| 75 | } |
| 76 | |
| 77 | Status NEElementwiseDivision::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) |
| 78 | { |
| 79 | return NEDivisionOperationKernel::validate(input1, input2, output); |
| 80 | } |
| 81 | |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 82 | void NEElementwisePower::configure(ITensor *input1, ITensor *input2, ITensor *output) |
| 83 | { |
| 84 | auto k = arm_compute::support::cpp14::make_unique<NEPowerOperationKernel>(); |
| 85 | k->configure(input1, input2, output); |
| 86 | _kernel = std::move(k); |
| 87 | } |
| 88 | |
| 89 | Status NEElementwisePower::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) |
| 90 | { |
| 91 | return NEPowerOperationKernel::validate(input1, input2, output); |
| 92 | } |
| 93 | |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 94 | template <ComparisonOperation COP> |
| 95 | void NEElementwiseComparisonStatic<COP>::configure(ITensor *input1, ITensor *input2, ITensor *output) |
| 96 | { |
| 97 | auto k = arm_compute::support::cpp14::make_unique<NEComparisonOperationKernel>(); |
| 98 | k->configure(COP, input1, input2, output); |
| 99 | _kernel = std::move(k); |
| 100 | } |
| 101 | |
| 102 | template <ComparisonOperation COP> |
| 103 | Status NEElementwiseComparisonStatic<COP>::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output) |
| 104 | { |
| 105 | return NEComparisonOperationKernel::validate(COP, input1, input2, output); |
| 106 | } |
| 107 | |
| 108 | void NEElementwiseComparison::configure(ITensor *input1, ITensor *input2, ITensor *output, ComparisonOperation op) |
| 109 | { |
| 110 | auto k = arm_compute::support::cpp14::make_unique<NEComparisonOperationKernel>(); |
| 111 | k->configure(op, input1, input2, output); |
| 112 | _kernel = std::move(k); |
| 113 | } |
| 114 | |
| 115 | Status NEElementwiseComparison::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ComparisonOperation op) |
| 116 | { |
| 117 | return NEComparisonOperationKernel::validate(op, input1, input2, output); |
| 118 | } |
Georgios Pinitas | 83bbf77 | 2019-01-25 16:44:07 +0000 | [diff] [blame] | 119 | |
| 120 | // Supported Specializations |
| 121 | template class NEElementwiseComparisonStatic<ComparisonOperation::Equal>; |
| 122 | template class NEElementwiseComparisonStatic<ComparisonOperation::NotEqual>; |
| 123 | template class NEElementwiseComparisonStatic<ComparisonOperation::Greater>; |
| 124 | template class NEElementwiseComparisonStatic<ComparisonOperation::GreaterEqual>; |
| 125 | template class NEElementwiseComparisonStatic<ComparisonOperation::Less>; |
| 126 | template class NEElementwiseComparisonStatic<ComparisonOperation::LessEqual>; |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 127 | } // namespace arm_compute |