def check_equal_objects(self, obj: Any):
        """
        Checks if the given object is the same across all processes.

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

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

        output: List[Any] = [None for _ in range(self.world_size)]
        torch.distributed.all_gather_object(output, obj)

        obj_bt = _base_typed(obj)

        for i, o in enumerate(output):
            o_bt = _base_typed(o)
            if obj_bt != o_bt:
                raise ValueError(
                    "Different objects (ranks this={}, remote={}). "
                    "Got this={}, remote={}".format(self.rank, i, obj, o)
                )

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

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

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