code: def test_mmd_from_kernel_matrix(mmd_from_kernel_matrix_params):
      n, m, permute, zero_diag = mmd_from_kernel_matrix_params
      n_tot = n + m
      shape = (n_tot, n_tot)
      kernel_mat = np.random.uniform(0, 1, size=shape)
      kernel_mat_2 = kernel_mat.copy()
      kernel_mat_2[-m:, :-m] = 1.0
      kernel_mat_2[:-m, -m:] = 1.0
      kernel_mat = tf.convert_to_tensor(kernel_mat)
      kernel_mat_2 = tf.convert_to_tensor(kernel_mat_2)
      if not zero_diag:
          kernel_mat -= tf.linalg.diag(tf.linalg.diag_part(kernel_mat))
          kernel_mat_2 -= tf.linalg.diag(
              tf.linalg.diag_part(kernel_mat_2)
          )
      mmd = mmd2_from_kernel_matrix(
          kernel_mat, m, permute=permute, zero_diag=zero_diag
      )
      mmd_2 = mmd2_from_kernel_matrix(
          kernel_mat_2, m, permute=permute, zero_diag=zero_diag
      )
      if not permute:
          assert mmd_2.numpy() < mmd.numpy()
  
file_path: alibi-detect/alibi_detect/utils/tensorflow/tests/test_distance_tf.py
imports: import numpy
  from itertools import product
  import pytest
  import tensorflow
  from alibi_detect.utils.tensorflow import GaussianRBF, mmd2, mmd2_from_kernel_matrix, permed_lsdds
  from alibi_detect.utils.tensorflow import relative_euclidean_distance, squared_pairwise_distance
  from alibi_detect.utils.tensorflow import batch_compute_kernel_matrix
label_desc: Use image node_id 8 for calling a global function with example usage: test_mmd_from_kernel_matrix(mmd_from_kernel_matrix_params) without return types