Open GargantuaOmni opened 3 years ago
Thanks for proposing all these!
Sometimes when src is a uniform ScalarField we want we input a single scalar rather than a field to save space.
I wonder if you can just create a 0-D ScalarField in this case :-) ?
I am not sure. Does src[2, 3]
make sense when src
is a 0-D ScalarNdarray? Will compiler make it equivalent to src[0, 0]
?
I am not sure. Does
src[2, 3]
make sense whensrc
is a 0-D ScalarNdarray? Will compiler make it equivalent tosrc[0, 0]
?
Do you mean that your src
is 0-D but dst
is 2-D, and you want to set all values of dst
to the value of src
?
Yes, and maybe with some computation. In script we expect to make the code available for src
in both 2-D and 0-D, which will apply to different cases.
I am not sure. Does src[2, 3] make sense when src is a 0-D ScalarNdarray? Will compiler make it equivalent to src[0, 0]?
I think it's better to have some kind of adaptor rather than asking a Taichi field to support a coordinate with mismatching dimensions
Thanks. Let me think about it.
When we are developing some image processing programs, we have faced several problems which we might walk around but still noticed. We made those proposes here, though maybe not all of them are reasonable. We will be appreciate that if Taichi could make some improvement about it.
For example, we want something like:
Image -> VectorNdarray with 4 channels
Image.slice([3], ......) returns a ScalarNdarray with 1 channel without spending more space on GPU
Data -> VectorNdarray with 8 channels
Data.slice([2, 3, 5], ......) returns a VectorNdarray with 3 channels (2, 3, 5) without spending more space on GPU
For example, we are using something like
for P in ti.grouped(src): dst[P] = some_computation(src[P], ....)
Sometimes whensrc
is a uniform ScalarField we want we input a single scalar rather than a field to save space. We want thatsrc[P]
is equivalent tosrc
ifsrc
is a scalar, thus we could reuse those functions in some way.Discussion above also applies to VectorField.
One-dimension Vector Sometimes we want one-dimension vector be equivalent with scalar. That is,
src
is a ScalarNdarray, 'a = ti.Vector([1.0])' and thensrc[P] += a
should make sense.Automatically passing vector Sometimes we are constructing numpy array in python scope and pass it into Taichi kernel using ti.any_arr() and get a Ndarray inside the kernel. However, sometimes we are expecting a vector be automatically got through this passing procedure.
We understand that we need to ensure that the vector length should be fixed during compiling. Thus we propose that there be a way that allows us to pass a vector with an arbitrary but fixed length into kernel.