Skip to content

Commit

Permalink
MNT support array functions in numpy>=1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
adrinjalali committed Jun 22, 2023
1 parent 795600e commit 80b9c88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions skops/io/_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,17 @@ def _construct(self):
(np.random.RandomState, random_state_get_state),
(np.random.Generator, random_generator_get_state),
]

try:
# From numpy=1.25.0 dispatching for `__array_function__` is done via
# a C wrapper: https://github.com/numpy/numpy/pull/23020
from numpy.core._multiarray_umath import _ArrayFunctionDispatcher

GET_STATE_DISPATCH_FUNCTIONS.append((_ArrayFunctionDispatcher, function_get_state))
except ImportError:
pass


# tuples of type and function that creates the instance of that type
NODE_TYPE_MAPPING = {
("NdArrayNode", PROTOCOL): NdArrayNode,
Expand Down

0 comments on commit 80b9c88

Please sign in to comment.