ifsheldon/stannum

Flexible tensor shape support

ifsheldon opened this issue · 1 comments

Now stannum only supports tensors with fixed shapes which are defined by shapes of registered fields. However, Taichi kernels are more flexible than that.

For example, this simple kernel can handle 3 arrays of the same arbitrary length

@ti.kernel
def array_add(array0: ti.template(), array1: ti.template(), output_array: ti.template()):
    for i in range(array0.shape[0]):
        output_array[i] = array0[i] + array1[i]  

But, we cannot do that with stannum now.

Now I don't have a clear idea about how to implement this, but discussions and PRs are always welcomed.

This is resolved by newly introduced Tube in v0.4.0, which self-manages the life cycle of fields.