@parameterized.named_parameters(('1', None, np.int32([]), dtypes.bool), ('2', None, np.int32([]), dtypes.int32), ('3', None, np.int32([]), dtypes.float32), ('4', None, np.int32([]), dtypes.string), ('5', None, np.int32([2]), dtypes.int32), ('6', None, np.int32([2, 2]), dtypes.int32), ('7', (None, None, None), np.int32([]), dtypes.int32), ('8', (None, (None, None)), np.int32([]), dtypes.int32))
def testWindowDatasetBatchSparse(self, structure, shape, dtype):
    'Tests batching of sparse tensor windows.\n\n    Args:\n      structure: the input structure\n      shape: the input shape\n      dtype: the input data type\n    '

    def fn(*args):
        if ((len(args) == 1) and (not isinstance(args[0], tuple))):
            return batching.batch_window(args[0])
        return tuple([(fn(*arg) if isinstance(arg, tuple) else batching.batch_window(arg)) for arg in args])
    dataset = self._structuredSparseDataset(structure, shape, dtype).repeat(5).apply(grouping.window_dataset(5)).apply(grouping._map_x_dataset(fn))
    get_next = dataset.make_one_shot_iterator().get_next()
    with self.cached_session() as sess:
        expected = sess.run(self._structuredSparseElement(structure, np.concatenate(([5], shape), axis=0), dtype))
        actual = sess.run(get_next)
        self._assertEqual(expected, actual)
Tests batching of sparse tensor windows.

Args:
  structure: the input structure
  shape: the input shape
  dtype: the input data type
@parameterized.named_parameters(('1', None, np.int32([]), dtypes.bool), ('2', None, np.int32([]), dtypes.int32), ('3', None, np.int32([]), dtypes.float32), ('4', None, np.int32([]), dtypes.string), ('5', None, np.int32([2]), dtypes.int32), ('6', None, np.int32([2, 2]), dtypes.int32), ('7', (None, None, None), np.int32([]), dtypes.int32), ('8', (None, (None, None)), np.int32([]), dtypes.int32))
def testWindowDatasetBatchSparse(self, structure, shape, dtype):
    'Tests batching of sparse tensor windows.\n\n    Args:\n      structure: the input structure\n      shape: the input shape\n      dtype: the input data type\n    '

    def fn(*args):
        if ((len(args) == 1) and (not isinstance(args[0], tuple))):
            return batching.batch_window(args[0])
        return tuple([(fn(*arg) if isinstance(arg, tuple) else batching.batch_window(arg)) for arg in args])
    dataset = self._structuredSparseDataset(structure, shape, dtype).repeat(5).apply(grouping.window_dataset(5)).apply(grouping._map_x_dataset(fn))
    get_next = dataset.make_one_shot_iterator().get_next()
    with self.cached_session() as sess:
        expected = sess.run(self._structuredSparseElement(structure, np.concatenate(([5], shape), axis=0), dtype))
        actual = sess.run(get_next)
        self._assertEqual(expected, actual)