code: def test_one_hot(self):
      ref = np.asarray(
          [
              [[0.0, 1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0, 0.0]],
              [[0.0, 0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 1.0]],
          ],
          dtype=np.float32,
      )
  
      with self.cached_session():
          labels = tf.constant([[1, 2], [3, 4]])
          # import pdb; pdb.set_trace()
          one_hot = tf.sparse_tensor_to_dense(
              labels_to_one_hot(labels, 5)
          ).eval()
          self.assertAllEqual(one_hot, ref)
  
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 2 for calling the OneHotTester obj's underlying member method code with example usage: obj.test_one_hot() without return types