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
Implement np.asarray() #3598
Implement np.asarray() #3598
Conversation
This implements np.asarray() and adds tests.
Seems like a test that was relying on |
As title.
numba/targets/arraymath.py
Outdated
else: | ||
def impl(a, dtype=None): | ||
return np.array(a, dtype) | ||
elif isinstance(a, (types.Float, types.Integer, types.Boolean)): |
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.
Replace types.Float
and types.Integer
with types.Number
so that complex dtype also work.
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.
done.
Codecov Report
@@ Coverage Diff @@
## master #3598 +/- ##
=========================================
- Coverage 80.68% 80.5% -0.19%
=========================================
Files 393 395 +2
Lines 80485 81179 +694
Branches 9164 9240 +76
=========================================
+ Hits 64942 65351 +409
- Misses 14127 14399 +272
- Partials 1416 1429 +13 |
return np.array(a, dtype) | ||
elif isinstance(a, (types.Float, types.Integer, types.Boolean)): | ||
dt_conv = a if _is_nonelike(dtype) else dtype | ||
ty = as_dtype(dt_conv) |
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.
ty
is frozen as a compile-time constant. the first dt_conv
will always be used afterwards
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.
ah yes, thanks, that explains some of the weirdness
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 just realized that my explanation is wrong. The cache is per signature. A different a
should not reach into the same cache.
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 think the problem here is due to this #3612
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.
On merge this #3628 can be closed. |
This is currently failing two unit tests:
|
This seems to be passing Azure now, except for a random failure in the Windows Py27 environment caused by a failure to install VS2008. |
Build seems to be ok now as noted :) |
Looks good. |
This implements np.asarray() and adds tests.