Keras reports TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

前端 未结 2 1110
小蘑菇
小蘑菇 2020-12-11 02:59

I\'m a beginner in Keras and just write a toy example. It reports a TypeError. The code and error are as follows:

Code:



        
2条回答
  •  醉话见心
    2020-12-11 03:49

    I think @today's answer is very clear. However, not complete. The key thing here is that, if your input doesn't contain num_features, you have to make a Embedding layer next to the input.

    So if you use:

    inputs = keras.Input(shape=(3,))
    embedding = Embedding(voc_size, embed_dim, ..)
    X = embedding(inputs)
    

    it also works.

提交回复
热议问题