tensorflow 出现Dense should be defined. Found `None`.

问题:

ValueError: The last dimension of the inputs to `Dense` should be defined. Found `None`.

解决:

主要看下之前的层是否有问题,比如Flatten()等,是否会出现None

可以考虑

T = SelfCreateLayer2()(output) # SelfCreateLayer2,输出为(None,None,256) T = GlobalMaxPooling1D()(T) # 若是使用flatten/Reshape,则无法进行实验,显示错误:Error: ValueError: The last dimension of the inputs to `Dense` should be defined. Found `None`。 # 解决方法就是,使用池化层代替flatten或者reshape。

参考:

本文_已修复Error: ValueError: The last dimension of the inputs to `Dense` should be defined. Found `None`

你可能感兴趣的:(tensorflow,tensorflow,深度学习,人工智能)