JuliaMath / JuliaMath/ChangesOfVariables.jl

Add support for mutating transformations

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
12
Forks
3
PR merge metrics
No merged PRs in 30d

Description

At some point we will probably want to add support for mutating transformation.

Mutating transformations are likely to become more relevant in the future. Non-mutating transformations are more prevalent at the moment, I think at least partially due to the limitations of AD-frameworks [like Zygote](https://github.com/FluxML/Zygote.jl). But with [Enzyme](https://github.com/wsmoses/Enzyme.jl) we now have a reverse-mode AD solution for mutating functions, and AFAIK there are plans to support rules for mutating functions in [ChainRulesCore](https://github.com/JuliaDiff/ChainRulesCore.jl).

The cleanest way to support this would probably be to add `with_logabsdet_jacobian!`, so that

```julia
(y, ladj) = with_logabsdet_jacobian!(f!, y, x)
```

We could provide automatic support for `bc_f! = Base.Fix1(broadcast!, f!)` as well (we already support `Base.Fix1(broadcast, f)`, after all).

This issue is intended to collect comments and ideas, we can act on it once a concrete need (use case) arises.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.