Skip to content

Commit

Permalink
Fixed round_half_up for negative integers (#1970)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment authored Jul 24, 2023
1 parent 785cbe8 commit 168a828
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/src/nodes/utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# From https://github.com/victorca25/iNNfer/blob/main/utils/utils.py
from __future__ import annotations

import math
import os
import re
from dataclasses import dataclass
Expand Down Expand Up @@ -28,7 +29,7 @@ def round_half_up(number: Union[float, int]) -> int:
https://en.wikipedia.org/wiki/Rounding#Rounding_to_the_nearest_integer
"""
return int(number + 0.5)
return math.floor(number + 0.5)


def get_h_w_c(image: np.ndarray) -> Tuple[int, int, int]:
Expand Down

0 comments on commit 168a828

Please sign in to comment.