taichi.types
¶
Submodules¶
Package Contents¶
Classes¶
Functions¶
|
Type annotation for external arrays. |
|
|
|
|
|
Attributes¶
Alias for |
|
Alias for |
|
32-bit single precision floating point data type. |
|
Alias for |
|
64-bit double precision floating point data type. |
|
Alias for |
|
32-bit signed integer data type. |
|
Alias for |
|
64-bit signed integer data type. |
|
Alias for |
|
32-bit unsigned integer data type. |
|
Alias for |
|
64-bit unsigned integer data type. |
|
Alias for |
|
- 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.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.template¶
Alias for
Template
.
- class taichi.types.CompoundType¶
- taichi.types.matrix(n, m, dtype)¶
- taichi.types.struct(**kwargs)¶
- taichi.types.vector(n, dtype)¶
- taichi.types.float32¶
32-bit single precision floating point data type.
- taichi.types.float64¶
64-bit double precision floating point data type.
- taichi.types.float16¶
- taichi.types.f16¶
- taichi.types.int8¶
- taichi.types.i8¶
- taichi.types.int16¶
- taichi.types.i16¶
- taichi.types.int32¶
32-bit signed integer data type.
- taichi.types.int64¶
64-bit signed integer data type.
- taichi.types.uint8¶
- taichi.types.u8¶
- taichi.types.uint16¶
- taichi.types.u16¶
- taichi.types.uint32¶
32-bit unsigned integer data type.
- taichi.types.uint64¶
64-bit unsigned integer data type.
- taichi.types.real_types¶
- taichi.types.integer_types¶
- taichi.types.is_signed¶
- taichi.types.is_integral¶