Comments (4)
I'm late to the party here, just noticed this. The way to handle array creation is use np.*_like
functions, as in
numpy.empty_like(some_input_whose_type_will_be_imitated, dtype=..., shape=...)
In the past, the *_like
functions did not allow users to customize the shape
because the whole point was to return array of the same shape. Now, they may be used to return an array of the same type
but, optionally, a different shape
or internal dtype
. This was a added in a recent release of numpy; the PR to add it to dask is not yet merged as of this writing: dask/dask#6064
from autocorr.
can we walk back up the class / module tree of the input to sort out what version of empty
to call?
from autocorr.
Looks like we need to rely on __module__
? Not really a fan of it...
>>> import inspect
>>>
>>> import cupy as cp
>>> a = cp.empty(10)
>>> type(a).__module__
'cupy.core.core'
>>> inspect.getmodule(a) is None # useless
True
>>>
>>> import numpy as np
>>> b = np.empty(10)
>>> type(b).__module__
'numpy'
>>> inspect.getmodule(b) is None # useless
True
from autocorr.
For CuPy's uninformative __module__
, just raised an issue: cupy/cupy#3266. Not sure whether other libraries are compliant on this aspect or not.
from autocorr.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autocorr.