-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Dy2St][tests][46-49, 16] paddle.jit.enable_to_static->enable_to_static_guard
#59730
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
[Dy2St][tests][46-49, 16] paddle.jit.enable_to_static->enable_to_static_guard
#59730
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
DrRyanHuang
left a comment
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.
nice work! 🍢🍢YYDS! LGTM
SigureMo
left a comment
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.
SigureMo
left a comment
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.
改写一下吧,尽可能不要加缩进
def train():
...
def test_xxx():
with guard(False):
train()
train()
test/legacy_test/test_jit_layer.py
Outdated
| with enable_to_static_guard(True): | ||
| model_path = os.path.join(self.temp_dir.name, 'multi_program') | ||
| paddle.jit.save(model, model_path, combine_params=True) | ||
| place = paddle.CPUPlace() | ||
| if paddle.is_compiled_with_cuda(): | ||
| place = paddle.CUDAPlace(0) | ||
| jit_layer = Layer() | ||
| jit_layer.load(model_path, place) | ||
| forward_out2 = jit_layer.forward(x) | ||
| infer_out2 = jit_layer.infer(x) | ||
| np.testing.assert_allclose( | ||
| forward_out1, forward_out2[0], rtol=1e-05 | ||
| ) | ||
| np.testing.assert_allclose(infer_out1, infer_out2[0], rtol=1e-05) |
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.
这块不需要 with enable_to_static_guard(True):
SigureMo
left a comment
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.

PR types
Others
PR changes
Others
Description
test/legacy_test/test_model.py好像没跑动转静,我就直接删除了相关链接:
enable_to_static_guard推全 #59684paddle.jit.enable_to_static->enable_to_static_guard#59717paddle.jit.enable_to_static->enable_to_static_guard#59729