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