diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-10-12 11:12:22 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-12 11:12:22 +0000 |
commit | a9135612c312b180f0fa8363446321c3f0b9c072 (patch) | |
tree | d91678828549d7e858f892c5ee048c2437530837 | |
parent | 4dae8f7765189e999e9c3010ab8b55eea9d3ca40 (diff) |
The first argument to fastMatch() should be the tensor with fewest cells.
-rw-r--r-- | eval/src/vespa/eval/tensor/sparse/sparse_tensor_match.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_match.cpp b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_match.cpp index 8dbb31c032d..35ae6b7544b 100644 --- a/eval/src/vespa/eval/tensor/sparse/sparse_tensor_match.cpp +++ b/eval/src/vespa/eval/tensor/sparse/sparse_tensor_match.cpp @@ -112,7 +112,12 @@ SparseTensorMatch::SparseTensorMatch(const TensorImplType &lhs, { if ((lhs.type().dimensions().size() == rhs.type().dimensions().size()) && (lhs.type().dimensions().size() == _builder.type().dimensions().size())) { - fastMatch(lhs, rhs); + // Ensure that first tensor to fastMatch has fewest cells. + if (lhs.cells().size() <= rhs.cells().size()) { + fastMatch(lhs, rhs); + } else { + fastMatch(rhs, lhs); + } } else { slowMatch(lhs, rhs); } |