tensorflow: tf.while_loop much slower than static graph?

I’m running on TF 1.1, and I’ve used tf.while_loop + TensorArray to implement dynamic unrolling of a type of recurrence that I previously unrolled statically through python code. The difference in speed is very dramatic, with forward inference being about 200x slower when dynamically unrolled, and backprop about 2x slower. Is this expected? Are there any tricks for optimization that I’m missing? This is on CPU. Performance gap on GPU is even larger.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 30 (18 by maintainers)

Most upvoted comments

It has been 89 days with no activity and the awaiting response label was assigned. Is this still an issue?

I did; it only made things worse.