Salil Desai
da43584bef
[Reland] Clean Up MobileOptimizerType Rewrite Flags Public API and Documentation ( #92081 )
...
Summary:
X-link: https://github.com/facebookresearch/d2go/pull/459
Reland of D41690203 (370df963e0 )
Remove MobileOptimizerType and all rewrite flags from torch.X and torch._C.X to clean up torch.X and torch._C.X namespaces
The affected rewrite flags are
- CONV_BN_FUSION
- FUSE_ADD_RELU
- HOIST_CONV_PACKED_PARAMS
- INSERT_FOLD_PREPACK_OPS
- REMOVE_DROPOUT
- VULKAN_AUTOMATIC_GPU_TRANSFER
Bc-Breaking Change:
Before this change, the rewrite flags were accessible through all of
1. torch.utils.mobile_optimizer.MobileOptimizerType.X
2. torch._C.MobileOptimizerType.X
3. torch.X
4. torch.MobileOptimizerType.X
5. torch._C.X
But after this change, only torch.utils.mobile_optimizer.MobileOptimizerType.X (option 1 above) and the newly added torch._C._MobileOptimizerType.X remain
Corresponding updates to PyTorch Tutorial Docs are in https://github.com/pytorch/tutorials/pull/2163
Test Plan:
```buck test caffe2/test:test_mobile_optimizer```
```
Summary
Pass: 6
Skip: 1
↻ caffe2/test:test_mobile_optimizer - test_mobilenet_optimize_for_mobile (test_mobile_optimizer.TestOptimizer)
ListingSuccess: 1
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/4222124793514412
```
___
```buck test caffe2/torch/fb/mobile/tests:model_exporter_tests```
Tests pass
___
With temporary testing changes in D41690204:
```buck run caffe2:test_rewrite_flags_api```
Before:
```
torch.utils.mobile_optimizer.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ✅ | Result: ✅
torch._C._MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ✅ | Result: ❌ (module 'torch._C' has no attribute '_MobileOptimizerType')
torch._C.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ✅
torch.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ✅
torch.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ✅
torch._C.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ✅
```
After:
```
torch.utils.mobile_optimizer.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ✅ | Result: ✅
torch._C._MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ✅ | Result: ✅
torch._C.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ❌ (module 'torch._C' has no attribute 'MobileOptimizerType')
torch.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ❌ (module 'torch' has no attribute 'VULKAN_AUTOMATIC_GPU_TRANSFER')
torch.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ❌ (module 'torch' has no attribute 'MobileOptimizerType')
torch._C.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ❌ (module 'torch._C' has no attribute 'VULKAN_AUTOMATIC_GPU_TRANSFER')
```
```buck test caffe2/test:public_bindings -- test_no_new_bindings```
```
Summary
Pass: 1
ListingSuccess: 1
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/7881299473114294
```
Reviewed By: SS-JIA
Differential Revision: D42442395
Pull Request resolved: https://github.com/pytorch/pytorch/pull/92081
Approved by: https://github.com/albanD
2023-01-14 17:06:00 +00:00
Kazuaki Ishizaki
4f91b8e0ee
Fix typo under docs directory ( #91871 )
...
This PR fixes typo in '.rst' files under 'docs' directory
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91871
Approved by: https://github.com/ngimel
2023-01-10 22:33:36 +00:00
PyTorch MergeBot
3aeb7127b4
Revert "Clean Up MobileOptimizerType Rewrite Flags Public API and Documentation ( #91600 )"
...
This reverts commit 370df963e0 .
Reverted https://github.com/pytorch/pytorch/pull/91600 on behalf of https://github.com/facebook-github-bot due to Diff reverted internally
2023-01-10 21:38:40 +00:00
Salil Desai
370df963e0
Clean Up MobileOptimizerType Rewrite Flags Public API and Documentation ( #91600 )
...
Summary:
X-link: https://github.com/facebookresearch/d2go/pull/452
Remove MobileOptimizerType and all rewrite flags from torch.X and torch._C.X to clean up torch.X and torch._C.X namespaces
The affected rewrite flags are
- CONV_BN_FUSION
- FUSE_ADD_RELU
- HOIST_CONV_PACKED_PARAMS
- INSERT_FOLD_PREPACK_OPS
- REMOVE_DROPOUT
- VULKAN_AUTOMATIC_GPU_TRANSFER
Bc-Breaking Change:
Before this change, the rewrite flags were accessible through all of
1. torch.utils.mobile_optimizer.MobileOptimizerType.X
2. torch._C.MobileOptimizerType.X
3. torch.X
4. torch.MobileOptimizerType.X
5. torch._C.X
But after this change, only torch.utils.mobile_optimizer.MobileOptimizerType.X (option 1 above) and the newly added torch._C._MobileOptimizerType.X remain
Corresponding updates to PyTorch Tutorial Docs are in https://github.com/pytorch/tutorials/pull/2163
Test Plan:
```buck test caffe2/test:test_mobile_optimizer```
```
Summary
Pass: 6
Skip: 1
↻ caffe2/test:test_mobile_optimizer - test_mobilenet_optimize_for_mobile (test_mobile_optimizer.TestOptimizer)
ListingSuccess: 1
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/4222124793514412
```
___
With temporary testing changes in D41690204:
```buck run caffe2:test_rewrite_flags_api```
Before:
```
torch.utils.mobile_optimizer.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ✅ | Result: ✅
torch._C._MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ✅ | Result: ❌ (module 'torch._C' has no attribute '_MobileOptimizerType')
torch._C.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ✅
torch.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ✅
torch.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ✅
torch._C.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ✅
```
After:
```
torch.utils.mobile_optimizer.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ✅ | Result: ✅
torch._C._MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ✅ | Result: ✅
torch._C.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ❌ (module 'torch._C' has no attribute 'MobileOptimizerType')
torch.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ❌ (module 'torch' has no attribute 'VULKAN_AUTOMATIC_GPU_TRANSFER')
torch.MobileOptimizerType.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ❌ (module 'torch' has no attribute 'MobileOptimizerType')
torch._C.VULKAN_AUTOMATIC_GPU_TRANSFER
Expected: ❌ | Result: ❌ (module 'torch._C' has no attribute 'VULKAN_AUTOMATIC_GPU_TRANSFER')
```
```buck test caffe2/test:public_bindings -- test_no_new_bindings```
```
Summary
Pass: 1
ListingSuccess: 1
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/7881299473114294
```
Differential Revision: D41690203
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91600
Approved by: https://github.com/albanD , https://github.com/malfet
2023-01-10 20:16:53 +00:00
Salil Desai
df1cc0ef47
[Vulkan] Add Vulkan Rewrite to Transfer Inputs and Outputs to Vulkan and CPU Backends Respectively ( #87432 )
...
With this change, we don't have to manually invoke transferring input and output backends when we run vulkan models.
Graph rewrite code based off of:
- 32efff45ba (diff-a473bddb458dc24225866a45092d6eca064eddd256245d93020e48e216eee4d5R160-R179)
Differential Revision: [D39519168](https://our.internmc.facebook.com/intern/diff/D39519168/ )
**NOTE FOR REVIEWERS**: This PR has internal Meta-specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D39519168/ )!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/87432
Approved by: https://github.com/mcr229 , https://github.com/digantdesai
2022-10-31 14:18:45 +00:00
Richard Barnes
b3387139b4
Mod lists to neutral+descriptive terms in caffe2/docs ( #49803 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49803
Per "https://fb.workplace.com/groups/e/permalink/3320810064641820/ " we can no longer use the terms "whitelist" and "blacklist", and editing any file containing them results in a critical error signal. Let's embrace the change.
This diff changes "blacklist" to "blocklist" in a number of non-interface contexts (interfaces would require more extensive testing and might interfere with reading stored data, so those are deferred until later).
Test Plan: Sandcastle
Reviewed By: vkuzo
Differential Revision: D25686924
fbshipit-source-id: 117de2ca43a0ea21b6e465cf5082e605e42adbf6
2020-12-23 11:37:11 -08:00
Vasiliy Kuznetsov
79b8328aaf
optimize_for_mobile: bring packed params to root module ( #42740 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42740
Adds a pass to hoist conv packed params to root module.
The benefit is that if there is nothing else in the conv module,
subsequent passes will delete it, which will reduce module size.
For context, freezing does not handle this because conv packed
params is a custom object.
Test Plan:
```
PYTORCH_JIT_LOG_LEVEL=">hoist_conv_packed_params.cpp" python test/test_mobile_optimizer.py TestOptimizer.test_hoist_conv_packed_params
```
Imported from OSS
Reviewed By: kimishpatel
Differential Revision: D23005961
fbshipit-source-id: 31ab1f5c42a627cb74629566483cdc91f3770a94
2020-08-08 15:53:20 -07:00
Xingying Cheng
04320a47d7
Add optimizer_for_mobile doc into python api root doc ( #41211 )
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/41211
Test Plan: Imported from OSS
Reviewed By: xta0
Differential Revision: D22543608
fbshipit-source-id: bf522a6c94313bf2696eca3c5bb5812ea98998d0
2020-07-15 09:57:40 -07:00