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

Method __sub__

tensorflow/python/framework/tensor_shape.py:359–388  ·  view source on GitHub ↗

Returns the subtraction of `other` from `self`. Dimensions are subtracted 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.v

(self, other)

Source from the content-addressed store, hash-verified

357 return self + other
358
359 def __sub__(self, other):
360 """Returns the subtraction of `other` from `self`.
361
362 Dimensions are subtracted as follows:
363
364 ```python
365 tf.compat.v1.Dimension(m) - tf.compat.v1.Dimension(n) ==
366 tf.compat.v1.Dimension(m - n)
367 tf.compat.v1.Dimension(m) - tf.compat.v1.Dimension(None) # equiv. to
368 tf.compat.v1.Dimension(None)
369 tf.compat.v1.Dimension(None) - tf.compat.v1.Dimension(n) # equiv. to
370 tf.compat.v1.Dimension(None)
371 tf.compat.v1.Dimension(None) - tf.compat.v1.Dimension(None) # equiv. to
372 tf.compat.v1.Dimension(None)
373 ```
374
375 Args:
376 other: Another Dimension, or a value accepted by `as_dimension`.
377
378 Returns:
379 A Dimension whose value is the subtraction of `other` from `self`.
380 """
381 try:
382 other = as_dimension(other)
383 except (TypeError, ValueError):
384 return NotImplemented
385 if self._value is None or other.value is None:
386 return Dimension(None)
387 else:
388 return Dimension(self._value - other.value)
389
390 def __rsub__(self, other):
391 """Returns the subtraction of `self` from `other`.

Callers

nothing calls this directly

Calls 2

as_dimensionFunction · 0.85
DimensionClass · 0.70

Tested by

no test coverage detected