Skip to content

Commit

Permalink
refactor: remove assert statement from non-test files
Browse files Browse the repository at this point in the history
Usage of `assert` statement in application logic is discouraged. `assert` is removed with compiling to optimized byte code. Consider raising an exception instead. Ideally, `assert` statement should be used only in tests.
  • Loading branch information
deepsource-autofix[bot] authored Mar 29, 2024
1 parent 3dcd9b0 commit 540b33f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hsf/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ def main(cfg: DictConfig) -> None:
bs = cfg.hardware.engine_settings.batch_size
multispectral = 2 if cfg.multispectrality.pattern else 1

assert multispectral * (
if multispectral * (
tta + 1
) % bs == 0, "test_time_num_aug+1 must be a multiple of batch_size for deepsparse"
) % bs != 0:
raise AssertionError("test_time_num_aug+1 must be a multiple of batch_size for deepsparse")

mris = load_from_config(cfg.files.path, cfg.files.pattern)
_n = len(mris)
Expand Down

0 comments on commit 540b33f

Please sign in to comment.