-
Notifications
You must be signed in to change notification settings - Fork 89
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
5 changed files
with
33 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# For the CoreLogging submodule of Base. (not to be confused with the Logging stdlib) | ||
|
||
function rrule( | ||
rc::RuleConfig{>:ChainRulesCore.HasReverseMode}, | ||
::typeof(Base.CoreLogging.with_logger), | ||
f::Function, | ||
logger::Base.CoreLogging.AbstractLogger | ||
) | ||
y, f_pb = Base.CoreLogging.with_logger(logger) do | ||
rrule_via_ad(rc, f) | ||
end | ||
with_logger_pullback(ȳ) = (NoTangent(), only(f_pb(ȳ)), NoTangent()) | ||
return y, with_logger_pullback | ||
end | ||
|
||
@non_differentiable Base.CoreLogging.current_logger(args...) | ||
@non_differentiable Base.CoreLogging.current_logger_for_env(::Any...) | ||
@non_differentiable Base.CoreLogging._invoked_shouldlog(::Any...) | ||
@non_differentiable Base.CoreLogging.Base.fixup_stdlib_path(::Any) | ||
@non_differentiable Base.CoreLogging.handle_message(::Any...) |
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,11 @@ | ||
# For the CoreLogging submodule of Base. (not to be confused with the Logging stdlib) | ||
@testset "CoreLogging.jl" begin | ||
@testset "with_logger" begin | ||
test_rrule( | ||
Base.CoreLogging.with_logger, | ||
()->2.0 * 3.0, | ||
Base.CoreLogging.NullLogger(); | ||
check_inferred=false | ||
) | ||
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