
    BVh)                     0    d Z  G d d      Z G d d      Zy)z1Types for specifying saving and loading behavior.c                   (    e Zd ZdZddZed        Zy)SaveSpecz;Class used to describe tensor slices that need to be saved.Nc                     || _         || _        || _        t        | j                         r||t	        d      || _        || _        y|j
                  | _        ||| _        y|j                  | _        y)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   s         a/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/training/saving/saveable_object.py__init__zSaveSpec.__init__   ss     DL DODI	&.12 	2 djdk<<dj		mm    c                 d    t        | j                        r| j                         S | j                  S )N)r   r   r   s    r   r   zSaveSpec.tensor3   s"    %dll34<<>EEr   )NN)__name__
__module____qualname____doc__r   propertyr    r   r   r   r      s     C$< F Fr   r   c                   ,    e Zd ZdZd Zed        Zd Zy)SaveableObjectz5Base class for saving and restoring saveable objects.c                 .    || _         || _        || _        y)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   s       r   r   zSaveableObject.__init__;   s     DGDJDIr   c                 4    | j                   d   j                  S )z The device for SaveSpec Tensors.    )r   r   r   s    r   r   zSaveableObject.deviceI   s     ::a=r   c                     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   restored_tensorsrestored_shapess      r   restorezSaveableObject.restoreN   s      2
33r   N)r   r   r   r   r   r   r   r$   r   r   r   r   r   8   s#    =    4r   r   N)r   r   r   r   r   r   <module>r%      s!    8#F #FL&4 &4r   