From d9c431996f3bb232640d412d719be77ca49a31ff Mon Sep 17 00:00:00 2001 From: Peter Hawkins Date: Tue, 13 Aug 2024 08:34:16 -0700 Subject: [PATCH] [numpy] Fix test failures under NumPy 2.0. PiperOrigin-RevId: 662528924 Change-Id: I0a1215f5c7d097cc37c3953a05cd4aebab4701a4 --- acme/wrappers/single_precision.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acme/wrappers/single_precision.py b/acme/wrappers/single_precision.py index e1b90c7f67..101ebc0893 100644 --- a/acme/wrappers/single_precision.py +++ b/acme/wrappers/single_precision.py @@ -75,11 +75,11 @@ def _convert_value(nested_value: types.Nest) -> types.Nest: def _convert_single_value(value): if value is not None: - value = np.array(value, copy=False) + value = np.asarray(value) if np.issubdtype(value.dtype, np.float64): - value = np.array(value, copy=False, dtype=np.float32) + value = np.asarray(value, dtype=np.float32) elif np.issubdtype(value.dtype, np.int64): - value = np.array(value, copy=False, dtype=np.int32) + value = np.asarray(value, dtype=np.int32) return value return tree.map_structure(_convert_single_value, nested_value)