code: def sampled_softmax_loss(
      positive_keys: tf.Tensor,
      inputs: tf.Tensor,
      num_samples: int,
      de_config: de_config_pb2.DynamicEmbeddingConfig,
      var_name: typing.Text,
      service_address: typing.Text = "",
      timeout_ms: int = -1,
  ):
      """Compute sampled Softmax loss from given input activations.
  
      Args:
        positive_keys: A string `Tensor` of shape `[batch_size, None]` representing
          input positive keys.
        inputs: A float `Tensor` of shape `[batch_size, dim]`, representing the
          forward activations of the input network.
        num_samples: An int denoting the returned positive and negative samples.
        de_config: A DynamicEmbeddingConfig for configuring the dynamic embedding.
        var_name: A unique name for the operation.
        service_address: The address of a dynamic embedding service. If empty, the
          value passed from --kbs_address flag will be used instead.
        timeout_ms: Timeout millseconds for the connection. If negative, never
          timout.
  
      Returns:
        A float `Tensor` representing the sampled softmax loss.
      """
      logits, labels, _, mask, _ = compute_sampled_logits(
          positive_keys,
          inputs,
          num_samples,
          de_config,
          var_name,
          service_address,
          timeout_ms,
      )
      tiled_norm = tf.tile(
          tf.maximum(tf.reduce_sum(labels, -1, keepdims=True), 1),
          [1, labels.get_shape()[-1]],
      )
      labels /= tiled_norm
      return tf.reduce_sum(
          tf.nn.softmax_cross_entropy_with_logits_v2(
              labels=labels, logits=logits
          )
      ) / tf.reduce_sum(mask)
  
file_path: neural-structured-learning/research/carls/candidate_sampling_ops.py
imports: import typing
  from research.carls import context
  from research.carls import dynamic_embedding_config_pb2
  from research.carls.kernels import gen_carls_ops
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: sampled_softmax_loss(positive_keys, inputs, num_samples, de_config, var_name, service_address, timeout_ms) and returns: unknown