diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests.NetCoreApp/InferenceTest.netcore.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests.NetCoreApp/InferenceTest.netcore.cs index 816511150a137..eab4a3d412898 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests.NetCoreApp/InferenceTest.netcore.cs +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests.NetCoreApp/InferenceTest.netcore.cs @@ -74,11 +74,9 @@ public void CanCreateAndDisposeSessionWithModelPath() #if NET8_0_OR_GREATER #pragma warning disable SYSLIB5001 // System.Numerics.Tensors is only in preview so we can continue receiving API feedback [Theory] - [InlineData(GraphOptimizationLevel.ORT_DISABLE_ALL, true)] - [InlineData(GraphOptimizationLevel.ORT_DISABLE_ALL, false)] - [InlineData(GraphOptimizationLevel.ORT_ENABLE_EXTENDED, true)] - [InlineData(GraphOptimizationLevel.ORT_ENABLE_EXTENDED, false)] - private void CanRunInferenceOnAModelDotnetTensors(GraphOptimizationLevel graphOptimizationLevel, bool enableParallelExecution) + [InlineData(GraphOptimizationLevel.ORT_DISABLE_ALL)] + [InlineData(GraphOptimizationLevel.ORT_ENABLE_EXTENDED)] + private void CanRunInferenceOnAModelDotnetTensors(GraphOptimizationLevel graphOptimizationLevel) { var model = TestDataLoader.LoadModelFromEmbeddedResource("squeezenet.onnx"); @@ -151,7 +149,7 @@ public void InferenceSessionDisposedDotnetTensors() using (var inputOrtValues = new DisposableListTest>(session.InputMetadata.Count)) using (var outputOrtValues = new DisposableListTest>(session.OutputMetadata.Count)) { - + foreach (var name in inputMeta.Keys) { Assert.Equal(typeof(float), inputMeta[name].ElementType); @@ -159,7 +157,7 @@ public void InferenceSessionDisposedDotnetTensors() var tensor = SystemNumericsTensors.Tensor.Create(inputData, inputMeta[name].Dimensions.Select(x => (nint) x).ToArray()); inputOrtValues.Add(new DisposableTestPair(name, OrtValue.CreateTensorValueFromSystemNumericsTensorObject(tensor))); } - + // Run inference with named inputs and outputs created with in Run() using (var results = session.Run(runOptions, inputOrtValues.Select(x => x.Key).ToList(), inputOrtValues.Select(x => x.Value).ToList(), new List(["softmaxout_1"]))) // results is an IDisposableReadOnlyCollection container { @@ -224,7 +222,7 @@ private void ThrowWrongOutputDimensionDotnetTensors() inputOrtValues.Add(new DisposableTestPair("data_0", OrtValue.CreateTensorValueFromSystemNumericsTensorObject(tensor))); outputOrtValues.Add(new DisposableTestPair("softmaxout_1", OrtValue.CreateTensorValueFromSystemNumericsTensorObject(outputTensor))); - + var ex = Assert.Throws(() => session.Run(runOptions, ["data_0"], [inputOrtValues[0].Value], ["softmaxout_1"], [outputOrtValues[0].Value])); }