Commit c02dfd6
authored
Arm backend: Replace asserts with error handling in upsample operators (pytorch#10577)
Update `op_upsample_bilinear2d.py` and `op_upsample_nearest2d.py`
classes to replace `assert` checks with `ValueError` exceptions for
improved error handling and code robustness.
- Change static shape checks from assertions to conditional raises of
`ValueError` for clear runtime error communication.
- Replaced `assert` checks for int16 range validation of `scale_n_yx`,
`scale_d_yx`, and `border_yx` with explicit value range checks that
raise `ValueError` when bounds are breached.
Signed-off-by: Sebastian Larsson <[email protected]>1 parent 12ed924 commit c02dfd6
File tree
2 files changed
+16
-12
lines changed- backends/arm/operators
2 files changed
+16
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 37 | + | |
| 38 | + | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| |||
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
| 39 | + | |
| 40 | + | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
0 commit comments