code: def test_dice_plus_weighted(self):
      with self.cached_session():
          predicted = tf.constant(
              [
                  [0, 9999, 9999],
                  [9999, 0, 0],
                  [0, 9999, 9999],
                  [9999, 0, 0],
              ],
              dtype=tf.float32,
              name="predicted",
          )
          labels = tf.constant(
              [2, 0, 1, 0], dtype=tf.int16, name="labels"
          )
          weights = tf.expand_dims(
              tf.constant([0, 1, 0, 0], dtype=tf.float32), axis=0
          )
          predicted, labels = [
              tf.expand_dims(x, axis=0) for x in (predicted, labels)
          ]
          test_loss_func = LossFunction(
              3, loss_type="DicePlusXEnt", softmax=True
          )
          loss_value = test_loss_func(
              predicted, labels, weight_map=weights
          )
          self.assertAllClose(loss_value.eval(), -1.0)
  
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 5 for calling the DicePlusXEntTest obj's underlying member method code with example usage: obj.test_dice_plus_weighted() without return types