code: def test_generalised_dice_score_uniform_regression(self):
      with self.cached_session():
          predicted = tf.constant(
              [[0, 10], [10, 0], [10, 0], [10, 0]],
              dtype=tf.float32,
              name="predicted",
          )
  
          labels = tf.constant(
              [[1, 0, 0, 0]], dtype=tf.int64, name="labels"
          )
          weights = tf.cast(labels, tf.float32)
          predicted, labels, weights = [
              tf.expand_dims(x, axis=0)
              for x in (predicted, labels, weights)
          ]
  
          test_loss_func = LossFunction(
              2,
              loss_type="GDSC",
              loss_func_params={"type_weight": "Uniform"},
          )
          one_minus_generalised_dice_score = test_loss_func(
              predicted, labels, weights
          )
          self.assertAllClose(
              one_minus_generalised_dice_score.eval(), 0.3333, atol=1e-4
          )
  
imports: from __future__ import absolute_import, print_function
  import numpy
  import tensorflow
  from niftynet.layer.loss_segmentation import LossFunction, labels_to_one_hot
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 3 for calling the GeneralisedDiceTest obj's underlying member method code with example usage: obj.test_generalised_dice_score_uniform_regression() without return types