Skip to content

Commit

Permalink
Replace 'master' branch ref to 'main' in the code (microsoft#12547)
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-eire authored Aug 22, 2022
1 parent d93e653 commit c144acc
Show file tree
Hide file tree
Showing 44 changed files with 131 additions and 132 deletions.
4 changes: 2 additions & 2 deletions csharp/src/Microsoft.ML.OnnxRuntime/ProviderOptions.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public static void StringToDict(string s, Dictionary<string, string> dict)
/// <summary>
/// CoreML flags for use with SessionOptions
/// </summary>
/// <see cref="https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/providers/coreml/coreml_provider_factory.h"/>
/// <see cref="https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/providers/coreml/coreml_provider_factory.h"/>
[Flags]
public enum CoreMLFlags : uint
{
Expand All @@ -261,7 +261,7 @@ public enum CoreMLFlags : uint
/// <summary>
/// NNAPI flags for use with SessionOptions
/// </summary>
/// <see cref="https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h"/>
/// <see cref="https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h"/>
[Flags]
public enum NnapiFlags
{
Expand Down
8 changes: 4 additions & 4 deletions csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Microsoft.ML.OnnxRuntime
{
/// <summary>
/// Graph optimization level to use with SessionOptions
/// [https://github.com/microsoft/onnxruntime/blob/master/docs/ONNX_Runtime_Graph_Optimizations.md]
/// [https://github.com/microsoft/onnxruntime/blob/main/docs/ONNX_Runtime_Graph_Optimizations.md]
/// </summary>
public enum GraphOptimizationLevel
{
Expand Down Expand Up @@ -408,13 +408,13 @@ public void AppendExecutionProvider(string providerName, Dictionary<string, stri
{
providerOptions = new Dictionary<string, string>();
}

var keysArray = NativeOnnxValueHelper.ConvertNamesToUtf8(
providerOptions.Keys.ToArray(), n => n, cleanupList);

var valuesArray = NativeOnnxValueHelper.ConvertNamesToUtf8(
providerOptions.Values.ToArray(), n => n, cleanupList);

NativeApiStatus.VerifySuccess(NativeMethods.SessionOptionsAppendExecutionProvider(
handle, epArray[0], keysArray, valuesArray, (UIntPtr)providerOptions.Count));
}
Expand All @@ -426,7 +426,7 @@ public void AppendExecutionProvider(string providerName, Dictionary<string, stri
/// (Deprecated) Loads a DLL named 'libraryPath' and looks for this entry point:
/// OrtStatus* RegisterCustomOps(OrtSessionOptions* options, const OrtApiBase* api);
/// It then passes in the provided session options to this function along with the api base.
/// Deprecated in favor of RegisterCustomOpLibraryV2() because it provides users with the library handle
/// Deprecated in favor of RegisterCustomOpLibraryV2() because it provides users with the library handle
/// to release when all sessions relying on it are destroyed
/// </summary>
/// <param name="libraryPath">path to the custom op library</param>
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ If the `device_type` runtime config option is not explicitly specified, CPU will
Example:
HETERO:MYRIAD,CPU HETERO:HDDL,GPU,CPU MULTI:MYRIAD,GPU,CPU AUTO:GPU,CPU
*This is the hardware accelerator target that is enabled by **default** in the container image. After building the container image for one default target, the application may explicitly choose a different target at run time with the same container by using the [Dynamic device selction API](https://github.com/microsoft/onnxruntime/blob/master/docs/execution_providers/OpenVINO-ExecutionProvider.md#dynamic-device-selection).*
*This is the hardware accelerator target that is enabled by **default** in the container image. After building the container image for one default target, the application may explicitly choose a different target at run time with the same container by using the [Dynamic device selction API](https://github.com/microsoft/onnxruntime/blob/main/docs/execution_providers/OpenVINO-ExecutionProvider.md#dynamic-device-selection).*
### OpenVINO on CPU
Expand Down
8 changes: 4 additions & 4 deletions docs/C_API_Guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ If an API such as CreateSession creates an Ort object such as Session, Session c

No C++ exceptions must propagate through the C++/C boundaries. All C++ exceptions must be converted to OrtStatus instances at API boundaries. Such functions should return nullptr on success.

Macros API_IMPL_BEGIN and API_IMPL_END are helpful in this regard.
Macros API_IMPL_BEGIN and API_IMPL_END are helpful in this regard.

Cleanup API that destroys objects or simply deallocates memory must return void. Most of the time such API can never error out. Adding return status creates more uncertainty for the client and does not help in exception scenarios such as try/finally in C#. Returning void helps clients to write cleaner code and preserve original exception if any with its meaningful error message rather than memory deallocation failure.

This requirement will also help us to create C++ API wrappers that are exception safe.

Consider logging errors if you must rather than return them to the client.
Consider logging errors if you must rather than return them to the client.

Example: on Windows delete operator is implemented on top of HeapFree() which may return an error. However, delete never returns anything and can be relied upon as a no throw primitive for cleanup purposes.

Expand All @@ -52,7 +52,7 @@ When API errors out it must leave all its out parameters and buffers untouched,

The obvious exception in this rule is the actual OrtStatus that is dynamically allocated and must be released by the client using the corresponding API.

Some of the client code, notably in C#, attempts to detect which out arguments need a cleanup when an API errors out. The way it is done, out arguments are pre-set to a specific value, such as zero. If the API errors out, the client code attempts to cleanup if the out argument has changed.
Some of the client code, notably in C#, attempts to detect which out arguments need a cleanup when an API errors out. The way it is done, out arguments are pre-set to a specific value, such as zero. If the API errors out, the client code attempts to cleanup if the out argument has changed.

Such a technique is error prone and dangerous, as the client has no way of finding out if the out argument has already been cleaned up by the API as should be the case. It may result in double free. One reason for this is our insufficient documentation. This also results in a convoluted hard to read code with nested try/finally/catch clauses.

Expand Down Expand Up @@ -80,4 +80,4 @@ Use types that fall into established patterns. For example, we use int64_t for d

### 9. Adding a new API

Follow these guidelines and instructions in the source code. "Rules on how to add a new Ort API version" in [onnxruntime_c_api.cc](https://github.com/microsoft/onnxruntime/blob/master/onnxruntime/core/session/onnxruntime_c_api.cc).
Follow these guidelines and instructions in the source code. "Rules on how to add a new Ort API version" in [onnxruntime_c_api.cc](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/session/onnxruntime_c_api.cc).
4 changes: 2 additions & 2 deletions docs/Coding_Conventions_and_Standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void foo(gsl::span<const std::string> names) {
* Qualify usages of `auto` with `const`, `*`, `&` and `&&` where applicable to more clearly express the intent
* When adding a new class, disable copy/assignment/move until you have a proven need for these capabilities. If a need arises, enable copy/assignment/move selectively, and when doing so validate that the implementation of the class supports what is being enabled.
* Use `ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE` initially
* See the other `ORT_DISALLOW_*` macros in <https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/common/common.h>
* See the other `ORT_DISALLOW_*` macros in <https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/common/common.h>
* Sometimes, `std::unique_ptr` might be considered for delayed or optional construction of objects or members of classes. Instead, use `std::optional` as appropriate to reduce the number of allocations.
* Don't use `else` after `return`. see: [https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return](https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return)
* Don't overuse `std::shared_ptr`. Use `std::shared_ptr` only if it's not clear when and where the object will be de-allocated. See also: [https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-shared_ptr](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-shared_ptr)
Expand Down Expand Up @@ -141,7 +141,7 @@ Follow the [Black formatter](https://black.readthedocs.io)'s coding style when p

Please adhere to the [PEP8 Style Guide](https://www.python.org/dev/peps/pep-0008/). We use [Google's python style guide](https://google.github.io/styleguide/pyguide.html) as the style guide which is an extension to PEP8.

Code can be validated with [flake8](https://pypi.org/project/flake8/) using the configuration file in the root directory called [.flake8](https://github.com/microsoft/onnxruntime/tree/master/.flake8).
Code can be validated with [flake8](https://pypi.org/project/flake8/) using the configuration file in the root directory called [.flake8](https://github.com/microsoft/onnxruntime/blob/main/.flake8).

Use `pyright`, which is provided as a component of the `pylance` extension in VS Code for static type checking.

Expand Down
2 changes: 1 addition & 1 deletion docs/ContribOperators.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Contrib Operator Schemas
*This file is automatically generated from the registered contrib operator schemas by [this script](https://github.com/microsoft/onnxruntime/blob/master/tools/python/gen_contrib_doc.py).
*This file is automatically generated from the registered contrib operator schemas by [this script](https://github.com/microsoft/onnxruntime/blob/main/tools/python/gen_contrib_doc.py).
Do not modify directly.*

* com.microsoft
Expand Down
4 changes: 2 additions & 2 deletions docs/NotesOnThreading.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
This document is intended for ORT developers.

ORT allows the usage of either OpenMP or non-OpenMP (ORT) threads for execution. Threadpool management
is abstracted behind: (1) ThreadPool class in [threadpool.h](https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/platform/threadpool.h) and (2) functions in [thread_utils.h](https://github.com/microsoft/onnxruntime/blob/master/onnxruntime/core/util/thread_utils.h).
is abstracted behind: (1) ThreadPool class in [threadpool.h](https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/platform/threadpool.h) and (2) functions in [thread_utils.h](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/util/thread_utils.h).

When developing an op, please use these abstractions to parallelize your code. These abstractions centralize 2 things.
When OpenMP is enabled, they resort to using OpenMP. When OpenMP is disabled they resort to sequential execution if the threadpool ptr is NULL or schedule the tasks on the threadpool otherwise.

Examples of these abstractions are: ([threadpool.h](https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/platform/threadpool.h) has more documentation for these)
Examples of these abstractions are: ([threadpool.h](https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/platform/threadpool.h) has more documentation for these)
* TryParallelFor
* TrySimpleParallelFor
* TryBatchParallelFor
Expand Down
2 changes: 1 addition & 1 deletion docs/ORTMobilePackageOperatorTypeSupport.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Supported operators and types

The supported operators and types are based on what is required to support float32 and quantized versions of popular models. The full list of input models used to determine this list is available [here](https://github.com/microsoft/onnxruntime/blob/master/tools/ci_build/github/android/mobile_package.required_operators.readme.txt)
The supported operators and types are based on what is required to support float32 and quantized versions of popular models. The full list of input models used to determine this list is available [here](https://github.com/microsoft/onnxruntime/blob/main/tools/ci_build/github/android/mobile_package.required_operators.readme.txt)

## Supported data input types

Expand Down
2 changes: 1 addition & 1 deletion docs/OperatorKernels.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Supported Operators and Data Types
*This file is automatically generated from the registered kernels by [this script](https://github.com/microsoft/onnxruntime/blob/master/tools/python/gen_opkernel_doc.py).
*This file is automatically generated from the registered kernels by [this script](https://github.com/microsoft/onnxruntime/blob/main/tools/python/gen_opkernel_doc.py).
Do not modify directly.*

## Execution Providers
Expand Down
Loading

0 comments on commit c144acc

Please sign in to comment.