Skip to content

Commit 1ead27d

Browse files
authored
Fix flake8 format in PatchEmbeddingBlock (#8742)
### Description Fix flake8 format in `PatchEmbeddingBlock` ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Yun Liu <yunl@nvidia.com>
1 parent f18ad5e commit 1ead27d

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

monai/data/box_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,8 @@ def non_max_suppression(
11281128
scores_t, *_ = convert_to_dst_type(scores, boxes_t)
11291129

11301130
# sort boxes in descending order according to the scores
1131-
sort_idxs = torch.argsort(scores_t, dim=0, descending=True)
1131+
# use stable=True to ensure deterministic ordering when scores are equal
1132+
sort_idxs = torch.argsort(scores_t, dim=0, descending=True, stable=True)
11321133
boxes_sort = deepcopy(boxes_t)[sort_idxs, :]
11331134

11341135
# initialize the list of picked indexes

monai/networks/blocks/patchembedding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(
101101
chars = (("h", "p1"), ("w", "p2"), ("d", "p3"))[:spatial_dims]
102102
from_chars = "b c " + " ".join(f"({k} {v})" for k, v in chars)
103103
to_chars = f"b ({' '.join([c[0] for c in chars])}) ({' '.join([c[1] for c in chars])} c)"
104-
axes_len = {f"p{i+1}": p for i, p in enumerate(patch_size)}
104+
axes_len = {f"p{i + 1}": p for i, p in enumerate(patch_size)}
105105
self.patch_embeddings = nn.Sequential(
106106
Rearrange(f"{from_chars} -> {to_chars}", **axes_len), nn.Linear(self.patch_dim, hidden_size)
107107
)

runtests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function print_version {
136136

137137
function install_deps {
138138
echo "Pip installing MONAI development dependencies and compile MONAI cpp extensions..."
139-
${cmdPrefix}"${PY_EXE}" -m pip install -r requirements-dev.txt
139+
${cmdPrefix}"${PY_EXE}" -m pip install --no-build-isolation -r requirements-dev.txt
140140
}
141141

142142
function compile_cpp {

0 commit comments

Comments
 (0)