def pack_grad_hess(self, grad, hess):
        """Pack Grad and Hess into Plaintext
        Args:
            grad: list of grad value
            hess: list of hess value
            output: output ciphertext or encrypted number

        Returns:
            Plaintext of packed number
        """
        assert len(grad) == len(
            hess), 'the length of grad and hess list should be equal'
        grad_plaintext = [
            FixedPointNumber.encode(g, self._n, self.max_int, self.precision)
            for g in grad
        ]
        hess_plaintext = [
            FixedPointNumber.encode(h, self._n, self.max_int, self.precision)
            for h in hess
        ]
        grad_hess_encoding = [
            (g_text.encoding << self.offset) + h_text.encoding
            for g_text, h_text in zip(grad_plaintext, hess_plaintext)
        ]
        return grad_hess_encoding
Pack Grad and Hess into Plaintext
        Args:
            grad: list of grad value
            hess: list of hess value
            output: output ciphertext or encrypted number

        Returns:
            Plaintext of packed number
        
fedlearner/model/tree/packing.py