pytorch
1324b0dd - [FX] Adds C-level monkeypatching of `torch.randn` so that we can capture it during tracing. (#54060)

Commit
3 years ago
[FX] Adds C-level monkeypatching of `torch.randn` so that we can capture it during tracing. (#54060) Summary: ``` def foo(x): return x + torch.randn(3, 3) fx.enable_ctracing(True) print(fx.symbolic_trace(foo).code) ``` results in ``` def forward(self, x): randn = torch.randn(3, 3) add = x + randn; x = randn = None return add ``` Seems to slow down tracing by 1.5-3x. DenseNet121: 0.05 -> 0.12 seconds ResNet18: 0.10 -> 0.15 Pull Request resolved: https://github.com/pytorch/pytorch/pull/54060 Reviewed By: jamesr66a Differential Revision: D27208978 Pulled By: Chillee fbshipit-source-id: b9e19a9b1084dadfc0dfaee41a03bc25a45910b1
Author
Parents
Loading