import tensorflow as tf

                res = render(Monitor(make_env(FLAGS.env.id, task_config=task), f"./{setting}/{taskname}-testtask{TEST_TASK_NUM}-slbo{T}/", force=True, video_callable=lambda episode_id: True), policy)
                print ('test_summary_slbo:', test_summary['slbo'][TEST_TASK_NUM])

            if not test:
                np.save(f'{setting}/{taskname}.task{TASK_NUM}.saver', saver.state_dict())
                np.save(f'{setting}/{taskname}.final.saver', saver.state_dict())

        if init_generator and TASK_NUM==0:
            print ('finished init generator!')
            exit(0)

        pol_params, warm_params = tf.get_default_session().run([nn.utils.parameters_to_vector(policy.parameters()), nn.utils.parameters_to_vector(warmup_policy.parameters())])
        print ("After SLBO, pol_params_norm:", np.linalg.norm(pol_params), "warm_params_norm:", np.linalg.norm(warm_params))

        eval_rollout(runners['train'], policy, 'Use optimal policy to collect data from real env')
        optimal_collect_real = []

        t3 = time.time()
        slbo_time = t3 - t2
        evaluate(settings, 'post-slbo')
        logger.info(f'Warmup time = {warmup_time}, SLBO time = {slbo_time}')

