class_docstr: Test loss functions.
class_docstr_tok: ["Test","loss","functions","."]
docstr: .
code: def test_ShannonEntropy_pytorch(self):
      """."""
      loss = losses.ShannonEntropy()
      inputs = torch.tensor([[0.7, 0.3], [0.9, 0.1]])
      result = loss._create_pytorch_loss()(inputs).numpy()
      expected = [
          -np.mean([0.7 * np.log(0.7), 0.3 * np.log(0.3)]),
          -np.mean([0.9 * np.log(0.9), 0.1 * np.log(0.1)]),
      ]
      assert np.allclose(expected, result)
  
imports: import unittest
  import numpy
  import pytest
  import deepchem
  import deepchem.models.losses
label_desc: Use image node_id 28 for calling the TestLosses obj's underlying member method code with example usage: obj.test_ShannonEntropy_pytorch() without return types