有没有办法根据keras中的GPU内存自动生成批量大小?据我所知,批量大小主要用于调整模型使用vram的大小。目前,我只是使用反复试验设置好批量,但我不知道是否有更简单的方法。这没关系,但有点单调乏味。如果我试图运行多个不同的模型,我可以让我的计算机运行多天,我希望它对每个模型都是最有效的。
编辑: 一些伪代码
# What I currently do
batch = 32
model.fit(x_train, y_train, batch_size=batch)
# here I have to manually change batch to maximize my gpu
# What I would prefer to do
model.fit(x_train, y_train, batch_size='auto')
# where the auto takes into account the size of my gpu
# and adjusts the batch_size automatically