class_docstr: A callable wrapper for a function in the static schedule.
  
  Args:
      func (FunctionNode): A function in the static schedule.
      args: Arguments to 'func'.
      kwargs: Keyword arguments to 'func'.
      inputs_hooks (list of tuples): A list of hooks that instruct how to
          update the ndarray references in 'args' so that they
          refer to the correct master array in 'unique_arrays'.
      return_hooks (list of tuples): A list of hooks that instruct how
          to update the ndarray references in 'unique_arrays' so that
          they refer to the correct arrays that were dynamically
          allocated and returned by 'func'. These run after
          'func' is called.
      unique_arrays (list of ndarray): The master list of all unique
          ndarrays that appear in the static schedule.
      func_name (str): An optional name of the static function. This is
          the name (if any) that was used as a decorater argument to
          `@static_code(func_name=name)`.
class_docstr_tok: ["A","callable","wrapper","for","a","function","in","the","static","schedule",".","Args",":","func","(","FunctionNode",")",":","A","function","in","the","static","schedule",".","args",":","Arguments","to","'func","'",".","kwargs",":","Keyword","arguments","to","'func","'",".","inputs_hooks","(","list","of","tuples",")",":","A","list","of","hooks","that","instruct","how","to","update","the","ndarray","references","in","'args","'","so","that","they","refer","to","the","correct","master","array","in","'unique_arrays","'",".","return_hooks","(","list","of","tuples",")",":","A","list","of","hooks","that","instruct","how","to","update","the","ndarray","references","in","'unique_arrays","'","so","that","they","refer","to","the","correct","arrays","that","were","dynamically","allocated","and","returned","by","'func","'",".","These","run","after","'func","'","is","called",".","unique_arrays","(","list","of","ndarray",")",":","The","master","list","of","all","unique","ndarrays","that","appear","in","the","static","schedule",".","func_name","(","str",")",":","An","optional","name","of","the","static","function",".","This","is","the","name","(","if","any",")","that","was","used","as","a","decorater","argument","to","`","@","static_code","(","func_name=name",")","`","."]
docstr: Run post-hooks.
  
  This method should be called after calling the static function
  `self.func(*self.args)`. This method sets any array references that
  appear in `self.args` to None. This is safe because the master
  array reference is still kept in `self.unique_arrays`.
  
  Also, process the list of post-hooks which will modify the array
  references in
  the unique_arrays list to refer to the new dynamically-allocated arrays
  that were returned by 'func'.
  
  Args:
      return_arrays (list of ndarray or None): The list of arrays that
          were returned by the schedule function, if not None.
docstr_tok: ["Run","post-hooks",".","This","method","should","be","called","after","calling","the","static","function","`","self.func","(","*","self.args",")","`",".","This","method","sets","any","array","references","that","appear","in","`","self.args","`","to","None",".","This","is","safe","because","the","master","array","reference","is","still","kept","in","`","self.unique_arrays","`",".","Also",",","process","the","list","of","post-hooks","which","will","modify","the","array","references","in","the","unique_arrays","list","to","refer","to","the","new","dynamically-allocated","arrays","that","were","returned","by","'func","'",".","Args",":","return_arrays","(","list","of","ndarray","or","None",")",":","The","list","of","arrays","that","were","returned","by","the","schedule","function",",","if","not","None","."]
code: def run_post_hooks(self, return_arrays):
      """Run post-hooks.
  
      This method should be called after calling the static function
      `self.func(*self.args)`. This method sets any array references that
      appear in `self.args` to None. This is safe because the master
      array reference is still kept in `self.unique_arrays`.
  
      Also, process the list of post-hooks which will modify the array
      references in
      the unique_arrays list to refer to the new dynamically-allocated arrays
      that were returned by 'func'.
  
      Args:
          return_arrays (list of ndarray or None): The list of arrays that
              were returned by the schedule function, if not None.
      """
      for hook in self.inputs_hooks:
          (ind, unique_ind) = hook
          self.in_list[ind] = None
  
      for hook in self.outputs_hooks:
          (ind, unique_ind) = hook
          self.out_list[ind] = None
  
      for hook in self.return_hooks:
          # Update the array reference in unique_arrays to refer to the
          # array in the results array.
          (ret_index, unique_list_index) = hook
  
          # Note: input/output variables to a FunctionNode that are
          # retained using retain_inputs() or retain_outputs() are
          # not currently explicitly used as input arguments to the
          # auto-wrapped functions, and so their corresponding array
          # reference could be used inside a function wrapped with
          # @static_code without the array explicitly appearing in the
          # 'inputs' argument. It is therefore not safe to change the
          # reference of such arrays, and so for them, we must be
          # sure to copy the dynamically-allocated array into the
          # same array that was used in the define-by-run code and
          # set 'need_copy' to True in such cases.
          need_copy = self.array_infos[unique_list_index].retain
          # todo: possible memory leak when need_copy False is allowed?
          if need_copy:
              # This must be used if the model used retain_inputs() or
              # retain_outputs().
              self.unique_arrays[unique_list_index][
                  ...
              ] = return_arrays[ret_index]
          else:
              # This is preferred, when possible, since it should
              # be faster than a copy to simply update the array
              # reference.
              self.unique_arrays[unique_list_index] = return_arrays[
                  ret_index
              ]
  
imports: import sys
  import weakref
  import numpy
  import chainer
  from chainer.backends import cuda
  import chainer.function_node
label_desc: Use image node_id 3 for calling the ScheduleInfo obj's underlying member method code with example usage: obj.run_post_hooks(return_arrays) without return types