class_docstr: A function that executes the static schedule of a Chain.
  
  An instance of this class executes the static schedule of computations
  that are equivalent to executing the define-by-run code of a Chain.
  
  This class is used by the `static_graph` decorator to wrap the
  define-by-run
  computations of a chain into two static schedules:
  - The forward schedule corresponds to the computations that are executed by
  the define-by-run code of the `__call__()` method of a chain. The static
  schedule corresponding to these computations can be executed by calling the
  `forward()` method of this class.
  - The backward schedule corresponds to the computations that are executed
  by the sequence of calls to `Function.backward()` that occur during when
  backpropagating the gradients through the same chain. That is, for each
  `Function.forward()` that was called during the forward propagation,
  there will be a corresponding call to `Function.backward()` (of the
  same Function object) in the backward schedule. This backward schedule
  can be executed by calling the `backward()` method of this class.
  
  Note the intended usage of this class:
  
  Recall that a "static chain" referes to a chain that is decorated by the
  `static_graph` decorator.
  During the first forward pass of a static chain, the define-by-run code
  is executed. However,
  for subsequent iterations, that define-by-run code is replaced by an
  instance
  of this function and this function will be called instead. Since the
  static
  schedules contained by this function perform the same computations, it is
  safe (and potentially much more efficient) to simply execute the static
  schedule instead
  of the define-by-run code. See `static_graph` for details.
  
  Args:
      schedule_manager (ScheduleManager): The schedule manager of this
          schedule instance.
      in_vars (tuple of Variable): The flattened tuple of input variables
          that is supplied to
          `__call__()` method of the chain that this schedule corresponds to.
      unique_arrays (list of ndarray): A list of all unique array references
          deeply used in an StaticScheduleFunction instance. It is 'None'
          for the StaticScheduleFunction that corresponds to the "forward"
          schedule, but the contained StaticScheduleFunction for the
          "backward" schedule should take the unique_arrays of the
          "forward" schedule.
