Does ctx.save_for_backward() do anything in inference mode?

Based on this response from @albanD it should not save any tensors if it’s executed in a with torch.no_grad() context (and I would also assume the same for with torch.inference_mode()).

1 Like