code: def variability(pred_multi, num_classes=2, nrater=2):
      one_hot_gt, output_shape = labels_to_one_hot(
          tf.cast(pred_multi, tf.int64), num_classes
      )
      dense_one_hot = tf.sparse_tensor_to_dense(one_hot_gt)
      freq = tf.divide(
          tf.reduce_sum(dense_one_hot, 1),
          tf.cast(tf.shape(pred_multi)[1], tf.float32),
      )
      variability = tf.reduce_sum(tf.square(freq), -1)
      return 1 - variability
  
file_path: NiftyNet/niftynet/layer/loss_classification_multi.py
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import tensorflow
  from niftynet.engine.application_factory import LossClassificationMultiFactory
  from niftynet.layer.base_layer import Layer
label_desc: Use image node_id 3 for calling a global function with example usage: variability(pred_multi, num_classes, nrater) and returns: unknown