code: def test_gaussian_kernel(gaussian_kernel_params):
      sigma, n_features, n_instances, trainable = gaussian_kernel_params
      xshape, yshape = (n_instances[0], n_features), (
          n_instances[1],
          n_features,
      )
      x = tf.convert_to_tensor(
          np.random.random(xshape).astype("float32")
      )
      y = tf.convert_to_tensor(
          np.random.random(yshape).astype("float32")
      )
  
      kernel = GaussianRBF(sigma=sigma, trainable=trainable)
      infer_sigma = True if sigma is None else False
      if trainable and infer_sigma:
          with pytest.raises(Exception):
              kernel(x, y, infer_sigma=infer_sigma)
      else:
          k_xy = kernel(x, y, infer_sigma=infer_sigma).numpy()
          k_xx = kernel(x, x, infer_sigma=infer_sigma).numpy()
          assert k_xy.shape == n_instances and k_xx.shape == (
              xshape[0],
              xshape[0],
          )
          np.testing.assert_almost_equal(
              k_xx.trace(), xshape[0], decimal=4
          )
          assert (k_xx > 0.0).all() and (k_xy > 0.0).all()
  
file_path: alibi-detect/alibi_detect/utils/tensorflow/tests/test_kernels_tf.py
imports: from itertools import product
  import numpy
  import pytest
  import tensorflow
  from tensorflow.keras.layers import Dense, Input
  from alibi_detect.utils.tensorflow import GaussianRBF, DeepKernel
label_desc: Use image node_id 2 for calling a global function with example usage: test_gaussian_kernel(gaussian_kernel_params) without return types