class_docstr: Test label smoothing.
docstr: Test if output is correct for the LCWA training loop use case.
docstr_tok: ["Test","if","output","is","correct","for","the","LCWA","training","loop","use","case","."]
code: def test_lcwa_label_smoothing(self):
      """Test if output is correct for the LCWA training loop use case."""
      # Create dummy dense labels
      labels = torch.zeros(self.batch_size, self.num_entities)
      for i in range(self.batch_size):
          labels[i, self.random.randint(self.num_entities)] = 1.0
      # Check if labels form a probability distribution
      np.testing.assert_allclose(torch.sum(labels, dim=1).numpy(), 1.0)
  
      # Apply label smoothing
      smooth_labels = apply_label_smoothing(
          labels=labels,
          epsilon=self.epsilon,
          num_classes=self.num_entities,
      )
      # Check if smooth labels form probability distribution
      np.testing.assert_allclose(
          torch.sum(smooth_labels, dim=1).numpy(),
          1.0,
          rtol=self.relative_tolerance,
      )
  
imports: import unittest
  import numpy
  import torch
  import unittest_templates
  import pykeen.losses
  from pykeen.losses import Loss, NSSALoss, apply_label_smoothing
  from pykeen.pipeline import PipelineResult, pipeline
  from tests import cases
label_desc: Use image node_id 2 for calling the LabelSmoothingTest obj's underlying member method code with example usage: obj.test_lcwa_label_smoothing() without return types