class_docstr: A kernel that supports spectral learning for GPs, where the underlying spectral density is modeled as a mixture
  of delta distributions (e.g., with point masses). This has been explored e.g. in Lazaro-Gredilla et al., 2010.
  
  Conceptually, this kernel is similar to random Fourier features as implemented in RFFKernel, but instead of sampling
  a Gaussian to determine the spectrum sites, they are treated as learnable parameters.
  
  When using CG for inference, this kernel supports linear space and time (in N) for training and inference.
  
  :param int num_dims: Dimensionality of input data that this kernel will operate on. Note that if active_dims is
      used, this should be the length of the active dim set.
  :param int num_deltas: Number of point masses to learn.
code: def forward(self, x1, x2, diag=False, **params):
      x1_ = x1.div(self.lengthscale)
      x2_ = x2.div(self.lengthscale)
  
      Z = self.Z
  
      # Z1_ and Z2_ are s x d
      x1z1 = x1_.matmul(Z.transpose(-2, -1))  # n x s
      x2z2 = x2_.matmul(Z.transpose(-2, -1))  # n x s
  
      x1z1 = x1z1 * 2 * math.pi
      x2z2 = x2z2 * 2 * math.pi
  
      x1z1 = torch.cat([x1z1.cos(), x1z1.sin()], dim=-1) / math.sqrt(
          x1z1.size(-1)
      )
      x2z2 = torch.cat([x2z2.cos(), x2z2.sin()], dim=-1) / math.sqrt(
          x2z2.size(-1)
      )
  
      if x1.size() == x2.size() and torch.equal(x1, x2):
          prod = RootLinearOperator(x1z1)
      else:
          prod = MatmulLinearOperator(x1z1, x2z2.transpose(-2, -1))
  
      if diag:
          return prod.diagonal(dim1=-1, dim2=-2)
      else:
          return prod
  
file_path: gpytorch/gpytorch/kernels/spectral_delta_kernel.py
imports: import math
  from typing import Optional
  import torch
  from linear_operator.operators import MatmulLinearOperator, RootLinearOperator
  from ..constraints import Interval, Positive
  from .kernel import Kernel
label_desc: Use image node_id 7 for calling the SpectralDeltaKernel obj's underlying member method code with example usage: obj.forward(x1, x2, diag) and returns: prod, prod