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 jax.tree_util.tree_map to jax.tree.map #1821

Merged
merged 5 commits into from
Jun 26, 2024

Conversation

fehiepsi
Copy link
Member

@fehiepsi fehiepsi commented Jun 24, 2024

Since jax 0.4.25 (released Feb 24), jax.tree_util.tree_map is deprecated, in favor of jax.tree.map. This PR updates numpyro to use the new pattern.

In addition, jnp.clip(..., a_min=..., a_max=...) is deprecated. I change the pattern to jnp.clip(..., ..., ...) to remove the deprecation warning in the tests.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Collaborator

@martinjankowiak martinjankowiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm although i might have chosen to keep explicit min and max

@@ -1417,7 +1415,7 @@ def _inverse(self, y: jnp.ndarray) -> jnp.ndarray:
return y

def extend_axis_rev(self, array: jnp.ndarray, axis: int) -> jnp.ndarray:
normalized_axis = normalize_axis_tuple(axis, array.ndim)[0]
normalized_axis = axis if axis >= 0 else jnp.ndim(array) + axis
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This raises a warning that this function is hidden and accessing it through numpy.core.numeric is deprecated.

@fehiepsi
Copy link
Member Author

The current numpy versions still use a_min a_max. They have a PR to deprecate those arguments but it has not been merged yet.

@fehiepsi fehiepsi merged commit 5af9ebd into pyro-ppl:master Jun 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants