def torchmetrics(self, x, y, prefix):
        """Update torchmetrics with new data.

        Prefix corresponds to a particular dataloader (e.g. train, val, test).

        Generally call this every batch.
        """
        if prefix not in self._tracked_torchmetrics:
            self._init_torchmetrics(prefix)

        for name in self.torchmetric_names:
            if name.startswith('Accuracy'):
                if len(x.shape) > 2:
                    # Multi-dimensional, multi-class
                    self._tracked_torchmetrics[prefix][name].update(x.transpose(1, 2), y.squeeze())
                    continue
            self._tracked_torchmetrics[prefix][name].update(x, y)
Update torchmetrics with new data.

        Prefix corresponds to a particular dataloader (e.g. train, val, test).

        Generally call this every batch.
        
analyze/convnexts4nd/src/tasks/tasks.py