pytorch
05077f2a - [PyTorch] Avoid extra refcounting in vector variant of VariableType::unpack (#95835)

Commit
1 year ago
[PyTorch] Avoid extra refcounting in vector variant of VariableType::unpack (#95835) Looks like this line was a historical relic of Variable and Tensor not being the same. I spot checked assembly and it's not the same, which already implies this way is better; specifically there are fewer locked refcounting instructions (I believe the type of the expression is `Tensor` not `const Tensor&` and both forks must have the same type). Spotted this with at::cat in an internal workload; the actual fix is to enable InferenceMode but this should reduce the penalty for failing to do that. Differential Revision: [D43714744](https://our.internmc.facebook.com/intern/diff/D43714744/) Pull Request resolved: https://github.com/pytorch/pytorch/pull/95835 Approved by: https://github.com/albanD
Author
Committer
Parents
Loading