Tensorflow - ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float)

后端 未结 8 1375
情歌与酒
情歌与酒 2020-12-01 13:45

Continuation from previous question: Tensorflow - TypeError: 'int' object is not iterable

My training data is a list of lists each comprised of 1000 floats. F

8条回答
  •  一生所求
    2020-12-01 14:28

    You may want to check data types in input data set or array and than convert it to float32:

    train_X[:2, :].view()
    #array([[4.6, 3.1, 1.5, 0.2],
    #       [5.9, 3.0, 5.1, 1.8]], dtype=object)
    train_X = train_X.astype(np.float32)
    #array([[4.6, 3.1, 1.5, 0.2],
    #       [5.9, 3. , 5.1, 1.8]], dtype=float32)
    

提交回复
热议问题