Skip to content

Commit 7139f26

Browse files
David Erikssonfacebook-github-bot
authored andcommitted
Resolve numpy_utils warnings (#3025)
Summary: Pull Request resolved: #3025 Numpy doesn't like assigning a torch.Tensor to a numpy array, so let's do that conversion explicity. This resolves **a ton** of warnings of the form: ``` [W 250925 11:18:45 numpy_utils:91] __array__ implementation doesn't accept a copy keyword, so passing copy=False failed. __array__ must implement 'dtype' and 'copy' keyword arguments. To learn more, see the migration guide https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword ``` Reviewed By: saitcakmak, Balandat Differential Revision: D83269102 fbshipit-source-id: c56c34319521f3cd37a8a9e12885af3b48b609b5
1 parent 83599a9 commit 7139f26

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

botorch/optim/utils/numpy_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def get_bounds_as_ndarray(
8585
lower = -inf if lower is None else lower
8686
upper = inf if upper is None else upper
8787
if isinstance(lower, Tensor):
88-
lower = lower.cpu()
88+
lower = lower.cpu().numpy()
8989
if isinstance(upper, Tensor):
90-
upper = upper.cpu()
90+
upper = upper.cpu().numpy()
9191
out[index : index + size, 0] = lower
9292
out[index : index + size, 1] = upper
9393
index = index + size

0 commit comments

Comments
 (0)