pytorch / FBGEMM

FB (Facebook) + GEMM (General Matrix-Matrix Multiplication) - https://code.fb.com/ml-applications/fbgemm/
Other
1.18k stars 486 forks source link

Fix torch_dispatch issue in group_index_select_dim0_gpu_backward #2767

Closed egienvalue closed 3 months ago

egienvalue commented 3 months ago

Summary: The group_index_select_dim0_gpu_backward returns tensor list with undefined tensor. It is not compatible to __torch_dispatch__ which call into Python from C++. The undefined tensors in the vector become None in Python. Once it returns to C++ call stack, It can't convert [None,None, Tensor] back to std::vector<at::Tensor>. To solve this problem, the group_index_select_dim0_gpu_backward must return valid tensor list without undefined tensors (the diff used tensor with size {0}). It can set the variable_list to undefined tensor after returned from the pytorch dispatcher, which is a common scenario I have seen in other ops.

Reviewed By: sryap

Differential Revision: D58761943

netlify[bot] commented 3 months ago

Deploy Preview for pytorch-fbgemm-docs ready!

Name Link
Latest commit 3f131deb5fba90eb09fa30cf0e80f4d3c2e67120
Latest deploy log https://app.netlify.com/sites/pytorch-fbgemm-docs/deploys/6675bef0e7e23a000798eb0d
Deploy Preview https://deploy-preview-2767--pytorch-fbgemm-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

facebook-github-bot commented 3 months ago

This pull request was exported from Phabricator. Differential Revision: D58761943

facebook-github-bot commented 3 months ago

This pull request has been merged in pytorch/FBGEMM@b32d59ec6e856c9971c8280463c89cedc1a719f6.