Skip to content

Commit f52d934

Browse files
guangy10Guang Yang
authored andcommitted
Fixed linter (#11742)
Fixed linter error. CI Co-authored-by: Guang Yang <[email protected]>
1 parent 7565342 commit f52d934

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

temp/run.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import torch
2+
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
3+
from executorch.exir import to_edge_transform_and_lower
4+
from executorch.extension.pybindings.portable_lib import (
5+
_load_for_executorch_from_buffer,
6+
)
7+
8+
9+
class Model(torch.nn.Module):
10+
def forward(self, x, y):
11+
return torch.add(x, y, alpha=10)
12+
13+
14+
inputs = (
15+
torch.randn(10),
16+
torch.randn(10),
17+
)
18+
model = Model()
19+
20+
ep = torch.export.export(model, inputs)
21+
lowered = to_edge_transform_and_lower(
22+
ep,
23+
partitioner=[XnnpackPartitioner()],
24+
).to_executorch()
25+
26+
et_model = _load_for_executorch_from_buffer(lowered.buffer)
27+
28+
eager_output = model(*inputs)
29+
et_output = et_model([*inputs])[0]
30+
31+
print(f"Eager: {eager_output}")
32+
print(f"ET: {et_output}")
33+
print(f"Error: {et_output-eager_output}")

0 commit comments

Comments
 (0)