Best practice for indexing layers, Variable or Tensor?

I’m implementing a custom module, which based on the input generates some index, and then index the input, and do operations (Conv etc.) on the indexed parts. Should I make the indices Variable or Tensor?

Currently, I implemented in Tensor, it works fine.
But say, I get the indices from nn.topk, which return indices as Variables, and then I need to return indices.data as my indices.

Which way is better?
Will the Tensor way cause some unknown bug?

If made the indices Variable, then it must have requires_grad = False, then what’s the sense of making it a Variable?

We’re working on merging Tensor and Variable so that you won’t have to worry about the difference between the two for now.

For your case, either way should work. I’d say it’s better to use Variable for now – there are small difference at the moment with the tensor/variable APIs and the Variable one will be what we use when those are merged.