code: def forward_train(self, inputs, **kwargs):
      if isinstance(inputs, dict):
          iter_id = inputs["iter_id"]
      elif isinstance(inputs, list):
          iter_id = inputs[-1]
      if iter_id == self.ema_start_iters:
          self.update_ema_model(momentum=0)
      elif iter_id > self.ema_start_iters:
          self.update_ema_model(momentum=self.momentum)
      if iter_id > self.ema_start_iters:
          data_sup_w, data_sup_s, data_unsup_w, data_unsup_s, _ = inputs
  
          if data_sup_w["image"].shape != data_sup_s["image"].shape:
              data_sup_w, data_sup_s = align_weak_strong_shape(
                  data_sup_w, data_sup_s
              )
  
          if "gt_bbox" in data_unsup_s.keys():
              del data_unsup_s["gt_bbox"]
          if "gt_class" in data_unsup_s.keys():
              del data_unsup_s["gt_class"]
          if "gt_class" in data_unsup_w.keys():
              del data_unsup_w["gt_class"]
          if "gt_bbox" in data_unsup_w.keys():
              del data_unsup_w["gt_bbox"]
          for k, v in data_sup_s.items():
              if k in ["epoch_id"]:
                  continue
              elif k in ["gt_class", "gt_bbox", "is_crowd"]:
                  data_sup_s[k].extend(data_sup_w[k])
              else:
                  data_sup_s[k] = paddle.concat([v, data_sup_w[k]])
  
          loss = {}
          body_feats = self.student.backbone(data_sup_s)
          if self.student.neck is not None:
              body_feats = self.student.neck(body_feats)
          out_transformer = self.student.transformer(
              body_feats, None, data_sup_s
          )
          sup_loss = self.student.detr_head(
              out_transformer, body_feats, data_sup_s
          )
          sup_loss.update(
              {
                  "loss": paddle.add_n(
                      [v for k, v in sup_loss.items() if "log" not in k]
                  )
              }
          )
          sup_loss = {"sup_" + k: v for k, v in sup_loss.items()}
  
          loss.update(**sup_loss)
          unsup_loss = self.foward_unsup_train(
              data_unsup_w, data_unsup_s
          )
          unsup_loss.update(
              {
                  "loss": paddle.add_n(
                      [
                          v
                          for k, v in unsup_loss.items()
                          if "log" not in k
                      ]
                  )
              }
          )
          unsup_loss = {"unsup_" + k: v for k, v in unsup_loss.items()}
          unsup_loss.update(
              {
                  "loss": paddle.add_n(
                      [
                          v
                          for k, v in unsup_loss.items()
                          if "log" not in k
                      ]
                  )
              }
          )
          loss.update(**unsup_loss)
          loss.update({"loss": loss["sup_loss"] + loss["unsup_loss"]})
      else:
          if iter_id == self.ema_start_iters:
              logger.info("start semi_supervised_traing")
          data_sup_w, data_sup_s, data_unsup_w, data_unsup_s, _ = inputs
  
          if data_sup_w["image"].shape != data_sup_s["image"].shape:
              data_sup_w, data_sup_s = align_weak_strong_shape(
                  data_sup_w, data_sup_s
              )
          for k, v in data_sup_s.items():
              if k in ["epoch_id"]:
                  continue
              elif k in ["gt_class", "gt_bbox", "is_crowd"]:
                  data_sup_s[k].extend(data_sup_w[k])
              else:
                  data_sup_s[k] = paddle.concat([v, data_sup_w[k]])
          loss = {}
          sup_loss = self.student(data_sup_s)
          unsup_loss = {
              "unsup_" + k: v * paddle.to_tensor(0)
              for k, v in sup_loss.items()
          }
          sup_loss = {"sup_" + k: v for k, v in sup_loss.items()}
          loss.update(**sup_loss)
          unsup_loss.update(
              {
                  "loss": paddle.add_n(
                      [
                          v * 0
                          for k, v in sup_loss.items()
                          if "log" not in k
                      ]
                  )
              }
          )
          unsup_loss = {
              "unsup_" + k: v * 0 for k, v in unsup_loss.items()
          }
          loss.update(**unsup_loss)
          loss.update({"loss": loss["sup_loss"]})
      return loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from ppdet.core.workspace import register, create, merge_config
  import paddle
  import numpy
  import paddle
  import paddle.nn.functional
  from ppdet.core.workspace import register, create
  from ppdet.utils.logger import setup_logger
  from ppdet.modeling.ssod.utils import filter_invalid
  from .multi_stream_detector import MultiSteamDetector
label_desc: Use image node_id 3 for calling the DETR_SSOD obj's underlying member method code with example usage: obj.forward_train(inputs) and returns: loss