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 autogen code support for merge_selected_rows #52274

Merged
merged 2 commits into from
Mar 30, 2023
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/operators/generator/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ class {to_pascal_case(op_name)}InferVarType : public framework::VarTypeInference
}}
}};
"""
elif op_name == "merge_selected_rows":
return f"""
class {to_pascal_case(op_name)}InferVarType
: public framework::PassInDtypeAndVarTypeToOutput {{
protected:
std::unordered_map<std::string, std::string>& GetInputOutputWithSameType()
const override {{
static std::unordered_map<std::string, std::string> m{{{{"X", /*->*/ "Out"}}}};
return m;
}}
}};
"""
else:
return None

Expand Down
93 changes: 0 additions & 93 deletions paddle/fluid/operators/merge_selected_rows_op.cc

This file was deleted.

8 changes: 0 additions & 8 deletions paddle/phi/api/yaml/legacy_ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1032,14 +1032,6 @@
func : mean_all
backward : mean_all_grad

- op : merge_selected_rows
args : (Tensor x)
output : Tensor
infer_meta :
func : UnchangedInferMeta
kernel :
func : merge_selected_rows {selected_rows -> selected_rows}

- op : merged_adam_
args : (Tensor[] param, Tensor[] grad, Tensor[] learning_rate, Tensor[] moment1, Tensor[] moment2, Tensor[] beta1_pow, Tensor[] beta2_pow, Tensor[] master_param, Scalar beta1, Scalar beta2, Scalar epsilon, bool multi_precision, bool use_global_beta_pow)
output : Tensor[](param_out){param.size()}, Tensor[](moment1_out){param.size()}, Tensor[](moment2_out){param.size()}, Tensor[](beta1_pow_out){param.size()}, Tensor[](beta2_pow_out){param.size()}, Tensor[](master_param_out){param.size()}
Expand Down
6 changes: 6 additions & 0 deletions paddle/phi/api/yaml/op_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,12 @@
extra :
attrs : [bool use_mkldnn = false]

- op : merge_selected_rows
inputs :
x : X
outputs :
out : Out

- op : meshgrid
backward : meshgrid_grad
inputs :
Expand Down
8 changes: 8 additions & 0 deletions paddle/phi/api/yaml/ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,14 @@
optional : bias, cu_seqlens_q, cu_seqlens_k, causal_diagonal, seqlen_k
backward : memory_efficient_attention_grad

- op : merge_selected_rows
args : (Tensor x)
output : Tensor(out)
infer_meta :
func : UnchangedInferMeta
kernel :
func : merge_selected_rows {selected_rows -> selected_rows}

- op : meshgrid
args : (Tensor[] inputs)
output : Tensor[]{inputs.size()}
Expand Down