class_docstr: Orthogonal Additive Kernels (OAKs) were introduced in [Lu2022additive]_, though
  only for the case of Gaussian base kernels with a Gaussian input data distribution.
  
  The implementation here generalizes OAKs to arbitrary base kernels by using a
  Gauss-Legendre quadrature approximation to the required one-dimensional integrals
  involving the base kernels.
  
  .. [Lu2022additive]
      X. Lu, A. Boukouvalas, and J. Hensman. Additive Gaussian processes revisited.
      Proceedings of the 39th International Conference on Machine Learning. Jul 2022.
class_docstr_tok: ["Orthogonal","Additive","Kernels","(","OAKs",")","were","introduced","in","[","Lu2022additive","]","_",",","though","only","for","the","case","of","Gaussian","base","kernels","with","a","Gaussian","input","data","distribution",".","The","implementation","here","generalizes","OAKs","to","arbitrary","base","kernels","by","using","a","Gauss-Legendre","quadrature","approximation","to","the","required","one-dimensional","integrals","involving","the","base","kernels",".","..","[","Lu2022additive","]","X.","Lu",",","A.","Boukouvalas",",","and","J.","Hensman",".","Additive","Gaussian","processes","revisited",".","Proceedings","of","the","39th","International","Conference","on","Machine","Learning",".","Jul","2022","."]
docstr: Evaluates the set of `d` orthogonalized base kernels on (x1, x2).
  Note that even if the base kernel is positive, the orthogonalized versions
  can - and usually do - take negative values.
  
  Args:
      x1: `batch_shape x n1 x d`-dim inputs to the kernel.
      x2: `batch_shape x n2 x d`-dim inputs to the kernel.
  
  Returns:
      A `batch_shape x d x n1 x n2`-dim Tensor.
docstr_tok: ["Evaluates","the","set","of","`","d","`","orthogonalized","base","kernels","on","(","x1",",","x2",")",".","Note","that","even","if","the","base","kernel","is","positive",",","the","orthogonalized","versions","can","-","and","usually","do","-","take","negative","values",".","Args",":","x1",":","`","batch_shape","x","n1","x","d","`","-dim","inputs","to","the","kernel",".","x2",":","`","batch_shape","x","n2","x","d","`","-dim","inputs","to","the","kernel",".","Returns",":","A","`","batch_shape","x","d","x","n1","x","n2","`","-dim","Tensor","."]
code: def _orthogonal_base_kernels(self, x1: Tensor, x2: Tensor) -> Tensor:
      """Evaluates the set of `d` orthogonalized base kernels on (x1, x2).
      Note that even if the base kernel is positive, the orthogonalized versions
      can - and usually do - take negative values.
  
      Args:
          x1: `batch_shape x n1 x d`-dim inputs to the kernel.
          x2: `batch_shape x n2 x d`-dim inputs to the kernel.
  
      Returns:
          A `batch_shape x d x n1 x n2`-dim Tensor.
      """
      _check_hypercube(x1, "x1")
      if x1 is not x2:
          _check_hypercube(x2, "x2")
      Kx1x2 = self.k(x1, x2)  # d x n x n
      # Overwriting allocated quadrature tensors with fitting dtype and device
      # self.z, self.w = self.z.to(x1), self.w.to(x1)
      # include normalization constant in weights
      w = self.w / self.normalizer().sqrt()
      Skx1 = self.k(x1, self.z) @ w  # batch_shape x d x n
      Skx2 = Skx1 if (x1 is x2) else self.k(x2, self.z) @ w  # d x n
      # this is a tensor of kernel matrices of orthogonal 1d kernels
      K_ortho = (
          Kx1x2 - Skx1 @ Skx2.transpose(-2, -1)
      ).to_dense()  # d x n x n
      return K_ortho
  
imports: import math
  from typing import List, Optional, Tuple
  import numpy
  import torch
  from botorch.exceptions.errors import UnsupportedError
  from gpytorch.constraints import Interval, Positive
  from gpytorch.kernels import Kernel
  from torch import nn, Tensor
label_desc: Use image node_id 7 for calling the OrthogonalAdditiveKernel obj's underlying member method code with example usage: obj._orthogonal_base_kernels(x1, x2) and returns: K_ortho