title: Retval[0] does not have value : tf.cond(condition, net1, net2)
body: <p>I was trying to use <code>tf.cond()</code> to create 2 different graphs based on a condition. On, both the graphs we want to have weight regularization loss and thus we use <code>tf.losses.get_regularization_loss()</code>. Here is a pseudo code of our project</p>
  
  <pre><code> def net_1(x,y):
    statement 1 (has trainable params)
    statement 2 (has trainable params)
    return
  
  </code></pre>
  
  <pre><code>def net_2(x,y):
   statement 1 (has trainable params)
   statement 2 (has trainable params)
   statement 3 (has trainable params)
   return
  </code></pre>
  
  <pre><code>step = tf.get_or_create_global_step()
  
  
  tf.cond(tf.greater(step, 100), net_1, net_2)
  loss = 0.0
  loss += tf.losses.get_regularization_loss()
  </code></pre>
  
  <p>If we keep the <code>tf.losses.get_regularization_loss()</code> we get the error:</p>
  
  <blockquote>
    <p>Retval[0] does not have value</p>
  </blockquote>
  
  <p>Otherwise, there is no error.</p>
  
  <p>Is there any special care to be taken with <code>tf.cond()</code> if we want to impose <code>tf.losses.get_regularization_loss()</code>.</p>