You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It does not seem to be possible to set the dtype of ti.types.ndarray(dtype=vec3, ndim=1) in the signature of a ti.func to a vector type.
To Reproduce
importtaichiastiti.init()
vec3=ti.types.vector(3, ti.f32)
@ti.func# vvvvvvvvvv-------------- Works without this part.defchild_func(a: ti.types.ndarray(dtype=vec3, ndim=1)):
pass@ti.kerneldefparent_func(x: ti.types.ndarray(dtype=vec3, ndim=1)):
child_func(x)
arr=ti.ndarray(vec3, shape=(4))
parent_func(arr)
Log/Screenshots
$ python my_sample_code.py
[Taichi] version 1.4.1, llvm 15.0.4, commit e67c674e, linux, python 3.7.4
[Taichi] Starting on arch=x64
Traceback (most recent call last):
File "test.py", line 15, in <module>
parent_func(arr)
File "/home/myusername/miniconda3/lib/python3.7/site-packages/taichi/lang/kernel_impl.py", line 976, in wrapped
raise type(e)('\n' + str(e)) from None
taichi.lang.exception.TaichiCompilationError:
File "test.py", line 12, in parent_func:
child_func(x)
File "test.py", line 6, in child_func:
@ti.func
Traceback (most recent call last):
File "/home/myusername/miniconda3/lib/python3.7/site-packages/taichi/lang/ast/ast_transformer_utils.py", line 25, in __call__
return method(ctx, node)
File "/home/myusername/miniconda3/lib/python3.7/site-packages/taichi/lang/ast/ast_transformer.py", line 652, in build_FunctionDef
data.get_type())
File "/home/myusername/miniconda3/lib/python3.7/site-packages/taichi/types/ndarray_type.py", line 112, in check_matched
f"Expect TensorType element for Ndarray with element_dim: {self.dtype.ndim} > 0"
TypeError: Expect TensorType element for Ndarray with element_dim: 1 > 0
Additional comments
Scalar types instead of vec3 work, e.g. by replacing vec3 = ti.types.vector(3, ti.f32) with vec3 = ti.f32.
Not giving type information at all works, too.
The text was updated successfully, but these errors were encountered:
Describe the bug
It does not seem to be possible to set the
dtype
ofti.types.ndarray(dtype=vec3, ndim=1)
in the signature of ati.func
to a vector type.To Reproduce
Log/Screenshots
Additional comments
vec3
work, e.g. by replacingvec3 = ti.types.vector(3, ti.f32)
withvec3 = ti.f32
.The text was updated successfully, but these errors were encountered: