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

Method load_config

backends/qualcomm/export_utils.py:165–186  ·  view source on GitHub ↗

config (Union[argparse.Namespace, str]): Accepts either a parser generated from setup_common_args_and_variables() or a json file.

(cls, config: Union[argparse.Namespace, str])

Source from the content-addressed store, hash-verified

163
164 @classmethod
165 def load_config(cls, config: Union[argparse.Namespace, str]) -> "QnnConfig":
166 """
167 config (Union[argparse.Namespace, str]): Accepts either a parser generated from setup_common_args_and_variables() or a json file.
168 """
169 qnn_config = None
170 if isinstance(config, argparse.Namespace):
171 logging.info("Using parser's config")
172 args_dict = vars(config)
173 matched_keys = {f.name for f in fields(QnnConfig)}
174 config = {k: v for k, v in args_dict.items() if k in matched_keys}
175 qnn_config = cls(**config)
176 elif isinstance(config, str):
177 logging.info(f"Using {config}'s config.")
178
179 with open(config) as f:
180 qnn_config = cls(**json.load(f))
181 else:
182 raise TypeError(
183 f"Invalid config type {type(config).__name__}. Expected argparse.Namespace or str."
184 )
185
186 return qnn_config
187
188 def _parse_skip_delegation_node(
189 self, skip_delegate_node_ids, skip_delegate_node_ops

Callers 15

mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 3

infoMethod · 0.80
itemsMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected