code: def semi_supervised_loss(loss_function):
      """Wraps the provided ivis supervised loss function to deal with the partially
      labeled data. Returns a new 'semi-supervised' loss function that masks the
      loss on examples where label information is missing.
  
      Missing labels are assumed to be marked with -1."""
  
      @functools.wraps(loss_function)
      def new_loss_function(y_true, y_pred):
          mask = tf.cast(~tf.math.equal(y_true, -1), tf.float32)
          y_true_pos = tf.nn.relu(y_true)
          loss = loss_function(y_true_pos, y_pred)
          masked_loss = loss * mask
          return masked_loss
  
      return new_loss_function
  
imports: import functools
  from tensorflow.keras import backend
  import tensorflow
  from tensorflow import keras
  import numpy
  from .distances import euclidean_distance, manhattan_distance, chebyshev_distance, cosine_distance
label_desc: Use image node_id 3 for calling a global function with example usage: semi_supervised_loss(loss_function) and returns: new_loss_function, masked_loss