[fx2trt] re-enable profiler and some miscs for TRTModule (#65072)
authorShiyan Deng <dsy842974287@fb.com>
Fri, 17 Sep 2021 22:42:57 +0000 (15:42 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 17 Sep 2021 23:26:28 +0000 (16:26 -0700)
commit4408b755bc93a09641fa206a868b7885bec04663
tree2ac9af81aff1a76675ebd2253114a6fefc67e5f3
parentafa25c77f14851d611ec299f0c2ec4382eec5f51
[fx2trt] re-enable profiler and some miscs for TRTModule (#65072)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65072

Previously disabled attaching trt profiler to exec context in TRTModule because https://fburl.com/mc33n880 states that `enqueue()` doesn't support profiling. Seems to be a lie though. Re-enable attaching profiler in this diff.

Also added a bunch of checks for dtype and shape, and fixed saving state_dict and loading back.

Test Plan: buck run mode/opt -c python.package_style=inplace -j 40 deeplearning/trt/fx2trt:acc2trt_test

Reviewed By: yinghai

Differential Revision: D30962757

fbshipit-source-id: 9c664b0500a8169b7952f6f912239a5a05772aea
torch/fx/experimental/fx2trt/fx2trt.py