diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-01-09 18:32:11 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-01-09 18:32:11 +0100 |
commit | 66a66370294a32830e7057d7ac53b48b16fc1a14 (patch) | |
tree | a6cdd453d46353cba65d5034fd5abe0a639836f4 /eval | |
parent | c331285d503f5dd908cdbb250bc6b6a64a95e607 (diff) |
No need to update the right address, as we update cellIdx inline.
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.h b/eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.h index 5039e1a2fbc..86a1bd0e5d7 100644 --- a/eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.h +++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_address_combiner.h @@ -127,31 +127,30 @@ public: const eval::ValueType &type_in, CellsRef cells); ~CommonDenseTensorCellsIterator(); template <typename Func> - void for_each(Address & combined, Func && func) { + void for_each(Address & combined, Func && func) const { const int32_t lastDimension = _mutable.size() - 1; int32_t curDimension = lastDimension; size_t cellIdx = index(_address); while (curDimension >= 0) { const uint32_t rdim = _mutable[curDimension].second; const uint32_t cdim = _mutable[curDimension].first; - size_type & rindex = _address[rdim]; size_type & cindex = combined[cdim]; if (curDimension == lastDimension) { - for (rindex = 0, cindex = 0; rindex < _type.dimensions()[rdim].size; rindex++, cindex++) { + for (cindex = 0; cindex < _type.dimensions()[rdim].size; cindex++) { func(combined, cell(cellIdx)); cellIdx += _accumulatedSize[rdim]; } - rindex = 0; cindex = 0; + cindex = 0; cellIdx -= _accumulatedSize[rdim] * _type.dimensions()[rdim].size; curDimension--; } else { - if (rindex < _type.dimensions()[rdim].size) { - rindex++; cindex++; + if (cindex < _type.dimensions()[rdim].size) { + cindex++; cellIdx += _accumulatedSize[rdim]; curDimension++; } else { cellIdx -= _accumulatedSize[rdim] * _type.dimensions()[rdim].size; - rindex = 0; cindex = 0; + cindex = 0; curDimension--; } } |