'What's going on on torch.transform.ToTensor?
let
x = np.array([[0,254],[14,77]])
>>> x
array([[ 0, 254],
[ 14, 77]])
y = torch.from_numpy(x).int().float()
>>> y
tensor([[ 0., 254.],
[ 14., 77.]])
train_transform = transforms.Compose([transforms.ToPILImage(),
transforms.ToTensor()])
z = train_transform(y)
>>> z
tensor([[[0.0000, 0.0078],
[0.9490, 0.7020]]])
if I use the ToTensor, it will be divided into 255, but what is going on with that? Why is 14 and 77 high?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
