class_docstr: A `tf.linalg.LinearOperator` representing a kernel covariance matrix.
class_docstr_tok: ["A","`","tf.linalg.LinearOperator","`","representing","a","kernel","covariance","matrix","."]
code: def _diag_part(self):
      x1, x2, axis, kernel = self._x1_x2_axis_kernel()
      ax_minsize = tf.minimum(tf.shape(x1)[axis], tf.shape(x2)[axis])
  
      def slice_of(xn):
          slice_size = tf.where(
              tf.equal(tf.range(tf.rank(xn)), tf.rank(xn) + axis),
              ax_minsize,
              tf.shape(xn),
          )
          return tf.slice(
              xn, begin=tf.zeros_like(tf.shape(xn)), size=slice_size
          )
  
      return kernel.apply(slice_of(x1), slice_of(x2))
  
imports: import functools
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow.python.ops import control_flow_util
label_desc: Use image node_id 12 for calling the LinearOperatorPSDKernel obj's underlying member method code with example usage: obj._diag_part() and returns: kernel, tf