Created
March 12, 2019 13:42
-
-
Save khanhnamle1994/8297ce53aa7cf4d9bdcd376563a88aa0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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