docstr: model（nn.Layer): A sementic segmentation model.
docstr_tok: ["model\uff08nn.Layer",")",":","A","sementic","segmentation","model","."]
code: def __init__(self, model, cfg):
      """model（nn.Layer): A sementic segmentation model."""
      self.cfg = cfg
      self.ema_decay = cfg["ema_decay"]
      self.edgeconstrain = cfg["edgeconstrain"]
      self.edgepullin = cfg["edgepullin"]
      self.src_only = cfg["src_only"]
      self.featurepullin = cfg["featurepullin"]
  
      self.model = model
      self.ema = EMA(self.model, self.ema_decay)
      self.celoss = losses.CrossEntropyLoss()
      self.klloss = losses.KLLoss()
      self.mseloss = losses.MSELoss()
      self.bceloss_src = losses.BCELoss(weight="dynamic")
      self.bceloss_tgt = losses.BCELoss(weight="dynamic")
      self.src_centers = [paddle.zeros((1, 19)) for _ in range(19)]
      self.tgt_centers = [paddle.zeros((1, 19)) for _ in range(19)]
  
      if "None" in cfg["resume_ema"]:
          self.resume_ema = None
      else:
          self.resume_ema = cfg["resume_ema"]
  
file_path: PaddleSeg/contrib/DomainAdaptation/script/train.py
imports: import os
  import time
  import numpy
  import shutil
  import functools
  from collections import deque
  import paddle
  import paddle.nn.functional
  import paddleseg.transforms.functional
  from paddleseg.utils import TimeAverager, calculate_eta, resume, logger, worker_init_fn
  from paddleseg.models import losses
  from models import EMA
  from script import val
  from utils import augmentation, load_ema_model, save_edge
label_desc: Use image node_id 1 to create a new Trainer object  with example: obj = Trainer(model, cfg)