class_docstr: The Latent Context Embedding Additive (LCE-A) Kernel.
  
  This kernel is similar to the SACKernel, and is used when context breakdowns are
  unbserverable. It assumes the same additive structure and a spatial kernel shared
  across contexts. Rather than assuming independence, LCEAKernel models the
  correlation in the latent functions for each context through learning context
  embeddings.
docstr: Computes the base covariance matrix on x1, x2, applying permutations and
  reshaping the kernel matrix as required by `forward`.
  
  NOTE: Using the notation n = num_observations, k = num_contexts, d = input_dim,
  the input tensors have to have the following shapes.
  
  Args:
      x1: `batch_shape x n x (k*d)`-dim Tensor of kernel inputs.
      x2: `batch_shape x n x (k*d)`-dim Tensor of kernel inputs.
  
  Returns:
      `batch_shape x n x n x k x k`-dim Tensor of base covariance values.
docstr_tok: ["Computes","the","base","covariance","matrix","on","x1",",","x2",",","applying","permutations","and","reshaping","the","kernel","matrix","as","required","by","`","forward","`",".","NOTE",":","Using","the","notation","n","=","num_observations",",","k","=","num_contexts",",","d","=","input_dim",",","the","input","tensors","have","to","have","the","following","shapes",".","Args",":","x1",":","`","batch_shape","x","n","x","(","k","*","d",")","`","-dim","Tensor","of","kernel","inputs",".","x2",":","`","batch_shape","x","n","x","(","k","*","d",")","`","-dim","Tensor","of","kernel","inputs",".","Returns",":","`","batch_shape","x","n","x","n","x","k","x","k","`","-dim","Tensor","of","base","covariance","values","."]
code: def _eval_base_covar_perm(self, x1: Tensor, x2: Tensor) -> Tensor:
      """Computes the base covariance matrix on x1, x2, applying permutations and
      reshaping the kernel matrix as required by `forward`.
  
      NOTE: Using the notation n = num_observations, k = num_contexts, d = input_dim,
      the input tensors have to have the following shapes.
  
      Args:
          x1: `batch_shape x n x (k*d)`-dim Tensor of kernel inputs.
          x2: `batch_shape x n x (k*d)`-dim Tensor of kernel inputs.
  
      Returns:
          `batch_shape x n x n x k x k`-dim Tensor of base covariance values.
      """
      if self.permutation is not None:
          x1 = x1[..., self.permutation]
          x2 = x2[..., self.permutation]
      # turn last two dimensions of n x (k*d) into (n*k) x d.
      x1_exp = x1.reshape(*x1.shape[:-2], -1, self.num_param)
      x2_exp = x2.reshape(*x2.shape[:-2], -1, self.num_param)
      # batch shape x n*k x n*k
      base_covar = self.base_kernel(x1_exp, x2_exp)
      # batch shape x n x n x k x k
      view_shape = x1.shape[:-2] + torch.Size(
          [
              x1.shape[-2],
              self.num_contexts,
              x2.shape[-2],
              self.num_contexts,
          ]
      )
      base_covar_perm = (
          base_covar.to_dense()
          .view(view_shape)
          .permute(*list(range(x1.ndim - 2)), -4, -2, -3, -1)
      )
      return base_covar_perm
  
imports: from typing import Any, Dict, List, Optional
  import torch
  from gpytorch.constraints import Positive
  from gpytorch.kernels.kernel import Kernel
  from gpytorch.kernels.matern_kernel import MaternKernel
  from gpytorch.priors.torch_priors import GammaPrior
  from linear_operator.operators import DiagLinearOperator
  from linear_operator.operators.dense_linear_operator import DenseLinearOperator
  from torch import Tensor
  from torch.nn import ModuleList
label_desc: Use image node_id 13 for calling the LCEAKernel obj's underlying member method code with example usage: obj._eval_base_covar_perm(x1, x2) and returns: base_covar_perm