mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[TorchGen] remove remove_non_owning_ref_types from valuetype_type (#142449)
It is not used Pull Request resolved: https://github.com/pytorch/pytorch/pull/142449 Approved by: https://github.com/ezyang
This commit is contained in:
parent
1b3f8b7589
commit
db81a3f31c
2 changed files with 1 additions and 15 deletions
|
|
@ -99,22 +99,16 @@ def valuetype_type(
|
|||
*,
|
||||
binds: ArgName,
|
||||
mutable: bool = True,
|
||||
remove_non_owning_ref_types: bool = False,
|
||||
symint: bool = False,
|
||||
) -> NamedCType | None:
|
||||
if isinstance(t, BaseType):
|
||||
if t.name == BaseTy.Tensor or t.name == BaseTy.Scalar:
|
||||
if t.name in (BaseTy.Tensor, BaseTy.Scalar):
|
||||
return None
|
||||
elif str(t) == "SymInt":
|
||||
if symint:
|
||||
return NamedCType(binds, BaseCType(SymIntT))
|
||||
else:
|
||||
return NamedCType(binds, BaseCType(longT))
|
||||
if remove_non_owning_ref_types:
|
||||
if t.name == BaseTy.str:
|
||||
raise AssertionError(
|
||||
"string ref->value conversion: not implemented yet"
|
||||
)
|
||||
# All other BaseType currently map directly to BaseCppTypes.
|
||||
return NamedCType(binds, BaseCType(BaseTypeToCppMapping[t.name]))
|
||||
elif isinstance(t, OptionalType):
|
||||
|
|
@ -150,7 +144,6 @@ def argumenttype_type(
|
|||
binds=binds,
|
||||
mutable=mutable,
|
||||
symint=symint,
|
||||
remove_non_owning_ref_types=remove_non_owning_ref_types,
|
||||
)
|
||||
if r is not None:
|
||||
return r
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ def valuetype_type(
|
|||
t: Type,
|
||||
*,
|
||||
binds: ArgName,
|
||||
remove_non_owning_ref_types: bool = False,
|
||||
) -> NamedCType | None:
|
||||
if isinstance(t, BaseType):
|
||||
if t.name == BaseTy.Tensor or t.name == BaseTy.Scalar:
|
||||
|
|
@ -75,11 +74,6 @@ def valuetype_type(
|
|||
# For SymInt we simply treat it as int.
|
||||
elif str(t) == "SymInt":
|
||||
return NamedCType(binds, BaseCType(BaseTypeToCppMapping[BaseTy.int]))
|
||||
if remove_non_owning_ref_types:
|
||||
if t.name == BaseTy.str:
|
||||
raise AssertionError(
|
||||
"string ref->value conversion: not implemented yet"
|
||||
)
|
||||
# All other BaseType currently map directly to BaseCppTypes.
|
||||
return NamedCType(binds, BaseCType(BaseTypeToCppMapping[t.name]))
|
||||
elif isinstance(t, OptionalType):
|
||||
|
|
@ -114,7 +108,6 @@ def argumenttype_type(
|
|||
r = valuetype_type(
|
||||
t,
|
||||
binds=binds,
|
||||
remove_non_owning_ref_types=remove_non_owning_ref_types,
|
||||
)
|
||||
if r is not None:
|
||||
return r
|
||||
|
|
|
|||
Loading…
Reference in a new issue