Commit 050bc91b by Yizhi Liu Committed by Tianqi Chen

add tvm.select (#148)

parent 134c6ba3
......@@ -34,6 +34,8 @@ def convert_to_node(value):
"""
if isinstance(value, _CLASS_NODE_BASE):
return value
elif isinstance(value, bool):
return const(value, 'uint1x1')
elif isinstance(value, Number):
return const(value)
elif isinstance(value, string_types):
......
......@@ -463,6 +463,23 @@ def reduce_axis(dom, name="rv"):
"""
return _IterVar(dom, name, 2)
def select(cond, t, f):
"""Construct a select branch
Parameters
----------
cond : Expr
The condition
t : Expr
The result expression if cond is true.
f : Expr
The result expression if cond is false.
Returns
-------
node : Node
The tvm.expr.Select node
"""
return _make.Select(convert(cond), convert(t), convert(f))
def comm_reducer(fcombine, fidentity, name="reduce"):
"""Create a commutative reducer for reduction.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment