
    &Vf                        d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d d lm"Z" d d!lm#Z# d d"lm$Z$ d d#lm%Z% d d$lm&Z& d d%lm'Z' d d&lm(Z( d d'lm)Z) d d(lm*Z* d d)lm+Z+ d d*lm,Z, d d+lm-Z- d d,l.m/Z/ h eeeeeeee	eeeeeeeeeee
eee$e*eeeee+e(e&e'e)ee%e#e"e,ee!e-Z0d- e0D             Z1e12                    eee$e$e&e&e(e(e'e'e)e)d.            ed/          d0             Z3 ed1          d5d2            Z4 ed3          d4             Z5dS )6    N)keras_export)Loss)BinaryCrossentropy)BinaryFocalCrossentropy)CategoricalCrossentropy)CategoricalFocalCrossentropy)CategoricalHinge)CosineSimilarity)Dice)Hinge)Huber)KLDivergence)LogCosh)LossFunctionWrapper)MeanAbsoluteError)MeanAbsolutePercentageError)MeanSquaredError)MeanSquaredLogarithmicError)Poisson)SparseCategoricalCrossentropy)SquaredHinge)Tversky)binary_crossentropy)binary_focal_crossentropy)categorical_crossentropy)categorical_focal_crossentropy)categorical_hinge)cosine_similarity)ctc)dice)hinge)huber)kl_divergence)log_cosh)mean_absolute_error)mean_absolute_percentage_error)mean_squared_error)mean_squared_logarithmic_error)poisson)sparse_categorical_crossentropy)squared_hinge)tversky)serialization_libc                     i | ]
}|j         |S  )__name__).0clss     V/var/www/html/software/conda/lib/python3.11/site-packages/keras/src/losses/__init__.py
<dictcomp>r4   c   s    ===#CL#===    )bceBCEkldKLDmaeMAEmseMSEmapeMAPEmsleMSLEzkeras.losses.serializec                 *    t          j        |           S )zSerializes loss function or `Loss` instance.

    Args:
        loss: A Keras `Loss` instance or a loss function.

    Returns:
        Loss configuration dictionary.
    )r-   serialize_keras_object)losss    r3   	serializerE   v   s     3D999r5   zkeras.losses.deserializec                 :    t          j        | t          |          S )aZ  Deserializes a serialized loss class/function instance.

    Args:
        name: Loss configuration.
        custom_objects: Optional dictionary mapping names (strings) to custom
            objects (classes and functions) to be considered during
            deserialization.

    Returns:
        A Keras `Loss` instance or a loss function.
    )module_objectscustom_objects)r-   deserialize_keras_objectALL_OBJECTS_DICT)namerH   s     r3   deserializerL      s'     5'%   r5   zkeras.losses.getc                 <   | dS t          | t                    rt          |           }n3t          | t                    rt                              | d          }n| }t          |          r t          j        |          r
 |            }|S t          d|            )a  Retrieves a Keras loss as a `function`/`Loss` class instance.

    The `identifier` may be the string name of a loss function or `Loss` class.

    >>> loss = losses.get("categorical_crossentropy")
    >>> type(loss)
    <class 'function'>
    >>> loss = losses.get("CategoricalCrossentropy")
    >>> type(loss)
    <class '...CategoricalCrossentropy'>

    You can also specify `config` of the loss to this function by passing dict
    containing `class_name` and `config` as an identifier. Also note that the
    `class_name` must map to a `Loss` class

    >>> identifier = {"class_name": "CategoricalCrossentropy",
    ...               "config": {"from_logits": True}}
    >>> loss = losses.get(identifier)
    >>> type(loss)
    <class '...CategoricalCrossentropy'>

    Args:
        identifier: A loss identifier. One of None or string name of a loss
            function/class or loss configuration dictionary or a loss function
            or a loss class instance.

    Returns:
        A Keras loss as a `function`/ `Loss` class instance.
    Nz%Could not interpret loss identifier: )

isinstancedictrL   strrJ   getcallableinspectisclass
ValueError)
identifierobjs     r3   rQ   rQ      s    > t*d## *%%	J	$	$ "":t44}} O?3 	#%%C
MMMNNNr5   )N)6rS   keras.src.api_exportr   keras.src.losses.lossr   keras.src.losses.lossesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   keras.src.savingr-   ALL_OBJECTSrJ   updaterE   rL   rQ   r/   r5   r3   <module>r^      s    - - - - - - & & & & & & 6 6 6 6 6 6 ; ; ; ; ; ; ; ; ; ; ; ; @ @ @ @ @ @ 4 4 4 4 4 4 4 4 4 4 4 4 ( ( ( ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) 0 0 0 0 0 0 + + + + + + 7 7 7 7 7 7 5 5 5 5 5 5 ? ? ? ? ? ? 4 4 4 4 4 4 ? ? ? ? ? ? + + + + + + A A A A A A 0 0 0 0 0 0 + + + + + + 7 7 7 7 7 7 = = = = = = < < < < < < B B B B B B 5 5 5 5 5 5 5 5 5 5 5 5 ' ' ' ' ' ' ( ( ( ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) 1 1 1 1 1 1 , , , , , , 7 7 7 7 7 7 B B B B B B 6 6 6 6 6 6 B B B B B B + + + + + + C C C C C C 1 1 1 1 1 1 + + + + + + . . . . . .22 2
 2 2 2 2 2 !2 "2 2 2  2   !2" #2$ %2& 
'2* 
+2, -2. /22 	324 528 92: ;2< =2> ?2@ A2B #C2D $E2H I2J K2L #M2N #O2P Q2R S2T 
U2X 
Y2Z [2\ ]2` 	a2b c2h >====    """"!!....   $ &''	: 	: ('	: ())   *)&  !!,O ,O "!,O ,O ,Or5   