-
Notifications
You must be signed in to change notification settings - Fork 743
Description
🚀 The feature, motivation and pitch
Pytorch provides several higher-level control flow ops, including while_loop and scan. These ops have to be used explicitly in the PyTorch model (Dynamo can't infer them from Python control flow), but they are useful in expressing more complex models. As a first step to try to handle complex patterns without needing to chop up the model and port logic to C++, we should support some of the higher-order ops in ET.
I believe while_loop, and scan should be a good starting point, as they are sufficient to express many of the data dependent patterns. This may allow for writing some generator loops in pure PyTorch, specially for non-multi-turn generation.
Currently, these ops are not supported on ET. It's likely that we will need both AOT and runtime work to do this. Exporting a simple cond model gives the following error. Simple scan and while_loop models also fail with various errors
Edit: From Tarun's comment, cond should be supported, but it seems like there are some issues to resolve, as I haven't been able to use cond when I've tried it. I will create specific tasks for cond. I've removed it from this issue for now.
Alternatives
No response
Additional context
No response
RFC (Optional)
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status