-
Notifications
You must be signed in to change notification settings - Fork 477
Support ast.IfExp in kernels #500
Copy link
Copy link
Closed
Labels
feature requestRequest for something to be addedRequest for something to be addedlanguage supportPython language supportPython language support
Milestone
Description
Kernels should support expressions like out[i] = 1.0 if out[i] < value else -1, e.g.
import warp as wp
wp.init()
@wp.kernel
def threshold(value: float, out: wp.array(dtype=float)):
i = wp.tid()
out[i] = 1.0 if out[i] < value else -1
a = wp.ones(10, dtype=float)
wp.launch(threshold, (10,), inputs=[0.5, a])
print(a.numpy())Currently, the above code yields:
warp.codegen.WarpCodegenError: Error while parsing function "threshold" at /home/eshi/code-projects/warp/ershi-tests/test_single_line.py:10:
out[i] = 1.0 if out[i] < value else -1
;Construct `ast.IfExp` not supported in kernels.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature requestRequest for something to be addedRequest for something to be addedlanguage supportPython language supportPython language support