aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/kernels/internal
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-08-09 08:59:11 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-09 09:06:58 -0700
commit2f283289bf0705f294c607b4ea00f8f0df35c44a (patch)
tree6f458a82175547a00495cff5d5d1a5e16df0f882 /tensorflow/contrib/lite/kernels/internal
parent040b2f332eb95f71da77c0943c9a9f58e7c8acae (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.cc4
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;
}
}