22 for (uint32_t b = 0; b < nBatch; b++)
24 for (uint32_t v = 0; v < vSize; v++)
26 outResult.
Set(batchVector.
Get() + vector.
Get());
33 batchVector -= vSize * nBatch;
34 outResult -= vSize * nBatch;
44 float normalization_epsilon)
46 for (uint32_t batch = 0; batch < n_batch; ++batch) {
49 for (uint32_t i = 0; i < v_size; ++i) {
50 sum += input_vector.
Get();
51 sum_sq += input_vector.
Get() * input_vector.
Get();
54 input_vector -= v_size;
56 const float mean = sum /
static_cast<float>(v_size);
57 float stddev_inv = 0.0f;
58 const float variance = sum_sq /
static_cast<float>(v_size) - mean * mean;
60 stddev_inv = 1.0f / std::sqrt(normalization_epsilon);
62 stddev_inv = 1.0f / std::sqrt(variance);
65 for (uint32_t i = 0; i < v_size; ++i) {
66 output_vector.
Set((input_vector.
Get() - mean) * stddev_inv);
72 output_vector -= v_size * n_batch;
73 input_vector -= v_size * n_batch;
79 for (uint32_t v = 0; v < vSize; v++)
94 for (uint32_t b = 0; b < nBatch; b++)
96 for (uint32_t r = 0; r < mRows; r++)
99 for (uint32_t c = 0; c < mCols; c++)
101 outResult.
Set(outResult.
Get() + matrix.
Get() * vector.
Get());
106 vector -= (b+1) * mCols;
108 matrix -= (mRows * mCols);
110 outResult -= (mRows * nBatch);
118 for (uint32_t b = 0; b < nBatch; b++)
120 for (uint32_t v = 0; v < vSize; v++)
122 outBatchVector.
Set(vector.
Get());
128 outBatchVector -= (nBatch * vSize);
137 for (uint32_t b = 0; b < nBatch; b++)
139 for (uint32_t v = 0; v < vSize; v++)
141 outResult.
Set(outResult.
Get() + vector.
Get() * batchVector.
Get());
148 batchVector -= vSize * nBatch;
149 outResult -= vSize * nBatch;
158 for (uint32_t b = 0; b < nBatch; b++)
160 for (uint32_t v = 0; v < vSize; v++)
162 outResult.
Set(vector.
Get() * batchVector.
Get());
169 batchVector -= vSize * nBatch;
170 outResult -= vSize * nBatch;
177 for (uint32_t v = 0; v < vSize; v++)
179 result.
Set(1.0f - vector.
Get());
192 for (uint32_t v = 0; v < vSize; v++)
194 outResult.
Set(vector1.
Get() * vector2.
Get());
209 for (uint32_t v = 0; v < vSize; v++)
211 outResult.
Set(outResult.
Get() + vector1.
Get() * vector2.
Get());
224 float result = (absLimit < f) ? absLimit : f;
225 result = (-absLimit > result) ? -absLimit : result;
234 for (uint32_t v = 0; v < vSize; v++)
248 for (uint32_t v = 0; v < vSize; v++)
250 outResult.
Set(vector.
Get());
295 throw armnn::Exception(
"Unsupported activation function: " + std::to_string(activation));
306 return std::make_unique<armnn::ScopedTensorHandle>(*ptr);