Keras自动生成批量大小

Keras自动生成批量大小,keras,Keras,有没有办法根据keras中GPU的内存自动生成批量大小?据我所知,批量大小主要用于调整模型使用vram的大小。目前,我只是使用试错法来设置一个好的批量大小,但我不知道是否有更简单的方法。这很好,但有点乏味。如果我尝试运行多个不同的型号,我可以让我的计算机运行多天,我希望它对每个型号都是最有效的 编辑: 一些伪代码 # What I currently do batch = 32 model.fit(x_train, y_train, batch_size=batch) # here I have

有没有办法根据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

你能帮我发一些密码吗?你好。你找到解决办法了吗?没有。现在只是试错