-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix randint op #58295
fix randint op #58295
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
paddle::framework::proto::VarType::Type var_type = | ||
static_cast<paddle::framework::proto::VarType::Type>(dtype_num); | ||
|
||
pir::Type dtype = type_translator.operator[](var_type)(ctx, *var); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pir::Type dtype = type_translator.operator[](var_type)(ctx, *var); | |
pir::Type dtype = type_translator[var_type](ctx, *var); |
这行应该可以这样?
另外,输出类型的翻译过程能否优化为
pir::Type translated_var_type = type_translator[VarType::LOD_TENSOR](ctx, *var);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改为
pir::Type dtype = type_translator[var_type](ctx, *var);
这里主要是要翻译的LOD_TENSOR的dtype类型会出现RAW类型,直接调用type_translator[VarType::LOD_TENSOR](ctx, *var)的话,会调用对应的函数翻译RAW类型,但是目前不支持RAW类型的翻译,所以这里仿照InferMeta的逻辑,将attribute中的dtype指定给Out
"[op:%s] Output %s should not be null", | ||
op_desc.Type(), | ||
var_name); | ||
int dtype_num = PADDLE_GET_CONST(int, op_desc.GetAttr("dtype")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不建议叫dtype_num。另外dtype是属性,但是VarDesc中也有dtype字段,没有特殊情形用VarDesc里的dtype就可以了吧,不建议在这里做额外的工作。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改dtype_num为dtype_attr_val。如果直接使用VarDesc里的dtype会遇到翻译RAW类型的情况
2dd4f12
to
46946a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
f017d3f
to
51de5d4
Compare
* fix randint op * Update new_ir_op_test_no_check_list * fix name * fix file name * fix file name * Update pir_op_test_no_check_list
* fix randint op * Update new_ir_op_test_no_check_list * fix name * fix file name * fix file name * Update pir_op_test_no_check_list
* fix randint op * Update new_ir_op_test_no_check_list * fix name * fix file name * fix file name * Update pir_op_test_no_check_list
* fix randint op * Update new_ir_op_test_no_check_list * fix name * fix file name * fix file name * Update pir_op_test_no_check_list
PR types
Others
PR changes
Others
Description
fix randint op