Skip to content

Commit c4b193b

Browse files
Update example.md
1 parent 0310dd4 commit c4b193b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/src/example.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In this tutorial we will implement the SciMLStructures.jl interface for a parame
44
object. This is useful when differentiating through ODE solves using SciMLSensitivity.jl
55
and only part of the parameters are differentiable.
66

7-
```@example
7+
```@example basic_tutorial
88
using OrdinaryDiffEqTsit5
99
using LinearAlgebra
1010
@@ -41,7 +41,7 @@ solve(prob, Tsit5())
4141

4242
The ODE solves fine. Now let's try to differentiate with respect to the tunable parameters.
4343

44-
```@example
44+
```@example basic_tutorial
4545
using Zygote
4646
using SciMLSensitivity
4747
@@ -60,7 +60,7 @@ SciMLSensitivity does not know how to handle the parameter object, because it do
6060
implement the SciMLStructures interface. The bare minimum necessary for SciMLSensitivity
6161
is the `Tunable` portion.
6262

63-
```@example
63+
```@example basic_tutorial
6464
import SciMLStructures as SS
6565
6666
# Mark the struct as a SciMLStructure
@@ -112,7 +112,7 @@ end
112112

113113
Now, we should be able to differentiate through the ODE solve.
114114

115-
```@example
115+
```@example basic_tutorial
116116
Zygote.gradient(0.1ones(length(SS.canonicalize(SS.Tunable(), p)[1]))) do tunables
117117
newp = SS.replace(SS.Tunable(), p, tunables)
118118
newprob = remake(prob; p = newp)
@@ -123,7 +123,7 @@ end
123123

124124
We can also implement a `Constants` portion to store the rest of the values:
125125

126-
```@example
126+
```@example basic_tutorial
127127
SS.hasportion(::SS.Constants, ::Parameters) = true
128128
129129
function SS.canonicalize(::SS.Constants, p::Parameters)
@@ -156,15 +156,15 @@ buf, repack, alias = SS.canonicalize(SS.Constants(), p)
156156
buf
157157
```
158158

159-
```@example
159+
```@example basic_tutorial
160160
repack(ones(length(buf)))
161161
```
162162

163-
```@example
163+
```@example basic_tutorial
164164
SS.replace(SS.Constants(), p, ones(length(buf)))
165165
```
166166

167-
```@example
167+
```@example basic_tutorial
168168
SS.replace!(SS.Constants(), p, ones(length(buf)))
169169
p
170170
```

0 commit comments

Comments
 (0)