original_docstring: 
      Creates a "clean" MNIST dataset, which is a the MNIST dataset (with potential transformations applied),
      but no triggers.
      :param input_train_csv_path: path to the CSV file containing the training data.  The format of the CSV file is
                                   is specified by the mnist_utils.convert() function
      :param input_test_csv_path:  path to the CSV file containing the test data.  The format of the CSV file is
                                   is specified by the mnist_utils.convert() function
      :param output_rootdir: the root directory into which the clean data will be stored.
                              training data will be stored in: output_rootdir/train
                              test data will be stored in: output_rootdir/test
      :param output_train_csv_file: a CSV file of the training data, which specifies paths to files, and their
                                    associated labels
      :param output_test_csv_file: a CSV file of the test data, which specifies paths to files, and their
                                    associated labels
      :param train_fname_prefix: a prefix to every training filename
      :param test_fname_prefix: a prefix to every test filename
      :param xforms: a dictionary which contains the necessary transformations to be applied to each input image.
                      The configuration is validated by _validate_create_clean_dataset_cfgdict(), but at a high level,
                      the dictionary must contain the 'transforms' key, and that must be a list of transformations to
                      be applied.
      :param random_state_obj: object used to derive random states for each image that is generated
      :return: None
      
docstring: Creates a "clean" MNIST dataset, which is a the MNIST dataset (with potential transformations applied),
  but no triggers.
docstring_tokens: Creates a " clean " MNIST dataset which is a the MNIST dataset ( with potential transformations applied ) but no triggers .
code: def create_clean_dataset(input_train_csv_path: str, input_test_csv_path: str,
                           output_rootdir: str, output_train_csv_file: str, output_test_csv_file: str,
                           train_fname_prefix: str, test_fname_prefix: str, xforms: Sequence[dg_transform.Transform],
                           random_state_obj: RandomState) -> None:
      """
      Creates a "clean" MNIST dataset, which is a the MNIST dataset (with potential transformations applied),
      but no triggers.
      :param input_train_csv_path: path to the CSV file containing the training data.  The format of the CSV file is
                                   is specified by the mnist_utils.convert() function
      :param input_test_csv_path:  path to the CSV file containing the test data.  The format of the CSV file is
                                   is specified by the mnist_utils.convert() function
      :param output_rootdir: the root directory into which the clean data will be stored.
                              training data will be stored in: output_rootdir/train
                              test data will be stored in: output_rootdir/test
      :param output_train_csv_file: a CSV file of the training data, which specifies paths to files, and their
                                    associated labels
      :param output_test_csv_file: a CSV file of the test data, which specifies paths to files, and their
                                    associated labels
      :param train_fname_prefix: a prefix to every training filename
      :param test_fname_prefix: a prefix to every test filename
      :param xforms: a dictionary which contains the necessary transformations to be applied to each input image.
                      The configuration is validated by _validate_create_clean_dataset_cfgdict(), but at a high level,
                      the dictionary must contain the 'transforms' key, and that must be a list of transformations to
                      be applied.
      :param random_state_obj: object used to derive random states for each image that is generated
      :return: None
      """
      # input error checking
      if not _validate_create_clean_dataset_cfgdict(xforms):
          raise ValueError("mod_cfg argument incorrectly specified!")
  
      # create a fresh version of the directory
      try:
          shutil.rmtree(output_rootdir)
      except:
          pass
  
      X_train, y_train = load_dataset(input_train_csv_path)
      X_test, y_test = load_dataset(input_test_csv_path)
      train_output_subdir = 'train'
      test_output_subdir = 'test'
  
      # make necessary sub-directories
      try:
          os.makedirs(os.path.join(output_rootdir, train_output_subdir))
      except:
          pass
      try:
          os.makedirs(os.path.join(output_rootdir, test_output_subdir))
      except:
          pass
  
      random_state = random_state_obj.get_state()
      clean_train_output_list = _df_iterate_store(X_train, y_train,
                                                  train_fname_prefix, output_rootdir,
                                                  train_output_subdir,
                                                  xforms,
                                                  random_state_obj,
                                                  output_file_start_counter=0)
      # reset state to ensure reproducibility regardless of the # of data points generated
      random_state_obj.set_state(random_state)
      clean_test_output_list = _df_iterate_store(X_test, y_test,
                                                 test_fname_prefix, output_rootdir,
                                                 test_output_subdir,
                                                 xforms,
                                                 random_state_obj,
                                                 output_file_start_counter=0)
  
      keys = ['file', 'label']
      with open(os.path.join(output_rootdir, output_train_csv_file), 'w') as output_file:
          dict_writer = csv.DictWriter(output_file, keys)
          dict_writer.writeheader()
          dict_writer.writerows(clean_train_output_list)
      with open(os.path.join(output_rootdir, output_test_csv_file), 'w') as output_file:
          dict_writer = csv.DictWriter(output_file, keys)
          dict_writer.writeheader()
          dict_writer.writerows(clean_test_output_list)
