[pytorch] make is_tracing scriptable (#49853)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49853
fix https://github.com/pytorch/pytorch/issues/47379
Test Plan: buck test mode/dev-nosan //caffe2/test:jit -- 'test_script_is_tracing'
Reviewed By: SplitInfinity
Differential Revision: D25704315
fbshipit-source-id: 33c09c5bc1f1b62ef254f58e18ab1e951dbd1790