---
title: "Smoke: Reactant"
engine: julia
julia:
  exeflags: ["+1.12", "--project=../julia"]
---

```{julia}
#| label: grad
using Reactant, Enzyme
Reactant.set_default_backend("gpu")
loss(x) = sum(sort(x) .^ 2)
g(x) = Enzyme.gradient(Reverse, loss, x)[1]
x = Reactant.to_rarray(Float32[3, 1, 4, 2])
Array((@compile g(x))(x))
```
