class_docstr: Tests kernel matrix computations.
class_docstr_tok: ["Tests","kernel","matrix","computations","."]
docstr: Test square_kernel_matrix and kernel_matrix of the _laplace_kernel above.
docstr_tok: ["Test","square_kernel_matrix","and","kernel_matrix","of","the","_laplace_kernel","above","."]
code: def test_laplace_kernel(self, batch):
      """Test square_kernel_matrix and kernel_matrix of the _laplace_kernel above."""
      X1 = [0.1, 0.4, 0.2]
      X2 = [0.0, 0.1, 0.3, 0.2]
  
      K1_expected = pnp.exp(
          -np.array([[0.0, 0.3, 0.1], [0.3, 0.0, 0.2], [0.1, 0.2, 0.0]])
      )
      K2_expected = pnp.exp(
          -np.array(
              [
                  [0.1, 0.0, 0.2, 0.1],
                  [0.4, 0.3, 0.1, 0.2],
                  [0.2, 0.1, 0.1, 0.0],
              ]
          )
      )
      if batch is not None:
          K1_expected = pnp.tensordot(
              np.linspace(1, 5, batch), K1_expected, axes=0
          )
          K2_expected = pnp.tensordot(
              np.linspace(1, 5, batch), K2_expected, axes=0
          )
  
      K1 = kern.square_kernel_matrix(
          X1, partial(_laplace_kernel, batch=batch), False
      )
      K2 = kern.kernel_matrix(
          X1, X2, partial(_laplace_kernel, batch=batch)
      )
  
      assert np.allclose(K1, K1_expected)
      assert np.allclose(K2, K2_expected)
  
imports: import math
  import sys
  from functools import partial
  import pytest
  import numpy
  import pennylane
  import pennylane.kernels
  from pennylane import numpy
label_desc: Use image node_id 3 for calling the TestKernelMatrix obj's underlying member method code with example usage: obj.test_laplace_kernel(batch) without return types