Skip to content

Instantly share code, notes, and snippets.

@khanhnamle1994
Created March 12, 2019 13:42
Show Gist options
  • Select an option

  • Save khanhnamle1994/8297ce53aa7cf4d9bdcd376563a88aa0 to your computer and use it in GitHub Desktop.

Select an option

Save khanhnamle1994/8297ce53aa7cf4d9bdcd376563a88aa0 to your computer and use it in GitHub Desktop.
batch_size = 50
#function next_batch
def next_batch(num, data, labels):
'''
Return a total of `num` random samples and labels.
'''
idx = np.arange(0 , len(data))
np.random.shuffle(idx)
idx = idx[:num]
data_shuffle = [data[i] for i in idx]
labels_shuffle = [labels[i] for i in idx]
return np.asarray(data_shuffle), np.asarray(labels_shuffle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment