!17798 C++ API update doc of constants

From: @luoyang42
Reviewed-by: @jonyguo,@liucunwei
Signed-off-by: @jonyguo
This commit is contained in:
mindspore-ci-bot 2021-06-05 17:45:41 +08:00 committed by Gitee
commit 0ae751e0ba
2 changed files with 89 additions and 42 deletions

View File

@ -26,65 +26,112 @@ namespace dataset {
using uchar = unsigned char; using uchar = unsigned char;
using dsize_t = int64_t; using dsize_t = int64_t;
/// \brief Target devices to perform map operation /// \brief Target devices to perform map operation.
enum class MapTargetDevice { kCpu, kGpu, kAscend310 }; enum class MapTargetDevice {
kCpu, ///< CPU Device.
kGpu, ///< Gpu Device.
kAscend310 ///< Ascend310 Device.
};
/// \brief Possible dataset types for holding the data and client type /// \brief The initial type of tensor implementation.
enum class DatasetType { kUnknown, kArrow, kTf }; enum class TensorImpl {
kNone, ///< None type tensor.
kFlexible, ///< Flexible type tensor, can be converted to any type.
kCv, ///< CV type tensor.
kNP ///< Numpy type tensor.
};
/// \brief Possible flavours of Tensor implementations /// \brief The mode for shuffling data.
enum class TensorImpl { kNone, kFlexible, kCv, kNP }; enum class ShuffleMode {
kFalse = 0, ///< No shuffling is performed.
kFiles = 1, ///< Shuffle files only.
kGlobal = 2, ///< Shuffle both the files and samples.
kInfile = 3 ///< Shuffle data within each file.
};
/// \brief Possible values for shuffle /// \brief The method of padding.
enum class ShuffleMode { kFalse = 0, kFiles = 1, kGlobal = 2, kInfile = 3 }; enum class BorderType {
kConstant = 0, ///< Fills the border with constant values.
kEdge = 1, ///< Fills the border with the last value on the edge.
kReflect = 2, ///< Reflects the values on the edge omitting the last value of edge.
kSymmetric = 3 ///< Reflects the values on the edge repeating the last value of edge.
};
/// \brief Possible values for Border types /// \brief Possible options for Image format types in a batch.
enum class BorderType { kConstant = 0, kEdge = 1, kReflect = 2, kSymmetric = 3 }; enum class ImageBatchFormat {
kNHWC = 0, ///< Indicate the input batch is of NHWC format.
kNCHW = 1 ///< Indicate the input batch is of NCHW format.
};
/// \brief Possible values for Image format types in a batch /// \brief Possible options for Image format types.
enum class ImageBatchFormat { kNHWC = 0, kNCHW = 1 }; enum class ImageFormat {
HWC = 0, ///< Indicate the input batch is of NHWC format
CHW = 1, ///< Indicate the input batch is of NHWC format
HW = 2 ///< Indicate the input batch is of NHWC format
};
/// \brief Possible values for Image format types /// \brief Possible options for interpolation method.
enum class ImageFormat { HWC = 0, CHW = 1, HW = 2 }; enum class InterpolationMode {
kLinear = 0, ///< Interpolation method is linear interpolation.
kNearestNeighbour = 1, ///< Interpolation method is nearest-neighbor interpolation.
kCubic = 2, ///< Interpolation method is bicubic interpolation.
kArea = 3, ///< Interpolation method is pixel area interpolation.
kCubicPil = 4 ///< Interpolation method is bicubic interpolation like implemented in pillow.
};
/// \brief Possible interpolation modes /// \brief Possible tokenize modes for JiebaTokenizer.
enum class InterpolationMode { kLinear = 0, kNearestNeighbour = 1, kCubic = 2, kArea = 3, kCubicPil = 4 }; enum class JiebaMode {
kMix = 0, ///< Tokenize with MPSegment algorithm.
kMp = 1, ///< Tokenize with Hiddel Markov Model Segment algorithm.
kHmm = 2 ///< Tokenize with a mix of MPSegment and HMMSegment algorithm.
};
/// \brief Possible JiebaMode modes /// \brief Possible options for SPieceTokenizerOutType.
enum class JiebaMode { kMix = 0, kMp = 1, kHmm = 2 }; enum class SPieceTokenizerOutType {
kString = 0, ///< Output of sentencepiece tokenizer is string type.
kInt = 1 ///< Output of sentencepiece tokenizer is int type.
};
/// \brief Possible values for SPieceTokenizerOutType /// \brief Possible options for SPieceTokenizerLoadType.
enum class SPieceTokenizerOutType { kString = 0, kInt = 1 }; enum class SPieceTokenizerLoadType {
kFile = 0, ///< Load sentencepiece tokenizer from local sentencepiece vocab file.
kModel = 1 ///< Load sentencepiece tokenizer from sentencepiece vocab instance.
};
/// \brief Possible values for SPieceTokenizerLoadType /// \brief Type options for SentencePiece Model.
enum class SPieceTokenizerLoadType { kFile = 0, kModel = 1 }; enum class SentencePieceModel {
kUnigram = 0, ///< Based on Unigram model.
kBpe = 1, ///< Based on Byte Pair Encoding (BPE) model.
kChar = 2, ///< Based on Char model.
kWord = 3 ///< Based on Word model.
};
/// \brief Possible values for SentencePieceModel /// \brief Possible options to specify a specific normalize mode.
enum class SentencePieceModel { kUnigram = 0, kBpe = 1, kChar = 2, kWord = 3 };
/// \brief Possible values for NormalizeForm
enum class NormalizeForm { enum class NormalizeForm {
kNone = 0, kNone = 0, ///< Do nothing for input string tensor.
kNfc, kNfc, ///< Normalize with Normalization Form C.
kNfkc, kNfkc, ///< Normalize with Normalization Form KC.
kNfd, kNfd, ///< Normalize with Normalization Form D.
kNfkd, kNfkd, ///< Normalize with Normalization Form KD.
}; };
/// \brief Possible values for Mask /// \brief Possible options for Mask.
enum class RelationalOp { enum class RelationalOp {
kEqual = 0, // == kEqual = 0, ///< equal to `==`
kNotEqual, // != kNotEqual, ///< equal to `!=`
kLess, // < kLess, ///< equal to `<`
kLessEqual, // <= kLessEqual, ///< equal to `<=`
kGreater, // > kGreater, ///< equal to `>`
kGreaterEqual, // >= kGreaterEqual, ///< equal to `>=`
}; };
/// \brief Possible values for SamplingStrategy /// \brief Possible options for SamplingStrategy.
enum class SamplingStrategy { kRandom = 0, kEdgeWeight = 1 }; enum class SamplingStrategy {
kRandom = 0, ///< Random sampling with replacement.
kEdgeWeight = 1 ///< Sampling with edge weight as probability.
};
// convenience functions for 32bit int bitmask // convenience functions for 32bit int bitmask.
inline bool BitTest(uint32_t bits, uint32_t bitMask) { return (bits & bitMask) == bitMask; } inline bool BitTest(uint32_t bits, uint32_t bitMask) { return (bits & bitMask) == bitMask; }
inline void BitSet(uint32_t *bits, uint32_t bitMask) { *bits |= bitMask; } inline void BitSet(uint32_t *bits, uint32_t bitMask) { *bits |= bitMask; }

View File

@ -1389,7 +1389,7 @@ inline std::shared_ptr<MindDataDataset> MindData(
/// ShuffleMode::kFalse - No shuffling is performed. /// ShuffleMode::kFalse - No shuffling is performed.
/// ShuffleMode::kFiles - Shuffle files only. /// ShuffleMode::kFiles - Shuffle files only.
/// ShuffleMode::kGlobal - Shuffle both the files and samples. /// ShuffleMode::kGlobal - Shuffle both the files and samples.
/// ShuffleMode::kInfile - Shuffle samples in file. /// ShuffleMode::kInfile - Shuffle data within each file.
/// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used).
/// \return Shared pointer to the MindDataDataset. /// \return Shared pointer to the MindDataDataset.
inline std::shared_ptr<MindDataDataset> MindData(const std::vector<std::string> &dataset_files, inline std::shared_ptr<MindDataDataset> MindData(const std::vector<std::string> &dataset_files,