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

Class ExecutorchBackendConfig

exir/capture/_config.py:57–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55@compatibility(is_backward_compatible=False)
56@dataclass
57class ExecutorchBackendConfig:
58 passes: List[PassType] = field(default_factory=list)
59
60 # A single memory planning pass can be defined for all the programs in the
61 # EdgeProgramManager or can be defined per program.
62 memory_planning_pass: Union[PassType, Dict[str, PassType]] = MemoryPlanningPass()
63 to_out_var_pass: PassType = ToOutVarPass(ignore_to_out_var_failure=False)
64 dynamic_memory_planning_mode: DynamicMemoryPlanningMode = (
65 DynamicMemoryPlanningMode.UPPER_BOUND
66 )
67 emit_stacktrace: bool = False
68
69 # Whether to move delegate data blobs from the Program into separate
70 # segments, rather than encoding those blobs in the flatbuffer data.
71 # This makes it possible to free those blobs at runtime.
72 extract_delegate_segments: bool = True
73
74 # When extracting segments, the starting offset of each segment will be
75 # aligned to this value (in bytes). Must be a power of two.
76 segment_alignment: int = 128
77
78 # If provided, the minimum alignment of tensor buffers in the program. Must
79 # be a power of 2. If not provided, uses the value in the schema file.
80 constant_tensor_alignment: Optional[int] = None
81
82 # If provided, the minimum alignment of delegate data in the program. Must
83 # be a power of 2. If not provided, uses the value in the schema file.
84 delegate_alignment: Optional[int] = None
85
86 # A single sym shape eval pass can be defined for all the programs in the
87 # EdgeProgramManager or can be defined per program.
88 sym_shape_eval_pass: Union[PassType, Dict[str, PassType]] = (
89 ConstraintBasedSymShapeEvalPass()
90 )
91
92 # If set to true, view_copy operations will be converted to lightweight
93 # view operations in the ET runtime
94 # Moreover, static views will be elided from the ExecuTorch graph
95 remove_view_copy: bool = True
96
97 # Bool: if True, all constant tensors will be stored in a separate file. If False,
98 # all constant tensors will be stored in the PTE file.
99 # Callable: a function from torch.fx.Node to Optional[str]. This will be called for each
100 # placeholder (constant tensor) node, and if it returns a string, that node will be
101 # tagged with the string. If None, the constant tensor is stored in the PTE file.
102 # Otherwise, it is stored in a file named by the string. E.g., a function
103 # lambda x: "model_weights" will save all constants into a file "model_weights.ptd".
104 external_constants: Union[bool, Callable[[torch.fx.Node], Optional[str]]] = False
105
106 # If set to true, all trainable weights will be stored in a separate file,
107 # external to the PTE file.
108 external_mutable_weights: bool = False
109
110 # If set to true, all mutable buffers will have their fully qualified names
111 # serialized in the PTE file. Its value is ignored if mutable buffers are not
112 # memory planned as the names must be serialized in that case.
113 emit_mutable_buffer_names: bool = False
114

Calls 3

MemoryPlanningPassClass · 0.90
ToOutVarPassClass · 0.90