-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cumulative Update for Keras 2.2.0 and some fixes and Explanations in the README.md #103
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
59552b0
attempt 1
farizrahman4u 1ce792e
Updated engine.py
sumanthrao 149db79
Merge pull request #1 from sumanthrao/sumanthrao-patch-1
sumanthrao 00861ac
Update Readme.md to correct some mistakes.
Pyrestone f106cda
Update README.md
Pyrestone 12a805a
Merge pull request #1 from sumanthrao/master
Pyrestone 09792f0
Fix Keras 2.2?
Pyrestone 2e34bf7
Update README.md
Pyrestone c6dfc71
Update requirements.txt
Pyrestone 69cd986
Put back Fariz's URL into the installation URL
Pyrestone 5c3a4c2
Update engine.py
Pyrestone f575d8f
Merge pull request #2 from Pyrestone/master
Pyrestone 043bd3a
Merge branch 'master' into tf_teacher_force
Pyrestone 8bde71a
Merge pull request #3 from Pyrestone/tf_teacher_force
Pyrestone 4260701
more fix
Pyrestone b24113e
Merge pull request #4 from Pyrestone/master
Pyrestone 040020f
Spaces around = for prettyness
Pyrestone c825728
Merge pull request #5 from Pyrestone/master
Pyrestone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,8 @@ from keras.layers import * | |
from keras.models import * | ||
from recurrentshop import * | ||
|
||
x_t = Input(5,)) # The input to the RNN at time t | ||
h_tm1 = Input((10,)) # Previous hidden state | ||
x_t = Input(shape=(5,)) # The input to the RNN at time t | ||
h_tm1 = Input(shape=(10,)) # Previous hidden state | ||
|
||
# Compute new hidden state | ||
h_t = add([Dense(10)(x_t), Dense(10, use_bias=False)(h_tm1)]) | ||
|
@@ -34,17 +34,35 @@ h_t = add([Dense(10)(x_t), Dense(10, use_bias=False)(h_tm1)]) | |
h_t = Activation('tanh')(h_t) | ||
|
||
# Build the RNN | ||
rnn = RecurrentModel(input=x_t, initial_states=[h_tm1], output=h_t, output_states=[h_t]) | ||
|
||
# rnn is a standard Keras `Recurrent` instance. RecuurentModel also accepts arguments such as unroll, return_sequences etc | ||
# RecurrentModel is a standard Keras `Recurrent` layer. | ||
# RecurrentModel also accepts arguments such as unroll, return_sequences etc | ||
rnn = RecurrentModel(input=x_t, initial_states=[h_tm1], output=h_t, final_states=[h_t]) | ||
# return_sequences is False by default | ||
# so it only returns the last h_t state | ||
|
||
# Build a Keras Model using our RNN layer | ||
# input dimensions are (Time_steps, Depth) | ||
x = Input(shape=(7,5)) | ||
y = rnn(x) | ||
model = Model(x, y) | ||
|
||
# Run the RNN over a random sequence | ||
# Don't forget the batch shape when calling the model! | ||
out=model.predict(np.random.random((1, 7, 5))) | ||
print(out.shape)#->(1,10) | ||
|
||
x = Input((7,5)) | ||
y = rnn(x) | ||
|
||
model = Model(x, y) | ||
model.predict(np.random.random((7, 5))) | ||
# to get one output per input sequence element, set return_sequences=True | ||
rnn2 = RecurrentModel(input=x_t, initial_states=[h_tm1], output=h_t, final_states=[h_t],return_sequences=True) | ||
|
||
# Time_steps can also be None to allow variable Sequence Length | ||
# Note that this is not compatible with unroll=True | ||
x = Input(shape=(None ,5)) | ||
y = rnn2(x) | ||
model2 = Model(x, y) | ||
|
||
out2=model2.predict(np.random.random((1, 7, 5))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces around = |
||
print(out2.shape)#->(1,7,10) | ||
|
||
``` | ||
|
||
|
@@ -129,7 +147,7 @@ See docs/ directory for more features. | |
# Installation | ||
|
||
```shell | ||
git clone https://www.github.com/datalogai/recurrentshop.git | ||
git clone https://www.github.com/farizrahman4u/recurrentshop.git | ||
cd recurrentshop | ||
python setup.py install | ||
``` | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
keras>=2.0.0 | ||
keras>=2.2.0 | ||
numpy>=1.8.0 | ||
theano>=0.8.0 | ||
tensorflow>=1.9 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces around =