# Path: tensorflow_model_remediation/min_diff/losses/mmd_loss.py
# class MMDLoss(base_loss.MinDiffLoss):
#   def __init__(self,
#                kernel="gaussian",
#                predictions_transform=None,
#                name: Optional[str] = None,
#                enable_summary_histogram: Optional[bool] = True):
#   def _preprocess(self,
#                   membership: types.TensorType,
#                   predictions: types.TensorType,
#                   sample_weight: Optional[types.TensorType] = None):
#   def _calculate_mean(self, predictions_kernel: types.TensorType,
#                       normed_weights: types.TensorType,
#                       pos_mask: types.TensorType, neg_mask):
#   def call(self,
#            membership: types.TensorType,
#            predictions: types.TensorType,
#            sample_weight: Optional[types.TensorType] = None):
#   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 mmd_loss as mmd_lib
from tensorflow_model_remediation.min_diff.losses.kernels import gaussian_kernel
from tensorflow_model_remediation.min_diff.losses.kernels import laplacian_kernel
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for MMDLoss class."""




class MMDLossTest(tf.test.TestCase):
  """Tests for MMD Loss."""

  def testName(self):
    # Default name.
    loss_fn = mmd_lib.MMDLoss()
    self.assertEqual(loss_fn.name, "mmd_loss")

    # Custom name.
    loss_fn = mmd_lib.MMDLoss(name="custom_loss")
    self.assertEqual(loss_fn.name, "custom_loss")

  def testEnableSummaryHistogram(self):

# Path: tensorflow_model_remediation/min_diff/losses/mmd_loss.py
# class MMDLoss(base_loss.MinDiffLoss):
#   def __init__(self,
#                kernel="gaussian",
#                predictions_transform=None,
#                name: Optional[str] = None,
#                enable_summary_histogram: Optional[bool] = True):
#   def _preprocess(self,
#                   membership: types.TensorType,
#                   predictions: types.TensorType,
#                   sample_weight: Optional[types.TensorType] = None):
#   def _calculate_mean(self, predictions_kernel: types.TensorType,
#                       normed_weights: types.TensorType,
#                       pos_mask: types.TensorType, neg_mask):
#   def call(self,
#            membership: types.TensorType,
#            predictions: types.TensorType,
#            sample_weight: Optional[types.TensorType] = None):
#   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/mmd_loss_test.py
import tensorflow as tf
from tensorflow_model_remediation.min_diff.losses import mmd_loss as mmd_lib
from tensorflow_model_remediation.min_diff.losses.kernels import gaussian_kernel
from tensorflow_model_remediation.min_diff.losses.kernels import laplacian_kernel

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for MMDLoss class."""




class MMDLossTest(tf.test.TestCase):
  """Tests for MMD Loss."""

  def testName(self):
    # Default name.
    loss_fn = mmd_lib.MMDLoss()
    self.assertEqual(loss_fn.name, "mmd_loss")

    # Custom name.
    loss_fn = mmd_lib.MMDLoss(name="custom_loss")
    self.assertEqual(loss_fn.name, "custom_loss")

  def testEnableSummaryHistogram(self):

    loss = mmd_lib.MMDLoss()