Esempio n. 1
0
    def create_pointer(
        self,
        location: BaseWorker = None,
        id_at_location: (str or int) = None,
        register: bool = False,
        owner: BaseWorker = None,
        ptr_id: (str or int) = None,
        garbage_collect_data: bool = True,
    ) -> ObjectPointer:
        """Creates a pointer to the "self" tf.keras.layers.Layer object.

        Returns:
            A ObjectPointer pointer to self. Note that this
            object will likely be wrapped by a tf.keras.layers.Layer wrapper.
        """
        if id_at_location is None:
            id_at_location = self.id

        if ptr_id is None:
            if location is not None and location.id != self.owner.id:
                ptr_id = self.id
            else:
                ptr_id = syft.ID_PROVIDER.pop()

        ptr = ObjectPointer.create_pointer(
            self,
            location,
            id_at_location,
            register,
            owner,
            ptr_id,
            garbage_collect_data,
        )

        return ptr
Esempio n. 2
0
    def create_pointer(
        self,
        location: BaseWorker = None,
        id_at_location: (str or int) = None,
        register: bool = False,
        owner: BaseWorker = None,
        ptr_id: (str or int) = None,
        garbage_collect_data: bool = True,
        **kwargs,
    ) -> ObjectPointer:
        """Creates a pointer to the "self" OnnxModel object.

        Returns:
            An ObjectPointer pointer to self.
        """

        if id_at_location is None:
            id_at_location = self.id

        if ptr_id is None:
            if location is not None and location.id != self.owner.id:
                ptr_id = self.id
            else:
                ptr_id = syft.ID_PROVIDER.pop()

        ptr = ObjectPointer.create_pointer(self, location, id_at_location,
                                           register, owner, ptr_id,
                                           garbage_collect_data, **kwargs)

        return ptr