mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[TorchGen] Simplify argument_type_str (#142491)
Fixes #ISSUE_NUMBER Pull Request resolved: https://github.com/pytorch/pytorch/pull/142491 Approved by: https://github.com/ezyang
This commit is contained in:
@ -656,15 +656,14 @@ def argument_type_str(
|
||||
t: Type, *, simple_type: bool = False, symint: bool = True
|
||||
) -> str:
|
||||
if isinstance(t, BaseType):
|
||||
if t.name == BaseTy.Tensor:
|
||||
return "Tensor"
|
||||
elif t.name == BaseTy.int:
|
||||
if t.name == BaseTy.int:
|
||||
return "int64_t"
|
||||
elif t.name == BaseTy.float:
|
||||
return "double"
|
||||
elif t.name == BaseTy.str:
|
||||
return "c10::string_view"
|
||||
elif t.name in [
|
||||
BaseTy.Tensor,
|
||||
BaseTy.bool,
|
||||
BaseTy.QScheme,
|
||||
BaseTy.Scalar,
|
||||
@ -683,9 +682,6 @@ def argument_type_str(
|
||||
return t.name.name
|
||||
|
||||
elif isinstance(t, OptionalType):
|
||||
if str(t.elem) == "Tensor":
|
||||
# Is it desired to keep '?' for simple_type with new style dispatcher?
|
||||
return "Tensor?"
|
||||
elem = argument_type_str(t.elem, simple_type=simple_type, symint=symint)
|
||||
return f"{elem}?"
|
||||
elif isinstance(t, ListType):
|
||||
|
Reference in New Issue
Block a user