question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement more array creation & serialization methods in CuPy

See original GitHub issue

Currently, 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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
SaharCarmelcommented, Oct 28, 2021

I’m having trouble to decide where to place all the info in the .rst files. Since fromstring and from regex can be regarded as a creation function from existing data. What do you think?

Ah, sorry I overlooked that they are listed twice in the NumPy API reference… Could you put fromregex, fromstring and loadtxt in cupy/_creation/from_data.py in that case, and list it twice in both rst files?

Sure.

1reaction
kmaehashicommented, Oct 23, 2021

About the Array serialization functions. Where those functions should be written at?

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 under String formatting section, so cupy/_io/formatting.py is the right place to put it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found