Tensor & Variable
What is the difference between Tensors and Variables in Pytorch?
- torch tensors are actually the data.
- variables wrap tensors, and construct a chain of operations between the tensors, so that the gradients can flow back
- PyTorch requires that the input tensor to be forward propagated has to be wrapped in a Variable.
GPU
check
torch.cuda.is_available()
module
model = torch.nn.DataParallel(model).cuda()
Dataloader
dataloader = torch.utils.data.DataLoader(dataset)
dataloader.pin_memory = True #