aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/ElementwiseFunction.cpp
blob: 888037f9a61e8a2b64b1bce820ed0a9f585e5c18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "ElementwiseFunction.hpp"
#include "Broadcast.hpp"
#include <functional>
#include "Minimum.hpp"

#include "Maximum.hpp"

namespace armnn
{

template <typename Functor>
ElementwiseFunction<Functor>::ElementwiseFunction(const TensorShape& inShape0,
                                                   const TensorShape& inShape1,
                                                   const TensorShape& outShape,
                                                   armnn::Decoder<InType>& inData0,
                                                   armnn::Decoder<InType>& inData1,
                                                   armnn::Encoder<OutType>& outData)
{
    BroadcastLoop(inShape0, inShape1, outShape).Unroll(Functor(), 0, inData0, inData1, outData);
}

} //namespace armnn

template struct armnn::ElementwiseFunction<std::plus<float>>;
template struct armnn::ElementwiseFunction<std::minus<float>>;
template struct armnn::ElementwiseFunction<std::multiplies<float>>;
template struct armnn::ElementwiseFunction<std::divides<float>>;
template struct armnn::ElementwiseFunction<armnn::maximum<float>>;
template struct armnn::ElementwiseFunction<armnn::minimum<float>>;

// Comparison
template struct armnn::ElementwiseFunction<std::equal_to<float>>;
template struct armnn::ElementwiseFunction<std::greater<float>>;
template struct armnn::ElementwiseFunction<std::greater_equal<float>>;
template struct armnn::ElementwiseFunction<std::less<float>>;
template struct armnn::ElementwiseFunction<std::less_equal<float>>;
template struct armnn::ElementwiseFunction<std::not_equal_to<float>>;