From f58a12f8f13798dc0e0c3cde36bc1ece813c7a56 Mon Sep 17 00:00:00 2001 From: Taichi Gardener Date: Thu, 11 Nov 2021 12:55:50 +0000 Subject: [PATCH] Auto Format --- python/taichi/lang/matrix.py | 13 +++++++++---- taichi/ir/frontend_ir.h | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/python/taichi/lang/matrix.py b/python/taichi/lang/matrix.py index ca302551b6731..b6aee6007bd4b 100644 --- a/python/taichi/lang/matrix.py +++ b/python/taichi/lang/matrix.py @@ -169,20 +169,24 @@ def __init__(self, def element_wise_binary(self, foo, other): _taichi_skip_traceback = 1 other = self.broadcast_copy(other) - return Matrix([[foo(self(i, j), other(i, j)) for j in range(self.m)] for i in range(self.n)]) + return Matrix([[foo(self(i, j), other(i, j)) for j in range(self.m)] + for i in range(self.n)]) def broadcast_copy(self, other): if isinstance(other, (list, tuple)): other = Matrix(other) if not isinstance(other, Matrix): - other = Matrix([[other for _ in range(self.m)] for _ in range(self.n)]) + other = Matrix([[other for _ in range(self.m)] + for _ in range(self.n)]) assert self.m == other.m and self.n == other.n, f"Dimension mismatch between shapes ({self.n}, {self.m}), ({other.n}, {other.m})" return other def element_wise_ternary(self, foo, other, extra): other = self.broadcast_copy(other) extra = self.broadcast_copy(extra) - return Matrix([[foo(self(i, j), other(i, j), extra(i, j)) for j in range(self.m)] for i in range(self.n)]) + return Matrix([[ + foo(self(i, j), other(i, j), extra(i, j)) for j in range(self.m) + ] for i in range(self.n)]) def element_wise_writeback_binary(self, foo, other): ret = self.empty_copy() @@ -206,7 +210,8 @@ def element_wise_writeback_binary(self, foo, other): def element_wise_unary(self, foo): _taichi_skip_traceback = 1 - return Matrix([[foo(self(i, j)) for j in range(self.m)] for i in range(self.n)]) + return Matrix([[foo(self(i, j)) for j in range(self.m)] + for i in range(self.n)]) def __matmul__(self, other): """Matrix-matrix or matrix-vector multiply. diff --git a/taichi/ir/frontend_ir.h b/taichi/ir/frontend_ir.h index db744cd016fea..36daa617c2556 100644 --- a/taichi/ir/frontend_ir.h +++ b/taichi/ir/frontend_ir.h @@ -659,7 +659,10 @@ class SNodeOpExpression : public Expression { SNodeOpType op_type, const ExprGroup &indices, const Expr &value) - : snode(snode), op_type(op_type), indices(indices.loaded()), value(value) { + : snode(snode), + op_type(op_type), + indices(indices.loaded()), + value(value) { } void type_check() override;