# Path: tensorflow_model_remediation/min_diff/losses/base_loss.py
# class MinDiffLoss(tf.keras.losses.Loss, abc.ABC):
#   def __init__(self,
#                membership_transform=None,
#                predictions_transform=None,
#                membership_kernel=None,
#                predictions_kernel=None,
#                name: Optional[str] = None,
#                enable_summary_histogram: Optional[bool] = True):
#   def __call__(self,
#                membership: types.TensorType,
#                predictions: types.TensorType,
#                sample_weight: Optional[types.TensorType] = None):
#   def _preprocess_inputs(
#       self,
#       membership: types.TensorType,
#       predictions: types.TensorType,
#       sample_weight: Optional[types.TensorType] = None
#   ) -> Tuple[types.TensorType, types.TensorType, types.TensorType]:
#   def _apply_kernels(
#       self, membership: types.TensorType, predictions: types.TensorType
#   ) -> Tuple[types.TensorType, types.TensorType]:
#   def call(self,
#            membership: types.TensorType,
#            predictions: types.TensorType,
#            sample_weight: Optional[types.TensorType] = None):
#   def _serialize_config(self, config):
#     def _serialize_value(key, value):
#   def get_config(self):
#   def _deserialize_config(cls, config):
#     def _deserialize_value(key, value):
#   def from_config(cls, config):
# def _validate_transform(transform: types.TensorTransformType,
#                         var_name: str) -> None:
# def _to_snake_case(name):
# 
# Path: tensorflow_model_remediation/min_diff/losses/kernels/base_kernel.py
# class MinDiffKernel(abc.ABC):
#   def __init__(self, tile_input: bool = True):
#   def __call__(self,
#                x: types.TensorType,
#                y: Optional[types.TensorType] = None) -> types.TensorType:
#   def call(self, x: types.TensorType, y: types.TensorType):
#   def get_config(self):
#   def from_config(cls, config):
# 
# Path: tensorflow_model_remediation/min_diff/losses/kernels/gaussian_kernel.py
# class GaussianKernel(base_kernel.MinDiffKernel):
#   def __init__(self, kernel_length: complex = 0.1, **kwargs):
#   def call(self, x: types.TensorType, y: types.TensorType) -> types.TensorType:
#   def get_config(self):
# 
# Path: tensorflow_model_remediation/min_diff/losses/kernels/laplacian_kernel.py
# _EPSILON = 1.0e-8
# class LaplacianKernel(base_kernel.MinDiffKernel):
#   def __init__(self, kernel_length: complex = 0.1, **kwargs):
#   def call(self, x: types.TensorType, y: types.TensorType) -> types.TensorType:
#   def get_config(self):


import tensorflow as tf
from tensorflow_model_remediation.min_diff.losses import base_loss
from tensorflow_model_remediation.min_diff.losses.kernels import base_kernel
from tensorflow_model_remediation.min_diff.losses.kernels import gaussian_kernel
from tensorflow_model_remediation.min_diff.losses.kernels import laplacian_kernel
  def testAbstract(self):

    with self.assertRaisesRegex(TypeError,
                                'instantiate abstract class MinDiffLoss'):
      base_loss.MinDiffLoss()

    class CustomLoss1(base_loss.MinDiffLoss):
      pass

    with self.assertRaisesRegex(TypeError,
                                'instantiate abstract class CustomLoss1'):
      CustomLoss1()

    class CustomLoss2(base_loss.MinDiffLoss):

      def call(self):
        pass

    CustomLoss2()

  def testLossName(self):
    # Default name.
    loss = CustomLoss()
    self.assertEqual(loss.name, 'custom_loss')

    # Custom name.
    loss = CustomLoss(name='custom_name')
    self.assertEqual(loss.name, 'custom_name')

    # Private class

# Path: tensorflow_model_remediation/min_diff/losses/base_loss.py
# class MinDiffLoss(tf.keras.losses.Loss, abc.ABC):
#   def __init__(self,
#                membership_transform=None,
#                predictions_transform=None,
#                membership_kernel=None,
#                predictions_kernel=None,
#                name: Optional[str] = None,
#                enable_summary_histogram: Optional[bool] = True):
#   def __call__(self,
#                membership: types.TensorType,
#                predictions: types.TensorType,
#                sample_weight: Optional[types.TensorType] = None):
#   def _preprocess_inputs(
#       self,
#       membership: types.TensorType,
#       predictions: types.TensorType,
#       sample_weight: Optional[types.TensorType] = None
#   ) -> Tuple[types.TensorType, types.TensorType, types.TensorType]:
#   def _apply_kernels(
#       self, membership: types.TensorType, predictions: types.TensorType
#   ) -> Tuple[types.TensorType, types.TensorType]:
#   def call(self,
#            membership: types.TensorType,
#            predictions: types.TensorType,
#            sample_weight: Optional[types.TensorType] = None):
#   def _serialize_config(self, config):
#     def _serialize_value(key, value):
#   def get_config(self):
#   def _deserialize_config(cls, config):
#     def _deserialize_value(key, value):
#   def from_config(cls, config):
# def _validate_transform(transform: types.TensorTransformType,
#                         var_name: str) -> None:
# def _to_snake_case(name):
# 
# Path: tensorflow_model_remediation/min_diff/losses/kernels/base_kernel.py
# class MinDiffKernel(abc.ABC):
#   def __init__(self, tile_input: bool = True):
#   def __call__(self,
#                x: types.TensorType,
#                y: Optional[types.TensorType] = None) -> types.TensorType:
#   def call(self, x: types.TensorType, y: types.TensorType):
#   def get_config(self):
#   def from_config(cls, config):
# 
# Path: tensorflow_model_remediation/min_diff/losses/kernels/gaussian_kernel.py
# class GaussianKernel(base_kernel.MinDiffKernel):
#   def __init__(self, kernel_length: complex = 0.1, **kwargs):
#   def call(self, x: types.TensorType, y: types.TensorType) -> types.TensorType:
#   def get_config(self):
# 
# Path: tensorflow_model_remediation/min_diff/losses/kernels/laplacian_kernel.py
# _EPSILON = 1.0e-8
# class LaplacianKernel(base_kernel.MinDiffKernel):
#   def __init__(self, kernel_length: complex = 0.1, **kwargs):
#   def call(self, x: types.TensorType, y: types.TensorType) -> types.TensorType:
#   def get_config(self):


# Path: tensorflow_model_remediation/min_diff/losses/base_loss_test.py
import tensorflow as tf
from tensorflow_model_remediation.min_diff.losses import base_loss
from tensorflow_model_remediation.min_diff.losses.kernels import base_kernel
from tensorflow_model_remediation.min_diff.losses.kernels import gaussian_kernel
from tensorflow_model_remediation.min_diff.losses.kernels import laplacian_kernel

  def testAbstract(self):

    with self.assertRaisesRegex(TypeError,
                                'instantiate abstract class MinDiffLoss'):
      base_loss.MinDiffLoss()

    class CustomLoss1(base_loss.MinDiffLoss):
      pass

    with self.assertRaisesRegex(TypeError,
                                'instantiate abstract class CustomLoss1'):
      CustomLoss1()

    class CustomLoss2(base_loss.MinDiffLoss):

      def call(self):
        pass

    CustomLoss2()

  def testLossName(self):
    # Default name.
    loss = CustomLoss()
    self.assertEqual(loss.name, 'custom_loss')

    # Custom name.
    loss = CustomLoss(name='custom_name')
    self.assertEqual(loss.name, 'custom_name')

    # Private class

    class _CustomLoss(base_loss.MinDiffLoss):