Uh oh!
There was an error while loading. Please reload this page.
forked from pytorch/executorch
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd.py
More file actions
Latest commit
30 lines (23 loc) · 772 Bytes
/
Copy pathadd.py
File metadata and controls
30 lines (23 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# All rights reserved.
# Copyright 2023-2026 Arm Limited and/or its affiliates.
#
# Example of an external model for the Arm AOT Compiler
#
# Example of an external Python file to be used as a module by the `run.sh`
# (and the `backends/arm/scripts/aot_arm_compiler.py`) script.
#
# Just pass the path of the `add.py` file as `--model_name`
#
# These two variables are picked up by the `aot_arm_compiler.py` and used:
# `ModelUnderTest` should be a `torch.nn.module` instance.
# `ModelInputs` should be a tuple of inputs to the forward function.
#
importtorch
b=2
classmyModelAdd(torch.nn.Module):
def__init__(self):
super().__init__()
defforward(self, x):
returnx+x+b
ModelUnderTest=myModelAdd()
ModelInputs= (torch.ones(5),)