Skip to content

Commit

Permalink
Use inference_mode instead of no_grad (#2804)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryant1410 authored Jan 18, 2024
1 parent 904630f commit 2026cb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ts/torch_handler/base_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def inference(self, data, *args, **kwargs):
Returns:
Torch Tensor : The Predicted Torch Tensor is returned in this function.
"""
with torch.no_grad():
with torch.inference_mode():
marshalled_data = data.to(self.device)
results = self.model(marshalled_data, *args, **kwargs)
return results
Expand Down

0 comments on commit 2026cb1

Please sign in to comment.