Tensor Attributes — PyTorch 1.10.1 documentation
pytorch.org › docs › stableThe torch.device contains a device type ('cpu' or 'cuda') and optional device ordinal for the device type. If the device ordinal is not present, this object will always represent the current device for the device type, even after torch.cuda.set_device() is called; e.g., a torch.Tensor constructed with device 'cuda' is equivalent to 'cuda:X ...
A detailed example of data loaders with PyTorch
stanford.edu › ~shervine › blogDuring data generation, this method reads the Torch tensor of a given example from its corresponding file ID.pt.Since our code is designed to be multicore-friendly, note that you can do more complex operations instead (e.g. computations from source files) without worrying that data generation becomes a bottleneck in the training process.