Correct ownership of OptionalSymIntArrayRef in backwards (#86087)
Also add some cheap but cheerful sanity checks to help detect
similar situations in the future.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86087
Approved by: https://github.com/albanD