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

【Hackathon 6th Fundable Projects 3 No.82】fluid operator cudnn_lstm #63936

Merged
merged 5 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions paddle/fluid/eager/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ std::vector<AutogradMeta*> EagerUtils::nullable_autograd_meta(
return metas;
}

std::vector<AutogradMeta*> EagerUtils::nullable_autograd_meta(
const paddle::optional<std::vector<paddle::Tensor>>& targets) {
std::vector<AutogradMeta*> metas;
if (targets.get_ptr() != nullptr) {
metas.reserve(targets.get_ptr()->size());
for (const paddle::Tensor& t : (*(targets.get_ptr()))) {
metas.emplace_back(nullable_autograd_meta(t));
}
}
return metas;
}

std::vector<AutogradMeta*> EagerUtils::nullable_autograd_meta(
const std::vector<paddle::Tensor*>& targets) {
std::vector<AutogradMeta*> metas;
Expand Down
2 changes: 2 additions & 0 deletions paddle/fluid/eager/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ class TEST_API EagerUtils {
const paddle::optional<paddle::Tensor>& target);
static std::vector<AutogradMeta*> nullable_autograd_meta(
const std::vector<paddle::Tensor>& targets);
static std::vector<AutogradMeta*> nullable_autograd_meta(
const paddle::optional<std::vector<paddle::Tensor>>& targets);
static std::vector<AutogradMeta*> nullable_autograd_meta(
const std::vector<paddle::Tensor*>& targets);
static AutogradMeta* unsafe_autograd_meta(const paddle::Tensor& target);
Expand Down
285 changes: 0 additions & 285 deletions paddle/fluid/operators/cudnn_lstm_op.cc

This file was deleted.

59 changes: 0 additions & 59 deletions paddle/fluid/operators/ops_signature/cudnn_lstm_sig.cc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,12 @@ def GenBuildOutputsPart2(
}}
"""

# In cudnn_lstm operator, the output weight_list_grad requires the use of optional input weight_list,
# so "pir::VectorType {name}" outside the "if" block.
CREATE_OPTIONAL_INPUT_VEC_METATENSOR_TEMPLATE = """ std::vector<paddle::dialect::IrTensor> vec_ir_tensor_{name};
pir::VectorType {name};
if ({name}_.impl() != nullptr) {{
pir::VectorType {name} = {name}_.type().dyn_cast<pir::VectorType>();
{name} = {name}_.type().dyn_cast<pir::VectorType>();
for (size_t i=0; i < static_cast<size_t>({name}.size()); i++) {{
if({name}[i].isa<paddle::dialect::DenseTensorType>()) {{
auto {name}_type = {name}[i].dyn_cast<paddle::dialect::DenseTensorType>();
Expand Down
Loading