original_docstring: 
      Writes a dataset to a file in TFRecord format. The dataset must be an array with one row per example and at least
      one column with the file path to each example data, and one optional column for its label.
      The data for each example is read and saved serialized into the TFRecord file along with its label (if any).
  
      :param dataset: Input dataset array.
      :type dataset: numpy.ndarray
      :param file_path: Path where the output file will be placed. It shall have `*.tfrecord` extension.
      :type file_path: str
      :param data_preprocessing_function: Function to be applied on the first column of each example (file path), which
          is supposed to load the example data and perform any additional preprocessing. It must return the data
          in any of the supported formats for serialization (bytes or list of numbers), along with the
          data type (after loading and preprocessing) and the original data shape (after loading and preprocessing but
          before flattening). It will also return an example ID, used to identify the example (for instance, the original
          file name). This ID is not used internally but it is useful for further usages of the dataset.
          Optional, default: npy_data_preprocessor (see above).
      :type data_preprocessing_function: (str) -> tuple[Union[bytes, list[float], list[int]], type, tuple[int], str]
      :raises ValueError: If the label type conversion is not possible.
      :raises OSError: If there is a problem reading the example data from the file path.
      
docstring: Writes a dataset to a file in TFRecord format. The dataset must be an array with one row per example and at least
  one column with the file path to each example data, and one optional column for its label.
  The data for each example is read and saved serialized into the TFRecord file along with its label (if any).
docstring_tokens: Writes a dataset to a file in TFRecord format . The dataset must be an array with one row per example and at least one column with the file path to each example data and one optional column for its label . The data for each example is read and saved serialized into the TFRecord file along with its label ( if any ) .
code: def write_dataset_to_file(
          dataset,
          file_path,
          data_preprocessing_function=npy_data_preprocessor):
      """
      Writes a dataset to a file in TFRecord format. The dataset must be an array with one row per example and at least
      one column with the file path to each example data, and one optional column for its label.
      The data for each example is read and saved serialized into the TFRecord file along with its label (if any).
  
      :param dataset: Input dataset array.
      :type dataset: numpy.ndarray
      :param file_path: Path where the output file will be placed. It shall have `*.tfrecord` extension.
      :type file_path: str
      :param data_preprocessing_function: Function to be applied on the first column of each example (file path), which
          is supposed to load the example data and perform any additional preprocessing. It must return the data
          in any of the supported formats for serialization (bytes or list of numbers), along with the
          data type (after loading and preprocessing) and the original data shape (after loading and preprocessing but
          before flattening). It will also return an example ID, used to identify the example (for instance, the original
          file name). This ID is not used internally but it is useful for further usages of the dataset.
          Optional, default: npy_data_preprocessor (see above).
      :type data_preprocessing_function: (str) -> tuple[Union[bytes, list[float], list[int]], type, tuple[int], str]
      :raises ValueError: If the label type conversion is not possible.
      :raises OSError: If there is a problem reading the example data from the file path.
      """
      # If the labels column is present, guess the data type of the labels.
      if len(dataset) > 0 and dataset.shape[1] > 1:
          label_type = type(dataset[0, 1])
      else:
          label_type = None
      # Prepare to write to a TFRecord file.
      writer = tf.data.experimental.TFRecordWriter(file_path)
      # Serialize dataset examples. The dataset must have all columns of the same type. They are converted to
      # str since the paths will be str, and the label type is passed as a parameter to recover the label to its
      # original type inside the function.
      serialized_dataset = tf.data.Dataset.from_tensor_slices(dataset.astype(str))\
          .map(lambda ex: _tf_serialize_example(ex, data_preprocessing_function, label_type),
               num_parallel_calls=tf.data.AUTOTUNE)
      # Write to file.
      writer.write(serialized_dataset)
code_tokens: def write_dataset_to_file ( dataset , file_path , data_preprocessing_function = npy_data_preprocessor ) : if len ( dataset ) > 0 and dataset . shape [ 1 ] > 1 : label_type = type ( dataset [ 0 , 1 ] ) else : label_type = None writer = tf . data . experimental . TFRecordWriter ( file_path ) serialized_dataset = tf . data . Dataset . from_tensor_slices ( dataset . astype ( str ) ) . map ( lambda ex : _tf_serialize_example ( ex , data_preprocessing_function , label_type ) , num_parallel_calls = tf . data . AUTOTUNE ) writer . write ( serialized_dataset )
short_docstring: Writes a dataset to a file in TFRecord format.
short_docstring_tokens: Writes a dataset to a file in TFRecord format .
comment: """
      Writes a dataset to a file in TFRecord format. The dataset must be an array with one row per example and at least
      one column with the file path to each example data, and one optional column for its label.
      The data for each example is read and saved serialized into the TFRecord file along with its label (if any).
  
      :param dataset: Input dataset array.
      :type dataset: numpy.ndarray
      :param file_path: Path where the output file will be placed. It shall have `*.tfrecord` extension.
      :type file_path: str
      :param data_preprocessing_function: Function to be applied on the first column of each example (file path), which
          is supposed to load the example data and perform any additional preprocessing. It must return the data
          in any of the supported formats for serialization (bytes or list of numbers), along with the
          data type (after loading and preprocessing) and the original data shape (after loading and preprocessing but
          before flattening). It will also return an example ID, used to identify the example (for instance, the original
          file name). This ID is not used internally but it is useful for further usages of the dataset.
          Optional, default: npy_data_preprocessor (see above).
      :type data_preprocessing_function: (str) -> tuple[Union[bytes, list[float], list[int]], type, tuple[int], str]
      :raises ValueError: If the label type conversion is not possible.
      :raises OSError: If there is a problem reading the example data from the file path.
      """$SEP$# If the labels column is present, guess the data type of the labels.$SEP$# Prepare to write to a TFRecord file.$SEP$# Serialize dataset examples. The dataset must have all columns of the same type. They are converted to$SEP$# str since the paths will be str, and the label type is passed as a parameter to recover the label to its$SEP$# original type inside the function.$SEP$# Write to file.