ValueError: not enough values to unpack (expected 2, got 1)?

前端 未结 2 733
小蘑菇
小蘑菇 2021-01-27 21:18
def cnn_data(data):
    x, y = data.shape[1:]
    return data.reshape((-1, x, y, 1))

We introduce this function used in the following code.



        
相关标签:
2条回答
  • 2021-01-27 21:45

    it seems like you data has 2 dimensions, so data.shape[1:] is only one integer. Hence the error message

    0 讨论(0)
  • 2021-01-27 21:52

    In this line of code x and y are two values while data.shape is producing only one value:

    x, y = data.shape[1:]
    
    0 讨论(0)
提交回复
热议问题