File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -757,7 +757,9 @@ struct PyModule final {
757
757
} else if (py::isinstance<py::int_>(python_input)) {
758
758
cpp_inputs.push_back (EValue (py::cast<int64_t >(python_input)));
759
759
} else {
760
- ET_ASSERT_UNREACHABLE_MSG (" Unsupported pytype: %s" , type_str.c_str ());
760
+ throw std::runtime_error (
761
+ " Unsupported python type " + type_str +
762
+ " . Ensure that inputs are passed as a flat list of tensors." );
761
763
}
762
764
}
763
765
Original file line number Diff line number Diff line change @@ -464,6 +464,16 @@ def test_verification_config(tester) -> None:
464
464
465
465
tester .assertEqual (str (expected ), str (executorch_output ))
466
466
467
+ def test_unsupported_input_type (tester ):
468
+ exported_program , inputs = create_program (ModuleAdd ())
469
+ executorch_module = load_fn (exported_program .buffer )
470
+
471
+ # Pass an unsupported input type to the module.
472
+ inputs = ([* inputs ],)
473
+
474
+ # This should raise a Python error, not hit a fatal assert in the C++ code.
475
+ tester .assertRaises (RuntimeError , executorch_module , inputs )
476
+
467
477
######### RUN TEST CASES #########
468
478
test_e2e (tester )
469
479
test_multiple_entry (tester )
@@ -479,5 +489,6 @@ def test_verification_config(tester) -> None:
479
489
test_method_meta (tester )
480
490
test_bad_name (tester )
481
491
test_verification_config (tester )
492
+ test_unsupported_input_type (tester )
482
493
483
494
return wrapper
You can’t perform that action at this time.
0 commit comments