class_docstr: Base class for kernels used in this Gaussian Process module.
  
  Every inherited class should implement a :meth:`forward` pass which takes inputs
  :math:`X`, :math:`Z` and returns their covariance matrix.
  
  To construct a new kernel from the old ones, we can use methods :meth:`add`,
  :meth:`mul`, :meth:`exp`, :meth:`warp`, :meth:`vertical_scale`.
  
  References:
  
  [1] `Gaussian Processes for Machine Learning`,
  Carl E. Rasmussen, Christopher K. I. Williams
  
  :param int input_dim: Number of feature dimensions of inputs.
  :param torch.Tensor variance: Variance parameter of this kernel.
  :param list active_dims: List of feature dimensions of the input which the kernel
      acts on.
docstr: Slices :math:`X` according to ``self.active_dims``. If ``X`` is 1D then returns
  a 2D tensor with shape :math:`N \times 1`.
  
  :param torch.Tensor X: A 1D or 2D input tensor.
  :returns: a 2D slice of :math:`X`
  :rtype: torch.Tensor
docstr_tok: ["Slices",":","math",":","`","X","`","according","to","``","self.active_dims","``",".","If","``","X","``","is","1D","then","returns","a","2D","tensor","with","shape",":","math",":","`","N","\\times","1","`",".",":","param","torch.Tensor","X",":","A","1D","or","2D","input","tensor",".",":","returns",":","a","2D","slice","of",":","math",":","`","X","`",":","rtype",":","torch.Tensor"]
code: def _slice_input(self, X):
      r"""
      Slices :math:`X` according to ``self.active_dims``. If ``X`` is 1D then returns
      a 2D tensor with shape :math:`N \times 1`.
  
      :param torch.Tensor X: A 1D or 2D input tensor.
      :returns: a 2D slice of :math:`X`
      :rtype: torch.Tensor
      """
      if X.dim() == 2:
          return X[:, self.active_dims]
      elif X.dim() == 1:
          return X.unsqueeze(1)
      else:
          raise ValueError("Input X must be either 1 or 2 dimensional.")
  
imports: import numbers
  from pyro.contrib.gp.parameterized import Parameterized
label_desc: Use image node_id 3 for calling the Kernel obj's underlying member method code with example usage: obj._slice_input(X) and returns: X, X