mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
C# end to end test fix, and make end to end tests mandatory (#2079)
This commit is contained in:
parent
a314402097
commit
8803f6fff4
2 changed files with 81 additions and 7 deletions
|
|
@ -1058,6 +1058,86 @@ namespace Microsoft.ML.OnnxRuntime.Tests
|
|||
return tensorData.ToArray();
|
||||
}
|
||||
|
||||
|
||||
private enum TensorElementType
|
||||
{
|
||||
Float = 1,
|
||||
UInt8 = 2,
|
||||
Int8 = 3,
|
||||
UInt16 = 4,
|
||||
Int16 = 5,
|
||||
Int32 = 6,
|
||||
Int64 = 7,
|
||||
String = 8,
|
||||
Bool = 9,
|
||||
Float16 = 10,
|
||||
Double = 11,
|
||||
UInt32 = 12,
|
||||
UInt64 = 13,
|
||||
Complex64 = 14,
|
||||
Complex128 = 15,
|
||||
BFloat16 = 16,
|
||||
DataTypeMax = 17
|
||||
}
|
||||
|
||||
private static void GetTypeAndWidth(TensorElementType elemType, out Type type, out int width)
|
||||
{
|
||||
switch (elemType)
|
||||
{
|
||||
case TensorElementType.Float:
|
||||
type = typeof(float);
|
||||
width = sizeof(float);
|
||||
break;
|
||||
case TensorElementType.Double:
|
||||
type = typeof(double);
|
||||
width = sizeof(double);
|
||||
break;
|
||||
case TensorElementType.Int16:
|
||||
type = typeof(short);
|
||||
width = sizeof(short);
|
||||
break;
|
||||
case TensorElementType.UInt16:
|
||||
type = typeof(ushort);
|
||||
width = sizeof(ushort);
|
||||
break;
|
||||
case TensorElementType.Int32:
|
||||
type = typeof(int);
|
||||
width = sizeof(int);
|
||||
break;
|
||||
case TensorElementType.UInt32:
|
||||
type = typeof(uint);
|
||||
width = sizeof(uint);
|
||||
break;
|
||||
case TensorElementType.Int64:
|
||||
type = typeof(long);
|
||||
width = sizeof(long);
|
||||
break;
|
||||
case TensorElementType.UInt64:
|
||||
type = typeof(ulong);
|
||||
width = sizeof(ulong);
|
||||
break;
|
||||
case TensorElementType.UInt8:
|
||||
type = typeof(byte);
|
||||
width = sizeof(byte);
|
||||
break;
|
||||
case TensorElementType.Int8:
|
||||
type = typeof(sbyte);
|
||||
width = sizeof(sbyte);
|
||||
break;
|
||||
case TensorElementType.String:
|
||||
type = typeof(byte);
|
||||
width = sizeof(byte);
|
||||
break;
|
||||
case TensorElementType.Bool:
|
||||
type = typeof(bool);
|
||||
width = sizeof(bool);
|
||||
break;
|
||||
default:
|
||||
type = null;
|
||||
width = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
static NamedOnnxValue LoadTensorFromFilePb(string filename, IReadOnlyDictionary<string, NodeMetadata> nodeMetaDict)
|
||||
{
|
||||
var file = File.OpenRead(filename);
|
||||
|
|
@ -1066,7 +1146,7 @@ namespace Microsoft.ML.OnnxRuntime.Tests
|
|||
|
||||
Type tensorElemType = null;
|
||||
int width = 0;
|
||||
TensorElementTypeConverter.GetTypeAndWidth((TensorElementType)tensor.DataType, out tensorElemType, out width);
|
||||
GetTypeAndWidth((TensorElementType)tensor.DataType, out tensorElemType, out width);
|
||||
var intDims = new int[tensor.Dims.Count];
|
||||
for (int i = 0; i < tensor.Dims.Count; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ jobs:
|
|||
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact netcoreapp2.1 x64 $(NuGetPackageVersionNumber)
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
displayName: 'Run End to End Test (C#) .Net Core'
|
||||
continueOnError: true
|
||||
|
||||
- script: |
|
||||
@echo "Running Runtest.bat"
|
||||
|
|
@ -46,14 +45,12 @@ jobs:
|
|||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
displayName: 'Run End to End Test (C#) .Net Core x86'
|
||||
enabled: false
|
||||
continueOnError: true
|
||||
|
||||
- script: |
|
||||
@echo "Running Runtest.bat"
|
||||
test\Microsoft.ML.OnnxRuntime.EndToEndTests\runtest.bat $(Build.BinariesDirectory)\nuget-artifact net461 x64 $(NuGetPackageVersionNumber)
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
displayName: 'Run End to End Test (C#) .NetFramework'
|
||||
continueOnError: true
|
||||
|
||||
- script: |
|
||||
@echo "Running Runtest.bat"
|
||||
|
|
@ -61,7 +58,6 @@ jobs:
|
|||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
displayName: 'Run End to End Test (C#) .NetFramework x86'
|
||||
enabled: false
|
||||
continueOnError: true
|
||||
|
||||
- script: |
|
||||
@echo "Running runtest.bat"
|
||||
|
|
@ -73,7 +69,6 @@ jobs:
|
|||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
displayName: 'Run End to End Test (C-API) '
|
||||
timeoutInMinutes: 30
|
||||
continueOnError: true
|
||||
|
||||
# test C++ API sample
|
||||
- script: |
|
||||
|
|
@ -89,7 +84,6 @@ jobs:
|
|||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
displayName: 'Run End to End Test (C++ API) '
|
||||
timeoutInMinutes: 30
|
||||
continueOnError: true
|
||||
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
displayName: 'Component Detection'
|
||||
|
|
|
|||
Loading…
Reference in a new issue