def setup_scaffold(self):
if self.execution_type == "<STR_LIT>":<EOL><INDENT>global_variables = self.get_variables(include_submodules=True, include_nontrainable=True)<EOL>init_op = tf.variables_initializer(var_list=global_variables)<EOL>if self.summarizer_init_op is not None:<EOL><INDENT>init_op = tf.group(init_op, self.summarizer_init_op)<EOL><DEDENT>if self.graph_summary is None:<EOL><INDENT>ready_op = tf.report_uninitialized_variables(var_list=global_variables)<EOL>ready_for_local_init_op = None<EOL>local_init_op = None<EOL><DEDENT>else:<EOL><INDENT>ready_op = None<EOL>ready_for_local_init_op = tf.report_uninitialized_variables(var_list=global_variables)<EOL>local_init_op = self.graph_summary<EOL><DEDENT><DEDENT>else:<EOL><INDENT>global_variables = self.global_model.get_variables(include_submodules=True, include_nontrainable=True)<EOL>local_variables = self.get_variables(include_submodules=True, include_nontrainable=True)<EOL>init_op = tf.variables_initializer(var_list=global_variables)<EOL>if self.summarizer_init_op is not None:<EOL><INDENT>init_op = tf.group(init_op, self.summarizer_init_op)<EOL><DEDENT>ready_op = tf.report_uninitialized_variables(var_list=(global_variables + local_variables))<EOL>ready_for_local_init_op = tf.report_uninitialized_variables(var_list=global_variables)<EOL>if self.graph_summary is None:<EOL><INDENT>local_init_op = tf.group(<EOL>tf.variables_initializer(var_list=local_variables),<EOL>*(tf.assign(ref=local_var, value=global_var) for local_var, global_var in zip(<EOL>self.get_variables(include_submodules=True),<EOL>self.global_model.get_variables(include_submodules=True)<EOL>))<EOL>)<EOL><DEDENT>else:<EOL><INDENT>local_init_op = tf.group(<EOL>tf.variables_initializer(var_list=local_variables),<EOL>self.graph_summary,<EOL>*(tf.assign(ref=local_var, value=global_var) for local_var, global_var in zip(<EOL>self.get_variables(include_submodules=True),<EOL>self.global_model.get_variables(include_submodules=True)<EOL>))<EOL>)<EOL><DEDENT><DEDENT>def init_fn(scaffold, session):<EOL><INDENT>if self.saver_spec is not None and self.saver_spec.get('<STR_LIT>', True):<EOL><INDENT>directory = self.saver_spec['<STR_LIT>']<EOL>file = self.saver_spec.get('<STR_LIT:file>')<EOL>if file is None:<EOL><INDENT>file = tf.train.latest_checkpoint(<EOL>checkpoint_dir=directory,<EOL>latest_filename=None  <EOL>)<EOL><DEDENT>elif not os.path.isfile(file):<EOL><INDENT>file = os.path.join(directory, file)<EOL><DEDENT>if file is not None:<EOL><INDENT>try:<EOL><INDENT>scaffold.saver.restore(sess=session, save_path=file)<EOL>session.run(fetches=self.list_buffer_index_reset_op)<EOL><DEDENT>except tf.errors.NotFoundError:<EOL><INDENT>raise TensorForceError("<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT><DEDENT>self.scaffold = tf.train.Scaffold(<EOL>init_op=init_op,<EOL>init_feed_dict=None,<EOL>init_fn=init_fn,<EOL>ready_op=ready_op,<EOL>ready_for_local_init_op=ready_for_local_init_op,<EOL>local_init_op=local_init_op,<EOL>summary_op=None,<EOL>saver=self.saver,<EOL>copy_from_scaffold=None<EOL>)<EOL>
Creates the tf.train.Scaffold object and assigns it to self.scaffold.
Other fields of the Scaffold are generated automatically.