import tensorflow as tf

        try:
            summary_writer = tf.summary.FileWriter(tensorboard_dir, sess.graph)
            
            sess.run(tf.global_variables_initializer())
            
            # saved model restoring
            if args.restore:
                # Restore saved model if the user requested it, default = True
                try:
                    checkpoint_state = tf.train.get_checkpoint_state(save_dir)
                    
                    if checkpoint_state and checkpoint_state.model_checkpoint_path:
                        log("Loading checkpoint {}".format(checkpoint_state.model_checkpoint_path),
                            slack=True)
                        saver.restore(sess, checkpoint_state.model_checkpoint_path)
                    
                    else:
                        log("No model to load at {}".format(save_dir), slack=True)
