Skip to content

Commit

Permalink
check for int, float in one line
Browse files Browse the repository at this point in the history
Summary: since same `_sync_obj_states` is called for both `int` and `float` states, merged them into one `elif`

Reviewed By: ananthsub

Differential Revision: D48792448

fbshipit-source-id: 937a5c9f6750439491bfb7206c884b03a61c4ed4
  • Loading branch information
JKSenthil authored and facebook-github-bot committed Aug 29, 2023
1 parent 58b73d1 commit 65bb4ad
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions torcheval/metrics/synclib.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,13 @@ def sync_states(
gathered_states,
process_group=process_group,
)
elif isinstance(my_state_data, int):
_sync_obj_states(
metric_name,
state_name,
my_state_data,
gathered_states,
process_group=process_group,
)
elif isinstance(my_state_data, float):
elif isinstance(
my_state_data,
(
int,
float,
),
):
_sync_obj_states(
metric_name,
state_name,
Expand Down

0 comments on commit 65bb4ad

Please sign in to comment.