class_docstr: A `tf.linalg.LinearOperator` representing a kernel covariance matrix.
class_docstr_tok: ["A","`","tf.linalg.LinearOperator","`","representing","a","kernel","covariance","matrix","."]
docstr: Initializes the LinearOperator.
  
  This object implicitly represents the covariance matrix of `x1` and `x2`
  (`x1` if `x2` not provided) under the given `kernel`. This operator assumes
  one example dimension on each set of index points, which indexes the
  corresponding axis of the matrix. All outer dimensions are considered
  batch dimensions.
  
  Use this to avoid materializing the full matrix for such operations as:
  - accessing diagonal (`diag_part` method)
  - accessing a [batch of] row[s] (`row` method)
  - accessing a [batch of] column[s] (`col` method)
  
  Use this to perform matrix-vector products on very large covariance matrices
  by chunking the covariance matrix into parts, computing just that part of
  the output, computing a part of the covariance matrix, and the matrix-vector
  product, then forgetting the partial covariance matrix. Internally, uses
  recomputed gradients to avoid retaining infeasibly-large intermediate
  activations.
  
  Args:
    kernel_fn: A Python callable which takes `*kernel_args` and returns an
      instance of `tfp.math.psd_kernels.PositiveSemidefiniteKernel`. As a
      convenience, an instance may be passed instead of a function, but in
      this case gradients to kernel hyperparameters will not be available when
      using `num_matmul_parts`, and `kernel_args` must be `None`.
    x1: A floating point `Tensor`, the row index points.
    x2: Optional, a floating point `Tensor`, the column index points. If not
      provided, uses `x1`.
    kernel_args: A tuple of arguments (which may themselves be `tf.nest`
      compatible structures) to be passed to `kernel_fn`. This argument
      identifies the set of tensors which will have gradients in a
      `num_matmul_parts`-chunked matmul/backprop.
    num_matmul_parts: An optional Python `int` specifying the number of
      partitions into which the matrix should be broken when applying this
      linear operator. (An extra remainder partition is implied for uneven
      partitioning.) Because the use-case is avoiding a memory blowup, the
      partitioned matmul uses `parallel_iterations=1` and `back_prop=False`.
    is_non_singular:  Expect that this operator is non-singular.
    is_self_adjoint:  Expect that this operator is equal to its hermitian
      transpose.  If `dtype` is real, this is equivalent to being symmetric.
    is_positive_definite:  Expect that this operator is positive definite,
      meaning the quadratic form `x^H A x` has positive real part for all
      nonzero `x`.  Note that we do not require the operator to be
      self-adjoint to be positive-definite.  See:
      https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices
    is_square:  Expect that this operator acts like square [batch] matrices.
    name: Optional name for related ops.
