The answer to “how to circumvent” was staring me right in the face: just use torch.nonzero on the mask. Here’s the unelegant/dirty solution, which involves an extra sum operation that shouldn’t really be there to circumvent the bug:
mask = torch.where(graph_clusters_i == cluster_id, torch.ones_like(graph_clusters_i), torch.zeros_like(graph_clusters_i))
dummy = mask.sum()  # TODO: figure out why there is some kind of lazy-evaluation bug in PyTorch without this line...
del dummy
x = torch.nonzero(mask, as_tuple=True)[0].tolist()
```