Commit 467f583
authored
Create is_unknown and has_unknown_dim on Shape (#201)
This PR enables usages described in
#199.
This pull request enhances the handling and documentation of unknown
dimensions in the `Shape` class within the ONNX IR core. It introduces
new methods to check for unknown dimensions, updates the documentation
to clarify shape equality with unknowns, and adds comprehensive tests to
ensure correct behavior. Additionally, it clarifies the serialization
logic for symbolic dimensions with unknown values.
**Shape API improvements:**
* Added `is_unknown(dim)` and `has_unknown_dim()` methods to the `Shape`
class to check for unknown (i.e., `None`) dimensions, and updated the
class docstring to clarify shape equality semantics when unknowns are
present.
**Serialization:**
* Clarified that a symbolic dimension with `None` value is valid and
should result in an empty field in the serialized proto, reflecting ONNX
semantics for unknown dimensions.
---------
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>1 parent e6a9b8b commit 467f583
3 files changed
+72
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1219 | 1219 | | |
1220 | 1220 | | |
1221 | 1221 | | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
1222 | 1228 | | |
1223 | 1229 | | |
1224 | 1230 | | |
| |||
1427 | 1433 | | |
1428 | 1434 | | |
1429 | 1435 | | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
1430 | 1459 | | |
1431 | 1460 | | |
1432 | 1461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
746 | 785 | | |
747 | 786 | | |
748 | 787 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2000 | 2000 | | |
2001 | 2001 | | |
2002 | 2002 | | |
2003 | | - | |
2004 | 2003 | | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
0 commit comments