News for hackers. Stuff that matters.

fdrdrive

Re:Writing RNNs in Tensorflow on Saturday July 15, 2017 @05:23PM (#14779034)
I don't understand how that's related.
Re:Writing RNNs in Tensorflow on Saturday July 15, 2017 @06:45AM (#14776025)
I see - you're talking about a use case like this: https://github.com/google/seq2seq/blob/4c3582741f846a19195ac...

I agree that you have to use a tf.while_loop in those cases. But then tf.scan isn't an option, so I don't understand what you mean by 'quit early' or 'saves time'.

When tf.scan is possible, i.e. when you have an input sequence you want to scan over, it is a perfectly good option.

Re:Writing RNNs in Tensorflow on Saturday July 15, 2017 @03:40AM (#14775525)
I don't follow. tf.scan will execute as many time steps as there are elements in the input series, which is the same behavior you'd get with tf.while_loop or tf.dynamic_rnn. It does not execute for a fixed number of time steps, which I think is what you're implying?

The difference from using tf.while_loop directly is that tf.scan handles the logistics of an accumulator to keep track of hidden states, so you don't have to implement that piece yourself.

As you say, tf.scan uses tf.while_loop internally; it's not particularly different from something you might build using tf.while_loop yourself.

Re:Writing RNNs in Tensorflow on Saturday July 15, 2017 @01:56AM (#14775213)
I think that's covered in the article - there's a passage on using `tf.scan` when the `tf.dynamic_rnn` abstraction won't cut it. `tf.scan` is more flexible than `tf.dynamic_rnn`, but provides a little more scaffolding for RNNs than using `tf.while_loop` directly.