code: def rbf_kernel(X, Y=None, gamma=None):
      """
      Compute the rbf (gaussian) kernel between X and Y::
  
          K(x, y) = exp(-gamma ||x-y||^2)
  
      for each pair of rows x in X and y in Y.
  
      Read more in the :ref:`User Guide <rbf_kernel>`.
  
      Parameters
      ----------
      X : tensor of shape (n_samples_X, n_features)
  
      Y : tensor of shape (n_samples_Y, n_features)
  
      gamma : float, default None
          If None, defaults to 1.0 / n_features
  
      Returns
      -------
      kernel_matrix : tensor of shape (n_samples_X, n_samples_Y)
      """
  
      X, Y = PairwiseDistances.check_pairwise_arrays(X, Y)
      if gamma is None:
          gamma = 1.0 / X.shape[1]
  
      K = euclidean_distances(X, Y, squared=True)
      K *= -gamma
      K = mt.exp(K)
      return K
  
imports: from ....None import tensor
  from .core import PairwiseDistances
  from .euclidean import euclidean_distances
label_desc: Use image node_id 1 for calling a global function with example usage: rbf_kernel(X, Y, gamma) and returns: K