code: def test_sampled_softmax_has_greater_loss_in_train_mode(self):
      sampled_softmax = SampledSoftmaxLoss(
          num_words=10000, embedding_dim=12, num_samples=10
      )
  
      # sequence_length, embedding_dim
      embedding = torch.rand(100, 12)
      targets = torch.randint(0, 1000, (100,)).long()
  
      sampled_softmax.train()
      train_loss = sampled_softmax(embedding, targets).item()
  
      sampled_softmax.eval()
      eval_loss = sampled_softmax(embedding, targets).item()
  
      assert eval_loss > train_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 4 for calling the TestSampledSoftmaxLoss obj's underlying member method code with example usage: obj.test_sampled_softmax_has_greater_loss_in_train_mode() without return types