mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Improve namespace for c10::MemoryFormat::Contiguous
in torchgen/api/cpp.py
(#131622)
Top-level namespaces are more convenient for out-of-tree device extensions.
For example, now we have a patch for it in `torch_npu`:
98c50ced16/codegen/gen_backend_stubs.py (L772-L778)
```python
JIT_TO_CPP_DEFAULT["contiguous_format"] = "c10::MemoryFormat::Contiguous"
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/131622
Approved by: https://github.com/zou3519
This commit is contained in:
committed by
PyTorch MergeBot
parent
efc6e8457a
commit
378b12f3ad
@ -287,7 +287,7 @@ class PythonArgument:
|
||||
"::std::nullopt": "None",
|
||||
"std::nullopt": "None",
|
||||
"{}": "None",
|
||||
"MemoryFormat::Contiguous": "contiguous_format",
|
||||
"c10::MemoryFormat::Contiguous": "contiguous_format",
|
||||
"QScheme::PER_TENSOR_AFFINE": "per_tensor_affine",
|
||||
}.get(self.default, self.default)
|
||||
return f"{name}: {type_str} = {default}"
|
||||
|
Reference in New Issue
Block a user