benchmark
619f1594 - Make torch context manager a TorchCtxManagerClassVariable (#111622)

Commit
2 years ago
Make torch context manager a TorchCtxManagerClassVariable (#111622) Summary: Major change in this PR is to make torch context manager class a separate ```TorchCtxManagerClassVariable```, since we have dynamo implementation for these ctx managers. I was thinking to wrap them as ```UserDefinedClassVariable``` and do dispatch at ```USCVariable.call_function```, but it seems almost the same amount of work and this way is more clear. This is on the way of moving ```TorchVariable``` to ```TorchFunctionVariable``` which will only handle the functions who would be allowed in graph (e.g, ```torch.sin```) and constant folded (e.g, ```torch.is_floating_point```). All other torch functions would be go through skip/inline rules, and would be wrapped as ```UserFunctionVariable``` (for inlined) and ```SkipFilesVariable``` (for skipped). The next steps: * Wrap torch modules, classes, objects as regular ```PythonModuleVariable```, ```UserDefinedClassVariable``` and ```UserDefinedObjectVariable```. * Generate the allow in graph torch functions list and wrap them as ```TorchFunctionVariable```. * Finally merge ```skipfiles.check``` and ```is_allowed``` into one function ```allow_skip.check(fn)``` which would return a Enum of allow, skip and inline. X-link: https://github.com/pytorch/pytorch/pull/111622 Approved by: https://github.com/jansel Reviewed By: izaitsevfb Differential Revision: D50778779 Pulled By: yanboliang fbshipit-source-id: 4458a324a2010aa46bac10fee2ddea04d23dd3cf
Author
Parents
Loading