def write_unmasked_log(log, id_to_word, sequence_eval): """Helper function for logging evaluated sequences without mask.""" indices_arr = np.asarray(sequence_eval) samples = helper.convert_to_human_readable(id_to_word, indices_arr, FLAGS.batch_size) for sample in samples: log.write(sample + '\n') log.flush() return samples
def write_unmasked_log(log, id_to_word, sequence_eval): """Helper function for logging evaluated sequences without mask.""" indices_arr = np.asarray(sequence_eval) samples = helper.convert_to_human_readable(id_to_word, indices_arr, FLAGS.batch_size) for sample in samples: log.write(sample + '\n') log.flush() return samples
def print_and_log(log, id_to_word, sequence_eval, max_num_to_print=5): """Helper function for printing and logging evaluated sequences.""" indices_arr = np.asarray(sequence_eval) samples = helper.convert_to_human_readable(id_to_word, indices_arr, max_num_to_print) for i, sample in enumerate(samples): print('Sample', i, '. ', sample) log.write('\nSample ' + str(i) + '. ' + sample) log.write('\n') print('\n') log.flush() return samples
def print_and_log(log, id_to_word, sequence_eval, max_num_to_print=5): """Helper function for printing and logging evaluated sequences.""" indices_arr = np.asarray(sequence_eval) samples = helper.convert_to_human_readable(id_to_word, indices_arr, max_num_to_print) for i, sample in enumerate(samples): print('Sample', i, '. ', sample) log.write('\nSample ' + str(i) + '. ' + sample) log.write('\n') print('\n') log.flush() return samples