code: def test_result_no_onehot_no_bg(self, size, onehot):
      label = torch.randint(low=0, high=size[1] - 1, size=size)
      if onehot:
          label = torch.argmax(label, dim=1, keepdim=True)
      pred = torch.randn(size)
      for reduction in ["sum", "mean", "none"]:
          for weight in (
              [2.0] + []
              if size[1] != 3
              else [torch.tensor([1.0, 2.0]), (2.0, 1)]
          ):
              for lambda_focal in [0.5, 1.0, 1.5]:
                  common_params = {
                      "include_background": False,
                      "softmax": True,
                      "to_onehot_y": onehot,
                      "reduction": reduction,
                      "weight": weight,
                  }
                  dice_focal = DiceFocalLoss(
                      lambda_focal=lambda_focal, **common_params
                  )
                  dice = DiceLoss(**common_params)
                  common_params.pop("softmax", None)
                  focal = FocalLoss(**common_params)
                  result = dice_focal(pred, label)
                  expected_val = dice(
                      pred, label
                  ) + lambda_focal * focal(pred, label)
                  np.testing.assert_allclose(result, expected_val)
  
file_path: MONAI/tests/test_dice_focal_loss.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.losses import DiceFocalLoss, DiceLoss, FocalLoss
  from tests.utils import test_script_save
label_desc: Use image node_id 2 for calling the TestDiceFocalLoss obj's underlying member method code with example usage: obj.test_result_no_onehot_no_bg(size, onehot) without return types