Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deprecation of dtc #380

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AbstractGPs"
uuid = "99985d1d-32ba-4be9-9821-2ec096f28918"
authors = ["JuliaGaussianProcesses Team"]
version = "0.5.18"
version = "0.5.19"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
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)
Loading