From dbf51deeb7f706cc12d00813520de164254e68a8 Mon Sep 17 00:00:00 2001 From: yangyingchun Date: Wed, 10 Sep 2025 22:01:49 +0800 Subject: [PATCH] feature/arkTS static mindspore Signed-off-by: yangyingchun --- api/@ohos.ai.mindSporeLite.d.ts | 419 ++++++++++++++++++++------------ 1 file changed, 270 insertions(+), 149 deletions(-) diff --git a/api/@ohos.ai.mindSporeLite.d.ts b/api/@ohos.ai.mindSporeLite.d.ts index 8c1f5ac3a6..50b8f5c1df 100644 --- a/api/@ohos.ai.mindSporeLite.d.ts +++ b/api/@ohos.ai.mindSporeLite.d.ts @@ -16,15 +16,20 @@ /** * @file * @kit MindSporeLiteKit + * @arkts 1.1&1.2 */ import { Callback } from './@ohos.base'; +/*** if arkts 1.1 */ +import { int, double } from '@ohos.base'; +/*** endif */ /** * @namespace mindSporeLite * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ declare namespace mindSporeLite { /** @@ -34,7 +39,8 @@ declare namespace mindSporeLite { * @returns { Promise } the promise returned by the function. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromFile( model: string, @@ -46,7 +52,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromFile( model: string, callback: Callback): void; @@ -58,7 +65,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromFile( model: string, @@ -71,7 +79,8 @@ declare namespace mindSporeLite { * @returns { Promise } the promise returned by the function. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromBuffer( model: ArrayBuffer, @@ -83,7 +92,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromBuffer( model: ArrayBuffer, callback: Callback): void; @@ -95,49 +105,53 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromBuffer( model: ArrayBuffer, context: Context, callback: Callback): void; - /** + /** * Creates a Model instance file description - * @param { number } model - model indicates model file description to be loaded + * @param { int } model - model indicates model file description to be loaded * @param { Context } [context] - context indicates model context information * @returns { Promise } the promise returned by the function. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromFd( - model: number, + model: int, context?: Context): Promise; /** * Create a Model instance from file description - * @param { number } model - model indicates model file description to be loaded + * @param { int } model - model indicates model file description to be loaded * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromFd( - model: number, callback: Callback): void; - + model: int, callback: Callback): void; + /** * Create a Model instance from file description - * @param { number } model - model indicates model file description to be loaded + * @param { int } model - model indicates model file description to be loaded * @param { Context } context - context indicates model context information * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadModelFromFd( - model: number, - context: Context, callback: Callback): void; - + model: int, + context: Context, callback: Callback): void; + /** * Load train model from file * @param { string } model - model file path @@ -146,7 +160,8 @@ declare namespace mindSporeLite { * @returns { Promise } the promise of the built model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadTrainModelFromFile( model: string, @@ -161,7 +176,8 @@ declare namespace mindSporeLite { * @returns { Promise } the promise of the built model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadTrainModelFromBuffer( model: ArrayBuffer, @@ -170,16 +186,17 @@ declare namespace mindSporeLite { /** * Load train model from file description - * @param { number } model - model file description + * @param { int } model - model file description * @param { TrainCfg } [trainCfg] - model train configuration * @param { Context } [context] - model build context * @returns { Promise } the promise of the built model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function loadTrainModelFromFd( - model: number, + model: int, trainCfg?: TrainCfg, context?: Context): Promise; @@ -188,24 +205,27 @@ declare namespace mindSporeLite { * @typedef Model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ interface Model { /** * The learning rate of the training model - * @type {?number} + * @type {?double} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - learningRate?: number; + learningRate?: double; /** * The running mode of the model * @type {?boolean} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ trainMode?: boolean; @@ -214,7 +234,8 @@ declare namespace mindSporeLite { * @returns { MSTensor[] } the MSTensor array of the inputs. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ getInputs(): MSTensor[]; @@ -224,7 +245,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of MSTensor array. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ predict(inputs: MSTensor[], callback: Callback): void; @@ -234,20 +256,22 @@ declare namespace mindSporeLite { * @returns { Promise } the promise returned by the function. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ predict(inputs: MSTensor[]): Promise; /** * resize model input * @param { MSTensor[] } inputs - indicates the MSTensor array of the inputs. - * @param { Array> } dims - indicates the target new shape array + * @param { Array> } dims - indicates the target new shape array * @returns { boolean } the boolean result if the resize operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - resize(inputs: MSTensor[], dims: Array>): boolean; + resize(inputs: MSTensor[], dims: Array>): boolean; /** * Train model by step @@ -255,7 +279,8 @@ declare namespace mindSporeLite { * @returns { boolean } the boolean result if the runStep operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ runStep(inputs: MSTensor[]): boolean; @@ -264,7 +289,8 @@ declare namespace mindSporeLite { * @returns { MSTensor[] } the weight tensors of the model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ getWeights(): MSTensor[]; @@ -274,21 +300,23 @@ declare namespace mindSporeLite { * @returns { boolean } the boolean result if updating weights operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ updateWeights(weights: MSTensor[]): boolean; /** * Setup training with virtual batches - * @param { number } virtualBatchMultiplier - virtual batch multiplier, use any number < 1 to disable - * @param { number } lr - learning rate to use for virtual batch, -1 for internal configuration - * @param { number } momentum - batch norm momentum to use for virtual batch, -1 for internal configuration + * @param { int } virtualBatchMultiplier - virtual batch multiplier, use any number < 1 to disable + * @param { double } lr - learning rate to use for virtual batch, -1 for internal configuration + * @param { double } momentum - batch norm momentum to use for virtual batch, -1 for internal configuration * @returns { boolean } the boolean result if the operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - setupVirtualBatch(virtualBatchMultiplier: number, lr: number, momentum: number): boolean; + setupVirtualBatch(virtualBatchMultiplier: int, lr: double, momentum: double): boolean; /** * Export train model to file @@ -299,7 +327,8 @@ declare namespace mindSporeLite { * @returns { boolean } - the boolean result if the operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ exportModel( modelFile: string, @@ -316,7 +345,8 @@ declare namespace mindSporeLite { * @returns { boolean } the boolean result if the operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ exportWeightsCollaborateWithMicro( weightFile: string, @@ -327,68 +357,77 @@ declare namespace mindSporeLite { /** * Enum for quantization type - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum QuantizationType { /** * No quantization. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ NO_QUANT = 0, /** * Weight quantization. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ WEIGHT_QUANT = 1, /** * Full quantization. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ FULL_QUANT = 2, } /** * Enum for optimization level - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum OptimizationLevel { /** * Do not change * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ O0 = 0, /** * Cast network to float16, keep batch norm and loss in float32 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ O2 = 2, /** * Cast network to float16, including batch norm * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ O3 = 3, /** * Choose optimization based on device * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ AUTO = 4, } @@ -398,7 +437,8 @@ declare namespace mindSporeLite { * @typedef TrainCfg * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ interface TrainCfg { /** @@ -406,7 +446,8 @@ declare namespace mindSporeLite { * @type {?string[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ lossName?: string[], /** @@ -414,7 +455,8 @@ declare namespace mindSporeLite { * @type {?OptimizationLevel} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ optimizationLevel?: OptimizationLevel, } @@ -424,7 +466,8 @@ declare namespace mindSporeLite { * @typedef Context * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ interface Context { /** @@ -432,7 +475,8 @@ declare namespace mindSporeLite { * @type {?string[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ target?: string[]; /** @@ -440,7 +484,8 @@ declare namespace mindSporeLite { * @type {?CpuDevice} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ cpu?: CpuDevice; /** @@ -448,7 +493,8 @@ declare namespace mindSporeLite { * @type {?NNRTDevice} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ nnrt?: NNRTDevice; } @@ -458,122 +504,141 @@ declare namespace mindSporeLite { * @typedef CpuDevice * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ interface CpuDevice { /** * The thread num - * @type {?number} + * @type {?int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - threadNum?: number; + threadNum?: int; + /** * The thread affinity mode * @type {?ThreadAffinityMode} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ threadAffinityMode?: ThreadAffinityMode; + /** * The thread affinity core list - * @type {?number[]} + * @type {?int[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - threadAffinityCoreList?: number[]; + threadAffinityCoreList?: int[]; + /** * The precision mode * @type {?string} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ precisionMode?: string; } /** * Enum for performance mode - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum PerformanceMode { /** * No performance mode preference * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PERFORMANCE_NONE = 0, /** * Low power consumption mode * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PERFORMANCE_LOW = 1, /** * Medium performance mode * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PERFORMANCE_MEDIUM = 2, /** * High performance mode * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PERFORMANCE_HIGH = 3, /** * Ultimate performance mode * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PERFORMANCE_EXTREME = 4, } /** * Enum for scheduling priority - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum Priority { /** * No priority preference * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PRIORITY_NONE = 0, /** * Low priority * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PRIORITY_LOW = 1, /** * Medium priority * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PRIORITY_MEDIUM = 2, /** * High priority * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ PRIORITY_HIGH = 3, } @@ -583,7 +648,8 @@ declare namespace mindSporeLite { * @typedef Extension * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ interface Extension { /** @@ -591,7 +657,8 @@ declare namespace mindSporeLite { * @type {string} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ name: string, /** @@ -599,24 +666,27 @@ declare namespace mindSporeLite { * @type {ArrayBuffer} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ value: ArrayBuffer } /** * Enum for nnrt device type - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum NNRTDeviceType { /** * Devices that are not CPU, GPU, or dedicated accelerator * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ NNRTDEVICE_OTHERS = 0, @@ -624,7 +694,8 @@ declare namespace mindSporeLite { * CPU device * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ NNRTDEVICE_CPU = 1, @@ -632,7 +703,8 @@ declare namespace mindSporeLite { * GPU device * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ NNRTDEVICE_GPU = 2, @@ -640,7 +712,8 @@ declare namespace mindSporeLite { * Dedicated hardware accelerator * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ NNRTDEVICE_ACCELERATOR = 3, } @@ -650,7 +723,8 @@ declare namespace mindSporeLite { * @typedef NNRTDeviceDescription * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ interface NNRTDeviceDescription { /** @@ -658,7 +732,8 @@ declare namespace mindSporeLite { * @returns { bigint } the number of device id * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceID() : bigint; /** @@ -666,7 +741,8 @@ declare namespace mindSporeLite { * @returns { NNRTDeviceType } the device type * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceType() : NNRTDeviceType; /** @@ -674,7 +750,8 @@ declare namespace mindSporeLite { * @returns { string } device name * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceName() : string; } @@ -684,7 +761,8 @@ declare namespace mindSporeLite { * @returns { NNRTDeviceDescription[] } the array of NNRTDeviceDescription * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function getAllNNRTDeviceDescriptions() : NNRTDeviceDescription[]; @@ -693,7 +771,8 @@ declare namespace mindSporeLite { * @typedef NNRTDevice * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ interface NNRTDevice { /** @@ -701,7 +780,8 @@ declare namespace mindSporeLite { * @type {?bigint} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ deviceID?: bigint, /** @@ -709,7 +789,8 @@ declare namespace mindSporeLite { * @type {?PerformanceMode} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ performanceMode?: PerformanceMode, /** @@ -717,7 +798,8 @@ declare namespace mindSporeLite { * @type {?Priority} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ priority?: Priority, /** @@ -725,24 +807,27 @@ declare namespace mindSporeLite { * @type {?Extension[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ extensions?: Extension[], } /** * Enum for provides CPU thread affinity mode - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum ThreadAffinityMode { /** * Thread affinity mode is no bind. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NO_AFFINITIES = 0, @@ -750,7 +835,8 @@ declare namespace mindSporeLite { * Thread affinity mode is big cores first * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ BIG_CORES_FIRST = 1, @@ -758,7 +844,8 @@ declare namespace mindSporeLite { * Thread affinity mode is little cores first * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ LITTLE_CORES_FIRST = 2, } @@ -768,7 +855,8 @@ declare namespace mindSporeLite { * @typedef MSTensor * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ interface MSTensor { /** @@ -776,39 +864,48 @@ declare namespace mindSporeLite { * @type {string} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ name: string; + /** * The shape of the tensor. - * @type {number[]} + * @type {int[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - shape: number[]; + shape: int[]; + /** - * The number of elements in the tensor. - * @type {number} + * The data size of the tensor. + * @type {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - elementNum: number; + elementNum: int; + /** * The data size of the tensor. - * @type {number} + * @type {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ - dataSize: number; + dataSize: int; + /** * The data type of the tensor. * @type {DataType} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ dtype: DataType; /** @@ -816,7 +913,8 @@ declare namespace mindSporeLite { * @type {Format} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ format: Format; @@ -825,7 +923,8 @@ declare namespace mindSporeLite { * @returns { ArrayBuffer } the data of tensor * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ getData(): ArrayBuffer; @@ -834,160 +933,182 @@ declare namespace mindSporeLite { * @param { ArrayBuffer } inputArray - indicates the buffer of tensor * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ setData(inputArray: ArrayBuffer): void; } /** * Enum for provides MSTensor data type - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum DataType { /** * data type is unknown * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ TYPE_UNKNOWN = 0, /** * data type is int8 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_INT8 = 32, /** * data type is int16 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_INT16 = 33, /** * data type is int32 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_INT32 = 34, /** * data type is int64 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_INT64 = 35, /** * data type is uint8 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_UINT8 = 37, /** * data type is uint16 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_UINT16 = 38, /** * data type is uint32 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_UINT32 = 39, /** * data type is uint64 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_UINT64 = 40, /** * data type is float16 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_FLOAT16 = 42, /** * data type is float32 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_FLOAT32 = 43, /** * data type is float64 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NUMBER_TYPE_FLOAT64 = 44, } /** * Enum for provides MSTensor format - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum Format { /** * data format is default * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ DEFAULT_FORMAT = -1, /** * data format is NCHW * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NCHW = 0, /** * data format is NHWC * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NHWC = 1, /** * data format is NHWC4 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ NHWC4 = 2, /** * data format is HWKC * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ HWKC = 3, /** * data format is HWCK * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ HWCK = 4, /** * data format is KCHW * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since arkts {'1.1':'10', '1.2':'20'} + * @arkts 1.1&1.2 */ KCHW = 5, } -- Gitee