class_docstr: Shuffles and writes Examples to sharded TFRecord files.
  
  The number of shards is computed automatically.
class_docstr_tok: ["Shuffles","and","writes","Examples","to","sharded","TFRecord","files",".","The","number","of","shards","is","computed","automatically","."]
docstr: Initializes Writer.
  
  Args:
    serializer: class that can serialize examples.
    filename_template: template to format sharded filenames.
    hash_salt (str or bytes): salt to hash keys.
    disable_shuffling (bool): Specifies whether to shuffle the records.
    file_format (FileFormat): format of the record files in which the dataset
      should be written in.
    shard_config: the configuration for creating shards.
docstr_tok: ["Initializes","Writer",".","Args",":","serializer",":","class","that","can","serialize","examples",".","filename_template",":","template","to","format","sharded","filenames",".","hash_salt","(","str","or","bytes",")",":","salt","to","hash","keys",".","disable_shuffling","(","bool",")",":","Specifies","whether","to","shuffle","the","records",".","file_format","(","FileFormat",")",":","format","of","the","record","files","in","which","the","dataset","should","be","written","in",".","shard_config",":","the","configuration","for","creating","shards","."]
code: def __init__(
      self,
      serializer: example_serializer.Serializer,
      filename_template: naming.ShardedFileTemplate,
      hash_salt,
      disable_shuffling: bool,
      file_format=file_adapters.DEFAULT_FILE_FORMAT,
      shard_config: Optional[shard_utils.ShardConfig] = None,
  ):
      """Initializes Writer.
  
      Args:
        serializer: class that can serialize examples.
        filename_template: template to format sharded filenames.
        hash_salt (str or bytes): salt to hash keys.
        disable_shuffling (bool): Specifies whether to shuffle the records.
        file_format (FileFormat): format of the record files in which the dataset
          should be written in.
        shard_config: the configuration for creating shards.
      """
      self._serializer = serializer
      self._shuffler = shuffle.Shuffler(
          dirpath=filename_template.data_dir,
          hash_salt=hash_salt,
          disable_shuffling=disable_shuffling,
      )
      self._num_examples = 0
      self._filename_template = filename_template
      self._file_format = file_format
      self._shard_config = shard_config or shard_utils.ShardConfig()
  
imports: import dataclasses
  import functools
  import itertools
  import json
  import os
  from typing import Any, Iterable, List, Optional, Tuple
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core import example_parser
  from tensorflow_datasets.core import example_serializer
  from tensorflow_datasets.core import file_adapters
  from tensorflow_datasets.core import hashing
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import shuffle
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.utils import file_utils
  from tensorflow_datasets.core.utils import shard_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import apache_beam
label_desc: Use image node_id 1 to create a new Writer object from inherited base classes: object with example: obj = Writer(serializer, filename_template, hash_salt, disable_shuffling, file_format, shard_config)