Skip to content

Commit 66220f7

Browse files
hsharma35facebook-github-bot
authored andcommitted
Enable constant methods in cadence export. (#7948)
Summary: Add option to specify constant methods in export. The constants show up as methods (similar to "forward") in the serialized .pte. Differential Revision: D68637824
1 parent e52b3fc commit 66220f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backends/cadence/aot/compiler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import logging
1010
from pathlib import Path
11-
from typing import Callable, cast, Optional
11+
from typing import Any, Callable, cast, Optional
1212

1313
import executorch.backends.cadence.aot.ops_registrations # noqa
1414
import torch
@@ -174,6 +174,7 @@ def export_to_edge(
174174
model: torch.nn.Module,
175175
inputs: tuple[object, ...],
176176
dump_graphs: bool = False,
177+
constant_methods: Optional[dict[str, Any]] = None,
177178
) -> EdgeProgramManager:
178179
assert isinstance(model, torch.nn.Module), "model should be an nn.Module"
179180

@@ -195,6 +196,7 @@ def export_to_edge(
195196
torch.ops.aten.angle.default,
196197
],
197198
),
199+
constant_methods=constant_methods,
198200
)
199201

200202
if dump_graphs:

0 commit comments

Comments
 (0)