diff options
Diffstat (limited to 'tensorflow/python/data/kernel_tests/batch_dataset_op_test.py')
-rw-r--r-- | tensorflow/python/data/kernel_tests/batch_dataset_op_test.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tensorflow/python/data/kernel_tests/batch_dataset_op_test.py b/tensorflow/python/data/kernel_tests/batch_dataset_op_test.py index 53c8be1d1d..eac1c1960d 100644 --- a/tensorflow/python/data/kernel_tests/batch_dataset_op_test.py +++ b/tensorflow/python/data/kernel_tests/batch_dataset_op_test.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -301,6 +302,27 @@ class BatchDatasetTest(test.TestCase): with self.assertRaises(errors.OutOfRangeError): sess.run(get_next) + def testPaddedBatchDatasetUnicode(self): + # See GitHub issue 16149 + def generator(): + data = [ + [u'Простой', u'тест', u'юникода'], + [u'никогда', u'не', u'бывает', u'простым']] + + for seq in data: + yield seq, [0, 1, 2, 3] + + dataset = dataset_ops.Dataset.from_generator( + generator, + (dtypes.string, dtypes.int32), + (tensor_shape.TensorShape([None]), tensor_shape.TensorShape([None]))) + padded_dataset = dataset.padded_batch(2, padded_shapes=([None], [None]), + padding_values=('', 0)) + with self.test_session() as sess: + next_element = padded_dataset.make_one_shot_iterator().get_next() + sess.run(next_element) + + def testPaddedBatchDatasetShapeSpecifications(self): int_placeholder = array_ops.placeholder(dtypes.int32) float_placeholder = array_ops.placeholder(dtypes.float32) |