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> |
| 9 | |
saoste01 | 2df12b3 | 2018-11-28 16:57:20 +0000 | [diff] [blame^] | 10 | #include "Maximum.hpp" |
| 11 | |
David Beck | 591cdb7 | 2018-09-11 16:37:14 +0100 | [diff] [blame] | 12 | namespace armnn |
| 13 | { |
| 14 | |
| 15 | template <typename Functor> |
Éanna Ó Catháin | d57415d | 2018-11-28 16:24:38 +0000 | [diff] [blame] | 16 | ElementwiseFunction<Functor>::ElementwiseFunction(const TensorShape& inShape0, |
David Beck | 591cdb7 | 2018-09-11 16:37:14 +0100 | [diff] [blame] | 17 | const TensorShape& inShape1, |
| 18 | const TensorShape& outShape, |
| 19 | const float* inData0, |
| 20 | const float* inData1, |
| 21 | float* outData) |
| 22 | { |
| 23 | BroadcastLoop(inShape0, inShape1, outShape).Unroll(Functor(), 0, inData0, inData1, outData); |
| 24 | } |
| 25 | |
| 26 | } //namespace armnn |
| 27 | |
Éanna Ó Catháin | d57415d | 2018-11-28 16:24:38 +0000 | [diff] [blame] | 28 | template struct armnn::ElementwiseFunction<std::plus<float>>; |
| 29 | template struct armnn::ElementwiseFunction<std::minus<float>>; |
| 30 | template struct armnn::ElementwiseFunction<std::multiplies<float>>; |
| 31 | template struct armnn::ElementwiseFunction<std::divides<float>>; |
saoste01 | 2df12b3 | 2018-11-28 16:57:20 +0000 | [diff] [blame^] | 32 | template struct armnn::ElementwiseFunction<armnn::maximum<float>>; |