Skip to content

Commit

Permalink
Fix TorchRec OSS stable version (pytorch#946)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#946

TorchRec OSS stable version still uses permute_sparse_data. Restore the old API for backward compatibility.

Reviewed By: yixin94

Differential Revision: D34383729

fbshipit-source-id: c08789028635bd0646ab2265091465f93210c1fd
  • Loading branch information
xing-liu authored and facebook-github-bot committed Feb 22, 2022
1 parent ab3ca66 commit d838f62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fbgemm_gpu/src/sparse_ops_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,8 @@ std::tuple<Tensor, Tensor> embedding_bag_rowwise_prune(
} // namespace fbgemm_gpu

TORCH_LIBRARY_FRAGMENT(fbgemm, m) {
m.def(
"permute_sparse_data(Tensor permute, Tensor lengths, Tensor values, Tensor? weights=None, int? permuted_lengths_sum=None) -> (Tensor, Tensor, Tensor?)");
m.def(
"permute_2D_sparse_data(Tensor permute, Tensor lengths, Tensor values, Tensor? weights=None, int? permuted_lengths_sum=None) -> (Tensor, Tensor, Tensor?)");
m.def(
Expand Down Expand Up @@ -1658,6 +1660,8 @@ TORCH_LIBRARY_FRAGMENT(fbgemm, m) {
}

TORCH_LIBRARY_IMPL(fbgemm, CPU, m) {
DISPATCH_TO_CPU(
"permute_sparse_data", fbgemm_gpu::permute_2D_sparse_data_cpu);
DISPATCH_TO_CPU(
"permute_2D_sparse_data", fbgemm_gpu::permute_2D_sparse_data_cpu);
DISPATCH_TO_CPU(
Expand Down
2 changes: 2 additions & 0 deletions fbgemm_gpu/src/sparse_ops_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ std::vector<Tensor> stacked_jagged_2d_to_dense_gpu(
} // namespace fbgemm_gpu

TORCH_LIBRARY_IMPL(fbgemm, CUDA, m) {
DISPATCH_TO_CUDA(
"permute_sparse_data", fbgemm_gpu::permute_2D_sparse_data_cuda);
DISPATCH_TO_CUDA(
"permute_2D_sparse_data", fbgemm_gpu::permute_2D_sparse_data_cuda);
DISPATCH_TO_CUDA(
Expand Down

0 comments on commit d838f62

Please sign in to comment.