class_docstr_tok: ["A","function","that","executes","the","static","schedule","of","a","Chain",".","An","instance","of","this","class","executes","the","static","schedule","of","computations","that","are","equivalent","to","executing","the","define-by-run","code","of","a","Chain",".","This","class","is","used","by","the","`","static_graph","`","decorator","to","wrap","the","define-by-run","computations","of","a","chain","into","two","static","schedules",":","-","The","forward","schedule","corresponds","to","the","computations","that","are","executed","by","the","define-by-run","code","of","the","`","__call__","(",")","`","method","of","a","chain",".","The","static","schedule","corresponding","to","these","computations","can","be","executed","by","calling","the","`","forward","(",")","`","method","of","this","class",".","-","The","backward","schedule","corresponds","to","the","computations","that","are","executed","by","the","sequence","of","calls","to","`","Function.backward","(",")","`","that","occur","during","when","backpropagating","the","gradients","through","the","same","chain",".","That","is",",","for","each","`","Function.forward","(",")","`","that","was","called","during","the","forward","propagation",",","there","will","be","a","corresponding","call","to","`","Function.backward","(",")","`","(","of","the","same","Function","object",")","in","the","backward","schedule",".","This","backward","schedule","can","be","executed","by","calling","the","`","backward","(",")","`","method","of","this","class",".","Note","the","intended","usage","of","this","class",":","Recall","that","a","``","static","chain","''","referes","to","a","chain","that","is","decorated","by","the","`","static_graph","`","decorator",".","During","the","first","forward","pass","of","a","static","chain",",","the","define-by-run","code","is","executed",".","However",",","for","subsequent","iterations",",","that","define-by-run","code","is","replaced","by","an","instance","of","this","function","and","this","function","will","be","called","instead",".","Since","the","static","schedules","contained","by","this","function","perform","the","same","computations",",","it","is","safe","(","and","potentially","much","more","efficient",")","to","simply","execute","the","static","schedule","instead","of","the","define-by-run","code",".","See","`","static_graph","`","for","details",".","Args",":","schedule_manager","(","ScheduleManager",")",":","The","schedule","manager","of","this","schedule","instance",".","in_vars","(","tuple","of","Variable",")",":","The","flattened","tuple","of","input","variables","that","is","supplied","to","`","__call__","(",")","`","method","of","the","chain","that","this","schedule","corresponds","to",".","unique_arrays","(","list","of","ndarray",")",":","A","list","of","all","unique","array","references","deeply","used","in","an","StaticScheduleFunction","instance",".","It","is","'None'","for","the","StaticScheduleFunction","that","corresponds","to","the","``","forward","''","schedule",",","but","the","contained","StaticScheduleFunction","for","the","``","backward","''","schedule","should","take","the","unique_arrays","of","the","``","forward","''","schedule","."]
code: def __init__(
      self,
      schedule_manager,
      verbosity_level=0,
      enable_double_backprop=False,
  ):
      # A pass depth of 0 corresponds to the schedule for the forward pass.
      # A pass depth of 1 corresponds to the schedule for the backward pass.
      # A pass depth of 2 corresponds to the schedule for the
      # double-backward pass, and so on.
      self.pass_depth = 0
      self.schedule_manager = schedule_manager
      # A list of ScheduleInfo objects, each of which contains one function
      # in the static schedule. The order of functions in this list is
      # the order they should be called in the schedule.
      self.schedule_info_list = []
      # A list of all unique ndarrays used in this schedule and any deeply
      # contained schedules (backward, double-backward schedules).
      # That is, it is shared among all pass depths.
      # Note that this typically includes the ndarray attributes of the
      # parameters of the chain, the input variables to the chain,
      # and any intermediate arrays (activations, etc) created while
      # executing the define-by-run code of the chain.
      self.unique_arrays = []
      # A list of UniqueArray objects, where
      # each object contains information such as what the array corresponds
      # to (variable, parameter.data, etc), weak or regular reference,
      # whether
      # it was dynamically allocated or read-only in the schedule.
      # It is the same length as unique_arrays.
      self.unique_array_infos = []
      # Maps id(ndarray) to its position in self.unique_arrays
      # This is shared by this schedule and all deeply-contained schedules.
      self.array_id_to_unique_index = dict()
      self.backward_schedule_func = None
      self.verbosity_level = verbosity_level
      self.enable_double_backprop = enable_double_backprop
      self.in_vars = None
      self.chain = None
      self.schedule_built = False
      # A list of all parameters in the model (i.e., that exist when
      # build_schedule() is called.
      # This is shared among all deeply-contained schedules of this schedule.
      self.params_list = []
      # This list contains the grad_var corresponding to each variable
      # in params_list. This is needed so that we can restore any grad_var
      # that is set to None by outside code.
      # This is shared among all deeply-contained schedules of this schedule.
      self.grad_var_list = []
      # Maps an array id (of a parameter) to its location.
      # id(array) -> (index_in_self.params_list, attribute_location)
      self.array_id_to_param_map = dict()
      # Maps an array id (of an input variable for forward()) to its
      # positional index.
      # id(array) -> (index in inputs argument of forward())
      self.array_id_to_input_var_map = dict()
      # maps a Parameter id to the parameter's index in self.params_list
      self.param_id_to_index = dict()
      # A list of tuples that specify the mappings from static schedule
      # arrays to parameter attributes.
      # These are pre-hooks that are run before running the schedule.
      self.param_hooks = []
      # These are post hooks that are run after executing the schedule.
      # They are used to update parameter attributes from dynamically-
      # allocated arrays in the schedule.
      self.param_post_hooks = []
      # A list of tuples that specify the mappings from static schedule
      # arrays to 'data' array attributes of the output variables.
      self.out_var_hooks = []
      # A list of tuples that specify the mapping from static schedule
      # arrays to input variable index in the "inputs" argument of forward()
      # This is used to update the array references in the static schedule
      # that refer to the data attribute of input variables.
      self.in_var_hooks = []
      self.dynamically_allocated_unique_index = set()
      # Maps an index in unique_arrays to the index in the returned
      # output variables, if the index corresponds to an output
      # variable.
      self.unique_ind_to_out_var_ind = dict()
  
imports: import sys
  import weakref
  import numpy
  import chainer
  from chainer.backends import cuda
  import chainer.function_node
label_desc: Use image node_id 1 to create a new StaticScheduleFunction object from inherited base classes: chainer.function_node with example: obj = StaticScheduleFunction(schedule_manager, verbosity_level, enable_double_backprop)