title: How to use mean_squared_error loss in tensorflow session
body: <p>I am new to tensorflow</p>
  
  <p>In a part of a code for a tensorflow session, there is :</p>
  
  <pre><code> loss = tf.nn.softmax_cross_entropy_with_logits_v2(
                      logits=net, labels=self.out_placeholder, name='cross_entropy')
                  self.loss = tf.reduce_mean(loss, name='mean_squared_error')
  </code></pre>
  
  <p>I want to use <code>mean_squared_error</code> loss function for this purpose. I found this loss function in tensorflow website:</p>
  
  <pre><code>tf.losses.mean_squared_error(
  labels,
  predictions,
  weights=1.0,
  scope=None,
  loss_collection=tf.GraphKeys.LOSSES,
  reduction=Reduction.SUM_BY_NONZERO_WEIGHTS
  )
  </code></pre>
  
  <p>I need this loss function for a regression problem.</p>
  
  <p>I tried:</p>
  
  <pre><code>loss = tf.losses.mean_squared_error(predictions=net, labels=self.out_placeholder)
  self.loss = tf.reduce_mean(loss, name='mean_squared_error')
  </code></pre>
  
  <p>Where <code>net = tf.matmul(input_tensor, weights) + biases</code></p>
  
  <p>However, I'm not sure if it's the correct way.</p>