Skip to content

Commit

Permalink
[easy] encapsulate fb changes from OSS (pytorch#113677)
Browse files Browse the repository at this point in the history
Summary:
encapsulate fb changes into `torch._inductor.fx_passes.fb`, so that adding new passes (`fb.xxx`) won't need to touch OSS code like so:

```
# in torch/_inductor/fx_passes/pre_grad.py
if config.is_fbcode():
 from .fb import xxx  # every new fb/xxx.py would have needed this change in OSS code base
```

Test Plan: CI

Differential Revision: D51315193

Pull Request resolved: pytorch#113677
Approved by: https://github.com/khabinov, https://github.com/chenyang78
  • Loading branch information
kflu authored and pytorchmergebot committed Nov 16, 2023
1 parent cebad98 commit 1364f84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torch/_inductor/fx_passes/pre_grad.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def lazy_init():
from . import efficient_conv_bn_eval, split_cat # noqa: F401 # noqa: F401

if config.is_fbcode():
from .fb import split_cat as split_cat_fb # type: ignore[import] # noqa: F401
from . import fb # type: ignore[import] # noqa: F401


def pre_grad_passes(gm: torch.fx.GraphModule, example_inputs):
Expand Down

0 comments on commit 1364f84

Please sign in to comment.