class_docstr: Compute both Dice loss and Cross Entropy Loss, and return the weighted sum of these two losses.
  The details of Dice loss is shown in ``monai.losses.DiceLoss``.
  The details of Cross Entropy Loss is shown in ``torch.nn.CrossEntropyLoss`` and ``torch.nn.BCEWithLogitsLoss()``.
  In this implementation, two deprecated parameters ``size_average`` and ``reduce``, and the parameter ``ignore_index`` are
  not supported.
class_docstr_tok: ["Compute","both","Dice","loss","and","Cross","Entropy","Loss",",","and","return","the","weighted","sum","of","these","two","losses",".","The","details","of","Dice","loss","is","shown","in","``","monai.losses.DiceLoss","``",".","The","details","of","Cross","Entropy","Loss","is","shown","in","``","torch.nn.CrossEntropyLoss","``","and","``","torch.nn.BCEWithLogitsLoss","(",")","``",".","In","this","implementation",",","two","deprecated","parameters","``","size_average","``","and","``","reduce","``",",","and","the","parameter","``","ignore_index","``","are","not","supported","."]
docstr: Args:
      input: the shape should be BNH[WD].
      target: the shape should be BNH[WD] or B1H[WD].
  
  Raises:
      ValueError: When number of dimensions for input and target are different.
      ValueError: When number of channels for target is neither 1 nor the same as input.
docstr_tok: ["Args",":","input",":","the","shape","should","be","BNH","[","WD","]",".","target",":","the","shape","should","be","BNH","[","WD","]","or","B1H","[","WD","]",".","Raises",":","ValueError",":","When","number","of","dimensions","for","input","and","target","are","different",".","ValueError",":","When","number","of","channels","for","target","is","neither","1","nor","the","same","as","input","."]
code: def forward(
      self, input: torch.Tensor, target: torch.Tensor
  ) -> torch.Tensor:
      """
      Args:
          input: the shape should be BNH[WD].
          target: the shape should be BNH[WD] or B1H[WD].
  
      Raises:
          ValueError: When number of dimensions for input and target are different.
          ValueError: When number of channels for target is neither 1 nor the same as input.
  
      """
      if len(input.shape) != len(target.shape):
          raise ValueError(
              "the number of dimensions for input and target should be the same, "
              f"got shape {input.shape} and {target.shape}."
          )
  
      dice_loss = self.dice(input, target)
      ce_loss = (
          self.ce(input, target)
          if input.shape[1] != 1
          else self.bce(input, target)
      )
      total_loss: torch.Tensor = (
          self.lambda_dice * dice_loss + self.lambda_ce * ce_loss
      )
  
      return total_loss
  
imports: from __future__ import annotations
  import warnings
  from collections.abc import Callable, Sequence
  from typing import Any
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn.modules.loss import _Loss
  from monai.losses.focal_loss import FocalLoss
  from monai.losses.spatial_mask import MaskedLoss
  from monai.networks import one_hot
  from monai.utils import DiceCEReduction, LossReduction, Weight, deprecated_arg, look_up_option, pytorch_after
label_desc: Use image node_id 4 for calling the DiceCELoss obj's underlying member method code with example usage: obj.forward(input, target) and returns: total_loss