# (yet another) Zygote: mutating arrays is not supported

**URL:** <https://discourse.julialang.org/t/yet-another-zygote-mutating-arrays-is-not-supported/62294>\
**Category:** Machine Learning\
**Created:** [June 2, 2021, 6:57pm UTC](https://discourse.julialang.org/t/yet-another-zygote-mutating-arrays-is-not-supported/62294 "2021-06-02T18:57:42Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![rakeshvar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rakeshvar/32/3613_2.png) [@rakeshvar](https://discourse.julialang.org/u/rakeshvar)\
**Post date:** [July 7, 2021, 9:03am UTC](https://discourse.julialang.org/t/yet-another-zygote-mutating-arrays-is-not-supported/62294/8 "2021-07-07T09:03:04Z")

</div>

@Dhruva2 , One of the threads that @ChrisRackauckas is talking about is this one:

> [@Gradient of Gradient in Zygote](https://discourse.julialang.org/t/gradient-of-gradient-in-zygote/52685):
>
> I am trying to find the Hessian of a quadratic form. I know the answer. But if I apply gradient on the gradient, I get an error. Can Zygote do the differentiation only if the output is a scalar? But then how can it work for Neural Networks, where each layer can return a very big tensor? Here is an example… \> n = 3 \> A = reshape(0:(n^2-1), n, n) .% (n+1) 3×3 Array{Int64,2}: 0 3 2 1 0 3 2 1 0 \> H = 2\*A'\*A 3×3 Array{Int64,2}: 10 4 6 4 20 12 6 12 26 \> x1 = collect(0:(n-1)) …

I had a much more minimal working example there, and I ask the same question. (I do not even recollect what I was trying to do. May be I was just curious.) Chris gives a very comprehensive answer there. Do check it out.

---

_[View the full topic](https://discourse.julialang.org/t/yet-another-zygote-mutating-arrays-is-not-supported/62294)._
