code: def test_temperature_dist_warper(self):
      input_ids = None
      length = 20
  
      scores = self._get_uniform_logits(batch_size=2, length=length)
  
      # tweak scores to not be uniform anymore
      scores[1, 5] = (1 / length) + 0.1  # peak, 1st batch
      scores[1, 10] = (1 / length) - 0.4  # valley, 1st batch
  
      # compute softmax
      probs = nn.functional.softmax(scores, dim=-1)
  
      temp_dist_warper_sharper = TemperatureLogitsWarper(
          temperature=0.5
      )
      temp_dist_warper_smoother = TemperatureLogitsWarper(
          temperature=1.3
      )
  
      warped_prob_sharp = nn.functional.softmax(
          temp_dist_warper_sharper(input_ids, scores.clone()), dim=-1
      )
      warped_prob_smooth = nn.functional.softmax(
          temp_dist_warper_smoother(input_ids, scores.clone()), dim=-1
      )
  
      # uniform distribution stays uniform
      self.assertTrue(
          torch.allclose(
              probs[0, :], warped_prob_sharp[0, :], atol=1e-3
          )
      )
      self.assertTrue(
          torch.allclose(
              probs[0, :], warped_prob_smooth[0, :], atol=1e-3
          )
      )
  
      # sharp peaks get higher, valleys get lower
      self.assertLess(probs[1, :].max(), warped_prob_sharp[1, :].max())
      self.assertGreater(
          probs[1, :].min(), warped_prob_sharp[1, :].min()
      )
  
      # smooth peaks get lower, valleys get higher
      self.assertGreater(
          probs[1, :].max(), warped_prob_smooth[1, :].max()
      )
      self.assertLess(probs[1, :].min(), warped_prob_smooth[1, :].min())
  
imports: import unittest
  from typing import List, Union
  from parameterized import parameterized
  from transformers import is_torch_available
  from transformers.testing_utils import require_torch, torch_device
  from ..test_modeling_common import ids_tensor
label_desc: Use image node_id 4 for calling the LogitsProcessorTest obj's underlying member method code with example usage: obj.test_temperature_dist_warper() without return types