pytorch
951df11a - [dynamo] Raise exception on incorrect usage of disallow_in_graph (#98892)

Commit
2 years ago
[dynamo] Raise exception on incorrect usage of disallow_in_graph (#98892) Summary - `disallow_in_graph` is mostly useful for backends. Suppose, your backend does not support `torch.abs()`. So, you can use `disallow_in_graph` to do a graph break. The assumption in the above statement is that `disallow_in_graph` is called on an `allowed` callable. `allowed` in Dynamo language refers to a callable that is put as-is in the Dynamo graph. Therefore, if one uses `disallow_in_graph` on some non-torch non-allowed function, we want to raise an exception to tell user that they probably want something else. * If they want to disable Dynamo - they should use torch._dynamo.disable * If they wanted to stop inlining - they should use torch._dynamo.graph_break. However this is not a decorator. So, we need to provide another API. But, the question - who would want to do this? Pull Request resolved: https://github.com/pytorch/pytorch/pull/98892 Approved by: https://github.com/jansel
Author
Committer
Parents
Loading