taichi.snode

Submodules

Package Contents

Classes

FieldsBuilder

A builder that constructs a SNodeTree instance.

class taichi.snode.FieldsBuilder

A builder that constructs a SNodeTree instance.

Example:

x = ti.field(ti.i32)
y = ti.field(ti.f32)
fb = ti.FieldsBuilder()
fb.dense(ti.ij, 8).place(x)
fb.pointer(ti.ij, 8).dense(ti.ij, 4).place(y)

# Afer this line, `x` and `y` are placed. No more fields can be placed
# into `fb`.
#
# The tree looks like the following:
# (implicit root)
#  |
#  +-- dense +-- place(x)
#  |
#  +-- pointer +-- dense +-- place(y)
fb.finalize()
classmethod finalized_roots(cls)

Gets all the roots of the finalized SNodeTree.

Returns

A list of the roots of the finalized SNodeTree.

property ptr(self)
property root(self)
property empty(self)
property finalized(self)
deactivate_all(self)

Same as taichi.lang.snode.SNode.deactivate_all()

dense(self, indices: Union[Sequence[_Axis], _Axis], dimensions: Union[Sequence[int], int])

Same as taichi.lang.snode.SNode.dense()

pointer(self, indices: Union[Sequence[_Axis], _Axis], dimensions: Union[Sequence[int], int])

Same as taichi.lang.snode.SNode.pointer()

abstract hash(self, indices, dimensions)

Same as taichi.lang.snode.SNode.hash()

dynamic(self, index: Union[Sequence[_Axis], _Axis], dimension: Union[Sequence[int], int], chunk_size: Optional[int] = None)

Same as taichi.lang.snode.SNode.dynamic()

bitmasked(self, indices: Union[Sequence[_Axis], _Axis], dimensions: Union[Sequence[int], int])

Same as taichi.lang.snode.SNode.bitmasked()

bit_struct(self, num_bits: int)

Same as taichi.lang.snode.SNode.bit_struct()

bit_array(self, indices: Union[Sequence[_Axis], _Axis], dimensions: Union[Sequence[int], int], num_bits: int)

Same as taichi.lang.snode.SNode.bit_array()

place(self, *args: Any, offset: Optional[Union[Sequence[int], int]] = None, shared_exponent: bool = False)

Same as taichi.lang.snode.SNode.place()

lazy_grad(self)

Same as taichi.lang.snode.SNode.lazy_grad()

finalize(self, raise_warning=True)

Constructs the SNodeTree and finalizes this builder.

Parameters

raise_warning (bool) – Raise warning or not.