original_docstring: 
      This method trains FCN model for an epoch given FCN model model, optimizer optimizer,
      data_loader data_loader, device device, epoch epoch, and print frequency print_freq.
  
      :param model: FCN model
      :param optimizer: optimizer
      :param device: device to run training
      :param epoch: current epoch
      :param print_freq: frequency to print updates from logger
      :return:
      
docstring: This method trains FCN model for an epoch given FCN model model, optimizer optimizer,
  data_loader data_loader, device device, epoch epoch, and print frequency print_freq.
docstring_tokens: This method trains FCN model for an epoch given FCN model model optimizer optimizer data_loader data_loader device device epoch epoch and print frequency print_freq .
code: def train_one_epoch_fcn(model, optimizer, data_loader, device, epoch, print_freq):
      """
      This method trains FCN model for an epoch given FCN model model, optimizer optimizer,
      data_loader data_loader, device device, epoch epoch, and print frequency print_freq.
  
      :param model: FCN model
      :param optimizer: optimizer
      :param device: device to run training
      :param epoch: current epoch
      :param print_freq: frequency to print updates from logger
      :return:
      """
  
      model.train()
      metric_logger = utils.MetricLogger(delimiter="  ")
      metric_logger.add_meter('lr', utils.SmoothedValue(window_size=1, fmt='{value:.6f}'))
      header = 'Epoch: [{}]'.format(epoch)
  
      # Defines softmax cross-entropy loss
      CE_Loss = CrossEntropyLoss()
  
      for images, targets in metric_logger.log_every(data_loader, print_freq, header):
          images = torch.stack(list(images), dim=0).to(device)
          targets = torch.stack([t["masks"] for t in targets], dim=0).long().to(device)
  
          # Output is the responses before applying softmax activation
          output = model(images)['out']
  
          loss = CE_Loss(output, targets)
          loss_value = loss.item()
  
          if not math.isfinite(loss_value):
              print("Loss is {}, stopping training".format(loss_value))
              sys.exit(1)
  
          optimizer.zero_grad()
          loss.backward()
          optimizer.step()
  
          metric_logger.update(loss=loss_value)
          metric_logger.update(lr=optimizer.param_groups[0]["lr"])
code_tokens: def train_one_epoch_fcn ( model , optimizer , data_loader , device , epoch , print_freq ) : model . train ( ) metric_logger = utils . MetricLogger ( delimiter = "  " ) metric_logger . add_meter ( 'lr' , utils . SmoothedValue ( window_size = 1 , fmt = '{value:.6f}' ) ) header = 'Epoch: [{}]' . format ( epoch ) CE_Loss = CrossEntropyLoss ( ) for images , targets in metric_logger . log_every ( data_loader , print_freq , header ) : images = torch . stack ( list ( images ) , dim = 0 ) . to ( device ) targets = torch . stack ( [ t [ "masks" ] for t in targets ] , dim = 0 ) . long ( ) . to ( device ) output = model ( images ) [ 'out' ] loss = CE_Loss ( output , targets ) loss_value = loss . item ( ) if not math . isfinite ( loss_value ) : print ( "Loss is {}, stopping training" . format ( loss_value ) ) sys . exit ( 1 ) optimizer . zero_grad ( ) loss . backward ( ) optimizer . step ( ) metric_logger . update ( loss = loss_value ) metric_logger . update ( lr = optimizer . param_groups [ 0 ] [ "lr" ] )
short_docstring: This method trains FCN model for an epoch given FCN model model, optimizer optimizer,
  data_loader data_loader, device device, epoch epoch, and print frequency print_freq.
short_docstring_tokens: This method trains FCN model for an epoch given FCN model model optimizer optimizer data_loader data_loader device device epoch epoch and print frequency print_freq .
comment: """
      This method trains FCN model for an epoch given FCN model model, optimizer optimizer,
      data_loader data_loader, device device, epoch epoch, and print frequency print_freq.
  
      :param model: FCN model
      :param optimizer: optimizer
      :param device: device to run training
      :param epoch: current epoch
      :param print_freq: frequency to print updates from logger
      :return:
      """$SEP$# Defines softmax cross-entropy loss$SEP$# Output is the responses before applying softmax activation