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

Method __add__

tensorflow/python/framework/tensor_shape.py:317–346  ·  view source on GitHub ↗

Returns the sum of `self` and `other`. Dimensions are summed as follows: ```python tf.compat.v1.Dimension(m) + tf.compat.v1.Dimension(n) == tf.compat.v1.Dimension(m + n) tf.compat.v1.Dimension(m) + tf.compat.v1.Dimension(None) # equiv. to tf.compat.v1.Dimension(N

(self, other)

Source from the content-addressed store, hash-verified

315 return Dimension(self._value)
316
317 def __add__(self, other):
318 """Returns the sum of `self` and `other`.
319
320 Dimensions are summed as follows:
321
322 ```python
323 tf.compat.v1.Dimension(m) + tf.compat.v1.Dimension(n) ==
324 tf.compat.v1.Dimension(m + n)
325 tf.compat.v1.Dimension(m) + tf.compat.v1.Dimension(None) # equiv. to
326 tf.compat.v1.Dimension(None)
327 tf.compat.v1.Dimension(None) + tf.compat.v1.Dimension(n) # equiv. to
328 tf.compat.v1.Dimension(None)
329 tf.compat.v1.Dimension(None) + tf.compat.v1.Dimension(None) # equiv. to
330 tf.compat.v1.Dimension(None)
331 ```
332
333 Args:
334 other: Another Dimension, or a value accepted by `as_dimension`.
335
336 Returns:
337 A Dimension whose value is the sum of `self` and `other`.
338 """
339 try:
340 other = as_dimension(other)
341 except (TypeError, ValueError):
342 return NotImplemented
343 if self._value is None or other.value is None:
344 return Dimension(None)
345 else:
346 return Dimension(self._value + other.value)
347
348 def __radd__(self, other):
349 """Returns the sum of `other` and `self`.

Callers

nothing calls this directly

Calls 2

as_dimensionFunction · 0.85
DimensionClass · 0.70

Tested by

no test coverage detected