mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
The goal of this PR is to provide a standard way to create simple treespec instances and hide the implementation details of the `PyTreeSpec` class. Changes: 1. Add function `treespec_leaf()` to replace `LeafSpec()`. 2. Add function `treespec_tuple(...)` and `treespec_dict(...)` to create treespec for `tuple` / `dict` which is used for `*args` / `**kwargs`. This avoids direct modification to `treespec` instances that rely on the implementation details of the `PyTreeSpec` class. 3. Change `len(spec.children_specs)` to `spec.num_children`. 4. Change `isinstance(spec, LeafSpec)` to `spec.is_leaf()`. ------ Pull Request resolved: https://github.com/pytorch/pytorch/pull/160843 Approved by: https://github.com/mlazos |
||
|---|---|---|
| .. | ||
| backend_config | ||
| experimental | ||
| fx | ||
| pt2e | ||
| quantizer | ||
| __init__.py | ||
| _correct_bias.py | ||
| _equalize.py | ||
| _learnable_fake_quantize.py | ||
| fake_quantize.py | ||
| fuse_modules.py | ||
| fuser_method_mappings.py | ||
| observer.py | ||
| pattern.md | ||
| qconfig_mapping.py | ||
| qconfig.py | ||
| quant_type.py | ||
| quantization_mappings.py | ||
| quantize_fx.py | ||
| quantize_jit.py | ||
| quantize_pt2e.py | ||
| quantize.py | ||
| stubs.py | ||
| utils.py | ||