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: Generate embedding features of contexts when model is non-batch.
  
  Returns:
      a (num_contexts x n_embs) tensor. n_embs is the sum of embedding
      dimensions i.e. sum(embs_dim_list)
docstr_tok: ["Generate","embedding","features","of","contexts","when","model","is","non-batch",".","Returns",":","a","(","num_contexts","x","n_embs",")","tensor",".","n_embs","is","the","sum","of","embedding","dimensions","i.e",".","sum","(","embs_dim_list",")"]
code: def _task_embeddings(self) -> Tensor:
      """Generate embedding features of contexts when model is non-batch.
  
      Returns:
          a (num_contexts x n_embs) tensor. n_embs is the sum of embedding
          dimensions i.e. sum(embs_dim_list)
      """
      if self.train_embedding is False:
          return (
              self.context_emb_feature
          )  # use pre-trained embedding only
      context_features = torch.stack(
          [
              self.context_cat_feature[i, :]
              for i in range(self.num_contexts)
          ],
          dim=0,
      )
      embeddings = [
          emb_layer(
              context_features[:, i].to(
                  device=self.device, dtype=torch.long
              )
          )
          for i, emb_layer in enumerate(self.emb_layers)
      ]
      embeddings = torch.cat(embeddings, dim=1)
      # add given embeddings if any
      if self.context_emb_feature is not None:
          embeddings = torch.cat(
              [embeddings, self.context_emb_feature], dim=1
          )
      return embeddings
  
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 9 for calling the LCEAKernel obj's underlying member method code with example usage: obj._task_embeddings() and returns: embeddings, self