code: def _predict_batch(
      model: nn.Module,
      batch: Sequence[torch.Tensor],
      records: Sequence[BaseRecord],
      keep_images: bool = False,
      device: Optional[torch.device] = None,
  ) -> List[Prediction]:
      if device and (
          batch["img"][0].device.type != device.type
          or model_device(model).type != device.type
      ):
          _, batch = _move_to_device(None, batch, device.type)
      elif batch["img"][0].device.type != model_device(model).type:
          _, batch = _move_to_device(
              None, batch, model_device(model).type
          )
  
      # Making sure the model is in eval mode
      model.eval()
  
      raw_preds = model(**batch, return_loss=False)
      preds = convert_raw_predictions(
          batch=batch,
          raw_preds=raw_preds,
          records=records,
          keep_images=keep_images,
      )
  
      return preds
  
file_path: icevision/icevision/models/mmseg/common/prediction.py
imports: from icevision.imports import *
  from icevision.utils import *
  from icevision.core import *
  from icevision.data import *
  from icevision.models.utils import _predict_from_dl
  from icevision.models.mmseg.common.utils import *
  from icevision.models.mmseg.common.dataloaders import *
  from icevision.models.interpretation import _move_to_device
  import itertools
label_desc: Use image node_id 1 for calling a global function with example usage: _predict_batch(model, batch, records, keep_images, device) and returns: preds