MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / merge_with

Method merge_with

tensorflow/python/framework/tensor_shape.py:907–934  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 4

block_diagonalFunction · 0.95
with_rankMethod · 0.95
constant_value_as_shapeFunction · 0.95

Calls 5

assert_same_rankMethod · 0.95
as_shapeFunction · 0.85
TensorShapeClass · 0.70
appendMethod · 0.45
merge_withMethod · 0.45

Tested by 1