-
Notifications
You must be signed in to change notification settings - Fork 303
[REQ] Tile API function to convert between data types #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I also tried to use @warp.func
def where(s):
return warp.where(s, 1., 0.)
warp.tile_map(where, data) This produce the error of inconsistent data type in |
Would this work? import warp
import numpy as np
TILE_SIZE = 128
@warp.kernel
def kernel(
a: warp.array(dtype=int),
b: warp.array(dtype=float),
):
data = warp.tile_load(a, TILE_SIZE)
data0 = warp.untile(data)
data1 = warp.where(data0, 1., 0.)
data2 = warp.tile(data1)
warp.tile_store(b, data2)
data_a = warp.array(np.random.rand(TILE_SIZE) < 0.3, dtype=int)
data_b = warp.array(np.zeros(TILE_SIZE), dtype=float)
warp.launch_tiled(kernel, dim=[1], inputs=[data_a, data_b], block_dim=128)
print(data_a.numpy())
print(data_b.numpy()) |
Your example is converting |
Yep, we'll add this to our list. |
Is it possible to provide such support as soon as possible? This is an urgent requirement for me. Thanks. 😍 Converting the data types of a tiled array may be a simple implementation. I think it should be in the requirements of release 1.8.0? |
Sure, I can work on this next. |
Here is what I want to do. But I do not know what's wrong with this kernel.
The text was updated successfully, but these errors were encountered: