Kong
(Kong)
September 18, 2018, 10:45am
1
import torch
import numpy as np
a = np.zeros((3,3))
b = torch.from_numpy(a).type(torch.float)
AttributeError Traceback (most recent call last)
in ()
3
4 a = np.zeros((3,3))
----> 5 b = torch.from_numpy(a).type(torch.float)
AttributeError: module ‘torch’ has no attribute ‘float’
albanD
(Alban D)
September 18, 2018, 11:00am
2
Which version of pytorch are you using? This was added recently.
Kong
(Kong)
September 18, 2018, 11:18am
3
I used this to install conda install pytorch=0.1.12 cuda75 -c pytorch
following https://pytorch.org/previous-versions/ . Do you mean that torch.float and torch.FloatTensor are the same ?
albanD
(Alban D)
September 18, 2018, 12:01pm
4
For most purposes yes they are the same. torch.float
did not exist in 0.1
though so you will need to upgrade pytorch to be able to use it.