Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jit][edge] Pass through dynamic type for DictType. (pytorch#74025)
Summary: Pull Request resolved: pytorch#74025 When users are trying to inspect IValues out of the Lite Interpreter, dynamic types are still attached, therefore torch::jit::toPyObject will fail on these dynamic types while converting dictionary keys. We should just let dynamic types pass through under this corner case since they won't be used by anything later. ghstack-source-id: 151051826 Test Plan: buck test //caffe2/test:mobile -- -r 'test_bundled_input_with_dynamic_type' without patch: ``` BUILD SUCCEEDED Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details. Running with tpx session id: c6693277-2dad-4882-97c7-f69c58f67259 Trace available for this run at /tmp/tpx-20220310-000040.948069-c6693277-2dad-4882-97c7-f69c58f67259/trace.log RemoteExecution session id: reSessionID-c6693277-2dad-4882-97c7-f69c58f67259-tpx Started reporting to test run: https://www.internalfb.com/intern/testinfra/testrun/6473924544183693 ✓ ListingSuccess: caffe2/test:mobile : 40 tests discovered (2.122) ✗ Fail: caffe2/test:mobile - test_bundled_input_with_dynamic_type (mobile.test_lite_script_module.TestLiteScriptQuantizedModule) (3.059) Test output: > RuntimeError: Cannot create dict for key type 'Dynamic<8>', only int, float, complex, Tensor, device and string keys are supported File "/usr/local/fbcode/platform009/lib/python3.8/unittest/case.py", line 60, in testPartExecutor yield File "/usr/local/fbcode/platform009/lib/python3.8/unittest/case.py", line 676, in run self._callTestMethod(testMethod) File "/usr/local/fbcode/platform009/lib/python3.8/unittest/case.py", line 633, in _callTestMethod method() File "/data/users/zhxchen17/fbsource/fbcode/buck-out/dbg/gen/caffe2/test/mobile#binary,link-tree/mobile/test_lite_script_module.py", line 558, in test_bundled_input_with_dynamic_type i = mobile_module.run_method("get_all_bundled_inputs") File "/data/users/zhxchen17/fbsource/fbcode/buck-out/dbg/gen/caffe2/test/mobile#binary,link-tree/torch/jit/mobile/__init__.py", line 69, in run_method return self._c.run_method(method_name, input) stdout: stderr: Summary Fail: 1 ✗ caffe2/test:mobile - test_bundled_input_with_dynamic_type (mobile.test_lite_script_module.TestLiteScriptQuantizedModule) ListingSuccess: 1 If you need help understanding your runs, please follow the wiki: https://fburl.com/posting_in_tpx_users Finished test run: https://www.internalfb.com/intern/testinfra/testrun/6473924544183693 ``` Reviewed By: cccclai Differential Revision: D34780805 fbshipit-source-id: 88b139c5e91becc031e4b06e055a78a52a429c09 (cherry picked from commit 41abbac)
- Loading branch information