pytorch/torchgen
Mengwei Liu 5c8a9803c8 [torchgen] Support multiple namespace in NativeFunctions.h (#79733)
Summary:
This is a follow up to #78015. This PR
* introduces namespace logic for generating `NativeFunctions.h`.
* adds helper function to extract namespace from string
* relaxes the constraint on the levels we support for custom kernel namespace to 2

Test Plan:
Yaml entry:
```
- func: unsqueeze.out(Tensor(a) self, int dim, *, Tensor(a!) out) -> Tensor(a!)
  variants: function
  device_check: NoCheck
  dispatch:
    CPU: custom_1::custom_2::unsqueeze
```

Generated `NativeFunctions.h`:

```
namespace custom_1 {
namespace custom_2 {
namespace native {
    TORCH_API at::Tensor & unsqueeze(const at::Tensor & self, int64_t dim, at::Tensor & out);
} // namespace native
} // namespace custom_2
} // namespace custom_1

```

Differential Revision: D37198111

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79733
Approved by: https://github.com/bdhirsh
2022-07-08 21:56:52 +00:00
..
api fix overload ambiguity with functional ops; fix _foreach op grouping (#80556) 2022-07-06 12:45:11 +00:00
decompositions
dest functionalization <> LTC integration (take 3) (#80251) 2022-06-26 23:10:21 +00:00
operator_versions
selective_build
shape_functions Put imports in correct order so clang-format doesn't get mad every time 2022-05-20 18:39:47 +00:00
static_runtime [static-runtime] add nnc codegen for aten::div (#76903) 2022-06-22 05:47:44 +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
code_template.py Cleanup some Python2-related code (#78864) 2022-06-06 17:40:02 +00:00
context.py [test] attempt to functionalize ops with mutable positional-only args 2022-05-19 18:50:34 +00:00
gen_backend_stubs.py [torchgen] Support multiple namespace in NativeFunctions.h (#79733) 2022-07-08 21:56:52 +00:00
gen_functionalization_type.py functionalization <> LTC integration (take 3) (#80251) 2022-06-26 23:10:21 +00:00
gen_lazy_tensor.py [torchgen] Support multiple namespace in NativeFunctions.h (#79733) 2022-07-08 21:56:52 +00:00
gen.py [torchgen] Support multiple namespace in NativeFunctions.h (#79733) 2022-07-08 21:56:52 +00:00
local.py
model.py [torchgen] Support multiple namespace in NativeFunctions.h (#79733) 2022-07-08 21:56:52 +00:00
native_function_generation.py fix overload ambiguity with functional ops; fix _foreach op grouping (#80556) 2022-07-06 12:45:11 +00:00
utils.py [torchgen] Support multiple namespace in NativeFunctions.h (#79733) 2022-07-08 21:56:52 +00:00