Skip to content
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] Clear differentiation cache in visu_forward to avoid OOM problem #757

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/bubble/bubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def transform_out(in_, out):
NPOINT_PDE * NTIME_PDE, evenly=True
)

pred_norm = solver.predict(visu_mat, no_grad=False, return_numpy=True)
pred_norm = solver.predict(visu_mat, None, 4096, no_grad=False, return_numpy=True)
# inverse normalization
p_pred = pred_norm["p"].reshape([NTIME_PDE, NPOINT_PDE]).T
u_pred = pred_norm["u"].reshape([NTIME_PDE, NPOINT_PDE]).T
Expand Down
4 changes: 2 additions & 2 deletions ppsci/utils/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def visu_forward(
for name, expr in expr_dict.items():
output_dict[name] = expr(data_dict)

# clear differentiation cache
clear()
# clear differentiation cache
clear()

return output_dict