import tensorflow as tf

        with config.unlocked:
            config.logdir = logdir
        message = 'Start a new run and write summaries and checkpoints to {}.'
        tf.logging.info(message.format(config.logdir))
        tf.gfile.MakeDirs(config.logdir)
        config_path = os.path.join(config.logdir, 'config.yaml')
        with tf.gfile.GFile(config_path, 'w') as file_:
            yaml.dump(
                config, file_, yaml.Dumper,
                allow_unicode=True,
                default_flow_style=False)
    else:
