Skip to content

Commit 929da9b

Browse files
committed
Testing hack
1 parent 0f11e43 commit 929da9b

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

codegen/tools/gen_oplist.py

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,10 @@
1515

1616
try:
1717
from executorch.codegen.parse import strip_et_fields
18-
from executorch.exir._serialize import _deserialize_pte_binary
19-
from executorch.exir.schema import (
20-
EValue,
21-
KernelCall,
22-
OptionalTensorList,
23-
Tensor,
24-
TensorList
25-
)
2618
except ImportError:
2719
# If we build from source, executorch.codegen is not available.
2820
# We can use relative import instead.
2921
from ..parse import strip_et_fields
30-
from ..exir._serialize import _deserialize_pte_binary
31-
from ..exir.schema import (
32-
EValue,
33-
KernelCall,
34-
OptionalTensorList,
35-
Tensor,
36-
TensorList
37-
)
3822

3923
from torchgen.gen import LineLoader, parse_native_yaml_struct
4024
from torchgen.selective_build.operator import SelectiveBuildOperator
@@ -105,6 +89,7 @@ def _get_operators(model_file: str) -> List[str]:
10589
with open(model_file, "rb") as f:
10690
buf = f.read()
10791

92+
from executorch.exir._serialize import _deserialize_pte_binary
10893
model = _deserialize_pte_binary(buf)
10994
operators = []
11095
for execution_plan in model.execution_plan:
@@ -114,12 +99,6 @@ def _get_operators(model_file: str) -> List[str]:
11499
return operators
115100

116101

117-
def _get_dtypes_from_non_list(evalue: EValue):
118-
kernel_key = ""
119-
if isinstance(evalue, Tensor):
120-
dim_order = ",".join(map(str, evalue.dim_order))
121-
kernel_key += f"{evalue.scalar_type};{dim_order}|"
122-
return kernel_key
123102

124103

125104
def _get_kernel_metadata_for_model(model_file: str) -> Dict[str, List[str]]:
@@ -133,6 +112,20 @@ def _get_kernel_metadata_for_model(model_file: str) -> Dict[str, List[str]]:
133112
buf = f.read()
134113
op_kernel_key_list: Dict[str, List[str]] = {}
135114

115+
from executorch.exir._serialize import _deserialize_pte_binary
116+
from executorch.exir.schema import (
117+
EValue,
118+
KernelCall,
119+
OptionalTensorList,
120+
Tensor,
121+
TensorList
122+
)
123+
def _get_dtypes_from_non_list(evalue: EValue):
124+
kernel_key = ""
125+
if isinstance(evalue, Tensor):
126+
dim_order = ",".join(map(str, evalue.dim_order))
127+
kernel_key += f"{evalue.scalar_type};{dim_order}|"
128+
return kernel_key
136129
model = _deserialize_pte_binary(buf)
137130
for execution_plan in model.execution_plan:
138131
for chain in execution_plan.chains:

0 commit comments

Comments
 (0)