Skip to content

Commit c1f71d2

Browse files
fix onir_pt epic uncoalesced error
Cannot get values on an uncoalesced tensor, please call .coalesce() first
1 parent 88a4679 commit c1f71d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

onir_pt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def query_data_iter(df):
670670
tids = torch.from_numpy(tids)
671671
vals = torch.from_numpy(vals)
672672
dvec = torch.sparse.FloatTensor(torch.stack([torch.zeros_like(tids), tids]).long(), vals.float(), torch.Size([1, LEXICON_SIZE]))
673-
score = (this_qvec.cpu() * dvec[0]).values().sum().item()
673+
score = (this_qvec.cpu() * dvec[0]).coalesce().values().sum().item()
674674
scores.append(score)
675675
dataframe['score'] = scores
676676
return dataframe

0 commit comments

Comments
 (0)