Check for debug mode (#92707)
It works by validating the debug builds actually trigger debug level asserts
Turns out, most of our debug jobs today don't actually build in debug mode (causing the test to fail). The PR also fixes that
Contributes to https://github.com/pytorch/pytorch/issues/88842
Pull Request resolved: https://github.com/pytorch/pytorch/pull/92707
Approved by: https://github.com/malfet, https://github.com/albanD