Skip to content

Commit

Permalink
Back out "add Meta and Autograd backends for jagged ops" (pytorch#1463)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: pytorch#1463

Reviewed By: zyan0, khabinov, jianyuh, mikeiovine

Differential Revision:
D41317890

LaMa Project: L1138451

fbshipit-source-id: 9dc82f43d43a495ad85d3eb1b35859874e090acf
  • Loading branch information
Xiao Sun authored and facebook-github-bot committed Nov 16, 2022
1 parent 65d4508 commit d0af623
Show file tree
Hide file tree
Showing 3 changed files with 624 additions and 819 deletions.
36 changes: 30 additions & 6 deletions fbgemm_gpu/include/fbgemm_gpu/sparse_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,23 @@ at::Tensor batched_unary_embeddings_backward_cuda(
const at::Tensor& offsets,
const at::Tensor& indices);

///@ingroup sparse-data-cuda
std::tuple<std::vector<at::Tensor>, std::vector<at::Tensor>>
stacked_jagged_2d_to_dense_forward_cuda(
at::Tensor values,
at::Tensor lengths,
const std::vector<int64_t>& offset_per_key,
const std::vector<int64_t>& max_lengths_per_key);

///@ingroup sparse-data-cuda
at::Tensor stacked_jagged_2d_to_dense_backward_cuda(
int64_t B,
int64_t D,
int64_t total_L,
const std::vector<at::Tensor>& grad_padded_values_per_key,
const std::vector<at::Tensor>& offsets_tensor_per_key,
const std::vector<int64_t>& offset_per_key);

///@ingroup sparse-data-cpu
std::vector<at::Tensor> stacked_jagged_2d_to_dense_cpu(
at::Tensor values,
Expand All @@ -373,14 +390,15 @@ std::vector<at::Tensor> stacked_jagged_2d_to_dense_cpu(
const std::vector<int64_t>& max_lengths_per_key,
int64_t padding_value);

at::Tensor jagged_to_padded_dense_autograd(
const at::Tensor& values,
const std::vector<at::Tensor>& offsets,
const std::vector<std::int64_t>& max_lengths,
const double padding_value);
///@ingroup sparse-data-cuda
at::Tensor jagged_1d_to_dense_gpu(
at::Tensor values,
at::Tensor offsets,
int64_t max_L,
int64_t padding_value);

///@ingroup sparse-data-cpu
at::Tensor jagged_1d_to_dense_autograd(
at::Tensor jagged_1d_to_dense_cpu(
at::Tensor values,
at::Tensor offsets,
int64_t max_L,
Expand All @@ -392,6 +410,12 @@ at::Tensor jagged_2d_to_dense_forward_cpu(
at::Tensor offsets,
int64_t max_L);

///@ingroup sparse-data-cuda
at::Tensor jagged_2d_to_dense_gpu(
at::Tensor values,
at::Tensor offsets,
int64_t max_sequence_length);

///@ingroup sparse-data-cuda
at::Tensor jagged_2d_to_dense_gpu_forward(
at::Tensor values,
Expand Down
Loading

0 comments on commit d0af623

Please sign in to comment.