skcuda.linalg.multiply¶
-
skcuda.linalg.
multiply
(x_gpu, y_gpu, overwrite=False)[source]¶ Element-wise array multiplication (Hadamard product).
Parameters: - y_gpu (x_gpu,) – Input arrays to be multiplied.
- dev (pycuda.driver.Device) – Device object to be used.
- overwrite (bool (default: False)) – If true, return the result in y_gpu. is false, return the result in a newly allocated array.
Returns: z_gpu – The element-wise product of the input arrays.
Return type: Examples
>>> import pycuda.autoinit >>> import pycuda.gpuarray as gpuarray >>> import numpy as np >>> import skcuda.linalg as linalg >>> linalg.init() >>> x = np.asarray(np.random.rand(4, 4), np.float32) >>> y = np.asarray(np.random.rand(4, 4), np.float32) >>> x_gpu = gpuarray.to_gpu(x) >>> y_gpu = gpuarray.to_gpu(y) >>> z_gpu = linalg.multiply(x_gpu, y_gpu) >>> np.allclose(x*y, z_gpu.get()) True