code: def test_binary_cross_entropy_disc(oasis_logits):
      logits1, logits2, target = oasis_logits
  
      loss_fn = OASISDiscriminatorLoss()
  
      output = loss_fn(logits1, logits2, target)
  
      est1 = torch.gather(
          -1.0 * F.log_softmax(logits1, dim=1),
          1,
          target.unsqueeze(1) + 1,
      ).mean()
      est2 = torch.gather(
          -1.0 * F.log_softmax(logits1, dim=1),
          1,
          torch.zeros_like(target).unsqueeze(1),
      ).mean()
  
      # numerical precision issues
      assert torch.allclose(output, 0.5 * (est1 + est2), rtol=0.01)
  
imports: import pytest
  import torch
  import torch.nn.functional
  from neuralcompression.loss_fn import OASISDiscriminatorLoss, OASISGeneratorLoss
label_desc: Use image node_id 2 for calling a global function with example usage: test_binary_cross_entropy_disc(oasis_logits) without return types