# Path: veidt/kernel.py
# def rbf(x1, x2, sigma):
#     d_squared = np.sum((x1[:, None, :] - x2[None, :, :]) ** 2, axis=2)
#     return np.exp(-d_squared / (2 * sigma ** 2))
# 
# def get_kernel(identifier):
#     if isinstance(identifier, dict):
#         config = {'class_name': identifier['class_name'], 'config': identifier['config']}
#         return deserialize_veidt_object(config, module_objects=globals())
#     elif isinstance(identifier, str):
#         return deserialize_veidt_object(identifier, module_objects=globals())
#     elif callable(identifier):
#         return identifier
#     else:
#         raise ValueError('Could not interpret '
#                          'metric function identifier:', identifier)


import unittest
import numpy as np
import os
from veidt.kernel import rbf, get_kernel

file_path = os.path.dirname(__file__)


def test_func():
    return 1


class TestKernel(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.x1 = np.array([[1, 2], [1, 2]])
        cls.x2 = np.array([[2, 3], [2, 3]])
        cls.sigma = 1

    def test_rbf(self):

# Path: veidt/kernel.py
# def rbf(x1, x2, sigma):
#     d_squared = np.sum((x1[:, None, :] - x2[None, :, :]) ** 2, axis=2)
#     return np.exp(-d_squared / (2 * sigma ** 2))
# 
# def get_kernel(identifier):
#     if isinstance(identifier, dict):
#         config = {'class_name': identifier['class_name'], 'config': identifier['config']}
#         return deserialize_veidt_object(config, module_objects=globals())
#     elif isinstance(identifier, str):
#         return deserialize_veidt_object(identifier, module_objects=globals())
#     elif callable(identifier):
#         return identifier
#     else:
#         raise ValueError('Could not interpret '
#                          'metric function identifier:', identifier)


# Path: veidt/tests/test_kernel.py
import unittest
import numpy as np
import os
from veidt.kernel import rbf, get_kernel


file_path = os.path.dirname(__file__)


def test_func():
    return 1


class TestKernel(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.x1 = np.array([[1, 2], [1, 2]])
        cls.x2 = np.array([[2, 3], [2, 3]])
        cls.sigma = 1

    def test_rbf(self):

        self.assertAlmostEqual(np.sum(rbf(self.x1, self.x2, self.sigma)).item(),