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

Viewed 2927

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?

1 Answers

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

im = cupy.float32(im.get())
Related