class_docstr: Test loss functions.
class_docstr_tok: ["Test","loss","functions","."]
docstr: .
code: def test_GlobalMutualInformation_pytorch(self):
      """."""
      torch.manual_seed(123)
  
      g_enc = torch.tensor([[1, 2, 3, 4], [1, 2, 3, 4]])
      g_enc2 = torch.tensor([[5, 6, 7, 8], [5, 6, 7, 8]])
  
      globalloss = losses.GlobalMutualInformationLoss()
  
      excepted_global_loss = np.array(34.306854)
  
      global_loss = (
          globalloss._create_pytorch_loss()(g_enc, g_enc2)
          .detach()
          .numpy()
      )
      assert np.allclose(global_loss, excepted_global_loss, 1e-3)
  
imports: import unittest
  import numpy
  import pytest
  import deepchem
  import deepchem.models.losses
label_desc: Use image node_id 29 for calling the TestLosses obj's underlying member method code with example usage: obj.test_GlobalMutualInformation_pytorch() without return types