I have encountered a problem in my code. While I cannot easily write a MWE for my particular case, I thought that perhaps dealing with the following issue would help me further.

Let us say, that we have some data `y`

and parameters `x`

. Using `Zygote`

, we can calculate the gradient of the following:

```
using Zygote
x = [1.0;3.0;5.0] # parameters
y = [1.0;3.0;5.0].+ 10 # fake data
# calculate gradient wrt x
Zygote.gradient(x -> sum(abs2.(x-y)), x)
```

Now suppose that `y`

contains `missing`

values:

```
using Zygote
x = [1.0;3.0;5.0] # parameters
y = [1.0;3.0;missing].+ 10 # fake data
# calculate gradient wrt x
Zygote.gradient(x -> sum(abs2.(x-y)), x)
```

The above, as expected, will not work.

I tried using instead:

```
Zygote.gradient(x -> sum(abs2.(skipmissing(x-y))), x)
```

which gives me an error. I also tried:

```
Zygote.gradient(x -> sum(skipmissing(abs2.(x-y))), x)
```

which also doesnâ€™t work, but, interestingly, gives me a different error.

Any advice appreciated.