# Gradients in PyStan 3

**URL:** <https://discourse.mc-stan.org/t/gradients-in-pystan-3/20298>\
**Category:** Developers\
**Tags:** pystan\
**Created:** [January 18, 2021, 9:27pm UTC](https://discourse.mc-stan.org/t/gradients-in-pystan-3/20298 "2021-01-18T21:27:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhuggins](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jhuggins/32/10377_2.png) [@jhuggins](https://discourse.mc-stan.org/u/jhuggins)\
**Post date:** [January 18, 2021, 9:27pm UTC](https://discourse.mc-stan.org/t/gradients-in-pystan-3/20298/1 "2021-01-18T21:27:39Z")

</div>

I noticed that the PyStan 3 Model class does not support computing gradients (of the log prob). Is it possible to get that added in during pre-release? It is an essential feature for our viabel package ([GitHub - jhuggins/viabel: Efficient, lightweight variational inference and approximation bounds](https://github.com/jhuggins/viabel)).

Thanks!

@ariddell

---

<div class="post-metadata">

**Author:** ![ahartikainen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ahartikainen/32/321_2.png) [@ahartikainen](https://discourse.mc-stan.org/u/ahartikainen)\
**Post date:** [January 18, 2021, 9:51pm UTC](https://discourse.mc-stan.org/t/gradients-in-pystan-3/20298/2 "2021-01-18T21:51:22Z")

</div>

Gradients are already in httpstan

> <https://github.com/stan-dev/httpstan/pull/509>

So it will probably get in PyStan 3 when someone has time to implement it.

---

<div class="post-metadata">

**Author:** ![ahartikainen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ahartikainen/32/321_2.png) [@ahartikainen](https://discourse.mc-stan.org/u/ahartikainen)\
**Post date:** [January 20, 2021, 11:50am UTC](https://discourse.mc-stan.org/t/gradients-in-pystan-3/20298/3 "2021-01-20T11:50:57Z")

</div>

And now they are in Github main branch

> <https://github.com/stan-dev/pystan-next/pull/195>

Good work @mjcarter !
