code: def test_variability_loss(self):
      with self.cached_session():
          predicted = tf.constant(
              [
                  [[1, -1], [-1, 1], [1, -1]],
                  [[1, -1], [1, -1], [1, -1]],
              ],
              dtype=tf.float32,
          )
          predicted *= 1000
          ground_truth = [[0, 0, 1], [0, 0, 1]]
          test_loss_func = LossFunction(2, 3, loss_type="Variability")
          computed_loss = test_loss_func(
              ground_truth=ground_truth, pred_multi=predicted
          )
          self.assertAlmostEqual(
              computed_loss.eval(), np.sqrt(16.0 / 162.0)
          )
  
file_path: NiftyNet/tests/loss_classification_multi_test.py
imports: from __future__ import absolute_import, print_function
  import numpy
  import tensorflow
  from niftynet.layer.loss_classification_multi import LossFunction, variability
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 1 for calling the LossVariabilityTest obj's underlying member method code with example usage: obj.test_variability_loss() without return types