You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

acl_mdl.h 3.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef ACL_STUB_INC_ACL_MDL
  17. #define ACL_STUB_INC_ACL_MDL
  18. #include "acl_base.h"
  19. #define ACL_MAX_DIM_CNT 128
  20. #define ACL_MAX_TENSOR_NAME_LEN 128
  21. #define ACL_MAX_BATCH_NUM 128
  22. #define ACL_MAX_HW_NUM 128
  23. #define ACL_MAX_SHAPE_COUNT 128
  24. typedef struct aclmdlDataset aclmdlDataset;
  25. typedef struct aclmdlDesc aclmdlDesc;
  26. typedef struct aclmdlIODims {
  27. char name[ACL_MAX_TENSOR_NAME_LEN];
  28. size_t dimCount;
  29. int64_t dims[ACL_MAX_DIM_CNT];
  30. } aclmdlIODims;
  31. aclmdlDesc *aclmdlCreateDesc();
  32. aclError aclmdlDestroyDesc(aclmdlDesc *modelDesc);
  33. aclError aclmdlGetDesc(aclmdlDesc *modelDesc, uint32_t modelId);
  34. size_t aclmdlGetNumInputs(aclmdlDesc *modelDesc);
  35. size_t aclmdlGetNumOutputs(aclmdlDesc *modelDesc);
  36. size_t aclmdlGetInputSizeByIndex(aclmdlDesc *modelDesc, size_t index);
  37. size_t aclmdlGetOutputSizeByIndex(aclmdlDesc *modelDesc, size_t index);
  38. aclmdlDataset *aclmdlCreateDataset();
  39. aclError aclmdlDestroyDataset(const aclmdlDataset *dataSet);
  40. aclError aclmdlAddDatasetBuffer(aclmdlDataset *dataSet, aclDataBuffer *dataBuffer);
  41. size_t aclmdlGetDatasetNumBuffers(const aclmdlDataset *dataSet);
  42. aclDataBuffer *aclmdlGetDatasetBuffer(const aclmdlDataset *dataSet, size_t index);
  43. aclError aclmdlLoadFromFile(const char *modelPath, uint32_t *modelId);
  44. aclError aclmdlLoadFromMem(const void *model, size_t modelSize, uint32_t *modelId);
  45. aclError aclmdlLoadFromFileWithMem(const char *modelPath, uint32_t *modelId, void *workPtr, size_t workSize,
  46. void *weightPtr, size_t weightSize);
  47. aclError aclmdlLoadFromMemWithMem(const void *model, size_t modelSize, uint32_t *modelId, void *workPtr,
  48. size_t workSize, void *weightPtr, size_t weightSize);
  49. aclError aclmdlExecute(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output);
  50. aclError aclmdlExecuteAsync(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output, aclrtStream stream);
  51. aclError aclmdlUnload(uint32_t modelId);
  52. aclError aclmdlQuerySize(const char *fileName, size_t *workSize, size_t *weightSize);
  53. aclError aclmdlQuerySizeFromMem(const void *model, size_t modelSize, size_t *workSize, size_t *weightSize);
  54. aclError aclmdlGetInputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims);
  55. aclError aclmdlGetOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims);
  56. aclError aclmdlGetCurOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims);
  57. aclFormat aclmdlGetInputFormat(const aclmdlDesc *modelDesc, size_t index);
  58. aclFormat aclmdlGetOutputFormat(const aclmdlDesc *modelDesc, size_t index);
  59. aclDataType aclmdlGetInputDataType(const aclmdlDesc *modelDesc, size_t index);
  60. aclDataType aclmdlGetOutputDataType(const aclmdlDesc *modelDesc, size_t index);
  61. #endif