pytorch
0176405c - fix: check if double to i64 is in well-formed range (#94290)

Commit
1 year ago
fix: check if double to i64 is in well-formed range (#94290) Fixes #88951 The output shape of upsample is computed through `(i64)idim * (double)scale` and then casted back to `i64`. If the input scale is ill-formed (say negative number as #88951) which makes `(double)(idim * scale)` to be out of the range for `i64`, the casting will be an undefined behaviour. To fix it, we just check if `(double)(idim * scale)` can fit into `i64`. Pull Request resolved: https://github.com/pytorch/pytorch/pull/94290 Approved by: https://github.com/malfet
Author
Committer
Parents
Loading