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

Update wrappers #172

Merged
merged 2 commits into from
Sep 2, 2024
Merged

Update wrappers #172

merged 2 commits into from
Sep 2, 2024

Conversation

danielward27
Copy link
Owner

This introduces a breaking change to reparameterizations.

Breaking changes:

  • flowjax.wrappers.Lambda has been renamed to flowjax.wrappers.Parameterize
  • flowjax.wrappers.BijectionReparam has been removed.
  • flowjax.wrappers.Where has been removed.

Reasons for breaking change:

  1. Lambda was renamed to Parameterize because Lambda is uninformative.
  2. Parameterize is relatively simple, and flexible enough to cover the common uses of BijectionReparam and Where (see below).
  3. Before, there was dependencies between the wrappers module, and the bijections, and vice verse (due to BijectionReparam) which made it challenging to avoid circular dependencies. The removal of BijectionReparam eliminates this issue.

Transitioning:

  • Replace Lambda with Parameterize.
  • Instead of e.g. BijectionReparam(scale, SoftPlus()), we can use Parameterize(softplus, inv_softplus(scale)), using jax.nn.softplus and flowjax.utils.inv_softplus.
  • Instead of e.g. creating mask with Where(mask, weight, 0), we can use Parameterize(jnp.where, mask, weight, 0).

Apologies for any inconvenience and let me know if you have any specific use cases that this causes any issues for.

@danielward27 danielward27 merged commit b8eb028 into main Sep 2, 2024
1 check passed
@danielward27 danielward27 deleted the update_wrappers branch September 2, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant