Error: Error when checking model input: expected dense_input_6 to have shape (None, 784) but got array with shape (784L, 1L)

前端 未结 1 1191
生来不讨喜
生来不讨喜 2021-01-14 17:24

I get an error when trying to apply the below code onto the MNIST sample dataset for both training and testing. Please helpe

The following is my code:



        
1条回答
  •  醉梦人生
    2021-01-14 18:05

    I assume you are working with this tutorial.

    I would recommend using pandas to read your format:

    import pandas as pd
    import numpy as np
    
    data = pd.read_csv('mnist_train_100.csv', header=None)
    
    # numpy array of shape (100, 784), type float32
    X_train = data.ix[:, 1:].values.astype(np.float32) 
    
    # numpy array of shape (100,), type int64
    y_train = data.ix[:, 0].values  
    

    0 讨论(0)
提交回复
热议问题