code: def build_train_batch(records):
      """Builds a batch in the format required by the model when training.
  
      # Arguments
          records: A `Sequence` of records.
  
      # Returns
          A tuple with two items. The first will be a tuple like `(images, targets)`,
          in the input format required by the model. The second will be a list
          of the input records.
  
      # Examples
  
      Use the result of this function to feed the model.
      ```python
      batch, records = build_train_batch(records)
      outs = model(*batch)
      ```
      """
      batch_images, batch_bboxes, batch_classes = zip(
          *(process_train_record(record) for record in records)
      )
  
      # convert to tensors
      batch_images = torch.stack(batch_images)
      batch_bboxes = [
          tensor(bboxes, dtype=torch.float32) for bboxes in batch_bboxes
      ]
      batch_classes = [
          tensor(classes, dtype=torch.float32)
          for classes in batch_classes
      ]
  
      # convert to EffDet interface
      targets = dict(bbox=batch_bboxes, cls=batch_classes)
  
      return (batch_images, targets), records
  
file_path: icevision/icevision/models/ross/efficientdet/dataloaders.py
imports: from icevision.imports import *
  from icevision.models.utils import *
label_desc: Use image node_id 4 for calling a global function with example usage: build_train_batch(records) and returns: batch_images,  targets,  records