tf.contrib.losses.cosine_distance()

tf.contrib.losses.cosine_distance(predictions, targets, dim, weight=1.0, scope=None)

Adds a cosine-distance loss to the training procedure.

Note that the function assumes that the predictions and targets are already unit-normalized.

Args:
  • predictions: An arbitrary matrix.
  • targets: A Tensor whose shape matches 'predictions'
  • dim: The dimension along which the cosine distance is computed.
  • weight: Coefficients for the loss a scalar, a tensor of shape [batch_size] or a tensor whose shape matches predictions.
  • scope: The scope for the operations performed in computing the loss.
Returns:

A scalar Tensor representing the loss value.

Raises:
  • ValueError: If predictions.shape doesn't match targets.shape, if the ignore mask is provided and its shape doesn't match targets.shape or if the ignore mask is not boolean valued.
doc_TensorFlow
2016-10-14 13:07:09
Comments
Leave a Comment

Please login to continue.