Skip to content

Move is_param and get_param out of exir and into export #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions exir/program/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
edge_to_executorch_passes,
ExecutorchProgram,
ExirExportedProgram,
get_param,
is_param,
multi_method_program_to_executorch,
MultiMethodExecutorchProgram,
MultiMethodExirExportedProgram,
Expand All @@ -23,8 +21,6 @@
"ExecutorchProgram",
"_to_edge",
"edge_to_executorch_passes",
"is_param",
"get_param",
"MultiMethodExirExportedProgram",
"MultiMethodExecutorchProgram",
"multi_method_program_to_executorch",
Expand Down
22 changes: 0 additions & 22 deletions exir/program/_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,28 +203,6 @@ def edge_to_executorch_passes(config: ExecutorchBackendConfig) -> List[PassType]
return passes


def is_param(edge_program: ExportedProgram, node: torch.fx.Node) -> bool:
"""
Checks if the given node is a parameter within the edge_program
"""
return node.name in edge_program.graph_signature.inputs_to_parameters


def get_param(
edge_program: ExportedProgram,
node: torch.fx.Node,
) -> Optional[torch.nn.Parameter]:
"""
Returns the parameter associated with the given node in the edge program.
Returns None if the node is not a parameter within the edge_program
"""
if is_param(edge_program, node):
parameter_name = edge_program.graph_signature.inputs_to_parameters[node.name]
return edge_program.state_dict[parameter_name]

return None


######## MULTI METHOD STUFF BELOW HERE. TO BE MERGED INTO ExirExportedProgram and ExecutorchProgram AND THEN DELETED ##########


Expand Down