This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
123 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
import {env} from '../env'; | ||
|
||
import {Environment} from './env'; | ||
|
||
class ENV implements Environment { | ||
public set debug(value: boolean) { | ||
env.debug = value; | ||
} | ||
public get debug(): boolean { | ||
return env.debug; | ||
} | ||
} | ||
|
||
export const envImpl = new ENV(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
/** | ||
* represent runtime environment settings and status of ONNX.js | ||
*/ | ||
export interface Environment { | ||
/** | ||
* a global flag to indicate whether to run ONNX.js in debug mode | ||
*/ | ||
debug: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as platform from 'platform'; | ||
|
||
import * as onnx from './api'; | ||
import {Backend, Environment, Onnx} from './api'; | ||
|
||
interface ENV extends Environment { | ||
readonly onnx: Onnx; | ||
readonly backend: Backend; | ||
readonly platform: Platform; | ||
} | ||
|
||
class EnvironmentImpl implements ENV { | ||
public readonly onnx = onnx; | ||
public readonly backend = onnx.backend; | ||
public readonly platform = platform; | ||
|
||
public debug = false; | ||
} | ||
|
||
export const env: ENV = new EnvironmentImpl(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters