Returns the total number of elements, or none for incomplete shapes.
(self)
| 895 | return Dimension(None) |
| 896 | |
| 897 | def num_elements(self): |
| 898 | """Returns the total number of elements, or none for incomplete shapes.""" |
| 899 | if self.is_fully_defined(): |
| 900 | size = 1 |
| 901 | for dim in self._dims: |
| 902 | size *= dim.value |
| 903 | return size |
| 904 | else: |
| 905 | return None |
| 906 | |
| 907 | def merge_with(self, other): |
| 908 | """Returns a `TensorShape` combining the information in `self` and `other`. |