relax restriction on cond branches calling closed functions (#100013)
As of https://github.com/pytorch/pytorch/pull/99367 we error when cond branches look up closed vars. The suggested fix is to add these closed vars as args to the branches.
However, while this works for tensor vars (and also primitive vars by explicit wrapping), this is impossible to do for function vars. Moreover, function vars are OK because we trace through them. So relaxing this restriction for function vars is a strict win.
Differential Revision: [D45287893](https://our.internmc.facebook.com/intern/diff/D45287893/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100013
Approved by: https://github.com/tugsbayasgalan