Commit b602edc
Fix dtype propagation (#1141)
Summary:
Previously, dtypes were not propagated correctly in composed transforms, resulting in errors when different dtypes were mixed. Even specifying a dtype in the constructor does not fix this. Neither does specifying the dtype for each composition function invocation (e.g. as a `kwarg` in `rotate_axis_angle`).
With the change, I also had to modify the default dtype of `RotateAxisAngle`, which was `torch.float64`; it is now `torch.float32` like for all other transforms. This was required because the fix in propagation broke some tests due to dtype mismatches.
This change in default dtype in turn broke two tests due to precision changes (calculations that were previously done in `torch.float64` were now done in `torch.float32`), so I changed the precision tolerances to be less strict. I chose the lowest power of ten that passed the tests here.
Pull Request resolved: #1141
Reviewed By: patricklabatut
Differential Revision: D35192970
Pulled By: bottler
fbshipit-source-id: ba0293e8b3595dfc94b3cf8048e50b7a5e5ed7cf1 parent 21262e3 commit b602edc
File tree
2 files changed
+53
-15
lines changed- pytorch3d/transforms
- tests
2 files changed
+53
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
394 | 396 | | |
395 | 397 | | |
396 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
397 | 401 | | |
398 | 402 | | |
399 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
400 | 406 | | |
401 | 407 | | |
402 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
403 | 411 | | |
404 | 412 | | |
405 | 413 | | |
| |||
488 | 496 | | |
489 | 497 | | |
490 | 498 | | |
491 | | - | |
| 499 | + | |
492 | 500 | | |
493 | 501 | | |
494 | 502 | | |
| |||
532 | 540 | | |
533 | 541 | | |
534 | 542 | | |
535 | | - | |
| 543 | + | |
536 | 544 | | |
537 | 545 | | |
538 | 546 | | |
| |||
571 | 579 | | |
572 | 580 | | |
573 | 581 | | |
574 | | - | |
| 582 | + | |
575 | 583 | | |
576 | 584 | | |
577 | 585 | | |
| |||
598 | 606 | | |
599 | 607 | | |
600 | 608 | | |
601 | | - | |
| 609 | + | |
602 | 610 | | |
603 | 611 | | |
604 | 612 | | |
| |||
629 | 637 | | |
630 | 638 | | |
631 | 639 | | |
632 | | - | |
| 640 | + | |
633 | 641 | | |
634 | 642 | | |
635 | 643 | | |
| |||
646 | 654 | | |
647 | 655 | | |
648 | 656 | | |
649 | | - | |
650 | | - | |
| 657 | + | |
| 658 | + | |
651 | 659 | | |
652 | 660 | | |
653 | 661 | | |
| |||
696 | 704 | | |
697 | 705 | | |
698 | 706 | | |
699 | | - | |
| 707 | + | |
700 | 708 | | |
701 | 709 | | |
702 | 710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
90 | 120 | | |
91 | 121 | | |
92 | 122 | | |
| |||
219 | 249 | | |
220 | 250 | | |
221 | 251 | | |
222 | | - | |
223 | | - | |
| 252 | + | |
| 253 | + | |
224 | 254 | | |
225 | 255 | | |
226 | 256 | | |
| |||
951 | 981 | | |
952 | 982 | | |
953 | 983 | | |
954 | | - | |
| 984 | + | |
955 | 985 | | |
956 | 986 | | |
957 | 987 | | |
| |||
0 commit comments