Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Commit

Permalink
comsume official nodejs binding
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-eire committed Aug 11, 2020
1 parent 04561eb commit 93b46ad
Show file tree
Hide file tree
Showing 33 changed files with 931 additions and 7,560 deletions.
4 changes: 0 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
Language: JavaScript
BasedOnStyle: Google
ColumnLimit: 120
---
Language: Cpp
BasedOnStyle: LLVM
ColumnLimit: 120
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
/node_modules/
/build/
/bin/
/types/

/lib/*.js
/lib/*.js.map
/scripts/*.js
/scripts/*.js.map
/test/*.js
/test/*.js.map

/.vscode/ipch/
7 changes: 1 addition & 6 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/.vscode/
/bin/
/build/
/deps/
/onnxruntime/
/scripts/
/src/
/test/

Expand All @@ -15,5 +11,4 @@

/.clang-format
/.gitmodules
/CMakeLists.txt
/tsconfig.json
/tsconfig.json
22 changes: 0 additions & 22 deletions .vscode/c_cpp_properties.json

This file was deleted.

20 changes: 2 additions & 18 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests (Windows, C++)",
"type": "cppvsdbg",
"request": "launch",
"program": "node.exe",
"args": [
"${workspaceFolder}/node_modules/mocha/bin/_mocha",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/test/test-main"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true
},
{
"type": "node",
"request": "launch",
Expand All @@ -33,7 +16,8 @@
"${workspaceFolder}/test/test-main"
],
"internalConsoleOptions": "openOnSessionStart",
"sourceMaps": true
"sourceMaps": true,
"smartStep": true
}
]
}
55 changes: 0 additions & 55 deletions .vscode/settings.json

This file was deleted.

48 changes: 0 additions & 48 deletions CMakeLists.txt

This file was deleted.

14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ npm install onnxjs-node
## Supported Platforms
OS |Arch |CPU/GPU |NAPI version |Node.js version | ONNXRuntime version
---------|-----|--------|-------------|----------------|---------------------
Windows | x64 | CPU | v3 | v8.11.2+ | v0.4.0
Linux | x64 | CPU | v3 | v8.11.2+ | v0.4.0
macOS | x64 | CPU | v3 | v8.11.2+ | v0.4.0
Windows | x64 | GPU | v3 | v8.11.2+ | v0.4.0
Linux | x64 | GPU | v3 | v8.11.2+ | v0.4.0
Windows | x64 | CPU | v3 | v12.0.0+ | v1.4.0
Linux | x64 | CPU | v3 | v12.0.0+ | v1.4.0
macOS | x64 | CPU | v3 | v12.0.0+ | v1.4.0
Windows | x64 | GPU | v3 | v12.0.0+ | v1.4.0
Linux | x64 | GPU | v3 | v12.0.0+ | v1.4.0

## Usage
There are 2 options to import `onnxjs-node`.
Expand Down Expand Up @@ -53,9 +53,7 @@ session = new onnx.InferenceSession({backendHint: 'wasm'}); // use WebAssembly

## Documentation
- [ONNX.js Home](https://github.com/Microsoft/onnxjs)
- [ONNXRuntime](https://github.com/Microsoft/onnxruntime)
- [Nuget package: Microsoft.ML.OnnxRuntime](https://www.nuget.org/packages/Microsoft.ML.OnnxRuntime/)
- [Nuget package: Microsoft.ML.OnnxRuntime.Gpu](https://www.nuget.org/packages/Microsoft.ML.OnnxRuntime.Gpu/)
- [ONNXRuntime Node.js binding](https://github.com/Microsoft/onnxruntime/nodejs)

# License
Copyright (c) fs-eire. All rights reserved.
Expand Down
25 changes: 0 additions & 25 deletions lib/binding.ts

This file was deleted.

14 changes: 11 additions & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@ if (typeof process !== 'undefined' && process && process.release && process.rele
throw new Error(`onnxruntime node binding does not support non little-endian platform`);
}

// force re-assign overwritten property 'InferenceSession'
(onnxjs as any).InferenceSession = require('./inference-session-override').OnnxRuntimeInferenceSession;
// create a new onnx object and assign property 'InferenceSession'
const onnx: typeof onnxjs = Object.create(onnxjs);
Object.defineProperty(onnx, 'InferenceSession', {
enumerable: true,
get: function() {
return require('./inference-session-override').OnnxRuntimeInferenceSession;
}
});

(global as any).onnx = onnx;
}

export = onnxjs;
export = onnx;
Loading

0 comments on commit 93b46ad

Please sign in to comment.