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

Method merge_with

tensorflow/python/framework/tensor_shape.py:277–315  ·  view source on GitHub ↗

Returns a Dimension that combines the information in `self` and `other`. Dimensions are combined as follows: ```python tf.compat.v1.Dimension(n) .merge_with(tf.compat.v1.Dimension(n)) == tf.compat.v1.Dimension(n) tf.compat.v1.Dimension(n) .merge_with(tf.compat.v1.Dimens

(self, other)

Source from the content-addressed store, hash-verified

275 (self, other))
276
277 def merge_with(self, other):
278 """Returns a Dimension that combines the information in `self` and `other`.
279
280 Dimensions are combined as follows:
281
282 ```python
283 tf.compat.v1.Dimension(n) .merge_with(tf.compat.v1.Dimension(n)) ==
284 tf.compat.v1.Dimension(n)
285 tf.compat.v1.Dimension(n) .merge_with(tf.compat.v1.Dimension(None)) ==
286 tf.compat.v1.Dimension(n)
287 tf.compat.v1.Dimension(None).merge_with(tf.compat.v1.Dimension(n)) ==
288 tf.compat.v1.Dimension(n)
289 # equivalent to tf.compat.v1.Dimension(None)
290 tf.compat.v1.Dimension(None).merge_with(tf.compat.v1.Dimension(None))
291
292 # raises ValueError for n != m
293 tf.compat.v1.Dimension(n) .merge_with(tf.compat.v1.Dimension(m))
294 ```
295
296 Args:
297 other: Another Dimension.
298
299 Returns:
300 A Dimension containing the combined information of `self` and
301 `other`.
302
303 Raises:
304 ValueError: If `self` and `other` are not compatible (see
305 is_compatible_with).
306 """
307 try:
308 other = as_dimension(other)
309 except (TypeError, ValueError):
310 return NotImplemented
311 self.assert_is_compatible_with(other)
312 if self._value is None:
313 return Dimension(other.value)
314 else:
315 return Dimension(self._value)
316
317 def __add__(self, other):
318 """Returns the sum of `self` and `other`.

Callers 15

map_fnFunction · 0.95
enqueue_manyMethod · 0.95
scanFunction · 0.95
testDimensionMethod · 0.95
testUnknownDimensionMethod · 0.95
__init__Method · 0.95
__init__Method · 0.45
separable_conv2d_shapeFunction · 0.45
_broadcast_shape_helperFunction · 0.45
merge_withMethod · 0.45

Calls 3

as_dimensionFunction · 0.85
DimensionClass · 0.70

Tested by 5

testDimensionMethod · 0.76
testUnknownDimensionMethod · 0.76
testMergeFullShapesMethod · 0.36