code: def test_sampled_equals_unsampled_during_eval(self):
      sampled_softmax = SampledSoftmaxLoss(
          num_words=10000, embedding_dim=12, num_samples=40
      )
      unsampled_softmax = SoftmaxLoss(num_words=10000, embedding_dim=12)
  
      sampled_softmax.eval()
      unsampled_softmax.eval()
  
      # set weights equal, use transpose because opposite shapes
      sampled_softmax.softmax_w.data = unsampled_softmax.softmax_w.t()
      sampled_softmax.softmax_b.data = unsampled_softmax.softmax_b
  
      # sequence_length, embedding_dim
      embedding = torch.rand(100, 12)
      targets = torch.randint(0, 1000, (100,)).long()
  
      full_loss = unsampled_softmax(embedding, targets).item()
      sampled_loss = sampled_softmax(embedding, targets).item()
  
      # Should be really close
      np.testing.assert_almost_equal(sampled_loss, full_loss)
  
file_path: allennlp/tests/modules/sampled_softmax_loss_test.py
imports: from typing import Tuple
  import torch
  import numpy
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.modules.sampled_softmax_loss import _choice, SampledSoftmaxLoss
  from allennlp.modules import SoftmaxLoss
label_desc: Use image node_id 3 for calling the TestSampledSoftmaxLoss obj's underlying member method code with example usage: obj.test_sampled_equals_unsampled_during_eval() without return types