Skip to content

Commit

Permalink
Minor improvement on the decomposition of upsample_bilinear
Browse files Browse the repository at this point in the history
As per title

[ghstack-poisoned]
  • Loading branch information
lezcano committed May 17, 2023
1 parent ff3f196 commit 6c3d80c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions torch/_decomp/decompositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2781,19 +2781,15 @@ def upsample_bilinear2d(
if align_corners:
h_scale_factor = (in_h - 1) / (out_h - 1)
else:
h_scale_factor = (
in_h / (in_h * scales_h) if scales_h is not None else in_h / out_h
)
h_scale_factor = 1.0 / scales_h if scales_h is not None else in_h / out_h
else:
h_scale_factor = 0.0

if out_w > 1:
if align_corners:
w_scale_factor = (in_w - 1) / (out_w - 1)
else:
w_scale_factor = (
in_w / (in_w * scales_w) if scales_w is not None else in_w / out_w
)
w_scale_factor = 1.0 / scales_w if scales_w is not None else in_w / out_w
else:
w_scale_factor = 0.0

Expand Down

0 comments on commit 6c3d80c

Please sign in to comment.