For running mean/variance like tensor, we can use self.register_buffer(name, tensor) to manger it.
However, self.register_buffer must use name to refer to the tensor. In some case, I have a list of buffer tensors and I dnt want to use name to manager these buffers, for instance:
class MyModule(nn.Module):
  def __init__(n):
         self.params = [tensor(3, 3) for i  in range(n)]
         for i,p in enumerate(self.params):
             self.register_buffer('tensor'+str(i), p)


and then I want to visit self.params. However, once we call MyModule().to('cuda'), the tensor in self.params still point to initial cpu tensor, and we need to use self.tensor0/1/... to refer to cuda tensor. That’s not I wanted.
I wish to refer to these tensor by self.params still.
Could anyone help me.