[JIT] Fix jit-log verbosity selection logic. (#44587)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/44587
Currently it's skewed by one.
The following test demonstrates it:
```
$ cat test.py
import torch
def foo(a,b):
return a*a*b
torch._C._jit_set_profiling_executor(True)
torch._C._jit_set_profiling_mode(True)
torch._C._jit_override_can_fuse_on_cpu(True)
torch._C._jit_set_texpr_fuser_enabled(True)
f = torch.jit.script(foo)
for _ in range(10):
f(torch.rand(10), torch.rand(10))
$ cat test_logging_levels.sh
PYTORCH_JIT_LOG_LEVEL="tensorexpr_fuser" python test.py 2>&1 | grep DUMP >& /dev/null && echo OK || echo FAIL
PYTORCH_JIT_LOG_LEVEL="tensorexpr_fuser" python test.py 2>&1 | grep UPDATE >& /dev/null && echo FAIL || echo OK
PYTORCH_JIT_LOG_LEVEL="tensorexpr_fuser" python test.py 2>&1 | grep DEBUG >& /dev/null && echo FAIL || echo OK
PYTORCH_JIT_LOG_LEVEL=">tensorexpr_fuser" python test.py 2>&1 | grep DUMP >& /dev/null && echo OK || echo FAIL
PYTORCH_JIT_LOG_LEVEL=">tensorexpr_fuser" python test.py 2>&1 | grep UPDATE >& /dev/null && echo OK || echo FAIL
PYTORCH_JIT_LOG_LEVEL=">tensorexpr_fuser" python test.py 2>&1 | grep DEBUG >& /dev/null && echo FAIL || echo OK
PYTORCH_JIT_LOG_LEVEL=">>tensorexpr_fuser" python test.py 2>&1 | grep DUMP >& /dev/null && echo OK || echo FAIL
PYTORCH_JIT_LOG_LEVEL=">>tensorexpr_fuser" python test.py 2>&1 | grep UPDATE >& /dev/null && echo OK || echo FAIL
PYTORCH_JIT_LOG_LEVEL=">>tensorexpr_fuser" python test.py 2>&1 | grep DEBUG >& /dev/null && echo OK || echo FAIL
```
Before this change:
```
OK
FAIL
OK
OK
OK
FAIL
OK
OK
OK
```
With this change everthing passes.
Differential Revision: D23666813
Test Plan: Imported from OSS
Reviewed By: bertmaher
Pulled By: ZolotukhinM
fbshipit-source-id: 4adaa5a3d06deadf54eae014a0d76588cdc5e20a
Author
Mikhail Zolotukhin