# Speed up compilation with Zygote and PINN

**URL:** <https://discourse.julialang.org/t/speed-up-compilation-with-zygote-and-pinn/99652>\
**Category:** Machine Learning\
**Created:** [May 31, 2023, 7:43am UTC](https://discourse.julialang.org/t/speed-up-compilation-with-zygote-and-pinn/99652 "2023-05-31T07:43:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Matthieu\_BARREAU](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matthieu_barreau/32/50368_2.png) [@Matthieu\_BARREAU](https://discourse.julialang.org/u/Matthieu_BARREAU)\
**Post date:** [May 31, 2023, 3:03pm UTC](https://discourse.julialang.org/t/speed-up-compilation-with-zygote-and-pinn/99652/2 "2023-05-31T15:03:12Z")

</div>

I found that using ForwardDiff for getting the residuals is slightly more efficient (but can deal with the additional viscosity).  
Any idea on how to use forward mode to get the residual and reverse mode for the grads?  
I saw this post: [How to achieve good performance with Zygote.pushforward on a neural network](https://discourse.julialang.org/t/how-to-achieve-good-performance-with-zygote-pushforward-on-a-neural-network/55971) which might solve this issue, however, it is outdated and the codes there are not working anymore.

---

_[View the full topic](https://discourse.julialang.org/t/speed-up-compilation-with-zygote-and-pinn/99652)._
