mirror of
https://github.com/yalue/onnxruntime_go.git
synced 2025-10-29 09:52:33 +08:00
Enable multiple inputs and outputs
- Modified the Session API so that the user must provide all input and output tensors when creating the session (Run() no longer takes any arguments). This should avoid allocations and fix the incorrect way I was using input and output names before. - Updated the test to use the new API. - Removed the onnx_example_application; it was only doing the same thing as the unit test anyway.
This commit is contained in:
@@ -160,13 +160,15 @@ func TestExampleNetwork(t *testing.T) {
|
||||
defer outputTensor.Destroy()
|
||||
|
||||
// Set up and run the session.
|
||||
session, e := NewSimpleSession[float32]("test_data/example_network.onnx")
|
||||
session, e := NewSession[float32]("test_data/example_network.onnx",
|
||||
[]string{"1x4 Input Vector"}, []string{"1x2 Output Vector"},
|
||||
[]*Tensor[float32]{inputTensor}, []*Tensor[float32]{outputTensor})
|
||||
if e != nil {
|
||||
t.Logf("Failed creating simple session: %s\n", e)
|
||||
t.Logf("Failed creating session: %s\n", e)
|
||||
t.FailNow()
|
||||
}
|
||||
defer session.Destroy()
|
||||
e = session.SimpleRun(inputTensor, outputTensor)
|
||||
e = session.Run()
|
||||
if e != nil {
|
||||
t.Logf("Failed to run the session: %s\n", e)
|
||||
t.FailNow()
|
||||
|
||||
Reference in New Issue
Block a user