Skip to content

Commit

Permalink
fix deprecation of dtc
Browse files Browse the repository at this point in the history
  • Loading branch information
st-- committed Sep 23, 2023
1 parent 92456df commit 3bb0d80
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,17 @@
plt, gp; samples=n, kwargs...
)

@deprecate elbo(dtc::DTC, fx, y) approx_log_evidence(dtc, fx, y)
@deprecate dtc(vfe::Union{VFE,DTC}, fx, y) approx_log_evidence(vfe, fx, y)
@deprecate dtc(dtc::DTC, fx, y) approx_log_evidence(dtc, fx, y)

function _warn_elbo_called_with_DTC(dtc::DTC, fx, y)
@warn "`elbo` was called with an object of type `DTC`, but should only be called with the `VFE` type instead"
return elbo(VFE(dtc.fz), fx, y)

Check warning on line 13 in src/deprecations.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecations.jl#L11-L13

Added lines #L11 - L13 were not covered by tests
end

function _warn_dtc_called_with_VFE(vfe::VFE, fx, y)
@warn "`dtc` was called with an object of type `VFE`, but instead you should call `approx_log_evidence` with an object of type `DTC`"
return approx_log_evidence(DTC(vfe.fz), fx, y)

Check warning on line 18 in src/deprecations.jl

View check run for this annotation

Codecov / codecov/patch

src/deprecations.jl#L16-L18

Added lines #L16 - L18 were not covered by tests
end

@deprecate elbo(dtc::DTC, fx, y) _warn_elbo_called_with_DTC(dtc, fx, y)
@deprecate dtc(vfe::VFE, fx, y) _warn_dtc_called_with_VFE(vfe, fx, y)

0 comments on commit 3bb0d80

Please sign in to comment.