From 7617653dbdc9aa041ba65a93718e5b680acc6821 Mon Sep 17 00:00:00 2001 From: yangyingchun Date: Thu, 11 Sep 2025 19:08:03 +0800 Subject: [PATCH] feature/mindspore arkTS static Signed-off-by: yangyingchun --- api/@ohos.ai.mindSporeLite.d.ts | 412 ++++++++++++++++++++------------ 1 file changed, 264 insertions(+), 148 deletions(-) diff --git a/api/@ohos.ai.mindSporeLite.d.ts b/api/@ohos.ai.mindSporeLite.d.ts index 8c1f5ac3a6..dd20883b6c 100644 --- a/api/@ohos.ai.mindSporeLite.d.ts +++ b/api/@ohos.ai.mindSporeLite.d.ts @@ -24,7 +24,8 @@ import { Callback } from './@ohos.base'; * @namespace mindSporeLite * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ declare namespace mindSporeLite { /** @@ -34,7 +35,8 @@ declare namespace mindSporeLite { * @returns { Promise } the promise returned by the function. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ function loadModelFromFile( model: string, @@ -46,7 +48,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ function loadModelFromFile( model: string, callback: Callback): void; @@ -58,7 +61,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ function loadModelFromFile( model: string, @@ -71,7 +75,8 @@ declare namespace mindSporeLite { * @returns { Promise } the promise returned by the function. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ function loadModelFromBuffer( model: ArrayBuffer, @@ -83,7 +88,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ function loadModelFromBuffer( model: ArrayBuffer, callback: Callback): void; @@ -95,7 +101,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ function loadModelFromBuffer( model: ArrayBuffer, @@ -103,41 +110,44 @@ declare namespace mindSporeLite { /** * 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 10 dynamic + * @since 22 static */ 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 10 dynamic + * @since 22 static */ 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 10 dynamic + * @since 22 static */ 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 +156,8 @@ declare namespace mindSporeLite { * @returns { Promise } the promise of the built model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ function loadTrainModelFromFile( model: string, @@ -161,7 +172,8 @@ declare namespace mindSporeLite { * @returns { Promise } the promise of the built model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ function loadTrainModelFromBuffer( model: ArrayBuffer, @@ -170,16 +182,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 12 dynamic + * @since 22 static */ function loadTrainModelFromFd( - model: number, + model: int, trainCfg?: TrainCfg, context?: Context): Promise; @@ -188,24 +201,27 @@ declare namespace mindSporeLite { * @typedef Model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ interface Model { /** * The learning rate of the training model - * @type {?number} + * @type {?double} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ - learningRate?: number; + learningRate?: double; /** * The running mode of the model * @type {?boolean} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ trainMode?: boolean; @@ -214,7 +230,8 @@ declare namespace mindSporeLite { * @returns { MSTensor[] } the MSTensor array of the inputs. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ getInputs(): MSTensor[]; @@ -224,7 +241,8 @@ declare namespace mindSporeLite { * @param { Callback } callback - the callback of MSTensor array. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ predict(inputs: MSTensor[], callback: Callback): void; @@ -234,20 +252,22 @@ declare namespace mindSporeLite { * @returns { Promise } the promise returned by the function. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ 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 10 dynamic + * @since 22 static */ - resize(inputs: MSTensor[], dims: Array>): boolean; + resize(inputs: MSTensor[], dims: Array>): boolean; /** * Train model by step @@ -255,7 +275,8 @@ declare namespace mindSporeLite { * @returns { boolean } the boolean result if the runStep operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ runStep(inputs: MSTensor[]): boolean; @@ -264,7 +285,8 @@ declare namespace mindSporeLite { * @returns { MSTensor[] } the weight tensors of the model * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ getWeights(): MSTensor[]; @@ -274,21 +296,23 @@ declare namespace mindSporeLite { * @returns { boolean } the boolean result if updating weights operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ 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 12 dynamic + * @since 22 static */ - setupVirtualBatch(virtualBatchMultiplier: number, lr: number, momentum: number): boolean; + setupVirtualBatch(virtualBatchMultiplier: int, lr: double, momentum: double): boolean; /** * Export train model to file @@ -299,7 +323,8 @@ declare namespace mindSporeLite { * @returns { boolean } - the boolean result if the operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ exportModel( modelFile: string, @@ -316,7 +341,8 @@ declare namespace mindSporeLite { * @returns { boolean } the boolean result if the operation is successful * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ exportWeightsCollaborateWithMicro( weightFile: string, @@ -327,68 +353,77 @@ declare namespace mindSporeLite { /** * Enum for quantization type - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ export enum QuantizationType { /** * No quantization. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ NO_QUANT = 0, /** * Weight quantization. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ WEIGHT_QUANT = 1, /** * Full quantization. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ FULL_QUANT = 2, } /** * Enum for optimization level - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ export enum OptimizationLevel { /** * Do not change * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ O0 = 0, /** * Cast network to float16, keep batch norm and loss in float32 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ O2 = 2, /** * Cast network to float16, including batch norm * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ O3 = 3, /** * Choose optimization based on device * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ AUTO = 4, } @@ -398,7 +433,8 @@ declare namespace mindSporeLite { * @typedef TrainCfg * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ interface TrainCfg { /** @@ -406,7 +442,8 @@ declare namespace mindSporeLite { * @type {?string[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ lossName?: string[], /** @@ -414,7 +451,8 @@ declare namespace mindSporeLite { * @type {?OptimizationLevel} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ optimizationLevel?: OptimizationLevel, } @@ -424,7 +462,8 @@ declare namespace mindSporeLite { * @typedef Context * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ interface Context { /** @@ -432,7 +471,8 @@ declare namespace mindSporeLite { * @type {?string[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ target?: string[]; /** @@ -440,7 +480,8 @@ declare namespace mindSporeLite { * @type {?CpuDevice} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ cpu?: CpuDevice; /** @@ -448,7 +489,8 @@ declare namespace mindSporeLite { * @type {?NNRTDevice} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ nnrt?: NNRTDevice; } @@ -458,122 +500,140 @@ declare namespace mindSporeLite { * @typedef CpuDevice * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ interface CpuDevice { /** * The thread num - * @type {?number} + * @type {?int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ - threadNum?: number; + threadNum?: int; + /** * The thread affinity mode * @type {?ThreadAffinityMode} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ threadAffinityMode?: ThreadAffinityMode; /** * The thread affinity core list - * @type {?number[]} + * @type {?int[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ - threadAffinityCoreList?: number[]; + threadAffinityCoreList?: int[]; + /** * The precision mode * @type {?string} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ precisionMode?: string; } /** * Enum for performance mode - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ export enum PerformanceMode { /** * No performance mode preference * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PERFORMANCE_NONE = 0, /** * Low power consumption mode * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PERFORMANCE_LOW = 1, /** * Medium performance mode * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PERFORMANCE_MEDIUM = 2, /** * High performance mode * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PERFORMANCE_HIGH = 3, /** * Ultimate performance mode * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PERFORMANCE_EXTREME = 4, } /** * Enum for scheduling priority - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ export enum Priority { /** * No priority preference * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PRIORITY_NONE = 0, /** * Low priority * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PRIORITY_LOW = 1, /** * Medium priority * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PRIORITY_MEDIUM = 2, /** * High priority * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ PRIORITY_HIGH = 3, } @@ -583,7 +643,8 @@ declare namespace mindSporeLite { * @typedef Extension * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ interface Extension { /** @@ -591,7 +652,8 @@ declare namespace mindSporeLite { * @type {string} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ name: string, /** @@ -599,24 +661,27 @@ declare namespace mindSporeLite { * @type {ArrayBuffer} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ value: ArrayBuffer } /** * Enum for nnrt device type - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ export enum NNRTDeviceType { /** * Devices that are not CPU, GPU, or dedicated accelerator * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ NNRTDEVICE_OTHERS = 0, @@ -624,7 +689,8 @@ declare namespace mindSporeLite { * CPU device * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ NNRTDEVICE_CPU = 1, @@ -632,7 +698,8 @@ declare namespace mindSporeLite { * GPU device * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ NNRTDEVICE_GPU = 2, @@ -640,7 +707,8 @@ declare namespace mindSporeLite { * Dedicated hardware accelerator * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ NNRTDEVICE_ACCELERATOR = 3, } @@ -650,7 +718,8 @@ declare namespace mindSporeLite { * @typedef NNRTDeviceDescription * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ interface NNRTDeviceDescription { /** @@ -658,7 +727,8 @@ declare namespace mindSporeLite { * @returns { bigint } the number of device id * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ deviceID() : bigint; /** @@ -666,7 +736,8 @@ declare namespace mindSporeLite { * @returns { NNRTDeviceType } the device type * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ deviceType() : NNRTDeviceType; /** @@ -674,7 +745,8 @@ declare namespace mindSporeLite { * @returns { string } device name * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ deviceName() : string; } @@ -684,7 +756,8 @@ declare namespace mindSporeLite { * @returns { NNRTDeviceDescription[] } the array of NNRTDeviceDescription * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ function getAllNNRTDeviceDescriptions() : NNRTDeviceDescription[]; @@ -693,7 +766,8 @@ declare namespace mindSporeLite { * @typedef NNRTDevice * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ interface NNRTDevice { /** @@ -701,7 +775,8 @@ declare namespace mindSporeLite { * @type {?bigint} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ deviceID?: bigint, /** @@ -709,7 +784,8 @@ declare namespace mindSporeLite { * @type {?PerformanceMode} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ performanceMode?: PerformanceMode, /** @@ -717,7 +793,8 @@ declare namespace mindSporeLite { * @type {?Priority} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ priority?: Priority, /** @@ -725,24 +802,27 @@ declare namespace mindSporeLite { * @type {?Extension[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 12 + * @since 12 dynamic + * @since 22 static */ extensions?: Extension[], } /** * Enum for provides CPU thread affinity mode - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ export enum ThreadAffinityMode { /** * Thread affinity mode is no bind. * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NO_AFFINITIES = 0, @@ -750,7 +830,8 @@ declare namespace mindSporeLite { * Thread affinity mode is big cores first * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ BIG_CORES_FIRST = 1, @@ -758,7 +839,8 @@ declare namespace mindSporeLite { * Thread affinity mode is little cores first * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ LITTLE_CORES_FIRST = 2, } @@ -768,7 +850,8 @@ declare namespace mindSporeLite { * @typedef MSTensor * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ interface MSTensor { /** @@ -776,39 +859,48 @@ declare namespace mindSporeLite { * @type {string} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ name: string; + /** * The shape of the tensor. - * @type {number[]} + * @type {int[]} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ - 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 10 dynamic + * @since 22 static */ - elementNum: number; + elementNum: int; + /** * The data size of the tensor. - * @type {number} + * @type {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ - dataSize: number; + dataSize: int; + /** * The data type of the tensor. * @type {DataType} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ dtype: DataType; /** @@ -816,7 +908,8 @@ declare namespace mindSporeLite { * @type {Format} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ format: Format; @@ -825,7 +918,8 @@ declare namespace mindSporeLite { * @returns { ArrayBuffer } the data of tensor * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ getData(): ArrayBuffer; @@ -834,160 +928,182 @@ declare namespace mindSporeLite { * @param { ArrayBuffer } inputArray - indicates the buffer of tensor * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ setData(inputArray: ArrayBuffer): void; } /** * Enum for provides MSTensor data type - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ export enum DataType { /** * data type is unknown * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ TYPE_UNKNOWN = 0, /** * data type is int8 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_INT8 = 32, /** * data type is int16 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_INT16 = 33, /** * data type is int32 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_INT32 = 34, /** * data type is int64 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_INT64 = 35, /** * data type is uint8 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_UINT8 = 37, /** * data type is uint16 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_UINT16 = 38, /** * data type is uint32 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_UINT32 = 39, /** * data type is uint64 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_UINT64 = 40, /** * data type is float16 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_FLOAT16 = 42, /** * data type is float32 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_FLOAT32 = 43, /** * data type is float64 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NUMBER_TYPE_FLOAT64 = 44, } /** * Enum for provides MSTensor format - * @enum {number} + * @enum {int} * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ export enum Format { /** * data format is default * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ DEFAULT_FORMAT = -1, /** * data format is NCHW * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NCHW = 0, /** * data format is NHWC * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NHWC = 1, /** * data format is NHWC4 * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ NHWC4 = 2, /** * data format is HWKC * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ HWKC = 3, /** * data format is HWCK * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ HWCK = 4, /** * data format is KCHW * @syscap SystemCapability.AI.MindSporeLite * @stagemodelonly - * @since 10 + * @since 10 dynamic + * @since 22 static */ KCHW = 5, } -- Gitee