I read in PyTorch docs that .to(*args, **kwargs)
can also take Pytorch tensors as inputs.
https://pytorch.org/docs/stable/nn.html#torch.nn.Module.to
tensor = torch.tensor([[1, 2, 3], [4, 5, 6]], device='cuda:0', dtype=torch.float)
class MyModel(nn.Module):
...
model = MyModel()
model.to(tensor)
I just would like to know what does this do?
Does this just moves the model
to the device
the tensor
is on and set dtype
to that of tensor