Skip to content

Commit 347f9fe

Browse files
committed
Avoid reformatting of code blocks with shape comments for readability
1 parent d54e35b commit 347f9fe

14 files changed

Lines changed: 32 additions & 32 deletions

linear_operator/operators/_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,10 +1682,10 @@ def inv_quad_logdet(
16821682
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
16831683
logdet: Optional[bool] = False,
16841684
reduce_inv_quad: Optional[bool] = True,
1685-
) -> Tuple[
1685+
) -> Tuple[ # fmt: off
16861686
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
16871687
Optional[Tensor], # shape: (...)
1688-
]:
1688+
]: # fmt: on
16891689
r"""
16901690
Calls both :func:`inv_quad` and :func:`logdet` on a positive
16911691
definite matrix (or batch) :math:`\mathbf A`. However, calling this

linear_operator/operators/batch_repeat_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ def inv_quad_logdet(
260260
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
261261
logdet: Optional[bool] = False,
262262
reduce_inv_quad: Optional[bool] = True,
263-
) -> Tuple[
263+
) -> Tuple[ # fmt: off
264264
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
265265
Optional[Tensor], # shape: (...)
266-
]:
266+
]: # fmt: on
267267
if not self.is_square:
268268
raise RuntimeError(
269269
"inv_quad_logdet only operates on (batches of) square (positive semi-definite) LinearOperators. "

linear_operator/operators/block_diag_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ def inv_quad_logdet(
165165
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
166166
logdet: Optional[bool] = False,
167167
reduce_inv_quad: Optional[bool] = True,
168-
) -> Tuple[
168+
) -> Tuple[ # fmt: off
169169
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
170170
Optional[Tensor], # shape: (...)
171-
]:
171+
]: # fmt: on
172172
if inv_quad_rhs is not None:
173173
inv_quad_rhs = self._add_batch_dim(inv_quad_rhs)
174174
inv_quad_res, logdet_res = self.base_linear_op.inv_quad_logdet(

linear_operator/operators/block_interleaved_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ def inv_quad_logdet(
130130
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
131131
logdet: Optional[bool] = False,
132132
reduce_inv_quad: Optional[bool] = True,
133-
) -> Tuple[
133+
) -> Tuple[ # fmt: off
134134
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
135135
Optional[Tensor], # shape: (...)
136-
]:
136+
]: # fmt: on
137137
if inv_quad_rhs is not None:
138138
inv_quad_rhs = self._add_batch_dim(inv_quad_rhs)
139139
inv_quad_res, logdet_res = self.base_linear_op.inv_quad_logdet(

linear_operator/operators/cat_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,10 @@ def inv_quad_logdet(
393393
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
394394
logdet: Optional[bool] = False,
395395
reduce_inv_quad: Optional[bool] = True,
396-
) -> Tuple[
396+
) -> Tuple[ # fmt: off
397397
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
398398
Optional[Tensor], # shape: (...)
399-
]:
399+
]: # fmt: on
400400
res = super().inv_quad_logdet(inv_quad_rhs, logdet, reduce_inv_quad)
401401
return tuple(r.to(self.device) for r in res)
402402

linear_operator/operators/chol_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ def inv_quad_logdet(
123123
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
124124
logdet: Optional[bool] = False,
125125
reduce_inv_quad: Optional[bool] = True,
126-
) -> Tuple[
126+
) -> Tuple[ # fmt: off
127127
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
128128
Optional[Tensor], # shape: (...)
129-
]:
129+
]: # fmt: on
130130
if not self.is_square:
131131
raise RuntimeError(
132132
"inv_quad_logdet only operates on (batches of) square (positive semi-definite) LinearOperators. "

linear_operator/operators/diag_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ def inv_quad_logdet(
165165
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
166166
logdet: Optional[bool] = False,
167167
reduce_inv_quad: Optional[bool] = True,
168-
) -> Tuple[
168+
) -> Tuple[ # fmt: off
169169
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
170170
Optional[Tensor], # shape: (...)
171-
]:
171+
]: # fmt: on
172172
# TODO: Use proper batching for inv_quad_rhs (prepand to shape rathern than append)
173173
if inv_quad_rhs is None:
174174
rhs_batch_shape = torch.Size()

linear_operator/operators/identity_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ def inv_quad_logdet(
189189
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
190190
logdet: Optional[bool] = False,
191191
reduce_inv_quad: Optional[bool] = True,
192-
) -> Tuple[
192+
) -> Tuple[ # fmt: off
193193
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
194194
Optional[Tensor], # shape: (...)
195-
]:
195+
]: # fmt: on
196196
# TODO: Use proper batching for inv_quad_rhs (prepand to shape rather than append)
197197
if inv_quad_rhs is None:
198198
inv_quad_term = torch.empty(0, dtype=self.dtype, device=self.device)

linear_operator/operators/kronecker_product_added_diag_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ def inv_quad_logdet(
6767
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
6868
logdet: Optional[bool] = False,
6969
reduce_inv_quad: Optional[bool] = True,
70-
) -> Tuple[
70+
) -> Tuple[ # fmt: off
7171
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
7272
Optional[Tensor], # shape: (...)
73-
]:
73+
]: # fmt: on
7474
if inv_quad_rhs is not None:
7575
inv_quad_term, _ = super().inv_quad_logdet(
7676
inv_quad_rhs=inv_quad_rhs, logdet=False, reduce_inv_quad=reduce_inv_quad

linear_operator/operators/kronecker_product_linear_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ def inv_quad_logdet(
164164
inv_quad_rhs: Optional[Tensor] = None, # shape: (*batch, N, M) or (*batch, N)
165165
logdet: Optional[bool] = False,
166166
reduce_inv_quad: Optional[bool] = True,
167-
) -> Tuple[
167+
) -> Tuple[ # fmt: off
168168
Optional[Tensor], # shape: (*batch, M) or (*batch) or (0)
169169
Optional[Tensor], # shape: (...)
170-
]:
170+
]: # fmt: on
171171
if inv_quad_rhs is not None:
172172
inv_quad_term, _ = super().inv_quad_logdet(
173173
inv_quad_rhs=inv_quad_rhs, logdet=False, reduce_inv_quad=reduce_inv_quad

0 commit comments

Comments
 (0)