MCPcopy Create free account
hub / github.com/pytorch/pytorch / codegen_config

Method codegen_config

torch/utils/_config_module.py:161–173  ·  view source on GitHub ↗

Convert config to Python statements that replicate current config. This does NOT include config settings that are at default values.

(self)

Source from the content-addressed store, hash-verified

159 return pickle.dumps(config, protocol=2)
160
161 def codegen_config(self) -> str:
162 """Convert config to Python statements that replicate current config.
163 This does NOT include config settings that are at default values.
164 """
165 lines = []
166 mod = self.__name__
167 for k, v in self._config.items():
168 if k in self._config.get("_save_config_ignore", ()):
169 continue
170 if v == self._default[k]:
171 continue
172 lines.append(f"{mod}.{k} = {v!r}")
173 return "\n".join(lines)
174
175 def get_hash(self) -> bytes:
176 """Hashes the configs that are not compile_ignored"""

Callers 3

generate_config_stringFunction · 0.80
_gen_test_codeMethod · 0.80

Calls 4

itemsMethod · 0.45
getMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by 2

_gen_test_codeMethod · 0.64