diff --git a/tensornetwork/backends/tensorflow/tensorflow_backend.py b/tensornetwork/backends/tensorflow/tensorflow_backend.py index 0cf960838..4def9a232 100644 --- a/tensornetwork/backends/tensorflow/tensorflow_backend.py +++ b/tensornetwork/backends/tensorflow/tensorflow_backend.py @@ -430,3 +430,18 @@ def eps(self, dtype: Type[np.number]) -> float: float: Machine epsilon. """ return tf.experimental.numpy.finfo(dtype).eps + + def pinv(self, tensor: Tensor, rcond: float = 1E-15, hermitian: bool = False) -> Tensor: + """ + Compute the (Moore-Penrose) pseudo-inverse of a tensor. + Returns the pseudo-inverse of tensor. + + Args: + tensor: A tensor. + rcond: Cutoff for small singular values. + hermitian(optional): If True, matrix provided is assumed to be Hermitian (symmetric if real-valued). Defaults to False. + + Returns: + tensor: The pseudo inverse of tensor. + """ + return np.linalg.pinv(tensor) \ No newline at end of file