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 99import tests_pytorch .helpers .pipelines as pipes
1010from lightning .pytorch .core .module import _TORCH_TRT_AVAILABLE
1111from lightning .pytorch .demos .boring_classes import BoringModel
12+ from lightning .pytorch .utilities .exceptions import MisconfigurationException
1213from tests_pytorch .helpers .runif import RunIf
1314
1415
@@ -22,6 +23,15 @@ def test_missing_tensorrt_package():
2223 model .to_tensorrt ("model.trt" )
2324
2425
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+
2535@RunIf (tensorrt = True , min_cuda_gpus = 1 , min_torch = "2.2.0" )
2636def test_tensorrt_saves_with_input_sample (tmp_path ):
2737 model = BoringModel ()
You can’t perform that action at this time.
0 commit comments