diff --git a/docs/sphinx_setup/api/nodejs_api/addon.rst b/docs/sphinx_setup/api/nodejs_api/addon.rst index a24c1a52d68..9a0c650686d 100644 --- a/docs/sphinx_setup/api/nodejs_api/addon.rst +++ b/docs/sphinx_setup/api/nodejs_api/addon.rst @@ -51,7 +51,7 @@ The **openvino-node** package exports ``addon`` which contains the following pro } * **Defined in:** - `addon.ts:192 `__ + `addon.ts:591 `__ Properties @@ -71,7 +71,7 @@ Properties - CoreConstructor: :doc:`CoreConstructor <./openvino-node/interfaces/CoreConstructor>` - **Defined in:** - `addon.ts:193 `__ + `addon.ts:592 `__ .. rubric:: PartialShape @@ -87,7 +87,7 @@ Properties - PartialShapeConstructor: :doc:`PartialShapeConstructor <./openvino-node/interfaces/PartialShapeConstructor>` - **Defined in:** - `addon.ts:195 `__ + `addon.ts:594 `__ .. rubric:: Tensor @@ -102,7 +102,7 @@ Properties - TensorConstructor: :doc:`TensorConstructor <./openvino-node/interfaces/TensorConstructor>` - **Defined in:** - `addon.ts:194 `__ + `addon.ts:593 `__ .. rubric:: element @@ -118,7 +118,7 @@ Properties - element: typeof :doc:`element <./openvino-node/enums/element>` - **Defined in:** - `addon.ts:201 `__ + `addon.ts:600 `__ .. rubric:: preprocess @@ -138,5 +138,5 @@ Properties - resizeAlgorithm: typeof :doc:`resizeAlgorithm <./openvino-node/enums/resizeAlgorithm>` - **Defined in:** - `addon.ts:169 `__ + `addon.ts:596 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/enums/element.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/enums/element.rst index c4ae4a03e67..b2c2f601ff5 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/enums/element.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/enums/element.rst @@ -10,7 +10,7 @@ Enumeration element f32: number * **Defined in:** - `addon.ts:182 `__ + `addon.ts:580 `__ .. rubric:: f64 @@ -22,7 +22,7 @@ Enumeration element f64: number * **Defined in:** - `addon.ts:183 `__ + `addon.ts:581 `__ .. rubric:: i16 @@ -34,7 +34,7 @@ Enumeration element i16: number * **Defined in:** - `addon.ts:179 `__ + `addon.ts:577 `__ .. rubric:: i32 @@ -46,7 +46,7 @@ Enumeration element i32: number * **Defined in:** - `addon.ts:180 `__ + `addon.ts:578 `__ .. rubric:: i64 @@ -58,7 +58,7 @@ Enumeration element i64: number * **Defined in:** - `addon.ts:181 `__ + `addon.ts:579 `__ .. rubric:: i8 @@ -70,7 +70,7 @@ Enumeration element i8: number * **Defined in:** - `addon.ts:178 `__ + `addon.ts:576 `__ .. rubric:: string @@ -82,7 +82,7 @@ Enumeration element string: string * **Defined in:** - `addon.ts:176 `__ + `addon.ts:582 `__ .. rubric:: u16 @@ -94,7 +94,7 @@ Enumeration element u16: number * **Defined in:** - `addon.ts:176 `__ + `addon.ts:574 `__ .. rubric:: u32 @@ -106,7 +106,7 @@ Enumeration element u32: number * **Defined in:** - `addon.ts:175 `__ + `addon.ts:573 `__ .. rubric:: u64 @@ -118,7 +118,7 @@ Enumeration element u64: number * **Defined in:** - `addon.ts:177 `__ + `addon.ts:575 `__ .. rubric:: u8 @@ -130,5 +130,5 @@ Enumeration element u8: number * **Defined in:** - `addon.ts:174 `__ + `addon.ts:572 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/enums/resizeAlgorithm.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/enums/resizeAlgorithm.rst index e36b9f8ad13..c7222edc597 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/enums/resizeAlgorithm.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/enums/resizeAlgorithm.rst @@ -10,7 +10,7 @@ Enumeration resizeAlgorithm RESIZE_CUBIC: number - **Defined in:** - `addon.ts:188 `__ + `addon.ts:587 `__ .. rubric:: RESIZE_LINEAR @@ -22,7 +22,7 @@ Enumeration resizeAlgorithm RESIZE_LINEAR: number - **Defined in:** - `addon.ts:189 `__ + `addon.ts:588 `__ .. rubric:: RESIZE_NEAREST @@ -34,5 +34,5 @@ Enumeration resizeAlgorithm RESIZE_NEAREST: number - **Defined in:** - `addon.ts:187 `__ + `addon.ts:586 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/CompiledModel.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/CompiledModel.rst index 0346c14bc90..cd479a1a859 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/CompiledModel.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/CompiledModel.rst @@ -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 `__ + `addon.ts:272 `__ Properties @@ -28,8 +35,10 @@ Properties inputs: Output [] + It gets all inputs of a compiled model. + - **Defined in:** - `addon.ts:67 `__ + `addon.ts:274 `__ .. rubric:: outputs @@ -40,8 +49,10 @@ Properties outputs: Output [] + It gets all outputs of a compiled model. + - **Defined in:** - `addon.ts:66 `__ + `addon.ts:276 `__ 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 ` - **Defined in:** - `addon.ts:84 `__ + `addon.ts:281 `__ .. rubric:: exportModelSync + :name: exportModelSync .. container:: m-4 @@ -73,7 +88,7 @@ Methods * **Returns:** Buffer - **Defined in:** - `addon.ts:85 `__ + `addon.ts:288 `__ .. 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 ` + + A compiled model input. + + * **Defined in:** + `addon.ts:312 `__ + + + .. 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 ` - * **Returns:** :doc:`InferRequest ` + A compiled model input. * **Defined in:** - `addon.ts:83 `__ + `addon.ts:318 `__ + + + .. 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 ` + + A compiled model input. + + * **Defined in:** + `addon.ts:324 `__ .. 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 ` - * **Defined in:** - `addon.ts:82 `__ + A compiled model output. + + * **Defined in:** + `addon.ts:294 `__ + + + .. 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 ` + + A compiled model output. + + * **Defined in:** + `addon.ts:300 `__ + + + .. 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 ` + + A compiled model output. + + * **Defined in:** + `addon.ts:306 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Core.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Core.rst index 8cb00bf7cfd..2b654648428 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Core.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Core.rst @@ -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; + compileModel(modelPath, deviceName, config?): Promise; 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; readModel(modelBuffer, weightsBuffer?): Promise; 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 `__ + `addon.ts:32 `__ 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 `__ + + .. rubric:: compileModel .. container:: m-4 .. code-block:: ts - compileModel(model, device, config?): Promise + compileModel(model, deviceName, config?): Promise + + Asynchronously creates a compiled model from a source :doc:`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 ` - - device: string + - model: :doc:`Model ` + + The :doc:`Model ` object acquired from :ref:`Core.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 ` \> + + * **Defined in:** + `addon.ts:48 `__ + + + .. code-block:: ts + + compileModel(modelPath, deviceName, config?): Promise + + 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 ` + :ref:`core.compileModel(Model) ` + 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 ` + + 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 ` \> * **Defined in:** - `addon.ts:24 `__ + `addon.ts:67 `__ .. 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 `. + It creates a compiled model from a source model object. * **Parameters:** - model: :doc:`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 ` * **Defined in:** - `addon.ts:29 `__ + `addon.ts:76 `__ + + + .. code-block:: ts + + compileModelSync(modelPath, deviceName, config?): CompiledModel + + A synchronous version of :ref:`Core.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 ` + + * **Defined in:** + `addon.ts:85 `__ .. 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 `__ + `addon.ts:99 `__ .. 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 `__ + `addon.ts:104 `__ .. 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 `__ + `addon.ts:111 `__ + + +.. 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 `__ .. 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 ` 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 `__ + - ``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 ` * **Defined in:** - `addon.ts:40 `__ + `addon.ts:135 `__ .. rubric:: readModel + :name: readModel .. container:: m-4 @@ -183,19 +357,33 @@ Methods readModel(modelPath, weightsPath?): Promise + 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 `\ > + 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 `\ > * **Defined in:** - `addon.ts:34 `__ + `addon.ts:152 `__ .. container:: m-4 @@ -203,19 +391,26 @@ Methods readModel(modelBuffer, weightsBuffer?): Promise + 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 `\ > * **Defined in:** - `addon.ts:35 `__ + `addon.ts:160 `__ .. 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 ` + * **Returns:** Promise<\ :doc:`Model `\ > * **Defined in:** - `addon.ts:37 `__ + `addon.ts:166 `__ -.. container:: m-4 .. code-block:: ts @@ -258,7 +457,7 @@ Methods * **Returns:** :doc:`Model ` * **Defined in:** - `addon.ts:38 `__ + `addon.ts:171 `__ .. 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 `__ + `addon.ts:176 `__ -.. 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 `__ + `addon.ts:182 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/CoreConstructor.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/CoreConstructor.rst index e7473e47c0f..881c46798f9 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/CoreConstructor.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/CoreConstructor.rst @@ -4,11 +4,11 @@ Interface CoreConstructor .. code-block:: ts interface CoreConstructor { - new Core(): Core; + new CoreConstructor(): Core; } * **Defined in:** - `addon.ts:40 `__ + `addon.ts:187 `__ Constructors @@ -21,10 +21,10 @@ Constructors .. code-block:: ts - new Core(): Core + new CoreConstructor(): Core * **Returns:** :doc:`Core ` * **Defined in:** - `addon.ts:41 `__ + `addon.ts:188 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InferRequest.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InferRequest.rst index f33500ac0d7..8a080eefc7f 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InferRequest.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InferRequest.rst @@ -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 ` 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 `__ + `addon.ts:402 `__ Methods @@ -35,10 +52,12 @@ Methods getCompiledModel(): CompiledModel + It gets the compiled model used by the InferRequest object. + * **Returns:** :doc:`CompiledModel ` * **Defined in:** - `addon.ts:112 `__ + `addon.ts:439 `__ .. 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 ` + The input tensor for the model. If the model has several inputs, + an exception is thrown. + * **Defined in:** - `addon.ts:106 `__ + `addon.ts:445 `__ + + + .. 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 ` + + 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 `__ .. 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 ` + + 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 `__ + + + .. 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 ` + 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 `__ + `addon.ts:465 `__ .. 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 ` + - nameOrOutput: string | :doc:`Output ` + + The name of the tensor or output object. * **Returns:** :doc:`Tensor ` * **Defined in:** - `addon.ts:105 `__ + `addon.ts:474 `__ .. 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 ` or + :ref:`InferRequest.setInputTensor ` * **Returns:** @@ -134,10 +200,78 @@ Methods [outputName: string]: Tensor; } - - [outputName: string]: Tensor * **Defined in:** - `addon.ts:108 `__ + `addon.ts:409 `__ + + + .. 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 `__ + + + .. 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 `__ .. 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 `__ + `addon.ts:434 `__ + .. 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 ` - - - ``Optional`` - - .. code-block:: ts - - tensor: Tensor + - :doc:`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 `__ + `addon.ts:481 `__ + + + .. 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 ` + + 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 `__ + .. 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 ` - - ``Optional`` - - .. code-block:: ts - - tensor: Tensor + - :doc:`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 `__ + `addon.ts:496 `__ + + + .. code-block:: ts + + setOutputTensor(idx, tensor): void + + It sets the output tensor to infer. + + * **Parameters:** + + - idx: number + + The output tensor index. + + - :doc:`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 `__ + .. 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 ` + 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 `__ + `addon.ts:510 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputInfo.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputInfo.rst index dcbe7390a9d..293fe7881f2 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputInfo.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputInfo.rst @@ -10,7 +10,7 @@ Interface InputInfo } * **Defined in:** - `addon.ts:144 `__ + `addon.ts:542 `__ Methods ##################### @@ -26,7 +26,7 @@ Methods * **Returns:** :doc:`InputModelInfo ` * **Defined in:** - `addon.ts:147 `__ + `addon.ts:545 `__ .. rubric:: preprocess @@ -40,7 +40,7 @@ Methods * **Returns:** :doc:`PreProcessSteps ` * **Defined in:** - `addon.ts:146 `__ + `addon.ts:544 `__ .. rubric:: tensor @@ -54,5 +54,5 @@ Methods * **Returns:** :doc:`InputTensorInfo ` * **Defined in:** - `addon.ts:145 `__ + `addon.ts:543 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputModelInfo.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputModelInfo.rst index 789da988db8..e14c422b8d3 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputModelInfo.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputModelInfo.rst @@ -8,7 +8,7 @@ Interface InputModelInfo } * **Defined in:** - `addon.ts:140 `__ + `addon.ts:538 `__ Methods ##################### @@ -28,5 +28,5 @@ Methods * **Returns:** :doc:`InputModelInfo ` * **Defined in:** - `addon.ts:141 `__ + `addon.ts:539 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputTensorInfo.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputTensorInfo.rst index 8708b57cb4e..5e7bf5ae608 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputTensorInfo.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/InputTensorInfo.rst @@ -10,7 +10,7 @@ Interface InputTensorInfo } * **Defined in:** - `addon.ts:126 `__ + `addon.ts:524 `__ Methods @@ -32,7 +32,7 @@ Methods * **Returns:** :doc:`InputTensorInfo ` * **Defined in:** - `addon.ts:127 `__ + `addon.ts:525 `__ .. rubric:: setLayout @@ -50,7 +50,7 @@ Methods * **Returns:** :doc:`InputTensorInfo ` * **Defined in:** - `addon.ts:128 `__ + `addon.ts:526 `__ .. rubric:: setShape @@ -68,5 +68,5 @@ Methods * **Returns:** :doc:`InputTensorInfo ` * **Defined in:** - `addon.ts:129 `__ + `addon.ts:527 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Model.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Model.rst index 0bdd18ffa20..83048f7a83a 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Model.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Model.rst @@ -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 `. + * **Defined in:** - `addon.ts:68 `__ + `addon.ts:191 `__ Properties @@ -29,7 +39,7 @@ Properties inputs: Output[] - **Defined in:** - `addon.ts:70 `__ + `addon.ts:193 `__ .. rubric:: outputs @@ -41,13 +51,32 @@ Properties outputs: Output[] - **Defined in:** - `addon.ts:69 `__ + `addon.ts:192 `__ 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 `, a unique model name is returned. + + * **Returns:** string + + A string with a friendly name of the model. + + * **Defined in:** + `addon.ts:200 `__ + + .. 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 `__ + `addon.ts:196 `__ + + +.. 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 `__ + + +.. 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 `__ .. 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 ` + + * **Defined in:** + `addon.ts:219 `__ + + + .. 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 ` * **Defined in:** - `addon.ts:72 `__ + `addon.ts:224 `__ + + + .. 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 ` + + * **Defined in:** + `addon.ts:229 `__ .. 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 `__ + `addon.ts:234 `__ .. rubric:: output @@ -118,5 +223,23 @@ Methods * **Returns:** :doc:`Output ` * **Defined in:** - `addon.ts:71 `__ + `addon.ts:194 `__ + +.. rubric:: setFriendlyName + :name: setFriendlyName + +.. container:: m-4 + + .. code-block:: ts + + setFriendlyName(name): void + + * **Parameters:** + + - name: string + + * **Returns:** void + + * **Defined in:** + `addon.ts:199 `__ \ No newline at end of file diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Output.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Output.rst index 6c8487880b6..b9cab763b96 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Output.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Output.rst @@ -14,7 +14,7 @@ Interface Output } * **Defined in:** - `addon.ts:117 `__ + `addon.ts:515 `__ Properties @@ -31,7 +31,7 @@ Properties anyName: string - **Defined in:** - `addon.ts:118 `__ + `addon.ts:516 `__ @@ -44,7 +44,7 @@ Properties shape: number[] - **Defined in:** - `addon.ts:119 `__ + `addon.ts:517 `__ Methods @@ -62,7 +62,7 @@ Methods * **Returns:** string * **Defined in:** - `addon.ts:121 `__ + `addon.ts:519 `__ .. rubric:: getPartialShape @@ -75,7 +75,7 @@ Methods * **Returns:** :doc:`PartialShape ` * **Defined in:** - `addon.ts:123 `__ + `addon.ts:521 `__ .. rubric:: getShape @@ -88,7 +88,7 @@ Methods * **Returns:** number[] * **Defined in:** - `addon.ts:122 `__ + `addon.ts:520 `__ .. rubric:: toString @@ -101,5 +101,5 @@ Methods * **Returns:** string * **Defined in:** - `addon.ts:120 `__ + `addon.ts:518 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/OutputInfo.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/OutputInfo.rst index 6c7e5b41ceb..31abb00a759 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/OutputInfo.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/OutputInfo.rst @@ -8,7 +8,7 @@ Interface OutputInfo } * **Defined in:** - `addon.ts:150 `__ + `addon.ts:548 `__ Methods @@ -26,5 +26,5 @@ Methods * **Returns** :doc:`OutputTensorInfo ` * **Defined in:** - `addon.ts:151 `__ + `addon.ts:549 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/OutputTensorInfo.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/OutputTensorInfo.rst index 7ce6c7c177e..400927d03a0 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/OutputTensorInfo.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/OutputTensorInfo.rst @@ -9,7 +9,7 @@ Interface OutputTensorInfo } * **Defined in:** - `addon.ts:132 `__ + `addon.ts:530 `__ Methods @@ -31,7 +31,7 @@ Methods * **Returns** :doc:`InputTensorInfo ` * **Defined in:** - `addon.ts:133 `__ + `addon.ts:531 `__ .. rubric:: setLayout @@ -48,5 +48,5 @@ Methods * **Returns:** :doc:`InputTensorInfo ` * **Defined in:** - `addon.ts:134 `__ + `addon.ts:532 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PartialShape.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PartialShape.rst index 52a57545781..fd326949423 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PartialShape.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PartialShape.rst @@ -11,7 +11,7 @@ Interface PartialShape } * **Defined in:** - `addon.ts:163 `__ + `addon.ts:561 `__ Methods @@ -29,7 +29,7 @@ Methods * **Returns:** :doc:`Dimension <../types/Dimension>`\[] * **Defined in:** - `addon.ts:167 `__ + `addon.ts:565 `__ .. rubric:: isDynamic @@ -43,7 +43,7 @@ Methods * **Returns:** boolean * **Defined in:** - `addon.ts:165 `__ + `addon.ts:563 `__ .. rubric:: isStatic @@ -57,7 +57,7 @@ Methods * **Returns:** boolean * **Defined in:** - `addon.ts:164 `__ + `addon.ts:562 `__ .. rubric:: toString @@ -71,5 +71,5 @@ Methods * **Returns:** string * **Defined in:** - `addon.ts:166 `__ + `addon.ts:564 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PartialShapeConstructor.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PartialShapeConstructor.rst index a2a3022d897..4c83fa238ee 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PartialShapeConstructor.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PartialShapeConstructor.rst @@ -4,11 +4,11 @@ Interface PartialShapeConstructor .. code-block:: ts interface PartialShapeConstructor { - new PartialShape(shape): PartialShape; + new PartialShapeConstructor(shape): PartialShape; } * **Defined in:** - `addon.ts:169 `__ + `addon.ts:567 `__ 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 ` - **Defined in** - `addon.ts:170 `__ + `addon.ts:568 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PrePostProcessor.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PrePostProcessor.rst index ea888149cba..623d46cc1c7 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PrePostProcessor.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PrePostProcessor.rst @@ -10,7 +10,7 @@ Interface PrePostProcessor } * **Defined in:** - `addon.ts:154 `__ + `addon.ts:552 `__ Methods @@ -28,7 +28,7 @@ Methods * **Returns:** :doc:`PrePostProcessor ` * **Defined in:** - `addon.ts:155 `__ + `addon.ts:553 `__ .. rubric:: input @@ -50,7 +50,7 @@ Methods * **Returns:** :doc:`InputInfo ` * **Defined in:** - `addon.ts:156 `__ + `addon.ts:554 `__ .. rubric:: output @@ -71,5 +71,5 @@ Methods * **Returns:** :doc:`OutputInfo ` * **Defined in:** - `addon.ts:157 `__ + `addon.ts:555 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PrePostProcessorConstructor.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PrePostProcessorConstructor.rst index 4dead22c340..4444e48877d 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PrePostProcessorConstructor.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PrePostProcessorConstructor.rst @@ -4,11 +4,11 @@ Interface PrePostProcessorConstructor .. code-block:: ts interface PrePostProcessorConstructor { - new PrePostProcessor(model): PrePostProcessor; + new PrePostProcessorConstructor(model): PrePostProcessor; } * **Defined in:** - `addon.ts:159 `__ + `addon.ts:557 `__ 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 ` * **Defined in:** - `addon.ts:160 `__ + `addon.ts:558 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PreProcessSteps.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PreProcessSteps.rst index 4baae7aa003..cb1bd0e3346 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PreProcessSteps.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/PreProcessSteps.rst @@ -9,7 +9,7 @@ Interface PreProcessSteps } * **Defined in:** - `addon.ts:136 `__ + `addon.ts:534 `__ Methods @@ -31,5 +31,5 @@ Methods * **Returns:** :doc:`PreProcessSteps ` * **Defined in:** - `addon.ts:137 `__ + `addon.ts:535 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Tensor.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Tensor.rst index 02df24694e1..80dfccce435 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Tensor.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/Tensor.rst @@ -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 ` section. + * **Defined in:** - `addon.ts:88 `__ + `addon.ts:265 `__ 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 `__ @@ -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 `__ + `addon.ts:356 `__ .. 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 `__ + `addon.ts:350 `__ .. rubric:: getShape @@ -70,10 +93,12 @@ Methods getShape(): number[] + It gets the tensor shape. + * **Returns:** number[] * **Defined in:** - `addon.ts:91 `__ + `addon.ts:360 `__ .. 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 `__ + `addon.ts:364 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/TensorConstructor.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/TensorConstructor.rst index ae9c87e1336..456a3337d86 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/TensorConstructor.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/interfaces/TensorConstructor.rst @@ -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 ` 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 `__ + `addon.ts:376 `__ 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 ` * **Defined in:** - `addon.ts:95 `__ + `addon.ts:383 `__ + + + .. 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 ` + + * **Returns:** :doc:`Tensor ` + + * **Defined in:** + `addon.ts:392 `__ diff --git a/docs/sphinx_setup/api/nodejs_api/openvino-node/types/Dimension.rst b/docs/sphinx_setup/api/nodejs_api/openvino-node/types/Dimension.rst index 67866e08aa3..bf688969bf5 100644 --- a/docs/sphinx_setup/api/nodejs_api/openvino-node/types/Dimension.rst +++ b/docs/sphinx_setup/api/nodejs_api/openvino-node/types/Dimension.rst @@ -6,5 +6,5 @@ Type alias Dimension Dimension: number|[number,number] * **Defined in:** - `addon.ts:115 `__ + `addon.ts:513 `__