pytorch
920ec665 - [OpBench] fix jit mode run of operator benchmark for ops with parameters (#46694)

Commit
4 years ago
[OpBench] fix jit mode run of operator benchmark for ops with parameters (#46694) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/46694 For the op with parameters (e.g. conv), the jit mode run currently will raise an error of `RuntimeError: Cannot insert a Tensor that requires grad as a constant. Consider making it a parameter or input, or detaching the gradient`. After consulting https://www.fburl.com/vtkys6ug, decided to turn-off gradient for the parameters in the forward run. If we want op with parameters to work in backward with jit mode, probably needs to turn `TorchBenchmarkBase` into a sub-class of `nn.Module` Test Plan: ./buck-out/gen/caffe2/benchmarks/operator_benchmark/pt/conv_test.par --use_jit Reviewed By: mingzhe09088 Differential Revision: D24451206 fbshipit-source-id: 784eb60ca155b0152d745c92f6d0ce6b2c9014c6
Author
Yang Wang
Parents
Loading