Skip to content

Commit

Permalink
* Exposes some methods of input and output name.
Browse files Browse the repository at this point in the history
* Adds some documentation comments.
  • Loading branch information
gtbluesky committed Nov 1, 2023
1 parent a7ac6ab commit e7fa984
Show file tree
Hide file tree
Showing 12 changed files with 363 additions and 398 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.1.0

* Exposes some methods of input and output name.
* Adds some documentation comments.

## 1.0.0

* initial release.
* Initial release.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Flutter plugin for OnnxRuntime with `FFI` provides an easy, flexible, and fast D
* Flexibility to use any Onnx Model.
* Acceleration using multi-threading.
* Similar structure as OnnxRuntime Java and C# API.
* Inference speeds close to native Android/iOS Apps built using the Java/Objective-C API.
* Inference speed is not slower than native Android/iOS Apps built using the Java/Objective-C API.
* Run inference in different isolates to prevent jank in UI thread.

## Getting Started
Expand All @@ -24,12 +24,9 @@ In your flutter project add the dependency:
```yml
dependencies:
...
onnxruntime:
onnxruntime: x.y.z
```
For help getting started with Flutter, view the online
[documentation](https://flutter.io/).
## Usage example
### Import
Expand Down Expand Up @@ -64,6 +61,9 @@ final runOptions = OrtRunOptions();
final outputs = await _session?.runAsync(runOptions, inputs);
inputOrt.release();
runOptions.release();
outputs?.forEach((element) {
element?.release();
});
```

### Releasing environment
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Onnxruntime</string>
<string>OnnxRuntime</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.2"
version: "1.1.0"
path:
dependency: transitive
description:
Expand Down
42 changes: 23 additions & 19 deletions lib/src/bindings/onnxruntime_bindings_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,9 @@ class OrtCustomOp extends ffi.Struct {
ffi.Pointer<OrtKernelContext> context)>> KernelCompute;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void> op_kernel)>> KernelDestroy;
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void> op_kernel)>>
KernelDestroy;

/// Returns the characteristics of the input & output tensors
external ffi.Pointer<
Expand Down Expand Up @@ -1099,17 +1100,17 @@ class OrtApi extends ffi.Struct {
ffi.Size dim_count,
ffi.Pointer<ffi.Pointer<OrtValue>> out)>> KernelContext_GetOutput;

external ffi.Pointer<
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<OrtEnv> input)>>
external ffi
.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<OrtEnv> input)>>
ReleaseEnv;

external ffi.Pointer<
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<OrtStatus> input)>>
ReleaseStatus;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<OrtMemoryInfo> input)>>
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<OrtMemoryInfo> input)>>
ReleaseMemoryInfo;

external ffi.Pointer<
Expand All @@ -1121,8 +1122,8 @@ class OrtApi extends ffi.Struct {
ReleaseValue;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<OrtRunOptions> input)>>
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<OrtRunOptions> input)>>
ReleaseRunOptions;

external ffi.Pointer<
Expand Down Expand Up @@ -1182,8 +1183,8 @@ class OrtApi extends ffi.Struct {
GetSequenceElementType;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<OrtMapTypeInfo> input)>>
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<OrtMapTypeInfo> input)>>
ReleaseMapTypeInfo;

external ffi.Pointer<
Expand Down Expand Up @@ -1339,8 +1340,9 @@ class OrtApi extends ffi.Struct {
ffi.Pointer<ffi.Pointer<OrtAllocator>> out)>> CreateAllocator;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<OrtAllocator> input)>> ReleaseAllocator;
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<OrtAllocator> input)>>
ReleaseAllocator;

external ffi.Pointer<
ffi.NativeFunction<
Expand All @@ -1355,8 +1357,9 @@ class OrtApi extends ffi.Struct {
ffi.Pointer<ffi.Pointer<OrtIoBinding>> out)>> CreateIoBinding;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<OrtIoBinding> input)>> ReleaseIoBinding;
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<OrtIoBinding> input)>>
ReleaseIoBinding;

external ffi.Pointer<
ffi.NativeFunction<
Expand Down Expand Up @@ -1519,7 +1522,7 @@ class OrtApi extends ffi.Struct {
SessionOptionsAppendExecutionProvider_TensorRT;

external ffi
.Pointer<ffi.NativeFunction<OrtStatusPtr Function(ffi.Int device_id)>>
.Pointer<ffi.NativeFunction<OrtStatusPtr Function(ffi.Int device_id)>>
SetCurrentGpuDeviceId;

external ffi.Pointer<
Expand Down Expand Up @@ -1931,8 +1934,8 @@ class OrtApi extends ffi.Struct {
ffi.Pointer<ffi.Pointer<OrtValue>> output_values,
ffi.Int output_count)>> InvokeOp;

external ffi.Pointer<
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<OrtOp> input)>>
external ffi
.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<OrtOp> input)>>
ReleaseOp;

external ffi.Pointer<
Expand All @@ -1951,8 +1954,8 @@ class OrtApi extends ffi.Struct {
CopyKernelInfo;

external ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<OrtKernelInfo> input)>>
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<OrtKernelInfo> input)>>
ReleaseKernelInfo;

/// \name Ort Training
Expand Down Expand Up @@ -2524,6 +2527,7 @@ typedef OrtCustomThreadHandle = ffi.Pointer<OrtCustomHandleType>;

class OrtCustomHandleType extends ffi.Struct {
@ffi.Char()
// ignore: unused_field
external int __place_holder;
}

Expand Down
Loading

0 comments on commit e7fa984

Please sign in to comment.