Skip to main content

taichi.types.ndarray_type#

taichi.types.ndarray_type.ndarray#

Alias for NdarrayType.

Example:

>>> @ti.kernel
>>> def to_numpy(x: ti.types.ndarray(), y: ti.types.ndarray()):
>>> for i in range(n):
>>> x[i] = y[i]
>>>
>>> y = ti.ndarray(ti.f64, shape=n)
>>> ... # calculate y
>>> x = numpy.zeros(n)
>>> to_numpy(x, y) # `x` will be filled with `y`'s data.
Was this helpful?