def sampled_softmax_loss(weights, biases, inputs, labels, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=True, partition_strategy='mod', name='sampled_softmax_loss'):
    'Computes and returns the sampled softmax training loss.\n\n  This is a faster way to train a softmax classifier over a huge number of\n  classes.\n\n  This operation is for training only.  It is generally an underestimate of\n  the full softmax loss.\n\n  At inference time, you can compute full softmax probabilities with the\n  expression `tf.nn.softmax(tf.matmul(inputs, tf.transpose(weights)) + biases)`.\n\n  See our [Candidate Sampling Algorithms Reference]\n  (../../extras/candidate_sampling.pdf)\n\n  Also see Section 3 of [Jean et al., 2014](http://arxiv.org/abs/1412.2007)\n  ([pdf](http://arxiv.org/pdf/1412.2007.pdf)) for the math.\n\n  Args:\n    weights: A `Tensor` of shape `[num_classes, dim]`, or a list of `Tensor`\n        objects whose concatenation along dimension 0 has shape\n        [num_classes, dim].  The (possibly-sharded) class embeddings.\n    biases: A `Tensor` of shape `[num_classes]`.  The class biases.\n    inputs: A `Tensor` of shape `[batch_size, dim]`.  The forward\n        activations of the input network.\n    labels: A `Tensor` of type `int64` and shape `[batch_size,\n        num_true]`. The target classes.  Note that this format differs from\n        the `labels` argument of `nn.softmax_cross_entropy_with_logits`.\n    num_sampled: An `int`.  The number of classes to randomly sample per batch.\n    num_classes: An `int`. The number of possible classes.\n    num_true: An `int`.  The number of target classes per training example.\n    sampled_values: a tuple of (`sampled_candidates`, `true_expected_count`,\n        `sampled_expected_count`) returned by a `*_candidate_sampler` function.\n        (if None, we default to `log_uniform_candidate_sampler`)\n    remove_accidental_hits:  A `bool`.  whether to remove "accidental hits"\n        where a sampled class equals one of the target classes.  Default is\n        True.\n    partition_strategy: A string specifying the partitioning strategy, relevant\n        if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported.\n        Default is `"mod"`. See `tf.nn.embedding_lookup` for more details.\n    name: A name for the operation (optional).\n\n  Returns:\n    A `batch_size` 1-D tensor of per-example sampled softmax losses.\n\n  '
    (logits, labels) = _compute_sampled_logits(weights, biases, inputs, labels, num_sampled, num_classes, num_true=num_true, sampled_values=sampled_values, subtract_log_q=True, remove_accidental_hits=remove_accidental_hits, partition_strategy=partition_strategy, name=name)
    sampled_losses = nn_ops.softmax_cross_entropy_with_logits(logits, labels)
    return sampled_losses
Computes and returns the sampled softmax training loss.

This is a faster way to train a softmax classifier over a huge number of
classes.

This operation is for training only.  It is generally an underestimate of
the full softmax loss.

At inference time, you can compute full softmax probabilities with the
expression `tf.nn.softmax(tf.matmul(inputs, tf.transpose(weights)) + biases)`.

See our [Candidate Sampling Algorithms Reference]
(../../extras/candidate_sampling.pdf)

Also see Section 3 of [Jean et al., 2014](http://arxiv.org/abs/1412.2007)
([pdf](http://arxiv.org/pdf/1412.2007.pdf)) for the math.

Args:
  weights: A `Tensor` of shape `[num_classes, dim]`, or a list of `Tensor`
      objects whose concatenation along dimension 0 has shape
      [num_classes, dim].  The (possibly-sharded) class embeddings.
  biases: A `Tensor` of shape `[num_classes]`.  The class biases.
  inputs: A `Tensor` of shape `[batch_size, dim]`.  The forward
      activations of the input network.
  labels: A `Tensor` of type `int64` and shape `[batch_size,
      num_true]`. The target classes.  Note that this format differs from
      the `labels` argument of `nn.softmax_cross_entropy_with_logits`.
  num_sampled: An `int`.  The number of classes to randomly sample per batch.
  num_classes: An `int`. The number of possible classes.
  num_true: An `int`.  The number of target classes per training example.
  sampled_values: a tuple of (`sampled_candidates`, `true_expected_count`,
      `sampled_expected_count`) returned by a `*_candidate_sampler` function.
      (if None, we default to `log_uniform_candidate_sampler`)
  remove_accidental_hits:  A `bool`.  whether to remove "accidental hits"
      where a sampled class equals one of the target classes.  Default is
      True.
  partition_strategy: A string specifying the partitioning strategy, relevant
      if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported.
      Default is `"mod"`. See `tf.nn.embedding_lookup` for more details.
  name: A name for the operation (optional).

Returns:
  A `batch_size` 1-D tensor of per-example sampled softmax losses.
def sampled_softmax_loss(weights, biases, inputs, labels, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=True, partition_strategy='mod', name='sampled_softmax_loss'):
    'Computes and returns the sampled softmax training loss.\n\n  This is a faster way to train a softmax classifier over a huge number of\n  classes.\n\n  This operation is for training only.  It is generally an underestimate of\n  the full softmax loss.\n\n  At inference time, you can compute full softmax probabilities with the\n  expression `tf.nn.softmax(tf.matmul(inputs, tf.transpose(weights)) + biases)`.\n\n  See our [Candidate Sampling Algorithms Reference]\n  (../../extras/candidate_sampling.pdf)\n\n  Also see Section 3 of [Jean et al., 2014](http://arxiv.org/abs/1412.2007)\n  ([pdf](http://arxiv.org/pdf/1412.2007.pdf)) for the math.\n\n  Args:\n    weights: A `Tensor` of shape `[num_classes, dim]`, or a list of `Tensor`\n        objects whose concatenation along dimension 0 has shape\n        [num_classes, dim].  The (possibly-sharded) class embeddings.\n    biases: A `Tensor` of shape `[num_classes]`.  The class biases.\n    inputs: A `Tensor` of shape `[batch_size, dim]`.  The forward\n        activations of the input network.\n    labels: A `Tensor` of type `int64` and shape `[batch_size,\n        num_true]`. The target classes.  Note that this format differs from\n        the `labels` argument of `nn.softmax_cross_entropy_with_logits`.\n    num_sampled: An `int`.  The number of classes to randomly sample per batch.\n    num_classes: An `int`. The number of possible classes.\n    num_true: An `int`.  The number of target classes per training example.\n    sampled_values: a tuple of (`sampled_candidates`, `true_expected_count`,\n        `sampled_expected_count`) returned by a `*_candidate_sampler` function.\n        (if None, we default to `log_uniform_candidate_sampler`)\n    remove_accidental_hits:  A `bool`.  whether to remove "accidental hits"\n        where a sampled class equals one of the target classes.  Default is\n        True.\n    partition_strategy: A string specifying the partitioning strategy, relevant\n        if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported.\n        Default is `"mod"`. See `tf.nn.embedding_lookup` for more details.\n    name: A name for the operation (optional).\n\n  Returns:\n    A `batch_size` 1-D tensor of per-example sampled softmax losses.\n\n  '
    (logits, labels) = _compute_sampled_logits(weights, biases, inputs, labels, num_sampled, num_classes, num_true=num_true, sampled_values=sampled_values, subtract_log_q=True, remove_accidental_hits=remove_accidental_hits, partition_strategy=partition_strategy, name=name)
    sampled_losses = nn_ops.softmax_cross_entropy_with_logits(logits, labels)
    return sampled_losses