Support userbenchmarks to inject and replace the `model.invoke()` function (#1574)
Summary:
Support userbenchmarks to use their customized function to replace the original `model.invoke()`.
In the `user_defined_invoke()` function, users can run their own benchmark in subprocess workers, and return list or dict as metrics.
The output can be retrieved with the `get_model_attribute()` function.
Pull Request resolved: https://github.com/pytorch/benchmark/pull/1574
Test Plan:
```
$ python run_benchmark.py test-user-invoke -m resnet50 -d cpu -t train
Running TorchBenchModelConfig(name='resnet50', device='cpu', test='train', batch_size=1, jit=False, extra_args=[], extra_env=None) ... [Done]
{'list_result': [1.0, 2.0, 3.0, 4.0], 'dict_output': {'m1': 1.0, 'm2': 2.0, 'm3': 3.0}}
```
Reviewed By: janeyx99
Differential Revision: D45288287
Pulled By: xuzhao9
fbshipit-source-id: 4bb274c36d5f7e2aaa8847b43dd2a2ebfa98165a