def if_positive(criterion, then_, else_, out=None, queue=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") knl = elementwise.get_if_positive_kernel(criterion.context, criterion.dtype, then_.dtype) if out is None: out = empty_like(then_) _if_positive(out, criterion, then_, else_) return out
def if_positive(criterion, then_, else_, out=None, queue=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") knl = elementwise.get_if_positive_kernel(criterion.context, criterion.dtype, then_.dtype) if out is None: out = empty_like(then_) knl(queue or criterion.queue, criterion._global_size, criterion._local_size, criterion.data, then_.data, else_.data, out.data, criterion.size) return out
def if_positive(criterion, then_, else_, out=None, queue=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") knl = elementwise.get_if_positive_kernel( criterion.context, criterion.dtype, then_.dtype) if out is None: out = empty_like(then_) knl(queue or criterion.queue, criterion._global_size, criterion._local_size, criterion.data, then_.data, else_.data, out.data, criterion.size) return out
def _if_positive(result, criterion, then_, else_): return elementwise.get_if_positive_kernel( result.context, criterion.dtype, then_.dtype)
def _if_positive(result, criterion, then_, else_): return elementwise.get_if_positive_kernel(result.context, criterion.dtype, then_.dtype)