blob: 888037f9a61e8a2b64b1bce820ed0a9f585e5c18 [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>>;
Aron Virginas-Tar77bfb5e2019-10-16 17:45:38 +010035
36// Comparison
Derek Lambertif30f7d32019-04-09 10:25:02 +010037template struct armnn::ElementwiseFunction<std::equal_to<float>>;
38template struct armnn::ElementwiseFunction<std::greater<float>>;
Aron Virginas-Tar77bfb5e2019-10-16 17:45:38 +010039template struct armnn::ElementwiseFunction<std::greater_equal<float>>;
40template struct armnn::ElementwiseFunction<std::less<float>>;
41template struct armnn::ElementwiseFunction<std::less_equal<float>>;
42template struct armnn::ElementwiseFunction<std::not_equal_to<float>>;