It seems that torch topk and sort functions return both the indices and values for Tensor inputs, but they return only values for Variable inputs. When I look at the source code, the Topk function in autograd/_functions/tensor.py has an input parameter return_indices with default value False, but the topk function in autograd/variable.py do not use this parameter when calling Topk.
Is there a reason for this? I need to get the indices of smallest k elements of a Variable. Is there a way to do this currently in pytorch?
Thanks.