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

torch._VF frontend functions #28798

Open
Sam-Armstrong opened this issue Aug 9, 2024 · 2 comments
Open

torch._VF frontend functions #28798

Sam-Armstrong opened this issue Aug 9, 2024 · 2 comments
Assignees
Labels
PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist

Comments

@Sam-Armstrong
Copy link
Contributor

Frontend functions need to be added for the following torch._VF functions:

  • torch._VF.rnn_tanh
  • torch._VF.rnn_relu
  • torch._VF.gru
  • torch._VF.rnn_tanh_cell
  • torch._VF.rnn_relu_cell
  • torch._VF.lstm_cell
  • torch._VF.gru_cell
@Sam-Armstrong Sam-Armstrong added Next Release This issue or PR should only be considered once the next release is out. Suggestion A suggestion rather than a detected issue or a definitive task Ivy API Experimental Run CI for testing API experimental/New feature or request labels Aug 9, 2024
@Sam-Armstrong Sam-Armstrong self-assigned this Aug 9, 2024
@Sam-Armstrong Sam-Armstrong added PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist and removed Next Release This issue or PR should only be considered once the next release is out. Suggestion A suggestion rather than a detected issue or a definitive task Ivy API Experimental Run CI for testing API experimental/New feature or request labels Aug 9, 2024
@muzakkirhussain011
Copy link
Contributor

Hi @Sam-Armstrong ,
Are there any specific considerations or challenges we should be aware of when adding frontend functions for these torch._VF operations?

  • torch._VF.rnn_tanh
  • torch._VF.rnn_relu
  • torch._VF.gru
  • torch._VF.rnn_tanh_cell
  • torch._VF.rnn_relu_cell
  • torch._VF.lstm_cell
  • torch._VF.gru_cell

I'm wondering if there are existing patterns or best practices we should follow to ensure consistency and performance. Any thoughts on how we should approach this?

@Sam-Armstrong
Copy link
Contributor Author

@muzakkirhussain011 for the gru, lstm_cell and gru_cell implementations, you can generally follow how torch._VF.lstm was written. So the call graph would look something like torch_frontend._VF.lstm -> torch_frontend.lstm -> ivy.lstm.

If we can, the optimal implementation for torch._VF.gru would be something like:

torch_frontend._VF.gru -> torch_frontend.gru -> ivy.gru -> backend.gru

where you implement ivy.gru for all backend frameworks (torch, tensorflow, jax and numpy - but this isn't strictly necessary - you can just use an ivy compositional implementation as has been done in the case of lstm. Just note you'll have to add torch_frontend.gru, as this also doesn't exist in the torch frontend apis yet.

Feel free to message me on discord if you're unsure about anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PyTorch Frontend Developing the PyTorch Frontend, checklist triggered by commenting add_frontend_checklist
Projects
None yet
Development

No branches or pull requests

2 participants