code: def forward(
      self,
      sequence_output: torch.Tensor,
      encoded_layers: Optional[List[torch.Tensor]] = None,
      processed_sample_list: Optional[
          Dict[str, Dict[str, torch.Tensor]]
      ] = None,
  ):
      output_dict_refiner = self.refiner_head(
          sequence_output, encoded_layers, processed_sample_list
      )
      output_dict = self.mlp_loss_head(
          sequence_output, encoded_layers, processed_sample_list
      )
      for key in output_dict_refiner["losses"].keys():
          if key not in output_dict["losses"].keys():
              output_dict["losses"][key] = output_dict_refiner[
                  "losses"
              ][key]
  
      for key in output_dict_refiner.keys():
          if key not in output_dict.keys():
              output_dict[key] = output_dict_refiner[key]
  
      scores = output_dict["scores"]
  
      score_max = min(len(scores) - 1, self.max_sample_size)
      if isinstance(self.msloss, MSLoss):
          emb_f = self.emb_f
          targets_list = {}
          targets_list["targets"] = processed_sample_list["target_key"][
              "targets"
          ][:score_max]
          subset_score_list = {}
          subset_score_list["scores"] = output_dict["scores"][
              :score_max
          ]
          subset_score_list[emb_f] = output_dict[emb_f][:score_max]
          output_dict["losses"][
              "ms_loss"
          ] = self.msloss_weight * self.msloss(
              targets_list, subset_score_list
          )
  
      return output_dict
  
file_path: mmf/mmf/models/transformers/heads/refnet_classifier.py
imports: import logging
  from dataclasses import dataclass
  from typing import Dict, List, Optional
  import torch
  import torch.nn
  from mmf.common.registry import registry
  from mmf.models.transformers.base import BaseTransformerHead
  from mmf.modules.losses import LogitBinaryCrossEntropy, MSLoss
  from .mlp import MLP
  from .refiner import Refiner
label_desc: Use image node_id 2 for calling the RefinerClassifier obj's underlying member method code with example usage: obj.forward(sequence_output, encoded_layers, processed_sample_list) and returns: output_dict