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

[ADD] Method from_mat_inner to structured matrix interface #80

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

f-dangel
Copy link
Owner

@f-dangel f-dangel commented Jul 3, 2024

Adds an interface function from_mat_inner which extracts a structured matrix from X @ X.T where X is an arbitrary 2d tensor. This addresses f-dangel/sirfshampoo#24.

This function is useful for speeding up SIRFShampoo's update which takes a matrix view G of the gradient, then extracts a structured matrix of G @ G.T. So far, we were mimicking this computation by creating a structured matrix I which represents the identity matrix, then call I.from_inner(G) which computes the structured matrix of I.T @ G @ G.T @ I, effectively multiplying the identity matrix onto G before extracting the structured matrix. The new function from_mat_inner removes the unnecessary multiplication with identity.

@f-dangel f-dangel requested a review from runame July 3, 2024 14:28
@f-dangel f-dangel changed the title [ADD] Method from_mat_outer to structured matrix interface [ADD] Method from_mat_inner to structured matrix interface Jul 3, 2024
Copy link
Collaborator

@runame runame left a comment

Choose a reason for hiding this comment

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

LGTM

@f-dangel f-dangel merged commit a395165 into main Jul 3, 2024
14 checks passed
@f-dangel f-dangel deleted the from-mat-outer branch July 3, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants