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 | |
Derek Lamberti | f30f7d3 | 2019-04-09 10:25:02 +0100 | [diff] [blame] | 16 | template <typename Functor> |
| 17 | ElementwiseFunction<Functor>::ElementwiseFunction(const TensorShape& inShape0, |
| 18 | const TensorShape& inShape1, |
| 19 | const TensorShape& outShape, |
| 20 | armnn::Decoder<InType>& inData0, |
| 21 | armnn::Decoder<InType>& inData1, |
| 22 | armnn::Encoder<OutType>& 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 | |
Derek Lamberti | f30f7d3 | 2019-04-09 10:25:02 +0100 | [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>>; |
| 33 | template struct armnn::ElementwiseFunction<armnn::maximum<float>>; |
| 34 | template struct armnn::ElementwiseFunction<armnn::minimum<float>>; |
| 35 | template struct armnn::ElementwiseFunction<std::equal_to<float>>; |
| 36 | template struct armnn::ElementwiseFunction<std::greater<float>>; |
Sadik Armagan | 2e6dc3a | 2019-04-03 17:48:18 +0100 | [diff] [blame] | 37 | |