code: def test_caption_cross_entropy(self):
      caption_ce_loss = losses.CaptionCrossEntropyLoss()
  
      expected = dict()
      predicted = dict()
  
      # Test complete match
      expected["targets"] = torch.empty((1, 10), dtype=torch.long)
      expected["targets"].fill_(4)
      predicted["scores"] = torch.zeros((1, 10, 10))
      predicted["scores"][:, :, 4] = 100.0
  
      self.assertEqual(caption_ce_loss(expected, predicted).item(), 0.0)
  
      # Test random initialized
      torch.manual_seed(1234)
      expected["targets"] = torch.randint(0, 9491, (5, 10))
      predicted["scores"] = torch.rand((5, 10, 9491))
  
      self.assertAlmostEqual(
          caption_ce_loss(expected, predicted).item(), 9.2507, 4
      )
  
imports: import collections
  import unittest
  from unittest.mock import MagicMock
  import mmf.modules.losses
  import torch
  import torch.nn
  import torch.nn.functional
  from mmf.common.registry import registry
  from mmf.common.sample import SampleList
label_desc: Use image node_id 5 for calling the TestModuleLosses obj's underlying member method code with example usage: obj.test_caption_cross_entropy() without return types