-
Notifications
You must be signed in to change notification settings - Fork 27.7k
Add TracedModule attribute for the constants table #36625
Copy link
Copy link
Closed
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixmodule: bootcampWe plan to do a full writeup on the issue, and then get someone to do it for onboardingWe plan to do a full writeup on the issue, and then get someone to do it for onboardingoncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queuetriage reviewtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Metadata
Metadata
Assignees
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixmodule: bootcampWe plan to do a full writeup on the issue, and then get someone to do it for onboardingWe plan to do a full writeup on the issue, and then get someone to do it for onboardingoncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queuetriage reviewtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
🚀 Feature
TracedModuel currently returns the compiled code via the .code() member function. This code can possible contain constants (e.g. CONSTANTS.c0), however the value of these are not accessible from python at the moment. It would really useful to surface the constant mapping to python so libraries that interpret the module can get the full picture.
Motivation
I am currently writing a pytorch/torchscript -> mxnet code converter and currently it cannot resolve the constants in the torchscript code.
Pitch
tracedmodule.code -> returns code (done)
tracedmoduel.constants -> returns a mapping between constant name and value (dict)
Alternatives
Any other function from jit that can return the constants of a tracedmodule
Additional context
https://discuss.pytorch.org/t/extract-constants-from-torchscript-module/
cc @suo