Skip to content

cannot use this model as a layer of other model. #43

Answered by snakers4
gormat asked this question in Q&A
Discussion options

You must be logged in to vote

Just want to know if there is a specific reason to disable gradient calculation.

Well, basically these utils were designed mostly with inference in mind
Usually when we write inference code we either disable gradients altogether or use with with torch.no_grad()

I do not remember why I went with the former instead of the latter, but probably because I just invoke model simple like out = model(input) and I did not want to write an extra function hiding an extra level of tabulation from the concise examples

Anyway you can just override the init_jit_model function in your use case and that is it

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by snakers4
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #40 on January 25, 2021 12:15.