def handle_batch(self, batch):
        """Do a forward pass and compute loss.

        Args:
            batch (Dict[str, Any]): batch of data.
        """

        if self.is_train_loader:
            images = batch["image"]
            targets = torch.cat([batch["labels"].unsqueeze(-1), batch["bboxes"]], -1)
            loss = self.model(images, targets)
            self.batch_metrics["loss"] = loss
        else:
            predictions = self.model(batch["image"])
            self.batch["predicted_tensor"] = predictions
Do a forward pass and compute loss.

        Args:
            batch (Dict[str, Any]): batch of data.
        
examples/detection/custom_runner.py