Skip to content

Commit

Permalink
[Lang] Add @python_scope decorator for selected MatrixNdarray/VectorN…
Browse files Browse the repository at this point in the history
…darray methods
  • Loading branch information
jim19930609 committed Aug 23, 2022
1 parent 1b4006f commit 0e3567f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/taichi/lang/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -2053,16 +2053,19 @@ def from_numpy(self, arr):
"""
self._ndarray_matrix_from_numpy(arr, self.layout, as_vector=1)

@python_scope
def __deepcopy__(self, memo=None):
ret_arr = VectorNdarray(self.n, self.dtype, self.shape, self.layout)
ret_arr.copy_from(self)
return ret_arr

@python_scope
def _fill_by_kernel(self, val):
from taichi._kernels import \
fill_ndarray_matrix # pylint: disable=C0415
fill_ndarray_matrix(self, val)

@python_scope
def __repr__(self):
return f'<{self.n} {self.layout} ti.Vector.ndarray>'

Expand Down

0 comments on commit 0e3567f

Please sign in to comment.