Skip to content

Commit

Permalink
(WIP) Use -1 for dynamic dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelosthege committed Feb 18, 2023
1 parent d47398a commit 9013415
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mcbackend/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ def is_rigid(nshape: Optional[Shape]):
This "nullable shape" is interpreted as follows:
- ``[]`` indicates scalar shape (rigid: True).
- ``[2, 3]`` indicates a matrix with 2 rows and 3 columns (rigid: True).
- ``[2, 0]`` indicates a matrix with 2 rows and dynamic number of columns (rigid: False).
- ``[2, -1]`` indicates a matrix with 2 rows and dynamic number of columns (rigid: False).
- ``None`` indicates dynamic dimensionality (rigid: False).
"""
if nshape is None:
return False
if any(s == 0 for s in nshape):
if any(s == -1 for s in nshape):
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion mcbackend/meta.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protobufs/meta.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ message Variable {
// The default value, an empty sequence, corresponds to scalar shape.
// Note that for variables of dynamic dimensionality, ``undefined_ndim=True``
// can be set to render ``shape`` and ``dims`` meaningless.
repeated uint64 shape = 3;
repeated int64 shape = 3;
// Names of the variable's dimensions.
// The default value, an empty sequence, corresponds to undefined dimension names
// and applies to scalar variables, and variables where ``undefined_ndim=True``.
Expand Down

0 comments on commit 9013415

Please sign in to comment.