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

Method write

tensorflow/python/data/experimental/ops/writers.py:68–87  ·  view source on GitHub ↗

Returns a `tf.Operation` to write a dataset to a file. Args: dataset: a `tf.data.Dataset` whose elements are to be written to a file Returns: A `tf.Operation` that, when run, writes contents of `dataset` to a file.

(self, dataset)

Source from the content-addressed store, hash-verified

66 argument_dtype=dtypes.string)
67
68 def write(self, dataset):
69 """Returns a `tf.Operation` to write a dataset to a file.
70
71 Args:
72 dataset: a `tf.data.Dataset` whose elements are to be written to a file
73
74 Returns:
75 A `tf.Operation` that, when run, writes contents of `dataset` to a file.
76 """
77 if not isinstance(dataset, dataset_ops.DatasetV2):
78 raise TypeError("`dataset` must be a `tf.data.Dataset` object.")
79 if not dataset_ops.get_structure(dataset).is_compatible_with(
80 tensor_spec.TensorSpec([], dtypes.string)):
81 raise TypeError(
82 "`dataset` must produce scalar `DT_STRING` tensors whereas it "
83 "produces shape {0} and types {1}".format(
84 dataset_ops.get_legacy_output_shapes(dataset),
85 dataset_ops.get_legacy_output_types(dataset)))
86 return gen_experimental_dataset_ops.dataset_to_tf_record(
87 dataset._variant_tensor, self._filename, self._compression_type) # pylint: disable=protected-access

Callers 15

_createFilesMethod · 0.95
_createFilesMethod · 0.95
_createFilesMethod · 0.95
_createFileMethod · 0.95
reduce_funcMethod · 0.95
_createFilesMethod · 0.95
_createTFRecordFilesMethod · 0.95
_createFilesMethod · 0.45
_createFilesMethod · 0.45

Calls 2

is_compatible_withMethod · 0.45
formatMethod · 0.45

Tested by 15

_createFilesMethod · 0.76
_createFilesMethod · 0.76
_createFilesMethod · 0.76
_createFileMethod · 0.76
reduce_funcMethod · 0.76
_createFilesMethod · 0.76
_createTFRecordFilesMethod · 0.76
_createFilesMethod · 0.36
_createFilesMethod · 0.36