class_docstr: GraphProfilerCsvWriter
  csv writer for GraphProfiler class.
  
  Example:
  
  .. code-block:: python
  
      from nnabla.utils.profiler import GraphProfiler, GraphProfilerCsvWriter
  
      # Network building comes above
  
      B = GraphProfiler(variable, solver=solver, device_id=0, ext_name=device, n_run=1000)
      B.run()
  
      with open("./profile.csv", "w") as f:
          writer = GraphProfilerCsvWriter(B, file=f)
          writer.write()
  
  Args:
      gb (:py:class:`GraphProfiler <nnabla.utils.profile.GraphProfiler>`):
          Instance of GraphProfiler class which is main executor of profiling.
      file (Python file object):
          Output file object.
          Profile results will be written to the file which is specified by this argument.
class_docstr_tok: ["GraphProfilerCsvWriter","csv","writer","for","GraphProfiler","class",".","Example",":","..","code-block",":",":","python","from","nnabla.utils.profiler","import","GraphProfiler",",","GraphProfilerCsvWriter","#","Network","building","comes","above","B","=","GraphProfiler","(","variable",",","solver=solver",",","device_id=0",",","ext_name=device",",","n_run=1000",")","B.run","(",")","with","open","(","``",".\/profile.csv","''",",","``","w","''",")","as","f",":","writer","=","GraphProfilerCsvWriter","(","B",",","file=f",")","writer.write","(",")","Args",":","gb","(",":","py",":","class",":","`","GraphProfiler","<","nnabla.utils.profile.GraphProfiler",">","`",")",":","Instance","of","GraphProfiler","class","which","is","main","executor","of","profiling",".","file","(","Python","file","object",")",":","Output","file","object",".","Profile","results","will","be","written","to","the","file","which","is","specified","by","this","argument","."]
docstr: Write result to the file.
  The output file is specified by ``file``.
docstr_tok: ["Write","result","to","the","file",".","The","output","file","is","specified","by","``","file","``","."]
code: def write(self):
      """
      Write result to the file.
      The output file is specified by ``file``.
      """
      writer = csv.writer(self.file)
  
      for f, b in zip(
          self.gb.result["forward"], self.gb.result["backward"]
      ):
          f = f._asdict()
          b = b._asdict()
          if not self.check_same(f, b):
              raise AssertionError()
  
          args_info = ", ".join(
              ["{}: {}".format(k, v) for k, v in f["args_info"]]
          )
  
          out = [
              f["parameter_scope"],
              f["function_name"],
              f["inputs_shape"],
              args_info,
              f["mean_time"],
              b["mean_time"],
              f["n_run"],
              b["n_run"],
          ]
  
          writer.writerow(out)
  
      writer.writerow([])
      writer.writerow(["forward all", self.gb.result["forward_all"]])
      writer.writerow(
          ["forward_all_n_run", self.gb.result["n_run_forward_all"]]
      )
  
      writer.writerow([])
      writer.writerow(["backward all", self.gb.result["backward_all"]])
      writer.writerow(
          ["backward_all_n_run", self.gb.result["n_run_backward_all"]]
      )
  
      if set(self.gb.result.keys()) >= {"training", "n_run_training"}:
          writer.writerow([])
          writer.writerow(
              [
                  "training(forward + backward + update)",
                  self.gb.result["training"],
              ]
          )
          writer.writerow(
              ["training_n_run", self.gb.result["n_run_training"]]
          )
  
imports: from __future__ import division, print_function
  import csv
  import os
  import sys
  import time
  from collections import namedtuple
  from functools import partial
  import nnabla
  from nnabla.ext_utils import import_extension_module
label_desc: Use image node_id 4 for calling the GraphProfilerCsvWriter obj's underlying member method code with example usage: obj.write() without return types