code_tokens: def create_clean_dataset ( input_train_csv_path : str , input_test_csv_path : str , output_rootdir : str , output_train_csv_file : str , output_test_csv_file : str , train_fname_prefix : str , test_fname_prefix : str , xforms : Sequence [ dg_transform . Transform ] , random_state_obj : RandomState ) -> None : if not _validate_create_clean_dataset_cfgdict ( xforms ) : raise ValueError ( "mod_cfg argument incorrectly specified!" ) try : shutil . rmtree ( output_rootdir ) except : pass X_train , y_train = load_dataset ( input_train_csv_path ) X_test , y_test = load_dataset ( input_test_csv_path ) train_output_subdir = 'train' test_output_subdir = 'test' try : os . makedirs ( os . path . join ( output_rootdir , train_output_subdir ) ) except : pass try : os . makedirs ( os . path . join ( output_rootdir , test_output_subdir ) ) except : pass random_state = random_state_obj . get_state ( ) clean_train_output_list = _df_iterate_store ( X_train , y_train , train_fname_prefix , output_rootdir , train_output_subdir , xforms , random_state_obj , output_file_start_counter = 0 ) random_state_obj . set_state ( random_state ) clean_test_output_list = _df_iterate_store ( X_test , y_test , test_fname_prefix , output_rootdir , test_output_subdir , xforms , random_state_obj , output_file_start_counter = 0 ) keys = [ 'file' , 'label' ] with open ( os . path . join ( output_rootdir , output_train_csv_file ) , 'w' ) as output_file : dict_writer = csv . DictWriter ( output_file , keys ) dict_writer . writeheader ( ) dict_writer . writerows ( clean_train_output_list ) with open ( os . path . join ( output_rootdir , output_test_csv_file ) , 'w' ) as output_file : dict_writer = csv . DictWriter ( output_file , keys ) dict_writer . writeheader ( ) dict_writer . writerows ( clean_test_output_list )
short_docstring: Creates a "clean" MNIST dataset, which is a the MNIST dataset (with potential transformations applied),
  but no triggers.
short_docstring_tokens: Creates a " clean " MNIST dataset which is a the MNIST dataset ( with potential transformations applied ) but no triggers .
comment: """
      Creates a "clean" MNIST dataset, which is a the MNIST dataset (with potential transformations applied),
      but no triggers.
      :param input_train_csv_path: path to the CSV file containing the training data.  The format of the CSV file is
                                   is specified by the mnist_utils.convert() function
      :param input_test_csv_path:  path to the CSV file containing the test data.  The format of the CSV file is
                                   is specified by the mnist_utils.convert() function
      :param output_rootdir: the root directory into which the clean data will be stored.
                              training data will be stored in: output_rootdir/train
                              test data will be stored in: output_rootdir/test
      :param output_train_csv_file: a CSV file of the training data, which specifies paths to files, and their
                                    associated labels
      :param output_test_csv_file: a CSV file of the test data, which specifies paths to files, and their
                                    associated labels
      :param train_fname_prefix: a prefix to every training filename
      :param test_fname_prefix: a prefix to every test filename
      :param xforms: a dictionary which contains the necessary transformations to be applied to each input image.
                      The configuration is validated by _validate_create_clean_dataset_cfgdict(), but at a high level,
                      the dictionary must contain the 'transforms' key, and that must be a list of transformations to
                      be applied.
      :param random_state_obj: object used to derive random states for each image that is generated
      :return: None
      """$SEP$# input error checking$SEP$# create a fresh version of the directory$SEP$# make necessary sub-directories$SEP$# reset state to ensure reproducibility regardless of the # of data points generated