[DOCS] Updating Nodejs API with descriptions (#24866)

Adding descriptions of methods to Node.js API.
This commit is contained in:
Sebastian Golebiewski 2024-06-06 08:58:31 +02:00 committed by GitHub
parent 11ad74dcda
commit b9e1ef7486
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 902 additions and 217 deletions

View File

@ -51,7 +51,7 @@ The **openvino-node** package exports ``addon`` which contains the following pro
}
* **Defined in:**
`addon.ts:192 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L192>`__
`addon.ts:591 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L192>`__
Properties
@ -71,7 +71,7 @@ Properties
- CoreConstructor: :doc:`CoreConstructor <./openvino-node/interfaces/CoreConstructor>`
- **Defined in:**
`addon.ts:193 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L193>`__
`addon.ts:592 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L592>`__
.. rubric:: PartialShape
@ -87,7 +87,7 @@ Properties
- PartialShapeConstructor: :doc:`PartialShapeConstructor <./openvino-node/interfaces/PartialShapeConstructor>`
- **Defined in:**
`addon.ts:195 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L195>`__
`addon.ts:594 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L594>`__
.. rubric:: Tensor
@ -102,7 +102,7 @@ Properties
- TensorConstructor: :doc:`TensorConstructor <./openvino-node/interfaces/TensorConstructor>`
- **Defined in:**
`addon.ts:194 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L194>`__
`addon.ts:593 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L593>`__
.. rubric:: element
@ -118,7 +118,7 @@ Properties
- element: typeof :doc:`element <./openvino-node/enums/element>`
- **Defined in:**
`addon.ts:201 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L201>`__
`addon.ts:600 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L600>`__
.. rubric:: preprocess
@ -138,5 +138,5 @@ Properties
- resizeAlgorithm: typeof :doc:`resizeAlgorithm <./openvino-node/enums/resizeAlgorithm>`
- **Defined in:**
`addon.ts:169 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L169>`__
`addon.ts:596 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L596>`__

View File

@ -10,7 +10,7 @@ Enumeration element
f32: number
* **Defined in:**
`addon.ts:182 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L183>`__
`addon.ts:580 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L580>`__
.. rubric:: f64
@ -22,7 +22,7 @@ Enumeration element
f64: number
* **Defined in:**
`addon.ts:183 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L184>`__
`addon.ts:581 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L581>`__
.. rubric:: i16
@ -34,7 +34,7 @@ Enumeration element
i16: number
* **Defined in:**
`addon.ts:179 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L180>`__
`addon.ts:577 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L577>`__
.. rubric:: i32
@ -46,7 +46,7 @@ Enumeration element
i32: number
* **Defined in:**
`addon.ts:180 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L181>`__
`addon.ts:578 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L578>`__
.. rubric:: i64
@ -58,7 +58,7 @@ Enumeration element
i64: number
* **Defined in:**
`addon.ts:181 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L182>`__
`addon.ts:579 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L579>`__
.. rubric:: i8
@ -70,7 +70,7 @@ Enumeration element
i8: number
* **Defined in:**
`addon.ts:178 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L179>`__
`addon.ts:576 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L576>`__
.. rubric:: string
@ -82,7 +82,7 @@ Enumeration element
string: string
* **Defined in:**
`addon.ts:176 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L185>`__
`addon.ts:582 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L582>`__
.. rubric:: u16
@ -94,7 +94,7 @@ Enumeration element
u16: number
* **Defined in:**
`addon.ts:176 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L177>`__
`addon.ts:574 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L574>`__
.. rubric:: u32
@ -106,7 +106,7 @@ Enumeration element
u32: number
* **Defined in:**
`addon.ts:175 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L176>`__
`addon.ts:573 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L573>`__
.. rubric:: u64
@ -118,7 +118,7 @@ Enumeration element
u64: number
* **Defined in:**
`addon.ts:177 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L178>`__
`addon.ts:575 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L575>`__
.. rubric:: u8
@ -130,5 +130,5 @@ Enumeration element
u8: number
* **Defined in:**
`addon.ts:174 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L175>`__
`addon.ts:572 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L572>`__

View File

@ -10,7 +10,7 @@ Enumeration resizeAlgorithm
RESIZE_CUBIC: number
- **Defined in:**
`addon.ts:188 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L188>`__
`addon.ts:587 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L587>`__
.. rubric:: RESIZE_LINEAR
@ -22,7 +22,7 @@ Enumeration resizeAlgorithm
RESIZE_LINEAR: number
- **Defined in:**
`addon.ts:189 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L189>`__
`addon.ts:588 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L588>`__
.. rubric:: RESIZE_NEAREST
@ -34,5 +34,5 @@ Enumeration resizeAlgorithm
RESIZE_NEAREST: number
- **Defined in:**
`addon.ts:187 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L187>`__
`addon.ts:586 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L586>`__

View File

