File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 12
12
__tensorrt_version__ ,
13
13
)
14
14
15
+ from typing import Dict , List
16
+
15
17
if sys .version_info < (3 ,):
16
18
raise Exception (
17
19
"Python 2 has reached end-of-life and is not supported by Torch-TensorRT"
18
20
)
19
21
20
22
21
- def _parse_semver (version ) :
23
+ def _parse_semver (version : str ) -> Dict [ str , str ] :
22
24
split = version .split ("." )
23
25
if len (split ) < 3 :
24
26
split .append ("" )
25
27
26
28
return {"major" : split [0 ], "minor" : split [1 ], "patch" : split [2 ]}
27
29
28
30
29
- def _find_lib (name , paths ) :
31
+ def _find_lib (name : str , paths : List [ str ]) -> str :
30
32
for path in paths :
31
33
libpath = os .path .join (path , name )
32
34
if os .path .isfile (libpath ):
@@ -99,7 +101,7 @@ def _find_lib(name, paths):
99
101
from torch_tensorrt .dynamo import backend
100
102
101
103
102
- def _register_with_torch ():
104
+ def _register_with_torch () -> None :
103
105
trtorch_dir = os .path .dirname (__file__ )
104
106
torch .ops .load_library (trtorch_dir + "/lib/libtorchtrt.so" )
105
107
Original file line number Diff line number Diff line change 4
4
import torch
5
5
6
6
7
- def dump_build_info ():
7
+ def dump_build_info () -> None :
8
8
"""Prints build information about the torch_tensorrt distribution to stdout"""
9
9
print (get_build_info ())
10
10
@@ -15,20 +15,20 @@ def get_build_info() -> str:
15
15
Returns:
16
16
str: String containing the build information for torch_tensorrt distribution
17
17
"""
18
- build_info = _C .get_build_info ()
19
- build_info = (
18
+ core_build_info = _C .get_build_info ()
19
+ build_info = str (
20
20
"Torch-TensorRT Version: "
21
21
+ str (__version__ )
22
22
+ "\n "
23
23
+ "Using PyTorch Version: "
24
24
+ str (torch .__version__ )
25
25
+ "\n "
26
- + build_info
26
+ + core_build_info
27
27
)
28
28
return build_info
29
29
30
30
31
- def set_device (gpu_id ) :
31
+ def set_device (gpu_id : int ) -> None :
32
32
_C .set_device (gpu_id )
33
33
34
34
You can’t perform that action at this time.
0 commit comments