fix infinite loop when get_max_threads is nonzero but num_threads is 1
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15114
Differential Revision: D13431891
Pulled By: umanwizard
fbshipit-source-id: f968b8e50cf776c346d4a28d72b12e7856c95839