Question on Vectorize() numpy.exp

Hi, i have a begineer question hope someone can shed some lights:

From the document it appears numpy.exp is supported as a vectoriized function. The input is an array so I assume this arrary is passed in as a host based data, and as the vectorized function runs, this data is copied to device, is that correct or no? If I have this numpy function in the mid of other api calls that happens on the device, then how can I ensure the data always stay on device, and only copied to host when all calculations is done? Would the numpy.exp call copy data back to host upon return? Thank you!

import numpy as np
def exp_gpu(x):
return np.exp(x)

AFAIK numpy.exp is not supported, but math.exp is. You’ll note that math.exp takes a scalar quantity, not an array

1 Like