keras plot_model函数画网络结构图,问号??改成None

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,大家可以看看成果图:

猜你喜欢

转载自blog.csdn.net/deephacking/article/details/108139227