
    0h-
                     B    d Z ddlZddlZddlmc mZ ddlmZ d Z	d Z
y)z5Saving utilities to support Python's Pickle protocol.    N)
saving_libc                    t        j                         }	 t        j                  j	                  |d      }t        |d      5 }|j                  |        ddd       t        j                  |d      }|t        j                  j                  j                  |       S # 1 sw Y   KxY w# t        $ r}|d}~ww xY w# t        j                  j                  j                  |       w xY w)zReconstruct a Model from the output of `serialize_model_as_bytecode`.

    Args:
        serialized_model: (bytes) return value from
          `serialize_model_as_bytecode`.

    Returns:
        TF-Keras Model instance.
    model.keraswbNF)	safe_mode)tempfilemkdtempospathjoinopenwriter   
load_modeltfiogfilermtree	Exception)serialized_modeltemp_dirfilepathfmodeles         Z/var/www/html/engine/venv/lib/python3.12/site-packages/tf_keras/src/saving/pickle_utils.pydeserialize_model_from_bytecoder      s     !H%77<<-8(D! 	&QGG$%	& %%h%@ 
8$	& 	&  
 	8$sA   ,B* BB* 3B= B'#B* *	B:3B55B::B= =+C(c                    t        j                         }	 t        j                  j	                  |d      }t        j                  | |       t        |d      5 }|j                         }ddd       t        j                  j                  j                  |       S # 1 sw Y   4xY w# t        $ r}|d}~ww xY w# t        j                  j                  j                  |       w xY w)zConvert a TF-Keras Model into a bytecode representation for pickling.

    Args:
        model: TF-Keras Model instance.

    Returns:
        Tuple that can be read by `deserialize_from_bytecode`.
    r   rbN)r   r	   r
   r   r   r   
save_modelr   readr   r   r   r   r   )r   r   r   r   datar   s         r   serialize_model_as_bytecoder"   7   s     !H
%77<<-8eX.(D! 	Q668D	
 
8$	 	 
 	8$sB   AB( B)B( 1B; B%!B( (	B81B33B88B; ;+C&)__doc__r
   r   tensorflow.compat.v2compatv2r   tf_keras.src.savingr   r   r"        r   <module>r*      s#    < 	  ! ! *%>%r)   