blob: bb15049faa55a1ece0eea885500ed1edee0437f7 [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>
9
saoste012df12b32018-11-28 16:57:20 +000010#include "Maximum.hpp"
11
David Beck591cdb72018-09-11 16:37:14 +010012namespace armnn
13{
14
15template <typename Functor>
Éanna Ó Catháind57415d2018-11-28 16:24:38 +000016ElementwiseFunction<Functor>::ElementwiseFunction(const TensorShape& inShape0,
David Beck591cdb72018-09-11 16:37:14 +010017 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áind57415d2018-11-28 16:24:38 +000028template struct armnn::ElementwiseFunction<std::plus<float>>;
29template struct armnn::ElementwiseFunction<std::minus<float>>;
30template struct armnn::ElementwiseFunction<std::multiplies<float>>;
31template struct armnn::ElementwiseFunction<std::divides<float>>;
saoste012df12b32018-11-28 16:57:20 +000032template struct armnn::ElementwiseFunction<armnn::maximum<float>>;