code: def masked_l2(preds, actuals, mask):
      """L2 loss with masking."""
      loss = tf.nn.l2(preds, actuals)
      mask = tf.cast(mask, dtype=tf.float32)
      mask /= tf.reduce_mean(mask)
      loss *= mask
      return tf.reduce_mean(loss)
  
imports: import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: masked_l2(preds, actuals, mask) and returns: tf