import tensorflow as tf

  if not from_logits:
    # transform back to logits
    epsilon = _to_tensor(_EPSILON, output.dtype.base_dtype)
    output = tf.clip_by_value(output, epsilon, 1 - epsilon)
    output = tf.log(output / (1 - output))
  try:
    return tf.nn.sigmoid_cross_entropy_with_logits(labels=target, logits=output)
  except TypeError:
    return tf.nn.sigmoid_cross_entropy_with_logits(logits=output, labels=target)


def sum(x, axis=None, keepdims=False):
