ypwhs / captcha_break

验证码识别
MIT License
2.73k stars 684 forks source link

cnn_2019.ipynb(防止 tensorflow 占用所有显存)tensorflow2.0要怎么改 #71

Open hechengdu opened 2 years ago

hechengdu commented 2 years ago

import tensorflow as tf import tensorflow.keras.backend as K

config = tf.ConfigProto() config.gpu_options.allow_growth=True sess = tf.Session(config=config) K.set_session(sess)

这段代码 tensorflow2.0要怎么改

ypwhs commented 2 years ago

tf.config.gpu.set_per_process_memory_growth(enabled=True)