taichi.types#

taichi.types.any_arr#

Alias for ArgAnyArray.

Example:

>>> @ti.kernel
>>> def to_numpy(x: ti.any_arr(), y: ti.any_arr()):
>>> 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.
taichi.types.ext_arr()#

Type annotation for external arrays.

External arrays are formally defined as the data from other Python frameworks. For now, Taichi supports numpy and pytorch.

Example:

>>> @ti.kernel
>>> def to_numpy(arr: ti.ext_arr()):
>>> for i in x:
>>> arr[i] = x[i]
>>>
>>> arr = numpy.zeros(...)
>>> to_numpy(arr) # `arr` will be filled with `x`'s data.
taichi.types.f16#

Alias for float16

taichi.types.f32#

Alias for float32

taichi.types.f64#

Alias for float64

taichi.types.float16#

16-bit precision floating point data type.

taichi.types.float32#

32-bit single precision floating point data type.

taichi.types.float64#

64-bit double precision floating point data type.

taichi.types.i16#

Alias for int16

taichi.types.i32#

Alias for int32

taichi.types.i64#

Alias for int64

taichi.types.i8#

Alias for int8

taichi.types.int16#

16-bit signed integer data type.

taichi.types.int32#

32-bit signed integer data type.

taichi.types.int64#

64-bit signed integer data type.

taichi.types.int8#

8-bit signed integer data type.

taichi.types.is_integral#
taichi.types.is_signed#
taichi.types.matrix(n, m, dtype)#
class taichi.types.sparse_matrix_builder#
taichi.types.struct(**kwargs)#
taichi.types.template#

Alias for Template.

taichi.types.u16#

Alias for uint16

taichi.types.u32#

Alias for uint32

taichi.types.u64#

Alias for uint64

taichi.types.u8#

Alias for uint8

taichi.types.uint16#

16-bit unsigned integer data type.

taichi.types.uint32#

32-bit unsigned integer data type.

taichi.types.uint64#

64-bit unsigned integer data type.

taichi.types.uint8#

8-bit unsigned integer data type.

taichi.types.vector(n, dtype)#