- cupy.fuse(*args, **kwargs)¶
Decorator that fuses a function.
Since the fused kernels are cached and reused, it is recommended to reuse the same decorated functions instead of e.g. decorating local functions that are defined multiple times.
kernel_name (str) – Name of the fused kernel function. If omitted, the name of the decorated function is used.
>>> @cupy.fuse(kernel_name='squared_diff') ... def squared_diff(x, y): ... return (x - y) * (x - y) ... >>> x = cupy.arange(10) >>> y = cupy.arange(10)[::-1] >>> squared_diff(x, y) array([81, 49, 25, 9, 1, 1, 9, 25, 49, 81])