1+ from __future__ import annotations
2+
13from enum import Enum
24from typing import Any , Dict , List , Optional , Sequence , Tuple
35
@@ -32,11 +34,11 @@ class _ShapeMode(Enum):
3234 shape : Optional [
3335 Tuple [int , ...] | Dict [str , Tuple [int , ...]]
3436 ] = None #: Either a single Tuple or a dict of tuples defining the input shape. Static shaped inputs will have a single tuple. Dynamic inputs will have a dict of the form ``{ "min_shape": Tuple, "opt_shape": Tuple, "max_shape": Tuple }``
35- dtype : _enums .dtype = ( # type: ignore[name-defined]
37+ dtype : _enums .dtype = (
3638 _enums .dtype .unknown
3739 ) #: The expected data type of the input tensor (default: torch_tensorrt.dtype.float32)
3840 _explicit_set_dtype : bool = False
39- format : _enums .TensorFormat = ( # type: ignore[name-defined]
41+ format : _enums .TensorFormat = (
4042 _enums .TensorFormat .contiguous
4143 ) #: The expected format of the input tensor (default: torch_tensorrt.TensorFormat.NCHW)
4244
@@ -208,7 +210,7 @@ def _supported_input_size_type(input_size: Any) -> bool:
208210 return False
209211
210212 @staticmethod
211- def _parse_dtype (dtype : Any ) -> _enums .dtype : # type: ignore[name-defined]
213+ def _parse_dtype (dtype : Any ) -> _enums .dtype :
212214 if isinstance (dtype , torch .dtype ):
213215 if dtype == torch .long :
214216 return _enums .dtype .long
@@ -236,7 +238,7 @@ def _parse_dtype(dtype: Any) -> _enums.dtype: # type: ignore[name-defined]
236238 )
237239
238240 @staticmethod
239- def _to_torch_dtype (dtype : _enums .dtype ) -> torch .dtype : # type: ignore[name-defined]
241+ def _to_torch_dtype (dtype : _enums .dtype ) -> torch .dtype :
240242 if dtype == _enums .dtype .long :
241243 return torch .long
242244 elif dtype == _enums .dtype .int32 :
@@ -255,7 +257,7 @@ def is_trt_dtype(self) -> bool:
255257 return bool (self .dtype != _enums .dtype .long )
256258
257259 @staticmethod
258- def _parse_format (format : Any ) -> _enums .TensorFormat : # type: ignore[name-defined]
260+ def _parse_format (format : Any ) -> _enums .TensorFormat :
259261 if isinstance (format , torch .memory_format ):
260262 if format == torch .contiguous_format :
261263 return _enums .TensorFormat .contiguous
0 commit comments