未验证 提交 3df02fec 编写于 作者: X xiaoguoguo626807 提交者: GitHub

[NewIR] modify adagrad_op for inplace judge (#55162)

* add ir output check in OpTest

* add ir grad check in op test

* fix legacy name converter bug

* add more unittest

* fix

* fix warprnn op bug

* add whit list

* polish code

* adagrad modify

* recover

* polish code

* review

---------
Co-authored-by: Nkangguangli <kangguangli@hotmail.com>
Co-authored-by: Nphlrain <phliuhongyu@126.com>
上级 8e5b0af5
......@@ -69,15 +69,25 @@ using InputHandleFn = std::function<ir::OpResult(ir::IrContext*,
constexpr char kTargetDialectPrefix[] = "pd.";
constexpr char kEmptyVarName[] = "@EMPTY@";
static const std::unordered_set<std::string> special_inplace_ops = {
static const std::unordered_set<std::string> special_non_inplace_ops = {
"batch_norm",
};
static const std::unordered_set<std::string> special_inplace_ops = {
"adagrad",
"adam",
"adamax",
"adamw",
};
inline bool IsInplace(const OpDesc& op_desc) {
bool inplace = false;
if (special_non_inplace_ops.count(op_desc.Type())) {
return false;
}
if (special_inplace_ops.count(op_desc.Type())) {
return inplace;
return true;
}
bool inplace = false;
auto input_names = op_desc.InputArgumentNames();
auto output_names = op_desc.OutputArgumentNames();
if (input_names.size() == 0 || output_names.size() == 0) {
......@@ -382,7 +392,6 @@ std::vector<ir::OpResult> OpTranscriber::GenerateOperationInput(
continue;
}
}
VLOG(10) << "[op:" << op_desc.Type() << "][input]" << info.name << " "
<< legacy_input_name << " " << legacy_input_vars.size();
......@@ -414,7 +423,6 @@ std::vector<ir::OpResult> OpTranscriber::GenerateOperationInput(
(info.type_name.find("IntArrayAttribute") != std::string::npos);
VLOG(10) << "[op:" << op_desc.Type() << "][input]" << info.name << " "
<< is_vector << " " << info.type_name;
// Specially process TensorArray, this because we cannot distinguish it with
// Vector<DenseTensor> by other conditions but we cannot support it like
// Vector<DenseTensor>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册