def f(a, stream=None): from pycuda.reduction import get_minmax_kernel krnl = get_minmax_kernel(what, a.dtype) return krnl(a, stream=stream)