__array__ and __array_wrap__
See original GitHub issueA question about the Numpy array interface. cupy.ndarray
implements __array__
, but it doesn’t work since np.asarray(cupy_array)
raises an exception:
ValueError: object __array__ method not producing an array
So unless you have other plans for this method, it should be changed to return a Numpy array.
Do you want a PR? I’d also like to have the __array_wrap_
method, so I’d implement that one as well.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Ruby's Array() and Array.wrap (Example) - GoRails
Learn how to remove conditionals and make your code simpler and more reliable using Ruby and ActiveSupport's Array wrap methods.
Read more >wrap (Array) - APIdock
Wraps its argument in an array unless it is already an array (or array-like). Specifically: ... Otherwise, returns an array with the argument...
Read more >Array.wrap — Documentation for rails (3.1.1) - RubyDoc.info
Wraps its argument in an array unless it is already an array (or array-like). Specifically: ... Otherwise, returns an array with the argument...
Read more >Array - Rails API
Wraps its argument in an array unless it is already an array (or array-like). Specifically: If the argument is nil an empty list...
Read more >Array.wrap vs Kernel#array - Lucas Mendelowski
Both methods allow to convert an argument into an array but Kernel#Array has additional behavior: It tries to call to_ary and then to_a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
CuPy uses asynchronous CPU to GPU memory copy by default mode. This is very easy feature because CUDA supports asynchronous execution (kernel launch). But, CuPy does not use asynchronous GPU to CPU memory copy by default. NumPy only supports synchronous execution. So, Python code waits to finish GPU to CPU memory copy. This causes hard to find performance problems.
It is good if the user can select whether to use
__array_wrap__
or not by environment variable or global configure flag.We have no plan for it currently, but we will reopen if someone continues the discussion to support it.