-
Notifications
You must be signed in to change notification settings - Fork 53
Update guidance for output array dtype inference in full_like
#274
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
Conversation
CC @honno |
FWIW, this matched the behavior of |
@asmeurer Correct, but |
Also, just to clarify, for all the |
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.
I've mentioned before that I never quite understood the point of the *_like
functions, but it does seem reasonable to me that they should try to make an array as "like" x
as possible. And more to the point, this now matches the NumPy behavior. So this looks good to me.
Yes, it should be ignored. Compatibility does not apply for the I will update the guidance in a separate PR, however, to make this a bit more explicit. |
This has been approved and simply reverts to previous behavior. Merging... |
This PR
full_like
.Discussion
In gh-167, guidance was changed (see gh-31) to infer the dtype from the
fill_value
. However, this seems to have been a mistake, as scalar values do not have an array data type (onlyint
orfloat
) and do not participate in type promotion.This PR reverts this change, but also includes an explicit note that, if the
fill_value
is not of the same data type "kind" as the resolved output array data type, then behavior is left unspecified (e.g., ifx.dtype
isint64
andfill_value
isfloat
; e.g.,fill_value = 3.5
).