pytorch/torchgen
Xuehai Pan a229b4526f [BE] Prefer dash over underscore in command-line options (#94505)
Preferring dash over underscore in command-line options. Add `--command-arg-name` to the argument parser. The old arguments with underscores `--command_arg_name` are kept for backward compatibility.

Both dashes and underscores are used in the PyTorch codebase. Some argument parsers only have dashes or only have underscores in arguments. For example, the `torchrun` utility for distributed training only accepts underscore arguments (e.g., `--master_port`). The dashes are more common in other command-line tools. And it looks to be the default choice in the Python standard library:

`argparse.BooleanOptionalAction`: 4a9dff0e5a/Lib/argparse.py (L893-L895)

```python
class BooleanOptionalAction(Action):
    def __init__(...):
            if option_string.startswith('--'):
                option_string = '--no-' + option_string[2:]
                _option_strings.append(option_string)
```

It adds `--no-argname`, not `--no_argname`. Also typing `_` need to press the shift or the caps-lock key than `-`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94505
Approved by: https://github.com/ezyang, https://github.com/seemethere
2023-02-09 20:16:49 +00:00
..
api Revert "[Reland] Add sym_size/stride/numel/storage_offset to native_function.yaml (#91… (#92402)" 2023-02-03 03:12:43 +00:00
decompositions
dest [BE] Import Literal, Protocol, and Final from standard library typing as of Python 3.8+ (#94490) 2023-02-09 19:17:49 +00:00
executorch [torchgen] Add CI job to cover custom ops registration for Executorch (#91291) 2023-01-14 02:30:54 +00:00
operator_versions Update flatbuffer test models to match pkl models (#93022) 2023-01-26 21:17:57 +00:00
selective_build [torchgen] Fix selective build error on custom namespace (#83141) 2022-08-10 21:27:05 +00:00
shape_functions [JIT SSA] Allow updating shape functions without recompilation (#83629) 2022-08-22 18:03:44 +00:00
static_runtime Make segment_reduce properly private. (#93166) 2023-02-06 18:32:23 +00:00
__init__.py Package config/template files with torchgen (#78942) 2022-06-07 13:33:55 +00:00
BUCK.oss rename BUILD.buck to BUCK.oss (#78792) 2022-06-03 07:23:16 +00:00
BUILD.bazel
build.bzl [torchgen] Add CI job to make sure torchgen works for Executorch op registration (#89596) 2022-12-21 03:07:32 +00:00
code_template.py Apply ufmt linter to all py files under torchgen (#81570) 2022-07-16 03:52:25 +00:00
context.py Change API type Tensor[] for structured kernels. (#73350) 2022-09-26 21:46:38 +00:00
gen_backend_stubs.py [BE] Prefer dash over underscore in command-line options (#94505) 2023-02-09 20:16:49 +00:00
gen_executorch.py [BE] Prefer dash over underscore in command-line options (#94505) 2023-02-09 20:16:49 +00:00
gen_functionalization_type.py *_scatter ops should preserve input stride/storage_offset (#91029) 2022-12-22 19:41:53 +00:00
gen_lazy_tensor.py [BE] Prefer dash over underscore in command-line options (#94505) 2023-02-09 20:16:49 +00:00
gen_vmap_plumbing.py fix: update error when tensor escapes vmap (#89077) 2022-12-06 05:52:09 +00:00
gen.py [BE] Prefer dash over underscore in command-line options (#94505) 2023-02-09 20:16:49 +00:00
local.py Change API type Tensor[] for structured kernels. (#73350) 2022-09-26 21:46:38 +00:00
model.py Revert "[Reland] Add sym_size/stride/numel/storage_offset to native_function.yaml (#91… (#92402)" 2023-02-03 03:12:43 +00:00
native_function_generation.py [Pytorch][Executorch] Handwritten view copy out ops should resize out (#91194) 2023-01-30 23:07:14 +00:00
utils.py [BE] Import Literal, Protocol, and Final from standard library typing as of Python 3.8+ (#94490) 2023-02-09 19:17:49 +00:00