import tensorflow as tf

        #            loss_i = loss_mod.get_loss(samples.state, samples.next_state, samples.action, ~samples.done & ~samples.timeout)
        #            total_loss.append(loss_i.mean())
        #        total_loss = np.mean(total_loss)
        #        print ('loaded model val loss:', total_loss)
        ##exit(0)
        ######################### debug #########################
        slbo_n_stages = nslbo
        print (f"each task will do nslbo = {nslbo}")
        for param in model.parameters():
            param.invalidate()

    all_task_parameter = []
    while (not test and TASK_NUM < ITERS) or (test and TEST_TASK_NUM < ITERS):
        # first task or maxstep, update the model. Otherwise, revert the model
        logger.info('Sync model from lazymodel')
        tf.get_default_session().run(sync_model_from_lazymodel)
        taskres = {}
        if 'goal_velocity' not in taskres.keys():
            taskres['goal_velocity'] = []
        if not test and inittask == 'none':
            slbo_n_stages = nslbo
        elif not test and TASK_NUM == 0:
            slbo_n_stages = initnslbo
        elif not test and TASK_NUM > 0:
            slbo_n_stages = nslbo

        time_start = time.time()
        trpo_warmup = []
        trpo_slbo = []
        surprisal = []
