MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TextLineDatasetV2

Class TextLineDatasetV2

tensorflow/python/data/ops/readers.py:129–167  ·  view source on GitHub ↗

A `Dataset` comprising lines from one or more text files.

Source from the content-addressed store, hash-verified

127
128@tf_export("data.TextLineDataset", v1=[])
129class TextLineDatasetV2(dataset_ops.DatasetSource):
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):
167 return tensor_spec.TensorSpec([], dtypes.string)
168
169
170@tf_export(v1=["data.TextLineDataset"])

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected