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

Method matvec

tensorflow/python/ops/linalg/linear_operator.py:635–668  ·  view source on GitHub ↗

Transform [batch] vector `x` with left multiplication: `x --> Ax`. ```python # Make an operator acting like batch matric A. Assume A.shape = [..., M, N] operator = LinearOperator(...) X = ... # shape [..., N], batch vector Y = operator.matvec(X) Y.shape ==> [..., M]

(self, x, adjoint=False, name="matvec")

Source from the content-addressed store, hash-verified

633 return array_ops.squeeze(y_mat, axis=-1)
634
635 def matvec(self, x, adjoint=False, name="matvec"):
636 """Transform [batch] vector `x` with left multiplication: `x --> Ax`.
637
638 ```python
639 # Make an operator acting like batch matric A. Assume A.shape = [..., M, N]
640 operator = LinearOperator(...)
641
642 X = ... # shape [..., N], batch vector
643
644 Y = operator.matvec(X)
645 Y.shape
646 ==> [..., M]
647
648 Y[..., :] = sum_j A[..., :, j] X[..., j]
649 ```
650
651 Args:
652 x: `Tensor` with compatible shape and same `dtype` as `self`.
653 `x` is treated as a [batch] vector meaning for every set of leading
654 dimensions, the last dimension defines a vector.
655 See class docstring for definition of compatibility.
656 adjoint: Python `bool`. If `True`, left multiply by the adjoint: `A^H x`.
657 name: A name for this `Op`.
658
659 Returns:
660 A `Tensor` with shape `[..., M]` and same `dtype` as `self`.
661 """
662 with self._name_scope(name):
663 x = ops.convert_to_tensor(x, name="x")
664 self._check_input_dtype(x)
665 self_dim = -2 if adjoint else -1
666 tensor_shape.dimension_at_index(
667 self.shape, self_dim).assert_is_compatible_with(x.shape[-1])
668 return self._matvec(x, adjoint=adjoint)
669
670 def _determinant(self):
671 logging.warn(

Callers 8

_meanMethod · 0.80
_modeMethod · 0.80
testTwoByTwoCaseMethod · 0.80
test_matvecMethod · 0.80
test_matvecMethod · 0.80
check_tape_safeMethod · 0.80
_matvecMethod · 0.80
_matmulMethod · 0.80

Calls 4

_name_scopeMethod · 0.95
_check_input_dtypeMethod · 0.95
_matvecMethod · 0.95

Tested by 4

testTwoByTwoCaseMethod · 0.64
test_matvecMethod · 0.64
test_matvecMethod · 0.64
check_tape_safeMethod · 0.64