# 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/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/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.kernels import base_kernel
from tensorflow_model_remediation.min_diff.losses.kernels import gaussian_kernel
from tensorflow_model_remediation.min_diff.losses.kernels import kernel_utils as utils
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.

"""Test kernel_utils module."""




class GetMinDiffKernelTest(tf.test.TestCase):

  def testAcceptsNone(self):
    kernel = utils._get_kernel(None)
    self.assertIsNone(kernel)

  def testForGaussianKernel(self):
    kernel = utils._get_kernel('gauss')
    self.assertIsInstance(kernel, gaussian_kernel.GaussianKernel)
    kernel = utils._get_kernel('GauSs')  # Strangely capitalized.
    self.assertIsInstance(kernel, gaussian_kernel.GaussianKernel)
    kernel = utils._get_kernel('gauss_kernel')

# 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/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/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/kernels/kernel_utils_test.py
import tensorflow as tf
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 kernel_utils as utils
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.

"""Test kernel_utils module."""




class GetMinDiffKernelTest(tf.test.TestCase):

  def testAcceptsNone(self):
    kernel = utils._get_kernel(None)
    self.assertIsNone(kernel)

  def testForGaussianKernel(self):
    kernel = utils._get_kernel('gauss')
    self.assertIsInstance(kernel, gaussian_kernel.GaussianKernel)
    kernel = utils._get_kernel('GauSs')  # Strangely capitalized.
    self.assertIsInstance(kernel, gaussian_kernel.GaussianKernel)
    kernel = utils._get_kernel('gauss_kernel')

    self.assertIsInstance(kernel, gaussian_kernel.GaussianKernel)