Skip to content

Commit

Permalink
[math] Shape item name check
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Mar 17, 2023
1 parent d6b81fc commit 7896cc9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions phi/math/_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def __init__(self, sizes: tuple, names: tuple, types: tuple, item_names: tuple):
for name, size in zip(names, sizes):
if size is not None and isinstance(size, Tensor):
assert size.rank > 0
for size, item_names in zip(self.sizes, self.item_names):
if item_names is not None:
assert len(item_names) == size, f"Number of item names ({len(item_names)}) does not match size {size}"

def _check_is_valid_tensor_shape(self):
if DEBUG_CHECKS:
Expand Down

0 comments on commit 7896cc9

Please sign in to comment.