Returns a `TensorShape` combining the information in `self` and `other`. The dimensions in `self` and `other` are merged elementwise, according to the rules defined for `Dimension.merge_with()`. Args: other: Another `TensorShape`. Returns: A `TensorShape` containing th
(self, other)
| 905 | return None |
| 906 | |
| 907 | def merge_with(self, other): |
| 908 | """Returns a `TensorShape` combining the information in `self` and `other`. |
| 909 | |
| 910 | The dimensions in `self` and `other` are merged elementwise, |
| 911 | according to the rules defined for `Dimension.merge_with()`. |
| 912 | |
| 913 | Args: |
| 914 | other: Another `TensorShape`. |
| 915 | |
| 916 | Returns: |
| 917 | A `TensorShape` containing the combined information of `self` and |
| 918 | `other`. |
| 919 | |
| 920 | Raises: |
| 921 | ValueError: If `self` and `other` are not compatible. |
| 922 | """ |
| 923 | other = as_shape(other) |
| 924 | if self._dims is None: |
| 925 | return other |
| 926 | else: |
| 927 | try: |
| 928 | self.assert_same_rank(other) |
| 929 | new_dims = [] |
| 930 | for i, dim in enumerate(self._dims): |
| 931 | new_dims.append(dim.merge_with(other[i])) |
| 932 | return TensorShape(new_dims) |
| 933 | except ValueError: |
| 934 | raise ValueError("Shapes %s and %s are not compatible" % (self, other)) |
| 935 | |
| 936 | def __add__(self, other): |
| 937 | if not isinstance(other, TensorShape): |