@ -8,12 +8,19 @@ Interface CompiledModel
outputs: Output[];
createInferRequest(): InferRequest;
exportModelSync(): Buffer;
input(nameOrId?): Output;
output(nameOrId?): Output;
input(): Output;
input(index): Output;
input(name): Output;
output(): Output;
output(index): Output;
output(name): Output;
}
CompiledModel represents a model that is compiled for a specific device by applying
multiple optimization transformations, then mapping to compute kernels.
* **Defined in:**
`addon.ts:65 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L65>`__
`addon.ts:272 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L272>`__
Properties
@ -28,8 +35,10 @@ Properties
inputs: Output []
It gets all inputs of a compiled model.
- **Defined in:**
`addon.ts:67 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L67>`__
`addon.ts:274 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L274>`__
.. rubric:: outputs
@ -40,8 +49,10 @@ Properties
outputs: Output []
It gets all outputs of a compiled model.
- **Defined in:**
`addon.ts:66 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L66>`__
`addon.ts:276 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L276>`__
Methods
@ -49,6 +60,7 @@ Methods
.. rubric:: createInferRequest
:name: createInferRequest
.. container:: m-4
@ -56,13 +68,16 @@ Methods
createInferRequest(): InferRequest
It creates an inference request object used to infer the compiled model.
* **Returns:** :doc:`InferRequest <InferRequest>`
- **Defined in:**
`addon.ts:84 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L84>`__
`addon.ts:281 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L281>`__
.. rubric:: exportModelSync
:name: exportModelSync
.. container:: m-4
@ -73,7 +88,7 @@ Methods
* **Returns:** Buffer
- **Defined in:**
`addon.ts:85 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L85>`__
`addon.ts:288 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L288>`__
.. rubric:: input
@ -82,21 +97,57 @@ Methods
.. code-block:: ts
input(nameOrId?): Output
input(): Output
It gets a single input of a compiled model. If a model has more than one input,
this method throws an exception.
* **Returns:** :doc:`Output <Output>`
A compiled model input.
* **Defined in:**
`addon.ts:312 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L312>`__
.. code-block:: ts
input(index): Output
It gets input of a compiled model identified by an index.
* **Parameters:**
- ``Optional``
- index: number
.. code-block:: ts
An input tensor index.
nameOrId: string|number
* **Returns:** :doc:`Output <Output>`
* **Returns:** :doc:`InferRequest <Output>`
A compiled model input.
* **Defined in:**
`addon.ts:83 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L83>`__
`addon.ts:318 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L318>`__
.. code-block:: ts
input(name): Output
It gets input of a compiled model identified by an index.
* **Parameters:**
- name: string
An input tensor name.
* **Returns:** :doc:`Output <Output>`
A compiled model input.
* **Defined in:**
`addon.ts:324 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L324>`__
.. rubric:: output
@ -105,18 +156,62 @@ Methods
.. code-block:: ts
output(nameOrId?): Output
output(): Output
* **Parameters:**
- ``Optional``
.. code-block:: ts
nameOrId: string|number
It gets a single output of a compiled model. If a model has more than one output, this method throws an exception.
* **Returns:** :doc:`Output <Output>`
* **Defined in:**
`addon.ts:82 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L82>`__
A compiled model output.
* **Defined in:**
`addon.ts:294 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L294>`__
.. code-block:: ts
output(index): Output
It gets output of a compiled model identified by an index.
* **Parameters:**
-
.. code-block:: ts
index: number
An output tensor index.
* **Returns:** :doc:`Output <Output>`
A compiled model output.
* **Defined in:**
`addon.ts:300 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L300>`__
.. code-block:: ts
output(name): Output
It gets output of a compiled model identified by a tensorName.
* **Parameters:**
-
.. code-block:: ts
name: string
An output tensor name.
* **Returns:** :doc:`Output <Output>`
A compiled model output.
* **Defined in:**
`addon.ts:306 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L306>`__

View File

