keras参考资料:https://keras.io/zh/getting-started/faq/#sample-batch-epoch
https://keras-cn.readthedocs.io/en/latest/
参考资料:https://www.jianshu.com/p/5d47f152ff62
https://blog.csdn.net/A632189007/article/details/77978058
###写法一:充分利用申请的资源
import tensorflow as tf
import keras.backend.tensorflow_backend as KTF
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
session = tf.Session(config=config)
KTF.set_session(session)
#######写法二:限制GPU使用率
import os
import tensorflow as tf
import keras.backend.tensorflow_backend as KTF
config = tf.ConfigProto()
# 获取环境变量
env_dist = os.environ
#单卡GPU最大显存
card_gpu_mem_total = int(env_dist['ALIYUN_COM_GPU_MEM_CONTAINER'])
#启动Notebook分配的GPU显存
request_card_gpu_mem = in