Add TorchDynamo support (#816)
Summary:
Add torchdynamo support to TorchBench. Use `torchdynamo.list_backends()` to list available backends and apply them.
Pull Request resolved: https://github.com/pytorch/benchmark/pull/816
Test Plan:
```
$ python run.py resnet18 -d cuda -t eval --torchdynamo ofi
Running eval method from resnet18 on cuda in eager mode.
jit error
Traceback (most recent call last):
File "/home/xzhao9/torchdynamo/torchdynamo/utils.py", line 192, in torchscript
return torch.jit.trace(model, example_inputs)
File "/home/xzhao9/data/miniconda3/envs/py38/lib/python3.8/site-packages/torch/jit/_trace.py", line 741, in trace
return trace_module(
File "/home/xzhao9/data/miniconda3/envs/py38/lib/python3.8/site-packages/torch/jit/_trace.py", line 956, in trace_module
example_inputs = make_tuple(example_inputs)
File "/home/xzhao9/data/miniconda3/envs/py38/lib/python3.8/site-packages/torch/jit/_trace.py", line 549, in make_tuple
return tuple(example_inputs)
TypeError: 'NoneType' object is not iterable
GPU Time: 6.079 milliseconds
CPU Dispatch Time: 3.310 milliseconds
CPU Total Wall Time: 6.104 milliseconds
Correctness: 0.999988675117493
```
```
$ python run.py resnet18 -d cuda -t eval --torchdynamo eager
Running eval method from resnet18 on cuda in eager mode.
GPU Time: 6.668 milliseconds
CPU Dispatch Time: 6.023 milliseconds
CPU Total Wall Time: 6.693 milliseconds
Correctness: 0.999996900558472
```
Reviewed By: jansel
Differential Revision: D35031203
Pulled By: xuzhao9
fbshipit-source-id: 975275d22bedd369be8af6a58e42b6c63ef56e82