def cond_grad_fn(x, t_input):
        """
        Compute the gradient of the classifier, i.e. nabla_{x} log p_t(cond | x_t).
        """
        with torch.enable_grad():
            x_in = x.detach().requires_grad_(True)
            log_prob = classifier_fn(x_in, t_input, condition, **classifier_kwargs)
            return torch.autograd.grad(log_prob.sum(), x_in)[0]

        Compute the gradient of the classifier, i.e. nabla_{x} log p_t(cond | x_t).
        
ControlNet-v1-1-nightly/ldm/models/diffusion/dpm_solver/dpm_solver.py