I want to write a code to explicitly delegate index to all tensors and the result is that every tensor should have a default device().index() 0.
So I wrote the code as follows:
  if (! rawTensor.device().has_index()){
    rawTensor.device().set_index(0);
  }

However, this seems not work. Does this mean that I must explicitly call tensor.to( ‘cpu:0’) ? If so, what is the point of offering a set_index() function?