Rewrite assert statement with torch._assert under config (#88246)
This diff rewrites assert statement in python with torch._assert under config. The resulting graph looks something like:
```
SOURCE CODE:
def f(x):
assert x[0] == 3
return x.cos()
CAPTURED GRAPH:
graph():
%arg0 : [#users=2] = placeholder[target=arg0]
%getitem : [#users=1] = call_function[target=operator.getitem](args = (%arg0, 0), kwargs = {})
%eq : [#users=1] = call_function[target=operator.eq](args = (%getitem, 3), kwargs = {})
%_assert : [#users=0] = call_function[target=torch._assert](args = (%eq, "assertion_error"), kwargs = {})
%cos : [#users=1] = call_method[target=cos](args = (%arg0,), kwargs = {})
return cos
```
Note that this introduces side-effect as it could error out while executing graph, but the assertion can eliminated via DCE if we choose to ignore it.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/88246
Approved by: https://github.com/jansel