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_base.h 2.6 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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_BASE
  17. #define ACL_STUB_INC_ACL_BASE
  18. #include <stdint.h>
  19. #include <stddef.h>
  20. typedef void *aclrtStream;
  21. typedef void *aclrtEvent;
  22. typedef void *aclrtContext;
  23. typedef int aclError;
  24. typedef uint16_t aclFloat16;
  25. typedef struct aclDataBuffer aclDataBuffer;
  26. typedef struct aclTensorDesc aclTensorDesc;
  27. const int ACL_ERROR_NONE = 0;
  28. typedef enum {
  29. ACL_DT_UNDEFINED = -1,
  30. ACL_FLOAT = 0,
  31. ACL_FLOAT16 = 1,
  32. ACL_INT8 = 2,
  33. ACL_INT32 = 3,
  34. ACL_UINT8 = 4,
  35. ACL_INT16 = 6,
  36. ACL_UINT16 = 7,
  37. ACL_UINT32 = 8,
  38. ACL_INT64 = 9,
  39. ACL_UINT64 = 10,
  40. ACL_DOUBLE = 11,
  41. ACL_BOOL = 12,
  42. } aclDataType;
  43. typedef enum {
  44. ACL_FORMAT_UNDEFINED = -1,
  45. ACL_FORMAT_NCHW = 0,
  46. ACL_FORMAT_NHWC = 1,
  47. ACL_FORMAT_ND = 2,
  48. ACL_FORMAT_NC1HWC0 = 3,
  49. ACL_FORMAT_FRACTAL_Z = 4,
  50. ACL_FORMAT_FRACTAL_NZ = 29,
  51. } aclFormat;
  52. typedef enum {
  53. ACL_DEBUG,
  54. ACL_INFO,
  55. ACL_WARNING,
  56. ACL_ERROR,
  57. } aclLogLevel;
  58. aclDataBuffer *aclCreateDataBuffer(void *data, size_t size);
  59. aclError aclDestroyDataBuffer(const aclDataBuffer *dataBuffer);
  60. void *aclGetDataBufferAddr(const aclDataBuffer *dataBuffer);
  61. uint32_t aclGetDataBufferSize(const aclDataBuffer *dataBuffer);
  62. size_t aclDataTypeSize(aclDataType dataType);
  63. aclTensorDesc *aclCreateTensorDesc(aclDataType dataType, int numDims, const int64_t *dims, aclFormat format);
  64. void aclDestroyTensorDesc(const aclTensorDesc *desc);
  65. aclDataType aclGetTensorDescType(const aclTensorDesc *desc);
  66. aclFormat aclGetTensorDescFormat(const aclTensorDesc *desc);
  67. size_t aclGetTensorDescSize(const aclTensorDesc *desc);
  68. size_t aclGetTensorDescElementCount(const aclTensorDesc *desc);
  69. size_t aclGetTensorDescNumDims(const aclTensorDesc *desc);
  70. int64_t aclGetTensorDescDim(const aclTensorDesc *desc, size_t index);
  71. void aclAppLog(aclLogLevel logLevel, const char *func, const char *file, uint32_t line, const char *fmt, ...);
  72. #define ACL_APP_LOG(level, fmt, ...) aclAppLog(level, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
  73. #endif