# Unable to compute gradient of loss of my model with sciml\_train

**URL:** <https://discourse.julialang.org/t/unable-to-compute-gradient-of-loss-of-my-model-with-sciml-train/49572>\
**Category:** General Usage\
**Tags:** question, sciml\
**Created:** [November 4, 2020, 9:45am UTC](https://discourse.julialang.org/t/unable-to-compute-gradient-of-loss-of-my-model-with-sciml-train/49572 "2020-11-04T09:45:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [November 4, 2020, 10:43pm UTC](https://discourse.julialang.org/t/unable-to-compute-gradient-of-loss-of-my-model-with-sciml-train/49572/2 "2020-11-04T22:43:51Z")

</div>

> [@TomCif](#):
>
> ```julia
> function predict_adjoint(x, p) #we want to solve ivp with adjoint method 
> concrete_solve(prob,Tsit5(),u0 = x, p, #[u0,0f0]
> saveat=0f0:0.1f0:10f0,sensealg=DiffEqFlux.InterpolatingAdjoint(
> checkpointing=true))
> end
> 
> ```

I’m surprised that didn’t just error earlier. The issue is that you weren’t really passing `p` as it needed to be a keyword argument. That’s a deprecated function too, so the suggested updated syntax is:

```julia
function predict_adjoint(x, p) #we want to solve ivp with adjoint method
    _prob = remake(prob,u0=x,p=p)
          solve(_prob ,Tsit5(), #[u0,0f0]
                   saveat=0f0:0.1f0:10f0,sensealg=DiffEqFlux.InterpolatingAdjoint(
                   checkpointing=true))
end

```

---

_[View the full topic](https://discourse.julialang.org/t/unable-to-compute-gradient-of-loss-of-my-model-with-sciml-train/49572)._
