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

Add aten::_thnn_fused_gru_cell and _thnn_fused_lstm_cell #926

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/ATen/native/xpu/RNN.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <ATen/ATen.h>
#include <ATen/core/op_registration/adaption.h>
#include <ATen/native/cpu/mixed_data_type.h>
#include <ATen/native/xpu/sycl/RNNKernels.h>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include <ATen/core/op_registration/adaption.h>
#include <ATen/native/cpu/mixed_data_type.h>

please check if we need head files

namespace at::native {

std::tuple<at::Tensor, at::Tensor> _thnn_fused_gru_cell_xpu(
const Tensor& input_gates,
const Tensor& hidden_gates,
const Tensor& hx,
const std::optional<at::Tensor>& input_bias = {},
const std::optional<at::Tensor>& hidden_bias = {}) {
return native::xpu::_thnn_fused_gru_cell_kernel(
input_gates, hidden_gates, hx, input_bias, input_bias);
}

std::tuple<Tensor, Tensor, Tensor, Tensor, Tensor>
_thnn_fused_gru_cell_backward_xpu(
const Tensor& grad_hy,
const Tensor& workspace,
bool has_bias) {
return native::xpu::_thnn_fused_gru_cell_backward_kernel(
grad_hy, workspace, has_bias);
}

} // namespace at::native
1 change: 0 additions & 1 deletion src/ATen/native/xpu/XPUFallback.template
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ TORCH_LIBRARY_IMPL(aten, XPU, m) {
"segment_reduce",
"_segment_reduce_backward",
"sinc.out",
"_thnn_fused_gru_cell",
"_to_sparse",
"_to_sparse_csr",
"triangular_solve.X",
Expand Down
Loading