You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update XNNPACK docs to use to_edge_transform_and_lower API (#5344)
Summary:
Quick doc update to use the new to_edge_transform_and_lower API, since we recommend this path now.
Pull Request resolved: #5344
Test Plan: Rendered doc for this PR: https://docs-preview.pytorch.org/pytorch/executorch/5344/tutorial-xnnpack-delegate-lowering.html.
Reviewed By: mcr229
Differential Revision: D62634494
Pulled By: GregoryComer
fbshipit-source-id: c28881a8be5b6398da6d506819c28d085ff2762e
(cherry picked from commit 4357230)
We will go through this example with the [MobileNetV2](https://pytorch.org/hub/pytorch_vision_mobilenet_v2/) pretrained model downloaded from the TorchVision library. The flow of lowering a model starts after exporting the model `to_edge`. We call the `to_backend` api with the `XnnpackPartitioner`. The partitioner identifies the subgraphs suitable for XNNPACK backend delegate to consume. Afterwards, the identified subgraphs will be serialized with the XNNPACK Delegate flatbuffer schema and each subgraph will be replaced with a call to the XNNPACK Delegate.
We print the graph after lowering above to show the new nodes that were inserted to call the XNNPACK Delegate. The subgraphs which are being delegated to XNNPACK are the first argument at each call site. It can be observed that the majority of `convolution-relu-add` blocks and `linear` blocks were able to be delegated to XNNPACK. We can also see the operators which were not able to be lowered to the XNNPACK delegate, such as `clone` and `view_copy`.
@@ -75,7 +78,7 @@ The XNNPACK delegate can also execute symmetrically quantized models. To underst
75
78
76
79
```python
77
80
from torch.export import export_for_training
78
-
from executorch.exir import EdgeCompileConfig
81
+
from executorch.exir import EdgeCompileConfig, to_edge_transform_and_lower
0 commit comments