SIGN IN SIGN UP

Add torch.no_grad() guard on export (#2373)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/2373

For some models where the grad is enabled (like LLava model), we need to disable grad before exporting. This PR is to add this guard when using export script. It would not affect the models that grad is not enabled.

Reviewed By: cccclai

Differential Revision: D54812718

fbshipit-source-id: 639efa5a77839d8d5de52cfa6cb125c883ba54dc
M
Martin Yuan committed
35a847ebe027380d516b9fd37cb490f07ead2f49
Parent: 7675073
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 3/12/2024, 8:13:05 PM