-
Notifications
You must be signed in to change notification settings - Fork 942
Add LSTM ops and a simple LSTM demo #47
Conversation
|
So cool to see this PR! We use Reviewable for this project which is similar to Gerrit and the internal Google tool. Let me know if you have any questions about Reviewable! Most comments are just style/API goodies. The only bigger question is about the API regarding the input data type of the math lstm methods. Reviewed 13 of 13 files at r1. demos/lstm/index.html, line 4 at r1 (raw file):
move this <script> tag at the end of the body after We follow this practice as a precaution to avoid situations where the code uses elements in the dom that are not yet rendered. demos/lstm/lstm.ts, line 67 at r1 (raw file):
we added support for broadcasting in #40. demos/lstm/lstm.ts, line 85 at r1 (raw file):
demos/lstm/README.md, line 1 at r1 (raw file):
How about a title like "Learning digits of pi using an LSTM" demos/lstm/README.md, line 6 at r1 (raw file):
s/BasicLSTMCells/ demos/lstm/README.md, line 7 at r1 (raw file):
s/the/to demos/lstm/README.md, line 15 at r1 (raw file):
s/.:/: src/math/math.ts, line 1148 at r1 (raw file):
add src/math/math.ts, line 1150 at r1 (raw file):
Since it's always a tuple of 2 you can type the returning result as: src/math/math.ts, line 1151 at r1 (raw file):
FYI, you can just say this.scope(() => {..} if you don't use keep and track src/math/math.ts, line 1158 at r1 (raw file):
use src/math/math.ts, line 1180 at r1 (raw file):
add src/math/math.ts, line 1183 at r1 (raw file):
if the result is always of length 2, you can type it more strictly: Also, is the cell/hidden state src/math/math.ts, line 1189 at r1 (raw file):
use data.as3D(1, 1, data.shape[0]) here and elsewhere (as2D, as1D etc) where you call this.reshape(). You don't need src/math/math.ts, line 1201 at r1 (raw file):
We added broadcasting in #40 so src/math/math.ts, line 1215 at r1 (raw file):
sorry API's is evolving while you are writing this demo :) we deprecated this method. Use Comments from Reviewable |
|
I have only minor nits, Daniel covered all the non-trivial stuff! This is /so/ awesome, thank you for contributing to src/ and being the first major external contributor! :) Reviewed 13 of 13 files at r1. demos/lstm/index.html, line 1 at r1 (raw file):
Add the HTML license docstring (check out demos/mnist.html) demos/lstm/lstm.ts, line 1 at r1 (raw file):
can we maybe call this lstm_inference.ts so that it's clear this doesn't do any training? demos/lstm/lstm.ts, line 39 at r1 (raw file):
space before number[] demos/lstm/lstm.ts, line 54 at r1 (raw file):
remove extra space before expected src/math/math.ts, line 1143 at r1 (raw file):
can you say in the docstring here that this is only the forward mode? src/math/math.ts, line 1163 at r1 (raw file):
Add space before "Array2D[]" and below src/math/math.ts, line 1173 at r1 (raw file):
add to docstring saying this is only forward mode src/math/math.ts, line 1198 at r1 (raw file):
just a reminder to update this comment when you do the broadcast add :) Comments from Reviewable |
|
Review status: 8 of 13 files reviewed at latest revision, 24 unresolved discussions. demos/lstm/index.html, line 1 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Done. demos/lstm/index.html, line 4 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. demos/lstm/README.md, line 1 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. demos/lstm/README.md, line 6 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. demos/lstm/README.md, line 7 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. demos/lstm/README.md, line 15 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1143 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Done. src/math/math.ts, line 1148 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1150 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1151 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1158 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1163 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Done. src/math/math.ts, line 1173 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Done. src/math/math.ts, line 1180 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1183 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1189 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1198 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Done. src/math/math.ts, line 1201 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. src/math/math.ts, line 1215 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. demos/lstm/lstm.ts, line 1 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Done. demos/lstm/lstm.ts, line 39 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Done. demos/lstm/lstm.ts, line 54 at r1 (raw file): Previously, nsthorat (Nikhil Thorat) wrote…
Done. demos/lstm/lstm.ts, line 67 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. demos/lstm/lstm.ts, line 85 at r1 (raw file): Previously, dsmilkov (Daniel Smilkov) wrote…
Done. Comments from Reviewable |
|
Thanks for the review! I think I've got everything fixed up based on your comments. Review status: 8 of 13 files reviewed at latest revision, 24 unresolved discussions. Comments from Reviewable |
|
If you have any other feedback of how the API can be simplified, or what it needs, would love to hear it! Review status: 8 of 13 files reviewed at latest revision, 8 unresolved discussions. Comments from Reviewable |
* BasicLSTMCell * cleanup * 2-layer lstm * add training script for pi digits * start * interface * docs * lint * lint * fixes * updates based on comments
Adds ports of tf.contrib.rnn.BasicLSTMCell and tf.contrib.rnn.MultiRNNCell.
This change is