-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
459 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
name = "ADTypes" | ||
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b" | ||
authors = ["Vaibhav Dixit <vaibhavyashdixit@gmail.com> and contributors"] | ||
authors = [ | ||
"Vaibhav Dixit <vaibhavyashdixit@gmail.com>, Guillaume Dalle and contributors", | ||
] | ||
version = "0.3.0" | ||
|
||
[deps] | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" | ||
|
||
[weakdeps] | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" | ||
|
||
[extensions] | ||
ADTypesChainRulesCoreExt = "ChainRulesCore" | ||
ADTypesEnzymeCoreExt = "EnzymeCore" | ||
|
||
[compat] | ||
ChainRulesCore = "1.23.0" | ||
EnzymeCore = "0.7.2" | ||
julia = "1.6" | ||
|
||
[extras] | ||
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test"] | ||
test = ["ChainRulesCore", "EnzymeCore", "Test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module ADTypesChainRulesCoreExt | ||
|
||
using ADTypes: ADTypes, AutoChainRules | ||
using ChainRulesCore: HasForwardsMode, HasReverseMode, | ||
NoForwardsMode, NoReverseMode, | ||
RuleConfig | ||
|
||
# see https://juliadiff.org/ChainRulesCore.jl/stable/rule_author/superpowers/ruleconfig.html | ||
|
||
function ADTypes.mode(::AutoChainRules{RC}) where { | ||
RC <: RuleConfig{>:Union{HasForwardsMode, NoReverseMode}} | ||
} | ||
return ADTypes.ForwardMode() | ||
end | ||
|
||
function ADTypes.mode(::AutoChainRules{RC}) where { | ||
RC <: RuleConfig{>:Union{NoForwardsMode, HasReverseMode}} | ||
} | ||
return ADTypes.ReverseMode() | ||
end | ||
|
||
function ADTypes.mode(::AutoChainRules{RC}) where { | ||
RC <: RuleConfig{>:Union{HasForwardsMode, HasReverseMode}} | ||
} | ||
return ADTypes.ForwardOrReverseMode() | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module ADTypesEnzymeCoreExt | ||
|
||
using ADTypes: ADTypes, AutoEnzyme | ||
using EnzymeCore: EnzymeCore | ||
|
||
ADTypes.mode(::AutoEnzyme{M}) where {M <: EnzymeCore.ForwardMode} = ADTypes.ForwardMode() | ||
ADTypes.mode(::AutoEnzyme{M}) where {M <: EnzymeCore.ReverseMode} = ADTypes.ReverseMode() | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.