diff --git a/Project.toml b/Project.toml index 42e7791..e9a8bda 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ONNXRunTime" uuid = "e034b28e-924e-41b2-b98f-d2bbeb830c6a" authors = ["Jan Weidner and contributors"] -version = "0.4.0" +version = "0.4.1" [deps] ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197" diff --git a/src/highlevel.jl b/src/highlevel.jl index 58b7a9e..3c13bf2 100644 --- a/src/highlevel.jl +++ b/src/highlevel.jl @@ -146,6 +146,7 @@ function (o::InferenceSession)( inputs, output_names=nothing ) + isalive(o) || error("Session has been released and can no longer be called.") if output_names === nothing output_names = @__MODULE__().output_names(o) end @@ -174,7 +175,6 @@ function (o::InferenceSession)( throw(ArgumentError(msg)) end end - isalive(o) || error("Session has been released and can no longer be called.") inp_names, input_tensors = prepare_inputs(o, inputs) run_options = nothing output_tensors = Run(o.api, o.session, run_options, inp_names, input_tensors, output_names) diff --git a/test/test_highlevel.jl b/test/test_highlevel.jl index 330c801..d9565d1 100644 --- a/test/test_highlevel.jl +++ b/test/test_highlevel.jl @@ -158,6 +158,7 @@ using ONNXRunTime: juliatype y = model((;input)) release(model) @test_throws ErrorException y = model((;input)) + @test_throws "Session has been released and can no longer be called." y = model((;input)) end end