class_docstr: Base class of trainer extensions.
  
  Extension of :class:`Trainer` is a callable object that takes the trainer
  object as the argument. It also provides some default configurations as its
  attributes, e.g. the default trigger and the default priority. This class
  provides a set of typical default values for these attributes.
  
  There are three ways to define users' own extensions: inheriting this
  class, decorating closures by :func:`make_extension`, or using any callable
  including lambda functions as extensions. Decorator can slightly reduce the
  overhead and is much easier to use, while this class provides more
  flexibility (for example, it can have methods to configure the behavior).
  Using a lambda function allows one-line coding for simple purposes, but
  users have to specify the configurations as arguments to
  :meth:`Trainer.extend`. For a callable not inheriting this class, the
  default configurations of this class are used unless the user explicitly
  specifies them in :meth:`Trainer.extend` method.
  
  Attributes:
      trigger: Default value of trigger for this extension. It is set to
          ``(1, 'iteration')`` by default.
      priority: Default priority of the extension. It is set to
          ``PRIORITY_READER`` by default.
      ~Extension.name: Name of the extension. It is set to
          ``None`` by default. This value will be overwritten when
          registering an extension to a trainer. See
          :meth:`chainer.training.Trainer.extend` for details.
class_docstr_tok: ["Base","class","of","trainer","extensions",".","Extension","of",":","class",":","`","Trainer","`","is","a","callable","object","that","takes","the","trainer","object","as","the","argument",".","It","also","provides","some","default","configurations","as","its","attributes",",","e.g",".","the","default","trigger","and","the","default","priority",".","This","class","provides","a","set","of","typical","default","values","for","these","attributes",".","There","are","three","ways","to","define","users","'","own","extensions",":","inheriting","this","class",",","decorating","closures","by",":","func",":","`","make_extension","`",",","or","using","any","callable","including","lambda","functions","as","extensions",".","Decorator","can","slightly","reduce","the","overhead","and","is","much","easier","to","use",",","while","this","class","provides","more","flexibility","(","for","example",",","it","can","have","methods","to","configure","the","behavior",")",".","Using","a","lambda","function","allows","one-line","coding","for","simple","purposes",",","but","users","have","to","specify","the","configurations","as","arguments","to",":","meth",":","`","Trainer.extend","`",".","For","a","callable","not","inheriting","this","class",",","the","default","configurations","of","this","class","are","used","unless","the","user","explicitly","specifies","them","in",":","meth",":","`","Trainer.extend","`","method",".","Attributes",":","trigger",":","Default","value","of","trigger","for","this","extension",".","It","is","set","to","``","(","1",",","'iteration","'",")","``","by","default",".","priority",":","Default","priority","of","the","extension",".","It","is","set","to","``","PRIORITY_READER","``","by","default",".","~Extension.name",":","Name","of","the","extension",".","It","is","set","to","``","None","``","by","default",".","This","value","will","be","overwritten","when","registering","an","extension","to","a","trainer",".","See",":","meth",":","`","chainer.training.Trainer.extend","`","for","details","."]
docstr: Invokes the extension.
  
  Implementations should override this operator. This method is called
  at iterations which the corresponding trigger accepts.
  
  Args:
      trainer (Trainer): Trainer object that calls this operator.
docstr_tok: ["Invokes","the","extension",".","Implementations","should","override","this","operator",".","This","method","is","called","at","iterations","which","the","corresponding","trigger","accepts",".","Args",":","trainer","(","Trainer",")",":","Trainer","object","that","calls","this","operator","."]
code: def __call__(self, trainer):
      """Invokes the extension.
  
      Implementations should override this operator. This method is called
      at iterations which the corresponding trigger accepts.
  
      Args:
          trainer (Trainer): Trainer object that calls this operator.
  
      """
      raise NotImplementedError(
          "Extension implementation must override __call__."
      )
  
file_path: chainer/chainer/training/extension.py
imports: from chainer.utils import argument
label_desc: Use image node_id 2 for calling the Extension obj's underlying member method code with example usage: obj.__call__(trainer) without return types