ArmNN  NotReleased
ConvImpl.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "RefWorkloadUtils.hpp"
10 #include "BaseIterator.hpp"
11 #include "Decoders.hpp"
12 #include "Encoders.hpp"
13 
14 #include <armnn/Tensor.hpp>
15 
17 
18 #include <boost/assert.hpp>
19 #include <boost/numeric/conversion/cast.hpp>
20 
21 #include <cmath>
22 #include <limits>
23 
24 namespace armnn
25 {
26 
30 {
31 public:
35  QuantizedMultiplierSmallerThanOne(float multiplier);
36 
38  int32_t operator*(int32_t rhs) const;
39 
40 private:
42  static int32_t SaturatingRoundingDoublingHighMul(int32_t a, int32_t b);
43 
45  static int32_t RoundingDivideByPOT(int32_t x, int exponent);
46 
47  int32_t m_Multiplier;
48  int32_t m_RightShift;
49 };
50 
51 void Convolve(const TensorShape& rInputShape,
52  Decoder<float>& rInputDecoder,
53  const TensorShape& rOutputShape,
54  Encoder<float>& rOutputEncoder,
55  const TensorShape& rFilterShape,
56  Decoder<float>& rFilterDecoder,
57  bool biasEnabled,
58  Decoder<float>* pBiasDecoder,
59  DataLayout dataLayout,
60  unsigned int paddingTop,
61  unsigned int paddingLeft,
62  unsigned int xStride,
63  unsigned int yStride,
64  unsigned int xDilation,
65  unsigned int yDilation,
66  bool depthwise = false);
67 } //namespace armnn
void Convolve(const TensorShape &rInputShape, Decoder< float > &rInputDecoder, const TensorShape &rOutputShape, Encoder< float > &rOutputEncoder, const TensorShape &rFilterShape, Decoder< float > &rFilterDecoder, bool biasEnabled, Decoder< float > *pBiasDecoder, DataLayout dataLayout, unsigned int paddingTop, unsigned int paddingLeft, unsigned int xStride, unsigned int yStride, unsigned int xDilation, unsigned int yDilation, bool depthwise)
Definition: ConvImpl.cpp:71
DataLayout
Definition: Types.hpp:48
QuantizedMultiplierSmallerThanOne(float multiplier)
Definition: ConvImpl.cpp:16
int32_t operator*(int32_t rhs) const
The implementation of this function is adapted from Android NN&#39;s MultiplyByQuantizedMultiplierSmaller...
Definition: ConvImpl.cpp:41