Ошибка типа: невозможно преобразовать np.ndarray типа numpy .object_. Единственные поддерживаемые типы: float64, - PullRequest
0 голосов
/ 29 апреля 2020

Получен набор данных радужной оболочки от Kaggle.

Загружен набор данных с помощью pandas

ir= pd.read_csv("Path/iris.csv)

Теперь при выполнении

b=np.array(ir.values[:,1:-1])
input = autograd.Variable(torch.tensor(b).astype(float64))

Получено:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-33-9ad4fe1acac3> in <module>
     16 torch.manual_seed(123)
     17 
---> 18 input = autograd.Variable(torch.tensor(b).astype(float64))
     19 target = autograd.Variable(torch.tensor(target1))
     20 class Model(nn.Module):

TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, int64, int32, int16, int8, uint8, and bool.
...