'Get the rebar gradient.'

def get_rebar_gradient(self):

    (hardELBO, nvil_gradient, logQHard) = self._create_hard_elbo()
    if self.hparams.quadratic:
        (gumbel_cv, _) = self._create_gumbel_control_variate_quadratic(logQHard)
    else:
        (gumbel_cv, _) = self._create_gumbel_control_variate(logQHard)
    f_grads = self.optimizer_class.compute_gradients(tf.reduce_mean((- nvil_gradient)))
    eta = {}
    (h_grads, eta_statistics) = self.multiply_by_eta_per_layer(self.optimizer_class.compute_gradients(tf.reduce_mean(gumbel_cv)), eta)
    model_grads = U.add_grads_and_vars(f_grads, h_grads)
    total_grads = model_grads
    variance_objective = tf.reduce_mean(tf.square(U.vectorize(model_grads, set_none_to_zero=True)))
    debug = {'ELBO': hardELBO, 'etas': eta_statistics, 'variance_objective': variance_objective}
    return (total_grads, debug, variance_objective)
