code: def __call__(self, prediction, gt, sample):
      indices = sample["indices"]
      b, num_classes = tf.shape(prediction)[0], tf.shape(prediction)[-1]
      logits = tf.gather(
          tf.reshape(prediction, [b, -1, num_classes]),
          indices,
          batch_dims=1,
      )
  
      targets = tf.one_hot(tf.cast(gt, tf.int32), num_classes)
      positive_label_mask = tf.equal(targets, 1.0)
  
      neg_logits = -1.0 * logits
      cross_entropy = tf.nn.sigmoid_cross_entropy_with_logits(
          labels=targets, logits=logits
      )
      modulator = tf.exp(
          self.gamma * targets * neg_logits
          - self.gamma * tf.math.softplus(neg_logits)
      )
      loss = modulator * cross_entropy
      weighted_loss = tf.where(
          positive_label_mask,
          self.alpha * loss,
          (1.0 - self.alpha) * loss,
      )
  
      if self.reduce_batch:
          loss = tf.reduce_mean(weighted_loss)
      else:
          loss = tf.reduce_mean(weighted_loss, axis=[1, 2])
      return loss
  
label_desc: Use image node_id 2 for calling the SparseFocalLoss obj's underlying member method code with example usage: obj.__call__(prediction, gt, sample) and returns: loss