class_docstr: A `Dataset` that batches ragged dense elements into `tf.sparse.SparseTensor`s.
class_docstr_tok: ["A","`","Dataset","`","that","batches","ragged","dense","elements","into","`","tf.sparse.SparseTensor","`","s","."]
docstr: See `Dataset.dense_to_sparse_batch()` for more details.
docstr_tok: ["See","`","Dataset.dense_to_sparse_batch","(",")","`","for","more","details","."]
code: def __init__(self, input_dataset, batch_size, row_shape, name=None):
      """See `Dataset.dense_to_sparse_batch()` for more details."""
      if not isinstance(
          dataset_ops.get_legacy_output_types(input_dataset),
          dtypes.DType,
      ):
          raise TypeError(
              "`dense_to_sparse_batch` requires an input dataset whose "
              "elements have a single component, but the given dataset "
              "has the following component types: "
              f"{dataset_ops.get_legacy_output_types(input_dataset)}."
          )
      self._input_dataset = input_dataset
      self._batch_size = batch_size
      self._row_shape = row_shape
      self._element_spec = sparse_tensor.SparseTensorSpec(
          tensor_shape.TensorShape([None]).concatenate(self._row_shape),
          dataset_ops.get_legacy_output_types(input_dataset),
      )
      self._name = name
      variant_tensor = ged_ops.dense_to_sparse_batch_dataset(
          self._input_dataset._variant_tensor,  # pylint: disable=protected-access
          self._batch_size,
          row_shape=convert.partial_shape_to_tensor(self._row_shape),
          **self._flat_structure,
      )
      super(_DenseToSparseBatchDataset, self).__init__(
          input_dataset, variant_tensor
      )
  
file_path: tensorflow-upstream/tensorflow/python/data/ops/sparse_batch_op.py
imports: from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.util import convert
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import gen_experimental_dataset_ops
label_desc: Use image node_id 1 to create a new _DenseToSparseBatchDataset object from inherited base classes: dataset_ops with example: obj = _DenseToSparseBatchDataset(input_dataset, batch_size, row_shape, name)