Avoid convert trt.Dims to tuple in hot path (#67960)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/67960
For some reason, we are throwing py::index_error when converting a trt.Dims to tuple. This staying in the hot path of trt inference in not good, especially when we register a bunch of pybind11 exception translator where they repeatedly rethrow the exception. Since shape is static information, we save it once to avoid such repeated conversion.
Reviewed By: jianyuh, wushirong, 842974287
Differential Revision: D32232065
fbshipit-source-id: 11e49da9758ead0ff3aa647bbd3fce7735bf4a07