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

        Args:
            batch (Dict[str, Any]): batch of data.
        """
        locs, confs = self.model(batch["image"])

        regression_loss, classification_loss = self.criterion(
            locs, batch["bboxes"], confs, batch["labels"].long()
        )
        self.batch["predicted_bboxes"] = locs
        self.batch["predicted_scores"] = confs
        self.batch_metrics["loss"] = regression_loss + classification_loss
Do a forward pass and compute loss.

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