def _reset_torchmetrics(self, prefix=None):
        """Reset torchmetrics for a prefix associated with a particular dataloader (e.g. train, val, test).

        Generally do this at the start of an epoch.
        """
        all_prefixes = [prefix] if prefix is not None else self._tracked_torchmetrics
        for prefix in all_prefixes:
            for name in self.torchmetric_names:
                try:
                    self._tracked_torchmetrics[prefix][name].reset()
                except KeyError:  # metrics don't exist yet
                    pass
Reset torchmetrics for a prefix associated with a particular dataloader (e.g. train, val, test).

        Generally do this at the start of an epoch.
        
analyze/convnexts4nd/src/tasks/tasks.py