Check for contiguous well-formed mask (#79927)
Summary: Check for contiguous well-formed mask
Test Plan: sandcastle, github CI
Reviewed By: frank-wei
Differential Revision: D37301243
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79927
Approved by: https://github.com/jbschlosser