Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Try dispatching to the decomposed OpOverload to account for inference mode #251

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drisspg
Copy link
Contributor

@drisspg drisspg commented Apr 10, 2024

Summary

This enables logic that work with torch.no.grad to work with inference mode: #238

cc @albanD on what the correct pattern should be

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 10, 2024
@drisspg drisspg changed the title Need to figure out the correct error propagation and add tests Try dispatching to the decomposed version Apr 10, 2024
@drisspg drisspg changed the title Try dispatching to the decomposed version Try dispatching to the decomposed OpOverload to account for inference mode Apr 10, 2024
@albanD
Copy link

albanD commented Apr 12, 2024

Huh. I don't know off the top of my head what the decompose method is doing... @zou3519 might know better?

@@ -325,6 +325,8 @@ def allowed_subclasses(type):

if func in FLOAT8_OPS_TABLE:
return FLOAT8_OPS_TABLE[func](func, args, kwargs)
else:
return func.decompose(*args, *kwargs)
Copy link

Choose a reason for hiding this comment

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

I'm not sure this is what you want, it directly invokes the CompositeImplicitAutograd implementation

Copy link

Choose a reason for hiding this comment

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

I think this is exactly what they want :D
What happens if there is no CompositeImplicitAutograd impl?

Copy link

Choose a reason for hiding this comment

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

it returns NotImplemented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I figure that it we can noop ( execept not implemented) slide our way down by trying to decompose the op

  • Either it wont be decomposable, and return not implemented, cool same place as after this
  • or it is decomposable:
    • Run supported op, Great!
    • Not supported and ultimately end back up with a not implemented

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants