def atomic_min(x, y): """Atomically compute the minimum of `x` and `y`, element-wise. Store the result in `x`, and return the old value of `x`. `x` must be a writable target, constant expressions or scalars are not allowed. Args: x, y (Union[:mod:`~taichi.types.primitive_types`, :class:`~taichi.Matrix`]): \ The input. Returns: The old value of `x`. Example:: >>> @ti.kernel >>> def test(): >>> x = 2 >>> y = 1 >>> z = ti.atomic_min(x, y) >>> print(x) # 1 the new value of x >>> print(z) # 2, the old value of x >>> >>> ti.atomic_min(1, x) # will raise TaichiSyntaxError """ return impl.expr_init( expr.Expr(_ti_core.expr_atomic_min(x.ptr, y.ptr), tb=stack_info()))
def atomic_min(a, b): return impl.expr_init( expr.Expr(_ti_core.expr_atomic_min(a.ptr, b.ptr), tb=stack_info()))