class_docstr: A manager of static schedules for a static chain.
  
  This is a container of the static schedules that are used by a static
  chain.
  
  Args:
      minimize_cache_size (bool): If `True`, attempt to reduce memory
      usage by clearing the cached schedules whenever the training
      mode changes (that is, whenever `chainer.config.train` changes
      value) or whenever the mini-batch size changes.
class_docstr_tok: ["A","manager","of","static","schedules","for","a","static","chain",".","This","is","a","container","of","the","static","schedules","that","are","used","by","a","static","chain",".","Args",":","minimize_cache_size","(","bool",")",":","If","`","True","`",",","attempt","to","reduce","memory","usage","by","clearing","the","cached","schedules","whenever","the","training","mode","changes","(","that","is",",","whenever","`","chainer.config.train","`","changes","value",")","or","whenever","the","mini-batch","size","changes","."]
docstr: Get a static schedule.
  
  Return a static schedule object (that is, an instance of
  ``StaticScheduleFunction``) that is compatible with
  the current configuration and input variables to the supplied chain.
  If there is no existing schedule available, return an empty schedule
  object.
  
  During the usual "training mode" (that is, when both
  `chainer.config.enable_backprop` and `chainer.config.train`
  are `True`), this method will always return a distince static
  schedule each time it is called within the same iteration.
  It will also try to reuse
  existing schedules across iterations. Therefore, any schedule that
  is returned in a given iteration cannot be returned again until
  the following iteration. However, if either of these flags is
  'False', then this method may return the same schedule instance
  multiple times within the same iteration, as long as it is
  compatible with `in_vars`.
  
  Note that in order to implement the above behavior, the schedule
  manager must be informed when the current iteration has finished.
  This is accomplished by calling `end_forward()` after the
  iteration has finished. If a backward pass is performed, then
  `end_forward()` will be automatically called. Otherwise, it
  will not be called and the user will be responsible for calling
  it.
  
  Args:
      in_vars (tuple of :class:`~chainer.Variable`): The input
          variables to the chain.
  
  Returns:
      An instance of ``StaticScheduleFunction``.
docstr_tok: ["Get","a","static","schedule",".","Return","a","static","schedule","object","(","that","is",",","an","instance","of","``","StaticScheduleFunction","``",")","that","is","compatible","with","the","current","configuration","and","input","variables","to","the","supplied","chain",".","If","there","is","no","existing","schedule","available",",","return","an","empty","schedule","object",".","During","the","usual","``","training","mode","''","(","that","is",",","when","both","`","chainer.config.enable_backprop","`","and","`","chainer.config.train","`","are","`","True","`",")",",","this","method","will","always","return","a","distince","static","schedule","each","time","it","is","called","within","the","same","iteration",".","It","will","also","try","to","reuse","existing","schedules","across","iterations",".","Therefore",",","any","schedule","that","is","returned","in","a","given","iteration","can","not","be","returned","again","until","the","following","iteration",".","However",",","if","either","of","these","flags","is","'False","'",",","then","this","method","may","return","the","same","schedule","instance","multiple","times","within","the","same","iteration",",","as","long","as","it","is","compatible","with","`","in_vars","`",".","Note","that","in","order","to","implement","the","above","behavior",",","the","schedule","manager","must","be","informed","when","the","current","iteration","has","finished",".","This","is","accomplished","by","calling","`","end_forward","(",")","`","after","the","iteration","has","finished",".","If","a","backward","pass","is","performed",",","then","`","end_forward","(",")","`","will","be","automatically","called",".","Otherwise",",","it","will","not","be","called","and","the","user","will","be","responsible","for","calling","it",".","Args",":","in_vars","(","tuple","of",":","class",":","`","~chainer.Variable","`",")",":","The","input","variables","to","the","chain",".","Returns",":","An","instance","of","``","StaticScheduleFunction","``","."]
code: def get_schedule(self, in_vars, enable_double_backprop=False):
      """Get a static schedule.
  
      Return a static schedule object (that is, an instance of
      ``StaticScheduleFunction``) that is compatible with
      the current configuration and input variables to the supplied chain.
      If there is no existing schedule available, return an empty schedule
      object.
  
      During the usual "training mode" (that is, when both
      `chainer.config.enable_backprop` and `chainer.config.train`
      are `True`), this method will always return a distince static
      schedule each time it is called within the same iteration.
      It will also try to reuse
      existing schedules across iterations. Therefore, any schedule that
      is returned in a given iteration cannot be returned again until
      the following iteration. However, if either of these flags is
      'False', then this method may return the same schedule instance
      multiple times within the same iteration, as long as it is
      compatible with `in_vars`.
  
      Note that in order to implement the above behavior, the schedule
      manager must be informed when the current iteration has finished.
      This is accomplished by calling `end_forward()` after the
      iteration has finished. If a backward pass is performed, then
      `end_forward()` will be automatically called. Otherwise, it
      will not be called and the user will be responsible for calling
      it.
  
      Args:
          in_vars (tuple of :class:`~chainer.Variable`): The input
              variables to the chain.
  
      Returns:
          An instance of ``StaticScheduleFunction``.
      """
      if self.forward_over:
          self.forward_over = False
      if self.minimize_cache_size:
          if chainer.config.train != self.prev_train_config:
              # Training config changed, so clear caches.
              self.prev_train_config = chainer.config.train
              if self.verbosity_level >= 2:
                  print("Clearing schedule cache...")
              self.schedules.clear()
              self.in_use_count.clear()
  
      if (
          chainer.config.train is False
          or chainer.config.enable_backprop is False
      ):
          key_str = "test:" + "".join(
              str(x.shape) + str(x.dtype) for x in in_vars
          )
          # If the maximum number of in-use schedules in any iteration
          # during training mode was exactly 1, assume it should also
          # be 1 for test mode.
          if key_str in self.schedules:
              sched_list = self.schedules[key_str]
              sched = sched_list[0]
          else:
              # avoid "line too long":
              vb = self.verbosity_level
              edb = enable_double_backprop
              sched = StaticScheduleFunction(
                  self, verbosity_level=vb, enable_double_backprop=edb
              )
              self.schedules[key_str] = [sched]
          return sched
      else:
          key_str = "train:" + "".join(
              str(x.shape) + str(x.dtype) for x in in_vars
          )
          self.train_count += 1
  
          if key_str in self.schedules:
              sched_list = self.schedules[key_str]
              available_index = self.in_use_count[key_str]
              if available_index >= len(sched_list):
                  # avoid "line too long":
                  vb = self.verbosity_level
                  edb = enable_double_backprop
                  sched = StaticScheduleFunction(
                      self,
                      verbosity_level=vb,
                      enable_double_backprop=edb,
                  )
                  sched_list.append(sched)
  
              sched = sched_list[available_index]
              self.in_use_count[key_str] = available_index + 1
          else:
              # avoid "line too long":
              vb = self.verbosity_level
              edb = enable_double_backprop
              sched = StaticScheduleFunction(
                  self, verbosity_level=vb, enable_double_backprop=edb
              )
              self.schedules[key_str] = [sched]
              self.in_use_count[key_str] = 1
  
      return sched
  
imports: import sys
  import weakref
  import numpy
  import chainer
  from chainer.backends import cuda
  import chainer.function_node
label_desc: Use image node_id 2 for calling the ScheduleManager obj's underlying member method code with example usage: obj.get_schedule(in_vars, enable_double_backprop) and returns: sched, sched