class_docstr: GraphProfiler
  Class for measuring calculation time of each functions which compose nnabla computation graph.
  
  You can check some performances of your nnabla network.
  This can measure the calculation times of :
  
  * function-wise forward
  * function-wise backward
  * whole graph forward
  * whole graph backward
  * training (forward + backward + update) (if ``solver`` is not None)
  
  Example:
  
  .. code-block:: python
  
      import nnabla as nn
      import nnabla.functions as F
      import nnabla.solvers as S
      from nnabla.utils.profiler import GraphProfiler
  
      # Set up nnabla context
      device = "cpu"  # you can also use GPU ("cudnn")
      ctx = get_extension_context(device)
      nn.set_default_context(ctx)
  
      # Network building
      x = nn.Variable(shape=...)
      t = nn.Variable(shape=...)
      y = CNN(x) # you can build not only CNN but any networks
      loss = F.mean(F.softmax_cross_entropy(y, t)) # any loss functions or variables can be used
  
      # solver setting
      solver = S.Sgd()
      solver.set_parameters(nn.get_parameters())
  
      # SOME CODE (data loading or so on)
  
      B = GraphProfiler(loss, solver=solver, device_id=0, ext_name=device, n_run=1000)
      B.run()
  
  Args:
      graph (:class:`nnabla.Variable`):
          Instance of `nnabla.Variable` class.
          GraphProfiler find all functions which compose network graph from root `nnabla.Variable` to this `nnabla.Variable`.
      device_id (str):
          gpu device id.
      ext_name (str):
          Extension name. e.g. 'cpu', 'cuda', 'cudnn' etc.
      solver (:class:`nnabla.solvers.Solver`):
          Instance of `nnabla.solvers.Solver` for optimizing the parameters of the computation graph.
          if None, the training process is ignored.
          Default value is None.
      n_run (int):
          This argument specifies how many times the each functions` execution time are measured.
          Default value is 100.
      max_measure_execution_time (float):
          Maximum time of executing measurement for each functions.
          This argument has higher priority than ``n_run``.
          When the measurement time for each functions get bigger than this argument,
          this class stops measuring and goes to next function, unless the total times of measurement are less than n_run.
          Default value is 1 [sec].
      time_scale (str):
          Time scale to display. ['m', 'u', 'n'] (which stands for 'mili', 'micro' and 'nano')
      backward_accum(bool):
          Accumulation flag passed to the each backward function. The flag will fulfill the all accumulation flags
          with the same value of backward_accum. This flag is only valid for the time measurement of each function.
          For whole graph computation, the NNabla graph engine set the appropriate accumulation flags to functions.
          Pay attention to inplace flag for your graph because accumulation and inplace flags cannot be set
          at the same time. If even one inplace flag is true in your graph, this backward_accum must be false.
          Default value is False.
class_docstr_tok: ["GraphProfiler","Class","for","measuring","calculation","time","of","each","functions","which","compose","nnabla","computation","graph",".","You","can","check","some","performances","of","your","nnabla","network",".","This","can","measure","the","calculation","times","of",":","*","function-wise","forward","*","function-wise","backward","*","whole","graph","forward","*","whole","graph","backward","*","training","(","forward","+","backward","+","update",")","(","if","``","solver","``","is","not","None",")","Example",":","..","code-block",":",":","python","import","nnabla","as","nn","import","nnabla.functions","as","F","import","nnabla.solvers","as","S","from","nnabla.utils.profiler","import","GraphProfiler","#","Set","up","nnabla","context","device","=","``","cpu","''","#","you","can","also","use","GPU","(","``","cudnn","''",")","ctx","=","get_extension_context","(","device",")","nn.set_default_context","(","ctx",")","#","Network","building","x","=","nn.Variable","(","shape=","...",")","t","=","nn.Variable","(","shape=","...",")","y","=","CNN","(","x",")","#","you","can","build","not","only","CNN","but","any","networks","loss","=","F.mean","(","F.softmax_cross_entropy","(","y",",","t",")",")","#","any","loss","functions","or","variables","can","be","used","#","solver","setting","solver","=","S.Sgd","(",")","solver.set_parameters","(","nn.get_parameters","(",")",")","#","SOME","CODE","(","data","loading","or","so","on",")","B","=","GraphProfiler","(","loss",",","solver=solver",",","device_id=0",",","ext_name=device",",","n_run=1000",")","B.run","(",")","Args",":","graph","(",":","class",":","`","nnabla.Variable","`",")",":","Instance","of","`","nnabla.Variable","`","class",".","GraphProfiler","find","all","functions","which","compose","network","graph","from","root","`","nnabla.Variable","`","to","this","`","nnabla.Variable","`",".","device_id","(","str",")",":","gpu","device","id",".","ext_name","(","str",")",":","Extension","name",".","e.g",".","'cpu","'",",","'cuda","'",",","'cudnn","'","etc",".","solver","(",":","class",":","`","nnabla.solvers.Solver","`",")",":","Instance","of","`","nnabla.solvers.Solver","`","for","optimizing","the","parameters","of","the","computation","graph",".","if","None",",","the","training","process","is","ignored",".","Default","value","is","None",".","n_run","(","int",")",":","This","argument","specifies","how","many","times","the","each","functions","`","execution","time","are","measured",".","Default","value","is","100.","max_measure_execution_time","(","float",")",":","Maximum","time","of","executing","measurement","for","each","functions",".","This","argument","has","higher","priority","than","``","n_run","``",".","When","the","measurement","time","for","each","functions","get","bigger","than","this","argument",",","this","class","stops","measuring","and","goes","to","next","function",",","unless","the","total","times","of","measurement","are","less","than","n_run",".","Default","value","is","1","[","sec","]",".","time_scale","(","str",")",":","Time","scale","to","display",".","[","'m","'",",","'","u","'",",","'n","'","]","(","which","stands","for","'mili","'",",","'micro","'","and","'nano","'",")","backward_accum","(","bool",")",":","Accumulation","flag","passed","to","the","each","backward","function",".","The","flag","will","fulfill","the","all","accumulation","flags","with","the","same","value","of","backward_accum",".","This","flag","is","only","valid","for","the","time","measurement","of","each","function",".","For","whole","graph","computation",",","the","NNabla","graph","engine","set","the","appropriate","accumulation","flags","to","functions",".","Pay","attention","to","inplace","flag","for","your","graph","because","accumulation","and","inplace","flags","can","not","be","set","at","the","same","time",".","If","even","one","inplace","flag","is","true","in","your","graph",",","this","backward_accum","must","be","false",".","Default","value","is","False","."]
code: def print_result(self):
      print("time scale: {}".format(self.time_scale))
      print("-----------------forward--------------------")
      for x in self.result["forward"]:
          print(x)
      print()
  
      print("-----------------backward--------------------")
      for x in self.result["backward"]:
          print(x)
      print()
  
      print(
          "all forward: {}, all backward: {}".format(
              self.result["forward_all"], self.result["backward_all"]
          )
      )
  
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 10 for calling the GraphProfiler obj's underlying member method code with example usage: obj.print_result() without return types