Skip to content

Commit 265f667

Browse files
committed
Fix fill_triangular_matrix
The two lines were switched, leading to performance degradation.
1 parent 0ed0e88 commit 265f667

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bayesflow/utils/tensor_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,14 @@ def fill_triangular_matrix(x: Tensor, upper: bool = False, positive_diag: bool =
335335

336336
# Trick: Create triangular matrix by concatenating with a flipped version of itself, then reshape.
337337
if not upper:
338-
x_list = [x, keras.ops.flip(x[..., n:], axis=-1)]
338+
x_list = [x[..., n:], keras.ops.flip(x, axis=-1)]
339339

340340
y = keras.ops.concatenate(x_list, axis=len(batch_shape))
341341
y = keras.ops.reshape(y, (-1, n, n))
342342
y = keras.ops.tril(y)
343343

344344
else:
345-
x_list = [x[..., n:], keras.ops.flip(x, axis=-1)]
345+
x_list = [x, keras.ops.flip(x[..., n:], axis=-1)]
346346

347347
y = keras.ops.concatenate(x_list, axis=len(batch_shape))
348348
y = keras.ops.reshape(y, (-1, n, n))

0 commit comments

Comments
 (0)