(*other: 'TensorSpec')
| 81 | |
| 82 | @staticmethod |
| 83 | def max(*other: 'TensorSpec'): |
| 84 | other = [o for o in other if o is not None] |
| 85 | if not other: |
| 86 | return None |
| 87 | rank = len(other[0].shape) |
| 88 | dtype = other[0].dtype |
| 89 | assert all(rank == len(o.shape) for o in other) |
| 90 | assert all(dtype == o.dtype for o in other) |
| 91 | return TensorSpec( |
| 92 | [max([o.shape[i] for o in other]) for i in range(rank)], |
| 93 | dtype |
| 94 | ) |
| 95 | |
| 96 | def max_dictionaries(*other: Dict[str, 'TensorSpec']): |
| 97 | return {k: TensorSpec.max(*(o[k] for o in other if k in o)) for k in get_all_keys(other)} |
no test coverage detected