From 64cbc497af3e990af6ad4b83ff648a774768fd1b Mon Sep 17 00:00:00 2001 From: Peter Hawkins Date: Thu, 25 Jul 2024 11:25:38 -0700 Subject: [PATCH] [numpy] Fix users of NumPy APIs that are removed in NumPy 2.0. This change migrates users of APIs removed in NumPy 2.0 to their recommended replacements (https://numpy.org/devdocs/numpy_2_0_migration_guide.html). PiperOrigin-RevId: 656022757 --- fedjax/core/serialization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fedjax/core/serialization.py b/fedjax/core/serialization.py index 40c918b..d69f63e 100644 --- a/fedjax/core/serialization.py +++ b/fedjax/core/serialization.py @@ -132,7 +132,7 @@ def _msgpack_ext_pack(x): _bytes_ndarray_to_bytes(x)) elif isinstance(x, (np.ndarray, jax.Array)): return msgpack.ExtType(_MsgpackExtType.ndarray, _ndarray_to_bytes(x)) - elif np.issctype(type(x)): + elif isinstance(x, np.generic): # pack scalar as ndarray return msgpack.ExtType(_MsgpackExtType.npscalar, _ndarray_to_bytes(np.asarray(x)))