[JIT] Allow implicit boolean conversion of containers (#51683)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51683
**Summary**
This commit enables implicit boolean conversion of lists, strings, and
dictionaries in conditional expressions. Like Python, empty lists,
strings and dictionaries evaluate to `False` and their non-empty
counterparts evaluate to `True`. This allows users to write code like
```
torch.jit.script
def fn(l: List[int]):
if l:
...
else:
...
```
This has been requested by some users and would be a good usability
improvement.
**Test Plan**
This commit adds unit tests to `TestList`, `TestDict` and
`test_jit_string.py` to test this new feature.
Test Plan: Imported from OSS
Reviewed By: pbelevich
Differential Revision: D26264410
Pulled By: SplitInfinity
fbshipit-source-id: b764c18fd766cfc128ea98a02b7c6c3fa49f8632