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

support GPU inference in torchscript model for v2.5 / v2.6 #188

Merged
merged 13 commits into from
May 18, 2021
8 changes: 4 additions & 4 deletions sru/csrc/sru_cpu_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ std::vector<at::Tensor> cpu_forward(
const float* reset_b_ptr = forget_b_ptr + hidden_size;
const float* U_ptr = U.data_ptr<float>();
const float* x_ptr = x.data_ptr<float>();
const float* pad_ptr = mask_pad.has_value() ?
mask_pad.value().data_ptr<float>() : NULL;
const bool* pad_ptr = mask_pad.has_value() ?
mask_pad.value().data_ptr<bool>() : NULL;

auto h = at::zeros({length, batch_size, hidden_size}, U.options());
auto c = c_init.clone();
Expand Down Expand Up @@ -175,8 +175,8 @@ std::vector<at::Tensor> cpu_bi_forward(
const float* reset_b_ptr = forget_b_ptr + hidden_size*2;
const float* U_ptr = U.data_ptr<float>();
const float* x_ptr = x.data_ptr<float>();
const float* pad_ptr = mask_pad.has_value() ?
mask_pad.value().data_ptr<float>() : NULL;
const bool* pad_ptr = mask_pad.has_value() ?
mask_pad.value().data_ptr<bool>() : NULL;

auto h = at::zeros({length, batch_size, hidden_size*2}, U.options());
auto c = c_init.clone();
Expand Down
Loading