def test_torchscript_with_no_input():
    """Test that an error is thrown when there is no input tensor."""
    model = BoringModel()
    model.example_input_array = None

    with pytest.raises(ValueError, match="requires either `example_inputs` or `model.example_input_array`"):
        model.to_torchscript(method="trace")
Test that an error is thrown when there is no input tensor.
tests/tests_pytorch/models/test_torchscript.py