Skip to content

Commit

Permalink
[Lang] Add suppress_warning argument to ti.matrix initialization (tai…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhehaoli1999 authored Oct 28, 2021
1 parent 7b302fa commit 3473264
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/taichi/lang/matrix.py
Original file line number Diff line number Diff line change
@@ -38,7 +38,8 @@ def __init__(self,
m=1,
dt=None,
keep_raw=False,
disable_local_tensor=False):
disable_local_tensor=False,
suppress_warning=False):
self.local_tensor_proxy = None
self.any_array_access = None
self.grad = None
@@ -140,7 +141,7 @@ def __init__(self,
"Declaring matrix fields using `ti.Matrix(n, m, dt, shape)` is no longer supported. Use `ti.Matrix.field(n, m, dtype, shape)` instead."
)

if self.n * self.m > 32:
if self.n * self.m > 32 and not suppress_warning:
warning(
f'Taichi matrices/vectors with {self.n}x{self.m} > 32 entries are not suggested.'
' Matrices/vectors will be automatically unrolled at compile-time for performance.'

0 comments on commit 3473264

Please sign in to comment.