Fixes test_wrapped_number (#26523)
Summary:
test_wrapped_number was calling torch.set_default_tensor_type('torch.FloatTensor'), which was setting the default tensor types for all following tests until a class boundary (with unittest) or until end of file (with pytest). Tests that don't expect the default tensor type to be set this way were then failing if run afterwards.
This fixes the issue by copying the default_tensor_type decorator from test_nn and using that instead with test_wrapped_number. The decorator correctly resets the default tensor type after the test has run.
This fixes the many errors encountered when running pytest test_jit.py.
Note: test_wrapped_number was introduced in https://github.com/pytorch/pytorch/issues/22273.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26523
Differential Revision: D17495283
Pulled By: mruberry
fbshipit-source-id: ab518c78b7706af7cb1c2d1c17823d311178996d