class_docstr: (Optionally batched) CSR Sparse Matrix.
class_docstr_tok: ["(","Optionally","batched",")","CSR","Sparse","Matrix","."]
docstr: Construct a CSRSparseMatrix from a dense matrix or SparseTensor.
  
  Args:
    value: A dense `2D` or `3D` Tensor or `SparseTensor`.
    indices: The nonzero indices of `value`
      (if `value` is not a `SparseTensor`).
    name: Optional op name.
  
  Raises:
    ValueError: if `value` is a `SparseTensor` and `indices` is not `None`.
docstr_tok: ["Construct","a","CSRSparseMatrix","from","a","dense","matrix","or","SparseTensor",".","Args",":","value",":","A","dense","`","2D","`","or","`","3D","`","Tensor","or","`","SparseTensor","`",".","indices",":","The","nonzero","indices","of","`","value","`","(","if","`","value","`","is","not","a","`","SparseTensor","`",")",".","name",":","Optional","op","name",".","Raises",":","ValueError",":","if","`","value","`","is","a","`","SparseTensor","`","and","`","indices","`","is","not","`","None","`","."]
code: def __init__(self, value, indices=None, name=None):
      """Construct a CSRSparseMatrix from a dense matrix or SparseTensor.
  
      Args:
        value: A dense `2D` or `3D` Tensor or `SparseTensor`.
        indices: The nonzero indices of `value`
          (if `value` is not a `SparseTensor`).
        name: Optional op name.
  
      Raises:
        ValueError: if `value` is a `SparseTensor` and `indices` is not `None`.
      """
      del name  # Unused.
      super(CSRSparseMatrix, self).__init__()
      if isinstance(value, sparse_tensor.SparseTensor):
          if indices is not None:
              raise ValueError(
                  "indices must be None if value is a SparseTensor."
              )
          self._dtype = value.dtype
          self._csr_matrix = sm_ops.sparse_tensor_to_csr_sparse_matrix(
              indices=value.indices,
              values=value.values,
              dense_shape=value.dense_shape,
          )
      else:
          value = ops.convert_to_tensor(value)
          self._dtype = value.dtype
          if indices is not None:
              indices = ops.convert_to_tensor(
                  indices, dtype=dtypes.int64
              )
          else:
              indices = array_ops.stop_gradient(array_ops.where(value))
          self._csr_matrix = sm_ops.dense_to_csr_sparse_matrix(
              value, indices
          )
  
      # Eager mode doesn't call shape inference functions, so we have to set the
      # shape and dtype handle data directly.
      if self._eager_mode:
          # pylint: disable=protected-access
          self._csr_matrix._handle_data = _make_handle_data(value)
  
imports: import abc
  import collections
  from tensorflow.python.eager import context
  from tensorflow.python.framework import cpp_shape_inference_pb2
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops.linalg.sparse import gen_sparse_csr_matrix_ops
  from tensorflow.python.ops.linalg.sparse.gen_sparse_csr_matrix_ops import *
label_desc: Use image node_id 1 to create a new CSRSparseMatrix object from inherited base classes: SparseMatrix with example: obj = CSRSparseMatrix(value, indices, name)