Commit 3de2c0b
Fix L1Loss when target.requires_grad is True. (#44471)
Summary:
Pull Request resolved: #44471
L1Loss had a completely different (and incorrect, see #43228) path when target.requires_grad was True.
This PR does the following:
1) adds derivative support for target via the normal derivatives.yaml route
2) kill the different (and incorrect) path for when target.requires_grad was True
3) modify the L1Loss CriterionTests to verify that the target derivative is checked.
Test Plan: Imported from OSS
Reviewed By: albanD
Differential Revision: D23626008
Pulled By: gchanan
fbshipit-source-id: 2828be16b56b8dabe114962223d71b0e9a85f0f51 parent ea55820 commit 3de2c0b
File tree
3 files changed
+8
-11
lines changed- tools/autograd
- torch
- nn
- testing/_internal
3 files changed
+8
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1202 | 1202 | | |
1203 | 1203 | | |
1204 | 1204 | | |
| 1205 | + | |
1205 | 1206 | | |
1206 | 1207 | | |
1207 | 1208 | | |
| |||
1520 | 1521 | | |
1521 | 1522 | | |
1522 | 1523 | | |
| 1524 | + | |
1523 | 1525 | | |
1524 | 1526 | | |
1525 | 1527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2629 | 2629 | | |
2630 | 2630 | | |
2631 | 2631 | | |
2632 | | - | |
2633 | | - | |
2634 | | - | |
2635 | | - | |
2636 | | - | |
2637 | | - | |
2638 | | - | |
2639 | | - | |
2640 | | - | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
2641 | 2636 | | |
2642 | 2637 | | |
2643 | 2638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3879 | 3879 | | |
3880 | 3880 | | |
3881 | 3881 | | |
3882 | | - | |
| 3882 | + | |
3883 | 3883 | | |
3884 | 3884 | | |
3885 | 3885 | | |
| |||
4277 | 4277 | | |
4278 | 4278 | | |
4279 | 4279 | | |
4280 | | - | |
| 4280 | + | |
4281 | 4281 | | |
4282 | 4282 | | |
4283 | 4283 | | |
| |||
0 commit comments