code: def test_result_onehot_target_include_bg(self):
      size = [3, 3, 5, 5]
      label = torch.randint(low=0, high=2, size=size)
      pred = torch.randn(size)
      for reduction in ["sum", "mean", "none"]:
          common_params = {
              "include_background": True,
              "to_onehot_y": False,
              "reduction": reduction,
          }
          for weight in [
              None,
              torch.tensor([1.0, 1.0, 2.0]),
              (3, 2.0, 1),
          ]:
              for lambda_focal in [0.5, 1.0, 1.5]:
                  generalized_dice_focal = GeneralizedDiceFocalLoss(
                      weight=weight,
                      gamma=1.0,
                      lambda_focal=lambda_focal,
                      **common_params,
                  )
                  generalized_dice = GeneralizedDiceLoss(
                      **common_params
                  )
                  focal = FocalLoss(
                      weight=weight, gamma=1.0, **common_params
                  )
                  result = generalized_dice_focal(pred, label)
                  expected_val = generalized_dice(
                      pred, label
                  ) + lambda_focal * focal(pred, label)
                  np.testing.assert_allclose(result, expected_val)
  
file_path: MONAI/tests/test_generalized_dice_focal_loss.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from monai.losses import FocalLoss, GeneralizedDiceFocalLoss, GeneralizedDiceLoss
  from tests.utils import test_script_save
label_desc: Use image node_id 1 for calling the TestGeneralizedDiceFocalLoss obj's underlying member method code with example usage: obj.test_result_onehot_target_include_bg() without return types