[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
2023-08-04 09:36:09 +02:00
committed by GitHub
parent 80a807e26c
commit da36633c08
2 changed files with 11 additions and 0 deletions
@@ -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")