code: def test_vs_tf_onehot(self):
      with self.cached_session():
          labels = tf.constant(
              [1, 2, 3, 0], dtype=tf.int64, name="labels"
          )
          tf_one_hot = tf.one_hot(labels, depth=4)
          niftynet_one_hot = tf.sparse_tensor_to_dense(
              labels_to_one_hot(labels, 4)
          )
          self.assertAllEqual(
              tf_one_hot.eval(), niftynet_one_hot.eval()
          )
  
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 1 for calling the OneHotTester obj's underlying member method code with example usage: obj.test_vs_tf_onehot() without return types