Skip to content

Commit 67546dc

Browse files
committed
add unittests.
1 parent 15f1961 commit 67546dc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/tests_pytorch/models/test_torch_tensorrt.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313
from tests_pytorch.helpers.runif import RunIf
1414

1515

16+
@RunIf(max_torch="2.2.0")
17+
def test_torch_minimum_version():
18+
model = BoringModel()
19+
with pytest.raises(
20+
MisconfigurationException,
21+
match=re.escape(f"TensorRT export requires PyTorch 2.2 or higher. Current version is {torch.__version__}."),
22+
):
23+
model.to_tensorrt("model.trt")
24+
25+
1626
@pytest.mark.skipif(_TORCH_TRT_AVAILABLE, reason="Run this test only if tensorrt is not available.")
1727
def test_missing_tensorrt_package():
1828
model = BoringModel()

0 commit comments

Comments
 (0)