Skip to content

Commit

Permalink
add the SAM2_COMPUTE_SCORE step to flow job
Browse files Browse the repository at this point in the history
Summary: add the SAM2_COMPUTE_SCORE step to flow job

Reviewed By: SeaOtocinclus

Differential Revision: D61341812

fbshipit-source-id: b8ccfe38d5e9ff2bd5068843b18468dbf6422221
  • Loading branch information
Prithviraj Banerjee authored and facebook-github-bot committed Aug 28, 2024
1 parent bd632ef commit 2ccf867
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions hot3d/data_loaders/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,30 @@ def is_float(x: Any) -> bool:
return False


def is_int(x: Any) -> bool:
"""
Function checks if the input is convertible to int
"""
if x is None:
return False
if len(x) == 0:
return False
try:
int(x)
return True
except ValueError:
return False


def float_or_none(x: Any) -> Optional[float]:
"""
Function returns a float if x is convertible to float, otherwise None
"""
return float(x) if is_float(x) else None


def int_or_none(x: Any) -> Optional[int]:
"""
Function returns a int if x is convertible to int, otherwise None
"""
return int(x) if is_int(x) else None

0 comments on commit 2ccf867

Please sign in to comment.