Yep. I hadn’t tried using the builtin torch sparse tensors and that seems to give me what I want. Do you know where in the source code this logic is implemented for sparse tensors? I’d like to take a look