コード例 #1
0
ファイル: protocol.py プロジェクト: suhelsayyad2006/PySyft
 def create_pointer(self, owner, garbage_collect_data):
     return PointerProtocol(
         location=self.owner,
         id_at_location=self.id,
         owner=owner,
         garbage_collect_data=garbage_collect_data,
     )
コード例 #2
0
def test_create_pointer_to_plan(workers):
    """
   This test validates the following scenario:
   A creates a protocol
   A deploys it on workers D, E and F
   A sends the protocol to the cloud C
   B creates a pointer to it on C
   B runs remotely the protocol
   """
    alice, bob, charlie, james = (
        workers["alice"],
        workers["bob"],
        workers["charlie"],
        workers["james"],
    )

    protocol = _create_inc_protocol()

    protocol.deploy(alice, bob, charlie)

    protocol.send(james)

    id_at_location = protocol.id
    protocol_ptr = PointerProtocol(location=james,
                                   id_at_location=id_at_location)

    x = th.tensor([1.0]).send(james)

    ptr = protocol_ptr.run(x)

    assert isinstance(ptr, FrameworkTensor) and ptr.is_wrapper
    ptr = ptr.get()
    assert (isinstance(ptr, FrameworkTensor) and ptr.is_wrapper
            and isinstance(ptr.child, PointerTensor))

    assert (ptr.get() == th.tensor([4.0])).all()
コード例 #3
0
ファイル: protocol.py プロジェクト: nggih/PySyft
    def create_pointer(self, owner: AbstractWorker,
                       garbage_collect_data: bool) -> PointerProtocol:
        """
        Create a pointer to the protocol

        Args:
            owner: the owner of the pointer
            garbage_collect_data: bool

        Returns:
            PointerProtocol: pointer to the protocol
        """
        return PointerProtocol(
            location=self.owner,
            id_at_location=self.id,
            owner=owner,
            garbage_collect_data=garbage_collect_data,
        )
コード例 #4
0
ファイル: protocol.py プロジェクト: xiaozhimabing/PySyft
    def create_pointer(self,
                       owner: AbstractWorker,
                       garbage_collect_data: bool,
                       tags: Set = None) -> PointerProtocol:
        """
        Create a pointer to the protocol

        Args:
            owner: the owner of the pointer
            garbage_collect_data: bool
            tags: the tags inherited from the Protocol

        Returns:
            PointerProtocol: pointer to the protocol
        """
        return PointerProtocol(
            location=self.owner,
            id_at_location=self.id,
            owner=owner,
            garbage_collect_data=garbage_collect_data,
            tags=tags,
        )