Implement more array creation & serialization methods in CuPy
See original GitHub issueCurrently, the following NumPy-compatible APIs are missing. It would be great to have them in CuPy.
These APIs are relatively simple, so it would be a good starting point for those thinking of contributing to CuPy.
APIs
Array creation functions
- numpy.frombuffer
- numpy.fromfunction
- ~numpy.fromregex~ (not for CuPy, as CuPy does not support structured array yet)
- numpy.fromstring
- numpy.genfromtxt
- numpy.loadtxt
Array serialization functions
- numpy.array2string
- numpy.savetxt
Steps to contribute
- Fork the CuPy repository.
- Implement a function. You can implement these APIs in a similar way as
cupy.fromfile
:cupy/_creation/from_data.py
- Add the function to
cupy/__init__.py
. - Write a test code. (example:
cupy.fromfile
test:tests/cupy_tests/creation_tests/test_from_data.py
) - Build CuPy locally, then run the test code to confirm that the function runs fine. (in short:
pip install -e . && pytest tests/cupy_tests/creation_tests/test_from_data.py
. See the Contribution Guide for details.) - Add the function to the API reference. (example:
cupy.fromfile
is atdocs/source/reference/creation.rst
) - Submit a pull-request.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:18 (18 by maintainers)
Top Results From Across the Web
Array creation routines — CuPy 11.4.0 documentation
Creates an array on the current device. asarray (a[, dtype, order]). Converts an object to array.
Read more >CuPy Documentation
CuPy is a NumPy/SciPy-compatible array library for GPU-accelerated computing with Python. CuPy acts as a drop-in.
Read more >Attempting numpy conversion when not needed in cupy
The problem is cp.int_ is np.int_ , so calling that would invoke a host function to operate on a GPU array, which is...
Read more >Parameter Serialization
The serialization method is defined by the style and explode keywords: ... should generate separate parameters for each array item or object property....
Read more >Chainer Documentation
There are further two ways to use the optimizer directly. ... In particular, the cupy.ndarray class is the GPU array implementation for ...
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
Sure.
You can tell where to implement a function from a filename and a section name of the NumPy API Reference. For example,
numpy.array2string
is documented at https://numpy.org/doc/stable/reference/routines.io.html (io
) and is underString formatting
section, socupy/_io/formatting.py
is the right place to put it.