def if_positive(criterion, then_, else_, out=None, stream=None): if not (criterion.shape == then_.shape == else_.shape): raise ValueError("shapes do not match") if not (then_.dtype == else_.dtype): raise ValueError("dtypes do not match") func = elementwise.get_if_positive_kernel(criterion.dtype, then_.dtype) if out is None: out = empty_like(then_) func.prepared_async_call(criterion._grid, criterion._block, stream, criterion.gpudata, then_.gpudata, else_.gpudata, out.gpudata, criterion.size) return out
def if_positive(criterion, then_, else_, out=None, stream=None): if not (criterion.shape == then_.shape == else_.shape): raise ValueError("shapes do not match") if not (then_.dtype == else_.dtype): raise ValueError("dtypes do not match") func = elementwise.get_if_positive_kernel( criterion.dtype, then_.dtype) if out is None: out = empty_like(then_) func.prepared_async_call(criterion._grid, criterion._block, stream, criterion.gpudata, then_.gpudata, else_.gpudata, out.gpudata, criterion.size) return out