Pytorch, Deep Learning, Optimization, Tensorboard, Deep Dives.
requires changes to two lines of code. First, we set the pin_memory flag of the DataLoader to True. train_loader = torch.utils.data.DataLoader(train_set, batch_size=32, shuffle=True, num_workers=8, pin_memory=True) Then we modify the host-to-device memory transfer (in the train function) to be