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

[X86/ARM] add gru mode for rnn #7026

Merged
merged 8 commits into from
Sep 27, 2021
Merged

[X86/ARM] add gru mode for rnn #7026

merged 8 commits into from
Sep 27, 2021

Conversation

mjp9527
Copy link
Collaborator

@mjp9527 mjp9527 commented Sep 23, 2021

[X86/ARM] add gru mode for rnn, fix elementwise left problem, move cast op to host

@@ -0,0 +1,248 @@
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
Copy link
Collaborator

Choose a reason for hiding this comment

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

有时间新提Pr,将日期修改下:2019->2021

cur_h_ptr[offset] = out_ptr[offset] + pre_h_ptr[offset] * mask_ptr_1[i];
}
}
if ("LSTM" == mode) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

如果mode 不是LSTM,则不处理是吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

是的,gru不做处理,目前仅支持gru lstm

last_c_temp.Resize(init_h[layer_idx].dims());
last_c_temp.mutable_data<float>();
last_c_holder = &last_c_temp;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

是否还有其他mode 呢,不管是否有,请加上else LOG(FATAL)<< "提示暂不支持“

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

run函数入口处已经做了检测,后面不用再检测了

&output_tensors[i],
&vec[3 + offset * 4],
&weight_hh_tmp);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

} else if ("GRU" == mode) {
gate_num = 3;
} else {
LOG(FATAL) << "X86 RNN ERROR: unsupport mode except gru and lstm,"
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个是ARM 不支持

last_c_temp.Resize(init_h[layer_idx].dims());
last_c_temp.mutable_data<float>();
last_c_holder = &last_c_temp;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

加上else log(FATAL)

&output_tensors[i],
&vec[3 + offset * 4],
&weight_hh_tmp);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

同时,加上 else

@@ -0,0 +1,802 @@
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

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

改为2021

Copy link
Collaborator

@weishengying weishengying left a comment

Choose a reason for hiding this comment

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

LGTM

@weishengying weishengying merged commit c33793e into PaddlePaddle:develop Sep 27, 2021
@mjp9527 mjp9527 deleted the bigru branch November 28, 2022 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants