Module — PyTorch 1.10.1 documentation
pytorch.org › docs › stablecuda (device = None) [source] ¶ Moves all model parameters and buffers to the GPU. This also makes associated parameters and buffers different objects. So it should be called before constructing optimizer if the module will live on GPU while being optimized.
torch.Tensor.to — PyTorch 1.10.1 documentation
pytorch.org › docs › stabletorch.Tensor.to. Performs Tensor dtype and/or device conversion. A torch.dtype and torch.device are inferred from the arguments of self.to (*args, **kwargs). If the self Tensor already has the correct torch.dtype and torch.device, then self is returned. Otherwise, the returned tensor is a copy of self with the desired torch.dtype and torch.device.