Skip to main content

taichi.lang._ndarray#

class taichi.lang._ndarray.Ndarray#

Taichi ndarray class.

Parameters:
  • dtype (DataType) – Data type of each value.

  • shape (Tuple[int]) – Shape of the Ndarray.

copy_from(self, other)#

Copies all elements from another ndarray.

The shape of the other ndarray needs to be the same as self.

Parameters:

other (Ndarray) – The source ndarray.

property element_shape(self)#

Gets ndarray element shape.

Returns:

Ndarray element shape.

Return type:

Tuple[Int]

fill(self, val)#

Fills ndarray with a specific scalar value.

Parameters:

val (Union[int, float]) – Value to fill.

get_type(self)#
class taichi.lang._ndarray.ScalarNdarray(dtype, arr_shape)#

Bases: Ndarray

Taichi ndarray with scalar elements.

Parameters:
  • dtype (DataType) – Data type of each value.

  • shape (Tuple[int]) – Shape of the ndarray.

copy_from(self, other)#

Copies all elements from another ndarray.

The shape of the other ndarray needs to be the same as self.

Parameters:

other (Ndarray) – The source ndarray.

property element_shape(self)#

Gets ndarray element shape.

Returns:

Ndarray element shape.

Return type:

Tuple[Int]

fill(self, val)#

Fills ndarray with a specific scalar value.

Parameters:

val (Union[int, float]) – Value to fill.

from_numpy(self, arr)#
get_type(self)#
to_numpy(self)#