class_docstr: Test loss functions.
class_docstr_tok: ["Test","loss","functions","."]
docstr: Test CategoricalCrossEntropy.
code: def test_categorical_cross_entropy_pytorch(self):
      """Test CategoricalCrossEntropy."""
      loss = losses.CategoricalCrossEntropy()
      outputs = torch.tensor([[0.2, 0.8], [0.4, 0.6]])
      labels = torch.tensor([[0.0, 1.0], [1.0, 0.0]])
      result = loss._create_pytorch_loss()(outputs, labels).numpy()
      expected = [-np.log(0.8), -np.log(0.4)]
      assert np.allclose(expected, result)
  
imports: import unittest
  import numpy
  import pytest
  import deepchem
  import deepchem.models.losses
label_desc: Use image node_id 16 for calling the TestLosses obj's underlying member method code with example usage: obj.test_categorical_cross_entropy_pytorch() without return types