Skip to content

Commit b3bcb43

Browse files
DhairyaLGandhiChrisRackauckas
authored andcommitted
chore: add CRC to extentions
1 parent c113dd1 commit b3bcb43

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
5757

5858
[weakdeps]
5959
BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
60+
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
6061
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
6162

6263
[extensions]
6364
MTKBifurcationKitExt = "BifurcationKit"
65+
MTKChainRulesCoreExt = "ChainRulesCore"
6466
MTKDeepDiffsExt = "DeepDiffs"
6567

6668
[compat]

ext/MTKChainRulesCoreExt.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module MTKChainRulesCoreExt
2+
3+
import ModelingToolkit as MTK
4+
import ChainRulesCore
5+
6+
function ChainRulesCore.rrule(::Type{MTK.MTKParameters}, tunables, args...)
7+
function mtp_pullback(dt)
8+
(NoTangent(), dt.tunable[1:length(tunables)], ntuple(_ -> NoTangent(), length(args))...)
9+
end
10+
MTK.MTKParameters(tunables, args...), mtp_pullback
11+
end
12+
13+
end

0 commit comments

Comments
 (0)