MCPcopy Create free account
hub / github.com/pytorch/executorch / _register_no_decomp_op

Function _register_no_decomp_op

exir/program/_program.py:1007–1028  ·  view source on GitHub ↗
(op_aten)

Source from the content-addressed store, hash-verified

1005# Registers the op in edge_no_decomp_namespace namespace for the aten
1006# op that is passed in if it is not already cached in the table.
1007def _register_no_decomp_op(op_aten):
1008 # Check if the op is already cached in the table. If not, then we need to
1009 # create a new op in the edge_no_decomp_namespace namespace.
1010 if aten_op_to_transform_op.get(op_aten) is None and isinstance(
1011 op_aten, torch._ops.OpOverload
1012 ):
1013 # Extract the schema from the aten op.
1014 op_schema = str(op_aten._schema).split("::")[1]
1015 op_name = op_aten._schema.name.split("::")[1]
1016 # Define an op in the edge_no_decomp_namespace namespace with the aten schema.
1017 lib.define(op_schema)
1018 # Define the implementation of the op in the edge_no_decomp_namespace namespace.
1019 # Important to note that the implementation of the op is the same as the aten op.
1020
1021 overload_name = op_aten._schema.overload_name
1022 if overload_name != "":
1023 op_name += "." + overload_name
1024 lib.impl(op_name, op_aten, "CompositeExplicitAutograd")
1025
1026 # Cache the aten op and transformed op in their corresponding tables for future use.
1027 aten_op_to_transform_op[op_aten] = _get_transformed_op(op_aten)
1028 transform_op_to_aten_op[str(aten_op_to_transform_op[op_aten])] = op_aten
1029
1030
1031def _sanity_check_graph_for_non_decomp_ops(

Calls 3

_get_transformed_opFunction · 0.85
splitMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected