class_docstr: A callback to write prediction outputs to a CSV file.
  
  This callback provides an interface to simplify writing outputs during prediction
  into a CSV file. This callback must be extended with an implementation for
  ``get_step_output_rows`` to write the desired outputs as rows in the CSV file.
  
  By default, outputs at each step across all processes will be written into the same CSV file.
  The outputs in each row is a a list of strings, and should match
  the columns names defined in ``header_row``.
  
  Args:
      header_row: columns of the CSV file
      dir_path: directory path of where to save the CSV file
      delimiter: separate columns in one row. Default is tab
      filename: name of the file. Default filename is "predictions.csv"
class_docstr_tok: ["A","callback","to","write","prediction","outputs","to","a","CSV","file",".","This","callback","provides","an","interface","to","simplify","writing","outputs","during","prediction","into","a","CSV","file",".","This","callback","must","be","extended","with","an","implementation","for","``","get_step_output_rows","``","to","write","the","desired","outputs","as","rows","in","the","CSV","file",".","By","default",",","outputs","at","each","step","across","all","processes","will","be","written","into","the","same","CSV","file",".","The","outputs","in","each","row","is","a","a","list","of","strings",",","and","should","match","the","columns","names","defined","in","``","header_row","``",".","Args",":","header_row",":","columns","of","the","CSV","file","dir_path",":","directory","path","of","where","to","save","the","CSV","file","delimiter",":","separate","columns","in","one","row",".","Default","is","tab","filename",":","name","of","the","file",".","Default","filename","is","``","predictions.csv","''"]
code: def on_predict_end(self, state: State, unit: TPredictUnit) -> None:
      self._file.flush()
      self._file.close()
  
file_path: tnt/torchtnt/framework/callbacks/base_csv_writer.py
imports: import csv
  import os
  from abc import ABC, abstractmethod
  from typing import Any, List, TextIO, Union
  from pyre_extensions import none_throws
  from torchtnt.framework.callback import Callback
  from torchtnt.framework.state import EntryPoint, State
  from torchtnt.framework.unit import TEvalUnit, TPredictUnit, TTrainUnit
  from torchtnt.utils import get_filesystem, get_global_rank
label_desc: Use image node_id 5 for calling the BaseCSVWriter obj's underlying member method code with example usage: obj.on_predict_end(state, unit) without return types