Commit 26ad6ce9 authored by rusty1s's avatar rusty1s
Browse files

better vec gen

parent 3bf93538
......@@ -9,7 +9,7 @@ def coalesce(index, value, size, op='add', fill_value=0):
unique, inv = torch.unique(row * n + col, sorted=True, return_inverse=True)
perm = torch.arange(inv.size(0), dtype=inv.dtype, device=inv.device)
perm = inv.new_empty(inv.max().item() + 1).scatter_(0, inv, perm)
perm = inv.new_empty(unique.size(0)).scatter_(0, inv, perm)
index = torch.stack([row[perm], col[perm]], dim=0)
if value is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment