File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
tests/tests_pytorch/models Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 9
9
import tests_pytorch .helpers .pipelines as pipes
10
10
from lightning .pytorch .core .module import _TORCH_TRT_AVAILABLE
11
11
from lightning .pytorch .demos .boring_classes import BoringModel
12
+ from lightning .pytorch .utilities .exceptions import MisconfigurationException
12
13
from tests_pytorch .helpers .runif import RunIf
13
14
14
15
@@ -22,6 +23,15 @@ def test_missing_tensorrt_package():
22
23
model .to_tensorrt ("model.trt" )
23
24
24
25
26
+ @RunIf (tensorrt = True , min_torch = "2.2.0" )
27
+ def test_tensorrt_with_wrong_default_device (tmp_path ):
28
+ model = BoringModel ()
29
+ input_sample = torch .randn ((1 , 32 ))
30
+ file_path = os .path .join (tmp_path , "model.trt" )
31
+ with pytest .raises (MisconfigurationException ):
32
+ model .to_tensorrt (file_path , input_sample , default_device = "cpu" )
33
+
34
+
25
35
@RunIf (tensorrt = True , min_cuda_gpus = 1 , min_torch = "2.2.0" )
26
36
def test_tensorrt_saves_with_input_sample (tmp_path ):
27
37
model = BoringModel ()
You can’t perform that action at this time.
0 commit comments