[autograd] add tests for simple reentrant and stackoverflow escape (#35259)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35259
This PR added tests as part of https://github.com/pytorch/pytorch/issues/34367
It covers:
Re-entrant -> Test simple re-entrant
Re-entrant -> Test stack overflow escape mechanism
Test Plan: Imported from OSS
Differential Revision: D20611828
Pulled By: wanchaol
fbshipit-source-id: 2c55f2a0e3244f11b7153956b0d844e1992e5c80