Reason: Insufficient video memory (Generally, if it is not restricted, many deep learning framework codes will apply for the entire video memory space when running (even if it does not require so many resources, but it does not allow other programs after applying for it) Use), so if you run the code in this state, there will be a problem of insufficient video memory (because there are other programs or operations that require video memory resources))
Solution: add the following code to the running script
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)