def _prepare_for_distributed_comm(self, tensor: Tensor):
        """
        Internal utility used to move the tensor to the backend device.

        :param: The tensor to be send using torch.distributed API.
        :return: A tuple of 2 elements:
            1. The first element is the tensor moved to the correct device.
            2. The descriptor, as a tuple of 3 elements:
                1. The original device of the input tensor
                2. A boolean, describing if the tensor should be moved back
                    to the original device.
                3. The original tensor.
        """
        original_device = tensor.device
        copy_back = self.forced_cuda_comm and not tensor.is_cuda
        if self.forced_cuda_comm:
            tensor_distributed = tensor.cuda()
        else:
            tensor_distributed = tensor

        return tensor_distributed, (original_device, copy_back, tensor)

        Internal utility used to move the tensor to the backend device.

        :param: The tensor to be send using torch.distributed API.
        :return: A tuple of 2 elements:
            1. The first element is the tensor moved to the correct device.
            2. The descriptor, as a tuple of 3 elements:
                1. The original device of the input tensor
                2. A boolean, describing if the tensor should be moved back
                    to the original device.
                3. The original tensor.
        
avalanche/distributed/distributed_helper.py