Skip to content

Commit ff33b63

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
Move is_param and get_param out of exir and into export (#67)
Summary: X-link: pytorch/pytorch#107264 Pull Request resolved: #67 These doesn't feel edge specific so moving out of exir. Differential Revision: D48361384 fbshipit-source-id: bc30f25fd33dc0ad0f8c1c1c27cd50352c5cd9c8
1 parent d1563b6 commit ff33b63

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

exir/program/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
edge_to_executorch_passes,
1212
ExecutorchProgram,
1313
ExirExportedProgram,
14-
get_param,
15-
is_param,
1614
multi_method_program_to_executorch,
1715
MultiMethodExecutorchProgram,
1816
MultiMethodExirExportedProgram,
@@ -23,8 +21,6 @@
2321
"ExecutorchProgram",
2422
"_to_edge",
2523
"edge_to_executorch_passes",
26-
"is_param",
27-
"get_param",
2824
"MultiMethodExirExportedProgram",
2925
"MultiMethodExecutorchProgram",
3026
"multi_method_program_to_executorch",

exir/program/_program.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -203,28 +203,6 @@ def edge_to_executorch_passes(config: ExecutorchBackendConfig) -> List[PassType]
203203
return passes
204204

205205

206-
def is_param(edge_program: ExportedProgram, node: torch.fx.Node) -> bool:
207-
"""
208-
Checks if the given node is a parameter within the edge_program
209-
"""
210-
return node.name in edge_program.graph_signature.inputs_to_parameters
211-
212-
213-
def get_param(
214-
edge_program: ExportedProgram,
215-
node: torch.fx.Node,
216-
) -> Optional[torch.nn.Parameter]:
217-
"""
218-
Returns the parameter associated with the given node in the edge program.
219-
Returns None if the node is not a parameter within the edge_program
220-
"""
221-
if is_param(edge_program, node):
222-
parameter_name = edge_program.graph_signature.inputs_to_parameters[node.name]
223-
return edge_program.state_dict[parameter_name]
224-
225-
return None
226-
227-
228206
######## MULTI METHOD STUFF BELOW HERE. TO BE MERGED INTO ExirExportedProgram and ExecutorchProgram AND THEN DELETED ##########
229207

230208

0 commit comments

Comments
 (0)