Answers.Body: <p>They don't have to be equal, but introducing variable batches brings more complexity.</p>
  <p>In particular you need to make sure that batches are representative enough of the full dataset. If the batches have the same size you can just test few batch values until you get satisfactory results. If you introduce variable batches you need to perform more complicated test on the distribution/rule controlling this variability and handle edge cases, which is an additional headache over an already complicated debugging process. Usually it's not worth the pain, there are more impactful ways of spending your development time.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-15T22:50:20.280Z
Answers.LastActivityDate: 2022-04-16T19:25:42.763Z
Answers.LastEditDate: 2022-04-16T19:25:42.763Z
Answers.UserDisplayName: Rexcirus
Body: <p>Why should data batches in a neural network have an equal size?</p>
  <p>I have seen some recent research works on making the batch size dynamic, but still, I can't find an answer to my question.</p>
  
Tags: <neural-networks><hyper-parameters><batch-size>
Title: Why should data batches in a neural network have an equal size?
UserDisplayName: Minions
ThreadText: # Why should data batches in a neural network have an equal size?
  
  (Asked by: username_0 on 2022-03-15)
  
  Why should data batches in a neural network have an equal size?
  
  I have seen some recent research works on making the batch size dynamic, but still, I can't find an answer to my question.
  
  **Tags:** neural-networks, hyper-parameters, batch-size
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-03-15. Score: 1
  
  They don't have to be equal, but introducing variable batches brings more complexity.
  
  In particular you need to make sure that batches are representative enough of the full dataset. If the batches have the same size you can just test few batch values until you get satisfactory results. If you introduce variable batches you need to perform more complicated test on the distribution/rule controlling this variability and handle edge cases, which is an additional headache over an already complicated debugging process. Usually it's not worth the pain, there are more impactful ways of spending your development time.
  
  
  ---
  
  