Ubuntu找这个目录文件
anaconda3/envs/yourEnv/lib/python3.7/site-packages/tensorflow_core/python/keras/utils/vis_utils.py
Windows找这个目录文件
Anaconda\envs\yourEnv\Lib\site-packages\tensorflow\python\keras\utils\vis_utils.py
问题出在vis_utils.py文件中下面这个函数上面
def format_shape(shape):
return str(shape).replace(str(None), '?')
直接改为:
def format_shape(shape):
return str(shape).replace(str(None), 'None')
参考自:https://stackoverflow.com/questions/63101709/keras-plot-model-replace-the-question-mark-by-none-in-the-model-architecture
我将?改成了ABC,大家可以看看成果图:


本文解决了一个在TensorFlow Keras的vis_utils.py文件中遇到的问题,具体是在format_shape函数中对None的不正确处理。通过将'?'替换为'None',修复了模型架构显示中的错误。
1382

被折叠的 条评论
为什么被折叠?



