diff options
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp index db35de6786d..b2bd9330160 100644 --- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp +++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor.cpp @@ -29,10 +29,15 @@ using Cells = SparseTensor::Cells; void copyCells(Cells &cells, const Cells &cells_in, Stash &stash) { - for (const auto &cell : cells_in) { + // copy the exact hashtable structure: + cells = cells_in; + // copy the actual contents of the addresses, + // and update the pointers inside the hashtable + // keys so they point to our copy: + for (auto &cell : cells) { SparseTensorAddressRef oldRef = cell.first; SparseTensorAddressRef newRef(oldRef, stash); - cells[newRef] = cell.second; + cell.first = newRef; } } |