code: def test_validate_kernel_and_coerce_2_tensor(flavour, sigma):
      """
      Pass a kernel config through the KernelConfig pydantic model. This implicitly
      tests the coerce_2_tensor validator.
      """
      # Define a kernel config
      kernel_cfg = {
          "src": f"@utils.{flavour}.kernels.GaussianRBF",
          "flavour": flavour,
          "sigma": sigma,
      }
  
      # Pass through validation and check results
      kernel_cfg_val = KernelConfig(**kernel_cfg).dict()
      assert kernel_cfg_val["src"] == kernel_cfg["src"]
      assert kernel_cfg_val["flavour"] == flavour
      if sigma is None:
          assert kernel_cfg_val["sigma"] is None
      else:
          if flavour == "tensorflow":
              assert isinstance(kernel_cfg_val["sigma"], tf.Tensor)
          else:
              assert isinstance(kernel_cfg_val["sigma"], torch.Tensor)
  
file_path: alibi-detect/alibi_detect/saving/tests/test_validate.py
imports: import numpy
  import pytest
  from pydantic import ValidationError
  from alibi_detect.saving import validate_config
  from alibi_detect.saving.schemas import KernelConfig
  from alibi_detect.saving.saving import X_REF_FILENAME
  from alibi_detect.version import __version__
  from copy import deepcopy
  import tensorflow
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: test_validate_kernel_and_coerce_2_tensor(flavour, sigma) without return types