# Profiling gradient of model with transformed parameters block

**URL:** <https://discourse.mc-stan.org/t/profiling-gradient-of-model-with-transformed-parameters-block/23471>\
**Category:** Modeling\
**Tags:** techniques\
**Created:** [July 15, 2021, 8:00am UTC](https://discourse.mc-stan.org/t/profiling-gradient-of-model-with-transformed-parameters-block/23471 "2021-07-15T08:00:48Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![rok\_cesnovar](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rok\_cesnovar](https://discourse.mc-stan.org/u/rok_cesnovar)\
**Post date:** [July 15, 2021, 9:05am UTC](https://discourse.mc-stan.org/t/profiling-gradient-of-model-with-transformed-parameters-block/23471/6 "2021-07-15T09:05:43Z")

</div>

> [@treichelt](#):
>
> Out of interest, is that because the leapfrog integrator only uses the gradients but then for the accept/reject step it needs the actual value of the logjoint?

The actual values are computed always, they are just not stored for each HMC iteration, rather only evaluated once a new sample is “selected”. See [Request for final feedback: User controlled unnormalized (propto) distribution syntax - #12 by betanalpha](https://discourse.mc-stan.org/t/request-for-final-feedback-user-controlled-unnormalized-propto-distribution-syntax/16029/12)

So this is just trading a lot of memory savings for an additional function evaluation (without gradient evaluations).

---

_[View the full topic](https://discourse.mc-stan.org/t/profiling-gradient-of-model-with-transformed-parameters-block/23471)._
