Skip to content

Commit 8a35a1c

Browse files
committed
fix: make ruff happy
1 parent e481521 commit 8a35a1c

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

qstack/regression/local_kernels.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
RAM_BATCHING_SIZE = 1024**3 * 5 # 5GiB
1717
def compute_distance_matrix(R1,R2):
18-
f"""Computes the manhattan-distance matrix (||r_1 - r_2||_1) between the samples of R1 and R2,
18+
"""Compute the manhattan-distance matrix.
19+
20+
This computes (||r_1 - r_2||_1) between the samples of R1 and R2,
1921
using a batched python/numpy implementation.
2022
2123
Args:
@@ -64,13 +66,9 @@ def compute_distance_matrix(R1,R2):
6466

6567
R1_view = R1[batch_start : batch_start + this_batch_size, None, ...]
6668
np.subtract(R1_view, R2[None,:], out=dists[:this_batch_size])
67-
assert not (dists[:this_batch_size]==0).all()
6869
#np.pow(dists[:this_batch_size], 2, out=dists[:this_batch_size]) # For Euclidean distance
6970
np.abs(dists[:this_batch_size], out=dists[:this_batch_size])
70-
assert not (dists[:this_batch_size]==0).all()
7171
np.sum(dists[:this_batch_size], out=out[batch_start : batch_start+this_batch_size], axis=tuple(range(2,dists.ndim)))
72-
if batch_i == n_batches-1:
73-
assert batch_start + this_batch_size == R1.shape[0]
7472

7573
if transpose_flag:
7674
out = out.T

tests/test_kernels.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python3
22

3-
from time import perf_counter
43
import numpy as np
54
from qstack.regression import kernel, local_kernels
65

0 commit comments

Comments
 (0)