def increment(self):
        """
        Atomically increment the counter by 1 and return the
        previous value.
        """
        with self._lock:
            prev_value = self.value
            self.value += 1
            return prev_value

        Atomically increment the counter by 1 and return the
        previous value.
        
avalanche/benchmarks/utils/ffcv_support/ffcv_epoch_iterator.py