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

Method __mul__

tensorflow/python/framework/tensor_shape.py:405–435  ·  view source on GitHub ↗

Returns the product 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.Dimensi

(self, other)

Source from the content-addressed store, hash-verified

403 return Dimension(other.value - self._value)
404
405 def __mul__(self, other):
406 """Returns the product of `self` and `other`.
407
408 Dimensions are summed as follows:
409
410 ```python
411 tf.compat.v1.Dimension(m) * tf.compat.v1.Dimension(n) ==
412 tf.compat.v1.Dimension(m * n)
413 tf.compat.v1.Dimension(m) * tf.compat.v1.Dimension(None) # equiv. to
414 tf.compat.v1.Dimension(None)
415 tf.compat.v1.Dimension(None) * tf.compat.v1.Dimension(n) # equiv. to
416 tf.compat.v1.Dimension(None)
417 tf.compat.v1.Dimension(None) * tf.compat.v1.Dimension(None) # equiv. to
418 tf.compat.v1.Dimension(None)
419 ```
420
421 Args:
422 other: Another Dimension, or a value accepted by `as_dimension`.
423
424 Returns:
425 A Dimension whose value is the product of `self` and `other`.
426 """
427 try:
428 other = as_dimension(other)
429 except (TypeError, ValueError):
430 return NotImplemented
431
432 if self._value is None or other.value is None:
433 return Dimension(None)
434 else:
435 return Dimension(self._value * other.value)
436
437 def __rmul__(self, other):
438 """Returns the product of `self` and `other`.

Callers

nothing calls this directly

Calls 2

as_dimensionFunction · 0.85
DimensionClass · 0.70

Tested by

no test coverage detected