code: def masked_logit_cross_entropy(preds, labels, mask):
      """Logit cross-entropy loss with masking."""
      loss = tf.nn.sigmoid_cross_entropy_with_logits(
          logits=preds, labels=labels
      )
      loss = tf.reduce_sum(loss, axis=1)
      mask = tf.cast(mask, dtype=tf.float32)
      mask /= tf.maximum(tf.reduce_sum(mask), tf.constant([1.0]))
      loss *= mask
      return tf.reduce_mean(loss)
  
imports: import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: masked_logit_cross_entropy(preds, labels, mask) and returns: tf