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.

common.h 2.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * Copyright 2019 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 PREDICT_COMMON_COMMON_H_
  17. #define PREDICT_COMMON_COMMON_H_
  18. #include <string>
  19. #include "schema/inner/ms_generated.h"
  20. namespace mindspore {
  21. namespace predict {
  22. enum NCHW_SHAPE { NCHW_N = 0, NCHW_C = 1, NCHW_H = 2, NCHW_W = 3 };
  23. enum NHWC_SHAPE { NHWC_N = 0, NHWC_H = 1, NHWC_W = 2, NHWC_C = 3 };
  24. enum HWCK_SHAPE { HWCK_H = 0, HWCK_W = 1, HWCK_C = 2, HWCK_K = 3 };
  25. enum KCHW_SHAPE { KCHW_K = 0, KCHW_C = 1, KCHW_H = 2, KCHW_W = 3 };
  26. enum CHW_SHAPE { CHW_C = 0, CHW_H = 1, CHW_W = 2 };
  27. enum HWC_SHAPE { HWC_H = 0, HWC_W = 1, HWC_C = 2 };
  28. static constexpr int TENSOR_MAX_REFCOUNT = 999;
  29. static const char *DELIM_COLON = ":";
  30. static const char *DELIM_COMMA = ",";
  31. static const char *DELIM_SLASH = "/";
  32. static const char *DELIM_DOUBLE_BACKSLASH = "\\";
  33. // quantization relative
  34. static const char QUANTIZED_UINT8[] = "QUANTIZED_UINT8";
  35. static const char QUANTIZED_INT8[] = "QUANTIZED_INT8";
  36. static const char QUANTIZED_INT16[] = "QUANTIZED_INT16";
  37. static const char QUANTIZED_UINT16[] = "QUANTIZED_UINT16";
  38. static const char QUANTIZED_FLOAT16[] = "FLOAT16";
  39. static const char QUANTIZED_FLOAT32[] = "FLOAT32";
  40. static const char QUANTIZATION_TYPE_DYNAMIC[] = "DYNAMIC";
  41. static const char QUANTIZATION_TYPE_STATIC[] = "STATIC";
  42. static const char CALIB_NORM[] = "NORM";
  43. // dims
  44. static const int32_t DIM_DEFAULT_SIZE = 4;
  45. static const Format DEFAULT_FORMAT = Format_NCHW;
  46. } // namespace predict
  47. } // namespace mindspore
  48. #endif // PREDICT_COMMON_COMMON_H_