UnboundLocalError: local variable 'batch_index' referenced before assignment

后端 未结 4 1076
清歌不尽
清歌不尽 2020-12-11 10:06

This is NOT MY code by here is the line, where it shows a problem:

model.fit(trainX, trainY, batch_size=2, epochs=200, verbose=2)

(As I am thinking now, it i

4条回答
  •  萌比男神i
    2020-12-11 10:41

    UnboundLocalError: local variable 'batch_index' referenced before assignment
    

    The reason for the problem is that the list of batches is empty! batches ==[]

    The reason it is blank is because the number of samples for training data is too small to be divided by batch_size

    You should check your data, number of samples or You should reduce batch_size to a point that allows you to divide the number of samples by batch size with a real result..

提交回复
热议问题