You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been wondering if there are plans to add symbolic loops to TensorFlow because I feel like this is a major feature when it comes to variable length sequences. Finite unfolding (with bucketing) seems like a dirty hack to me and since (as far as I understand) TensorFlow is meant for deployment, too, how do you envision using it for seq2seq translation given that you don't know ahead of time how long the generated sequence will be?
Our white paper mentions a number of control flow operations that we've experimented with -- I think once we're happy with its API and confident in its implementation we will try to make it available through the public API -- we're just not quite there yet. It's still early days for us :)
See the highly alpha and unsupported control_flow_ops.While, the
TensorArray python class, and nn.dynamic_rnn. All at HEAD.
On Feb 16, 2016 7:48 AM, "Dmitrij Koniajev" [email protected]
wrote:
+1
—
Reply to this email directly or view it on GitHub #208 (comment)
.
You can now use control_flow_ops.{map, foldl, foldr} with forward and backprop, and you can call these functions from inside each others' lambdas. For RNN, you can use dynamic_rnn which does the same. If you have more complex eneds you can comment them here or use control_flow_ops.While and TensorArray. I'm marking this as fixed.
The implementation of both scan and map_fn uses TensorArray. Nesting scan inside map_fn is essentially nested while loops. Unfortunately, there is a known bug when TensorArray and nested while loops are used together. We have been working on a fix.
I am using scan to deal with different sequence length. But having problem to deal with batch! @rajarsheem can you write your solution for my above problem??? If I use for loop then its same like online learning! No need to use batch then! So no need to use GPU then!
You can see here for a more complex example, with a batch size > 1. But you'll need to either a) write not-so-clean code that's efficient (as they do in TensorFlow officially) or b) write clean code that is less efficient (this is what I do; I just wrap shorter sequences in time until all sequences are the same length, which simultaneously makes short sequences "count" just as much loss wise as long sequences).
Finally I have figured out how to use scan with batch. So I have written some simple code for dynamic RNN and GRU. Have conducted a little hack as Tensorflow was raising low level error. The github repo is here
Activity
vrv commentedon Nov 13, 2015
Our white paper mentions a number of control flow operations that we've experimented with -- I think once we're happy with its API and confident in its implementation we will try to make it available through the public API -- we're just not quite there yet. It's still early days for us :)
sisp commentedon Nov 13, 2015
I see. Great news that that's in the pipeline. Can't wait until it's publicly available. ;-)
Link to open GitHub issue: 4.4 control flow
dimchansky commentedon Feb 16, 2016
+1
ebrevdo commentedon Feb 16, 2016
See the highly alpha and unsupported control_flow_ops.While, the
TensorArray python class, and nn.dynamic_rnn. All at HEAD.
On Feb 16, 2016 7:48 AM, "Dmitrij Koniajev" [email protected]
wrote:
myme5261314 commentedon Mar 9, 2016
Any update or progress schedule?
ebrevdo commentedon Mar 9, 2016
You can now use control_flow_ops.{map, foldl, foldr} with forward and backprop, and you can call these functions from inside each others' lambdas. For RNN, you can use dynamic_rnn which does the same. If you have more complex eneds you can comment them here or use control_flow_ops.While and TensorArray. I'm marking this as fixed.
vrv commentedon Mar 9, 2016
@ebrevdo: are those functions:
ebrevdo commentedon Mar 9, 2016
Indeed not, but I believe {map_fn, foldl, foldr} are ready to be added by
referencing them in the header. We'll get a CL out soon.
On Wed, Mar 9, 2016 at 9:21 AM, Vijay Vasudevan [email protected]
wrote:
rakeshvar commentedon Mar 10, 2016
A toy RNN example with these functions would go a long way; especially since they do not directly correspond to the
theano.scanfunctionality.ebrevdo commentedon Mar 10, 2016
See the implementation of dynamic_rnn for a comprehensive example.
On Mar 9, 2016 6:59 PM, "rakeshvar" [email protected] wrote:
6 remaining items
rajarsheem commentedon May 20, 2016
@rdipietro I tried to extend your code to a vanilla GRU. Also removed the clipping therefore and replaced Gradient Descent with Adagrad.
Consequently convergence is now much faster.
Can you please verify the code ?
http://paste.ubuntu.com/16534925/
(I know it's much dirty!)
KnHuq commentedon Jun 4, 2016
How to use map and scan together??????? Anyone have any idea?
x=tf.constant(
[[[1,2,3],[10,20,30]],
[[1,2,3],[10,20,30]],
[[1,2,3],[10,20,30]],
[[1,2,3],[10,20,30]]])
def sum(x): return tf.scan(lambda y, z : tf.add(y,z), x)
tf.map_fn(sum ,a )
Then errors pop up!!!! Is there any way using these together?
@rdipietro I have been through your example notebook but how to use it for batch????
yuanbyu commentedon Jun 4, 2016
The implementation of both scan and map_fn uses TensorArray. Nesting scan inside map_fn is essentially nested while loops. Unfortunately, there is a known bug when TensorArray and nested while loops are used together. We have been working on a fix.
KnHuq commentedon Jun 5, 2016
Ok thanks.
rajarsheem commentedon Jun 5, 2016
@KnHuq Not sure if this serves your problem for batches, but you can still see my attempt . There may be some issues, though.
KnHuq commentedon Jun 5, 2016
I am using scan to deal with different sequence length. But having problem to deal with batch! @rajarsheem can you write your solution for my above problem??? If I use for loop then its same like online learning! No need to use batch then! So no need to use GPU then!
Please Google solve this nested while loops. ...
rdipietro commentedon Jun 5, 2016
You can see here for a more complex example, with a batch size > 1. But you'll need to either a) write not-so-clean code that's efficient (as they do in TensorFlow officially) or b) write clean code that is less efficient (this is what I do; I just wrap shorter sequences in time until all sequences are the same length, which simultaneously makes short sequences "count" just as much loss wise as long sequences).
KnHuq commentedon Jun 5, 2016
@rdipietro Thanks a lot. I will go through the your example!
rajarsheem commentedon Jun 5, 2016
@rdipietro can you verify my graph, whether it is set up right ? (it is a very very simple example)
KnHuq commentedon Jun 9, 2016
Finally I have figured out how to use scan with batch. So I have written some simple code for dynamic RNN and GRU. Have conducted a little hack as Tensorflow was raising low level error. The github repo is here
KnHuq commentedon Jul 9, 2016
The problem of scan and map together is solved by the latest release of Tensorflow.
[spirv] Add cast operations
[spirv] Add cast operations
[spirv] Add cast operations
update RCCL tarball to 0.6.0-rc2