diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-09 08:59:11 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-09 09:06:58 -0700 |
commit | 2f283289bf0705f294c607b4ea00f8f0df35c44a (patch) | |
tree | 6f458a82175547a00495cff5d5d1a5e16df0f882 /tensorflow/contrib/lite/kernels/internal | |
parent | 040b2f332eb95f71da77c0943c9a9f58e7c8acae (diff) |
Perform cumulation before adding bias.
PiperOrigin-RevId: 208056257
Diffstat (limited to 'tensorflow/contrib/lite/kernels/internal')
-rw-r--r-- | tensorflow/contrib/lite/kernels/internal/reference/portable_tensor_utils.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tensorflow/contrib/lite/kernels/internal/reference/portable_tensor_utils.cc b/tensorflow/contrib/lite/kernels/internal/reference/portable_tensor_utils.cc index a5f4addd5e..aa93e857d7 100644 --- a/tensorflow/contrib/lite/kernels/internal/reference/portable_tensor_utils.cc +++ b/tensorflow/contrib/lite/kernels/internal/reference/portable_tensor_utils.cc @@ -73,10 +73,12 @@ void PortableMatrixBatchVectorMultiplyAccumulate(const float* matrix, for (int b = 0; b < n_batch; b++) { const float* matrix_ptr = matrix; for (int r = 0; r < m_rows; r++) { + float dot_prod = 0.0f; const float* vector_in_batch = vector + b * m_cols; for (int c = 0; c < m_cols; c++) { - *result_in_batch += *matrix_ptr++ * *vector_in_batch++; + dot_prod += *matrix_ptr++ * *vector_in_batch++; } + *result_in_batch += dot_prod; result_in_batch += result_stride; } } |