# Path: tensorflow_model_remediation/common/docs.py
# def _no_op_decorator(obj):
# def _get_safe_decorator(decorator_name):
# 
# Path: tensorflow_model_remediation/common/types.py

# 
# Path: tensorflow_model_remediation/min_diff/losses/kernels/kernel_utils.py
# _STRING_TO_KERNEL_DICT = {}
# def _register_kernel_names(kernel_class, names):
# def _get_kernel(kernel: Union[base_kernel.MinDiffKernel, str],
#                 kernel_var_name: str = 'kernel'):


import abc
import re
import dill
import tensorflow as tf
from typing import Optional, Tuple
from tensorflow_model_remediation.common import docs
from tensorflow_model_remediation.common import types
from tensorflow_model_remediation.min_diff.losses.kernels import kernel_utils
    given subclass, the deserialization (or `from_config`) will need to be
    implemented directly.
    """

    def _deserialize_value(key, value):
      if key.endswith('transform'):
        return dill.loads(value)
      return value  # No transformation applied

    return {k: _deserialize_value(k, v) for k, v in config.items()}

  @classmethod
  @docs.do_not_doc_in_subclasses
  def from_config(cls, config):

    """Creates a `MinDiffLoss` instance from the config.

    Any subclass with additional attributes or a different initialization
    signature will need to override this method or `get_config`.

    Returns:
      A new `MinDiffLoss` instance corresponding to `config`.
    """
    config = cls._deserialize_config(config)
    return cls(**config)


#### Validation Functions ####



# Path: tensorflow_model_remediation/common/docs.py
# def _no_op_decorator(obj):
# def _get_safe_decorator(decorator_name):
# 
# Path: tensorflow_model_remediation/common/types.py

# 
# Path: tensorflow_model_remediation/min_diff/losses/kernels/kernel_utils.py
# _STRING_TO_KERNEL_DICT = {}
# def _register_kernel_names(kernel_class, names):
# def _get_kernel(kernel: Union[base_kernel.MinDiffKernel, str],
#                 kernel_var_name: str = 'kernel'):


# Path: tensorflow_model_remediation/min_diff/losses/base_loss.py
import abc
import re
import dill
import tensorflow as tf
from typing import Optional, Tuple
from tensorflow_model_remediation.common import docs
from tensorflow_model_remediation.common import types
from tensorflow_model_remediation.min_diff.losses.kernels import kernel_utils

    given subclass, the deserialization (or `from_config`) will need to be
    implemented directly.
    """

    def _deserialize_value(key, value):
      if key.endswith('transform'):
        return dill.loads(value)
      return value  # No transformation applied

    return {k: _deserialize_value(k, v) for k, v in config.items()}

  @classmethod
  @docs.do_not_doc_in_subclasses
  def from_config(cls, config):

    """Creates a `MinDiffLoss` instance from the config.

    Any subclass with additional attributes or a different initialization
    signature will need to override this method or `get_config`.

    Returns:
      A new `MinDiffLoss` instance corresponding to `config`.
    """
    config = cls._deserialize_config(config)
    return cls(**config)


#### Validation Functions ####



def _validate_transform(transform: types.TensorTransformType,