24.02
ElementwiseFunction.cpp
Go to the documentation of this file.
1
//
2
// Copyright © 2017-2021,2023 Arm Ltd and Contributors. All rights reserved.
3
// SPDX-License-Identifier: MIT
4
//
5
6
#include "
ElementwiseFunction.hpp
"
7
#include "
Broadcast.hpp
"
8
#include "
Minimum.hpp
"
9
#include "
Maximum.hpp
"
10
#include "
Abs.hpp
"
11
#include "
Ceil.hpp
"
12
#include "
Exp.hpp
"
13
#include "
Log.hpp
"
14
#include "
Rsqrt.hpp
"
15
#include "
Sin.hpp
"
16
#include "
Sqrt.hpp
"
17
#include "
Power.hpp
"
18
#include "
SquaredDifference.hpp
"
19
20
21
namespace
armnn
22
{
23
24
template
<
typename
Functor>
25
ElementwiseBinaryFunction<Functor>::ElementwiseBinaryFunction
(
const
TensorShape
& inShape0,
26
const
TensorShape
& inShape1,
27
const
TensorShape
& outShape,
28
Decoder<InType>
& inData0,
29
Decoder<InType>
& inData1,
30
Encoder<OutType>
& outData)
31
{
32
BroadcastLoop
(inShape0, inShape1, outShape).
Unroll
(Functor(), 0, inData0, inData1, outData);
33
}
34
35
template
<
typename
Functor>
36
ElementwiseUnaryFunction<Functor>::ElementwiseUnaryFunction
(
const
TensorShape
& inShape,
37
const
TensorShape
& outShape,
38
Decoder<InType>
& inData,
39
Encoder<OutType>
& outData)
40
{
41
BroadcastLoop
(inShape, outShape).
Unroll
(Functor(), 0, inData, outData);
42
}
43
44
template
<
typename
Functor>
45
LogicalBinaryFunction<Functor>::LogicalBinaryFunction
(
const
TensorShape
& inShape0,
46
const
TensorShape
& inShape1,
47
const
TensorShape
& outShape,
48
Decoder<InType>
& inData0,
49
Decoder<InType>
& inData1,
50
Encoder<OutType>
& outData)
51
{
52
BroadcastLoop
(inShape0, inShape1, outShape).
Unroll
(Functor(), 0, inData0, inData1, outData);
53
}
54
55
template
<
typename
Functor>
56
LogicalUnaryFunction<Functor>::LogicalUnaryFunction
(
const
TensorShape
& inShape,
57
const
TensorShape
& outShape,
58
Decoder<InType>
& inData,
59
Encoder<OutType>
& outData)
60
{
61
BroadcastLoop
(inShape, outShape).
Unroll
(Functor(), 0, inData, outData);
62
}
63
64
}
//namespace armnn
65
66
template
struct
armnn::ElementwiseBinaryFunction<std::plus<float>
>;
67
template
struct
armnn::ElementwiseBinaryFunction<std::minus<float>
>;
68
template
struct
armnn::ElementwiseBinaryFunction<std::multiplies<float>
>;
69
template
struct
armnn::ElementwiseBinaryFunction<std::divides<float>
>;
70
template
struct
armnn::ElementwiseBinaryFunction<armnn::maximum<float>
>;
71
template
struct
armnn::ElementwiseBinaryFunction<armnn::minimum<float>
>;
72
template
struct
armnn::ElementwiseBinaryFunction<armnn::power<float>
>;
73
template
struct
armnn::ElementwiseBinaryFunction<armnn::squaredDifference<float>
>;
74
75
template
struct
armnn::ElementwiseBinaryFunction<std::plus<int32_t>
>;
76
template
struct
armnn::ElementwiseBinaryFunction<std::minus<int32_t>
>;
77
template
struct
armnn::ElementwiseBinaryFunction<std::multiplies<int32_t>
>;
78
template
struct
armnn::ElementwiseBinaryFunction<std::divides<int32_t>
>;
79
template
struct
armnn::ElementwiseBinaryFunction<armnn::maximum<int32_t>
>;
80
template
struct
armnn::ElementwiseBinaryFunction<armnn::minimum<int32_t>
>;
81
template
struct
armnn::ElementwiseBinaryFunction<armnn::power<int32_t>
>;
82
template
struct
armnn::ElementwiseBinaryFunction<armnn::squaredDifference<int32_t>
>;
83
84
// Comparison
85
template
struct
armnn::ElementwiseBinaryFunction<std::equal_to<float>
>;
86
template
struct
armnn::ElementwiseBinaryFunction<std::greater<float>
>;
87
template
struct
armnn::ElementwiseBinaryFunction<std::greater_equal<float>
>;
88
template
struct
armnn::ElementwiseBinaryFunction<std::less<float>
>;
89
template
struct
armnn::ElementwiseBinaryFunction<std::less_equal<float>
>;
90
template
struct
armnn::ElementwiseBinaryFunction<std::not_equal_to<float>
>;
91
92
// Unary
93
template
struct
armnn::ElementwiseUnaryFunction<armnn::abs<float>
>;
94
template
struct
armnn::ElementwiseUnaryFunction<armnn::ceil<float>
>;
95
template
struct
armnn::ElementwiseUnaryFunction<armnn::exp<float>
>;
96
template
struct
armnn::ElementwiseUnaryFunction<armnn::log<float>
>;
97
template
struct
armnn::ElementwiseUnaryFunction<std::negate<float>
>;
98
template
struct
armnn::ElementwiseUnaryFunction<armnn::rsqrt<float>
>;
99
template
struct
armnn::ElementwiseUnaryFunction<armnn::sin<float>
>;
100
template
struct
armnn::ElementwiseUnaryFunction<armnn::sqrt<float>
>;
101
102
// Logical Unary
103
template
struct
armnn::LogicalUnaryFunction<std::logical_not<bool>
>;
104
template
struct
armnn::LogicalBinaryFunction<std::logical_and<bool>
>;
105
template
struct
armnn::LogicalBinaryFunction<std::logical_or<bool>
>;
Sin.hpp
armnn::Decoder
Definition:
BaseIterator.hpp:36
Ceil.hpp
armnn::LogicalUnaryFunction::LogicalUnaryFunction
LogicalUnaryFunction(const TensorShape &inShape, const TensorShape &outShape, Decoder< InType > &inData, Encoder< OutType > &outData)
Definition:
ElementwiseFunction.cpp:56
armnn::LogicalBinaryFunction
Definition:
ElementwiseFunction.hpp:41
armnn::BroadcastLoop
Definition:
Broadcast.hpp:14
Minimum.hpp
armnn::ElementwiseUnaryFunction::ElementwiseUnaryFunction
ElementwiseUnaryFunction(const TensorShape &inShape, const TensorShape &outShape, Decoder< InType > &inData, Encoder< OutType > &outData)
Definition:
ElementwiseFunction.cpp:36
Rsqrt.hpp
armnn::ElementwiseBinaryFunction::ElementwiseBinaryFunction
ElementwiseBinaryFunction(const TensorShape &inShape0, const TensorShape &inShape1, const TensorShape &outShape, Decoder< InType > &inData0, Decoder< InType > &inData1, Encoder< OutType > &outData)
Definition:
ElementwiseFunction.cpp:25
Broadcast.hpp
armnn::ElementwiseBinaryFunction
Definition:
ElementwiseFunction.hpp:15
armnn::TensorShape
Definition:
Tensor.hpp:20
armnn::Encoder
Definition:
BaseIterator.hpp:51
Abs.hpp
armnn::BroadcastLoop::Unroll
void Unroll(Func operationFunc, unsigned int dimension, DecoderOp &inData0, DecoderOp &inData1, EncoderOp &outData)
Definition:
Broadcast.hpp:26
armnn::LogicalBinaryFunction::LogicalBinaryFunction
LogicalBinaryFunction(const TensorShape &inShape0, const TensorShape &inShape1, const TensorShape &outShape, Decoder< InType > &inData0, Decoder< InType > &inData1, Encoder< OutType > &outData)
Definition:
ElementwiseFunction.cpp:45
armnn::ElementwiseUnaryFunction
Definition:
ElementwiseFunction.hpp:29
armnn::LogicalUnaryFunction
Definition:
ElementwiseFunction.hpp:55
SquaredDifference.hpp
ElementwiseFunction.hpp
Maximum.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition:
01_00_quick_start.dox:6
Power.hpp
Exp.hpp
Sqrt.hpp
Log.hpp
src
backends
reference
workloads
ElementwiseFunction.cpp
Generated on Wed Feb 14 2024 16:36:17 for Arm NN by
1.8.17