diff --git a/csharp/OnnxRuntime.CSharp.proj b/csharp/OnnxRuntime.CSharp.proj
index 01ed2eb326..a5058e9c07 100644
--- a/csharp/OnnxRuntime.CSharp.proj
+++ b/csharp/OnnxRuntime.CSharp.proj
@@ -138,5 +138,5 @@ CMake creates a target to this project
-
+
diff --git a/csharp/src/Microsoft.AI.MachineLearning.Interop/.gitignore b/csharp/src/Microsoft.AI.MachineLearning.Interop/.gitignore
new file mode 100644
index 0000000000..f128932de7
--- /dev/null
+++ b/csharp/src/Microsoft.AI.MachineLearning.Interop/.gitignore
@@ -0,0 +1 @@
+Generated Files
\ No newline at end of file
diff --git a/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.Interop.csproj b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.Interop.csproj
new file mode 100644
index 0000000000..0eae08f67e
--- /dev/null
+++ b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.Interop.csproj
@@ -0,0 +1,48 @@
+
+
+
+ Microsoft.AI.MachineLearning.Interop
+ netstandard2.0
+ true
+
+ Any CPU
+ Debug
+
+ ..\..\..\build\Windows
+ $(OnnxRuntimeBuildDirectory)\$(Configuration)\$(Configuration)
+ $(BuildOutputDir)\Microsoft.AI.MachineLearning.Interop
+ $(WindowsAIInteropOutputDir)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(CsWinRTPath)cswinrt.exe -verbose -in local -in @(WindowsAIsWinMDs->'"%(FullPath)"', ' ') -out "$(ProjectDir)Generated Files" -include Microsoft.AI.MachineLearning
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets
new file mode 100644
index 0000000000..0c38e34e04
--- /dev/null
+++ b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets
@@ -0,0 +1,32 @@
+
+
+
+ x64
+ x86
+ $(PlatformTarget)
+
+
+
+ $(MSBuildThisFileDirectory)..\..\runtimes\win-$(WindowsAI-Platform)\native\Microsoft.AI.MachineLearning.dll
+ $(MSBuildThisFileDirectory)..\..\runtimes\win-$(WindowsAI-Platform)\native\onnxruntime.dll
+ $(MSBuildThisFileDirectory)..\..\runtimes\win-$(WindowsAI-Platform)\native\directml.dll
+
+
+
+ $(WindowsAIBinary);$(OnnxRuntimeBinary);$(DirectMLBinary)
+
+
+ $(WindowsAIBinary);$(OnnxRuntimeBinary);$(DirectMLBinary)
+
+
+ $(WindowsAIBinary);$(OnnxRuntimeBinary)
+
+
+
+
+ Binplacing WindowsAI binaries: {0} and {1}.
+
+
+
+
+
diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.AI.MachineLearning.Rules.Project.xml b/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.Rules.Project.xml
similarity index 100%
rename from csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.AI.MachineLearning.Rules.Project.xml
rename to csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.Rules.Project.xml
diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.AI.MachineLearning.props b/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.props
similarity index 100%
rename from csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.AI.MachineLearning.props
rename to csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.props
diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.AI.MachineLearning.targets b/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.targets
similarity index 100%
rename from csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.AI.MachineLearning.targets
rename to csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.targets
diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs
index 80d87af996..1a5c2e94cb 100644
--- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs
+++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs
@@ -576,6 +576,7 @@ namespace Microsoft.ML.OnnxRuntime.Tests
skipModels["tf_nasnet_large"] = "Get preallocated buffer for initializer ConvBnFusion_BN_B_cell_11/beginning_bn/beta:0_331 failed";
skipModels["test_zfnet512"] = "System out of memory";
skipModels["test_bvlc_reference_caffenet"] = "System out of memory";
+ skipModels["coreml_VGG16_ImageNet"] = "System out of memory";
}
return skipModels;
@@ -1745,9 +1746,13 @@ namespace Microsoft.ML.OnnxRuntime.Tests
}
static NamedOnnxValue LoadTensorFromFilePb(string filename, IReadOnlyDictionary nodeMetaDict)
{
- var file = File.OpenRead(filename);
- var tensor = Onnx.TensorProto.Parser.ParseFrom(file);
- file.Close();
+ //Set buffer size to 4MB
+ int readBufferSize = 4194304;
+ Onnx.TensorProto tensor = null;
+ using (var file = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read, readBufferSize))
+ {
+ tensor = Onnx.TensorProto.Parser.ParseFrom(file);
+ }
Type tensorElemType = null;
int width = 0;
diff --git a/java/src/test/java/ai/onnxruntime/InferenceTest.java b/java/src/test/java/ai/onnxruntime/InferenceTest.java
index bea793cddc..d4b6477d5b 100644
--- a/java/src/test/java/ai/onnxruntime/InferenceTest.java
+++ b/java/src/test/java/ai/onnxruntime/InferenceTest.java
@@ -1425,7 +1425,7 @@ public class InferenceTest {
private static StringTensorPair loadTensorFromFilePb(
OrtEnvironment env, File filename, Map nodeMetaDict)
throws IOException, OrtException {
- InputStream is = new BufferedInputStream(new FileInputStream(filename));
+ InputStream is = new BufferedInputStream(new FileInputStream(filename), 1024 * 1024 * 4);
OnnxMl.TensorProto tensor = OnnxMl.TensorProto.parseFrom(is);
is.close();
diff --git a/onnxruntime/core/graph/model.cc b/onnxruntime/core/graph/model.cc
index ca31a76525..24f45250eb 100644
--- a/onnxruntime/core/graph/model.cc
+++ b/onnxruntime/core/graph/model.cc
@@ -24,7 +24,9 @@
using namespace ONNX_NAMESPACE;
using namespace onnxruntime;
-using namespace ::onnxruntime::common;
+using namespace onnxruntime::common;
+
+static constexpr int protobuf_block_size_in_bytes = 4 * 1024 * 1024;
namespace onnxruntime {
Model::Model(const std::string& graph_name,
@@ -237,7 +239,7 @@ Status Model::Load(std::istream& model_istream, ModelProto* p_model_proto) {
if (!p_model_proto) {
return Status(ONNXRUNTIME, INVALID_ARGUMENT, "Null model_proto ptr.");
}
- google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream, 1 << 20);
+ google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream, protobuf_block_size_in_bytes);
const bool result = p_model_proto->ParseFromZeroCopyStream(&zero_copy_input) && model_istream.eof();
if (!result) {
return Status(ONNXRUNTIME, INVALID_PROTOBUF, "Failed to load model because protobuf parsing failed.");
@@ -447,7 +449,7 @@ Status Model::Load(int fd, ONNX_NAMESPACE::ModelProto& model_proto) {
}
#if GOOGLE_PROTOBUF_VERSION >= 3002000
- FileInputStream input(fd, 1 << 20);
+ FileInputStream input(fd, protobuf_block_size_in_bytes);
const bool result = model_proto.ParseFromZeroCopyStream(&input) && input.GetErrno() == 0;
if (!result) {
return Status(ONNXRUNTIME, INVALID_PROTOBUF, "Protobuf parsing failed.");
diff --git a/onnxruntime/test/onnx/TestCase.cc b/onnxruntime/test/onnx/TestCase.cc
index 81f881f8ef..86958af1ea 100644
--- a/onnxruntime/test/onnx/TestCase.cc
+++ b/onnxruntime/test/onnx/TestCase.cc
@@ -27,7 +27,7 @@ using namespace onnxruntime;
using namespace onnxruntime::common;
using google::protobuf::RepeatedPtrField;
-static constexpr int protobuf_block_size_in_bytes = 1 << 20;
+static constexpr int protobuf_block_size_in_bytes = 4 * 1024 * 1024;
using ORT_VALUE_HOLDER = std::unique_ptr;
diff --git a/onnxruntime/test/onnx/main.cc b/onnxruntime/test/onnx/main.cc
index 21bc2f5513..188ad834b3 100644
--- a/onnxruntime/test/onnx/main.cc
+++ b/onnxruntime/test/onnx/main.cc
@@ -451,7 +451,7 @@ int real_main(int argc, char* argv[], Ort::Env& env) {
}
#if !defined(__amd64__) && !defined(_M_AMD64)
//out of memory
- static const ORTCHAR_T* x86_disabled_tests[] = {ORT_TSTR("mlperf_ssd_resnet34_1200"), ORT_TSTR("mask_rcnn_keras"), ORT_TSTR("mask_rcnn"), ORT_TSTR("faster_rcnn"), ORT_TSTR("vgg19")};
+ static const ORTCHAR_T* x86_disabled_tests[] = {ORT_TSTR("mlperf_ssd_resnet34_1200"), ORT_TSTR("mask_rcnn_keras"), ORT_TSTR("mask_rcnn"), ORT_TSTR("faster_rcnn"), ORT_TSTR("vgg19"), ORT_TSTR("coreml_VGG16_ImageNet")};
all_disabled_tests.insert(std::begin(x86_disabled_tests), std::end(x86_disabled_tests));
#endif
diff --git a/onnxruntime/test/perftest/TFModelInfo.cc b/onnxruntime/test/perftest/TFModelInfo.cc
index faf7bccccb..8b161faf90 100644
--- a/onnxruntime/test/perftest/TFModelInfo.cc
+++ b/onnxruntime/test/perftest/TFModelInfo.cc
@@ -8,8 +8,10 @@
#include
std::unique_ptr TFModelInfo::Create(_In_ const PATH_CHAR_TYPE* model_url) {
- auto ret = std::unique_ptr(new TFModelInfo{});
- ret->model_url_ = model_url;
+ auto* model_info = new TFModelInfo{};
+ std::unique_ptr ret(model_info);
+
+ model_info->model_url_ = model_url;
std::basic_string meta_file_path = model_url;
meta_file_path.append(ORT_TSTR(".meta"));
const onnxruntime::Env& env = onnxruntime::Env::Default();
@@ -40,15 +42,15 @@ std::unique_ptr TFModelInfo::Create(_In_ const PATH_CHAR_TYPE* mo
}
if (line.empty()) continue;
if (line.compare(0, 6, "input=") == 0) {
- ret->input_names_.push_back(line.substr(6));
+ model_info->input_names_.push_back(line.substr(6));
} else if (line.compare(0, 7, "output=") == 0) {
- ret->output_names_.push_back(line.substr(7));
+ model_info->output_names_.push_back(line.substr(7));
} else {
ORT_THROW("unknown line:", line.size());
}
}
- return std::move(ret);
+ return ret;
}
int TFModelInfo::GetInputCount() const { return static_cast(input_names_.size()); }
diff --git a/samples/README.md b/samples/README.md
index 9850b15be7..a2e6a4ac3e 100644
--- a/samples/README.md
+++ b/samples/README.md
@@ -43,7 +43,7 @@ For a list of available dockerfiles and published images to help with getting st
* [ONNX Runtime with Azure ML](https://github.com/Azure-Samples/onnxruntime-iot-edge/blob/master/AzureML-OpenVINO/README.md)
**Other**
-* [Running ONNX model tests](./docs/Model_Test.md)
+* [Running ONNX model tests](../docs/Model_Test.md)
* [Common Errors with explanations](https://microsoft.github.io/onnxruntime/python/auto_examples/plot_common_errors.html#sphx-glr-auto-examples-plot-common-errors-py)
## C#
diff --git a/tools/ci_build/github/azure-pipelines/linux-ort-srv-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/linux-ort-srv-ci-pipeline.yml
index ad00847a50..cf48a75453 100644
--- a/tools/ci_build/github/azure-pipelines/linux-ort-srv-ci-pipeline.yml
+++ b/tools/ci_build/github/azure-pipelines/linux-ort-srv-ci-pipeline.yml
@@ -20,22 +20,6 @@ jobs:
script: sudo docker build --pull -t onnxruntime-server-ubuntu16.04 --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg OS_VERSION=16.04 --build-arg PYTHON_VERSION=3.5 -f Dockerfile.ubuntu_server .
workingDirectory: $(Build.SourcesDirectory)/tools/ci_build/github/linux/docker
- - task: CmdLine@2
- displayName: 'Download azcopy'
- inputs:
- script: |
- curl -so azcopy.tar.gz -L 'https://aka.ms/downloadazcopy-v10-linux'
- tar -zxvf azcopy.tar.gz --strip 1
- workingDirectory: $(Build.BinariesDirectory)
-
- - task: PythonScript@0
- displayName: 'Download test data'
- inputs:
- scriptPath: '$(Build.SourcesDirectory)/tools/ci_build/github/download_test_data.py'
- arguments: --test_data_url $(TestDataUrl) --build_dir $(Build.BinariesDirectory)
- pythonInterpreter: '/usr/bin/python3'
- workingDirectory: $(Build.BinariesDirectory)
-
- task: CmdLine@2
displayName: 'Run docker image'
inputs:
diff --git a/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml b/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml
index c96efd52c5..6a1d041f58 100644
--- a/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml
+++ b/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml
@@ -135,6 +135,10 @@ steps:
arguments: 'x64'
modifyEnvironment: true
+ - script: msbuild Microsoft.AI.MachineLearning.Interop.csproj /p:Configuration=RelWithDebInfo /p:Platform="Any CPU" /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) -restore
+ workingDirectory: '$(Build.SourcesDirectory)\csharp\src\Microsoft.AI.MachineLearning.Interop'
+ displayName: 'Build Microsoft.AI.MachineLearning.Interop.dll'
+
# Esrp signing
- template: win-esrp-dll.yml
parameters:
diff --git a/tools/nuget/generate_nuspec_for_native_nuget.py b/tools/nuget/generate_nuspec_for_native_nuget.py
index dc52591343..7164db22d6 100644
--- a/tools/nuget/generate_nuspec_for_native_nuget.py
+++ b/tools/nuget/generate_nuspec_for_native_nuget.py
@@ -71,7 +71,24 @@ def generate_repo_url(list, repo_url, commit_id):
def generate_dependencies(list, package_name, version):
- if (package_name != 'Microsoft.AI.MachineLearning'):
+ if (package_name == 'Microsoft.AI.MachineLearning'):
+ list.append('')
+
+ # Support .Net Core
+ list.append('')
+ list.append('')
+ list.append('')
+ # Support .Net Standard
+ list.append('')
+ list.append('')
+ list.append('')
+ # Support .Net Framework
+ list.append('')
+ list.append('')
+ list.append('')
+
+ list.append('')
+ else:
list.append('')
# Support .Net Core
list.append('')
@@ -167,7 +184,6 @@ def generate_files(list, args):
'" target="build\\native\\include" />')
if includes_winml:
- mlop_path = 'onnxruntime\\core\\providers\\dml\\dmlexecutionprovider\\inc\\mloperatorauthor.h'
# Add microsoft.ai.machinelearning headers
files_list.append('')
+ # Add custom operator headers
+ mlop_path = 'onnxruntime\\core\\providers\\dml\\dmlexecutionprovider\\inc\\mloperatorauthor.h'
+ files_list.append('')
# Process microsoft.ai.machinelearning.winmd
files_list.append('')
- # Add custom operator headers
- files_list.append('')
+ interop_dll = 'Microsoft.AI.MachineLearning.Interop\\netstandard2.0\\Microsoft.AI.MachineLearning.Interop.dll'
+ files_list.append('')
+ interop_pdb = 'Microsoft.AI.MachineLearning.Interop\\netstandard2.0\\Microsoft.AI.MachineLearning.Interop.pdb'
+ files_list.append('')
# Process runtimes
# Process onnxruntime import lib, dll, and pdb
@@ -254,18 +276,24 @@ def generate_files(list, args):
# Process props and targets files
if is_windowsai_package:
- # Process props file
- windowsai_props = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime',
- 'Microsoft.AI.MachineLearning.props')
- files_list.append('')
- # Process targets files
- windowsai_targets = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime',
- 'Microsoft.AI.MachineLearning.targets')
- files_list.append('')
- # Process rules files
- windowsai_rules = os.path.join(args.sources_path, 'csharp', 'src', 'Microsoft.ML.OnnxRuntime',
- 'Microsoft.AI.MachineLearning.Rules.Project.xml')
- files_list.append('')
+ windowsai_src = 'Microsoft.AI.MachineLearning'
+ # Process native props
+ windowsai_props = 'Microsoft.AI.MachineLearning.props'
+ windowsai_native_props = os.path.join(args.sources_path, 'csharp', 'src', windowsai_src, windowsai_props)
+ files_list.append('')
+ # Process native targets
+ windowsai_targets = 'Microsoft.AI.MachineLearning.targets'
+ windowsai_native_targets = os.path.join(args.sources_path, 'csharp', 'src', windowsai_src, windowsai_targets)
+ files_list.append('')
+ # Process native rules
+ windowsai_rules = 'Microsoft.AI.MachineLearning.Rules.Project.xml'
+ windowsai_native_rules = os.path.join(args.sources_path, 'csharp', 'src', windowsai_src, windowsai_rules)
+ files_list.append('')
+ # Process .net standard 2.0 targets
+ interop_src = 'Microsoft.AI.MachineLearning.Interop'
+ interop_targets = 'Microsoft.AI.MachineLearning.targets'
+ windowsai_net20_targets = os.path.join(args.sources_path, 'csharp', 'src', interop_src, interop_targets)
+ files_list.append('')
if is_cpu_package or is_cuda_gpu_package or is_dml_package or is_mklml_package:
# Process props file