class_docstr: A `Type` for sparse tensors.
  
  Notes
  -----
  Currently, sparse tensors can only be matrices (i.e. have two dimensions).
class_docstr_tok: ["A","`","Type","`","for","sparse","tensors",".","Notes","--","--","-","Currently",",","sparse","tensors","can","only","be","matrices","(","i.e",".","have","two","dimensions",")","."]
code: def __init__(
      self,
      format: SparsityTypes,
      dtype: Union[str, np.dtype],
      shape: Optional[Iterable[Optional[Union[bool, int]]]] = None,
      name: Optional[str] = None,
      broadcastable: Optional[Iterable[bool]] = None,
  ):
      if shape is None and broadcastable is None:
          shape = (None, None)
  
      if format not in self.format_cls:
          raise ValueError(
              f'unsupported format "{format}" not in list',
          )
  
      self.format = format
  
      super().__init__(
          dtype, shape=shape, name=name, broadcastable=broadcastable
      )
  
imports: from collections.abc import Iterable
  from typing import Literal, Optional, Union
  import numpy
  import scipy.sparse
  import pytensor
  from pytensor import scalar
  from pytensor.graph.basic import Variable
  from pytensor.graph.type import HasDataType
  from pytensor.tensor.type import DenseTensorType, TensorType
label_desc: Use image node_id 1 to create a new SparseTensorType object from inherited base classes: TensorType, HasDataType with example: obj = SparseTensorType(format, dtype, shape, name, broadcastable)