@ -1,58 +1,146 @@
Interface Core
==============
Core represents an OpenVINO runtime Core entity.
User applications can create several Core class instances,
but in this case, the underlying plugins
are created multiple times and not shared between several Core instances.
It is recommended to have a single Core instance per application.
.. code-block:: ts
interface Core {
addExtension(libraryPath): void;
compileModel(model, deviceName, config?): Promise<CompiledModel>;
compileModel(modelPath, deviceName, config?): Promise<CompiledModel>;
compileModelSync(model, deviceName, config?): CompiledModel;
compileModelSync(modelPath, deviceName, config?): CompiledModel;
getAvailableDevices(): string[];
getProperty(propertyName): string | number | boolean;
getProperty(deviceName, propertyName): string | number | boolean;
importModelSync(modelStream, device): CompiledModel;
getVersions(deviceName): {
[deviceName: string]: {
buildNumber: string;
description: string;
};
};
importModelSync(modelStream, device, config?): CompiledModel;
readModel(modelPath, weightsPath?): Promise<Model>;
readModel(modelBuffer, weightsBuffer?): Promise<Model>;
readModelSync(modelPath, weightsPath?): Model;
readModelSync(modelBuffer, weightsBuffer?): Model;
setProperty(props): void;
setProperty(deviceName, props): void;
setProperty(properties): void;
setProperty(deviceName, properties): void;
}
* **Defined in:**
`addon.ts:23 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L23>`__
`addon.ts:32 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L32>`__
Methods
#####################
.. rubric:: addExtension
.. container:: m-4
.. code-block:: ts
addExtension(libraryPath): void
Registers extensions to a Core object.
* **Parameters:**
- libraryPath: string
A path to the library with ov::Extension
* **Defined in:**
`addon.ts:37 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L37>`__
.. rubric:: compileModel
.. container:: m-4
.. code-block:: ts
compileModel(model, device, config?): Promise<CompiledModel>
compileModel(model, deviceName, config?): Promise<CompiledModel>
Asynchronously creates a compiled model from a source :doc:`Model <Model>` object.
You can create as many compiled models as needed and use them
simultaneously (up to the limitation of the hardware resources).
* **Parameters:**
- model: :doc:`Model <Model>`
- device: string
- model: :doc:`Model <Model>`
The :doc:`Model <Model>` object acquired from :ref:`Core.readModel <readModel>`
- deviceName: string
The name of a device, to which the model is loaded.
- ``Optional``
An object with the key-value pairs
(property name, property value): relevant only for this load operation.
.. code-block:: ts
config: {
[propertyName: string]: string;
}
- [propertyName: string]:string
* **Returns:** Promise<\ :doc:`CompiledModel <CompiledModel>` \>
* **Defined in:**
`addon.ts:48 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L48>`__
.. code-block:: ts
compileModel(modelPath, deviceName, config?): Promise<CompiledModel>
Asynchronously reads a model and creates a compiled model
from the IR/ONNX/PDPD file. This can be more efficient
than using :ref:`Core.readModel <readModel>` + :ref:`core.compileModel(Model) <compileModel>`
flow especially for cases when caching is enabled and a cached model is
available. You can create as many compiled models as needed and use
them simultaneously (up to the limitation of the hardware resources).
* **Parameters:**
- model: :doc:`Model <Model>`
The path to a model.is i
- deviceName: string
The name of a device, to which a model is loaded.
- ``Optional``
.. code-block:: ts
config: {
[option: string]: string;
[propertyName: string]: string;
}
- [option: string]:string
An object with the key-value pairs
(property name, property value): relevant only for this load operation.
- [propertyName: string]:string
* **Returns:** Promise<\ :doc:`CompiledModel <CompiledModel>` \>
* **Defined in:**
`addon.ts:24 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L24>`__
`addon.ts:67 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L67>`__
.. rubric:: compileModelSync
@ -61,26 +149,56 @@ Methods
.. code-block:: ts
compileModelSync(model, device, config?): CompiledModel
compileModelSync(model, deviceName, config?): CompiledModel
A synchronous version of :ref:`Core.compileModel <compileModel>`.
It creates a compiled model from a source model object.
* **Parameters:**
- model: :doc:`Model <Model>`
- device: string
- deviceName: string
- ``Optional``
.. code-block:: ts
config: {
[option: string]: string;
[propertyName: string]: string;
}
- [option: string]:string
- [propertyName: string]:string
* **Returns:** :doc:`CompiledModel <CompiledModel>`
* **Defined in:**
`addon.ts:29 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L29>`__
`addon.ts:76 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L76>`__
.. code-block:: ts
compileModelSync(modelPath, deviceName, config?): CompiledModel
A synchronous version of :ref:`Core.compileModel <compileModel>`.
It reads a model and creates a compiled model from the IR/ONNX/PDPD file.
* **Parameters:**
- modelPath: string
- deviceName: string
- ``Optional``
.. code-block:: ts
config: {
[propertyName: string]: string;
}
- [propertyName: string]:string
* **Returns:** :doc:`CompiledModel <CompiledModel>`
* **Defined in:**
`addon.ts:85 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L85>`__
.. rubric:: getAvailableDevices
@ -91,10 +209,19 @@ Methods
getAvailableDevices(): string[]
It returns a list of available inference devices.
Core objects go over all registered plugins.
* **Returns:** string[]
The list of devices may include any of the following: CPU, GPU.0,
GPU.1, NPU… If there is more than one device of a specific type, they are
enumerated with ``.#`` suffix. Such enumerated devices can later be used
as a device name in all Core methods, like ``compile_model``, ``query_model``,
``set_property`` and so on.
* **Defined in:**
`addon.ts:45 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L45>`__
`addon.ts:99 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L99>`__
.. rubric:: getProperty
@ -105,14 +232,18 @@ Methods
getProperty(propertyName): string | number | boolean
It gets the properties dedicated to device behavior.
* **Parameters:**
- propertyName: string
A property name.
* **Returns:** string | number | boolean
* **Defined in:**
`addon.ts:57 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L57>`__
`addon.ts:104 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L104>`__
.. container:: m-4
@ -120,15 +251,61 @@ Methods
getProperty(deviceName, propertyName): string | number | boolean
It gets the properties dedicated to device behavior.
* **Parameters:**
- deviceName: string
The name of a device, the properties of which you get.
- propertyName: string
A property name.
* **Returns:** string | number | boolean
* **Defined in:**
`addon.ts:58 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L58>`__
`addon.ts:111 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L111>`__
.. rubric:: getVersions
.. container:: m-4
.. code-block:: ts
getVersions(deviceName): {
[deviceName: string]: {
buildNumber: string;
description: string;
};
}
It returns information on the version of device plugins.
* **Parameters:**
- deviceName: string
A device name to identify a plugin.
* **Returns:**
.. code-block::
{
[deviceName: string]: {
buildNumber: string;
description: string;
};
}
* buildNumber: string
* description: string
* **Defined in:**
`addon.ts:119 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L119>`__
.. rubric:: importModelSync
@ -137,45 +314,42 @@ Methods
.. code-block:: ts
importModelSync(modelStream, device): CompiledModel
importModelSync(modelStream, device, config?): CompiledModel
It imports a previously exported compiled model.
* **Parameters:**
- modelStream: Buffer
The input stream that contains a model, previously exported with the
:ref:`CompiledModel.exportModelSync <exportModelSync>` method.
- device: string
* **Returns:** CompiledModel
The name of a device, for which you import a compiled model. Note, if the device name
was not used to compile the original model, an exception is thrown.
* **Defined in:**
`addon.ts:39 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L39>`__
- ``Optional``
.. container:: m-4
.. code-block:: ts
.. code-block:: ts
importModelSync(modelStream: Buffer, device: string, props: { [key: string]: string | number | boolean }): CompiledModel
.. container:: m-4
**Parameters:**
- modelStream: Buffer
- device: string
-
.. code-block:: ts
props: {
config: {
[key: string]: string | number | boolean;
}
**Returns:** CompiledModel
An object with the key-value pairs (property name, property value): relevant only for this load operation.
- [key: string]: string | number | boolean
* **Returns:** :doc:`CompiledModel <CompiledModel>`
* **Defined in:**
`addon.ts:40 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L40>`__
`addon.ts:135 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L135>`__
.. rubric:: readModel
:name: readModel
.. container:: m-4
@ -183,19 +357,33 @@ Methods
readModel(modelPath, weightsPath?): Promise<Model>
It reads models from the IR / ONNX / PDPD / TF and TFLite formats.
* **Parameters:**
- modelPath: string
The path to a model in the IR / ONNX / PDPD / TF or TFLite format.
- ``Optional``
.. code-block:: ts
weightsPath: string
* **Returns:** Promise<\ :doc:`Model <Model>`\ >
The path to a data file for the IR format (.bin): if the path is empty, it tries to
read the bin file with the same name as xml and if the bin file with the same name
was not found, it loads IR without weights.
| For the ONNX format (.onnx), the weights parameter is not used.
| For the PDPD format (.pdmodel), the weights parameter is not used.
| For the TF format (.pb), the weights parameter is not used.
| For the TFLite format (.tflite), the weights parameter is not used.
* **Returns:** Promise<\ :doc:`Model <Model>`\ >
* **Defined in:**
`addon.ts:34 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L34>`__
`addon.ts:152 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L152>`__
.. container:: m-4
@ -203,19 +391,26 @@ Methods
readModel(modelBuffer, weightsBuffer?): Promise<Model>
It reads models from the IR / ONNX / PDPD / TF and TFLite formats.
* **Parameters:**
- modelBuffer: Uint8Array
Binary data with a model in the IR / ONNX / PDPD / TF or TFLite format.
- ``Optional``
.. code-block:: ts
weightsBuffer: Uint8Array
Binary data with tensor data.
* **Returns:** Promise<\ :doc:`Model <Model>`\ >
* **Defined in:**
`addon.ts:35 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L35>`__
`addon.ts:160 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L160>`__
.. rubric:: readModelSync
@ -226,21 +421,25 @@ Methods
readModelSync(modelPath, weightsPath?): Model
It reads models from the IR / ONNX / PDPD / TF and TFLite formats.
* **Parameters:**
- modelPath: string
The path to a model in the IR / ONNX / PDPD / TF or TFLite format.
- ``Optional``
.. code-block:: ts
weightsPath: string
* **Returns:** :doc:`Model <Model>`
* **Returns:** Promise<\ :doc:`Model <Model>`\ >
* **Defined in:**
`addon.ts:37 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L37>`__
`addon.ts:166 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L166>`__
.. container:: m-4
.. code-block:: ts
@ -258,7 +457,7 @@ Methods
* **Returns:** :doc:`Model <Model>`
* **Defined in:**
`addon.ts:38 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L38>`__
`addon.ts:171 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L171>`__
.. rubric:: setProperty
@ -267,7 +466,9 @@ Methods
.. code-block:: ts
setProperty(props): void
setProperty(properties): void
It sets the properties.
* **Parameters:**
@ -275,22 +476,25 @@ Methods
.. code-block:: ts
props: {
properties: {
[key: string]: string | number | boolean;
}
An object with the property name - property value pairs.
- [key: string]: string | number | boolean
* **Returns:** void
* **Defined in:**
`addon.ts:52 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L52>`__
`addon.ts:176 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L176>`__
.. container:: m-4
.. code-block:: ts
setProperty(deviceName, props): void
setProperty(deviceName, properties): void
It sets the properties for a device.
* **Parameters:**
@ -299,7 +503,7 @@ Methods
.. code-block:: ts
props: {
properties: {
[key: string]: string | number | boolean;
}
@ -308,5 +512,5 @@ Methods
* **Returns:** string | number | boolean
* **Defined in:**
`addon.ts:53 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L53>`__
`addon.ts:182 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L182>`__

View File

@ -4,11 +4,11 @@ Interface CoreConstructor
.. code-block:: ts
interface CoreConstructor {
new Core(): Core;
new CoreConstructor(): Core;
}
* **Defined in:**
`addon.ts:40 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L40>`__
`addon.ts:187 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L187>`__
Constructors
@ -21,10 +21,10 @@ Constructors
.. code-block:: ts
new Core(): Core
new CoreConstructor(): Core
* **Returns:** :doc:`Core <Core>`
* **Defined in:**
`addon.ts:41 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L41>`__
`addon.ts:188 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L188>`__

View File

@ -5,22 +5,39 @@ InferRequest
interface InferRequest {
getCompiledModel(): CompiledModel;
getInputTensor(idx?): Tensor;
getInputTensor(): Tensor;
getInputTensor(idx): Tensor;
getOutputTensor(): Tensor;
getOutputTensor(idx?): Tensor;
getTensor(nameOrOutput): Tensor;
infer(inputData?): {
infer(): {
[outputName: string]: Tensor;
};
infer(inputData): {
[outputName: string]: Tensor;
};
infer(inputData): {
[outputName: string]: Tensor;
};
inferAsync(inputData): Promise<{
[outputName: string]: Tensor;
}>;
setInputTensor(idxOrTensor, tensor?): void;
setOutputTensor(idxOrTensor, tensor?): void;
setInputTensor(tensor): void;
setInputTensor(idx, tensor): void;
setOutputTensor(tensor): void;
setOutputTensor(idx, tensor): void;
setTensor(name, tensor): void;
}
The ``InferRequest`` object is created using
:ref:`CompiledModel.createInferRequest <createInferRequest>` method and is
specific for a given deployed model. It is used to make predictions and
can be run in asynchronous or synchronous manners.
* **Defined in:**
`addon.ts:101 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L101>`__
`addon.ts:402 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L402>`__
Methods
@ -35,10 +52,12 @@ Methods
getCompiledModel(): CompiledModel
It gets the compiled model used by the InferRequest object.
* **Returns:** :doc:`CompiledModel <CompiledModel>`
* **Defined in:**
`addon.ts:112 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L112>`__
`addon.ts:439 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L439>`__
.. rubric:: getInputTensor
@ -47,8 +66,9 @@ Methods
.. code-block:: ts
getInputTensor(idx?): Tensor
getInputTensor(): Tensor
It gets the input tensor for inference.
* **Parameters:**
@ -61,8 +81,36 @@ Methods
* **Returns:** :doc:`Tensor <Tensor>`
The input tensor for the model. If the model has several inputs,
an exception is thrown.
* **Defined in:**
`addon.ts:106 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L106>`__
`addon.ts:445 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L445>`__
.. code-block:: ts
getInputTensor(idx: number): Tensor
It gets the input tensor for inference.
* **Parameters:**
- ``Optional``
.. code-block:: ts
idx: number
An index of the tensor to get.
* **Returns:** :doc:`Tensor <Tensor>`
A tensor at the specified index. If the tensor with the specified
idx is not found, an exception is thrown.
* **Defined in:**
`addon.ts:452 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L452>`__
.. rubric:: getOutputTensor
@ -71,8 +119,24 @@ Methods
.. code-block:: ts
getOutputTensor(idx?): Tensor
getOutputTensor(): Tensor
It gets the output tensor for inference.
* **Returns:** :doc:`Tensor <Tensor>`
The output tensor for the model. If the tensor with the specified
idx is not found, an exception is thrown.
* **Defined in:**
`addon.ts:465 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L465>`__
.. code-block:: ts
getOutputTensor(idx?: number): Tensor
It gets the output tensor for inference.
* **Parameters:**
@ -82,11 +146,15 @@ Methods
idx: number
An index of the tensor to get.
* **Returns:** :doc:`Tensor <Tensor>`
A tensor at the specified index. If the tensor with the specified
idx is not found, an exception is thrown.
* **Defined in:**
`addon.ts:107 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L107>`__
`addon.ts:465 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L465>`__
.. rubric:: getTensor
@ -94,16 +162,22 @@ Methods
.. code-block:: ts
getTensor(nameOrOutput): Tensor
getTensor(nameOrOutput: string | Output): Tensor;
It gets an input/output tensor for inference.
If a tensor with the specified name or port is not found, an exception
is thrown.
* **Parameters:**
- nameOrOutput: string| :doc:`Output <Output>`
- nameOrOutput: string | :doc:`Output <Output>`
The name of the tensor or output object.
* **Returns:** :doc:`Tensor <Tensor>`
* **Defined in:**
`addon.ts:105 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L105>`__
`addon.ts:474 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L474>`__
.. rubric:: infer
@ -112,19 +186,11 @@ Methods
.. code-block:: ts
infer(inputData?): {
[outputName: string]: Tensor;
}
infer(): { [outputName: string] : Tensor};
* **Parameters:**
- ``Optional``
.. code-block:: ts
inputData: {
[inputName: string]: Tensor | SupportedTypedArray;
} | Tensor[] | SupportedTypedArray[]
It infers specified input(s) in the synchronous mode. Inputs have to be
specified earlier using :ref:`InferRequest.setTensor <setTensor>` or
:ref:`InferRequest.setInputTensor <setInputTensor>`
* **Returns:**
@ -134,10 +200,78 @@ Methods
[outputName: string]: Tensor;
}
- [outputName: string]: Tensor
* **Defined in:**
`addon.ts:108 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L108>`__
`addon.ts:409 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L409>`__
.. code-block:: ts
infer(inputData): {
[outputName: string]: Tensor;
}
It infers specified input(s) in the synchronous mode.
* **Parameters:**
-
.. code-block:: ts
inputData: {
[inputName: string]: Tensor | SupportedTypedArray;
}
An object with the key-value pairs where the key is the
input name and value can be either a tensor or a ``TypedArray``. ``TypedArray``
will be wrapped into ``Tensor`` underneath using the input shape and element type
of the deployed model.
* **Returns:**
.. code-block:: ts
{
[outputName: string]: Tensor;
}
* **Defined in:**
`addon.ts:417 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L417>`__
.. code-block:: ts
infer(inputData): {
[outputName: string]: Tensor;
}
It infers specified input(s) in the synchronous mode.
* **Parameters:**
-
.. code-block:: ts
inputData: Tensor[] | SupportedTypedArray[]
An array with tensors or ``TypedArrays``. ``TypedArrays`` will be
wrapped into ``Tensors`` underneath using the input shape and element type
of the deployed model. If the model has multiple inputs, the ``Tensors``
and ``TypedArrays`` must be passed in the correct order.
* **Returns:**
.. code-block:: ts
{
[outputName: string]: Tensor;
}
* **Defined in:**
`addon.ts:426 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L426>`__
.. rubric:: inferAsync
@ -150,6 +284,8 @@ Methods
[outputName: string]: Tensor;
}>
It infers specified input(s) in the asynchronous mode.
* **Parameters:**
-
@ -160,6 +296,10 @@ Methods
[inputName: string]: Tensor;
}
An object with the key-value pairs where the key is the input name and
value is a tensor or an array with tensors. If the model has multiple
inputs, the Tensors must be passed in the correct order.
* **Returns:**
.. code-block:: ts
@ -170,32 +310,58 @@ Methods
* **Defined in:**
`addon.ts:110 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L110>`__
`addon.ts:434 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L434>`__
.. rubric:: setInputTensor
:name: setInputTensor
.. container:: m-4
.. code-block:: ts
setInputTensor(idxOrTensor, tensor?): void
setInputTensor(tensor): void
It sets the input tensor to infer models with a single input.
* **Parameters:**
- idxOrTensor: number| :doc:`Tensor <Tensor>`
- ``Optional``
.. code-block:: ts
tensor: Tensor
- :doc:`Tensor <Tensor>`
The input tensor. The element type and shape of the tensor must match
the type and size of the model's input element. If the model has
several inputs, an exception is thrown.
* **Returns:** void
* **Defined in:**
`addon.ts:103 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L103>`__
`addon.ts:481 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L481>`__
.. code-block:: ts
setInputTensor(idx, tensor): void
It sets the input tensor to infer.
* **Parameters:**
- idx: number
The input tensor index. If idx is greater than the number of
model inputs, an exception is thrown.
- :doc:`Tensor <Tensor>`
The input tensor. The element type and shape of the tensor
must match the input element type and size of the model.
* **Returns:** void
* **Defined in:**
`addon.ts:489 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L489>`__
.. rubric:: setOutputTensor
@ -203,25 +369,49 @@ Methods
.. code-block:: ts
setOutputTensor(idxOrTensor, tensor?): void
setOutputTensor(tensor): void
It sets the output tensor to infer models with a single output.
* **Parameters:**
- idxOrTensor: number| :doc:`Tensor <Tensor>`
- ``Optional``
.. code-block:: ts
tensor: Tensor
- :doc:`Tensor <Tensor>`
The output tensor. The element type and shape of the tensor must match
the output element type and size of the model. If the model has several
outputs, an exception is thrown.
* **Returns:** void
* **Defined in:**
`addon.ts:104 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L104>`__
`addon.ts:496 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L496>`__
.. code-block:: ts
setOutputTensor(idx, tensor): void
It sets the output tensor to infer.
* **Parameters:**
- idx: number
The output tensor index.
- :doc:`Tensor <Tensor>`
The output tensor. The element type and shape of the tensor
must match the output element type and size of the model.
* **Returns:** void
* **Defined in:**
`addon.ts:503 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L503>`__
.. rubric:: setTensor
:name: setTensor
.. container:: m-4
@ -229,13 +419,21 @@ Methods
setTensor(name, tensor): void
It sets the input/output tensor to infer.
* **Parameters:**
- name: string
The input or output tensor name.
- tensor: :doc:`Tensor <Tensor>`
The tensor. The element type and shape of the tensor
must match the input/output element type and size of the model.
* **Returns:** void
* **Defined in:**
`addon.ts:102 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L102>`__
`addon.ts:510 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L510>`__

View File

@ -10,7 +10,7 @@ Interface InputInfo
}
* **Defined in:**
`addon.ts:144 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L144>`__
`addon.ts:542 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L542>`__
Methods
#####################
@ -26,7 +26,7 @@ Methods
* **Returns:** :doc:`InputModelInfo <InputModelInfo>`
* **Defined in:**
`addon.ts:147 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L147>`__
`addon.ts:545 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L545>`__
.. rubric:: preprocess
@ -40,7 +40,7 @@ Methods
* **Returns:** :doc:`PreProcessSteps <PreProcessSteps>`
* **Defined in:**
`addon.ts:146 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L146>`__
`addon.ts:544 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L544>`__
.. rubric:: tensor
@ -54,5 +54,5 @@ Methods
* **Returns:** :doc:`InputTensorInfo <InputTensorInfo>`
* **Defined in:**
`addon.ts:145 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L145>`__
`addon.ts:543 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L543>`__

View File

@ -8,7 +8,7 @@ Interface InputModelInfo
}
* **Defined in:**
`addon.ts:140 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L140>`__
`addon.ts:538 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L538>`__
Methods
#####################
@ -28,5 +28,5 @@ Methods
* **Returns:** :doc:`InputModelInfo <InputModelInfo>`
* **Defined in:**
`addon.ts:141 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L141>`__
`addon.ts:539 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L539>`__

View File

@ -10,7 +10,7 @@ Interface InputTensorInfo
}
* **Defined in:**
`addon.ts:126 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L126>`__
`addon.ts:524 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L524>`__
Methods
@ -32,7 +32,7 @@ Methods
* **Returns:** :doc:`InputTensorInfo <InputTensorInfo>`
* **Defined in:**
`addon.ts:127 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L127>`__
`addon.ts:525 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L525>`__
.. rubric:: setLayout
@ -50,7 +50,7 @@ Methods
* **Returns:** :doc:`InputTensorInfo <InputTensorInfo>`
* **Defined in:**
`addon.ts:128 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L128>`__
`addon.ts:526 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L526>`__
.. rubric:: setShape
@ -68,5 +68,5 @@ Methods
* **Returns:** :doc:`InputTensorInfo <InputTensorInfo>`
* **Defined in:**
`addon.ts:129 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L129>`__
`addon.ts:527 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L527>`__

View File

@ -6,14 +6,24 @@ Interface Model
interface Model {
inputs: Output[];
outputs: Output[];
getFriendlyName(): string;
getName(): string;
input(nameOrId?): Output;
getOutputShape(index): number[];
getOutputSize(): number;
input(): Output;
input(name): Output;
input(index): Output;
isDynamic(): boolean;
output(nameOrId?): Output;
output(): Output;
output(name): Output;
output(index): Output;
setFriendlyName(name): void;
}
A user-defined model read by :ref:`Core.readModel <readModel>`.
* **Defined in:**
`addon.ts:68 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L68>`__
`addon.ts:191 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L191>`__
Properties
@ -29,7 +39,7 @@ Properties
inputs: Output[]
- **Defined in:**
`addon.ts:70 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L70>`__
`addon.ts:193 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L193>`__
.. rubric:: outputs
@ -41,13 +51,32 @@ Properties
outputs: Output[]
- **Defined in:**
`addon.ts:69 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L69>`__
`addon.ts:192 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L192>`__
Methods
#####################
.. rubric:: getFriendlyName
.. container:: m-4
.. code-block:: ts
getFriendlyName(): string
It gets the friendly name for a model. If a friendly name is not set
via :ref:`Model.setFriendlyName <setFriendlyName>`, a unique model name is returned.
* **Returns:** string
A string with a friendly name of the model.
* **Defined in:**
`addon.ts:200 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L200>`__
.. rubric:: getName
.. container:: m-4
@ -56,11 +85,46 @@ Methods
getName(): string
It gets the unique name of the model.
* **Returns:** string
A string with the name of the model.
* **Defined in:**
`addon.ts:73 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L73>`__
`addon.ts:196 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L196>`__
.. rubric:: getOutputShape
.. container:: m-4
.. code-block:: ts
getOutputShape(): number[]
It returns the shape of the element at the specified index.
* **Returns:** number[]
* **Defined in:**
`addon.ts:201 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L201>`__
.. rubric:: getOutputSize
.. container:: m-4
.. code-block:: ts
getOutputSize(): number[]
It returns the number of the model outputs.
* **Returns:** number[]
* **Defined in:**
`addon.ts:198 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L198>`__
.. rubric:: input
@ -69,7 +133,22 @@ Methods
.. code-block:: ts
input(nameOrId?): Output
input(): Output
It gets the input of the model. If a model has more than one input,
this method throws an exception.
* **Returns:** :doc:`Output <Output>`
* **Defined in:**
`addon.ts:219 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L219>`__
.. code-block:: ts
input(name: string): Output
It gets the input of the model identified by the tensor name.
* **Parameters:**
@ -77,12 +156,36 @@ Methods
.. code-block:: ts
nameOrId: string|number
name: string
The tensor name.
* **Returns:** :doc:`Output <Output>`
* **Defined in:**
`addon.ts:72 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L72>`__
`addon.ts:224 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L224>`__
.. code-block:: ts
input(index: number): Output
It gets the input of the model identified by the index.
* **Parameters:**
- ``Optional``
.. code-block:: ts
index: number
The index of the input.
* **Returns:** :doc:`Output <Output>`
* **Defined in:**
`addon.ts:229 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L229>`__
.. rubric:: isDynamic
@ -93,10 +196,12 @@ Methods
isDynamic(): boolean
It returns true if any of the ops defined in the model contains a partial shape.
* **Returns:** boolean
* **Defined in:**
`addon.ts:74 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L74>`__
`addon.ts:234 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L234>`__
.. rubric:: output
@ -118,5 +223,23 @@ Methods
* **Returns:** :doc:`Output <Output>`
* **Defined in:**
`addon.ts:71 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L71>`__
`addon.ts:194 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L194>`__
.. rubric:: setFriendlyName
:name: setFriendlyName
.. container:: m-4
.. code-block:: ts
setFriendlyName(name): void
* **Parameters:**
- name: string
* **Returns:** void
* **Defined in:**
`addon.ts:199 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L199>`__

View File

@ -14,7 +14,7 @@ Interface Output
}
* **Defined in:**
`addon.ts:117 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L117>`__
`addon.ts:515 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L515>`__
Properties
@ -31,7 +31,7 @@ Properties
anyName: string
- **Defined in:**
`addon.ts:118 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L118>`__
`addon.ts:516 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L516>`__
@ -44,7 +44,7 @@ Properties
shape: number[]
- **Defined in:**
`addon.ts:119 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L119>`__
`addon.ts:517 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L517>`__
Methods
@ -62,7 +62,7 @@ Methods
* **Returns:** string
* **Defined in:**
`addon.ts:121 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L121>`__
`addon.ts:519 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L519>`__
.. rubric:: getPartialShape
@ -75,7 +75,7 @@ Methods
* **Returns:** :doc:`PartialShape <PartialShape>`
* **Defined in:**
`addon.ts:123 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L123>`__
`addon.ts:521 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L521>`__
.. rubric:: getShape
@ -88,7 +88,7 @@ Methods
* **Returns:** number[]
* **Defined in:**
`addon.ts:122 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L122>`__
`addon.ts:520 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L520>`__
.. rubric:: toString
@ -101,5 +101,5 @@ Methods
* **Returns:** string
* **Defined in:**
`addon.ts:120 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L120>`__
`addon.ts:518 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L518>`__

View File

@ -8,7 +8,7 @@ Interface OutputInfo
}
* **Defined in:**
`addon.ts:150 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L150>`__
`addon.ts:548 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L548>`__
Methods
@ -26,5 +26,5 @@ Methods
* **Returns** :doc:`OutputTensorInfo <OutputTensorInfo>`
* **Defined in:**
`addon.ts:151 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L151>`__
`addon.ts:549 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L549>`__

View File

@ -9,7 +9,7 @@ Interface OutputTensorInfo
}
* **Defined in:**
`addon.ts:132 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L132>`__
`addon.ts:530 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L530>`__
Methods
@ -31,7 +31,7 @@ Methods
* **Returns** :doc:`InputTensorInfo <InputTensorInfo>`
* **Defined in:**
`addon.ts:133 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L133>`__
`addon.ts:531 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L531>`__
.. rubric:: setLayout
@ -48,5 +48,5 @@ Methods
* **Returns:** :doc:`InputTensorInfo <InputTensorInfo>`
* **Defined in:**
`addon.ts:134 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L134>`__
`addon.ts:532 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L532>`__

View File

@ -11,7 +11,7 @@ Interface PartialShape
}
* **Defined in:**
`addon.ts:163 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L163>`__
`addon.ts:561 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L561>`__
Methods
@ -29,7 +29,7 @@ Methods
* **Returns:** :doc:`Dimension <../types/Dimension>`\[]
* **Defined in:**
`addon.ts:167 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L167>`__
`addon.ts:565 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L565>`__
.. rubric:: isDynamic
@ -43,7 +43,7 @@ Methods
* **Returns:** boolean
* **Defined in:**
`addon.ts:165 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L165>`__
`addon.ts:563 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L563>`__
.. rubric:: isStatic
@ -57,7 +57,7 @@ Methods
* **Returns:** boolean
* **Defined in:**
`addon.ts:164 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L164>`__
`addon.ts:562 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L562>`__
.. rubric:: toString
@ -71,5 +71,5 @@ Methods
* **Returns:** string
* **Defined in:**
`addon.ts:166 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L166>`__
`addon.ts:564 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L564>`__

View File

@ -4,11 +4,11 @@ Interface PartialShapeConstructor
.. code-block:: ts
interface PartialShapeConstructor {
new PartialShape(shape): PartialShape;
new PartialShapeConstructor(shape): PartialShape;
}
* **Defined in:**
`addon.ts:169 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L169>`__
`addon.ts:567 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L567>`__
Constructors
@ -21,7 +21,7 @@ Constructors
.. code-block:: ts
new PartialShape(shape): PartialShape
new PartialShapeConstructor(shape): PartialShape
* **Parameters:**
@ -30,5 +30,5 @@ Constructors
* **Returns:** :doc:`PartialShape <PartialShape>`
- **Defined in**
`addon.ts:170 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L170>`__
`addon.ts:568 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L568>`__

View File

@ -10,7 +10,7 @@ Interface PrePostProcessor
}
* **Defined in:**
`addon.ts:154 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L154>`__
`addon.ts:552 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L552>`__
Methods
@ -28,7 +28,7 @@ Methods
* **Returns:** :doc:`PrePostProcessor <PrePostProcessor>`
* **Defined in:**
`addon.ts:155 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L155>`__
`addon.ts:553 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L553>`__
.. rubric:: input
@ -50,7 +50,7 @@ Methods
* **Returns:** :doc:`InputInfo <InputInfo>`
* **Defined in:**
`addon.ts:156 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L156>`__
`addon.ts:554 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L554>`__
.. rubric:: output
@ -71,5 +71,5 @@ Methods
* **Returns:** :doc:`OutputInfo <OutputInfo>`
* **Defined in:**
`addon.ts:157 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L157>`__
`addon.ts:555 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L555>`__

