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

Function add_delegate_data

exir/_serialize/test/test_program.py:60–81  ·  view source on GitHub ↗

Adds the provided delegate data blobs to the execution plan.

(
    program: Program, plan: ExecutionPlan, blobs: Sequence[bytes]
)

Source from the content-addressed store, hash-verified

58
59
60def add_delegate_data(
61 program: Program, plan: ExecutionPlan, blobs: Sequence[bytes]
62) -> None:
63 """Adds the provided delegate data blobs to the execution plan."""
64 di = len(plan.delegates)
65 for blob in blobs:
66 data_index: int = len(program.backend_delegate_data)
67 program.backend_delegate_data.append(
68 BackendDelegateInlineData(
69 data=blob,
70 )
71 )
72 delegate = BackendDelegate(
73 id=f"delegate{di}",
74 processed=BackendDelegateDataReference(
75 location=DataLocation.INLINE,
76 index=data_index,
77 ),
78 compile_specs=[],
79 )
80 plan.delegates.append(delegate)
81 di += 1
82
83
84def canonicalize_delegate_indices(program: Program) -> Program:

Calls 4

BackendDelegateClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected