-
Notifications
You must be signed in to change notification settings - Fork 269
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 No. 91】Update rfcs for register_hook #491
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aurelius84
approved these changes
Apr 4, 2023
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
@yangguohao 这个报错能贴一下么? |
不会出现任何报错,但是没有成功运行 hook 的函数。 |
以下是正确运行时 program 当中的内容:
更换 hook 位置后
我的想法是有没有其他办法调换算子的执行顺序。我有简单尝试过,但是都不太成功。如果可以的话,每次的 register 生成的 py_func 算子都移动到该变量生成的算子之后的第一位,也可以解决这个问题。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
您好 @Aurelius84 ,上一次的 rfc 中我并没有整体完成,这里更新了一下相关的内容。我目前已实现了功能,但还存在一些问题,我在这里想请教一下
我在静态图下的 Variable 类的 register_hook 中实现了以下的功能
可以成功运行下面的例子,与动态图下的行为一致。
但是碰到了这样的情况,如果我更改了 register_hook 这行代码的位置,就无法实现功能。例如:
我猜可能是我在 py_func 的实现出错了,我不太理解 append_op 的操作,这个方面可以讨论一下。
或者我想目前的方案就是规定用户在需要 register_hook 的变量进行其他任何操作前加入 register_hook。如上面的例子,在对 x 进行其他算子操作前,先加入 register_hook。这样是否可行呢?或者有其他任何的方向,我可以去了解一下。