In this example: https://github.com/pytorch/examples/blob/master/imagenet/main.py 129 and some other places, they set the non_blocking in cuda(device=None, non_blocking=False) to be True for the target variable only.
    target = target.cuda(True)

Why do they do this? And why this is only set to be True for the target Variable, but not the input Variable, in the above example, both the train and test data loaders’ pin_memory is set to be True. (I cannot understand the pin_memory setting in torch.utils.data.DataLoader as well)
train_loader = torch.utils.data.DataLoader(
    train_dataset, batch_size=args.batch_size, shuffle=(train_sampler is None),
    num_workers=args.workers, pin_memory=True, sampler=train_sampler)

val_loader = torch.utils.data.DataLoader(
    datasets.ImageFolder(valdir, transforms.Compose([
        transforms.Resize(256),
        transforms.CenterCrop(224),
        transforms.ToTensor(),
        normalize,
    ])),
    batch_size=args.batch_size, shuffle=False,
    num_workers=args.workers, pin_memory=True)