o
    ®Ÿ?e)  ã                   @   s$   d Z G dd„ dƒZG dd„ dƒZdS )z1Types for specifying saving and loading behavior.c                   @   s&   e Zd ZdZddd„Zedd„ ƒZdS )ÚSaveSpecz;Class used to describe tensor slices that need to be saved.Nc                 C   sj   || _ || _|| _t| j ƒr"|du s|du rtdƒ‚|| _|| _dS |j| _|dur/|| _dS |j| _dS )a;  Creates a `SaveSpec` object.

    Args:
      tensor: the tensor to save or callable that produces a tensor to save.
        If the value is `None`, the `SaveSpec` is ignored.
      slice_spec: the slice to be saved. See `Variable.SaveSliceInfo`.
      name: the name to save the tensor under.
      dtype: The data type of the Tensor. Required if `tensor` is callable.
        Used for error checking in the restore op.
      device: The device generating and consuming this tensor. Required if
        `tensor` is callable. Used to group objects to save by device.
    Nz^When passing a callable `tensor` to a SaveSpec, an explicit dtype and device must be provided.)Ú_tensorÚ
slice_specÚnameÚcallableÚAssertionErrorÚdtypeÚdevice)ÚselfÚtensorr   r   r   r   © r   úr/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/python/training/saving/saveable_object.pyÚ__init__   s   
ÿ

zSaveSpec.__init__c                 C   s   t | jƒr	|  ¡ S | jS )N)r   r   ©r	   r   r   r   r
   3   s   zSaveSpec.tensor)NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr
   r   r   r   r   r      s
    
r   c                   @   s,   e Zd ZdZdd„ Zedd„ ƒZdd„ ZdS )	ÚSaveableObjectz5Base class for saving and restoring saveable objects.c                 C   s   || _ || _|| _dS )a”  Creates a `SaveableObject` object.

    Args:
      op: the "producer" object that this class wraps; it produces a list of
        tensors to save.  E.g., a "Variable" object saving its backing tensor.
      specs: a list of SaveSpec, each element of which describes one tensor to
        save under this object. All Tensors must be on the same device.
      name: the name to save the object under.
    N)ÚopÚspecsr   )r	   r   r   r   r   r   r   r   ;   s   

zSaveableObject.__init__c                 C   s   | j d jS )z The device for SaveSpec Tensors.é    )r   r   r   r   r   r   r   I   s   zSaveableObject.devicec                 C   s   t dƒ‚)a“  Restores this object from 'restored_tensors'.

    Args:
      restored_tensors: the tensors that were loaded from a checkpoint
      restored_shapes: the shapes this object should conform to after
        restore, or None.

    Returns:
      An operation that restores the state of the object.

    Raises:
      ValueError: If the object cannot be restored using the provided
        parameters.
    zCalling an abstract method.)Ú
ValueError)r	   Zrestored_tensorsZrestored_shapesr   r   r   ÚrestoreN   s   zSaveableObject.restoreN)r   r   r   r   r   r   r   r   r   r   r   r   r   8   s    
r   N)r   r   r   r   r   r   r   Ú<module>   s   &