-
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
add check ops for prim #52302
add check ops for prim #52302
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
Sorry to inform you that b590561's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
… add_check_ops_for_prim
@@ -675,6 +681,17 @@ def check_jit_comp(self): | |||
) | |||
net = PrimNet(self.public_python_api) | |||
net = apply_to_static(net, False) | |||
# ensure the operator not in program if check_prim is True | |||
if self.prim_op_type == "comp" and self.op_type != "fill_any_like": |
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.
why "self.op_type != "fill_any_like"" ?
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.
动转静会在前向转静态图的时候把反向图也给构建了,fill_any_like的反向还是fill_any_like,所以把这个算子给过滤了。
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.
1.如果只拆解了反向 self.prim_op_type = prim ,是否需要判断program中不出现xxx_grad
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.
1.如果只拆解了反向 self.prim_op_type = prim ,是否需要判断program中不出现xxx_grad
2.最好加单测确定此检查已生效
1.算子反向检查在grad_checker中,无用的判断已经删除。 |
for op in net.forward.get_concrete_program(args)[1] | ||
._train_program.block(0) | ||
.ops | ||
] |
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.
use net.forward.get_concrete_program(args)[1].forward_program to avoid 'fill_any_like' condition
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.
done
backward_op_type = self.op_type + "_grad" | ||
assert backward_op_type not in ops, ( | ||
"%s shouldn't appear in program when check_prim is True" | ||
) % (backward_op_type) |
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.
Is this can cover the scene of CustomVJP?
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.
不能,CustomVJP只能在动转静测试中触发
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 for ignore cinn-ci task
PR types
New features
PR changes
Others
Description
Pcard-66975
PR改动在OPTest测试框架中为组合算子测试新增program检查功能,若该算子被组合算子拆解,那么就不应该出现该算子以及他自身的反向算子。