Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created July 28, 2020 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateekjoshi565/9572566327dc93fc91e4b311d48e5392 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/9572566327dc93fc91e4b311d48e5392 to your computer and use it in GitHub Desktop.
def get_batches(arr_x, arr_y, batch_size):
# iterate through the arrays
prv = 0
for n in range(batch_size, arr_x.shape[0], batch_size):
x = arr_x[prv:n,:]
y = arr_y[prv:n,:]
prv = n
yield x, y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment