title: Tensorflow warning: The graph couldn't be sorted in topological order?
body: <p>When I run <code>tensorflow</code> training (with custom defined graph, closed source), it outputs the warning:</p>
  
  <blockquote>
    <p>2018-10-03 14:29:24.352895: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 0, topological sort failed with message: The graph couldn't be sorted in topological order.</p>
  </blockquote>
  
  <p>What does it mean? What could likely cause this problem and how to avoid it?</p>
  
  <p><strong>Update:</strong> For the record, in my case, <code>tensorflow</code> still works correctly despite this warning. So I think it just means there are more loops in the computation graph than what <code>tensorflow</code> expects, not necessarily infinite loop. I fixed this by avoid using manual loop in code, but instead using tensor manipulation (<code>stack, concat, slice, reshape...</code>)</p>