I'm trying to pad an array with another one in cupy. Below is a MWE:

import cupy as cp
a = cp.random.rand(294, 302, 372)
b = cp.asarray([[5, 5], [5, 5], [2, 2]])
cp.pad(a, b, 'symmetric')

Unfortunately, this yields:

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

Both a and b are on CUDA Device 0, so I do not see the problem. I also do not understand why I would need ".get()" here, as no conversion from cupy to numpy is required. Please note that .get does not solve my problem as in the related post.

0

There are 0 best solutions below