Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 8, 2022
1 parent d1a5517 commit 746b27a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
3 changes: 2 additions & 1 deletion python/taichi/lang/snode.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ def _get_flattened_ptrs(val):
return ptrs
if impl.current_cfg().real_matrix and isinstance(
val, expr.Expr) and val.ptr.is_tensor():
return impl.get_runtime().prog.current_ast_builder().expand_expr([val.ptr])
return impl.get_runtime().prog.current_ast_builder().expand_expr(
[val.ptr])
return [expr.Expr(val).ptr]


Expand Down
24 changes: 17 additions & 7 deletions tests/python/test_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ def _test_append_matrix():
def make_list():
for i in range(10):
for j in range(20):
f[i].append(ti.Matrix([[i * j, i * j * 2], [i * j * 3, i * j * 4]], dt=ti.u8))
f[i].append(
ti.Matrix([[i * j, i * j * 2], [i * j * 3, i * j * 4]],
dt=ti.u8))

make_list()

Expand All @@ -291,7 +293,10 @@ def test_append_matrix():
_test_append_matrix()


@test_utils.test(require=ti.extension.sparse, exclude=[ti.metal], real_matrix=True, real_matrix_scalarize=True)
@test_utils.test(require=ti.extension.sparse,
exclude=[ti.metal],
real_matrix=True,
real_matrix_scalarize=True)
def test_append_matrix_real_matrix():
_test_append_matrix()

Expand All @@ -309,9 +314,10 @@ def make_list():
for i in range(10):
for j in range(20):
f[i].append(
struct(i * j * ti.u64(10**10),
ti.Matrix([[i * j, i * j * 2], [i * j * 3, i * j * 4]], dt=ti.u8),
i * j * 5000))
struct(
i * j * ti.u64(10**10),
ti.Matrix([[i * j, i * j * 2], [i * j * 3, i * j * 4]],
dt=ti.u8), i * j * 5000))

make_list()

Expand All @@ -328,6 +334,10 @@ def test_append_matrix_in_struct():
_test_append_matrix_in_struct()


@test_utils.test(require=ti.extension.sparse, exclude=[ti.metal], real_matrix=True, real_matrix_scalarize=True)
@test_utils.test(require=ti.extension.sparse,
exclude=[ti.metal],
real_matrix=True,
real_matrix_scalarize=True)
def _test_append_matrix_in_struct_real_matrix():
_test_append_matrix_in_struct() # Fails because Matrix expression has no attribute 'cast'
_test_append_matrix_in_struct(
) # Fails because Matrix expression has no attribute 'cast'

0 comments on commit 746b27a

Please sign in to comment.