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

Function to_backend

exir/backend/backend_api.py:44–65  ·  view source on GitHub ↗

A generic function the dispatch happens on the type of the first argument. There are currently to overloaded to_backend function: Note: Python is dynamically-typed language and therefore cannot have proper method overloading as that requires the language to be able to discriminate betw

(args)

Source from the content-addressed store, hash-verified

42
43@singledispatch
44def to_backend(args):
45 """
46 A generic function the dispatch happens on the type of the first argument. There are currently to overloaded to_backend function:
47
48 Note: Python is dynamically-typed language and therefore cannot have proper method overloading as that requires the language to
49 be able to discriminate between types at compile-time. @to_backend.register will attach the function to to_backend() base on the type of the first
50 argument (type annotation is required). However, it can't take multiple types as arguments.
51
52 ::
53
54 def to_backend(
55 backend_id: str,
56 edge_graph_module: ExportedProgram,
57 compile_specs: List[CompileSpec],
58 ) -> LoweredBackendModule:
59
60 def to_backend(
61 edge_program: ExportedProgram,
62 partitioner: Partitioner,
63 ) -> ExportedProgram:
64 """
65 pass
66
67
68@to_backend.register

Calls

no outgoing calls