code: def binary_crossentropy(target, output, from_logits=False):
      """Binary crossentropy between an output tensor and a target tensor.
  
      Args:
          target: A tensor with the same shape as `output`.
          output: A tensor.
          from_logits: Whether `output` is expected to be a logits tensor.
              By default, we consider that `output`
              encodes a probability distribution.
  
      Returns:
          A tensor.
      """
      target = tf.convert_to_tensor(target)
      output = tf.convert_to_tensor(output)
  
      if len(target.shape) != len(output.shape):
          raise ValueError(
              "Arguments `target` and `output` must have the same rank "
              "(ndim). Received: "
              f"target.shape={target.shape}, output.shape={output.shape}"
          )
      for e1, e2 in zip(target.shape, output.shape):
          if e1 is not None and e2 is not None and e1 != e2:
              raise ValueError(
                  "Arguments `target` and `output` must have the same shape. "
                  "Received: "
                  f"target.shape={target.shape}, output.shape={output.shape}"
              )
  
      output, from_logits = _get_logits(
          output, from_logits, "Sigmoid", "binary_crossentropy"
      )
  
      if from_logits:
          return tf.nn.sigmoid_cross_entropy_with_logits(
              labels=target, logits=output
          )
  
      # Compute cross entropy from probabilities.
      output = tf.clip_by_value(output, epsilon(), 1.0 - epsilon())
      bce = target * tf.math.log(output)
      bce += (1 - target) * tf.math.log(1 - output)
      return -bce
  
imports: import warnings
  import tensorflow
  from keras.backend import standardize_data_format
  from keras.backend import standardize_dtype
  from keras.backend.common.backend_utils import compute_conv_transpose_output_shape
  from keras.backend.config import epsilon
  from keras.backend.tensorflow.core import cast
  from keras.backend.tensorflow.core import convert_to_tensor
label_desc: Use image node_id 31 for calling a global function with example usage: binary_crossentropy(target, output, from_logits) and returns: unknown, tf