Exemple #1
0
def _detail_additive_shared_tensor(
        worker: AbstractWorker, tensor_tuple: tuple) -> AdditiveSharingTensor:
    """
        This function reconstructs a AdditiveSharingTensor given it's attributes in form of a tuple.
        Args:
            worker: the worker doing the deserialization
            tensor_tuple: a tuple holding the attributes of the AdditiveSharingTensor
        Returns:
            AdditiveSharingTensor: a AdditiveSharingTensor
        Examples:
            shared_tensor = _detail_additive_shared_tensor(data)
        """

    tensor_id, field, crypto_provider, chain = tensor_tuple

    tensor = AdditiveSharingTensor(
        owner=worker,
        id=tensor_id,
        field=field,
        crypto_provider=worker.get_worker(crypto_provider))

    if chain is not None:
        chain = _detail(worker, chain)
        tensor.child = chain

    return tensor
Exemple #2
0
def _detail_worker(worker: AbstractWorker, worker_tuple: tuple) -> PointerTensor:
    """
    This function reconstructs a PlanPointer given it's attributes in form of a tuple.

    Args:
        worker: the worker doing the deserialization
        plan_pointer_tuple: a tuple holding the attributes of the PlanPointer
    Returns:
        PointerTensor: a PointerTensor
    Examples:
        ptr = _detail_pointer_tensor(data)
    """
    worker_id = worker_tuple[0]

    referenced_worker = worker.get_worker(worker_id)

    return referenced_worker