Skip to content

Conversation

@wanchaol
Copy link
Collaborator

@wanchaol wanchaol commented Jul 23, 2019

Stack from ghstack:

Differential Revision: D16466588

@pytorchbot pytorchbot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jul 23, 2019
@wanchaol wanchaol requested review from driazati, eellison and suo July 23, 2019 18:22
[jit] support torch._C._get_tracing_state in script

gh-metadata: pytorch pytorch 23248 gh/wanchaol/33/head
@eellison
Copy link
Contributor

What is the use case for this ?

@wanchaol
Copy link
Collaborator Author

What is the use case for this ?

This is needed to support pack_padded_sequence. There're also bunch of internal functions that check if it's in the tracing state, and this can unblock them from scripting.

@eellison
Copy link
Contributor

What is the use case for this ?

This is needed to support pack_padded_sequence. There're also bunch of internal functions that check if it's in the tracing state, and this can unblock them from scripting.

You could also move that call to a function with torch.jit.ignore. I think it would be better to advocate people to reuse existing apis then add to a list of special cases

@wanchaol
Copy link
Collaborator Author

What is the use case for this ?

This is needed to support pack_padded_sequence. There're also bunch of internal functions that check if it's in the tracing state, and this can unblock them from scripting.

You could also move that call to a function with torch.jit.ignore. I think it would be better to advocate people to reuse existing apis then add to a list of special cases

I tried your approach, it unfortunately not working because of the torch.jit and torch.nn initialization order issue... I think this could considered to be an op as we already have different special ops.

@driazati
Copy link
Contributor

You can do @torch._jit_internal.ignore (the one in jit just aliases this), but I don't see how that would help since the function would still be run (even if it returns False every time), so places that use it couldn't be exported.

@zou3519 zou3519 deleted the gh/wanchaol/33/head branch July 29, 2019 22:08
@facebook-github-bot
Copy link
Contributor

@wanchaol merged this pull request in c384fbf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants