Skip to content

Commit

Permalink
Don't set the promotion state explicitly.
Browse files Browse the repository at this point in the history
The method `_set_promotion_state` was removed in numpy 2.2 and the promotion state is set to weak by default: https://numpy.org/devdocs/release/2.2.0-notes.html#nep-50-promotion-state-option-removed

PiperOrigin-RevId: 714013325
  • Loading branch information
Aliia Khasanova authored and Google-ML-Automation committed Jan 10, 2025
1 parent 69e993c commit 6a357aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions third_party/triton/temporary/numpy_type_promotion.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/python/test/unit/language/test_core.py
+++ b/python/test/unit/language/test_core.py
@@ -363,8 +363,7 @@ def _test_binary(dtype_x, dtype_y, expr,
# We remove any explicit casting
pattern = r'\.astype\(np\.\w+\)'
scalar_expr = expr if numpy_expr is None else re.sub(pattern, '', numpy_expr)
- with promotion_numpy_2_0():
- z_ref = eval(scalar_expr)
+ z_ref = eval(scalar_expr)
else:
z_ref = eval(expr if numpy_expr is None else numpy_expr)

1 change: 1 addition & 0 deletions third_party/triton/temporary/series.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ those to this list.
"""

temporary_patch_list = [
"//third_party/triton:temporary/numpy_type_promotion.patch",
# Add new patches just above this line
]

0 comments on commit 6a357aa

Please sign in to comment.