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

Method __init__

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

Creates a `TFRecordDataset` to read one or more TFRecord files. 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 `"

(self, filenames, compression_type=None, buffer_size=None,
               num_parallel_reads=None)

Source from the content-addressed store, hash-verified

274 """A `Dataset` comprising records from one or more TFRecord files."""
275
276 def __init__(self, filenames, compression_type=None, buffer_size=None,
277 num_parallel_reads=None):
278 """Creates a `TFRecordDataset` to read one or more TFRecord files.
279
280 Args:
281 filenames: A `tf.string` tensor or `tf.data.Dataset` containing one or
282 more filenames.
283 compression_type: (Optional.) A `tf.string` scalar evaluating to one of
284 `""` (no compression), `"ZLIB"`, or `"GZIP"`.
285 buffer_size: (Optional.) A `tf.int64` scalar representing the number of
286 bytes in the read buffer. If your input pipeline is I/O bottlenecked,
287 consider setting this parameter to a value 1-100 MBs. If `None`, a
288 sensible default for both local and remote file systems is used.
289 num_parallel_reads: (Optional.) A `tf.int64` scalar representing the
290 number of files to read in parallel. If greater than one, the records of
291 files read in parallel are outputted in an interleaved order. If your
292 input pipeline is I/O bottlenecked, consider setting this parameter to a
293 value greater than one to parallelize the I/O. If `None`, files will be
294 read sequentially.
295
296 Raises:
297 TypeError: If any argument does not have the expected type.
298 ValueError: If any argument does not have the expected shape.
299 """
300 filenames = _create_or_validate_filenames_dataset(filenames)
301
302 self._filenames = filenames
303 self._compression_type = compression_type
304 self._buffer_size = buffer_size
305 self._num_parallel_reads = num_parallel_reads
306
307 def creator_fn(filename):
308 return _TFRecordDataset(filename, compression_type, buffer_size)
309
310 self._impl = _create_dataset_reader(creator_fn, filenames,
311 num_parallel_reads)
312 variant_tensor = self._impl._variant_tensor # pylint: disable=protected-access
313 super(TFRecordDatasetV2, self).__init__(variant_tensor)
314
315 def _clone(self,
316 filenames=None,

Callers

nothing calls this directly

Calls 3

_create_dataset_readerFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected