@parameterized.named_parameters(('1', np.int64([[1], [2], [3]]), [(- 1)]), ('2', np.int64([[1, 3], [2, 2], [3, 1]]), [(- 1), (- 1)]), ('3', np.int64([[3, 1, 3], [1, 3, 1]]), [(- 1), (- 1), (- 1)]))
def testWindowDatasetPaddedBatchSparseDynamicShape(self, shapes, padded_shape):
    'Tests padded batching of dynamically shaped sparse tensor windows.\n\n    Args:\n      shapes: the input shapes\n      padded_shape: the shape to pad the output to\n    '
    shapes_t = array_ops.placeholder(dtypes.int32)
    dataset = dataset_ops.Dataset.from_tensor_slices(shapes_t).map((lambda shape: array_ops.zeros(shape, dtype=dtypes.int32))).map(self._make_dense_to_sparse_fn(False)).apply(grouping.window_dataset(len(shapes))).apply(grouping._map_x_dataset((lambda x: batching.padded_batch_window(x, padded_shape))))
    iterator = dataset.make_initializable_iterator()
    init_op = iterator.initializer
    get_next = iterator.get_next()
    with self.cached_session() as sess:
        sess.run(init_op, {shapes_t: shapes})
        expected = sess.run(self._structuredRaggedSparseElement(None, shapes, dtypes.int32, padded_shape))
        actual = sess.run(get_next)
        self._assertEqual(expected, actual)
Tests padded batching of dynamically shaped sparse tensor windows.

Args:
  shapes: the input shapes
  padded_shape: the shape to pad the output to
@parameterized.named_parameters(('1', np.int64([[1], [2], [3]]), [(- 1)]), ('2', np.int64([[1, 3], [2, 2], [3, 1]]), [(- 1), (- 1)]), ('3', np.int64([[3, 1, 3], [1, 3, 1]]), [(- 1), (- 1), (- 1)]))
def testWindowDatasetPaddedBatchSparseDynamicShape(self, shapes, padded_shape):
    'Tests padded batching of dynamically shaped sparse tensor windows.\n\n    Args:\n      shapes: the input shapes\n      padded_shape: the shape to pad the output to\n    '
    shapes_t = array_ops.placeholder(dtypes.int32)
    dataset = dataset_ops.Dataset.from_tensor_slices(shapes_t).map((lambda shape: array_ops.zeros(shape, dtype=dtypes.int32))).map(self._make_dense_to_sparse_fn(False)).apply(grouping.window_dataset(len(shapes))).apply(grouping._map_x_dataset((lambda x: batching.padded_batch_window(x, padded_shape))))
    iterator = dataset.make_initializable_iterator()
    init_op = iterator.initializer
    get_next = iterator.get_next()
    with self.cached_session() as sess:
        sess.run(init_op, {shapes_t: shapes})
        expected = sess.run(self._structuredRaggedSparseElement(None, shapes, dtypes.int32, padded_shape))
        actual = sess.run(get_next)
        self._assertEqual(expected, actual)