What I know, or at least what I think that I know
- When instantiating one of the
VisionDataset
fromtorchvision.datasets
, such as theMNIST
, atransform
argument can be provided which can be built usingtorchvision.transforms.Compose
with a list of transformations. - If the argument
transformation
is provided to the particular chosenVisionDataset
, thetransform
don’t seem to be used immediately by the object. But instead, it seems to be used only when we have atorch.utils.data.DataLoader
iterating through the dataset. - I noticed from the documentation page on transforms that there are transforms that work on top of PIL objects, Tensor objects and both.
- It seems that only Tensor objects can be transferred to the
gpu
, not PIL objects.
Questions I have
- Is it the case that it is better to have the transforms working only on
Tensor
s instead of working onPIL
objects in terms of execution time? - Would those transforms using
Tensor
be operated in theGPU
and the ones usingPIL
only onCPU
? - Is one type of input for the transform better than the other? If so, why having two types of transform?
- Additionally, I am setting the the
pin_memory
toTrue
. I am not sure what is abatch
of acustom type
, but I don’t think that this is my case, so I am assuming that thepin_memory
is actually taking effect and making the transfermemory -> gpu_memory
faster. Is that the case? If most of theout of the box
network examples fall in this categories, whypin_memory
is default toFalse
. Am I missing something on here?
Thanks.