code: def __init__(self, multitask_tasks, rdrop_alpha=0.0):
      self.rdrop_alpha = rdrop_alpha
      self.rdrop_alpha_mtl = rdrop_alpha
  
      self.multitask_criterion = OrderedDict()
      self.multitask_loss_weight = OrderedDict()
      for task_name, task_obj in multitask_tasks.items():
          if task_obj.args.get_loss_weight(0) == 0:
              logger.info(f"Skip {task_name} loss criterion")
              continue
  
          rdrop_alpha_task = task_obj.args.rdrop_alpha
          if rdrop_alpha_task is None:
              rdrop_alpha_task = rdrop_alpha
          self.rdrop_alpha_mtl = rdrop_alpha_task
          logger.info(
              f"rdrop_alpha is set to {rdrop_alpha_task} for {task_name}"
          )
  
          if task_obj.args.decoder_type == "ctc":
              self.multitask_criterion[task_name] = CtcCriterion(
                  task_obj.args.criterion_cfg,
                  task_obj,
                  rdrop_alpha=rdrop_alpha_task,
              )
          else:
              self.multitask_criterion[
                  task_name
              ] = RdropLabelSmoothedCrossEntropyCriterion(
                  task_obj,
                  task_obj.args.criterion_cfg.sentence_avg,
                  label_smoothing=task_obj.args.criterion_cfg.label_smoothing,
                  rdrop_alpha=rdrop_alpha_task,
              )
  
imports: import logging
  import math
  from collections import OrderedDict
  import torch
  from fairseq import utils
  from fairseq.logging import metrics
  from fairseq.criterions import register_criterion
  from fairseq.criterions.ctc import CtcCriterion
  from fairseq.criterions.label_smoothed_cross_entropy_with_rdrop import RdropLabelSmoothedCrossEntropyCriterion, RdropLabelSmoothedCrossEntropyCriterionConfig, duplicate_input
  from fairseq.criterions.tacotron2_loss import Tacotron2Criterion, Tacotron2CriterionConfig
label_desc: Use image node_id 1 to create a new MultitaskCriterion object  with example: obj = MultitaskCriterion(multitask_tasks, rdrop_alpha)