class_docstr: Callback to log metrics to a given csv file.
  
  Example: ::
  
      >>> from torchbearer.callbacks import CSVLogger
      >>> from torchbearer import Trial
      >>> import torch
  
      # Example Trial (without optimiser or loss criterion) which writes metrics to a csv file appending to previous content
      >>> logger = CSVLogger('my_path.pt', separator=',', append=True)
      >>> trial = Trial(None, callbacks=[logger], metrics=['acc'])
  
  Args:
      filename (str): The name of the file to output to
      separator (str): The delimiter to use (e.g. comma, tab etc.)
      batch_granularity (bool): If True, write on each batch, else on each epoch
      write_header (bool): If True, write the CSV header at the beginning of training
      append (bool): If True, append to the file instead of replacing it
  
  State Requirements:
      - :attr:`torchbearer.state.EPOCH`: State should have the current epoch stored
      - :attr:`torchbearer.state.METRICS`: Metrics dictionary should exist
      - :attr:`torchbearer.state.BATCH`: State should have the current batch stored if using `batch_granularity`
class_docstr_tok: ["Callback","to","log","metrics","to","a","given","csv","file",".","Example",":",":",":",">",">",">","from","torchbearer.callbacks","import","CSVLogger",">",">",">","from","torchbearer","import","Trial",">",">",">","import","torch","#","Example","Trial","(","without","optimiser","or","loss","criterion",")","which","writes","metrics","to","a","csv","file","appending","to","previous","content",">",">",">","logger","=","CSVLogger","(","'my_path.pt","'",",","separator=","'",",","'",",","append=True",")",">",">",">","trial","=","Trial","(","None",",","callbacks=","[","logger","]",",","metrics=","[","'acc","'","]",")","Args",":","filename","(","str",")",":","The","name","of","the","file","to","output","to","separator","(","str",")",":","The","delimiter","to","use","(","e.g",".","comma",",","tab","etc",".",")","batch_granularity","(","bool",")",":","If","True",",","write","on","each","batch",",","else","on","each","epoch","write_header","(","bool",")",":","If","True",",","write","the","CSV","header","at","the","beginning","of","training","append","(","bool",")",":","If","True",",","append","to","the","file","instead","of","replacing","it","State","Requirements",":","-",":","attr",":","`","torchbearer.state.EPOCH","`",":","State","should","have","the","current","epoch","stored","-",":","attr",":","`","torchbearer.state.METRICS","`",":","Metrics","dictionary","should","exist","-",":","attr",":","`","torchbearer.state.BATCH","`",":","State","should","have","the","current","batch","stored","if","using","`","batch_granularity","`"]
code: def on_end_epoch(self, state):
      super(CSVLogger, self).on_end_training(state)
      self._write_to_dict(state)
  
file_path: torchbearer/torchbearer/callbacks/csv_logger.py
imports: import sys
  import torchbearer
  from torchbearer.callbacks import Callback
  import csv
label_desc: Use image node_id 4 for calling the CSVLogger obj's underlying member method code with example usage: obj.on_end_epoch(state) without return types