class_docstr: The basic kernel class. Management of active dimensions is implemented here.
  
  :param active_dims: active dimensions, either a slice or list of
      indices into the columns of X.
  :param name: optional kernel name.
class_docstr_tok: ["The","basic","kernel","class",".","Management","of","active","dimensions","is","implemented","here",".",":","param","active_dims",":","active","dimensions",",","either","a","slice","or","list","of","indices","into","the","columns","of","X.",":","param","name",":","optional","kernel","name","."]
docstr: Slice the correct dimensions for use in the kernel, as indicated by `self.active_dims`.
  
  :param X: Input 1.
  :param X2: Input 2, can be None.
  :return: Sliced X, X2.
docstr_tok: ["Slice","the","correct","dimensions","for","use","in","the","kernel",",","as","indicated","by","`","self.active_dims","`",".",":","param","X",":","Input","1.",":","param","X2",":","Input","2",",","can","be","None",".",":","return",":","Sliced","X",",","X2","."]
code: def slice(
      self, X: TensorType, X2: Optional[TensorType] = None
  ) -> Tuple[tf.Tensor, Optional[tf.Tensor]]:
      """
      Slice the correct dimensions for use in the kernel, as indicated by `self.active_dims`.
  
      :param X: Input 1.
      :param X2: Input 2, can be None.
      :return: Sliced X, X2.
      """
      dims = self.active_dims
      if isinstance(dims, slice):
          X = X[..., dims]
          if X2 is not None:
              X2 = X2[..., dims]
      elif dims is not None:
          X = tf.gather(X, dims, axis=-1)
          if X2 is not None:
              X2 = tf.gather(X2, dims, axis=-1)
      return X, X2
  
imports: import abc
  from functools import partial, reduce
  from typing import Callable, List, Optional, Sequence, Tuple, Union, overload
  import numpy
  import tensorflow
  from check_shapes import check_shapes
  from ..base import AnyNDArray, Module, TensorType
label_desc: Use image node_id 8 for calling the Kernel obj's underlying member method code with example usage: obj.slice(X, X2) and returns: X,  X2