Esempio n. 1
0
 def _as_variant_tensor(self):
   return gen_dataset_ops.dense_to_sparse_batch_dataset(
       self._input_dataset._as_variant_tensor(),  # pylint: disable=protected-access
       self._batch_size,
       row_shape=dataset_ops._partial_shape_to_tensor(self._row_shape),  # pylint: disable=protected-access
       output_shapes=nest.flatten(
           sparse.as_dense_shapes(self.output_shapes, self.output_classes)),
       output_types=nest.flatten(
           sparse.as_dense_types(self.output_types, self.output_classes)))
Esempio n. 2
0
 def _as_variant_tensor(self):
   return gen_dataset_ops.dense_to_sparse_batch_dataset(
       self._input_dataset._as_variant_tensor(),  # pylint: disable=protected-access
       self._batch_size,
       row_shape=dataset_ops._partial_shape_to_tensor(self._row_shape),  # pylint: disable=protected-access
       output_shapes=nest.flatten(
           sparse.as_dense_shapes(self.output_shapes, self.output_classes)),
       output_types=nest.flatten(
           sparse.as_dense_types(self.output_types, self.output_classes)))
Esempio n. 3
0
 def __init__(self, input_dataset, batch_size, row_shape):
   """See `Dataset.dense_to_sparse_batch()` for more details."""
   super(DenseToSparseBatchDataset, self).__init__()
   if not isinstance(input_dataset.output_types, dtypes.DType):
     raise TypeError("DenseToSparseDataset requires an input whose elements "
                     "have a single component, whereas the input has %r." %
                     input_dataset.output_types)
   self._input_dataset = input_dataset
   self._batch_size = batch_size
   # pylint: disable=protected-access
   self._row_shape = dataset_ops._partial_shape_to_tensor(row_shape)
Esempio n. 4
0
 def __init__(self, input_dataset, batch_size, row_shape):
   """See `Dataset.dense_to_sparse_batch()` for more details."""
   super(DenseToSparseBatchDataset, self).__init__()
   if not isinstance(input_dataset.output_types, dtypes.DType):
     raise TypeError("DenseToSparseDataset requires an input whose elements "
                     "have a single component, whereas the input has %r." %
                     input_dataset.output_types)
   self._input_dataset = input_dataset
   self._batch_size = batch_size
   # pylint: disable=protected-access
   self._row_shape = dataset_ops._partial_shape_to_tensor(row_shape)