Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions csharp/src/Microsoft.ML.OnnxRuntime/InferenceSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public InferenceSession(string modelPath, SessionOptions options)
{
if (_nativeHandle != IntPtr.Zero)
{
NativeMethods.ReleaseONNXSession(_nativeHandle);
NativeMethods.OrtReleaseSession(_nativeHandle);
_nativeHandle = IntPtr.Zero;
}
throw e;
Expand Down Expand Up @@ -178,7 +178,7 @@ internal IReadOnlyCollection<NamedOnnxValue> Run(IReadOnlyCollection<NamedOnnxVa
{
if (outputValueArray[i] != IntPtr.Zero)
{
NativeMethods.ReleaseONNXValue(outputValueArray[i]);
NativeMethods.OrtReleaseValue(outputValueArray[i]);
}
}
throw e;
Expand All @@ -188,7 +188,7 @@ internal IReadOnlyCollection<NamedOnnxValue> Run(IReadOnlyCollection<NamedOnnxVa
// always unpin the input buffers, and delete the native Onnx value objects
for (int i = 0; i < inputs.Count; i++)
{
NativeMethods.ReleaseONNXValue(inputTensors[i]); // this should not release the buffer, but should delete the native tensor object
NativeMethods.OrtReleaseValue(inputTensors[i]); // this should not release the buffer, but should delete the native tensor object
pinnedBufferHandles[i].Dispose();
}
}
Expand Down Expand Up @@ -340,7 +340,7 @@ protected virtual void Dispose(bool disposing)
// cleanup unmanaged resources
if (_nativeHandle != IntPtr.Zero)
{
NativeMethods.ReleaseONNXSession(_nativeHandle);
NativeMethods.OrtReleaseSession(_nativeHandle);
}
}

Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Microsoft.ML.OnnxRuntime/NamedOnnxValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ out nativeElementType
longShape[i] = (ulong)shape[i];
}

IntPtr status = NativeMethods.OrtCreateTensorWithDataAsONNXValue(
IntPtr status = NativeMethods.OrtCreateTensorWithDataAsOrtValue(
NativeMemoryAllocatorInfo.DefaultInstance.Handle,
dataBufferPointer,
(ulong)(dataBufferLength),
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Microsoft.ML.OnnxRuntime/NativeApiStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void VerifySuccess(IntPtr nativeStatus)
{
ErrorCode statusCode = NativeMethods.OrtGetErrorCode(nativeStatus);
string errorMessage = GetErrorMessage(nativeStatus);
NativeMethods.ReleaseONNXStatus(nativeStatus);
NativeMethods.OrtReleaseStatus(nativeStatus);
throw new OnnxRuntimeException(statusCode, errorMessage);
}
}
Expand Down
84 changes: 42 additions & 42 deletions csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected override void Dispose(bool disposing)
// do managed objects cleanup
}

NativeMethods.ReleaseONNXValue(_onnxValueHandle);
NativeMethods.OrtReleaseValue(_onnxValueHandle);

_disposed = true;
}
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Microsoft.ML.OnnxRuntime/OnnxRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override bool IsInvalid

private static void Delete(IntPtr nativePtr)
{
NativeMethods.ReleaseONNXEnv(nativePtr);
NativeMethods.OrtReleaseEnv(nativePtr);
}

protected override bool ReleaseHandle()
Expand Down
6 changes: 3 additions & 3 deletions include/onnxruntime/core/framework/onnx_object_cxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ namespace onnxruntime {
template <typename T>
class ObjectBase {
private:
static ONNXObject static_cls;
static OrtObject static_cls;

protected:
const ONNXObject* const ORT_ATTRIBUTE_UNUSED cls_;
const OrtObject* const ORT_ATTRIBUTE_UNUSED cls_;
std::atomic_int ref_count;
ObjectBase() : cls_(&static_cls), ref_count(1) {
}
Expand All @@ -39,7 +39,7 @@ class ObjectBase {
};

template <typename T>
ONNXObject ObjectBase<T>::static_cls = {ObjectBase<T>::OrtAddRefImpl, ObjectBase<T>::OrtReleaseImpl};
OrtObject ObjectBase<T>::static_cls = {ObjectBase<T>::OrtAddRefImpl, ObjectBase<T>::OrtReleaseImpl};

} // namespace onnxruntime

Expand Down
Loading