-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numpy 2.0 compatibility #251
Conversation
cma/transformations.py
Outdated
@@ -1029,7 +1029,7 @@ def pheno(self, x, into_bounds=None, copy=True, | |||
input_type = type(x) | |||
if into_bounds is None: | |||
into_bounds = (lambda x, copy=False: | |||
x if not copy else array(x, copy=copy)) | |||
x if not copy else np.asarray(x, copy=copy)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a bug: np.asarray
doesn't accept a copy
argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! I'll change this to array(x, copy=True)
to make it clear that it's only called when copy=True
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! Looks good beside the small point I commented on.
Another question: did you consider using float(.)
instead of .item()
when a np.float64
is expected? I guess both has pros and cons.
I haven't thought of using |
While reviewing pytorch/botorch#2293, I noticed test failures coming from cma due to incompatibility with Numpy 2.0. One thing led to another and here we are with a PR making cma compatible with Numpy 2.0.
Changelist:
Test fixes:
Test plan: