4

I would like to use the numpy function np.float32(im) with CuPy library in my code.

im = cupy.float32(im)

but when I run the code I'm facing this error:

TypeError: Implicit conversion to a NumPy array is not allowed. Please use `.get()` to construct a NumPy array explicitly.

Any fixes for that?

Francesco Laiti
  • 1,791
  • 2
  • 13
  • 19

1 Answers1

6

You need to add .get() to im inside the brackets:

im = cupy.float32(im.get())
Francesco Laiti
  • 1,791
  • 2
  • 13
  • 19