pin_memory Copies the tensor to pinned memory, if it’s not already pinned.This will make tensor transfers faster to GPU.
The reason it failed may because the paths I return is string not tensor. But this has been fixed. So you may update PyTorch and try again.