@@ -222,6 +222,7 @@ class Operation:
222222 def __getattr__ (self , name : str ) -> Incomplete : ...
223223
224224class TensorShape (metaclass = ABCMeta ):
225+ __slots__ = ["_dims" ]
225226 def __init__ (self , dims : ShapeLike ) -> None : ...
226227 @property
227228 def rank (self ) -> int : ...
@@ -308,6 +309,7 @@ class UnconnectedGradients(Enum):
308309_SpecProto = TypeVar ("_SpecProto" , bound = Message )
309310
310311class TypeSpec (ABC , Generic [_SpecProto ]):
312+ __slots__ = ["_cached_cmp_key" ]
311313 @property
312314 @abstractmethod
313315 def value_type (self ) -> Any : ...
@@ -323,6 +325,7 @@ class TypeSpec(ABC, Generic[_SpecProto]):
323325 def most_specific_compatible_type (self , other : Self ) -> Self : ...
324326
325327class TensorSpec (TypeSpec [struct_pb2 .TensorSpecProto ]):
328+ __slots__ : list [str ] = []
326329 def __init__ (self , shape : ShapeLike , dtype : DTypeLike = ..., name : str | None = None ) -> None : ...
327330 @property
328331 def value_type (self ) -> Tensor : ...
@@ -339,6 +342,7 @@ class TensorSpec(TypeSpec[struct_pb2.TensorSpecProto]):
339342 def is_compatible_with (self , spec_or_tensor : Self | TensorCompatible ) -> _bool : ... # type: ignore[override]
340343
341344class SparseTensorSpec (TypeSpec [struct_pb2 .TypeSpecProto ]):
345+ __slots__ = ["_shape" , "_dtype" ]
342346 def __init__ (self , shape : ShapeLike | None = None , dtype : DTypeLike = ...) -> None : ...
343347 @property
344348 def value_type (self ) -> SparseTensor : ...
@@ -350,6 +354,7 @@ class SparseTensorSpec(TypeSpec[struct_pb2.TypeSpecProto]):
350354 def from_value (cls , value : SparseTensor ) -> Self : ...
351355
352356class RaggedTensorSpec (TypeSpec [struct_pb2 .TypeSpecProto ]):
357+ __slots__ = ["_shape" , "_dtype" , "_ragged_rank" , "_row_splits_dtype" , "_flat_values_spec" ]
353358 def __init__ (
354359 self ,
355360 shape : ShapeLike | None = None ,
0 commit comments