code: def test_cross_entropy_value(self):
      # test value is -0.5 * [1 * log(e / (1+e)) + 1 * log(e^2 / (e^2 + 1))]
      with self.cached_session():
          predicted = tf.constant(
              [[0, 1], [2, 0]], dtype=tf.float32, name="predicted"
          )
          labels = tf.constant([1, 0], dtype=tf.int64, name="labels")
          test_loss_func = LossFunction(2, loss_type="CrossEntropy")
          computed_cross_entropy = test_loss_func(predicted, labels)
          self.assertAlmostEqual(
              computed_cross_entropy.eval(),
              -0.5
              * (
                  np.log(np.e / (1 + np.e))
                  + np.log(np.e**2 / (1 + np.e**2))
              ),
          )
  
file_path: NiftyNet/tests/loss_classification_test.py
imports: from __future__ import absolute_import, print_function
  import numpy
  import tensorflow
  from niftynet.layer.loss_classification import LossFunction
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 1 for calling the CrossEntropyTests obj's underlying member method code with example usage: obj.test_cross_entropy_value() without return types