blob: 7a5c071f702486b68e7aeaa0384e710c2a84c805 [file] [log] [blame]
David Beck591cdb72018-09-11 16:37:14 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
Éanna Ó Catháind57415d2018-11-28 16:24:38 +00006#include "ElementwiseFunction.hpp"
David Beck591cdb72018-09-11 16:37:14 +01007#include "Broadcast.hpp"
8#include <functional>
Éanna Ó Catháin20e58802018-12-04 10:29:06 +00009#include "Minimum.hpp"
David Beck591cdb72018-09-11 16:37:14 +010010
saoste012df12b32018-11-28 16:57:20 +000011#include "Maximum.hpp"
12
David Beck591cdb72018-09-11 16:37:14 +010013namespace armnn
14{
15
Derek Lambertif30f7d32019-04-09 10:25:02 +010016template <typename Functor>
17ElementwiseFunction<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 Beck591cdb72018-09-11 16:37:14 +010023{
24 BroadcastLoop(inShape0, inShape1, outShape).Unroll(Functor(), 0, inData0, inData1, outData);
25}
26
27} //namespace armnn
28
Derek Lambertif30f7d32019-04-09 10:25:02 +010029template struct armnn::ElementwiseFunction<std::plus<float>>;
30template struct armnn::ElementwiseFunction<std::minus<float>>;
31template struct armnn::ElementwiseFunction<std::multiplies<float>>;
32template struct armnn::ElementwiseFunction<std::divides<float>>;
33template struct armnn::ElementwiseFunction<armnn::maximum<float>>;
34template struct armnn::ElementwiseFunction<armnn::minimum<float>>;
35template struct armnn::ElementwiseFunction<std::equal_to<float>>;
36template struct armnn::ElementwiseFunction<std::greater<float>>;
Sadik Armagan2e6dc3a2019-04-03 17:48:18 +010037