diff --git a/torchgen/api/cpp.py b/torchgen/api/cpp.py index c46f265b515..7695367a030 100644 --- a/torchgen/api/cpp.py +++ b/torchgen/api/cpp.py @@ -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 diff --git a/torchgen/executorch/api/et_cpp.py b/torchgen/executorch/api/et_cpp.py index 554a63864e0..d09f0079197 100644 --- a/torchgen/executorch/api/et_cpp.py +++ b/torchgen/executorch/api/et_cpp.py @@ -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