1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { Callback } from './@ohos.base'; 17 18/** 19 * @namespace mindSporeLite 20 * @syscap SystemCapability.AI.MindSporeLite 21 * @stagemodelonly 22 * @since 10 23 */ 24declare namespace mindSporeLite { 25 /** 26 * Create a Model instance from file path 27 * @param { string } model - model indicates model path to be loaded 28 * @param { Context } context - context indicates model context information 29 * @returns { Promise<Model> } the promise returned by the function. 30 * @syscap SystemCapability.AI.MindSporeLite 31 * @stagemodelonly 32 * @since 10 33 */ 34 function loadModelFromFile( 35 model: string, 36 context?: Context): Promise<Model>; 37 38 /** 39 * Create a Model instance from file path. 40 * @param { string } model - model indicates model path to be loaded 41 * @param { callback: Callback<Model> } callback - the callback of model 42 * @syscap SystemCapability.AI.MindSporeLite 43 * @stagemodelonly 44 * @since 10 45 */ 46 function loadModelFromFile( 47 model: string, callback: Callback<Model>): void; 48 49 /** 50 * Create a Model instance from file path. 51 * @param { string } model - model indicates model path to be loaded 52 * @param { Context } [context] - context indicates model context information 53 * @param { callback: Callback<Model> } callback - the callback of model 54 * @syscap SystemCapability.AI.MindSporeLite 55 * @stagemodelonly 56 * @since 10 57 */ 58 function loadModelFromFile( 59 model: string, 60 context: Context, callback: Callback<Model>): void; 61 62 /** 63 * Create a Model instance from buffer 64 * @param { ArrayBuffer } model - model indicates model buffer to be loaded 65 * @param { Context } context - context indicates model context information 66 * @returns { Promise<Model> } the promise returned by the function. 67 * @syscap SystemCapability.AI.MindSporeLite 68 * @stagemodelonly 69 * @since 10 70 */ 71 function loadModelFromBuffer( 72 model: ArrayBuffer, 73 context?: Context): Promise<Model>; 74 75 /** 76 * Create a Model instance from buffer 77 * @param { ArrayBuffer } model - model indicates model buffer to be loaded 78 * @param { callback: Callback<Model> } callback - the callback of model 79 * @syscap SystemCapability.AI.MindSporeLite 80 * @stagemodelonly 81 * @since 10 82 */ 83 function loadModelFromBuffer( 84 model: ArrayBuffer, callback: Callback<Model>): void; 85 86 /** 87 * Create a Model instance from buffer 88 * @param { ArrayBuffer } model - model indicates model buffer to be loaded 89 * @param { Context } [context] - context indicates model context information 90 * @param { callback: Callback<Model> } callback - the callback of model 91 * @syscap SystemCapability.AI.MindSporeLite 92 * @stagemodelonly 93 * @since 10 94 */ 95 function loadModelFromBuffer( 96 model: ArrayBuffer, 97 context: Context, callback: Callback<Model>): void; 98 99 /** 100 * Creates a Model instance file description 101 * @param { number } model - model indicates model file description to be loaded 102 * @param { Context } context - context indicates model context information 103 * @returns { Promise<Model> } the promise returned by the function. 104 * @syscap SystemCapability.AI.MindSporeLite 105 * @stagemodelonly 106 * @since 10 107 */ 108 function loadModelFromFd( 109 model: number, 110 context?: Context): Promise<Model>; 111 112 /** 113 * Create a Model instance from file description 114 * @param { number } model - model indicates model file description to be loaded 115 * @param { callback: Callback<Model> } callback - the callback of model 116 * @syscap SystemCapability.AI.MindSporeLite 117 * @stagemodelonly 118 * @since 10 119 */ 120 function loadModelFromFd( 121 model: number, callback: Callback<Model>): void; 122 123 /** 124 * Create a Model instance from file description 125 * @param { number } model - model indicates model file description to be loaded 126 * @param { Context } [context] - context indicates model context information 127 * @param { callback: Callback<Model> } callback - the callback of model 128 * @syscap SystemCapability.AI.MindSporeLite 129 * @stagemodelonly 130 * @since 10 131 */ 132 function loadModelFromFd( 133 model: number, 134 context: Context, callback: Callback<Model>): void; 135 136 /** 137 * Load train model from file 138 * @param { string } model - model file path 139 * @param { ?TrainCfg } trainCfg - model train configuration 140 * @param { ?Context } context - model build context 141 * @returns { Promise<Model> } the promise of the built model 142 * @syscap SystemCapability.AI.MindSporeLite 143 * @stagemodelonly 144 * @since 11 145 */ 146 function loadTrainModelFromFile( 147 model: string, 148 trainCfg?: TrainCfg, 149 context?: Context): Promise<Model>; 150 151 /** 152 * Load train model from buffer 153 * @param { ArrayBuffer } model - model buffer 154 * @param { ?TrainCfg } trainCfg - model train configuration 155 * @param { ?Context } context - model build context 156 * @returns { Promise<Model> } the promise of the built model 157 * @syscap SystemCapability.AI.MindSporeLite 158 * @stagemodelonly 159 * @since 11 160 */ 161 function loadTrainModelFromBuffer( 162 model: ArrayBuffer, 163 trainCfg?: TrainCfg, 164 context?: Context): Promise<Model>; 165 166 /** 167 * Load train model from file description 168 * @param { number } model - model file description 169 * @param { ?TrainCfg } trainCfg - model train configuration 170 * @param { ?Context } context - model build context 171 * @returns { Promise<Model> } the promise of the built model 172 * @syscap SystemCapability.AI.MindSporeLite 173 * @stagemodelonly 174 * @since 11 175 */ 176 function loadTrainModelFromFd( 177 model: number, 178 trainCfg?: TrainCfg, 179 context?: Context): Promise<Model>; 180 181 /** 182 * Provides manages model function. Including get inputs, predict ,resize. 183 * @typedef Model 184 * @syscap SystemCapability.AI.MindSporeLite 185 * @stagemodelonly 186 * @since 10 187 */ 188 interface Model { 189 /** 190 * The learning rate of the training model 191 * @type {?number} 192 * @syscap SystemCapability.AI.MindSporeLite 193 * @since 11 194 */ 195 learningRate?: number, 196 197 /** 198 * The running mode of the model 199 * @type {?boolean} 200 * @syscap SystemCapability.AI.MindSporeLite 201 * @since 11 202 */ 203 trainMode?: boolean, 204 205 /** 206 * Get model input tensors. 207 * @returns { MSTensor[] } the MSTensor array of the inputs. 208 * @syscap SystemCapability.AI.MindSporeLite 209 * @stagemodelonly 210 * @since 10 211 */ 212 getInputs(): MSTensor[]; 213 214 /** 215 * Infer model 216 * @param { MSTensor[] } inputs - indicates the MSTensor array of the inputs. 217 * @param { callback: Callback<MSTensor[]> } callback - the callback of MSTensor array. 218 * @syscap SystemCapability.AI.MindSporeLite 219 * @stagemodelonly 220 * @since 10 221 */ 222 predict(inputs: MSTensor[], callback: Callback<MSTensor[]>): void; 223 224 /** 225 * Infer model 226 * @param { MSTensor[] } inputs - indicates the MSTensor array of the inputs. 227 * @returns { Promise<MSTensor[]> } the promise returned by the function. 228 * @syscap SystemCapability.AI.MindSporeLite 229 * @stagemodelonly 230 * @since 10 231 */ 232 predict(inputs: MSTensor[]): Promise<MSTensor[]>; 233 234 /** 235 * resize model input 236 * @param { MSTensor[] } inputs - indicates the MSTensor array of the inputs. 237 * @param { Array<Array<number>> } dims - indicates the target new shape array 238 * @returns { boolean } the boolean result if the resize operation is successful 239 * @syscap SystemCapability.AI.MindSporeLite 240 * @stagemodelonly 241 * @since 10 242 */ 243 resize(inputs: MSTensor[], dims: Array<Array<number>>): boolean; 244 245 /** 246 * Train model by step 247 * @syscap SystemCapability.AI.MindSporeLite 248 * @returns { boolean } the boolean result if the runStep operation is successful 249 * @stagemodelonly 250 * @since 11 251 */ 252 runStep(): boolean; 253 254 /** 255 * Obtain all weights of the model 256 * @syscap SystemCapability.AI.MindSporeLite 257 * @returns { MSTensor[] } the weight tensors of the model 258 * @stagemodelonly 259 * @since 11 260 */ 261 getWeights(): MSTensor[]; 262 263 /** 264 * Update weights of the model 265 * @param { MSTensor[] } weights - indicates the MSTensor array of the inputs 266 * @returns { boolean } the boolean result if updating weights operation is successful 267 * @syscap SystemCapability.AI.MindSporeLite 268 * @stagemodelonly 269 * @since 11 270 */ 271 updateWeights(weights: MSTensor[]): boolean; 272 273 /** 274 * Setup training with virtual batches 275 * @param { number } virtualBatchMultiplier - virtual batch multiplier, use any number < 1 to disable 276 * @param { number } lr - learning rate to use for virtual batch, -1 for internal configuration 277 * @param { number } momentum - batch norm momentum to use for virtual batch, -1 for internal configuration 278 * @returns { boolean } the boolean result if the operation is successful 279 * @syscap SystemCapability.AI.MindSporeLite 280 * @stagemodelonly 281 * @since 11 282 */ 283 setupVirtualBatch(virtualBatchMultiplier: number, lr: number, momentum: number): boolean; 284 285 /** 286 * Export train model to file 287 * @param { string } modelFile - model file path. 288 * @param { ?QuantizationType } quantizationType - the quantization type, default NO_QUANT. 289 * @param { ?boolean } exportInferenceOnly - whether to export a inference only model, default true. 290 * @param { ?string[] } outputTensorName - the set of name of output tensor the exported inference model, 291 * @returns { boolean } - the boolean result if the operation is successful 292 * @syscap SystemCapability.AI.MindSporeLite 293 * @stagemodelonly 294 * @since 11 295 */ 296 exportModel( 297 modelFile: string, 298 quantizationType?: QuantizationType, 299 exportInferenceOnly?: boolean, 300 outputTensorName?: string[]): boolean; 301 302 /** 303 * Export model's weights, which can be used in micro only. Only valid for Lite Train 304 * @param { string } weightFile - weight file path 305 * @param { ?boolean } isInference - whether to export weights from inference model, only support this is `true` for now, default true 306 * @param { ?boolean } enableFp16 - float-weight is whether to be saved in float16 format, default false 307 * @param { ?string[] } changeableWeightsName - changeable weights name 308 * @returns { boolean } the boolean result if the operation is successful 309 * @syscap SystemCapability.AI.MindSporeLite 310 * @stagemodelonly 311 * @since 11 312 */ 313 exportWeightsCollaborateWithMicro( 314 weightFile: string, 315 isInference?: boolean, 316 enableFp16?: boolean, 317 changeableWeightsName?: string[]): boolean; 318 } 319 320 export enum QuantizationType { 321 /** 322 * No quantization. 323 * @syscap SystemCapability.AI.MindSporeLite 324 * @since 11 325 */ 326 NO_QUANT = 0, 327 /** 328 * Weight quantization. 329 * @syscap SystemCapability.AI.MindSporeLite 330 * @since 11 331 */ 332 WEIGHT_QUANT = 1, 333 /** 334 * Full quantization. 335 * @syscap SystemCapability.AI.MindSporeLite 336 * @since 11 337 */ 338 FULL_QUANT = 2, 339 } 340 export enum OptimizationLevel { 341 /** 342 * Do not change 343 * @syscap SystemCapability.AI.MindSporeLite 344 * @since 11 345 */ 346 O0 = 0, 347 /** 348 * Cast network to float16, keep batchnorm and loss in float32 349 * @syscap SystemCapability.AI.MindSporeLite 350 * @since 11 351 */ 352 O2 = 2, 353 /** 354 * Cast network to float16, including bacthnorm 355 * @syscap SystemCapability.AI.MindSporeLite 356 * @since 11 357 */ 358 O3 = 3, 359 /** 360 * Choose optimization based on device 361 * @syscap SystemCapability.AI.MindSporeLite 362 * @since 11 363 */ 364 AUTO = 4, 365 } 366 367 interface TrainCfg { 368 /** 369 * Array of loss name 370 * @type {?string[]} 371 * @syscap SystemCapability.AI.MindSporeLite 372 * @since 11 373 */ 374 lossName?: string[], 375 /** 376 * Train optimization level 377 * @type {?OptimizationLevel} 378 * @syscap SystemCapability.AI.MindSporeLite 379 * @since 11 380 */ 381 optimizationLevel?: OptimizationLevel, 382 } 383 384 /** 385 * Provides the device configurations 386 * @typedef Context 387 * @syscap SystemCapability.AI.MindSporeLite 388 * @stagemodelonly 389 * @since 10 390 */ 391 interface Context { 392 /** 393 * The target device 394 * @type {?string[]} 395 * @syscap SystemCapability.AI.MindSporeLite 396 * @since 10 397 */ 398 target?: string[]; 399 /** 400 * The cpu device information 401 * @type {?CpuDevice} 402 * @syscap SystemCapability.AI.MindSporeLite 403 * @since 10 404 */ 405 cpu?: CpuDevice; 406 /** 407 * The NNRT device information 408 * @type {?NNRTDevice} 409 * @since 10 410 */ 411 nnrt?: NNRTDevice; 412 } 413 414 /** 415 * Provides the CPU device info 416 * @typedef CpuDevice 417 * @syscap SystemCapability.AI.MindSporeLite 418 * @stagemodelonly 419 * @since 10 420 */ 421 interface CpuDevice { 422 /** 423 * The thread num 424 * @type {?number} 425 * @syscap SystemCapability.AI.MindSporeLite 426 * @since 10 427 */ 428 threadNum?: number; 429 /** 430 * The thread affinity mode 431 * @type {?ThreadAffinityMode} 432 * @syscap SystemCapability.AI.MindSporeLite 433 * @since 10 434 */ 435 threadAffinityMode?: ThreadAffinityMode; 436 /** 437 * The thread affinity core list 438 * @type {?number[]} 439 * @syscap SystemCapability.AI.MindSporeLite 440 * @since 10 441 */ 442 threadAffinityCoreList?: number[]; 443 /** 444 * The precision mode 445 * @type {?string} 446 * @syscap SystemCapability.AI.MindSporeLite 447 * @since 10 448 */ 449 precisionMode?: string; 450 } 451 452 export enum PerformanceMode { 453 /** 454 * No performance mode preference 455 * @syscap SystemCapability.AI.MindSporeLite 456 * @since 11 457 */ 458 PERFORMANCE_NONE = 0, 459 /** 460 * Low power consumption mode 461 * @syscap SystemCapability.AI.MindSporeLite 462 * @since 11 463 */ 464 PERFORMANCE_LOW = 1, 465 /** 466 * Medium performance mode 467 * @syscap SystemCapability.AI.MindSporeLite 468 * @since 11 469 */ 470 PERFORMANCE_MEDIUM = 2, 471 /** 472 * High performance mode 473 * @syscap SystemCapability.AI.MindSporeLite 474 * @since 11 475 */ 476 PERFORMANCE_HIGH = 3, 477 /** 478 * Ultimate performance mode 479 * @syscap SystemCapability.AI.MindSporeLite 480 * @since 11 481 */ 482 PERFORMANCE_EXTREME = 4, 483 } 484 485 export enum Priority { 486 /** 487 * No priority preference 488 * @syscap SystemCapability.AI.MindSporeLite 489 * @since 11 490 */ 491 PRIORITY_NONE = 0, 492 /** 493 * Low priority 494 * @syscap SystemCapability.AI.MindSporeLite 495 * @since 11 496 */ 497 PRIORITY_LOW = 1, 498 /** 499 * Medium priority 500 * @syscap SystemCapability.AI.MindSporeLite 501 * @since 11 502 */ 503 PRIORITY_MEDIUM = 2, 504 /** 505 * High priority 506 * @syscap SystemCapability.AI.MindSporeLite 507 * @since 11 508 */ 509 PRIORITY_HIGH = 3, 510 } 511 512 interface Extension { 513 /** 514 * Extension name 515 * @type {?string} 516 * @syscap SystemCapability.AI.MindSporeLite 517 * @since 11 518 */ 519 name: String, 520 /** 521 * Extension array buffer 522 * @type {?ArrayBuffer} 523 * @syscap SystemCapability.AI.MindSporeLite 524 * @since 11 525 */ 526 value: ArrayBuffer 527 } 528 529 export enum NNRTDeviceType { 530 /** 531 * Devices that are not CPU, GPU, or dedicated accelerator 532 * @syscap SystemCapability.AI.MindSporeLite 533 * @since 11 534 */ 535 NNRTDEVICE_OTHERS = 0, 536 537 /** 538 * CPU device 539 * @syscap SystemCapability.AI.MindSporeLite 540 * @since 11 541 */ 542 NNRTDEVICE_CPU = 1, 543 544 /** 545 * GPU device 546 * @syscap SystemCapability.AI.MindSporeLite 547 * @since 11 548 */ 549 NNRTDEVICE_GPU = 2, 550 551 /** 552 * Dedicated hardware accelerator 553 * @syscap SystemCapability.AI.MindSporeLite 554 * @since 11 555 */ 556 NNRTDEVICE_ACCELERATOR = 3, 557 } 558 559 interface NNRTDeviceDesc { 560 /** 561 * Get device id 562 * @returns { number } the number of device id 563 * @syscap SystemCapability.AI.MindSporeLite 564 * @stagemodelonly 565 * @since 11 566 */ 567 deviceID() : number; 568 /** 569 * Get device type. 570 * @returns { NNRTDeviceType } the device type 571 * @syscap SystemCapability.AI.MindSporeLite 572 * @stagemodelonly 573 * @since 11 574 */ 575 deviceType() : NNRTDeviceType; 576 /** 577 * Get device name. 578 * @returns { string } device name 579 * @syscap SystemCapability.AI.MindSporeLite 580 * @stagemodelonly 581 * @since 11 582 */ 583 deviceName() : string; 584 } 585 586 /** 587 * Obtain the all device descriptions in NNRT. 588 * @syscap SystemCapability.AI.MindSporeLite 589 * @returns { NNRTDeviceDesc[] } the array of NNRTDeviceDecs 590 * @since 11 591 */ 592 function getAllNNRTDeviceDescs() : NNRTDeviceDesc[]; 593 594 /** 595 * Provides the NNRT device info 596 * @typedef NNRTDevice 597 * @syscap SystemCapability.AI.MindSporeLite 598 * @stagemodelonly 599 * @since 10 600 */ 601 602 interface NNRTDevice { 603 /** 604 * NNRT device id. 605 * @type {?number} 606 * @syscap SystemCapability.AI.MindSporeLite 607 * @since 11 608 */ 609 deviceID?: number, 610 /** 611 * NNRT device performance mode. 612 * @type {?PerformanceMode} 613 * @syscap SystemCapability.AI.MindSporeLite 614 * @since 11 615 */ 616 performanceMode?: PerformanceMode, 617 /** 618 * NNRT device priority. 619 * @type {?Priority} 620 * @syscap SystemCapability.AI.MindSporeLite 621 * @since 11 622 */ 623 priority?: Priority, 624 /** 625 * NNRT device extension array. 626 * @type {?Extension[]} 627 * @syscap SystemCapability.AI.MindSporeLite 628 * @since 11 629 */ 630 extensions?: Extension[], 631 } 632 633 /** 634 * Enum for provides CPU thread affinity mode 635 * @enum {number} 636 * @syscap SystemCapability.AI.MindSporeLite 637 * @stagemodelonly 638 * @since 10 639 */ 640 export enum ThreadAffinityMode { 641 /** 642 * Thread affinity mode is no bind. 643 * @syscap SystemCapability.AI.MindSporeLite 644 * @since 10 645 */ 646 NO_AFFINITIES = 0, 647 648 /** 649 * Thread affinity mode is big cores first 650 * @syscap SystemCapability.AI.MindSporeLite 651 * @since 10 652 */ 653 BIG_CORES_FIRST = 1, 654 655 /** 656 * Thread affinity mode is little cores first 657 * @syscap SystemCapability.AI.MindSporeLite 658 * @since 10 659 */ 660 LITTLE_CORES_FIRST = 2, 661 } 662 663 /** 664 * Provides MSTensor definition 665 * @typedef MSTensor 666 * @syscap SystemCapability.AI.MindSporeLite 667 * @stagemodelonly 668 * @since 10 669 */ 670 interface MSTensor { 671 /** 672 * The name of the tensor. 673 * @type {string} 674 * @syscap SystemCapability.AI.MindSporeLite 675 * @since 10 676 */ 677 name: string; 678 /** 679 * The shape of the tensor. 680 * @type {number[]} 681 * @syscap SystemCapability.AI.MindSporeLite 682 * @since 10 683 */ 684 shape: number[]; 685 /** 686 * The number of elements in the tensor. 687 * @type {number} 688 * @syscap SystemCapability.AI.MindSporeLite 689 * @since 10 690 */ 691 elementNum: number; 692 /** 693 * The data size of the tensor. 694 * @type {number} 695 * @syscap SystemCapability.AI.MindSporeLite 696 * @since 10 697 */ 698 dataSize: number; 699 /** 700 * The data type of the tensor. 701 * @type {DataType} 702 * @syscap SystemCapability.AI.MindSporeLite 703 * @since 10 704 */ 705 dtype: DataType; 706 /** 707 * The format of the tensor. 708 * @type {Format} 709 * @syscap SystemCapability.AI.MindSporeLite 710 * @since 10 711 */ 712 format: Format; 713 714 /** 715 * Get MSTensor data 716 * @returns { ArrayBuffer } the data of tensor 717 * @syscap SystemCapability.AI.MindSporeLite 718 * @stagemodelonly 719 * @since 10 720 */ 721 getData(): ArrayBuffer; 722 723 /** 724 * Set MSTensor data 725 * @param { ArrayBuffer } inputArray - indicates the buffer of tensor 726 * @syscap SystemCapability.AI.MindSporeLite 727 * @stagemodelonly 728 * @since 10 729 */ 730 setData(inputArray: ArrayBuffer): void; 731 } 732 733 /** 734 * Enum for provides MSTensor data type 735 * @enum {number} 736 * @syscap SystemCapability.AI.MindSporeLite 737 * @stagemodelonly 738 * @since 10 739 */ 740 export enum DataType { 741 /** 742 * data type is unknown 743 * @syscap SystemCapability.AI.MindSporeLite 744 * @since 10 745 */ 746 TYPE_UNKNOWN = 0, 747 /** 748 * data type is int8 749 * @syscap SystemCapability.AI.MindSporeLite 750 * @since 10 751 */ 752 NUMBER_TYPE_INT8 = 32, 753 /** 754 * data type is int16 755 * @syscap SystemCapability.AI.MindSporeLite 756 * @since 10 757 */ 758 NUMBER_TYPE_INT16 = 33, 759 /** 760 * data type is int32 761 * @syscap SystemCapability.AI.MindSporeLite 762 * @since 10 763 */ 764 NUMBER_TYPE_INT32 = 34, 765 /** 766 * data type is int64 767 * @syscap SystemCapability.AI.MindSporeLite 768 * @since 10 769 */ 770 NUMBER_TYPE_INT64 = 35, 771 /** 772 * data type is uint8 773 * @syscap SystemCapability.AI.MindSporeLite 774 * @since 10 775 */ 776 NUMBER_TYPE_UINT8 = 37, 777 /** 778 * data type is uint16 779 * @syscap SystemCapability.AI.MindSporeLite 780 * @since 10 781 */ 782 NUMBER_TYPE_UINT16 = 38, 783 /** 784 * data type is uint32 785 * @syscap SystemCapability.AI.MindSporeLite 786 * @since 10 787 */ 788 NUMBER_TYPE_UINT32 = 39, 789 /** 790 * data type is uint64 791 * @syscap SystemCapability.AI.MindSporeLite 792 * @since 10 793 */ 794 NUMBER_TYPE_UINT64 = 40, 795 /** 796 * data type is float16 797 * @syscap SystemCapability.AI.MindSporeLite 798 * @since 10 799 */ 800 NUMBER_TYPE_FLOAT16 = 42, 801 /** 802 * data type is float32 803 * @syscap SystemCapability.AI.MindSporeLite 804 * @since 10 805 */ 806 NUMBER_TYPE_FLOAT32 = 43, 807 /** 808 * data type is float64 809 * @syscap SystemCapability.AI.MindSporeLite 810 * @since 10 811 */ 812 NUMBER_TYPE_FLOAT64 = 44, 813 } 814 815 /** 816 * Enum for provides MSTensor format 817 * @enum {number} 818 * @syscap SystemCapability.AI.MindSporeLite 819 * @stagemodelonly 820 * @since 10 821 */ 822 export enum Format { 823 /** 824 * data format is default 825 * @syscap SystemCapability.AI.MindSporeLite 826 * @since 10 827 */ 828 DEFAULT_FORMAT = -1, 829 /** 830 * data format is NCHW 831 * @syscap SystemCapability.AI.MindSporeLite 832 * @since 10 833 */ 834 NCHW = 0, 835 /** 836 * data format is NHWC 837 * @syscap SystemCapability.AI.MindSporeLite 838 * @since 10 839 */ 840 NHWC = 1, 841 /** 842 * data format is NHWC4 843 * @syscap SystemCapability.AI.MindSporeLite 844 * @since 10 845 */ 846 NHWC4 = 2, 847 /** 848 * data format is HWKC 849 * @syscap SystemCapability.AI.MindSporeLite 850 * @since 10 851 */ 852 HWKC = 3, 853 /** 854 * data format is HWCK 855 * @syscap SystemCapability.AI.MindSporeLite 856 * @since 10 857 */ 858 HWCK = 4, 859 /** 860 * data format is KCHW 861 * @syscap SystemCapability.AI.MindSporeLite 862 * @since 10 863 */ 864 KCHW = 5, 865 } 866} 867export default mindSporeLite; 868