1. 什么是NoneType
來自stackoverflow上的回答:NoneType
is the type for the None
object, which is an object that indicates no value. None
is the return value of functions that "don't return anything". It is also a common default return value for functions that search for something and may or may not find it;
2 . 出現的問題
問題代碼如下
1 model = AE() 2 model = model.build(input_shape=(None, 784)) 3 model.summary()
第2行代碼出錯了,model.build()是不返回什么的。所以此時model變成了NoneType object,而NoneType object並沒有summary屬性,所以直接報錯'NoneType' object has no attribute 'summary'