Search code examples
tensorflowmachine-learningkeras

What if the sample size is not divisible by batch_size in Keras model


What if we specify batch size as 15 and the sample size of 1000 which is not divisible by 15 in Keras model training?.should it still able to train?

also I have looked in to this answer but it's not helping question

please can anybody explain this Thank you.


Solution

  • I found the answer for this. If this is the case, it will take the remaining 10 samples to the last step of the epoch.

    Eg: 15x66+10=1000 that means it will take 66 batches of size 15 and for the final steps it takes only 10.

    Anyways this will only work with input_shape, if we use batch_input_shape it will give us an error because we are specifying the batch shape in the graph level.