Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import numpy
  2. from keras.models import Model
  3. from keras.layers import Input, Dropout, TimeDistributed
  4.  
  5. batch_size = 10
  6. timesteps = 5
  7. nb_features = 7
  8. dropout = 0.5
  9.  
  10. input = Input(batch_shape=(batch_size, timesteps, nb_features))
  11. a = input
  12. a = TimeDistributed(Dropout(dropout))(a) # gives error
  13. output = a
  14.  
  15. model = Model(input, output)
  16. model.compile("adam", "mse")
  17.  
  18. X = numpy.random.rand(batch_size, timesteps, nb_features)
  19.  
  20. Y = model.predict_on_batch(X)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement