MCPcopy Index your code
hub / github.com/tensorflow/datasets / write

Method write

tensorflow_datasets/core/writer.py:288–303  ·  view source on GitHub ↗

Returns the number of examples written to the given path.

(
      self,
      examples: Iterable[KeyExample],
      path: epath.Path,
  )

Source from the content-addressed store, hash-verified

286 )
287
288 def write(
289 self,
290 examples: Iterable[KeyExample],
291 path: epath.Path,
292 ) -> int:
293 """Returns the number of examples written to the given path."""
294 (for_writing, for_counting) = itertools.tee(examples, 2)
295
296 def serialize_examples() -> Iterator[type_utils.KeySerializedExample]:
297 for k, v in for_writing:
298 yield k, self._serialize_example(v)
299
300 self._example_writer.write(path=path, examples=serialize_examples())
301 num_examples = sum(1 for _ in for_counting)
302
303 return num_examples
304
305 def write_with_beam(
306 self,

Callers 2

write_examplesMethod · 0.95

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected