webdnn
BackendName: "webgpu"
| "webgl"
| "webassembly"
| "fallback"
[webdnn.ts:44]
Backend names supported in WebDNN
DescriptorRunner: DescriptorRunnerGeneric<GraphDescriptor
, any
>
[webdnn.ts:49]
Descriptor runner
getBackendAvailability
getBackendAvailability(): BackendAvailability
[webdnn.ts:102]
Check each computing backend is available or not in this browser.
The result will be returned as BackendAvailability
structure.
BackendAvailability
backend availability
load
load(directory: string
, initOption?: InitOption
): Promise<DescriptorRunner
>
[webdnn.ts:282]
Initialize descriptor runner. This function performs follow things.
Try to initialize computing backend. WebDNN will try to initialize each backend in order of the result of
getBackendAvailability
. If you want to modify this order, specifyinitOption.backendOrder
option.Load model data based on initialized backend. Generally, DNN binary data is very large and it takes long time to load.
initOption.progressCallback
option provides the progress status of loading.
Examples
Basic usage
let runner = await WebDNN.load('./model');
With
initOption.progressCallback
optionlet runner = await WebDNN.load('./model', { progressCallback: (loaded, total) => console.log(`${ (loaded/total*100).toFixed(1) }% Loaded`); });
Name | Type | Default | Description |
---|---|---|---|
directory
|
string
|
URL of directory that contains graph descriptor files (e.g. graph_webgpu.json) |
|
initOption
|
InitOption
|
{}
|
Initialize option |
Promise<DescriptorRunner
>
DescriptorRunner instance, which is the interface to input/output data and run the model.
-
Classes -
Interfaces -
Type aliases -
Functions
Module
WebDNN
provides main features of WebDNN.