@0phoff
Thanks for posting this link here. That page in the doc helps but doesn’t solve my initial question automatically. Prorogation of the flags wasn’t my concern since all of my variable will have the gradient flag off. My initial question was different from what’s described in the doc and it’s a common problem of using nearly all of the popular deep learning frameworks when you try to implement an inference based model since these frameworks were developed biased towards error BP based models (for an obvious reason after Alexnet). In Tensorflow we need to do other hacks to get around this.
But inference based models are still important given many key innovations in even error BP based deep learning models came from these models. These two kinds of models are deeply related beyond some superficial difference. My post was also to suggest building a better support for inference models. If you work on these models, I think you’d already know what I’m talking about. If not, Matthew Zeiler’s adaptive deconvnet is one of my favorite papers on this track in case you are interested.
The current design of PyTorch is not bad at all. (Except it’s a little confusing that using GPU convolution on Tensors needs a Variable under autograd module.) Turning off the gradient seems have solved the problem nicely and my early implementation went well. However, the new release sounds a lot more straight forward.