Pytorch Notes
This notes mostly comes from source code from pytorch just to summarize the most import part of those most frequently used functions.
torchvision
transforms
..ToTensor()
torchvision.tansforms.functional(pic)
: Convert a PIL Image
or numpy.ndarray
to tensor.
1 | # This will divide image pixel value by 255.0 to normalize it into [0, 1.0] |
..Normalize()
Using *.*.functional.normalize()
function: Normalize a tensor image with mean and standare deviation:
1 | mean = torch.as_tensor(mean, dtype=dtype, device=tensor.device) |