Program Listing for File constants.h

Return to documentation for file (include/constants.h)

#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_CONSTANTS_H_
#define MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_CONSTANTS_H_

#include <cstdint>
#include <limits>
#include <random>

#include "include/api/types.h"

namespace mindspore {
namespace dataset {
// Various type defines for convenience
using uchar = unsigned char;
using dsize_t = int64_t;

enum class  Modulation {
  kSinusoidal = 0,
  kTriangular = 1
};

enum class  Interpolation {
  kLinear = 0,
  kQuadratic = 1
};

enum class  AutoAugmentPolicy {
  kImageNet = 0,
  kCifar10 = 1,
  kSVHN = 2
};

enum class  ConvertMode {
  COLOR_BGR2BGRA = 0,
  COLOR_RGB2RGBA = COLOR_BGR2BGRA,
  COLOR_BGRA2BGR = 1,
  COLOR_RGBA2RGB = COLOR_BGRA2BGR,
  COLOR_BGR2RGBA = 2,
  COLOR_RGB2BGRA = COLOR_BGR2RGBA,
  COLOR_RGBA2BGR = 3,
  COLOR_BGRA2RGB = COLOR_RGBA2BGR,
  COLOR_BGR2RGB = 4,
  COLOR_RGB2BGR = COLOR_BGR2RGB,
  COLOR_BGRA2RGBA = 5,
  COLOR_RGBA2BGRA = COLOR_BGRA2RGBA,
  COLOR_BGR2GRAY = 6,
  COLOR_RGB2GRAY = 7,
  COLOR_GRAY2BGR = 8,
  COLOR_GRAY2RGB = COLOR_GRAY2BGR,
  COLOR_GRAY2BGRA = 9,
  COLOR_GRAY2RGBA = COLOR_GRAY2BGRA,
  COLOR_BGRA2GRAY = 10,
  COLOR_RGBA2GRAY = 11
};

// \brief Possible density function in Dither.
enum  DensityFunction {
  kTPDF = 0,
  kRPDF = 1,
  kGPDF = 2
};

enum class  NormMode {
  kNone = 0,
  kOrtho = 1
};

enum class  NormType {
  kNone = 0,
  kSlaney = 1,
};

enum class  ManualOffloadMode {
  kUnspecified,
  kDisabled,
  kEnabled
};

enum class  MapTargetDevice {
  kCpu,
  kGpu,
  kAscend310
};

enum class  MelType {
  kHtk = 0,
  kSlaney = 1,
};

enum class  TensorImpl {
  kNone,
  kFlexible,
  kCv,
  kNP
};

enum class  ShuffleMode {
  kFalse = 0,
  kFiles = 1,
  kGlobal = 2,
  kInfile = 3
};

enum class  ScaleType {
  kMagnitude = 0,
  kPower = 1,
};

enum class  GainType {
  kAmplitude = 0,
  kPower = 1,
  kDb = 2,
};

enum class  BorderType {
  kConstant = 0,
  kEdge = 1,
  kReflect = 2,
  kSymmetric = 3
};

enum class  FixRotationAngle {
  k0Degree = 1,
  k0DegreeAndMirror = 2,
  k180Degree = 3,
  k180DegreeAndMirror = 4,
  k90DegreeAndMirror = 5,
  k90Degree = 6,
  k270DegreeAndMirror = 7,
  k270Degree = 8,
};

enum class  WindowType {
  kBartlett = 0,
  kBlackman = 1,
  kHamming = 2,
  kHann = 3,
  kKaiser = 4
};

enum class  ImageBatchFormat {
  kNHWC = 0,
  kNCHW = 1
};

enum class  ImageFormat {
  HWC = 0,
  CHW = 1,
  HW = 2
};

enum class  InterpolationMode {
  kLinear = 0,
  kNearestNeighbour = 1,
  kCubic = 2,
  kArea = 3,
  kCubicPil = 4
};

enum class  JiebaMode {
  kMix = 0,
  kMp = 1,
  kHmm = 2
};

enum class  SPieceTokenizerOutType {
  kString = 0,
  kInt = 1
};

enum class  SPieceTokenizerLoadType {
  kFile = 0,
  kModel = 1
};

enum class  SentencePieceModel {
  kUnigram = 0,
  kBpe = 1,
  kChar = 2,
  kWord = 3
};

enum class  NormalizeForm {
  kNone = 0,
  kNfc,
  kNfkc,
  kNfd,
  kNfkd,
};

enum class  RelationalOp {
  kEqual = 0,
  kNotEqual,
  kLess,
  kLessEqual,
  kGreater,
  kGreaterEqual,
};

enum class  SliceMode {
  kPad = 0,
  kDrop = 1,
};

enum class  SamplingStrategy {
  kRandom = 0,
  kEdgeWeight = 1
};

enum class  OutputFormat {
  kNormal = 0,
  kCoo = 1,
  kCsr = 2
};

enum class  FadeShape {
  kLinear = 0,
  kExponential = 1,
  kLogarithmic = 2,
  kQuarterSine = 3,
  kHalfSine = 4,
};

inline bool  BitTest(uint32_t bits, uint32_t bitMask) { return (bits & bitMask) == bitMask; }

inline void  BitSet(uint32_t *bits, uint32_t bitMask) {
  if (bits == nullptr) {
    return;
  }
  *bits |= bitMask;
}

inline void  BitClear(uint32_t *bits, uint32_t bitMask) {
  if (bits == nullptr) {
    return;
  }
  *bits &= (~bitMask);
}

constexpr int64_t kDeMaxDim = std::numeric_limits<int64_t>::max();
constexpr int32_t kDeMaxRank = std::numeric_limits<int32_t>::max();
constexpr int64_t kDeMaxFreq = std::numeric_limits<int64_t>::max();  // 9223372036854775807 or 2^(64-1)
constexpr int64_t kDeMaxTopk = std::numeric_limits<int64_t>::max();

constexpr uint32_t kCfgRowsPerBuffer = 1;
constexpr uint32_t kCfgParallelWorkers = 8;
constexpr uint32_t kCfgWorkerConnectorSize = 16;
constexpr uint32_t kCfgOpConnectorSize = 16;
constexpr uint32_t kCfgSendingBatch = 0;
constexpr int32_t kCfgDefaultRankId = -1;
constexpr uint32_t kCfgDefaultSeed = std::mt19937::default_seed;
constexpr uint32_t kCfgMonitorSamplingInterval = 1000;        // timeout value for monitor sampling interval in
                                                              // milliseconds
constexpr uint32_t kCfgCallbackTimeout = 60;                  // timeout value for callback in seconds
constexpr uint32_t kCfgMultiprocessingTimeoutInterval = 300;  // timeout value for multiprocessing interval in seconds
constexpr int32_t kCfgDefaultCachePort = 50052;
constexpr char kCfgDefaultCacheHost[] = "127.0.0.1";
constexpr int32_t kDftCachePrefetchSize = 20;
constexpr int32_t kDftNumConnections = 12;
constexpr bool kDftAutoNumWorkers = false;
constexpr char kDftMetaColumnPrefix[] = "_meta-";
constexpr int32_t kDecimal = 10;  // used in strtol() to convert a string value according to decimal numeral system
constexpr int32_t kMinLegalPort = 1025;
constexpr int32_t kMaxLegalPort = 65535;

// Invalid OpenCV type should not be from 0 to 7 (opencv4/opencv2/core/hal/interface.h)
constexpr uint8_t kCVInvalidType = 255;

using connection_id_type = uint64_t;
using session_id_type = uint32_t;
using row_id_type = int64_t;

constexpr uint32_t kCfgAutoTuneInterval = 0;  // default number of steps
}  // namespace dataset
}  // namespace mindspore

#endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_CONSTANTS_H_