Created
September 13, 2017 20:56
-
-
Save mcleonard/6666b0b9999da20754a7aa933bb3dcb5 to your computer and use it in GitHub Desktop.
RNN batch examples
This file contains 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
seq = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) | |
### | |
## For get_batches(seq, 2, 2) | |
# batch 1 | |
x = array([[1, 2], | |
[7, 8]]), | |
y = array([[2, 3], | |
[8, 9]])) | |
# batch 2 | |
x = array([[ 3, 4], | |
[ 9, 10]]), | |
y = array([[ 4, 5], | |
[10, 11]])) | |
# batch 3 | |
x = array([[ 5, 6], | |
[11, 12]]) | |
y = array([[ 6, 7], | |
[12, 1]]) | |
### | |
## For get_batches(seq, 2, 3) | |
# batch 1 | |
x = array([[1, 2, 3], | |
[7, 8, 9]]) | |
y = array([[2, 3, 4], | |
[8, 9, 10]])) | |
# batch 2 | |
x = array([[ 4, 5, 6], | |
[10, 11, 12]]), | |
y = array([[ 5, 6, 7], | |
[11, 12, 1]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment