Topk often works on the gpu, but often also not. Found another form in which it fails, crashing when using topk on a 4d tensor.
import torch
cdata = torch.randn(1,1,128,10, out=torch.cuda.FloatTensor())
cdata.topk(5).cpu()
Observe a crash with:
RuntimeError: cuda runtime error (59) : device-side assert triggered at pytorch/aten/src/THC/generic/THCTensorCopy.c:70