code: def test_binary_cross_entropy(self):
      layer = tl.BinaryCrossEntropy()
      targets = np.array([1, 1, 0, 0, 0])
  
      # Near-perfect prediction for all five items in batch.
      model_outputs = np.array([9.0, 9.0, -9.0, -9.0, -9.0])
      metric_output = layer([model_outputs, targets])
      self.assertAlmostEqual(metric_output, 0.000123, places=6)
  
      # More right than wrong for all five items in batch.
      model_outputs = np.array([1.0, 1.0, -1.0, -1.0, -1.0])
      metric_output = layer([model_outputs, targets])
      self.assertAlmostEqual(metric_output, 0.313, places=3)
  
      # Near-perfect for 2, more right than wrong for 3.
      model_outputs = np.array([9.0, 1.0, -1.0, -1.0, -9.0])
      metric_output = layer([model_outputs, targets])
      self.assertAlmostEqual(metric_output, 0.188, places=3)
  
      # More wrong than right for all five.
      model_outputs = np.array([-1.0, -1.0, 1.0, 1.0, 1.0])
      metric_output = layer([model_outputs, targets])
      self.assertAlmostEqual(metric_output, 1.313, places=3)
  
imports: from absl.testing import absltest
  import numpy
  import trax.layers
label_desc: Use image node_id 9 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_binary_cross_entropy() without return types