View File

@ -4,11 +4,11 @@ Interface PrePostProcessorConstructor
.. code-block:: ts
interface PrePostProcessorConstructor {
new PrePostProcessor(model): PrePostProcessor;
new PrePostProcessorConstructor(model): PrePostProcessor;
}
* **Defined in:**
`addon.ts:159 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L159>`__
`addon.ts:557 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L557>`__
Constructors
@ -21,7 +21,7 @@ Constructors
.. code-block:: ts
new PrePostProcessor(model): PrePostProcessor
new PrePostProcessorConstructor(model): PrePostProcessor
* **Parameters:**
@ -30,5 +30,5 @@ Constructors
* **Returns:** :doc:`PrePostProcessor <PrePostProcessor>`
* **Defined in:**
`addon.ts:160 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L160>`__
`addon.ts:558 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L558>`__

View File

@ -9,7 +9,7 @@ Interface PreProcessSteps
}
* **Defined in:**
`addon.ts:136 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L136>`__
`addon.ts:534 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L534>`__
Methods
@ -31,5 +31,5 @@ Methods
* **Returns:** :doc:`PreProcessSteps <PreProcessSteps>`
* **Defined in:**
`addon.ts:137 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L137>`__
`addon.ts:535 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L535>`__

View File

@ -4,15 +4,20 @@ Interface Tensor
.. code-block:: ts
interface Tensor {
data: number[];
getData(): number[];
data: SupportedTypedArray;
getData(): SupportedTypedArray;
getElementType(): element;
getShape(): number[];
getSize(): number;
}
The ``Tensor`` is a lightweight class that represents data used for
inference. There are different ways to create a tensor. You can find them
in :doc:`TensorConstructor <TensorConstructor>` section.
* **Defined in:**
`addon.ts:88 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L88>`__
`addon.ts:265 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L265>`__
Properties
@ -27,6 +32,17 @@ Properties
data: SupportedTypedArray
This property provides access to the tensor's data.
Its getter returns a subclass of TypedArray that corresponds to the
tensor element type, e.g. ``Float32Array`` corresponds to ``float32``. The
content of the ``TypedArray`` subclass is a copy of the tensor underlaying
memory.
Its setter fills the underlaying tensor memory by copying the binary data
buffer from the ``TypedArray`` subclass. An exception will be thrown if the size
or type of array does not match the tensor.
- **Defined in:**
`addon.ts:89 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L89>`__
@ -41,12 +57,17 @@ Methods
.. code-block:: ts
getData(): number[]
getData(): SupportedTypedArray;
* **Returns:** number[]
It gets tensor data.
* **Returns:** SupportedTypedArray
A subclass of ``TypedArray`` corresponding to the tensor
element type, e.g. ``Float32Array`` corresponds to float32.
* **Defined in:**
`addon.ts:92 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L92>`__
`addon.ts:356 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L356>`__
.. rubric:: getElementType
@ -56,10 +77,12 @@ Methods
getElementType(): element
It gets the tensor element type.
* **Returns:** :doc:`element <../enums/element>`
* **Defined in:**
`addon.ts:90 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L90>`__
`addon.ts:350 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L350>`__
.. rubric:: getShape
@ -70,10 +93,12 @@ Methods
getShape(): number[]
It gets the tensor shape.
* **Returns:** number[]
* **Defined in:**
`addon.ts:91 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L91>`__
`addon.ts:360 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L360>`__
.. rubric:: getSize
@ -84,8 +109,10 @@ Methods
getSize(): number[]
It gets the tensor size as a total number of elements.
* **Returns:** number[]
* **Defined in:**
`addon.ts:93 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L93>`__
`addon.ts:364 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L364>`__

View File

@ -4,11 +4,19 @@ Interface TensorConstructor
.. code-block:: ts
interface TensorConstructor {
new Tensor(type, shape, tensorData?): Tensor;
new TensorConstructor (type, shape): Tensor;
new TensorConstructor (type, shape, tensorData): Tensor;
}
This interface contains constructors of the :doc:`Tensor <Tensor>` class.
The tensor memory is shared with the ``TypedArray``. That is,
the responsibility for maintaining the reference to the ``TypedArray`` lies with
the user. Any action performed on the ``TypedArray`` will be reflected in this
tensor memory.
* **Defined in:**
`addon.ts:94 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L94>`__
`addon.ts:376 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L376>`__
Constructors
@ -21,20 +29,50 @@ Constructors
.. code-block:: ts
new Tensor(type, shape, tensorData?): Tensor
new TensorConstructor(type, shape): Tensor
It constructs a tensor using the element type and shape. The new tensor data
will be allocated by default.
* **Parameters:**
- type: :doc:`elementTypeString <../types/elementTypeString>` | :doc:`element <../enums/element>`
The element type of the new tensor.
- shape: number[]
- ``Optional``
.. code-block:: ts
tensorData: number[]|SupportedTypedArray
The shape of the new tensor.
* **Returns:** :doc:`Tensor <Tensor>`
* **Defined in:**
`addon.ts:95 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L95>`__
`addon.ts:383 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L383>`__
.. code-block:: ts
new TensorConstructor(type, shape, tensorData): Tensor
It constructs a tensor using the element type and shape. The new tensor wraps
allocated host memory.
* **Parameters:**
- type: :doc:`elementTypeString <../types/elementTypeString>` | :doc:`element <../enums/element>`
The element type of the new tensor.
- shape: number[]
The shape of the new tensor.
- tensorData: SupportedTypedArray
A subclass of TypedArray that will be wrapped by a :doc:`Tensor <Tensor>`
* **Returns:** :doc:`Tensor <Tensor>`
* **Defined in:**
`addon.ts:392 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L392>`__

View File

@ -6,5 +6,5 @@ Type alias Dimension
Dimension: number|[number,number]
* **Defined in:**
`addon.ts:115 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L115>`__
`addon.ts:513 <https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/node/lib/addon.ts#L513>`__