[PT FE] Raise graceful exception when model has incorrect type (#18976)

* [PT FE] Raise graceful exception when model has incorrect type

* Improve message
This commit is contained in:
Maxim Vafin authored and GitHub committed 2023-08-04 09:36:09 +02:00
1 parent 80a807e26c
commit da36633c08
2 files changed
+11

No files matched your search

@@ -1106,3 +1106,11 @@ class ConvertRaises(unittest.TestCase):
with self.assertRaisesRegex(Exception, ".*Conversion is failed for: aten::relu.*"):
convert_model(pt_model, input=(inp_shapes, np.float32), extensions=[
ConversionExtension("aten::relu", relu_bad)])
def test_failed_extension(self):
import tempfile
from openvino.tools.mo import convert_model
with self.assertRaisesRegex(Exception, ".*PyTorch Frontend doesn't support provided model type.*"):
with tempfile.NamedTemporaryFile() as tmpfile:
convert_model(tmpfile.name, framework="pytorch")