Skip to content

Make FactoredMatrix compatible with tensor-like arguments #599

Draft
JasonGross wants to merge 2 commits intoTransformerLensOrg:devfrom
JasonGross:patch-1
Draft

Make FactoredMatrix compatible with tensor-like arguments #599
JasonGross wants to merge 2 commits intoTransformerLensOrg:devfrom
JasonGross:patch-1

Conversation

@JasonGross
Copy link
Contributor

Description

I'd like to be able to use FactoredMatrix with things that implement the interface of torch.Tensor without subclassing it. This slight change allows FactoredMatrix to work with such classes rather than returning None in various places.

(I haven't finished the checklists, so creating this draft PR so I don't forget about this)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have not rewritten tests relating to key interfaces which would affect backward compatibility

JasonGross and others added 2 commits May 17, 2024 02:05
I'd like to be able to use `FactoredMatrix` with things that implement the interface of `torch.Tensor` without subclassing it.  This slight change allows `FactoredMatrix` to work with such classes rather than returning `None` in various places.
@bryce13950
Copy link
Collaborator

@JasonGross Do you still have a bit to wrap up on this? If you need any help getting this out the door let me know. If you could add a test for this, that would be greatly appreciated as well.

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