# Zygote.gradient(): Mutating arrays is not supported

**URL:** https://discourse.julialang.org/t/zygote-gradient-mutating-arrays-is-not-supported/45148
**Category:** General Usage
**Created:** [August 18, 2020, 9:12am UTC](https://discourse.julialang.org/t/zygote-gradient-mutating-arrays-is-not-supported/45148 "2020-08-18T09:12:55Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)
#### Post date: [August 18, 2020, 10:01am UTC](https://discourse.julialang.org/t/zygote-gradient-mutating-arrays-is-not-supported/45148/2 "2020-08-18T10:01:42Z")

</div>

Probably, you try to differentiate through some code that contains something like `x[i] = y`.  
This is not supported by Zygote. I used [this work-around](https://discourse.julialang.org/t/zygote-and-setindex/44554) at some point.

To get more help, please follow the recommendations in [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757).

---

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