code: def _test_label_smoothing_function(self, dtype):
      # Set label smoothing configuration
      smoothing, padding_idx = 0.1, 0
      N, T, H = 128, 74, 32320
      iters = 10
      loss_func = label_smoothing.SoftmaxCrossEntropyLoss.apply
  
      for i in range(iters):
          logits, labels, half_to_float = self.gen_test_inputs(
              N, T, H, smoothing, padding_idx
          )
  
          # Run original softmax cross entropy with label smoothing
          logits.grad = None
          losses = label_smoothing_raw(
              logits, labels, padding_idx, smoothing
          )
          loss = losses.sum()
          loss.backward()
  
          ref_loss = loss.clone().detach()
          ref_grad = logits.grad.clone().detach()
  
          # Run optimized softmax cross entropy with label smoothing
          logits.grad = None
          losses = loss_func(
              logits, labels, smoothing, padding_idx, half_to_float
          )
          loss = losses.sum()
          loss.backward()
  
          val_loss = loss.clone().detach()
          val_grad = logits.grad.clone().detach()
  
          # Validate
          self.print_max_diff_elem(ref_grad, val_grad)
          torch.testing.assert_close(val_loss, ref_loss)
          torch.testing.assert_close(val_grad, ref_grad)
  
file_path: apex/apex/contrib/test/xentropy/test_label_smoothing.py
imports: import unittest
  import random
  import time
  import numpy
  import torch
label_desc: Use image node_id 4 for calling the LabelSmoothingTest obj's underlying member method code with example usage: obj._test_label_smoothing_function(dtype) without return types