keras plot_model function to draw network structure diagram, question mark? ?Change to None

Ubuntu finds this directory file

anaconda3/envs/yourEnv/lib/python3.7/site-packages/tensorflow_core/python/keras/utils/vis_utils.py

Windows finds this directory file

Anaconda\envs\yourEnv\Lib\site-packages\tensorflow\python\keras\utils\vis_utils.py

The problem lies in the following function in the vis_utils.py file

def format_shape(shape):
  return str(shape).replace(str(None), '?')

Change directly to:

def format_shape(shape):
  return str(shape).replace(str(None), 'None')

Reference from: https://stackoverflow.com/questions/63101709/keras-plot-model-replace-the-question-mark-by-none-in-the-model-architecture

I shall? Changed to ABC, you can take a look at the result graph:

 

Guess you like

Origin blog.csdn.net/deephacking/article/details/108139227