ArmNN
 24.02
LstmUtils.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 "BaseIterator.hpp"
10 
11 // Helper functions ported from the Android code base
12 // Refer to: android/external/tensorflow/tensorflow/contrib/lite/kernels/internal/reference/portable_tensor_utils.cc
13 
14 
16  uint32_t vSize,
17  armnn::Decoder<float>& batchVector,
18  uint32_t nBatch,
19  armnn::Encoder<float>& outResult );
20 
21 // Layer norm for each batch.
22 // normalization_epsilon is added to avoid divergence.
24  armnn::Encoder<float>& output_vector,
25  uint32_t v_size,
26  uint32_t n_batch,
27  float normalization_epsilon);
28 
30  uint32_t vSize);
31 
33  uint32_t mRows,
34  uint32_t mCols,
35  armnn::Decoder<float>& vector,
36  uint32_t nBatch,
37  armnn::Encoder<float>& outResult);
38 
40  uint32_t vSize,
41  uint32_t nBatch,
42  armnn::Encoder<float>& outBatchVector);
43 
45  uint32_t vSize,
46  armnn::Decoder<float>& batchVector,
47  uint32_t nBatch,
48  armnn::Encoder<float>& outResult);
49 
51  uint32_t vSize,
52  armnn::Decoder<float>& batchVector,
53  uint32_t nBatch,
54  armnn::Encoder<float>& outResult);
55 
57  uint32_t vSize,
58  armnn::Encoder<float>& result);
59 
60 
62  armnn::Decoder<float>& vector2,
63  uint32_t vSize,
64  armnn::Encoder<float>& outResult);
65 
67  armnn::Decoder<float>& vector2,
68  uint32_t vSize,
69  armnn::Encoder<float>& outResult);
70 
71 float Clip(float f,
72  float absLimit);
73 
75  uint32_t vSize,
76  float absLimit,
77  armnn::Encoder<float>& outResult);
78 
80  uint32_t vSize,
81  armnn::Encoder<float>& outResult);
82 
83 void SetActivationParameters(uint32_t activation,
84  armnn::ActivationFunction& outArmnnActivation,
85  float& outA,
86  float& outB);
87 
88 std::unique_ptr<armnn::ScopedTensorHandle> AssignScopedTensorHandle(const armnn::ConstTensorHandle *ptr);
MeanStddevNormalization
void MeanStddevNormalization(armnn::Decoder< float > &input_vector, armnn::Encoder< float > &output_vector, uint32_t v_size, uint32_t n_batch, float normalization_epsilon)
Definition: LstmUtils.cpp:40
armnn::Decoder< float >
Sub1Vector
void Sub1Vector(armnn::Decoder< float > &vector, uint32_t vSize, armnn::Encoder< float > &result)
Definition: LstmUtils.cpp:173
BaseIterator.hpp
armnn::ConstTensorHandle
Definition: TensorHandle.hpp:24
VectorBatchVectorAssign
void VectorBatchVectorAssign(armnn::Decoder< float > &vector, uint32_t vSize, uint32_t nBatch, armnn::Encoder< float > &outBatchVector)
Definition: LstmUtils.cpp:113
VectorBatchVectorCwiseProduct
void VectorBatchVectorCwiseProduct(armnn::Decoder< float > &vector, uint32_t vSize, armnn::Decoder< float > &batchVector, uint32_t nBatch, armnn::Encoder< float > &outResult)
Definition: LstmUtils.cpp:152
ZeroVector
void ZeroVector(armnn::Encoder< float > &vector, uint32_t vSize)
Definition: LstmUtils.cpp:76
armnn::Encoder< float >
VectorVectorCwiseProductAccumulate
void VectorVectorCwiseProductAccumulate(armnn::Decoder< float > &vector1, armnn::Decoder< float > &vector2, uint32_t vSize, armnn::Encoder< float > &outResult)
Definition: LstmUtils.cpp:204
VectorVectorCwiseProduct
void VectorVectorCwiseProduct(armnn::Decoder< float > &vector1, armnn::Decoder< float > &vector2, uint32_t vSize, armnn::Encoder< float > &outResult)
Definition: LstmUtils.cpp:187
VectorBatchVectorCwiseProductAccumulate
void VectorBatchVectorCwiseProductAccumulate(armnn::Decoder< float > &vector, uint32_t vSize, armnn::Decoder< float > &batchVector, uint32_t nBatch, armnn::Encoder< float > &outResult)
Definition: LstmUtils.cpp:131
armnn::ActivationFunction
ActivationFunction
Definition: Types.hpp:86
CopyVector
void CopyVector(armnn::Decoder< float > &vector, uint32_t vSize, armnn::Encoder< float > &outResult)
Definition: LstmUtils.cpp:244
TensorHandle.hpp
ClipVector
void ClipVector(armnn::Decoder< float > &vector, uint32_t vSize, float absLimit, armnn::Encoder< float > &outResult)
Definition: LstmUtils.cpp:229
AssignScopedTensorHandle
std::unique_ptr< armnn::ScopedTensorHandle > AssignScopedTensorHandle(const armnn::ConstTensorHandle *ptr)
Definition: LstmUtils.cpp:299
MatrixBatchVectorMultiplyAccumulate
void MatrixBatchVectorMultiplyAccumulate(armnn::Decoder< float > &matrix, uint32_t mRows, uint32_t mCols, armnn::Decoder< float > &vector, uint32_t nBatch, armnn::Encoder< float > &outResult)
Definition: LstmUtils.cpp:87
Clip
float Clip(float f, float absLimit)
Definition: LstmUtils.cpp:221
VectorBatchVectorAdd
void VectorBatchVectorAdd(armnn::Decoder< float > &vector, uint32_t vSize, armnn::Decoder< float > &batchVector, uint32_t nBatch, armnn::Encoder< float > &outResult)
Definition: LstmUtils.cpp:16
SetActivationParameters
void SetActivationParameters(uint32_t activation, armnn::ActivationFunction &outArmnnActivation, float &outA, float &outB)
Definition: LstmUtils.cpp:258