Created
July 21, 2018 23:51
-
-
Save morenoh149/b164e48a35fe4e6df1f85c4d5b054e70 to your computer and use it in GitHub Desktop.
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
--------------------------------------------------------------------------- | |
MemoryError Traceback (most recent call last) | |
<ipython-input-22-567222df1eb0> in <module>() | |
----> 1 x_train = vectorize_sequences(train_data) | |
2 x_test = vectorize_sequences(test_data) | |
<ipython-input-21-5d7c33381575> in vectorize_sequences(sequences, dimension) | |
2 # are a 1 in the tensor, 0 otherwise | |
3 def vectorize_sequences(sequences, dimension=10000): | |
----> 4 results = np.zeros((len(sequences), dimension)) | |
5 for i, sequence in enumerate(sequences): | |
6 results[i, sequence] = 1. | |
MemoryError: |
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
# accepts sequences list/nparray and returns a tensor where those numbers | |
# are a 1 in the tensor, 0 otherwise | |
def vectorize_sequences(sequences, dimension=10000): | |
results = np.zeros((len(sequences), dimension)) | |
for i, sequence in enumerate(sequences): | |
results[i, sequence] = 1. | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment