def check_equal_tensors(self, tensor: Tensor):
        """
        Checks if the given tensor is the same across all processes.

        This method will raise an error the tensors are not equal.

        :param tensor: The tensor to be compared.
        """
        if not DistributedHelper.is_distributed:
            return

        all_tensors = self.gather_all(tensor)

        tensors_hashes = [hash_tensor(t) for t in all_tensors]

        if len(set(tensors_hashes)) != 1:
            # Equal tensors
            raise ValueError("Different tensors. Got hashes: {}".format(tensors_hashes))

        Checks if the given tensor is the same across all processes.

        This method will raise an error the tensors are not equal.

        :param tensor: The tensor to be compared.
        
avalanche/distributed/distributed_helper.py