diff --git a/python/taichi/lang/matrix.py b/python/taichi/lang/matrix.py index 51399376a408d..91fbc748fac95 100644 --- a/python/taichi/lang/matrix.py +++ b/python/taichi/lang/matrix.py @@ -24,18 +24,13 @@ class Matrix(TaichiOperations): """The matrix class. Args: - n (Union[int, list, tuple], np.ndarray): the first dimension of a matrix. + n (Union[int, list, tuple, np.ndarray]): the first dimension of a matrix. m (int): the second dimension of a matrix. dt (DataType): the element data type. """ is_taichi_class = True - def __init__(self, - n=1, - m=1, - dt=None, - disable_local_tensor=False, - suppress_warning=False): + def __init__(self, n=1, m=1, dt=None, suppress_warning=False): self.local_tensor_proxy = None self.any_array_access = None self.grad = None @@ -49,8 +44,7 @@ def __init__(self, elif not isinstance(n[0], Iterable): # now init a Vector if in_python_scope(): mat = [[x] for x in n] - elif disable_local_tensor or not ti.current_cfg( - ).dynamic_index: + elif not ti.current_cfg().dynamic_index: mat = [[impl.expr_init(x)] for x in n] else: if not ti.is_extension_supported( @@ -88,8 +82,7 @@ def __init__(self, else: # now init a Matrix if in_python_scope(): mat = [list(row) for row in n] - elif disable_local_tensor or not ti.current_cfg( - ).dynamic_index: + elif not ti.current_cfg().dynamic_index: mat = [[impl.expr_init(x) for x in row] for row in n] else: if not ti.is_extension_supported( @@ -1012,20 +1005,6 @@ def cols(cols): """ return Matrix.rows(cols).transpose() - @classmethod - def empty(cls, n, m): - """Clear the matrix and fill None. - - Args: - n (int): The number of the row of the matrix. - m (int): The number of the column of the matrix. - - Returns: - :class:`~taichi.lang.matrix.Matrix`: A :class:`~taichi.lang.matrix.Matrix` instance filled with None. - - """ - return cls([[None] * m for _ in range(n)], disable_local_tensor=True) - def __hash__(self): # TODO: refactor KernelTemplateMapper # If not, we get `unhashable type: Matrix` when diff --git a/python/taichi/lang/struct.py b/python/taichi/lang/struct.py index 4b336db477d1c..d0d0ee9a4290f 100644 --- a/python/taichi/lang/struct.py +++ b/python/taichi/lang/struct.py @@ -214,18 +214,6 @@ def to_dict(self): """ return self.entries - @classmethod - def empty(cls, entries): - """Clear the struct and fill None. - - Args: - members (Dict[str, DataType]): the names and data types for struct members. - Returns: - :class:`~taichi.lang.struct.Struct`: A :class:`~taichi.lang.struct.Struct` instance filled with None. - - """ - return cls({k: None for k in entries}) - @classmethod @python_scope def field(cls, diff --git a/tests/python/test_ast_refactor.py b/tests/python/test_ast_refactor.py index 6d12cd61846b6..c3d8f54d07779 100644 --- a/tests/python/test_ast_refactor.py +++ b/tests/python/test_ast_refactor.py @@ -849,8 +849,7 @@ def test_listcomp(): @ti.func def identity(dt, n: ti.template()): return ti.Matrix([[ti.cast(int(i == j), dt) for j in range(n)] - for i in range(n)], - disable_local_tensor=1) + for i in range(n)]) @ti.kernel def foo(n: ti.template()) -> ti.i32: