Make the warning suppression safer (#15560)
Summary:
Address the problem introduced in https://github.com/pytorch/pytorch/pull/15499#issuecomment-450038494.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15560
Differential Revision: D13561346
Pulled By: soumith
fbshipit-source-id: 6abf622672bdcb77ae1a7188e8a3817fa97aecbc