docstr_tok: ["Initializes","the","LinearOperator",".","This","object","implicitly","represents","the","covariance","matrix","of","`","x1","`","and","`","x2","`","(","`","x1","`","if","`","x2","`","not","provided",")","under","the","given","`","kernel","`",".","This","operator","assumes","one","example","dimension","on","each","set","of","index","points",",","which","indexes","the","corresponding","axis","of","the","matrix",".","All","outer","dimensions","are","considered","batch","dimensions",".","Use","this","to","avoid","materializing","the","full","matrix","for","such","operations","as",":","-","accessing","diagonal","(","`","diag_part","`","method",")","-","accessing","a","[","batch","of","]","row","[","s","]","(","`","row","`","method",")","-","accessing","a","[","batch","of","]","column","[","s","]","(","`","col","`","method",")","Use","this","to","perform","matrix-vector","products","on","very","large","covariance","matrices","by","chunking","the","covariance","matrix","into","parts",",","computing","just","that","part","of","the","output",",","computing","a","part","of","the","covariance","matrix",",","and","the","matrix-vector","product",",","then","forgetting","the","partial","covariance","matrix",".","Internally",",","uses","recomputed","gradients","to","avoid","retaining","infeasibly-large","intermediate","activations",".","Args",":","kernel_fn",":","A","Python","callable","which","takes","`","*","kernel_args","`","and","returns","an","instance","of","`","tfp.math.psd_kernels.PositiveSemidefiniteKernel","`",".","As","a","convenience",",","an","instance","may","be","passed","instead","of","a","function",",","but","in","this","case","gradients","to","kernel","hyperparameters","will","not","be","available","when","using","`","num_matmul_parts","`",",","and","`","kernel_args","`","must","be","`","None","`",".","x1",":","A","floating","point","`","Tensor","`",",","the","row","index","points",".","x2",":","Optional",",","a","floating","point","`","Tensor","`",",","the","column","index","points",".","If","not","provided",",","uses","`","x1","`",".","kernel_args",":","A","tuple","of","arguments","(","which","may","themselves","be","`","tf.nest","`","compatible","structures",")","to","be","passed","to","`","kernel_fn","`",".","This","argument","identifies","the","set","of","tensors","which","will","have","gradients","in","a","`","num_matmul_parts","`","-chunked","matmul\/backprop",".","num_matmul_parts",":","An","optional","Python","`","int","`","specifying","the","number","of","partitions","into","which","the","matrix","should","be","broken","when","applying","this","linear","operator",".","(","An","extra","remainder","partition","is","implied","for","uneven","partitioning",".",")","Because","the","use-case","is","avoiding","a","memory","blowup",",","the","partitioned","matmul","uses","`","parallel_iterations=1","`","and","`","back_prop=False","`",".","is_non_singular",":","Expect","that","this","operator","is","non-singular",".","is_self_adjoint",":","Expect","that","this","operator","is","equal","to","its","hermitian","transpose",".","If","`","dtype","`","is","real",",","this","is","equivalent","to","being","symmetric",".","is_positive_definite",":","Expect","that","this","operator","is","positive","definite",",","meaning","the","quadratic","form","`","x^H","A","x","`","has","positive","real","part","for","all","nonzero","`","x","`",".","Note","that","we","do","not","require","the","operator","to","be","self-adjoint","to","be","positive-definite",".","See",":","https",":","\/\/en.wikipedia.org\/wiki\/Positive-definite_matrix","#","Extension_for_non-symmetric_matrices","is_square",":","Expect","that","this","operator","acts","like","square","[","batch","]","matrices",".","name",":","Optional","name","for","related","ops","."]
code: def __init__(
      self,
      kernel_fn,
      x1,
      x2=None,
      kernel_args=None,
      num_matmul_parts=None,
      is_non_singular=None,
      is_self_adjoint=None,
      is_positive_definite=None,
      is_square=None,
      name=None,
  ):
      """Initializes the LinearOperator.
  
      This object implicitly represents the covariance matrix of `x1` and `x2`
      (`x1` if `x2` not provided) under the given `kernel`. This operator assumes
      one example dimension on each set of index points, which indexes the
      corresponding axis of the matrix. All outer dimensions are considered
      batch dimensions.
  
      Use this to avoid materializing the full matrix for such operations as:
      - accessing diagonal (`diag_part` method)
      - accessing a [batch of] row[s] (`row` method)
      - accessing a [batch of] column[s] (`col` method)
  
      Use this to perform matrix-vector products on very large covariance matrices
      by chunking the covariance matrix into parts, computing just that part of
      the output, computing a part of the covariance matrix, and the matrix-vector
      product, then forgetting the partial covariance matrix. Internally, uses
      recomputed gradients to avoid retaining infeasibly-large intermediate
      activations.
  
      Args:
        kernel_fn: A Python callable which takes `*kernel_args` and returns an
          instance of `tfp.math.psd_kernels.PositiveSemidefiniteKernel`. As a
          convenience, an instance may be passed instead of a function, but in
          this case gradients to kernel hyperparameters will not be available when
          using `num_matmul_parts`, and `kernel_args` must be `None`.
        x1: A floating point `Tensor`, the row index points.
        x2: Optional, a floating point `Tensor`, the column index points. If not
          provided, uses `x1`.
        kernel_args: A tuple of arguments (which may themselves be `tf.nest`
          compatible structures) to be passed to `kernel_fn`. This argument
          identifies the set of tensors which will have gradients in a
          `num_matmul_parts`-chunked matmul/backprop.
        num_matmul_parts: An optional Python `int` specifying the number of
          partitions into which the matrix should be broken when applying this
          linear operator. (An extra remainder partition is implied for uneven
          partitioning.) Because the use-case is avoiding a memory blowup, the
          partitioned matmul uses `parallel_iterations=1` and `back_prop=False`.
        is_non_singular:  Expect that this operator is non-singular.
        is_self_adjoint:  Expect that this operator is equal to its hermitian
          transpose.  If `dtype` is real, this is equivalent to being symmetric.
        is_positive_definite:  Expect that this operator is positive definite,
          meaning the quadratic form `x^H A x` has positive real part for all
          nonzero `x`.  Note that we do not require the operator to be
          self-adjoint to be positive-definite.  See:
          https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices
        is_square:  Expect that this operator acts like square [batch] matrices.
        name: Optional name for related ops.
      """
      if not callable(kernel_fn):
          kernel = kernel_fn
          kernel_fn = lambda: kernel
          if kernel_args is not None:
              raise ValueError(
                  "Cannot pass a kernel instance for `kernel_fn` while "
                  "also specifying `kernel_args`."
              )
      if kernel_args is None:
          kernel_args = ()
      dtype = dtype_util.common_dtype(
          [kernel_fn(*kernel_args), x1, x2], dtype_hint=tf.float64
      )
      self._kernel_fn = kernel_fn
      self._kernel_args = tf.nest.map_structure(
          tensor_util.convert_nonref_to_tensor, kernel_args
      )
      self._x1 = tensor_util.convert_nonref_to_tensor(x1, dtype=dtype)
      self._x2 = tensor_util.convert_nonref_to_tensor(x2, dtype=dtype)
      self._num_matmul_parts = tensor_util.convert_nonref_to_tensor(
          num_matmul_parts, dtype=tf.int32
      )
      if self._x2 is None:
          if is_non_singular is not None and not is_non_singular:
              raise ValueError(
                  "Operator is non-singular with a single set of index points."
              )
          is_non_singular = True
          if is_self_adjoint is not None and not is_self_adjoint:
              raise ValueError(
                  "Operator is self-adjoint with a single set of index points."
              )
          is_self_adjoint = True
          if (
              is_positive_definite is not None
              and not is_positive_definite
          ):
              raise ValueError(
                  "Operator is positive-definite with a single set of index points."
              )
          is_positive_definite = True
          if is_square is not None and not is_square:
              raise ValueError(
                  "Operator is square with a single set of index points."
              )
          is_square = True
      super(LinearOperatorPSDKernel, self).__init__(
          dtype,
          is_non_singular=is_non_singular,
          is_self_adjoint=is_self_adjoint,
          is_positive_definite=is_positive_definite,
          is_square=is_square,
          name=name or "LinearOperatorPSDKernel",
      )
  
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 1 to create a new LinearOperatorPSDKernel object from inherited base classes: tf.linalg with example: obj = LinearOperatorPSDKernel(kernel_fn, x1, x2, kernel_args, num_matmul_parts, is_non_singular, is__adjoint, is_positive_definite, is_square, name)