Inference_mode() doesn't remove grad

Hi guys as I know inference_mode() will remove grad, but in my case here it doesn’t → so I have to use y_preds.detach().

Anyone has any ideas about this?
Thanks for your help!

Could you post a minimal and executable code snippet reproducing the issue, please?