(predicted_vectors, true_vectors, name)
return loss
Calculate L2 loss and associated summaries.

  Args:
    predicted_vectors: Tensor of predictions, first dimension is batch size.
    true_vectors: Tensor of labels, first dimension is batch size.
    name: Name to use as prefix for summaries.

  Returns:
    loss: Dimensionless tensor representing the mean euclidean distance
      between true and predicted.
Calculate L2 loss and associated summaries.
Calculate L2 loss and associated summaries .
def calculate_l2_and_summaries(predicted_vectors, true_vectors, name):
  """Calculate L2 loss and associated summaries.

  Args:
    predicted_vectors: Tensor of predictions, first dimension is batch size.
    true_vectors: Tensor of labels, first dimension is batch size.
    name: Name to use as prefix for summaries.

  Returns:
    loss: Dimensionless tensor representing the mean euclidean distance
      between true and predicted.
  """
  loss = tf.reduce_mean((predicted_vectors - true_vectors)**2)
  tf.summary.scalar(name + "_loss", loss)
  tf.summary.scalar(
      name + "_prediction_mean_squared_norm",
      tf.reduce_mean(tf.nn.l2_loss(predicted_vectors)))
  tf.summary.scalar(
      name + "_label_mean_squared_norm",
      tf.reduce_mean(tf.nn.l2_loss(true_vectors)))
  return loss
def calculate_l2_and_summaries ( predicted_vectors , true_vectors , name ) : loss = tf . reduce_mean ( ( predicted_vectors - true_vectors ) ** 2 ) tf . summary . scalar ( name + "_loss" , loss ) tf . summary . scalar ( name + "_prediction_mean_squared_norm" , tf . reduce_mean ( tf . nn . l2_loss ( predicted_vectors ) ) ) tf . summary . scalar ( name + "_label_mean_squared_norm" , tf . reduce_mean ( tf . nn . l2_loss ( true_vectors ) ) ) return loss