Skip to content

Commit 101746e

Browse files
authored
Arm backend: Example external model to be used by the ahead of time arm compiler (#10810)
Example of an external model to be loaded as a module by the aot_arm_compiler.py. Useful for documentation.
1 parent fa5048b commit 101746e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Example of an external model for the ARM AOT Compiler
2+
Example of an external Python file to be used as a module by the `run.sh` (and the `aot_arm_compiler.py`) scripts in `examples/arm` directory.
3+
Just pass the path of the `add.py` file as `--model_name`:
4+
5+
`ModelUnderTest` should be a `torch.nn.module` instance.
6+
7+
`ModelInputs` should be a tuple of inputs to the forward function.

examples/arm/example_modules/add.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import torch
2+
3+
4+
class myModelAdd(torch.nn.Module):
5+
def __init__(self):
6+
super().__init__()
7+
8+
def forward(self, x):
9+
return x + x
10+
11+
12+
ModelUnderTest = myModelAdd()
13+
ModelInputs = (torch.ones(5),)

0 commit comments

Comments
 (0)