Fix lifted_tensor in Gemma3n export which dynamo can't reason about (#43801)
* Fix lifted_tensor in Gemma3n which dynamo can't reason about
When using the torch.export path with this model we hit an issue on correction_coefs being modified with unknown side-effects the dynamo can't catch. So it lifts this tensor unnecessarily, and fails assuming mutation is needed RuntimeError: Constant model.model.language_model.layers.0.lifted_tensor_4 is mutated in the forward method. Pls register it as buffer.
This change makes the subsequent use recognisable as an out variant to prevent this.
Signed-off-by: Rob Elliott <Robert.Elliott@arm.com>
* reintroduce training check
Signed-off-by: Rob Elliott <Robert.Elliott@arm.com>
---------
Signed-off-by: Rob Elliott <Robert.Elliott@arm.com>
Co-authored-by: Raushan Turganbay <raushan@huggingface.co>