Skip to content

Commit

Permalink
Reverts bce64e5
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 674083626
  • Loading branch information
hawkinsp authored and Google-ML-Automation committed Sep 13, 2024
1 parent 7e47cbb commit b7de8d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions xla/python/pytree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,15 @@ nb::list PyTreeDef::FlattenUpTo(nb::handle xs) const {

case PyTreeKind::kNone:
if (!object.is_none()) {
throw std::invalid_argument(
absl::StrFormat("Expected None, got %s.",
nb::cast<std::string_view>(nb::repr(object))));
PythonDeprecationWarning(
/*stacklevel=*/3,
"In a future release of JAX, flatten-up-to will no longer "
"consider None to be a tree-prefix of non-None values, got: "
"%s.\n\n"
"To preserve the current behavior, you can usually write:\n"
" jax.tree.map(lambda x, y: None if x is None else f(x, y), a, "
"b, is_leaf=lambda x: x is None)",
nb::cast<std::string_view>(nb::repr(object)));
}
break;

Expand Down
2 changes: 1 addition & 1 deletion xla/python/xla_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

# Just an internal arbitrary increasing number to help with backward-compatible
# changes. In JAX, reference this via jax._src.lib.xla_extension_version.
_version = 284
_version = 283

# Version number for MLIR:Python components.
mlir_api_version = 57
Expand Down

0 comments on commit b7de8d2

Please sign in to comment.