Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 19083

TypeError: Cannot interpret 'torch.uint8' as a data type

$
0
0

Today I have started to learn Pytorch and I stuck here. The code piece in the comment raises this error:TypeError: Cannot interpret 'torch.uint8' as a data type

For changing the data type of the tensor I used: quzu_torch = quzu_torch.type(torch.float) But this time I got this error:TypeError: Cannot interpret 'torch.float32' as a data type

import numpy as npimport torchfrom matplotlib import pyplot as pltquzu = np.array(Image.open('wool.jpg').resize((224,224)))quzu_torch = torch.from_numpy(quzu)plt.imsave('quzucuq.jpg', quzu)# quzu_torch = quzu_torch.type(torch.bool)plt.imsave('quzucuq_tensor.jpg', quzu_torch)```

Viewing all articles
Browse latest Browse all 19083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>