From 95c54fac7205a64e96ea9445e082e4b7cbff278d Mon Sep 17 00:00:00 2001 From: David Widmann Date: Tue, 23 Aug 2022 21:23:05 +0200 Subject: [PATCH] Replace `Zygote.@nograd` with `CRC.@non_differentiable` (#230) * Replace `Zygote.@nograd` with `CRC.@non_differentiable` * Update Project.toml Co-authored-by: Hong Ge <3279477+yebai@users.noreply.github.com> --- Project.toml | 2 +- src/chainrules.jl | 3 +++ src/compat/zygote.jl | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 6b478a12..7202822b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Bijectors" uuid = "76274a88-744f-5084-9051-94815aaf08c4" -version = "0.10.4" +version = "0.10.5" [deps] ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197" diff --git a/src/chainrules.jl b/src/chainrules.jl index a7071649..45cacf82 100644 --- a/src/chainrules.jl +++ b/src/chainrules.jl @@ -155,3 +155,6 @@ function ChainRulesCore.rrule(::typeof(_transform_inverse_ordered), x::AbstractM return y, _transform_inverse_ordered_adjoint end + +# Fixes Zygote's issues with `@debug` +ChainRulesCore.@non_differentiable _debug(::Any) \ No newline at end of file diff --git a/src/compat/zygote.jl b/src/compat/zygote.jl index e2adf050..362915a7 100644 --- a/src/compat/zygote.jl +++ b/src/compat/zygote.jl @@ -1,9 +1,8 @@ -using .Zygote: Zygote, @adjoint, @nograd, pullback +using .Zygote: Zygote, @adjoint, pullback using Compat: eachcol @adjoint istraining() = true, _ -> nothing -@nograd Bijectors._debug @adjoint function mapvcat(f, args...) g(f, args...) = map(f, args...)