class_docstr: Function hook for measuring memory usage of functions in cupy memory pool.
  
  Example:
      Code example::
  
          from chainer.function_hooks import CupyMemoryProfileHook
          hook = CupyMemoryProfileHook()
          with hook:
              trainer.run()
          hook.print_report()
  
      Output example::
  
                 FunctionName  UsedBytes  AcquiredBytes  Occurrence
               LinearFunction     5.16GB       179.98MB        3900
                         ReLU     0.99GB       458.97MB        2600
          SoftmaxCrossEntropy     0.01GB         5.08MB        1300
                     Accuracy     0.00GB         0.35MB         700
  
      where *FunctionName* is the name of function that calls the hook, and
      *UsedBytes* is the memory bytes the function used from cupy memory
      pool, and *AcquiredBytes* is the actual memory bytes the cupy memory
      pool acquired from GPU device on the function call, and *Occurrence*
      is the number of calls.
  Attributes:
      call_history: List of measurement results. It consists of the name of
          the function that calls this hook, the memory bytes the function
          used from cupy memory pool, and the memory bytes the cupy memory
          pool acquired from GPU device on the function call.
class_docstr_tok: ["Function","hook","for","measuring","memory","usage","of","functions","in","cupy","memory","pool",".","Example",":","Code","example",":",":","from","chainer.function_hooks","import","CupyMemoryProfileHook","hook","=","CupyMemoryProfileHook","(",")","with","hook",":","trainer.run","(",")","hook.print_report","(",")","Output","example",":",":","FunctionName","UsedBytes","AcquiredBytes","Occurrence","LinearFunction","5.16GB","179.98MB","3900","ReLU","0.99GB","458.97MB","2600","SoftmaxCrossEntropy","0.01GB","5.08MB","1300","Accuracy","0.00GB","0.35MB","700","where","*","FunctionName","*","is","the","name","of","function","that","calls","the","hook",",","and","*","UsedBytes","*","is","the","memory","bytes","the","function","used","from","cupy","memory","pool",",","and","*","AcquiredBytes","*","is","the","actual","memory","bytes","the","cupy","memory","pool","acquired","from","GPU","device","on","the","function","call",",","and","*","Occurrence","*","is","the","number","of","calls",".","Attributes",":","call_history",":","List","of","measurement","results",".","It","consists","of","the","name","of","the","function","that","calls","this","hook",",","the","memory","bytes","the","function","used","from","cupy","memory","pool",",","and","the","memory","bytes","the","cupy","memory","pool","acquired","from","GPU","device","on","the","function","call","."]
docstr: Choose optimal unit.
  
  Returns:
      Tuple of denomi (float) and human-readable unit (str).
docstr_tok: ["Choose","optimal","unit",".","Returns",":","Tuple","of","denomi","(","float",")","and","human-readable","unit","(","str",")","."]
code: def _choose_unit(self, size):
      """Choose optimal unit.
  
      Returns:
          Tuple of denomi (float) and human-readable unit (str).
      """
      denomi = 1.0
      if size <= 0:
          return denomi, self._units[0]
      for unit in self._units[:-1]:
          if size / (denomi * 1024) < 1:
              return denomi, unit
          denomi *= 1024
      return denomi, self._units[-1]
  
imports: import collections
  import sys
  import typing
  from chainer.backends import cuda
  from chainer import function_hook
label_desc: Use image node_id 13 for calling the CupyMemoryProfileHook obj's underlying member method code with example usage: obj._choose_unit(size) and returns: denomi,  self, denomi,  self, denomi,  unit