class_docstr: Test loss functions.
class_docstr_tok: ["Test","loss","functions","."]
docstr: .
code: def test_LocalInformation_pytorch(self):
      """."""
      torch.manual_seed(123)
      dim = 4
      g_enc = torch.rand(2, dim)
      l_enc = torch.randn(4, dim)
      batch_graph_index = torch.tensor([[0, 1], [1, 0]])
  
      localloss = losses.LocalMutualInformationLoss()
  
      expected_local_loss = np.array(-0.17072642)
  
      local_loss = (
          localloss._create_pytorch_loss()(
              l_enc, g_enc, batch_graph_index
          )
          .detach()
          .numpy()
      )
      assert np.allclose(local_loss, expected_local_loss, 1e-3)
  
imports: import unittest
  import numpy
  import pytest
  import deepchem
  import deepchem.models.losses
label_desc: Use image node_id 30 for calling the TestLosses obj's underlying member method code with example usage: obj.test_LocalInformation_pytorch() without return types