Created
October 25, 2016 16:12
-
-
Save eyaler/6801eee9b2134bcd518ffd34004c1475 to your computer and use it in GitHub Desktop.
timedistributed(dropout) error when batch_size is specified and using theano
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
import numpy | |
from keras.models import Model | |
from keras.layers import Input, Dropout, TimeDistributed | |
batch_size = 10 | |
timesteps = 5 | |
nb_features = 7 | |
dropout = 0.5 | |
input = Input(batch_shape=(batch_size, timesteps, nb_features)) | |
a = input | |
a = TimeDistributed(Dropout(dropout))(a) # gives error | |
output = a | |
model = Model(input, output) | |
model.compile("adam", "mse") | |
X = numpy.random.rand(batch_size, timesteps, nb_features) | |
Y = model.predict_on_batch(X) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment