code: def binary_sigmoid_cross_entropy_with_clas(
      clas_fn,
      pos_inputs=None,
      neg_inputs=None,
      average_across_batch=True,
      average_across_classes=True,
      sum_over_batch=False,
      sum_over_classes=False,
      return_pos_neg_losses=False,
      name=None,
  ):
      """Computes sigmoid cross entropy of binary classifier.
  
      .. role:: python(code)
         :language: python
  
      Args:
          clas_fn: A callable takes data (e.g., :attr:`pos_inputs` and
              :attr:`fake_inputs`) and returns the logits of being positive. The
              signature of `clas_fn` must be:
              :python:`logits (, ...) = clas_fn(inputs)`.
              The return value of `clas_fn` can be the logits, or
              a tuple where the logits are the first element.
          pos_inputs: The positive data fed into `clas_fn`.
          neg_inputs: The negative data fed into `clas_fn`.
          average_across_batch (bool): If set, average the loss across the
              batch dimension. Must not set `average_across_batch`'
              and `sum_over_batch` at the same time.
          average_across_classes (bool): If set, average the loss across the
              class dimension (if exists). Must not set
              `average_across_classes`' and `sum_over_classes` at
              the same time. Ignored if :attr:`logits` is a 1D Tensor.
          sum_over_batch (bool): If set, sum the loss across the
              batch dimension. Must not set `average_across_batch`
              and `sum_over_batch` at the same time.
          sum_over_classes (bool): If set, sum the loss across the
              class dimension. Must not set `average_across_classes`
              and `sum_over_classes` at the same time. Ignored if
              :attr:`logits` is a 2D Tensor.
          return_pos_neg_losses (bool): If set, additionally returns the losses
              on :attr:`pos_logits` and :attr:`neg_logits`, respectively.
          name (str, optional): A name for the operation.
  
      Returns:
          By default, a Tensor containing the loss, of rank 0, 1, or 2 depending
          on the arguments :attr:`{average_across}/{sum_over}_{batch}/{classes}`.
          For example:
  
              - If :attr:`sum_over_batch` and :attr:`average_across_classes`  \
              are `True` (default), the return Tensor is of rank 0.
  
              - If  arguments are `False`, the return Tensor is of shape \
              `[batch_size(, num_classes)]`.
  
          If :attr:`return_pos_neg_losses`=`True`, returns a tuple
          `(loss, pos_loss, neg_loss)`, where `loss` is the loss above;
          `pos_loss` is the loss on `pos_logits` only; and
          `neg_loss` is the loss on `neg_logits` only. They have
          `loss = pos_loss + neg_loss`.
      """
      pos_logits = None
      if pos_inputs is not None:
          pos_logits = clas_fn(pos_inputs)
          if isinstance(pos_logits, (list, tuple)):
              pos_logits = pos_logits[0]
  
      neg_logits = None
      if neg_inputs is not None:
          neg_logits = clas_fn(neg_inputs)
          if isinstance(neg_logits, (list, tuple)):
              neg_logits = neg_logits[0]
  
      return binary_sigmoid_cross_entropy(
          pos_logits=pos_logits,
          neg_logits=neg_logits,
          average_across_batch=average_across_batch,
          average_across_classes=average_across_classes,
          sum_over_batch=sum_over_batch,
          sum_over_classes=sum_over_classes,
          return_pos_neg_losses=return_pos_neg_losses,
          name=name,
      )
  
imports: import tensorflow
  from texar.tf.losses.losses_utils import mask_and_reduce, reduce_dimensions
  from texar.tf.utils import shapes
label_desc: Use image node_id 5 for calling a global function with example usage: binary_sigmoid_cross_entropy_with_clas(clas_fn, pos_inputs, neg_inputs, average_across_batch, average_across_classes, sum_over_batch, sum_over_classes, return_pos_neg_losses, name) and returns: binary_sigmoid_cross_entropy