Thanks reply @ptrblck .
Of course, I have tried it, but coefficients(parameter) do not change
def exp_inverse(true_coef, arg, env, agent, x_traj, a_traj, true_loss, filename, n, part_coef=False):
    tic = time.time()

    # Parameterization of coefficient to apply optimizer
    coef = nn.Parameter(reset_coef(arg.desvel_range, arg.uns4IDM_range))
    ini_coef = coef.data.clone()

    loss_log = deque(maxlen=arg.NUM_IT)
    loss_log_recent = deque(maxlen=100)
    coef_log = deque(maxlen=arg.NUM_IT)
    coef = Variable(coef, requires_grad=True)

    # Set-up Optimizer & Scheduler
    opt = torch.optim.Adam([coef], lr=arg.ADAM_LR, eps=arg.ADAM_eps, amsgrad=False)
    Sched = torch.optim.lr_scheduler.StepLR(opt, step_size=10, gamma=0.99)

    print('===========================================')
    print('Finding Coefficient')
    print('===========================================')

    for it in tqdm(range(arg.NUM_IT)):
        # Calculate loss function
        loss, _ = getLoss(agent, x_traj, a_traj, coef, env, arg.PI_STD, arg.NUM_SAM)
        # loss = Variable(loss, requires_grad=True)
        loss.requires_grad = True
        # Initialize the gradients calculated previous step; Clears old gradients
        opt.zero_grad()
        # print(loss.grad)

        # Collect the data for plotting tendency
        loss_log.append(loss.data)
        loss_log_recent.append(loss.data)

        # Backpropagation
        loss.backward(retain_graph=True)
        # opt.param_groups[0]["params"][0].grad
        print(coef.grad)
        # Optimizer and Scheduler
        opt.step() # change coefficients
        Sched.step()

what is the problem? could you help me again?