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‘
'NoneType' object has no attribute 'summary'
原文:https://www.cnblogs.com/zhenlingmo/p/12634362.html