Creates a `TextLineDataset`. Args: filenames: A `tf.string` tensor or `tf.data.Dataset` containing one or more filenames. compression_type: (Optional.) A `tf.string` scalar evaluating to one of `""` (no compression), `"ZLIB"`, or `"GZIP"`. buffer_size: (Optiona
(self, filenames, compression_type=None, buffer_size=None,
num_parallel_reads=None)
| 130 | """A `Dataset` comprising lines from one or more text files.""" |
| 131 | |
| 132 | def __init__(self, filenames, compression_type=None, buffer_size=None, |
| 133 | num_parallel_reads=None): |
| 134 | """Creates a `TextLineDataset`. |
| 135 | |
| 136 | Args: |
| 137 | filenames: A `tf.string` tensor or `tf.data.Dataset` containing one or |
| 138 | more filenames. |
| 139 | compression_type: (Optional.) A `tf.string` scalar evaluating to one of |
| 140 | `""` (no compression), `"ZLIB"`, or `"GZIP"`. |
| 141 | buffer_size: (Optional.) A `tf.int64` scalar denoting the number of bytes |
| 142 | to buffer. A value of 0 results in the default buffering values chosen |
| 143 | based on the compression type. |
| 144 | num_parallel_reads: (Optional.) A `tf.int64` scalar representing the |
| 145 | number of files to read in parallel. If greater than one, the records of |
| 146 | files read in parallel are outputted in an interleaved order. If your |
| 147 | input pipeline is I/O bottlenecked, consider setting this parameter to a |
| 148 | value greater than one to parallelize the I/O. If `None`, files will be |
| 149 | read sequentially. |
| 150 | """ |
| 151 | filenames = _create_or_validate_filenames_dataset(filenames) |
| 152 | self._filenames = filenames |
| 153 | self._compression_type = compression_type |
| 154 | self._buffer_size = buffer_size |
| 155 | |
| 156 | def creator_fn(filename): |
| 157 | return _TextLineDataset(filename, compression_type, buffer_size) |
| 158 | |
| 159 | self._impl = _create_dataset_reader(creator_fn, filenames, |
| 160 | num_parallel_reads) |
| 161 | variant_tensor = self._impl._variant_tensor # pylint: disable=protected-access |
| 162 | |
| 163 | super(TextLineDatasetV2, self).__init__(variant_tensor) |
| 164 | |
| 165 | @property |
| 166 | def element_spec(self): |
nothing calls this directly
no test coverage detected