Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinv numpy backend #918

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

raunakbhupal
Copy link

This is done with respect to issue: #844
pinv function is added to tensornetwork/backends/tensorflow/numpy_backend.py
The pinv function has been referred from https://numpy.org/doc/stable/reference/generated/numpy.linalg.pinv.html
Please do have a look and let me know if should make any other change.
Thank you.

@google-cla google-cla bot added the cla: yes label Apr 2, 2021
Copy link
Collaborator

@mganahl mganahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add pinv to all other backends, or raise a NotImplementedError,
and add tests for each function. Thanks!

Returns:
tensor: The pseudo inverse of tensor.
"""
return np.linalg.pinv(tensor)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should use the tensorflow version here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi.
In a StackOverflow article someone has mentioned that the Tensorflow version doesn't work for complex matrices and that's why I went with the Numpy Version.
So shall I still use the Tensorflow version only?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, please use tensorflow. The point here is to use backend-native operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants