David Beck | 591cdb7 | 2018-09-11 16:37:14 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
Éanna Ó Catháin | d57415d | 2018-11-28 16:24:38 +0000 | [diff] [blame] | 6 | #include "ElementwiseFunction.hpp" |
David Beck | 591cdb7 | 2018-09-11 16:37:14 +0100 | [diff] [blame] | 7 | #include "Broadcast.hpp" |
| 8 | #include <functional> |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 9 | #include "Minimum.hpp" |
David Beck | 591cdb7 | 2018-09-11 16:37:14 +0100 | [diff] [blame] | 10 | |
saoste01 | 2df12b3 | 2018-11-28 16:57:20 +0000 | [diff] [blame] | 11 | #include "Maximum.hpp" |
| 12 | |
David Beck | 591cdb7 | 2018-09-11 16:37:14 +0100 | [diff] [blame] | 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | template <typename Functor> |
Éanna Ó Catháin | d57415d | 2018-11-28 16:24:38 +0000 | [diff] [blame] | 17 | ElementwiseFunction<Functor>::ElementwiseFunction(const TensorShape& inShape0, |
FrancisMurtagh | 30cdfca | 2018-12-18 12:57:35 +0000 | [diff] [blame^] | 18 | const TensorShape& inShape1, |
| 19 | const TensorShape& outShape, |
| 20 | const float* inData0, |
| 21 | const float* inData1, |
| 22 | float* outData) |
David Beck | 591cdb7 | 2018-09-11 16:37:14 +0100 | [diff] [blame] | 23 | { |
| 24 | BroadcastLoop(inShape0, inShape1, outShape).Unroll(Functor(), 0, inData0, inData1, outData); |
| 25 | } |
| 26 | |
| 27 | } //namespace armnn |
| 28 | |
Éanna Ó Catháin | d57415d | 2018-11-28 16:24:38 +0000 | [diff] [blame] | 29 | template struct armnn::ElementwiseFunction<std::plus<float>>; |
| 30 | template struct armnn::ElementwiseFunction<std::minus<float>>; |
| 31 | template struct armnn::ElementwiseFunction<std::multiplies<float>>; |
| 32 | template struct armnn::ElementwiseFunction<std::divides<float>>; |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 33 | template struct armnn::ElementwiseFunction<armnn::maximum<float>>; |
FrancisMurtagh | 30cdfca | 2018-12-18 12:57:35 +0000 | [diff] [blame^] | 34 | template struct armnn::ElementwiseFunction<armnn::minimum<float>>; |
| 35 | template struct armnn::ElementwiseFunction<std::equal_to<float>>; |