Skip to content

Commit c4b345a

Browse files
Merge pull request #329 from HydrogenSulfate/enable_grad_for_visu
control no_grad for visualize_func
2 parents b7ad945 + 254c2d3 commit c4b345a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ppsci/solver/visu.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from ppsci.utils import misc
2222

2323

24-
@paddle.no_grad()
2524
def visualize_func(solver, epoch_id: int):
2625
"""Visualization program
2726
@@ -60,7 +59,7 @@ def visualize_func(solver, epoch_id: int):
6059
evaluator.add_target_expr(output_expr, output_key)
6160

6261
# forward
63-
with solver.autocast_context_manager():
62+
with solver.autocast_context_manager(), solver.no_grad_context_manager():
6463
batch_output_dict = evaluator(batch_input_dict)
6564

6665
# collect batch data

0 commit comments

Comments
 (0)