# Zygote @adjoint with matrices

**URL:** <https://discourse.julialang.org/t/zygote-adjoint-with-matrices/32188>\
**Category:** Machine Learning\
**Created:** [December 12, 2019, 10:32am UTC](https://discourse.julialang.org/t/zygote-adjoint-with-matrices/32188 "2019-12-12T10:32:31Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [December 12, 2019, 2:39pm UTC](https://discourse.julialang.org/t/zygote-adjoint-with-matrices/32188/4 "2019-12-12T14:39:49Z")

</div>

You’re right, Zygote does reverse-mode differentiation, so the argument to the pullback of `f` is actually `df/df`, which is just one. In your case, I would suggest looking into forward-mode AD using `ForwardDiff` instead because it should be much more efficient for differentiating `K` and it will be easier to implement this custom adjoint for `f`.

---

_[View the full topic](https://discourse.julialang.org/t/zygote-adjoint-with-matrices/32188)._
