diff --git a/include/api/visible.h b/include/api/visible.h index ab6b6971ff1..37cc1dd52a5 100644 --- a/include/api/visible.h +++ b/include/api/visible.h @@ -24,5 +24,14 @@ #endif // _WIN32 #endif -#endif // MINDSPORE_INCLUDE_API_VISIBLE_H +#ifdef _MSC_VER +#ifdef BUILDING_DATASET_DLL +#define DATASET_API __declspec(dllexport) +#else +#define DATASET_API __declspec(dllimport) +#endif +#else +#define DATASET_API __attribute__((visibility("default"))) +#endif // _MSC_VER +#endif // MINDSPORE_INCLUDE_API_VISIBLE_H diff --git a/mindspore/ccsrc/minddata/dataset/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/CMakeLists.txt index 58e277b6425..7f2a0a7b5ca 100644 --- a/mindspore/ccsrc/minddata/dataset/CMakeLists.txt +++ b/mindspore/ccsrc/minddata/dataset/CMakeLists.txt @@ -11,6 +11,11 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized") endif() +if(MSVC) + # define this for msvc:dllexport or dllimport + add_compile_definitions(BUILDING_DATASET_DLL) +endif() + # fix for GCC8.0 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess -Wno-stringop-truncation") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format") diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/audio.h b/mindspore/ccsrc/minddata/dataset/include/dataset/audio.h index fd4b57c8b17..dd85391d793 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/audio.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/audio.h @@ -37,7 +37,7 @@ class TensorOperation; // Transform operations for performing computer audio. namespace audio { /// \brief Compute the angle of complex tensor input. -class MS_API Angle final : public TensorTransform { +class DATASET_API Angle final : public TensorTransform { public: /// \brief Constructor. Angle(); @@ -52,7 +52,7 @@ class MS_API Angle final : public TensorTransform { }; /// \brief Design two-pole allpass filter. Similar to SoX implementation. -class MS_API AllpassBiquad final : public TensorTransform { +class DATASET_API AllpassBiquad final : public TensorTransform { public: /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. /// \param[in] central_freq Central frequency (in Hz). @@ -74,7 +74,7 @@ class MS_API AllpassBiquad final : public TensorTransform { /// \brief AmplitudeToDB TensorTransform. /// \notes Turn a tensor from the power/amplitude scale to the decibel scale. -class MS_API AmplitudeToDB final : public TensorTransform { +class DATASET_API AmplitudeToDB final : public TensorTransform { public: /// \brief Constructor. /// \param[in] stype Scale of input tensor, must be one of [ScaleType::kPower, ScaleType::kMagnitude] (Default: @@ -99,7 +99,7 @@ class MS_API AmplitudeToDB final : public TensorTransform { }; /// \brief Design two-pole band filter. -class MS_API BandBiquad final : public TensorTransform { +class DATASET_API BandBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -122,7 +122,7 @@ class MS_API BandBiquad final : public TensorTransform { }; /// \brief Design two-pole band-pass filter. -class MS_API BandpassBiquad final : public TensorTransform { +class DATASET_API BandpassBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -146,7 +146,7 @@ class MS_API BandpassBiquad final : public TensorTransform { }; /// \brief Design two-pole band-reject filter. Similar to SoX implementation. -class MS_API BandrejectBiquad final : public TensorTransform { +class DATASET_API BandrejectBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -168,7 +168,7 @@ class MS_API BandrejectBiquad final : public TensorTransform { }; /// \brief Design a bass tone-control effect. -class MS_API BassBiquad final : public TensorTransform { +class DATASET_API BassBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -191,7 +191,7 @@ class MS_API BassBiquad final : public TensorTransform { }; /// \brief Perform a biquad filter of input tensor. -class MS_API Biquad final : public TensorTransform { +class DATASET_API Biquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] b0 Numerator coefficient of current input, x[n]. @@ -217,7 +217,7 @@ class MS_API Biquad final : public TensorTransform { /// \brief ComplexNorm TensorTransform. /// \notes Compute the norm of complex tensor input. -class MS_API ComplexNorm final : public TensorTransform { +class DATASET_API ComplexNorm final : public TensorTransform { public: /// \brief Constructor. /// \param[in] power Power of the norm, which must be non-negative (Default: 1.0). @@ -238,7 +238,7 @@ class MS_API ComplexNorm final : public TensorTransform { /// \brief ComputeDeltas Transform. /// \note Compute delta coefficients of a spectrogram. -class MS_API ComputeDeltas final : public TensorTransform { +class DATASET_API ComputeDeltas final : public TensorTransform { public: /// \brief Construct a new Compute Deltas object. /// \f[ @@ -263,7 +263,7 @@ class MS_API ComputeDeltas final : public TensorTransform { }; /// \brief Apply contrast effect. -class MS_API Contrast final : public TensorTransform { +class DATASET_API Contrast final : public TensorTransform { public: /// \brief Constructor. /// \param[in] enhancement_amount Controls the amount of the enhancement (Default: 75.0). @@ -283,7 +283,7 @@ class MS_API Contrast final : public TensorTransform { }; /// \brief Turn a waveform from the decibel scale to the power/amplitude scale. -class MS_API DBToAmplitude final : public TensorTransform { +class DATASET_API DBToAmplitude final : public TensorTransform { public: /// \brief Constructor /// \param[in] ref Reference which the output will be scaled by. @@ -304,7 +304,7 @@ class MS_API DBToAmplitude final : public TensorTransform { }; /// \brief Apply a DC shift to the audio. -class MS_API DCShift : public TensorTransform { +class DATASET_API DCShift : public TensorTransform { public: /// \brief Constructor /// \param[in] shift Indicates the amount to shift the audio, the value must be in the range [-2.0, 2.0]. @@ -336,7 +336,7 @@ class MS_API DCShift : public TensorTransform { Status CreateDct(mindspore::MSTensor *output, int32_t n_mfcc, int32_t n_mels, NormMode norm = NormMode::kNone); /// \brief Design two-pole deemph filter. Similar to SoX implementation. -class MS_API DeemphBiquad final : public TensorTransform { +class DATASET_API DeemphBiquad final : public TensorTransform { public: /// \param[in] sample_rate Sampling rate of the waveform, the value can only be 44100 (Hz) or 48000(hz). explicit DeemphBiquad(int32_t sample_rate); @@ -355,7 +355,7 @@ class MS_API DeemphBiquad final : public TensorTransform { }; /// \brief Detect pitch frequency. -class MS_API DetectPitchFrequency final : public TensorTransform { +class DATASET_API DetectPitchFrequency final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -383,7 +383,7 @@ class MS_API DetectPitchFrequency final : public TensorTransform { /// \brief Dither increases the perceived dynamic range of audio stored at a /// particular bit-depth by eliminating nonlinear truncation distortion. -class MS_API Dither final : public TensorTransform { +class DATASET_API Dither final : public TensorTransform { public: /// \brief Constructor. /// \param[in] density_function The density function of a continuous random variable. @@ -408,7 +408,7 @@ class MS_API Dither final : public TensorTransform { }; /// \brief EqualizerBiquad TensorTransform. Apply highpass biquad filter on audio. -class MS_API EqualizerBiquad final : public TensorTransform { +class DATASET_API EqualizerBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -431,7 +431,7 @@ class MS_API EqualizerBiquad final : public TensorTransform { }; /// \brief Add fade in or/and fade out on the input audio. -class MS_API Fade final : public TensorTransform { +class DATASET_API Fade final : public TensorTransform { public: /// \brief Constructor. /// \param[in] fade_in_len Length of fade-in (time frames), which must be non-negative @@ -455,7 +455,7 @@ class MS_API Fade final : public TensorTransform { }; /// \brief Design IIR forward and backward filter. -class MS_API Filtfilt final : public TensorTransform { +class DATASET_API Filtfilt final : public TensorTransform { public: /// \param[in] a_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). /// Lower delays coefficients are first, e.g. [a0, a1, a2, ...]. @@ -480,7 +480,7 @@ class MS_API Filtfilt final : public TensorTransform { }; /// \brief Apply a flanger effect to the audio. -class MS_API Flanger final : public TensorTransform { +class DATASET_API Flanger final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). @@ -513,7 +513,7 @@ class MS_API Flanger final : public TensorTransform { /// \brief FrequencyMasking TensorTransform. /// \notes Apply masking to a spectrogram in the frequency domain. -class MS_API FrequencyMasking final : public TensorTransform { +class DATASET_API FrequencyMasking final : public TensorTransform { public: /// \brief Constructor. /// \param[in] iid_masks Whether to apply different masks to each example. @@ -539,7 +539,7 @@ class MS_API FrequencyMasking final : public TensorTransform { }; /// \brief Apply amplification or attenuation to the whole waveform. -class MS_API Gain final : public TensorTransform { +class DATASET_API Gain final : public TensorTransform { public: /// \brief Constructor. /// \param[in] gain_db Gain adjustment in decibels (dB) (Default: 1.0). @@ -559,7 +559,7 @@ class MS_API Gain final : public TensorTransform { }; /// \brief Waveform calculation from linear scalar amplitude spectrogram using GriffinLim transform. -class MS_API GriffinLim final : public TensorTransform { +class DATASET_API GriffinLim final : public TensorTransform { public: /// \brief Constructor. /// \notes Calculated by formula: @@ -594,7 +594,7 @@ class MS_API GriffinLim final : public TensorTransform { }; /// \brief HighpassBiquad TensorTransform. Apply highpass biquad filter on audio. -class MS_API HighpassBiquad final : public TensorTransform { +class DATASET_API HighpassBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -617,7 +617,7 @@ class MS_API HighpassBiquad final : public TensorTransform { /// \brief InverseMelScale TensorTransform /// \notes Solve for a normal STFT from a mel frequency STFT, using a conversion matrix. -class MS_API InverseMelScale final : public TensorTransform { +class DATASET_API InverseMelScale final : public TensorTransform { public: /// \brief Constructor. /// \param[in] n_stft Number of bins in STFT, must be positive. @@ -653,7 +653,7 @@ class MS_API InverseMelScale final : public TensorTransform { }; /// \brief Design filter. Similar to SoX implementation. -class MS_API LFilter final : public TensorTransform { +class DATASET_API LFilter final : public TensorTransform { public: /// \param[in] a_coeffs Numerator coefficients of difference equation of dimension of (n_order + 1). /// Lower delays coefficients are first, e.g. [a0, a1, a2, ...]. @@ -685,11 +685,11 @@ class MS_API LFilter final : public TensorTransform { /// \param n_filter: Number of (linear) triangular filter. /// \param sample_rate: Sample rate. /// \return Status code. -Status MS_API LinearFbanks(MSTensor *output, int32_t n_freqs, float f_min, float f_max, int32_t n_filter, - int32_t sample_rate); +Status DATASET_API LinearFbanks(MSTensor *output, int32_t n_freqs, float f_min, float f_max, int32_t n_filter, + int32_t sample_rate); /// \brief Design biquad lowpass filter and perform filtering. Similar to SoX implementation. -class MS_API LowpassBiquad final : public TensorTransform { +class DATASET_API LowpassBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -711,7 +711,7 @@ class MS_API LowpassBiquad final : public TensorTransform { }; /// \brief Separate a complex-valued spectrogram with shape (..., 2) into its magnitude and phase. -class MS_API Magphase final : public TensorTransform { +class DATASET_API Magphase final : public TensorTransform { public: /// \brief Constructor. /// \param[in] power Power of the norm, which must be non-negative (Default: 1.0). @@ -780,7 +780,7 @@ class MaskAlongAxisIID final : public TensorTransform { /// \brief MelScale TensorTransform. /// \notes Convert normal STFT to STFT at the Mel scale. -class MS_API MelScale final : public TensorTransform { +class DATASET_API MelScale final : public TensorTransform { public: /// \brief Constructor. /// \param[in] n_mels Number of mel filter, which must be positive (Default: 128). @@ -817,12 +817,13 @@ class MS_API MelScale final : public TensorTransform { /// \param[in] norm Norm to use, can be NormType::kNone or NormType::kSlaney (Default: NormType::kNone). /// \param[in] mel_type Scale to use, can be MelType::kHtk or MelType::kSlaney (Default: MelType::kHtz). /// \return Status code. -Status MS_API MelscaleFbanks(MSTensor *output, int32_t n_freqs, float f_min, float f_max, int32_t n_mels, - int32_t sample_rate, NormType norm = NormType::kNone, MelType mel_type = MelType::kHtk); +Status DATASET_API MelscaleFbanks(MSTensor *output, int32_t n_freqs, float f_min, float f_max, int32_t n_mels, + int32_t sample_rate, NormType norm = NormType::kNone, + MelType mel_type = MelType::kHtk); /// \brief MuLawDecoding TensorTransform. /// \note Decode mu-law encoded signal. -class MS_API MuLawDecoding final : public TensorTransform { +class DATASET_API MuLawDecoding final : public TensorTransform { public: /// \brief Constructor. /// \param[in] quantization_channels Number of channels, which must be positive (Default: 256). @@ -843,7 +844,7 @@ class MS_API MuLawDecoding final : public TensorTransform { /// \brief MuLawEncoding TensorTransform. /// \note Encode signal based on mu-law companding. -class MS_API MuLawEncoding final : public TensorTransform { +class DATASET_API MuLawEncoding final : public TensorTransform { public: /// \brief Constructor. /// \param[in] quantization_channels Number of channels, which must be positive (Default: 256). @@ -863,7 +864,7 @@ class MS_API MuLawEncoding final : public TensorTransform { }; /// \brief Overdrive TensorTransform. -class MS_API Overdrive final : public TensorTransform { +class DATASET_API Overdrive final : public TensorTransform { public: /// \brief Constructor. /// \param[in] gain Coefficient of overload in dB, in range of [0, 100] (Default: 20.0). @@ -884,7 +885,7 @@ class MS_API Overdrive final : public TensorTransform { }; /// \brief Phaser TensorTransform. -class MS_API Phaser final : public TensorTransform { +class DATASET_API Phaser final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). @@ -915,7 +916,7 @@ class MS_API Phaser final : public TensorTransform { /// \brief PhaseVocoder TensorTransform /// \notes Given a STFT tensor, speed up in time without modifying pitch by factor of rate. -class MS_API PhaseVocoder final : public TensorTransform { +class DATASET_API PhaseVocoder final : public TensorTransform { public: /// \brief Constructor. /// \param[in] rate Speed-up factor. @@ -937,7 +938,7 @@ class MS_API PhaseVocoder final : public TensorTransform { /// \brief Resample TensorTransform. /// \notes Resample a signal from one frequency to another. A sampling method can be given. -class MS_API Resample : public TensorTransform { +class DATASET_API Resample : public TensorTransform { public: /// \brief Constructor. /// \param[in] orig_freq The original frequency of the signal, which must be positive (default=16000). @@ -966,7 +967,7 @@ class MS_API Resample : public TensorTransform { }; /// \brief Apply RIAA vinyl playback equalization. -class MS_API RiaaBiquad final : public TensorTransform { +class DATASET_API RiaaBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), @@ -987,7 +988,7 @@ class MS_API RiaaBiquad final : public TensorTransform { }; /// \brief Apply sliding-window cepstral mean (and optionally variance) normalization per utterance. -class MS_API SlidingWindowCmn final : public TensorTransform { +class DATASET_API SlidingWindowCmn final : public TensorTransform { public: /// \brief Constructor of SlidingWindowCmnOp. /// \param[in] cmn_window The window in frames for running average CMN computation (Default: 600). @@ -1013,7 +1014,7 @@ class MS_API SlidingWindowCmn final : public TensorTransform { }; /// \brief Create a spectral centroid from an audio signal. -class MS_API SpectralCentroid : public TensorTransform { +class DATASET_API SpectralCentroid : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz). @@ -1046,7 +1047,7 @@ class MS_API SpectralCentroid : public TensorTransform { }; /// \brief Create a spectrogram from an audio signal. -class MS_API Spectrogram : public TensorTransform { +class DATASET_API Spectrogram : public TensorTransform { public: /// \brief Constructor. /// \param[in] n_fft Size of FFT, creates n_fft / 2 + 1 bins (Default: 400). @@ -1092,7 +1093,7 @@ class MS_API Spectrogram : public TensorTransform { /// \brief TimeMasking TensorTransform. /// \notes Apply masking to a spectrogram in the time domain. -class MS_API TimeMasking final : public TensorTransform { +class DATASET_API TimeMasking final : public TensorTransform { public: /// \brief Constructor. /// \param[in] iid_masks Whether to apply different masks to each example. @@ -1119,7 +1120,7 @@ class MS_API TimeMasking final : public TensorTransform { /// \brief TimeStretch TensorTransform /// \notes Stretch STFT in time at a given rate, without changing the pitch. -class MS_API TimeStretch final : public TensorTransform { +class DATASET_API TimeStretch final : public TensorTransform { public: /// \brief Constructor. /// \param[in] hop_length Length of hop between STFT windows (Default: None, will use ((n_freq - 1) * 2) // 2). @@ -1143,7 +1144,7 @@ class MS_API TimeStretch final : public TensorTransform { }; /// \brief Design a treble tone-control effect. -class MS_API TrebleBiquad final : public TensorTransform { +class DATASET_API TrebleBiquad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero. @@ -1167,7 +1168,7 @@ class MS_API TrebleBiquad final : public TensorTransform { /// \brief Vad TensorTransform. /// \notes Attempt to trim silent background sounds from the end of the voice recording. -class MS_API Vad final : public TensorTransform { +class DATASET_API Vad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] sample_rate Sample rate of audio signal. @@ -1218,7 +1219,7 @@ class MS_API Vad final : public TensorTransform { /// \brief Vol TensorTransform. /// \notes Add a volume to an waveform. -class MS_API Vol final : public TensorTransform { +class DATASET_API Vol final : public TensorTransform { public: /// \brief Constructor. /// \param[in] gain Gain value, varies according to the value of gain_type. If gain_type is GainType::kAmplitude, diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/config.h b/mindspore/ccsrc/minddata/dataset/include/dataset/config.h index 8a1ebf3cf9d..e9cc4bd59ee 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/config.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/config.h @@ -37,7 +37,7 @@ namespace config { /// // Operations with randomness will use the seed value to generate random values. /// bool rc = config::set_seed(5); /// \endcode -bool MS_API set_seed(int32_t seed); +bool DATASET_API set_seed(int32_t seed); /// \brief A function to get the seed. /// \return The seed set in the configuration. @@ -47,7 +47,7 @@ bool MS_API set_seed(int32_t seed); /// // If set_seed() is never called before, the default value(std::mt19937::default_seed) will be returned. /// uint32_t seed = config::get_seed(); /// \endcode -uint32_t MS_API get_seed(); +uint32_t DATASET_API get_seed(); /// \brief A function to set the number of rows to be prefetched. /// \param[in] prefetch_size Total number of rows to be prefetched. @@ -57,7 +57,7 @@ uint32_t MS_API get_seed(); /// // Set a new global configuration value for the prefetch size. /// bool rc = config::set_prefetch_size(1000); /// \endcode -bool MS_API set_prefetch_size(int32_t prefetch_size); +bool DATASET_API set_prefetch_size(int32_t prefetch_size); /// \brief A function to get the prefetch size in number of rows. /// \return Total number of rows to be prefetched. @@ -67,7 +67,7 @@ bool MS_API set_prefetch_size(int32_t prefetch_size); /// // If set_prefetch_size() is never called before, the default value(16) will be returned. /// int32_t prefetch_size = config::get_prefetch_size(); /// \endcode -int32_t MS_API get_prefetch_size(); +int32_t DATASET_API get_prefetch_size(); /// \brief A function to set the default number of parallel workers. /// \param[in] num_parallel_workers Number of parallel workers to be used as the default for each operation. @@ -78,7 +78,7 @@ int32_t MS_API get_prefetch_size(); /// // Now parallel dataset operators will run with 16 workers. /// bool rc = config::set_num_parallel_workers(16); /// \endcode -bool MS_API set_num_parallel_workers(int32_t num_parallel_workers); +bool DATASET_API set_num_parallel_workers(int32_t num_parallel_workers); /// \brief A function to get the default number of parallel workers. /// \return Number of parallel workers to be used as the default for each operation. @@ -88,7 +88,7 @@ bool MS_API set_num_parallel_workers(int32_t num_parallel_workers); /// // If set_num_parallel_workers() is never called before, the default value(8) will be returned. /// int32_t parallel_workers = config::get_num_parallel_workers(); /// \endcode -int32_t MS_API get_num_parallel_workers(); +int32_t DATASET_API get_num_parallel_workers(); /// \brief A function to set the default interval (in milliseconds) for monitor sampling. /// \param[in] interval Interval (in milliseconds) to be used for performance monitor sampling. @@ -98,7 +98,7 @@ int32_t MS_API get_num_parallel_workers(); /// // Set a new global configuration value for the monitor sampling interval. /// bool rc = config::set_monitor_sampling_interval(100); /// \endcode -bool MS_API set_monitor_sampling_interval(int32_t interval); +bool DATASET_API set_monitor_sampling_interval(int32_t interval); /// \brief A function to get the default interval of performance monitor sampling. /// \return Interval (in milliseconds) for performance monitor sampling. @@ -108,7 +108,7 @@ bool MS_API set_monitor_sampling_interval(int32_t interval); /// // If set_monitor_sampling_interval() is never called before, the default value(1000) will be returned. /// int32_t sampling_interval = config::get_monitor_sampling_interval(); /// \endcode -int32_t MS_API get_monitor_sampling_interval(); +int32_t DATASET_API get_monitor_sampling_interval(); /// \brief A function to set the default timeout (in seconds) for DSWaitedCallback. In case of a deadlock, the wait /// function will exit after the timeout period. @@ -119,7 +119,7 @@ int32_t MS_API get_monitor_sampling_interval(); /// // Set a new global configuration value for the timeout value. /// bool rc = config::set_callback_timeout(100); /// \endcode -bool MS_API set_callback_timeout(int32_t timeout); +bool DATASET_API set_callback_timeout(int32_t timeout); /// \brief A function to get the default timeout for DSWaitedCallback. In case of a deadback, the wait function /// will exit after the timeout period. @@ -130,7 +130,7 @@ bool MS_API set_callback_timeout(int32_t timeout); /// // If set_callback_timeout() is never called before, the default value(60) will be returned. /// int32_t callback_timeout = config::get_callback_timeout(); /// \endcode -int32_t MS_API get_callback_timeout(); +int32_t DATASET_API get_callback_timeout(); /// \brief A function to load the configuration from a file. /// \param[in] file Path of the configuration file to be loaded. @@ -138,7 +138,7 @@ int32_t MS_API get_callback_timeout(); /// \note The reason for using this API is that std::string will be constrained by the /// compiler option '_GLIBCXX_USE_CXX11_ABI' while char is free of this restriction. /// Check API `mindspore::dataset::config::load(const std::string &file)` and find more usage. -bool MS_API load(const std::vector &file); +bool DATASET_API load(const std::vector &file); /// \brief A function to load the configuration from a file. /// \param[in] file Path of the configuration file to be loaded. @@ -156,7 +156,7 @@ bool MS_API load(const std::vector &file); /// std::string config_file = "/path/to/config/file"; /// bool rc = config::load(config_file); /// \endcode -inline bool MS_API load(const std::string &file) { return load(StringToChar(file)); } +inline bool DATASET_API load(const std::string &file) { return load(StringToChar(file)); } } // namespace config } // namespace dataset } // namespace mindspore diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h b/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h index 215cbde2c98..d9938b71d78 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h @@ -29,26 +29,26 @@ using uchar = unsigned char; using dsize_t = int64_t; /// \brief The modulation in Flanger -enum class MS_API Modulation { +enum class DATASET_API Modulation { kSinusoidal = 0, ///< Use sinusoidal modulation. kTriangular = 1 ///< Use triangular modulation. }; /// \brief The interpolation in Flanger -enum class MS_API Interpolation { +enum class DATASET_API Interpolation { kLinear = 0, ///< Use linear for delay-line interpolation. kQuadratic = 1 ///< Use quadratic for delay-line interpolation. }; /// \brief The dataset auto augment policy in AutoAugment -enum class MS_API AutoAugmentPolicy { +enum class DATASET_API AutoAugmentPolicy { kImageNet = 0, ///< AutoAugment policy learned on the ImageNet dataset. kCifar10 = 1, ///< AutoAugment policy learned on the Cifar10 dataset. kSVHN = 2 ///< AutoAugment policy learned on the SVHN dataset. }; /// \brief The color conversion code -enum class MS_API ConvertMode { +enum class DATASET_API ConvertMode { COLOR_BGR2BGRA = 0, ///< Add alpha channel to BGR image. COLOR_RGB2RGBA = COLOR_BGR2BGRA, ///< Add alpha channel to RGB image. COLOR_BGRA2BGR = 1, ///< Remove alpha channel to BGR image. @@ -72,46 +72,46 @@ enum class MS_API ConvertMode { }; // \brief Possible density function in Dither. -enum MS_API DensityFunction { +enum DATASET_API DensityFunction { kTPDF = 0, ///< Use triangular probability density function. kRPDF = 1, ///< Use rectangular probability density function. kGPDF = 2 ///< Use gaussian probability density function. }; /// \brief Values of norm in CreateDct. -enum class MS_API NormMode { +enum class DATASET_API NormMode { kNone = 0, ///< None type norm. kOrtho = 1 ///< Ortho type norm. }; /// \brief Possible options for norm in MelscaleFbanks. -enum class MS_API NormType { +enum class DATASET_API NormType { kNone = 0, ///< None type norm. kSlaney = 1, ///< Slaney type norm. }; /// \brief The mode for manual offload. -enum class MS_API ManualOffloadMode { +enum class DATASET_API ManualOffloadMode { kUnspecified, ///< Not set, will use auto_offload setting instead. kDisabled, ///< Do not perform offload. kEnabled ///< Attempt to offload. }; /// \brief Target devices to perform map operation. -enum class MS_API MapTargetDevice { +enum class DATASET_API MapTargetDevice { kCpu, ///< CPU Device. kGpu, ///< Gpu Device. kAscend310 ///< Ascend310 Device. }; /// \brief Possible options for mel_type in MelscaleFbanks. -enum class MS_API MelType { +enum class DATASET_API MelType { kHtk = 0, ///< Htk scale type. kSlaney = 1, ///< Slaney scale type. }; /// \brief The initial type of tensor implementation. -enum class MS_API TensorImpl { +enum class DATASET_API TensorImpl { kNone, ///< None type tensor. kFlexible, ///< Flexible type tensor, can be converted to any type. kCv, ///< CV type tensor. @@ -119,7 +119,7 @@ enum class MS_API TensorImpl { }; /// \brief The mode for shuffling data. -enum class MS_API ShuffleMode { +enum class DATASET_API ShuffleMode { kFalse = 0, ///< No shuffling is performed. kFiles = 1, ///< Shuffle files only. kGlobal = 2, ///< Shuffle both the files and samples. @@ -127,20 +127,20 @@ enum class MS_API ShuffleMode { }; /// \brief Possible scale for input audio. -enum class MS_API ScaleType { +enum class DATASET_API ScaleType { kMagnitude = 0, ///< Audio scale is magnitude. kPower = 1, ///< Audio scale is power. }; /// \brief The scale for gain type. -enum class MS_API GainType { +enum class DATASET_API GainType { kAmplitude = 0, ///< Audio gain type is amplitude. kPower = 1, ///< Audio gain type is power. kDb = 2, ///< Audio gain type is db. }; /// \brief The method of padding. -enum class MS_API BorderType { +enum class DATASET_API BorderType { kConstant = 0, ///< Fill the border with constant values. kEdge = 1, ///< Fill the border with the last value on the edge. kReflect = 2, ///< Reflect the values on the edge omitting the last value of edge. @@ -148,7 +148,7 @@ enum class MS_API BorderType { }; /// \brief Possible fix rotation angle for Rotate Op. -enum class MS_API FixRotationAngle { +enum class DATASET_API FixRotationAngle { k0Degree = 1, ///< Rotate 0 degree. k0DegreeAndMirror = 2, ///< Rotate 0 degree and apply horizontal flip. k180Degree = 3, ///< Rotate 180 degree. @@ -160,7 +160,7 @@ enum class MS_API FixRotationAngle { }; /// \brief Possible types for windows function. -enum class MS_API WindowType { +enum class DATASET_API WindowType { kBartlett = 0, ///< Bartlett window function. kBlackman = 1, ///< Blackman window function. kHamming = 2, ///< Hamming window function. @@ -169,20 +169,20 @@ enum class MS_API WindowType { }; /// \brief Possible options for Image format types in a batch. -enum class MS_API ImageBatchFormat { +enum class DATASET_API ImageBatchFormat { kNHWC = 0, ///< Indicate the input batch is of NHWC format. kNCHW = 1 ///< Indicate the input batch is of NCHW format. }; /// \brief Possible options for Image format types. -enum class MS_API ImageFormat { +enum class DATASET_API 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 options for interpolation method. -enum class MS_API InterpolationMode { +enum class DATASET_API InterpolationMode { kLinear = 0, ///< Interpolation method is linear interpolation. kNearestNeighbour = 1, ///< Interpolation method is nearest-neighbor interpolation. kCubic = 2, ///< Interpolation method is bicubic interpolation. @@ -191,13 +191,13 @@ enum class MS_API InterpolationMode { }; /// \brief Possible formats for Vdec output image. -enum class MS_API VdecOutputFormat { +enum class DATASET_API VdecOutputFormat { kYuvSemiplanar420 = 1, ///< Output image with PIXEL_FORMAT_YUV_SEMIPLANAR_420. kYvuSemiplanar420 = 2, ///< Output image with PIXEL_FORMAT_YVU_SEMIPLANAR_420. }; /// \brief Possible formats for Vdec input video. -enum class MS_API VdecStreamFormat { +enum class DATASET_API VdecStreamFormat { kH265MainLevel = 0, ///< Input video with H265_MAIN_LEVEL kH264BaselineLevel, ///< Input video with H264_BASELINE_LEVEL kH264MainLevel, ///< Input video with H264_MAIN_LEVEL @@ -205,26 +205,26 @@ enum class MS_API VdecStreamFormat { }; /// \brief Possible tokenize modes for JiebaTokenizer. -enum class MS_API JiebaMode { +enum class DATASET_API 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 options for SPieceTokenizerOutType. -enum class MS_API SPieceTokenizerOutType { +enum class DATASET_API SPieceTokenizerOutType { kString = 0, ///< Output of sentencepiece tokenizer is string type. kInt = 1 ///< Output of sentencepiece tokenizer is int type. }; /// \brief Possible options for SPieceTokenizerLoadType. -enum class MS_API SPieceTokenizerLoadType { +enum class DATASET_API SPieceTokenizerLoadType { kFile = 0, ///< Load sentencepiece tokenizer from local sentencepiece vocab file. kModel = 1 ///< Load sentencepiece tokenizer from sentencepiece vocab instance. }; /// \brief Type options for SentencePiece Model. -enum class MS_API SentencePieceModel { +enum class DATASET_API SentencePieceModel { kUnigram = 0, ///< Based on Unigram model. kBpe = 1, ///< Based on Byte Pair Encoding (BPE) model. kChar = 2, ///< Based on Char model. @@ -232,7 +232,7 @@ enum class MS_API SentencePieceModel { }; /// \brief Possible options to specify a specific normalize mode. -enum class MS_API NormalizeForm { +enum class DATASET_API NormalizeForm { kNone = 0, ///< Keep the input string tensor unchanged. kNfc, ///< Normalize with Normalization Form C. kNfkc, ///< Normalize with Normalization Form KC. @@ -241,7 +241,7 @@ enum class MS_API NormalizeForm { }; /// \brief Possible options for Mask. -enum class MS_API RelationalOp { +enum class DATASET_API RelationalOp { kEqual = 0, ///< equal to `==` kNotEqual, ///< equal to `!=` kLess, ///< equal to `<` @@ -251,26 +251,26 @@ enum class MS_API RelationalOp { }; /// \brief Possible modes for slice patches. -enum class MS_API SliceMode { +enum class DATASET_API SliceMode { kPad = 0, ///< Pad some pixels before slice to patches. kDrop = 1, ///< Drop remainder pixels before slice to patches. }; /// \brief Possible options for SamplingStrategy. -enum class MS_API SamplingStrategy { +enum class DATASET_API SamplingStrategy { kRandom = 0, ///< Random sampling with replacement. kEdgeWeight = 1 ///< Sampling with edge weight as probability. }; /// \brief Possible values for output format in get all neighbors function of gnn dataset -enum class MS_API OutputFormat { +enum class DATASET_API OutputFormat { kNormal = 0, ///< Normal format. kCoo = 1, ///< COO format. kCsr = 2 ///< CSR format. }; /// \brief Possible options for fade shape. -enum class MS_API FadeShape { +enum class DATASET_API FadeShape { kLinear = 0, ///< Fade shape is linear mode. kExponential = 1, ///< Fade shape is exponential mode. kLogarithmic = 2, ///< Fade shape is logarithmic mode. @@ -279,7 +279,7 @@ enum class MS_API FadeShape { }; /// \brief Sample method for audio resample. -enum class MS_API ResampleMethod { +enum class DATASET_API ResampleMethod { kSincInterpolation = 0, ///< Resample audio by sinc interpolation method kKaiserWindow = 1, ///< Resample audio by Kaiser window }; @@ -288,12 +288,12 @@ enum class MS_API ResampleMethod { /// \param[in] bits a 32bit int to be tested /// \param[in] bitMask a 32bit int representing bit mask /// \return bool Result for the check -inline bool MS_API BitTest(uint32_t bits, uint32_t bitMask) { return (bits & bitMask) == bitMask; } +inline bool DATASET_API BitTest(uint32_t bits, uint32_t bitMask) { return (bits & bitMask) == bitMask; } /// \brief Convenience function to set bitmask for a 32bit int /// \param[in] bits a 32bit int to deal with /// \param[in] bitMask a 32bit int representing bit mask -inline void MS_API BitSet(uint32_t *bits, uint32_t bitMask) { +inline void DATASET_API BitSet(uint32_t *bits, uint32_t bitMask) { if (bits == nullptr) { return; } @@ -303,7 +303,7 @@ inline void MS_API BitSet(uint32_t *bits, uint32_t bitMask) { /// \brief Convenience function to clear bitmask from a 32bit int /// \param[in] bits a 32bit int to deal with /// \param[in] bitMask a 32bit int representing bit mask -inline void MS_API BitClear(uint32_t *bits, uint32_t bitMask) { +inline void DATASET_API BitClear(uint32_t *bits, uint32_t bitMask) { if (bits == nullptr) { return; } diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/data_helper.h b/mindspore/ccsrc/minddata/dataset/include/dataset/data_helper.h index 93007e554fe..b0bac63f46a 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/data_helper.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/data_helper.h @@ -33,7 +33,7 @@ namespace mindspore { namespace dataset { /// \brief Simple class to do data manipulation, contains helper function to update json files in dataset -class MS_API DataHelper { +class DATASET_API DataHelper { public: /// \brief constructor DataHelper() = default; diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h b/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h index d9d48752252..0a4436d55a5 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h @@ -82,7 +82,7 @@ class ZipDataset; /// \class Dataset datasets.h /// \brief A base class to represent a dataset in the data pipeline. -class MS_API Dataset : public std::enable_shared_from_this { +class DATASET_API Dataset : public std::enable_shared_from_this { public: // need friend class so they can access the children_ field friend class Iterator; @@ -641,7 +641,7 @@ class MS_API Dataset : public std::enable_shared_from_this { /// \class SchemaObj /// \brief A schema object to set column type, data type and data shape. -class MS_API SchemaObj { +class DATASET_API SchemaObj { public: /// \brief Constructor explicit SchemaObj(const std::string &schema_file = "") : SchemaObj(StringToChar(schema_file)) {} @@ -764,7 +764,7 @@ class MS_API SchemaObj { /// \class BatchDataset /// \brief The result of applying Batch operator to the input dataset. -class MS_API BatchDataset : public Dataset { +class DATASET_API BatchDataset : public Dataset { public: /// \brief Constructor of BatchDataset. /// \note Combines batch_size number of consecutive rows into batches. @@ -782,7 +782,7 @@ class MS_API BatchDataset : public Dataset { /// \class BucketBatchByLengthDataset /// \brief The result of applying BucketBatchByLength operator to the input dataset. -class MS_API BucketBatchByLengthDataset : public Dataset { +class DATASET_API BucketBatchByLengthDataset : public Dataset { public: /// \brief Constructor of BucketBatchByLengthDataset. /// \note Bucket elements according to their lengths. Each bucket will be padded and batched when @@ -823,7 +823,7 @@ class MS_API BucketBatchByLengthDataset : public Dataset { /// \class ConcatDataset /// \brief The result of applying concat dataset operator to the input Dataset. -class MS_API ConcatDataset : public Dataset { +class DATASET_API ConcatDataset : public Dataset { public: /// \brief Constructor of ConcatDataset. /// \note Concat the datasets in the input. @@ -836,7 +836,7 @@ class MS_API ConcatDataset : public Dataset { /// \class FilterDataset /// \brief The result of applying filter predicate to the input Dataset. -class MS_API FilterDataset : public Dataset { +class DATASET_API FilterDataset : public Dataset { public: /// \brief Constructor of FilterDataset. /// \note If input_columns is not provided or empty, all columns will be used. @@ -852,7 +852,7 @@ class MS_API FilterDataset : public Dataset { /// \class MapDataset /// \brief The result of applying the Map operator to the input Dataset. -class MS_API MapDataset : public Dataset { +class DATASET_API MapDataset : public Dataset { public: /// \brief Constructor of MapDataset. /// \note Applies each operation in operations to this dataset. @@ -882,7 +882,7 @@ class MS_API MapDataset : public Dataset { /// \class ProjectDataset /// \brief The result of applying the Project operator to the input Dataset. -class MS_API ProjectDataset : public Dataset { +class DATASET_API ProjectDataset : public Dataset { public: /// \brief Constructor of ProjectDataset. /// \note Applies project to the dataset. @@ -896,7 +896,7 @@ class MS_API ProjectDataset : public Dataset { /// \class RenameDataset /// \brief The result of applying the Rename operator to the input Dataset. -class MS_API RenameDataset : public Dataset { +class DATASET_API RenameDataset : public Dataset { public: /// \brief Constructor of RenameDataset. /// \note Renames the columns in the input dataset. @@ -912,7 +912,7 @@ class MS_API RenameDataset : public Dataset { /// \class RepeatDataset /// \brief The result of applying the Repeat operator to the input Dataset. -class MS_API RepeatDataset : public Dataset { +class DATASET_API RepeatDataset : public Dataset { public: /// \brief Constructor of RepeatDataset. /// \note Repeats this dataset count times. Repeat indefinitely if count is -1. @@ -926,7 +926,7 @@ class MS_API RepeatDataset : public Dataset { /// \class ShuffleDataset /// \brief The result of applying the Shuffle operator to the input Dataset. -class MS_API ShuffleDataset : public Dataset { +class DATASET_API ShuffleDataset : public Dataset { public: /// \brief Constructor of ShuffleDataset. /// \note Randomly shuffles the rows of this dataset. @@ -940,7 +940,7 @@ class MS_API ShuffleDataset : public Dataset { /// \class SkipDataset /// \brief The result of applying the Skip operator to the input Dataset. -class MS_API SkipDataset : public Dataset { +class DATASET_API SkipDataset : public Dataset { public: /// \brief Constructor of SkipDataset. /// \note Skips count elements in this dataset. @@ -954,7 +954,7 @@ class MS_API SkipDataset : public Dataset { /// \class TakeDataset /// \brief The result of applying the Take operator to the input Dataset. -class MS_API TakeDataset : public Dataset { +class DATASET_API TakeDataset : public Dataset { public: /// \brief Constructor of TakeDataset. /// \note Takes count elements in this dataset. @@ -968,7 +968,7 @@ class MS_API TakeDataset : public Dataset { /// \class ZipDataset /// \brief The result of applying the Zip operator to the input Dataset. -class MS_API ZipDataset : public Dataset { +class DATASET_API ZipDataset : public Dataset { public: /// \brief Constructor of ZipDataset. /// \note Applies zip to the dataset. @@ -985,7 +985,7 @@ class MS_API ZipDataset : public Dataset { /// compiler option '_GLIBCXX_USE_CXX11_ABI' while char is free of this restriction. /// Check API `mindspore::dataset::Schema` and find more usage. /// \return Shared pointer to the current schema. -std::shared_ptr MS_API SchemaCharIF(const std::vector &schema_file); +std::shared_ptr DATASET_API SchemaCharIF(const std::vector &schema_file); /// \brief Function to create a SchemaObj. /// \param[in] schema_file Path of schema file (default = "", which means do not set the path). @@ -998,13 +998,13 @@ std::shared_ptr MS_API SchemaCharIF(const std::vector &schema_f /// schema->add_column("label", mindspore::DataType::kNumberTypeUInt8, {1}); /// std::shared_ptr ds = RandomData(50, schema); /// \endcode -inline std::shared_ptr MS_API Schema(const std::string &schema_file = "") { +inline std::shared_ptr DATASET_API Schema(const std::string &schema_file = "") { return SchemaCharIF(StringToChar(schema_file)); } /// \class AGNewsDataset /// \brief A source dataset that reads and parses AG News datasets. -class MS_API AGNewsDataset : public Dataset { +class DATASET_API AGNewsDataset : public Dataset { public: /// \brief Constructor of AGNewsDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1044,17 +1044,18 @@ class MS_API AGNewsDataset : public Dataset { /// specified only when num_shards is also specified (Default = 0). /// \param[in] cache Tensor cache to use.(default=nullptr which means no cache is used). /// \return Shared pointer to the AGNewsDataset. -inline std::shared_ptr MS_API AGNews(const std::string &dataset_dir, const std::string &usage = "all", - int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API AGNews(const std::string &dataset_dir, + const std::string &usage = "all", int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class AlbumDataset /// \brief A source dataset for reading and parsing Album dataset. -class MS_API AlbumDataset : public Dataset { +class DATASET_API AlbumDataset : public Dataset { public: /// \brief Constructor of AlbumDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1122,7 +1123,7 @@ class MS_API AlbumDataset : public Dataset { /// /* Note: As we defined before, each data dictionary owns keys "image", "label" and "id" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Album(const std::string &dataset_dir, const std::string &data_schema, const std::vector &column_names = {}, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -1139,10 +1140,10 @@ Album(const std::string &dataset_dir, const std::string &data_schema, const std: /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the AlbumDataset -inline std::shared_ptr MS_API Album(const std::string &dataset_dir, const std::string &data_schema, - const std::vector &column_names, bool decode, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Album(const std::string &dataset_dir, const std::string &data_schema, + const std::vector &column_names, bool decode, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(data_schema), VectorStringToChar(column_names), decode, sampler, cache); } @@ -1156,17 +1157,17 @@ inline std::shared_ptr MS_API Album(const std::string &dataset_dir /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the AlbumDataset. -inline std::shared_ptr MS_API Album(const std::string &dataset_dir, const std::string &data_schema, - const std::vector &column_names, bool decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Album(const std::string &dataset_dir, const std::string &data_schema, + const std::vector &column_names, bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(data_schema), VectorStringToChar(column_names), decode, sampler, cache); } /// \class AmazonReviewDataset /// \brief A source dataset for reading and parsing Amazon Review Polarity and Amazon Review Full datasets. -class MS_API AmazonReviewDataset : public Dataset { +class DATASET_API AmazonReviewDataset : public Dataset { public: /// \brief Constructor of AmazonReviewDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1220,19 +1221,17 @@ class MS_API AmazonReviewDataset : public Dataset { /// /* Note: In AmazonReview dataset, each data dictionary owns keys "label", "title", "content" */ /// auto title = row["title"]; /// \endcode -inline std::shared_ptr MS_API AmazonReview(const std::string &dataset_dir, - const std::string &usage = "all", - int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +AmazonReview(const std::string &dataset_dir, const std::string &usage = "all", int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class Caltech256Dataset /// \brief A source dataset for reading and parsing Caltech256 dataset. -class MS_API Caltech256Dataset : public Dataset { +class DATASET_API Caltech256Dataset : public Dataset { public: /// \brief Constructor of Caltech256Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1284,7 +1283,7 @@ class MS_API Caltech256Dataset : public Dataset { /// /* Note: In Caltech256 dataset, each data dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Caltech256(const std::string &dataset_dir, const std::shared_ptr &sampler = std::make_shared(), bool decode = false, const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), decode, sampler, cache); @@ -1297,9 +1296,9 @@ Caltech256(const std::string &dataset_dir, const std::shared_ptr &sampl /// \param[in] decode Decode the images after reading (default=false). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the Caltech256Dataset. -inline std::shared_ptr MS_API Caltech256(const std::string &dataset_dir, const Sampler *sampler, - bool decode = false, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Caltech256(const std::string &dataset_dir, const Sampler *sampler, + bool decode = false, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), decode, sampler, cache); } @@ -1310,16 +1309,16 @@ inline std::shared_ptr MS_API Caltech256(const std::string &d /// \param[in] decode Decode the images after reading (default=false). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the Caltech256Dataset. -inline std::shared_ptr MS_API Caltech256(const std::string &dataset_dir, - const std::reference_wrapper &sampler, - bool decode = false, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Caltech256(const std::string &dataset_dir, + const std::reference_wrapper &sampler, + bool decode = false, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), decode, sampler, cache); } /// \class CelebADataset /// \brief A source dataset for reading and parsing CelebA dataset. -class MS_API CelebADataset : public Dataset { +class DATASET_API CelebADataset : public Dataset { public: /// \brief Constructor of CelebADataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1383,7 +1382,7 @@ class MS_API CelebADataset : public Dataset { /// /* Note: In CelebA dataset, each data dictionary owns keys "image" and "attr" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API CelebA(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), bool decode = false, const std::set &extensions = {}, const std::shared_ptr &cache = nullptr) { @@ -1401,10 +1400,10 @@ CelebA(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] extensions Set of file extensions to be included in the dataset (default={}). /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the CelebADataset. -inline std::shared_ptr MS_API CelebA(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, bool decode = false, - const std::set &extensions = {}, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API CelebA(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, bool decode = false, + const std::set &extensions = {}, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, decode, SetStringToChar(extensions), cache); } @@ -1419,17 +1418,18 @@ inline std::shared_ptr MS_API CelebA(const std::string &dataset_d /// \param[in] extensions Set of file extensions to be included in the dataset (default={}). /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the CelebADataset. -inline std::shared_ptr MS_API CelebA(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper &sampler, bool decode = false, - const std::set &extensions = {}, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API CelebA(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper &sampler, + bool decode = false, + const std::set &extensions = {}, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, decode, SetStringToChar(extensions), cache); } /// \class Cifar10Dataset /// \brief A source dataset for reading and parsing Cifar10 dataset. -class MS_API Cifar10Dataset : public Dataset { +class DATASET_API Cifar10Dataset : public Dataset { public: /// \brief Constructor of Cifar10Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1482,7 +1482,7 @@ class MS_API Cifar10Dataset : public Dataset { /// /* Note: In CIFAR10 dataset, each data dictionary owns keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Cifar10(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -1496,9 +1496,9 @@ Cifar10(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the Cifar10Dataset. -inline std::shared_ptr MS_API Cifar10(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Cifar10(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -1509,15 +1509,15 @@ inline std::shared_ptr MS_API Cifar10(const std::string &dataset /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the Cifar10Dataset. -inline std::shared_ptr MS_API Cifar10(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Cifar10(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class Cifar100Dataset /// \brief A source dataset for reading and parsing Cifar100 dataset. -class MS_API Cifar100Dataset : public Dataset { +class DATASET_API Cifar100Dataset : public Dataset { public: /// \brief Constructor of Cifar100Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1570,7 +1570,7 @@ class MS_API Cifar100Dataset : public Dataset { /// /* Note: In CIFAR100 dataset, each dictionary has 3 keys: "image", "fine_label" and "coarse_label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Cifar100(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -1584,9 +1584,9 @@ Cifar100(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the Cifar100Dataset. -inline std::shared_ptr MS_API Cifar100(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Cifar100(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -1597,15 +1597,15 @@ inline std::shared_ptr MS_API Cifar100(const std::string &datas /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the Cifar100Dataset. -inline std::shared_ptr MS_API Cifar100(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Cifar100(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class CityscapesDataset /// \brief A source dataset for reading and parsing Cityscapes dataset. -class MS_API CityscapesDataset : public Dataset { +class DATASET_API CityscapesDataset : public Dataset { public: /// \brief Constructor of CityscapesDataset. /// \param[in] dataset_dir The dataset dir to be read. @@ -1685,7 +1685,7 @@ class MS_API CityscapesDataset : public Dataset { /// /* Note: In Cityscapes dataset, each data dictionary owns keys "image" and "task" */ /// auto task = row["task"]; /// \endcode -inline std::shared_ptr MS_API Cityscapes( +inline std::shared_ptr DATASET_API Cityscapes( const std::string &dataset_dir, const std::string &usage, const std::string &quality_mode, const std::string &task, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -1706,10 +1706,9 @@ inline std::shared_ptr MS_API Cityscapes( /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current CityscapesDataset. -inline std::shared_ptr MS_API Cityscapes(const std::string &dataset_dir, const std::string &usage, - const std::string &quality_mode, const std::string &task, - bool decode, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Cityscapes( + const std::string &dataset_dir, const std::string &usage, const std::string &quality_mode, const std::string &task, + bool decode, const Sampler *sampler, const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), StringToChar(quality_mode), StringToChar(task), decode, sampler, cache); } @@ -1727,17 +1726,16 @@ inline std::shared_ptr MS_API Cityscapes(const std::string &d /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current CityscapesDataset. -inline std::shared_ptr MS_API Cityscapes(const std::string &dataset_dir, const std::string &usage, - const std::string &quality_mode, const std::string &task, - bool decode, const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Cityscapes( + const std::string &dataset_dir, const std::string &usage, const std::string &quality_mode, const std::string &task, + bool decode, const std::reference_wrapper &sampler, const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), StringToChar(quality_mode), StringToChar(task), decode, sampler, cache); } /// \class CLUEDataset /// \brief A source dataset for reading and parsing CLUE dataset. -class MS_API CLUEDataset : public Dataset { +class DATASET_API CLUEDataset : public Dataset { public: /// \brief Constructor of CLUEDataset. /// \param[in] dataset_files List of files to be read to search for a pattern of files. The list @@ -1794,18 +1792,19 @@ class MS_API CLUEDataset : public Dataset { /// /// auto text = row["sentence1"]; /// \endcode -inline std::shared_ptr MS_API CLUE(const std::vector &dataset_files, - const std::string &task = "AFQMC", const std::string &usage = "train", - int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API CLUE(const std::vector &dataset_files, + const std::string &task = "AFQMC", + const std::string &usage = "train", int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, + int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(VectorStringToChar(dataset_files), StringToChar(task), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class CMUArcticDataset /// \brief A source dataset for reading and parsing CMUArctic dataset. -class MS_API CMUArcticDataset : public Dataset { +class DATASET_API CMUArcticDataset : public Dataset { public: /// \brief Constructor of CMUArcticDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1863,7 +1862,7 @@ class MS_API CMUArcticDataset : public Dataset { /// and "utterance_id" */ /// auto waveform = row["waveform"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API CMUArctic(const std::string &dataset_dir, const std::string &name = "aew", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -1878,9 +1877,9 @@ CMUArctic(const std::string &dataset_dir, const std::string &name = "aew", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the CMUArcticDataset. -inline std::shared_ptr MS_API CMUArctic(const std::string &dataset_dir, const std::string &name, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API CMUArctic(const std::string &dataset_dir, const std::string &name, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(name), sampler, cache); } @@ -1892,15 +1891,15 @@ inline std::shared_ptr MS_API CMUArctic(const std::string &dat /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the CMUArcticDataset. -inline std::shared_ptr MS_API CMUArctic(const std::string &dataset_dir, const std::string &name, - const std::reference_wrapper sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API CMUArctic(const std::string &dataset_dir, const std::string &name, + const std::reference_wrapper sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(name), sampler, cache); } /// \class CocoDataset /// \brief A source dataset for reading and parsing Coco dataset. -class MS_API CocoDataset : public Dataset { +class DATASET_API CocoDataset : public Dataset { public: /// \brief Constructor of CocoDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1978,7 +1977,7 @@ class MS_API CocoDataset : public Dataset { /// /* Note: In COCO dataset, each dictionary has keys "image" and "annotation" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Coco(const std::string &dataset_dir, const std::string &annotation_file, const std::string &task = "Detection", const bool &decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr, const bool &extra_metadata = false) { @@ -2005,10 +2004,11 @@ Coco(const std::string &dataset_dir, const std::string &annotation_file, const s /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \param[in] extra_metadata Flag to add extra meta-data to row. (default=false). /// \return Shared pointer to the CocoDataset. -inline std::shared_ptr MS_API Coco(const std::string &dataset_dir, const std::string &annotation_file, - const std::string &task, const bool &decode, const Sampler *sampler, - const std::shared_ptr &cache = nullptr, - const bool &extra_metadata = false) { +inline std::shared_ptr DATASET_API Coco(const std::string &dataset_dir, const std::string &annotation_file, + const std::string &task, const bool &decode, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr, + const bool &extra_metadata = false) { return std::make_shared(StringToChar(dataset_dir), StringToChar(annotation_file), StringToChar(task), decode, sampler, cache, extra_metadata); } @@ -2032,18 +2032,18 @@ inline std::shared_ptr MS_API Coco(const std::string &dataset_dir, /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \param[in] extra_metadata Flag to add extra meta-data to row. (default=false). /// \return Shared pointer to the CocoDataset. -inline std::shared_ptr MS_API Coco(const std::string &dataset_dir, const std::string &annotation_file, - const std::string &task, const bool &decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr, - const bool &extra_metadata = false) { +inline std::shared_ptr DATASET_API Coco(const std::string &dataset_dir, const std::string &annotation_file, + const std::string &task, const bool &decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr, + const bool &extra_metadata = false) { return std::make_shared(StringToChar(dataset_dir), StringToChar(annotation_file), StringToChar(task), decode, sampler, cache, extra_metadata); } /// \class CoNLL2000Dataset /// \brief A source dataset for reading and parsing CoNLL2000Dataset. -class MS_API CoNLL2000Dataset : public Dataset { +class DATASET_API CoNLL2000Dataset : public Dataset { public: /// \brief Constructor of CoNLL2000Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -2096,18 +2096,19 @@ class MS_API CoNLL2000Dataset : public Dataset { /// /* Note: In CoNLL2000 dataset, each dictionary has keys "word", "pos_tag", "chunk_tag" */ /// auto word = row["word"]; /// \endcode -inline std::shared_ptr MS_API CoNLL2000(const std::string &dataset_dir, - const std::string &usage = "all", int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API CoNLL2000(const std::string &dataset_dir, + const std::string &usage = "all", + int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class CSVDataset /// \brief A source dataset that reads and parses comma-separated values (CSV) datasets. -class MS_API CSVDataset : public Dataset { +class DATASET_API CSVDataset : public Dataset { public: /// \brief Constructor of CSVDataset. /// \param[in] dataset_files List of files to be read to search for a pattern of files. The list @@ -2173,12 +2174,13 @@ class MS_API CSVDataset : public Dataset { /// /* Note: As we defined before, the dataset has column "col1", "col2", "col3" and "col4" */ /// auto col1 = row["col1"]; /// \endcode -inline std::shared_ptr MS_API CSV(const std::vector &dataset_files, char field_delim = ',', - const std::vector> &column_defaults = {}, - const std::vector &column_names = {}, - int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API CSV(const std::vector &dataset_files, + char field_delim = ',', + const std::vector> &column_defaults = {}, + const std::vector &column_names = {}, + int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(VectorStringToChar(dataset_files), field_delim, column_defaults, VectorStringToChar(column_names), num_samples, shuffle, num_shards, shard_id, cache); @@ -2186,7 +2188,7 @@ inline std::shared_ptr MS_API CSV(const std::vector &da /// \class DBpediaDataset /// \brief A source dataset for reading and parsing DBpedia dataset. -class MS_API DBpediaDataset : public Dataset { +class DATASET_API DBpediaDataset : public Dataset { public: /// \brief Constructor of DBpediaDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -2224,18 +2226,18 @@ class MS_API DBpediaDataset : public Dataset { /// specified only when num_shards is also specified (Default = 0). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the DBpediaDataset -inline std::shared_ptr MS_API DBpedia(const std::string &dataset_dir, const std::string &usage = "all", - int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API DBpedia(const std::string &dataset_dir, + const std::string &usage = "all", int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class DIV2KDataset /// \brief A source dataset for reading and parsing DIV2K dataset. -class MS_API DIV2KDataset : public Dataset { +class DATASET_API DIV2KDataset : public Dataset { public: /// \brief Constructor of DIV2KDataset. /// \param[in] dataset_dir The dataset dir to be read. @@ -2306,7 +2308,7 @@ class MS_API DIV2KDataset : public Dataset { /// /* Note: In DIV2K dataset, each dictionary has keys "hr_image" and "lr_image" */ /// auto hr_image = row["hr_image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API DIV2K(const std::string &dataset_dir, const std::string &usage, const std::string &downgrade, int32_t scale, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -2325,10 +2327,10 @@ DIV2K(const std::string &dataset_dir, const std::string &usage, const std::strin /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current DIV2KDataset. -inline std::shared_ptr MS_API DIV2K(const std::string &dataset_dir, const std::string &usage, - const std::string &downgrade, int32_t scale, bool decode, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API DIV2K(const std::string &dataset_dir, const std::string &usage, + const std::string &downgrade, int32_t scale, bool decode, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), StringToChar(downgrade), scale, decode, sampler, cache); } @@ -2344,17 +2346,17 @@ inline std::shared_ptr MS_API DIV2K(const std::string &dataset_dir /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current DIV2KDataset. -inline std::shared_ptr MS_API DIV2K(const std::string &dataset_dir, const std::string &usage, - const std::string &downgrade, int32_t scale, bool decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API DIV2K(const std::string &dataset_dir, const std::string &usage, + const std::string &downgrade, int32_t scale, bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), StringToChar(downgrade), scale, decode, sampler, cache); } /// \class EMnistDataset /// \brief A source dataset for reading and parsing EMnist dataset. -class MS_API EMnistDataset : public Dataset { +class DATASET_API EMnistDataset : public Dataset { public: /// \brief Constructor of EMnistDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -2414,7 +2416,7 @@ class MS_API EMnistDataset : public Dataset { /// /* Note: In EMNIST dataset dataset, each dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API EMnist(const std::string &dataset_dir, const std::string &name, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -2430,9 +2432,9 @@ EMnist(const std::string &dataset_dir, const std::string &name, const std::strin /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current EMnistDataset. -inline std::shared_ptr MS_API EMnist(const std::string &dataset_dir, const std::string &usage, - const std::string &name, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API EMnist(const std::string &dataset_dir, const std::string &usage, + const std::string &name, const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(name), StringToChar(usage), sampler, cache); } @@ -2445,17 +2447,17 @@ inline std::shared_ptr MS_API EMnist(const std::string &dataset_d /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current EMnistDataset. -inline std::shared_ptr MS_API EMnist(const std::string &dataset_dir, const std::string &name, - const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API EMnist(const std::string &dataset_dir, const std::string &name, + const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(name), StringToChar(usage), sampler, cache); } /// \class EnWik9Dataset /// \brief A source dataset for reading and parsing EnWik9 dataset. -class MS_API EnWik9Dataset : public Dataset { +class DATASET_API EnWik9Dataset : public Dataset { public: /// \brief Function to create a EnWik9Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -2491,16 +2493,16 @@ class MS_API EnWik9Dataset : public Dataset { /// specified only when num_shards is also specified (Default = 0). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the EnWik9Dataset. -inline std::shared_ptr MS_API EnWik9(const std::string &dataset_dir, int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, - int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API EnWik9(const std::string &dataset_dir, int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), num_samples, shuffle, num_shards, shard_id, cache); } /// \class FakeImageDataset /// \brief A source dataset for generating fake images. -class MS_API FakeImageDataset : public Dataset { +class DATASET_API FakeImageDataset : public Dataset { public: /// \brief Constructor of FakeImageDataset. /// \param[in] num_images The number of images to generate, which must be positive. @@ -2548,7 +2550,7 @@ class MS_API FakeImageDataset : public Dataset { /// given, a `RandomSampler` will be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current FakeDataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API FakeImage(int32_t num_images = 1000, const std::vector &image_size = {224, 224, 3}, int32_t num_classes = 10, int32_t base_seed = 0, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -2564,10 +2566,11 @@ FakeImage(int32_t num_images = 1000, const std::vector &image_size = {2 /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current FakeImageDataset. -inline std::shared_ptr MS_API FakeImage(int32_t num_images, const std::vector &image_size, - int32_t num_classes, int32_t base_seed, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API FakeImage(int32_t num_images, + const std::vector &image_size, + int32_t num_classes, int32_t base_seed, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(num_images, image_size, num_classes, base_seed, sampler, cache); } @@ -2580,16 +2583,17 @@ inline std::shared_ptr MS_API FakeImage(int32_t num_images, co /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current FakeImageDataset. -inline std::shared_ptr MS_API FakeImage(int32_t num_images, const std::vector &image_size, - int32_t num_classes, int32_t base_seed, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API FakeImage(int32_t num_images, + const std::vector &image_size, + int32_t num_classes, int32_t base_seed, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(num_images, image_size, num_classes, base_seed, sampler, cache); } /// \class FashionMnistDataset /// \brief A source dataset that reads and parses FASHION-MNIST dataset. -class MS_API FashionMnistDataset : public Dataset { +class DATASET_API FashionMnistDataset : public Dataset { public: /// \brief Constructor of FashionMnistDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -2628,7 +2632,7 @@ class MS_API FashionMnistDataset : public Dataset { /// given, a `RandomSampler` will be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the FashionMnistDataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API FashionMnist(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -2642,9 +2646,9 @@ FashionMnist(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the FashionMnistDataset. -inline std::shared_ptr MS_API FashionMnist(const std::string &dataset_dir, - const std::string &usage, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +FashionMnist(const std::string &dataset_dir, const std::string &usage, const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -2655,16 +2659,15 @@ inline std::shared_ptr MS_API FashionMnist(const std::strin /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the FashionMnistDataset. -inline std::shared_ptr MS_API FashionMnist(const std::string &dataset_dir, - const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +FashionMnist(const std::string &dataset_dir, const std::string &usage, const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class FlickrDataset /// \brief A source dataset for reading and parsing Flickr dataset. -class MS_API FlickrDataset : public Dataset { +class DATASET_API FlickrDataset : public Dataset { public: /// \brief Constructor of FlickrDataset. /// \param[in] dataset_dir The dataset dir to be read @@ -2722,7 +2725,7 @@ class MS_API FlickrDataset : public Dataset { /// /* Note: In FLICKR dataset, each dictionary has keys "image" and "annotation" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Flickr(const std::string &dataset_dir, const std::string &annotation_file, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -2738,9 +2741,10 @@ Flickr(const std::string &dataset_dir, const std::string &annotation_file, bool /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current FlickrDataset -inline std::shared_ptr MS_API Flickr(const std::string &dataset_dir, const std::string &annotation_file, - bool decode, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Flickr(const std::string &dataset_dir, + const std::string &annotation_file, bool decode, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(annotation_file), decode, sampler, cache); } @@ -2753,16 +2757,17 @@ inline std::shared_ptr MS_API Flickr(const std::string &dataset_d /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current FlickrDataset -inline std::shared_ptr MS_API Flickr(const std::string &dataset_dir, const std::string &annotation_file, - bool decode, const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Flickr(const std::string &dataset_dir, + const std::string &annotation_file, bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(annotation_file), decode, sampler, cache); } /// \class GTZANDataset /// \brief A source dataset for reading and parsing GTZAN dataset. -class MS_API GTZANDataset : public Dataset { +class DATASET_API GTZANDataset : public Dataset { public: /// \brief Constructor of GTZANDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -2814,7 +2819,7 @@ class MS_API GTZANDataset : public Dataset { /// /* Note: In GTZAN dataset, each data dictionary has keys "waveform", "sample_rate" and "label" */ /// auto waveform = row["waveform"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API GTZAN(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -2828,9 +2833,9 @@ GTZAN(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the GTZANDataset. -inline std::shared_ptr MS_API GTZAN(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API GTZAN(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -2841,15 +2846,15 @@ inline std::shared_ptr MS_API GTZAN(const std::string &dataset_dir /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the GTZANDataset. -inline std::shared_ptr MS_API GTZAN(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API GTZAN(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class ImageFolderDataset /// \brief A source dataset that reads images from a tree of directories. -class MS_API ImageFolderDataset : public Dataset { +class DATASET_API ImageFolderDataset : public Dataset { public: /// \brief Constructor of ImageFolderDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -2918,7 +2923,7 @@ class MS_API ImageFolderDataset : public Dataset { /// /* Note: In ImageFolder dataset, each data dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API ImageFolder(const std::string &dataset_dir, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::set &extensions = {}, const std::map &class_indexing = {}, @@ -2938,11 +2943,9 @@ ImageFolder(const std::string &dataset_dir, bool decode = false, /// \param[in] class_indexing a class name to label map. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the ImageFolderDataset. -inline std::shared_ptr MS_API ImageFolder(const std::string &dataset_dir, bool decode, - const Sampler *sampler, - const std::set &extensions = {}, - const std::map &class_indexing = {}, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API ImageFolder( + const std::string &dataset_dir, bool decode, const Sampler *sampler, const std::set &extensions = {}, + const std::map &class_indexing = {}, const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), decode, sampler, SetStringToChar(extensions), MapStringToChar(class_indexing), cache); } @@ -2958,18 +2961,17 @@ inline std::shared_ptr MS_API ImageFolder(const std::string /// \param[in] class_indexing a class name to label map. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the ImageFolderDataset. -inline std::shared_ptr MS_API ImageFolder(const std::string &dataset_dir, bool decode, - const std::reference_wrapper &sampler, - const std::set &extensions = {}, - const std::map &class_indexing = {}, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +ImageFolder(const std::string &dataset_dir, bool decode, const std::reference_wrapper &sampler, + const std::set &extensions = {}, const std::map &class_indexing = {}, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), decode, sampler, SetStringToChar(extensions), MapStringToChar(class_indexing), cache); } /// \class IMDBDataset /// \brief A source dataset for reading and parsing IMDB dataset. -class MS_API IMDBDataset : public Dataset { +class DATASET_API IMDBDataset : public Dataset { public: /// \brief Constructor of IMDBDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -3022,7 +3024,7 @@ class MS_API IMDBDataset : public Dataset { /// /* Note: In IMDB dataset, each data dictionary has keys "text" and "label" */ /// auto text = row["text"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API IMDB(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -3036,9 +3038,9 @@ IMDB(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the IMDBDataset. -inline std::shared_ptr MS_API IMDB(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API IMDB(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -3049,15 +3051,15 @@ inline std::shared_ptr MS_API IMDB(const std::string &dataset_dir, /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the IMDBDataset. -inline std::shared_ptr MS_API IMDB(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API IMDB(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class IWSLT2016Dataset. /// \brief A source dataset for reading and parsing IWSLT2016 dataset. -class MS_API IWSLT2016Dataset : public Dataset { +class DATASET_API IWSLT2016Dataset : public Dataset { public: /// \brief Constructor of IWSLT2016Dataset. /// \note The generated dataset has two columns ["text", "translation"]. @@ -3104,7 +3106,7 @@ class MS_API IWSLT2016Dataset : public Dataset { /// specified only when num_shards is also specified (Default = 0). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the IWSLT2016Dataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API IWSLT2016(const std::string &dataset_dir, const std::string &usage = "all", const std::vector &language_pair = {"de", "en"}, const std::string &valid_set = "tst2013", const std::string &test_set = "tst2014", int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, @@ -3116,7 +3118,7 @@ IWSLT2016(const std::string &dataset_dir, const std::string &usage = "all", /// \class IWSLT2017Dataset. /// \brief A source dataset for reading and parsing IWSLT2017 dataset. -class MS_API IWSLT2017Dataset : public Dataset { +class DATASET_API IWSLT2017Dataset : public Dataset { public: /// \brief Constructor of IWSLT2017Dataset. /// \note The generated dataset has two columns ["text", "translation"]. @@ -3159,13 +3161,11 @@ class MS_API IWSLT2017Dataset : public Dataset { /// specified only when num_shards is also specified (Default = 0). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the IWSLT2017Dataset. -inline std::shared_ptr MS_API IWSLT2017(const std::string &dataset_dir, - const std::string &usage = "all", - const std::vector &language_pair = {"de", "en"}, - int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +IWSLT2017(const std::string &dataset_dir, const std::string &usage = "all", + const std::vector &language_pair = {"de", "en"}, int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), VectorStringToChar(language_pair), num_samples, shuffle, num_shards, shard_id, cache); @@ -3173,7 +3173,7 @@ inline std::shared_ptr MS_API IWSLT2017(const std::string &dat /// \class KITTIDataset /// \brief A source dataset that reads KITTI images and labels. -class MS_API KITTIDataset : public Dataset { +class DATASET_API KITTIDataset : public Dataset { public: /// \brief Constructor of KITTIDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -3231,7 +3231,7 @@ class MS_API KITTIDataset : public Dataset { /// /* Note: In KITTI dataset, each dictionary has key "image" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API KITTI(const std::string &dataset_dir, const std::string &usage = "train", bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -3248,9 +3248,9 @@ KITTI(const std::string &dataset_dir, const std::string &usage = "train", bool d /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API KITTI(const std::string &dataset_dir, const std::string &usage, bool decode, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API KITTI(const std::string &dataset_dir, const std::string &usage, + bool decode, const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), decode, sampler, cache); } @@ -3264,15 +3264,15 @@ inline std::shared_ptr MS_API KITTI(const std::string &dataset_dir /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API KITTI(const std::string &dataset_dir, const std::string &usage, bool decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API KITTI(const std::string &dataset_dir, const std::string &usage, + bool decode, const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), decode, sampler, cache); } /// \class KMnistDataset. /// \brief A source dataset for reading and parsing KMnist dataset. -class MS_API KMnistDataset : public Dataset { +class DATASET_API KMnistDataset : public Dataset { public: /// \brief Function to create a KMnistDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -3314,7 +3314,7 @@ class MS_API KMnistDataset : public Dataset { /// given, a `RandomSampler` will be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current KMnistDataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API KMnist(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -3328,9 +3328,9 @@ KMnist(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current KMnistDataset. -inline std::shared_ptr MS_API KMnist(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API KMnist(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -3341,15 +3341,15 @@ inline std::shared_ptr MS_API KMnist(const std::string &dataset_d /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current KMnistDataset. -inline std::shared_ptr MS_API KMnist(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API KMnist(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class LFWDataset /// \brief A source dataset for reading and parsing LFW dataset. -class MS_API LFWDataset : public Dataset { +class DATASET_API LFWDataset : public Dataset { public: /// \brief Constructor of LFWDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -3419,7 +3419,7 @@ class MS_API LFWDataset : public Dataset { /// /* Note: In LFW dataset, each data dictionary owns keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API LFW(const std::string &dataset_dir, const std::string &task = "people", const std::string &usage = "all", const std::string &image_set = "funneled", bool decode = false, const std::shared_ptr &sampler = std::make_shared(), @@ -3439,10 +3439,10 @@ LFW(const std::string &dataset_dir, const std::string &task = "people", const st /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the LFWDataset. -inline std::shared_ptr MS_API LFW(const std::string &dataset_dir, const std::string &task, - const std::string &usage, const std::string &image_set, bool decode, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API LFW(const std::string &dataset_dir, const std::string &task, + const std::string &usage, const std::string &image_set, bool decode, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(task), StringToChar(usage), StringToChar(image_set), decode, sampler, cache); } @@ -3458,17 +3458,17 @@ inline std::shared_ptr MS_API LFW(const std::string &dataset_dir, co /// \param[in] sampler Shared pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the LFWDataset. -inline std::shared_ptr MS_API LFW(const std::string &dataset_dir, const std::string &task, - const std::string &usage, const std::string &image_set, bool decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API LFW(const std::string &dataset_dir, const std::string &task, + const std::string &usage, const std::string &image_set, bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(task), StringToChar(usage), StringToChar(image_set), decode, sampler, cache); } /// \class LibriTTSDataset /// \brief A source dataset for reading and parsing LibriTTSDataset dataset. -class MS_API LibriTTSDataset : public Dataset { +class DATASET_API LibriTTSDataset : public Dataset { public: /// \brief Constructor of LibriTTSDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -3526,7 +3526,7 @@ class MS_API LibriTTSDataset : public Dataset { /// "original_text", "normalized_text", "speaker_id", "chapter_id", "utterance_id"].*/ /// auto waveform = row["waveform"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API LibriTTS(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -3542,9 +3542,9 @@ LibriTTS(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the LibriTTSDataset. -inline std::shared_ptr MS_API LibriTTS(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API LibriTTS(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -3557,15 +3557,15 @@ inline std::shared_ptr MS_API LibriTTS(const std::string &datas /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the LibriTTSDataset. -inline std::shared_ptr MS_API LibriTTS(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API LibriTTS(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class LJSpeechDataset /// \brief A source dataset for reading and parsing LJSpeech dataset. -class MS_API LJSpeechDataset : public Dataset { +class DATASET_API LJSpeechDataset : public Dataset { public: /// \brief Constructor of LJSpeechDataset. /// \param[in] dataset_file The dataset file to be read. @@ -3601,7 +3601,7 @@ class MS_API LJSpeechDataset : public Dataset { /// given, a `RandomSampler` will be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use. (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API LJSpeech(const std::string &dataset_dir, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); @@ -3614,8 +3614,8 @@ LJSpeech(const std::string &dataset_dir, const std::shared_ptr &sampler /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API LJSpeech(const std::string &dataset_dir, Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API LJSpeech(const std::string &dataset_dir, Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); } @@ -3626,15 +3626,15 @@ inline std::shared_ptr MS_API LJSpeech(const std::string &datas /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API LJSpeech(const std::string &dataset_dir, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API LJSpeech(const std::string &dataset_dir, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); } /// \class LSUNDataset /// \brief A source dataset for reading LSUN datast. -class MS_API LSUNDataset : public Dataset { +class DATASET_API LSUNDataset : public Dataset { public: /// \brief Constructor of LSUNDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -3697,7 +3697,7 @@ class MS_API LSUNDataset : public Dataset { /// /* Note: In LSUNDataset, each data dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API LSUN(const std::string &dataset_dir, const std::string &usage = "all", const std::vector &classes = {}, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -3714,10 +3714,10 @@ LSUN(const std::string &dataset_dir, const std::string &usage = "all", const std /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (Default=nullptr, which means no cache is used). /// \return Shared pointer to the current LSUNDataset. -inline std::shared_ptr MS_API LSUN(const std::string &dataset_dir, const std::string &usage, - const std::vector &classes, bool decode, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API LSUN(const std::string &dataset_dir, const std::string &usage, + const std::vector &classes, bool decode, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), VectorStringToChar(classes), decode, sampler, cache); } @@ -3731,17 +3731,17 @@ inline std::shared_ptr MS_API LSUN(const std::string &dataset_dir, /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (Default=nullptr, which means no cache is used). /// \return Shared pointer to the current LSUNDataset. -inline std::shared_ptr MS_API LSUN(const std::string &dataset_dir, const std::string &usage, - const std::vector &classes, bool decode, - const std::reference_wrapper sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API LSUN(const std::string &dataset_dir, const std::string &usage, + const std::vector &classes, bool decode, + const std::reference_wrapper sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), VectorStringToChar(classes), decode, sampler, cache); } /// \class ManifestDataset /// \brief A source dataset for reading and parsing Manifest dataset. -class MS_API ManifestDataset : public Dataset { +class DATASET_API ManifestDataset : public Dataset { public: /// \brief Constructor of ManifestDataset. /// \param[in] dataset_file The dataset file to be read. @@ -3810,7 +3810,7 @@ class MS_API ManifestDataset : public Dataset { /// /* Note: In Manifest dataset, each data dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Manifest(const std::string &dataset_file, const std::string &usage = "train", const std::shared_ptr &sampler = std::make_shared(), const std::map &class_indexing = {}, bool decode = false, @@ -3829,11 +3829,11 @@ Manifest(const std::string &dataset_file, const std::string &usage = "train", /// \param[in] decode Decode the images after reading (default=false). /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the ManifestDataset. -inline std::shared_ptr MS_API Manifest(const std::string &dataset_file, const std::string &usage, - const Sampler *sampler, - const std::map &class_indexing = {}, - bool decode = false, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Manifest(const std::string &dataset_file, const std::string &usage, + const Sampler *sampler, + const std::map &class_indexing = {}, + bool decode = false, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_file), StringToChar(usage), sampler, MapStringToChar(class_indexing), decode, cache); } @@ -3848,18 +3848,18 @@ inline std::shared_ptr MS_API Manifest(const std::string &datas /// \param[in] decode Decode the images after reading (default=false). /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the ManifestDataset. -inline std::shared_ptr MS_API Manifest(const std::string &dataset_file, const std::string &usage, - const std::reference_wrapper &sampler, - const std::map &class_indexing = {}, - bool decode = false, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Manifest(const std::string &dataset_file, const std::string &usage, + const std::reference_wrapper &sampler, + const std::map &class_indexing = {}, + bool decode = false, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_file), StringToChar(usage), sampler, MapStringToChar(class_indexing), decode, cache); } /// \class MindDataDataset /// \brief A source dataset for reading and parsing MindRecord dataset. -class MS_API MindDataDataset : public Dataset { +class DATASET_API MindDataDataset : public Dataset { public: /// \brief Constructor of MindDataDataset. /// \param[in] dataset_file File name of one component of a mindrecord source. Other files with identical source @@ -4018,7 +4018,7 @@ class MS_API MindDataDataset : public Dataset { /// /* Note: As we defined before, each data dictionary owns keys "data", "file_name" and "label" */ /// auto data = row["data"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API MindData(const std::string &dataset_file, const std::vector &columns_list = {}, const std::shared_ptr &sampler = std::make_shared(), nlohmann::json *padded_sample = nullptr, int64_t num_padded = 0, @@ -4043,12 +4043,10 @@ MindData(const std::string &dataset_file, const std::vector &column /// ShuffleMode::kInfile - Shuffle samples in file. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the MindDataDataset. -inline std::shared_ptr MS_API MindData(const std::string &dataset_file, - const std::vector &columns_list, - const Sampler *sampler, nlohmann::json *padded_sample = nullptr, - int64_t num_padded = 0, - ShuffleMode shuffle_mode = ShuffleMode::kGlobal, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +MindData(const std::string &dataset_file, const std::vector &columns_list, const Sampler *sampler, + nlohmann::json *padded_sample = nullptr, int64_t num_padded = 0, + ShuffleMode shuffle_mode = ShuffleMode::kGlobal, const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_file), VectorStringToChar(columns_list), sampler, padded_sample, num_padded, shuffle_mode, cache); } @@ -4068,12 +4066,10 @@ inline std::shared_ptr MS_API MindData(const std::string &datas /// ShuffleMode::kInfile - Shuffle samples in file. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the MindDataDataset. -inline std::shared_ptr MS_API MindData(const std::string &dataset_file, - const std::vector &columns_list, - const std::reference_wrapper &sampler, - nlohmann::json *padded_sample = nullptr, int64_t num_padded = 0, - ShuffleMode shuffle_mode = ShuffleMode::kGlobal, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API MindData( + const std::string &dataset_file, const std::vector &columns_list, + const std::reference_wrapper &sampler, nlohmann::json *padded_sample = nullptr, int64_t num_padded = 0, + ShuffleMode shuffle_mode = ShuffleMode::kGlobal, const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_file), VectorStringToChar(columns_list), sampler, padded_sample, num_padded, shuffle_mode, cache); } @@ -4111,7 +4107,7 @@ inline std::shared_ptr MS_API MindData(const std::string &datas /// /* Note: As we defined before, each data dictionary owns keys "data", "file_name" and "label" */ /// auto data = row["data"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API MindData(const std::vector &dataset_files, const std::vector &columns_list = {}, const std::shared_ptr &sampler = std::make_shared(), nlohmann::json *padded_sample = nullptr, int64_t num_padded = 0, @@ -4135,12 +4131,10 @@ MindData(const std::vector &dataset_files, const std::vector MS_API MindData(const std::vector &dataset_files, - const std::vector &columns_list, - const Sampler *sampler, nlohmann::json *padded_sample = nullptr, - int64_t num_padded = 0, - ShuffleMode shuffle_mode = ShuffleMode::kGlobal, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +MindData(const std::vector &dataset_files, const std::vector &columns_list, + const Sampler *sampler, nlohmann::json *padded_sample = nullptr, int64_t num_padded = 0, + ShuffleMode shuffle_mode = ShuffleMode::kGlobal, const std::shared_ptr &cache = nullptr) { return std::make_shared(VectorStringToChar(dataset_files), VectorStringToChar(columns_list), sampler, padded_sample, num_padded, shuffle_mode, cache); } @@ -4160,19 +4154,17 @@ inline std::shared_ptr MS_API MindData(const std::vector MS_API MindData(const std::vector &dataset_files, - const std::vector &columns_list, - const std::reference_wrapper &sampler, - nlohmann::json *padded_sample = nullptr, int64_t num_padded = 0, - ShuffleMode shuffle_mode = ShuffleMode::kGlobal, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API MindData( + const std::vector &dataset_files, const std::vector &columns_list, + const std::reference_wrapper &sampler, nlohmann::json *padded_sample = nullptr, int64_t num_padded = 0, + ShuffleMode shuffle_mode = ShuffleMode::kGlobal, const std::shared_ptr &cache = nullptr) { return std::make_shared(VectorStringToChar(dataset_files), VectorStringToChar(columns_list), sampler, padded_sample, num_padded, shuffle_mode, cache); } /// \class MnistDataset /// \brief A source dataset for reading and parsing MNIST dataset. -class MS_API MnistDataset : public Dataset { +class DATASET_API MnistDataset : public Dataset { public: /// \brief Constructor of MnistDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4225,7 +4217,7 @@ class MS_API MnistDataset : public Dataset { /// /* Note: In MNIST dataset, each dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Mnist(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -4239,9 +4231,9 @@ Mnist(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the MnistDataset. -inline std::shared_ptr MS_API Mnist(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Mnist(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -4252,15 +4244,15 @@ inline std::shared_ptr MS_API Mnist(const std::string &dataset_dir /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the MnistDataset. -inline std::shared_ptr MS_API Mnist(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Mnist(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class Multi30kDataset /// \brief A source dataset that reads and parses Multi30k dataset. -class MS_API Multi30kDataset : public Dataset { +class DATASET_API Multi30kDataset : public Dataset { public: /// \brief Constructor of Multi30kDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4315,13 +4307,11 @@ class MS_API Multi30kDataset : public Dataset { /// /* Note: In Multi30kdataset, each dictionary has keys "text" and "translation" */ /// auto text = row["text"]; /// \endcode -inline std::shared_ptr MS_API Multi30k(const std::string &dataset_dir, - const std::string &usage = "all", - const std::vector &language_pair = {"en", "de"}, - int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +Multi30k(const std::string &dataset_dir, const std::string &usage = "all", + const std::vector &language_pair = {"en", "de"}, int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), VectorStringToChar(language_pair), num_samples, shuffle, num_shards, shard_id, cache); @@ -4329,7 +4319,7 @@ inline std::shared_ptr MS_API Multi30k(const std::string &datas /// \class OmniglotDataset /// \brief A source dataset for reading and parsing Omniglot dataset. -class MS_API OmniglotDataset : public Dataset { +class DATASET_API OmniglotDataset : public Dataset { public: /// \brief Constructor of OmniglotDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4385,7 +4375,7 @@ class MS_API OmniglotDataset : public Dataset { /// /* Note: In Omniglot dataset, each dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Omniglot(const std::string &dataset_dir, bool background = true, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -4400,9 +4390,9 @@ Omniglot(const std::string &dataset_dir, bool background = true, bool decode = f /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the current OmniglotDataset. -inline std::shared_ptr MS_API Omniglot(const std::string &dataset_dir, bool background, bool decode, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Omniglot(const std::string &dataset_dir, bool background, + bool decode, const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), background, decode, sampler, cache); } @@ -4414,15 +4404,16 @@ inline std::shared_ptr MS_API Omniglot(const std::string &datas /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the current OmniglotDataset. -inline std::shared_ptr MS_API Omniglot(const std::string &dataset_dir, bool background, bool decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Omniglot(const std::string &dataset_dir, bool background, + bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), background, decode, sampler, cache); } /// \class PennTreebankDataset /// \brief A source dataset for reading and parsing PennTreebank dataset. -class MS_API PennTreebankDataset : public Dataset { +class DATASET_API PennTreebankDataset : public Dataset { public: /// \brief Constructor of PennTreebank Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4462,19 +4453,17 @@ class MS_API PennTreebankDataset : public Dataset { /// specified only when num_shards is also specified (Default = 0). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the TextFileDataset. -inline std::shared_ptr MS_API PennTreebank(const std::string &dataset_dir, - const std::string &usage = "all", - int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +PennTreebank(const std::string &dataset_dir, const std::string &usage = "all", int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class PhotoTourDataset /// \brief A source dataset for reading and parsing PhotoTour dataset. -class MS_API PhotoTourDataset : public Dataset { +class DATASET_API PhotoTourDataset : public Dataset { public: /// \brief Constructor of PhotoTourDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4523,7 +4512,7 @@ class MS_API PhotoTourDataset : public Dataset { /// be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current PhotoTourDataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API PhotoTour(const std::string &dataset_dir, const std::string &name, const std::string &usage = "train", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -4541,9 +4530,9 @@ PhotoTour(const std::string &dataset_dir, const std::string &name, const std::st /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current PhotoTourDataset. -inline std::shared_ptr MS_API PhotoTour(const std::string &dataset_dir, const std::string &name, - const std::string &usage, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API PhotoTour(const std::string &dataset_dir, const std::string &name, + const std::string &usage, const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(name), StringToChar(usage), sampler, cache); } @@ -4558,17 +4547,17 @@ inline std::shared_ptr MS_API PhotoTour(const std::string &dat /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current PhotoTourDataset. -inline std::shared_ptr MS_API PhotoTour(const std::string &dataset_dir, const std::string &name, - const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API PhotoTour(const std::string &dataset_dir, const std::string &name, + const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(name), StringToChar(usage), sampler, cache); } /// \class Places365Dataset /// \brief A source dataset that reads and parses Places365 dataset. -class MS_API Places365Dataset : public Dataset { +class DATASET_API Places365Dataset : public Dataset { public: /// \brief Constructor of Places365Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4617,7 +4606,7 @@ class MS_API Places365Dataset : public Dataset { /// be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current Places365Dataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Places365(const std::string &dataset_dir, const std::string &usage = "train-standard", const bool small = false, const bool decode = true, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -4634,9 +4623,10 @@ Places365(const std::string &dataset_dir, const std::string &usage = "train-stan /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current Places365Dataset. -inline std::shared_ptr MS_API Places365(const std::string &dataset_dir, const std::string &usage, - const bool small, const bool decode, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Places365(const std::string &dataset_dir, const std::string &usage, + const bool small, const bool decode, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), small, decode, sampler, cache); } @@ -4650,17 +4640,17 @@ inline std::shared_ptr MS_API Places365(const std::string &dat /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr which means no cache is used). /// \return Shared pointer to the current Places365Dataset. -inline std::shared_ptr MS_API Places365(const std::string &dataset_dir, const std::string &usage, - const bool small, const bool decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Places365(const std::string &dataset_dir, const std::string &usage, + const bool small, const bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), small, decode, sampler, cache); } /// \class QMnistDataset /// \brief A source dataset that reads and parses QMNIST dataset. -class MS_API QMnistDataset : public Dataset { +class DATASET_API QMnistDataset : public Dataset { public: /// \brief Constructor of QMnistDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4721,7 +4711,7 @@ class MS_API QMnistDataset : public Dataset { /// /* Note: In QMNIST dataset, each dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API QMnist(const std::string &dataset_dir, const std::string &usage = "all", bool compat = true, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -4736,9 +4726,9 @@ QMnist(const std::string &dataset_dir, const std::string &usage = "all", bool co /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the QMnistDataset. -inline std::shared_ptr MS_API QMnist(const std::string &dataset_dir, const std::string &usage, - bool compat, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API QMnist(const std::string &dataset_dir, const std::string &usage, + bool compat, const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), compat, sampler, cache); } @@ -4750,9 +4740,9 @@ inline std::shared_ptr MS_API QMnist(const std::string &dataset_d /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the QMnistDataset. -inline std::shared_ptr MS_API QMnist(const std::string &dataset_dir, const std::string &usage, - bool compat, const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API QMnist(const std::string &dataset_dir, const std::string &usage, + bool compat, const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), compat, sampler, cache); } @@ -4761,14 +4751,14 @@ inline std::shared_ptr MS_API QMnist(const std::string &dataset_d /// \param[in] datasets1 Shared pointer to the first dataset to be concatenated. /// \param[in] datasets2 Shared pointer to the second dataset to be concatenated. /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API operator+(const std::shared_ptr &datasets1, - const std::shared_ptr &datasets2) { +inline std::shared_ptr DATASET_API operator+(const std::shared_ptr &datasets1, + const std::shared_ptr &datasets2) { return std::make_shared(std::vector({datasets1, datasets2})); } /// \class RandomDataDataset /// \brief A source dataset that generates random data. -class MS_API RandomDataDataset : public Dataset { +class DATASET_API RandomDataDataset : public Dataset { public: /// \brief Constructor of RandomDataDataset. /// \param[in] total_rows Number of rows for the dataset to generate (default=0, number of rows is random). @@ -4813,9 +4803,9 @@ class MS_API RandomDataDataset : public Dataset { /// auto column1 = row["column1"]; /// \endcode template > -std::shared_ptr MS_API RandomData(const int32_t &total_rows = 0, const T &schema = nullptr, - const std::vector &columns_list = {}, - const std::shared_ptr &cache = nullptr) { +std::shared_ptr DATASET_API RandomData(const int32_t &total_rows = 0, const T &schema = nullptr, + const std::vector &columns_list = {}, + const std::shared_ptr &cache = nullptr) { std::shared_ptr ds; if constexpr (std::is_same::value || std::is_same>::value) { std::shared_ptr schema_obj = schema; @@ -4829,7 +4819,7 @@ std::shared_ptr MS_API RandomData(const int32_t &total_rows = /// \class SBUDataset /// \brief A source dataset that reads and parses SBU dataset. -class MS_API SBUDataset : public Dataset { +class DATASET_API SBUDataset : public Dataset { public: /// \brief Constructor of SBUDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4882,7 +4872,7 @@ class MS_API SBUDataset : public Dataset { /// /* Note: In SBU dataset, each dictionary has keys "image" and "caption" */ /// auto caption = row["caption"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API SBU(const std::string &dataset_dir, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -4896,8 +4886,8 @@ SBU(const std::string &dataset_dir, bool decode = false, /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current SBUDataset. -inline std::shared_ptr MS_API SBU(const std::string &dataset_dir, bool decode, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API SBU(const std::string &dataset_dir, bool decode, const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), decode, sampler, cache); } @@ -4908,15 +4898,15 @@ inline std::shared_ptr MS_API SBU(const std::string &dataset_dir, bo /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \return Shared pointer to the current SBUDataset. -inline std::shared_ptr MS_API SBU(const std::string &dataset_dir, bool decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API SBU(const std::string &dataset_dir, bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), decode, sampler, cache); } /// \class SemeionDataset /// \brief A source dataset for reading and parsing Semeion dataset. -class MS_API SemeionDataset : public Dataset { +class DATASET_API SemeionDataset : public Dataset { public: /// \brief Constructor of SemeionDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -4964,7 +4954,7 @@ class MS_API SemeionDataset : public Dataset { /// /* Note: In SEMEION dataset, each dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API Semeion(const std::string &dataset_dir, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); @@ -4976,9 +4966,9 @@ Semeion(const std::string &dataset_dir, const std::shared_ptr &sampler /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the SemeionDataset. -inline std::shared_ptr MS_API Semeion(const std::string &dataset_dir, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Semeion(const std::string &dataset_dir, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); } @@ -4988,14 +4978,14 @@ inline std::shared_ptr MS_API Semeion(const std::string &dataset /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the SemeionDataset. -inline std::shared_ptr MS_API Semeion(const std::string &dataset_dir, Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Semeion(const std::string &dataset_dir, Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); } /// \class SogouNewsDataset /// \brief A source dataset for reading and parsing Sogou News dataset. -class MS_API SogouNewsDataset : public Dataset { +class DATASET_API SogouNewsDataset : public Dataset { public: /// \brief Constructor of SogouNewsDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5035,18 +5025,19 @@ class MS_API SogouNewsDataset : public Dataset { /// specified only when num_shards is also specified (Default = 0). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the SogouNewsDataset. -inline std::shared_ptr MS_API SogouNews(const std::string &dataset_dir, - const std::string &usage = "all", int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API SogouNews(const std::string &dataset_dir, + const std::string &usage = "all", + int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class SpeechCommandsDataset. /// \brief A source dataset that reads and parses SpeechCommands dataset. -class MS_API SpeechCommandsDataset : public Dataset { +class DATASET_API SpeechCommandsDataset : public Dataset { public: /// \brief Constructor of SpeechCommandsDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5084,7 +5075,7 @@ class MS_API SpeechCommandsDataset : public Dataset { /// given, a `RandomSampler` will be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the SpeechCommandsDataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API SpeechCommands(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -5098,7 +5089,7 @@ SpeechCommands(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the SpeechCommandsDataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API SpeechCommands(const std::string &dataset_dir, const std::string &usage, const Sampler *sampler, const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); @@ -5111,7 +5102,7 @@ SpeechCommands(const std::string &dataset_dir, const std::string &usage, const S /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the SpeechCommandsDataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API SpeechCommands(const std::string &dataset_dir, const std::string &usage, const std::reference_wrapper &sampler, const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); @@ -5119,7 +5110,7 @@ SpeechCommands(const std::string &dataset_dir, const std::string &usage, const s /// \class SQuADDataset /// \brief A source dataset that reads and parses SQuAD dataset. -class MS_API SQuADDataset : public Dataset { +class DATASET_API SQuADDataset : public Dataset { public: /// \brief Constructor of SQuADDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5172,17 +5163,18 @@ class MS_API SQuADDataset : public Dataset { /// /* Note: In SQuAD dataset, each dictionary has keys "context", "question", "text", "answer_start" */ /// auto context = row["context"]; /// \endcode -inline std::shared_ptr MS_API SQuAD(const std::string &dataset_dir, const std::string &usage = "all", - int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API SQuAD(const std::string &dataset_dir, const std::string &usage = "all", + int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class STL10Dataset /// \brief A source dataset that reads and parses STL10 dataset. -class MS_API STL10Dataset : public Dataset { +class DATASET_API STL10Dataset : public Dataset { public: /// \brief Constructor of STL10Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5224,7 +5216,7 @@ class MS_API STL10Dataset : public Dataset { /// given, a `RandomSampler` will be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use. (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API STL10(const std::string &dataset_dir, const std::string &usage = "all", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -5238,9 +5230,9 @@ STL10(const std::string &dataset_dir, const std::string &usage = "all", /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API STL10(const std::string &dataset_dir, const std::string &usage, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API STL10(const std::string &dataset_dir, const std::string &usage, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } @@ -5251,15 +5243,15 @@ inline std::shared_ptr MS_API STL10(const std::string &dataset_dir /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use. (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API STL10(const std::string &dataset_dir, const std::string &usage, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API STL10(const std::string &dataset_dir, const std::string &usage, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), sampler, cache); } /// \class TedliumDataset /// \brief A source dataset for reading and parsing tedlium dataset. -class MS_API TedliumDataset : public Dataset { +class DATASET_API TedliumDataset : public Dataset { public: /// \brief Constructor of TedliumDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5314,7 +5306,7 @@ class MS_API TedliumDataset : public Dataset { /// given, a `RandomSampler` will be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the TedliumDataset. -inline std::shared_ptr MS_API Tedlium( +inline std::shared_ptr DATASET_API Tedlium( const std::string &dataset_dir, const std::string &release, const std::string &usage = "all", const std::string &extensions = ".sph", const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -5333,10 +5325,10 @@ inline std::shared_ptr MS_API Tedlium( /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the TedliumDataset. -inline std::shared_ptr MS_API Tedlium(const std::string &dataset_dir, const std::string &release, - const std::string &usage, const std::string &extensions, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Tedlium(const std::string &dataset_dir, const std::string &release, + const std::string &usage, const std::string &extensions, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(release), StringToChar(usage), StringToChar(extensions), sampler, cache); } @@ -5352,17 +5344,17 @@ inline std::shared_ptr MS_API Tedlium(const std::string &dataset /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the TedliumDataset. -inline std::shared_ptr MS_API Tedlium(const std::string &dataset_dir, const std::string &release, - const std::string &usage, const std::string &extensions, - Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API Tedlium(const std::string &dataset_dir, const std::string &release, + const std::string &usage, const std::string &extensions, + Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(release), StringToChar(usage), StringToChar(extensions), sampler, cache); } /// \class TextFileDataset /// \brief A source dataset that reads and parses datasets stored on disk in text format. -class MS_API TextFileDataset : public Dataset { +class DATASET_API TextFileDataset : public Dataset { public: /// \brief Constructor of TextFileDataset. /// \param[in] dataset_files List of files to be read to search for a pattern of files. The list @@ -5415,18 +5407,18 @@ class MS_API TextFileDataset : public Dataset { /// /* Note: In TextFile dataset, each dictionary has key "text" */ /// auto text = row["text"]; /// \endcode -inline std::shared_ptr MS_API TextFile(const std::vector &dataset_files, - int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API TextFile(const std::vector &dataset_files, + int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(VectorStringToChar(dataset_files), num_samples, shuffle, num_shards, shard_id, cache); } /// \class TFRecordDataset /// \brief A source dataset for reading and parsing datasets stored on disk in TFData format. -class MS_API TFRecordDataset : public Dataset { +class DATASET_API TFRecordDataset : public Dataset { public: /// \brief Constructor of TFRecordDataset. /// \param[in] dataset_files List of files to be read to search for a pattern of files. The list @@ -5524,13 +5516,11 @@ class MS_API TFRecordDataset : public Dataset { /// auto image = row["image"]; /// \endcode template > -std::shared_ptr MS_API TFRecord(const std::vector &dataset_files, - const T &schema = nullptr, - const std::vector &columns_list = {}, - int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - bool shard_equal_rows = false, - const std::shared_ptr &cache = nullptr) { +std::shared_ptr DATASET_API +TFRecord(const std::vector &dataset_files, const T &schema = nullptr, + const std::vector &columns_list = {}, int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, int32_t shard_id = 0, + bool shard_equal_rows = false, const std::shared_ptr &cache = nullptr) { std::shared_ptr ds; if constexpr (std::is_same::value || std::is_same>::value) { std::shared_ptr schema_obj = schema; @@ -5555,7 +5545,7 @@ std::shared_ptr MS_API TFRecord(const std::vector /// \class UDPOSDataset /// \brief A source dataset for reading and parsing UDPOS dataset. -class MS_API UDPOSDataset : public Dataset { +class DATASET_API UDPOSDataset : public Dataset { public: /// \brief Constructor of UDPOS Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5607,17 +5597,18 @@ class MS_API UDPOSDataset : public Dataset { /// /* Note: In UDPOS dataset, each dictionary has keys "word", "universal", "stanford" */ /// auto word = row["word"]; /// \endcode -inline std::shared_ptr MS_API UDPOS(const std::string &dataset_dir, const std::string &usage = "all", - int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API UDPOS(const std::string &dataset_dir, const std::string &usage = "all", + int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class USPSDataset /// \brief A source dataset that reads and parses USPS datasets. -class MS_API USPSDataset : public Dataset { +class DATASET_API USPSDataset : public Dataset { public: /// \brief Constructor of USPSDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5669,17 +5660,18 @@ class MS_API USPSDataset : public Dataset { /// /* Note: In USPS dataset, each dictionary has keys "image" and "label" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API USPS(const std::string &dataset_dir, const std::string &usage = "all", - int64_t num_samples = 0, ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API USPS(const std::string &dataset_dir, const std::string &usage = "all", + int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, + int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class VOCDataset /// \brief A source dataset for reading and parsing VOC dataset. -class MS_API VOCDataset : public Dataset { +class DATASET_API VOCDataset : public Dataset { public: /// \brief Constructor of VOCDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5757,7 +5749,7 @@ class MS_API VOCDataset : public Dataset { /// /* Note: In VOC dataset, if task='Detection', each dictionary has keys "image" and "annotation" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API VOC(const std::string &dataset_dir, const std::string &task = "Segmentation", const std::string &usage = "train", const std::map &class_indexing = {}, bool decode = false, const std::shared_ptr &sampler = std::make_shared(), @@ -5780,12 +5772,12 @@ VOC(const std::string &dataset_dir, const std::string &task = "Segmentation", co /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \param[in] extra_metadata Flag to add extra meta-data to row (default=false). /// \return Shared pointer to the VOCDataset. -inline std::shared_ptr MS_API VOC(const std::string &dataset_dir, const std::string &task, - const std::string &usage, - const std::map &class_indexing, bool decode, - const Sampler *sampler, - const std::shared_ptr &cache = nullptr, - bool extra_metadata = false) { +inline std::shared_ptr DATASET_API VOC(const std::string &dataset_dir, const std::string &task, + const std::string &usage, + const std::map &class_indexing, bool decode, + const Sampler *sampler, + const std::shared_ptr &cache = nullptr, + bool extra_metadata = false) { return std::make_shared(StringToChar(dataset_dir), StringToChar(task), StringToChar(usage), MapStringToChar(class_indexing), decode, sampler, cache, extra_metadata); } @@ -5804,19 +5796,19 @@ inline std::shared_ptr MS_API VOC(const std::string &dataset_dir, co /// \param[in] cache Tensor cache to use (default=nullptr which means no cache is used). /// \param[in] extra_metadata Flag to add extra meta-data to row (default=false). /// \return Shared pointer to the VOCDataset. -inline std::shared_ptr MS_API VOC(const std::string &dataset_dir, const std::string &task, - const std::string &usage, - const std::map &class_indexing, bool decode, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr, - bool extra_metadata = false) { +inline std::shared_ptr DATASET_API VOC(const std::string &dataset_dir, const std::string &task, + const std::string &usage, + const std::map &class_indexing, bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr, + bool extra_metadata = false) { return std::make_shared(StringToChar(dataset_dir), StringToChar(task), StringToChar(usage), MapStringToChar(class_indexing), decode, sampler, cache, extra_metadata); } /// \class WIDERFaceDataset /// \brief A source dataset for reading and parsing WIDERFace dataset. -class MS_API WIDERFaceDataset : public Dataset { +class DATASET_API WIDERFaceDataset : public Dataset { public: /// \brief Constructor of WIDERFaceDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5880,7 +5872,7 @@ class MS_API WIDERFaceDataset : public Dataset { /// "blur", "expression", "illumination", "occlusion", "pose", "invalid" */ /// auto image = row["image"]; /// \endcode -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API WIDERFace(const std::string &dataset_dir, const std::string &usage = "all", bool decode = false, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { @@ -5898,9 +5890,9 @@ WIDERFace(const std::string &dataset_dir, const std::string &usage = "all", bool /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the WIDERFaceDataset. -inline std::shared_ptr MS_API WIDERFace(const std::string &dataset_dir, const std::string &usage, - bool decode, const Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API WIDERFace(const std::string &dataset_dir, const std::string &usage, + bool decode, const Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), decode, sampler, cache); } @@ -5915,15 +5907,16 @@ inline std::shared_ptr MS_API WIDERFace(const std::string &dat /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the WIDERFaceDataset. -inline std::shared_ptr MS_API WIDERFace(const std::string &dataset_dir, const std::string &usage, - bool decode, const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API WIDERFace(const std::string &dataset_dir, const std::string &usage, + bool decode, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), decode, sampler, cache); } /// \class WikiTextDataset /// \brief A source dataset for reading and parsing WikiTextDataset dataset. -class MS_API WikiTextDataset : public Dataset { +class DATASET_API WikiTextDataset : public Dataset { public: /// \brief Constructor of WikiTextDataset Dataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -5976,18 +5969,18 @@ class MS_API WikiTextDataset : public Dataset { /// /* Note: In WikiText dataset, each dictionary has key "text" */ /// auto text = row["text"]; /// \endcode -inline std::shared_ptr MS_API WikiText(const std::string &dataset_dir, - const std::string &usage = "all", int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API WikiText(const std::string &dataset_dir, + const std::string &usage = "all", int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class YahooAnswersDataset /// \brief A source dataset for reading and parsing YahooAnswers dataset. -class MS_API YahooAnswersDataset : public Dataset { +class DATASET_API YahooAnswersDataset : public Dataset { public: /// \brief Constructor of YahooAnswersDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -6039,19 +6032,17 @@ class MS_API YahooAnswersDataset : public Dataset { /// /* Note: As we defined before, each data dictionary owns keys "class", "title", "content", "answer" */ /// auto title = row["title"]; /// \endcode -inline std::shared_ptr MS_API YahooAnswers(const std::string &dataset_dir, - const std::string &usage = "all", - int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API +YahooAnswers(const std::string &dataset_dir, const std::string &usage = "all", int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class YelpReviewDataset /// \brief A source dataset for reading and parsing Yelp Review dataset. -class MS_API YelpReviewDataset : public Dataset { +class DATASET_API YelpReviewDataset : public Dataset { public: /// \brief Constructor of YelpReviewDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -6091,18 +6082,19 @@ class MS_API YelpReviewDataset : public Dataset { /// specified only when num_shards is also specified (Default = 0). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the YelpReviewDataset. -inline std::shared_ptr MS_API YelpReview(const std::string &dataset_dir, - const std::string &usage = "all", int64_t num_samples = 0, - ShuffleMode shuffle = ShuffleMode::kGlobal, - int32_t num_shards = 1, int32_t shard_id = 0, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API YelpReview(const std::string &dataset_dir, + const std::string &usage = "all", + int64_t num_samples = 0, + ShuffleMode shuffle = ShuffleMode::kGlobal, + int32_t num_shards = 1, int32_t shard_id = 0, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), StringToChar(usage), num_samples, shuffle, num_shards, shard_id, cache); } /// \class YesNoDataset. /// \brief A source dataset for reading and parsing YesNo dataset. -class MS_API YesNoDataset : public Dataset { +class DATASET_API YesNoDataset : public Dataset { public: /// \brief Constructor of YesNoDataset. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -6137,7 +6129,7 @@ class MS_API YesNoDataset : public Dataset { /// given, a `RandomSampler` will be used to randomly iterate the entire dataset (default = RandomSampler()). /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API +inline std::shared_ptr DATASET_API YesNo(const std::string &dataset_dir, const std::shared_ptr &sampler = std::make_shared(), const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); @@ -6149,8 +6141,8 @@ YesNo(const std::string &dataset_dir, const std::shared_ptr &sampler = /// \param[in] sampler Raw pointer to a sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API YesNo(const std::string &dataset_dir, Sampler *sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API YesNo(const std::string &dataset_dir, Sampler *sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); } @@ -6160,9 +6152,9 @@ inline std::shared_ptr MS_API YesNo(const std::string &dataset_dir /// \param[in] sampler Sampler object used to choose samples from the dataset. /// \param[in] cache Tensor cache to use (default=nullptr, which means no cache is used). /// \return Shared pointer to the current Dataset. -inline std::shared_ptr MS_API YesNo(const std::string &dataset_dir, - const std::reference_wrapper &sampler, - const std::shared_ptr &cache = nullptr) { +inline std::shared_ptr DATASET_API YesNo(const std::string &dataset_dir, + const std::reference_wrapper &sampler, + const std::shared_ptr &cache = nullptr) { return std::make_shared(StringToChar(dataset_dir), sampler, cache); } @@ -6179,7 +6171,7 @@ inline std::shared_ptr MS_API YesNo(const std::string &dataset_dir /// \param[in] num_connections optional number of connections (default=std::nullopt, means to use 12). /// \param[in] prefetch_sz optional prefetch size (default=std::nullopt, means to use 20). /// \return Shared pointer to DatasetCache. If error, nullptr is returned. -std::shared_ptr MS_API CreateDatasetCacheCharIF( +std::shared_ptr DATASET_API CreateDatasetCacheCharIF( session_id_type id, uint64_t mem_sz, bool spill, const std::optional> &hostname = std::nullopt, const std::optional &port = std::nullopt, const std::optional &num_connections = std::nullopt, const std::optional &prefetch_sz = std::nullopt); @@ -6206,7 +6198,7 @@ std::shared_ptr MS_API CreateDatasetCacheCharIF( /// /* Create iterator to read dataset */ /// std::shared_ptr iter = ds->CreateIterator(); /// \endcode -inline std::shared_ptr MS_API CreateDatasetCache( +inline std::shared_ptr DATASET_API CreateDatasetCache( session_id_type id, uint64_t mem_sz, bool spill, const std::optional &hostname = std::nullopt, const std::optional &port = std::nullopt, const std::optional &num_connections = std::nullopt, const std::optional &prefetch_sz = std::nullopt) { @@ -6221,7 +6213,7 @@ inline std::shared_ptr MS_API CreateDatasetCache( /// \note Applies zip to the dataset. /// \param[in] datasets List of shared pointers to the datasets that we want to zip. /// \return Shared pointer to the ZipDataset. -inline std::shared_ptr MS_API Zip(const std::vector> &datasets) { +inline std::shared_ptr DATASET_API Zip(const std::vector> &datasets) { return std::make_shared(datasets); } } // namespace dataset diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/execute.h b/mindspore/ccsrc/minddata/dataset/include/dataset/execute.h index d15150299a2..fb3008ba6e7 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/execute.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/execute.h @@ -33,7 +33,7 @@ class TensorOp; class Tensor; // class to run tensor operations in eager mode -class MS_API Execute { +class DATASET_API Execute { public: /// \brief Constructor. /// \param[in] op TensorOperation to be applied in Eager mode, it accepts operation in type of shared pointer. diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/iterator.h b/mindspore/ccsrc/minddata/dataset/include/dataset/iterator.h index 85f7bca96e8..8cb84931f81 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/iterator.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/iterator.h @@ -45,7 +45,7 @@ using MSTensorMapChar = std::map, mindspore::MSTensor>; using MSTensorVec = std::vector; // Abstract class for iterating over the dataset. -class MS_API Iterator { +class DATASET_API Iterator { public: /// \brief Constructor. Iterator(); @@ -146,7 +146,7 @@ class MS_API Iterator { IteratorConsumer *consumer_; }; -class MS_API PullIterator : public Iterator { +class DATASET_API PullIterator : public Iterator { public: /// \brief Constructor. PullIterator(); diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/samplers.h b/mindspore/ccsrc/minddata/dataset/include/dataset/samplers.h index 8d988c4c261..61cb9baece3 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/samplers.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/samplers.h @@ -31,7 +31,7 @@ class SamplerObj; // Abstract class to represent a sampler in the data pipeline. /// \class Sampler samplers.h /// \brief An abstract base class to represent a sampler in the data pipeline. -class MS_API Sampler : std::enable_shared_from_this { +class DATASET_API Sampler : std::enable_shared_from_this { friend class AlbumDataset; friend class Caltech256Dataset; friend class CelebADataset; @@ -104,7 +104,7 @@ class MS_API Sampler : std::enable_shared_from_this { /// \brief A class to represent a Distributed Sampler in the data pipeline. /// \note A Sampler that accesses a shard of the dataset. -class MS_API DistributedSampler final : public Sampler { +class DATASET_API DistributedSampler final : public Sampler { friend std::shared_ptr SelectSampler(int64_t num_samples, bool shuffle, int32_t num_shards, int32_t shard_id); @@ -147,7 +147,7 @@ class MS_API DistributedSampler final : public Sampler { /// \brief A class to represent a PK Sampler in the data pipeline. /// \note Samples K elements for each P class in the dataset. /// This will sample all classes. -class MS_API PKSampler final : public Sampler { +class DATASET_API PKSampler final : public Sampler { friend std::shared_ptr SelectSampler(int64_t num_samples, bool shuffle, int32_t num_shards, int32_t shard_id); @@ -180,7 +180,7 @@ class MS_API PKSampler final : public Sampler { /// \brief A class to represent a Random Sampler in the data pipeline. /// \note Samples the elements randomly. -class MS_API RandomSampler final : public Sampler { +class DATASET_API RandomSampler final : public Sampler { friend std::shared_ptr SelectSampler(int64_t num_samples, bool shuffle, int32_t num_shards, int32_t shard_id); @@ -211,7 +211,7 @@ class MS_API RandomSampler final : public Sampler { /// \brief A class to represent a Sequential Sampler in the data pipeline. /// \note Samples the dataset elements sequentially, same as not having a sampler. -class MS_API SequentialSampler final : public Sampler { +class DATASET_API SequentialSampler final : public Sampler { friend std::shared_ptr SelectSampler(int64_t num_samples, bool shuffle, int32_t num_shards, int32_t shard_id); @@ -242,7 +242,7 @@ class MS_API SequentialSampler final : public Sampler { /// \brief A class to represent a Subset Sampler in the data pipeline. /// \note Samples the elements from a sequence of indices. -class MS_API SubsetSampler : public Sampler { +class DATASET_API SubsetSampler : public Sampler { friend std::shared_ptr SelectSampler(int64_t num_samples, bool shuffle, int32_t num_shards, int32_t shard_id); @@ -272,7 +272,7 @@ class MS_API SubsetSampler : public Sampler { /// \brief A class to represent a Subset Random Sampler in the data pipeline. /// \note Samples the elements randomly from a sequence of indices. -class MS_API SubsetRandomSampler final : public SubsetSampler { +class DATASET_API SubsetRandomSampler final : public SubsetSampler { friend std::shared_ptr SelectSampler(int64_t num_samples, bool shuffle, int32_t num_shards, int32_t shard_id); @@ -300,7 +300,7 @@ class MS_API SubsetRandomSampler final : public SubsetSampler { /// \brief A class to represent a Weighted Random Sampler in the data pipeline. /// \note Samples the elements from [0, len(weights) - 1] randomly with the given /// weights (probabilities). -class MS_API WeightedRandomSampler final : public Sampler { +class DATASET_API WeightedRandomSampler final : public Sampler { friend std::shared_ptr SelectSampler(int64_t num_samples, bool shuffle, int32_t num_shards, int32_t shard_id); diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/text.h b/mindspore/ccsrc/minddata/dataset/include/dataset/text.h index 5e7da1d8f5f..f900b12eeef 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/text.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/text.h @@ -237,7 +237,7 @@ namespace text { #ifndef _WIN32 /// \brief Tokenize a scalar tensor of UTF-8 string by specific rules. /// \note BasicTokenizer is not supported on the Windows platform yet. -class MS_API BasicTokenizer final : public TensorTransform { +class DATASET_API BasicTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] lower_case If true, apply CaseFold, NormalizeUTF8 (NFD mode) and RegexReplace operations to @@ -277,7 +277,7 @@ class MS_API BasicTokenizer final : public TensorTransform { /// \brief A tokenizer used for Bert text process. /// \note BertTokenizer is not supported on the Windows platform yet. -class MS_API BertTokenizer final : public TensorTransform { +class DATASET_API BertTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] vocab A Vocab object. @@ -348,7 +348,7 @@ class MS_API BertTokenizer final : public TensorTransform { }; /// \brief Apply case fold operation on UTF-8 string tensors. -class MS_API CaseFold final : public TensorTransform { +class DATASET_API CaseFold final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -389,7 +389,7 @@ class FilterWikipediaXML final : public TensorTransform { /// \brief Tokenize a Chinese string into words based on the dictionary. /// \note The integrity of the HMMSegment algorithm and MPSegment algorithm files must be confirmed. -class MS_API JiebaTokenizer final : public TensorTransform { +class DATASET_API JiebaTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] hmm_path Dictionary file is used by the HMMSegment algorithm. The dictionary can be obtained on the @@ -501,7 +501,7 @@ class MS_API JiebaTokenizer final : public TensorTransform { }; /// \brief Look up a word into an id according to the input vocabulary table. -class MS_API Lookup final : public TensorTransform { +class DATASET_API Lookup final : public TensorTransform { public: /// \brief Constructor. /// \param[in] vocab a Vocab object. @@ -555,7 +555,7 @@ class MS_API Lookup final : public TensorTransform { }; /// \brief Generate n-gram from a 1-D string Tensor. -class MS_API Ngram final : public TensorTransform { +class DATASET_API Ngram final : public TensorTransform { public: /// \brief Constructor. /// \param[in] ngrams ngrams is a vector of positive integers. For example, if ngrams={4, 3}, then the result @@ -606,7 +606,7 @@ class MS_API Ngram final : public TensorTransform { #ifndef _WIN32 /// \brief Apply normalize operation to UTF-8 string tensors. -class MS_API NormalizeUTF8 final : public TensorTransform { +class DATASET_API NormalizeUTF8 final : public TensorTransform { public: /// \brief Constructor. /// \param[in] normalize_form Valid values can be any of [NormalizeForm::kNone,NormalizeForm::kNfc, @@ -642,7 +642,7 @@ class MS_API NormalizeUTF8 final : public TensorTransform { }; /// \brief Replace a UTF-8 string tensor with 'replace' according to regular expression 'pattern'. -class MS_API RegexReplace final : public TensorTransform { +class DATASET_API RegexReplace final : public TensorTransform { public: /// \brief Constructor. /// \param[in] pattern The regex expression patterns. @@ -682,7 +682,7 @@ class MS_API RegexReplace final : public TensorTransform { }; /// \brief Tokenize a scalar tensor of UTF-8 string by the regex expression pattern. -class MS_API RegexTokenizer final : public TensorTransform { +class DATASET_API RegexTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] delim_pattern The pattern of regex delimiters. @@ -721,7 +721,7 @@ class MS_API RegexTokenizer final : public TensorTransform { #endif /// \brief Tokenize a scalar token or a 1-D token to tokens by sentencepiece. -class MS_API SentencePieceTokenizer final : public TensorTransform { +class DATASET_API SentencePieceTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] vocab a SentencePieceVocab object. @@ -777,7 +777,7 @@ class MS_API SentencePieceTokenizer final : public TensorTransform { /// \brief Construct a tensor from data (only 1-D for now), where each element in the dimension /// axis is a slice of data starting at the corresponding position, with a specified width. -class MS_API SlidingWindow final : public TensorTransform { +class DATASET_API SlidingWindow final : public TensorTransform { public: /// \brief Constructor. /// \param[in] width The width of the window. It must be an integer and greater than zero. @@ -812,7 +812,7 @@ class MS_API SlidingWindow final : public TensorTransform { /// https://en.cppreference.com/w/cpp/string/basic_string/stof, /// https://en.cppreference.com/w/cpp/string/basic_string/stoul, /// except that any strings which represent negative numbers cannot be cast to an unsigned integer type. -class MS_API ToNumber final : public TensorTransform { +class DATASET_API ToNumber final : public TensorTransform { public: /// \brief Constructor. /// \param[in] data_type mindspore::DataType of the tensor to be cast to. Must be a numeric type, excluding bool. @@ -841,7 +841,7 @@ class MS_API ToNumber final : public TensorTransform { }; /// \brief Look up a token into an vector according to the input Vectors table. -class MS_API ToVectors final : public TensorTransform { +class DATASET_API ToVectors final : public TensorTransform { public: /// \brief Constructor. /// \param[in] vectors A Vectors object. @@ -865,7 +865,7 @@ class MS_API ToVectors final : public TensorTransform { }; /// \brief Truncate a pair of rank-1 tensors such that the total length is less than max_length. -class MS_API TruncateSequencePair final : public TensorTransform { +class DATASET_API TruncateSequencePair final : public TensorTransform { public: /// \brief Constructor. /// \param[in] max_length Maximum length required. @@ -894,7 +894,7 @@ class MS_API TruncateSequencePair final : public TensorTransform { }; /// \brief Tokenize a scalar tensor of UTF-8 string to Unicode characters. -class MS_API UnicodeCharTokenizer final : public TensorTransform { +class DATASET_API UnicodeCharTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] with_offsets whether to output offsets of tokens (default=false). @@ -923,7 +923,7 @@ class MS_API UnicodeCharTokenizer final : public TensorTransform { }; /// \brief Tokenize scalar token or 1-D tokens to 1-D sub-word tokens. -class MS_API WordpieceTokenizer final : public TensorTransform { +class DATASET_API WordpieceTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] vocab A Vocab object. @@ -969,7 +969,7 @@ class MS_API WordpieceTokenizer final : public TensorTransform { #ifndef _WIN32 /// \brief Tokenize a scalar tensor of UTF-8 string on Unicode script boundaries. -class MS_API UnicodeScriptTokenizer final : public TensorTransform { +class DATASET_API UnicodeScriptTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] keep_whitespace whether to emit whitespace tokens (default=false). @@ -999,7 +999,7 @@ class MS_API UnicodeScriptTokenizer final : public TensorTransform { }; /// \brief Tokenize a scalar tensor of UTF-8 string on ICU4C defined whitespaces. -class MS_API WhitespaceTokenizer final : public TensorTransform { +class DATASET_API WhitespaceTokenizer final : public TensorTransform { public: /// \brief Constructor. /// \param[in] with_offsets whether to output offsets of tokens (default=false). diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h b/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h index e59bb28c645..a56538ba72b 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h @@ -47,7 +47,7 @@ class UniformAugment; // Abstract class to represent a tensor transform operation in the data pipeline. /// \class TensorTransform transforms.h /// \brief A base class to represent a tensor transform operation in the data pipeline. -class MS_API TensorTransform : public std::enable_shared_from_this { +class DATASET_API TensorTransform : public std::enable_shared_from_this { friend class Dataset; friend class Execute; friend class transforms::Compose; @@ -76,7 +76,7 @@ class MS_API TensorTransform : public std::enable_shared_from_this *size); +Status DATASET_API GetImageSize(const mindspore::MSTensor &image, std::vector *size); /// \brief Flip the input image horizontally. -class MS_API HorizontalFlip final : public TensorTransform { +class DATASET_API HorizontalFlip final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -532,7 +532,7 @@ class MS_API HorizontalFlip final : public TensorTransform { }; /// \brief Apply invert on the input image in RGB mode. -class MS_API Invert final : public TensorTransform { +class DATASET_API Invert final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -555,7 +555,7 @@ class MS_API Invert final : public TensorTransform { /// \brief Apply MixUp transformation on an input batch of images and labels. The labels must be in /// one-hot format and Batch must be called before calling this function. -class MS_API MixUpBatch final : public TensorTransform { +class DATASET_API MixUpBatch final : public TensorTransform { public: /// \brief Constructor. /// \param[in] alpha hyperparameter of beta distribution (default = 1.0). @@ -583,7 +583,7 @@ class MS_API MixUpBatch final : public TensorTransform { /// \brief Normalize the input image with respect to mean and standard deviation and pads an extra /// channel with value zero. -class MS_API NormalizePad final : public TensorTransform { +class DATASET_API NormalizePad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] mean A vector of mean values for each channel, with respect to channel order. @@ -625,7 +625,7 @@ class MS_API NormalizePad final : public TensorTransform { }; /// \brief Pad the image according to padding parameters. -class MS_API Pad final : public TensorTransform { +class DATASET_API Pad final : public TensorTransform { public: /// \brief Constructor. /// \param[in] padding A vector representing the number of pixels to pad the image. @@ -675,7 +675,7 @@ class MS_API Pad final : public TensorTransform { }; /// \brief Pad the image to a fixed size. -class MS_API PadToSize final : public TensorTransform { +class DATASET_API PadToSize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A two element vector representing the target size to pad, in order of [height, width]. @@ -717,7 +717,7 @@ class MS_API PadToSize final : public TensorTransform { }; /// \brief Posterize an image by reducing the number of bits for each color channel. -class MS_API Posterize final : public TensorTransform { +class DATASET_API Posterize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] bits The number of bits to keep for each channel, @@ -748,7 +748,7 @@ class MS_API Posterize final : public TensorTransform { }; /// \brief Automatically adjust the contrast of the image with a given probability. -class MS_API RandomAutoContrast final : public TensorTransform { +class DATASET_API RandomAutoContrast final : public TensorTransform { public: /// \brief Constructor. /// \param[in] cutoff Percent of the lightest and darkest pixels to be cut off from @@ -783,7 +783,7 @@ class MS_API RandomAutoContrast final : public TensorTransform { }; /// \brief Randomly adjust the sharpness of the input image with a given probability. -class MS_API RandomAdjustSharpness final : public TensorTransform { +class DATASET_API RandomAdjustSharpness final : public TensorTransform { public: /// \brief Constructor. /// \param[in] degree A float representing sharpness adjustment degree, which must be non negative. @@ -817,7 +817,7 @@ class MS_API RandomAdjustSharpness final : public TensorTransform { /// \brief Blend an image with its grayscale version with random weights /// t and 1 - t generated from a given range. If the range is trivial /// then the weights are determinate and t equals to the bound of the interval. -class MS_API RandomColor final : public TensorTransform { +class DATASET_API RandomColor final : public TensorTransform { public: /// \brief Constructor. /// \param[in] t_lb Lower bound random weights. @@ -848,7 +848,7 @@ class MS_API RandomColor final : public TensorTransform { }; /// \brief Randomly adjust the brightness, contrast, saturation, and hue of the input image. -class MS_API RandomColorAdjust final : public TensorTransform { +class DATASET_API RandomColorAdjust final : public TensorTransform { public: /// \brief Constructor. /// \param[in] brightness Brightness adjustment factor. Must be a vector of one or two values @@ -889,7 +889,7 @@ class MS_API RandomColorAdjust final : public TensorTransform { }; /// \brief Crop the input image at a random location. -class MS_API RandomCrop final : public TensorTransform { +class DATASET_API RandomCrop final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the cropped image. @@ -945,7 +945,7 @@ class MS_API RandomCrop final : public TensorTransform { }; /// \brief Equivalent to RandomResizedCrop TensorTransform, but crop the image before decoding. -class MS_API RandomCropDecodeResize final : public TensorTransform { +class DATASET_API RandomCropDecodeResize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the cropped image. @@ -992,7 +992,7 @@ class MS_API RandomCropDecodeResize final : public TensorTransform { /// \brief Crop the input image at a random location and adjust bounding boxes accordingly. /// If the cropped area is out of bbox, the returned bbox will be empty. -class MS_API RandomCropWithBBox final : public TensorTransform { +class DATASET_API RandomCropWithBBox final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the cropped image. @@ -1046,7 +1046,7 @@ class MS_API RandomCropWithBBox final : public TensorTransform { }; /// \brief Randomly apply histogram equalization on the input image with a given probability. -class MS_API RandomEqualize final : public TensorTransform { +class DATASET_API RandomEqualize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] prob A float representing the probability of equalization, which @@ -1077,7 +1077,7 @@ class MS_API RandomEqualize final : public TensorTransform { }; /// \brief Randomly flip the input image horizontally with a given probability. -class MS_API RandomHorizontalFlip final : public TensorTransform { +class DATASET_API RandomHorizontalFlip final : public TensorTransform { public: /// \brief Constructor. /// \param[in] prob A float representing the probability of flip. @@ -1107,7 +1107,7 @@ class MS_API RandomHorizontalFlip final : public TensorTransform { }; /// \brief Randomly flip the input image horizontally with a given probability and adjust bounding boxes accordingly. -class MS_API RandomHorizontalFlipWithBBox final : public TensorTransform { +class DATASET_API RandomHorizontalFlipWithBBox final : public TensorTransform { public: /// \brief Constructor. /// \param[in] prob A float representing the probability of flip. @@ -1136,7 +1136,7 @@ class MS_API RandomHorizontalFlipWithBBox final : public TensorTransform { }; /// \brief Randomly invert the input image with a given probability. -class MS_API RandomInvert final : public TensorTransform { +class DATASET_API RandomInvert final : public TensorTransform { public: /// \brief Constructor. /// \param[in] prob A float representing the probability of the image being inverted, which @@ -1167,7 +1167,7 @@ class MS_API RandomInvert final : public TensorTransform { }; /// \brief Add AlexNet-style PCA-based noise to an image. -class MS_API RandomLighting final : public TensorTransform { +class DATASET_API RandomLighting final : public TensorTransform { public: /// \brief Constructor. /// \param[in] alpha A float representing the intensity of the image (default=0.05). @@ -1197,7 +1197,7 @@ class MS_API RandomLighting final : public TensorTransform { }; /// \brief Reduce the number of bits for each color channel randomly. -class MS_API RandomPosterize final : public TensorTransform { +class DATASET_API RandomPosterize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] bit_range Range of random posterize to compress image. @@ -1228,7 +1228,7 @@ class MS_API RandomPosterize final : public TensorTransform { }; /// \brief Resize the input image using a randomly selected interpolation mode. -class MS_API RandomResize final : public TensorTransform { +class DATASET_API RandomResize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the resized image. @@ -1261,7 +1261,7 @@ class MS_API RandomResize final : public TensorTransform { /// \brief Resize the input image using a randomly selected interpolation mode and adjust /// bounding boxes accordingly. -class MS_API RandomResizeWithBBox final : public TensorTransform { +class DATASET_API RandomResizeWithBBox final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the resized image. @@ -1292,7 +1292,7 @@ class MS_API RandomResizeWithBBox final : public TensorTransform { }; /// \brief Crop the input image to a random size and aspect ratio. -class MS_API RandomResizedCrop final : public TensorTransform { +class DATASET_API RandomResizedCrop final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the cropped image. @@ -1340,7 +1340,7 @@ class MS_API RandomResizedCrop final : public TensorTransform { /// \brief Crop the input image to a random size and aspect ratio. /// If cropped area is out of bbox, the return bbox will be empty. -class MS_API RandomResizedCropWithBBox final : public TensorTransform { +class DATASET_API RandomResizedCropWithBBox final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the cropped image. @@ -1387,7 +1387,7 @@ class MS_API RandomResizedCropWithBBox final : public TensorTransform { }; /// \brief Rotate the image according to parameters. -class MS_API RandomRotation final : public TensorTransform { +class DATASET_API RandomRotation final : public TensorTransform { public: /// \brief Constructor. /// \param[in] degrees A float vector of size 2, representing the starting and ending degrees. @@ -1434,7 +1434,7 @@ class MS_API RandomRotation final : public TensorTransform { /// (operation, prob), where operation is a TensorTransform operation and prob is the probability that this /// operation will be applied. Once a sub-policy is selected, each operation within the sub-policy with be /// applied in sequence according to its probability. -class MS_API RandomSelectSubpolicy final : public TensorTransform { +class DATASET_API RandomSelectSubpolicy final : public TensorTransform { public: /// \brief Constructor. /// \param[in] policy Vector of sub-policies to choose from, in which the TensorTransform objects are raw pointers. @@ -1509,7 +1509,7 @@ class MS_API RandomSelectSubpolicy final : public TensorTransform { }; /// \brief Adjust the sharpness of the input image by a fixed or random degree. -class MS_API RandomSharpness final : public TensorTransform { +class DATASET_API RandomSharpness final : public TensorTransform { public: /// \brief Constructor. /// \param[in] degrees A float vector of size 2, representing the range of random sharpness @@ -1541,7 +1541,7 @@ class MS_API RandomSharpness final : public TensorTransform { }; /// \brief Invert pixels randomly within a specified range. -class MS_API RandomSolarize final : public TensorTransform { +class DATASET_API RandomSolarize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] threshold A vector with two elements specifying the pixel range to invert. @@ -1573,7 +1573,7 @@ class MS_API RandomSolarize final : public TensorTransform { }; /// \brief Randomly flip the input image vertically with a given probability. -class MS_API RandomVerticalFlip final : public TensorTransform { +class DATASET_API RandomVerticalFlip final : public TensorTransform { public: /// \brief Constructor. /// \param[in] prob A float representing the probability of flip. @@ -1603,7 +1603,7 @@ class MS_API RandomVerticalFlip final : public TensorTransform { }; /// \brief Randomly flip the input image vertically with a given probability and adjust bounding boxes accordingly. -class MS_API RandomVerticalFlipWithBBox final : public TensorTransform { +class DATASET_API RandomVerticalFlipWithBBox final : public TensorTransform { public: /// \brief Constructor. /// \param[in] prob A float representing the probability of flip. @@ -1632,7 +1632,7 @@ class MS_API RandomVerticalFlipWithBBox final : public TensorTransform { }; /// \brief Rescale the pixel value of input image. -class MS_API Rescale final : public TensorTransform { +class DATASET_API Rescale final : public TensorTransform { public: /// \brief Constructor. /// \param[in] rescale Rescale factor. @@ -1663,7 +1663,7 @@ class MS_API Rescale final : public TensorTransform { }; /// \brief Crop the given image and zoom to the specified size. -class MS_API ResizedCrop final : public TensorTransform { +class DATASET_API ResizedCrop final : public TensorTransform { public: /// \brief Constructor. /// \param[in] top Horizontal ordinate of the upper left corner of the crop image. @@ -1707,7 +1707,7 @@ class MS_API ResizedCrop final : public TensorTransform { }; /// \brief Resize the input image to the given size and adjust bounding boxes accordingly. -class MS_API ResizeWithBBox final : public TensorTransform { +class DATASET_API ResizeWithBBox final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size The output size of the resized image. @@ -1745,7 +1745,7 @@ class MS_API ResizeWithBBox final : public TensorTransform { }; /// \brief Change the format of input tensor from 4-channel RGBA to 3-channel BGR. -class MS_API RGBA2BGR final : public TensorTransform { +class DATASET_API RGBA2BGR final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -1770,7 +1770,7 @@ class MS_API RGBA2BGR final : public TensorTransform { }; /// \brief Change the input 4 channel RGBA tensor to 3 channel RGB. -class MS_API RGBA2RGB final : public TensorTransform { +class DATASET_API RGBA2RGB final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -1795,7 +1795,7 @@ class MS_API RGBA2RGB final : public TensorTransform { }; /// \note Slice the tensor to multiple patches in horizontal and vertical directions. -class MS_API SlicePatches final : public TensorTransform { +class DATASET_API SlicePatches final : public TensorTransform { public: /// \brief Constructor. /// \param[in] num_height The number of patches in vertical direction (default=1). @@ -1832,7 +1832,7 @@ class MS_API SlicePatches final : public TensorTransform { }; /// \brief Invert pixels within a specified range. -class MS_API Solarize final : public TensorTransform { +class DATASET_API Solarize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] threshold A vector with two elements specifying the pixel range to invert. @@ -1864,7 +1864,7 @@ class MS_API Solarize final : public TensorTransform { }; /// \brief Swap the red and blue channels of the input image. -class MS_API SwapRedBlue final : public TensorTransform { +class DATASET_API SwapRedBlue final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -1889,7 +1889,7 @@ class MS_API SwapRedBlue final : public TensorTransform { }; /// \brief Divide the pixel values by 255 and convert from HWC format to CHW format with required datatype. -class MS_API ToTensor final : public TensorTransform { +class DATASET_API ToTensor final : public TensorTransform { public: /// \brief Constructor. /// \param[in] output_type The type of the output tensor of type mindspore::DataType or String @@ -1921,7 +1921,7 @@ class MS_API ToTensor final : public TensorTransform { }; /// \brief Dataset-independent data-augmentation with TrivialAugment Wide. -class MS_API TrivialAugmentWide final : public TensorTransform { +class DATASET_API TrivialAugmentWide final : public TensorTransform { public: /// \brief Constructor. /// \param[in] num_magnitude_bins The number of different magnitude values. Default: 31. @@ -1958,7 +1958,7 @@ class MS_API TrivialAugmentWide final : public TensorTransform { }; /// \brief Randomly perform transformations, as selected from input transform list, on the input tensor. -class MS_API UniformAugment final : public TensorTransform { +class DATASET_API UniformAugment final : public TensorTransform { public: /// \brief Constructor. /// \param[in] transforms Raw pointer to vector of TensorTransform operations. @@ -2025,7 +2025,7 @@ class MS_API UniformAugment final : public TensorTransform { }; /// \brief Flip the input image vertically. -class MS_API VerticalFlip final : public TensorTransform { +class DATASET_API VerticalFlip final : public TensorTransform { public: /// \brief Constructor. /// \par Example diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/vision_ascend.h b/mindspore/ccsrc/minddata/dataset/include/dataset/vision_ascend.h index 793d9afb9ca..e21f02a5aac 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/vision_ascend.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/vision_ascend.h @@ -35,7 +35,7 @@ namespace vision { /// \brief Decode and resize JPEG image using the hardware algorithm of /// Ascend series chip DVPP module. -class MS_API DvppDecodeResizeJpeg final : public TensorTransform { +class DATASET_API DvppDecodeResizeJpeg final : public TensorTransform { public: /// \brief Constructor. /// \param[in] resize Parameter vector of two integers for each dimension, with respect to H,W order. @@ -67,7 +67,7 @@ class MS_API DvppDecodeResizeJpeg final : public TensorTransform { /// \brief Decode, resize and crop JPEG image using the hardware algorithm of /// Ascend series chip DVPP module. -class MS_API DvppDecodeResizeCropJpeg final : public TensorTransform { +class DATASET_API DvppDecodeResizeCropJpeg final : public TensorTransform { public: /// \brief Constructor. /// \param[in] crop Parameter vector of two integers for each dimension after final crop, with respect to H,W order. @@ -100,7 +100,7 @@ class MS_API DvppDecodeResizeCropJpeg final : public TensorTransform { /// \brief Decode H264/H265 video using the hardware algorithm of /// DVPP module on Ascend series chip. -class MS_API DvppDecodeVideo final : public TensorTransform { +class DATASET_API DvppDecodeVideo final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size Parameter vector of two integers for each dimension of input video frames, with respect to H,W @@ -176,7 +176,7 @@ class MS_API DvppDecodeVideo final : public TensorTransform { /// \brief Decode PNG image using the hardware algorithm of /// Ascend series chip DVPP module. -class MS_API DvppDecodePng final : public TensorTransform { +class DATASET_API DvppDecodePng final : public TensorTransform { public: /// \brief Constructor. /// \par Example diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/vision_lite.h b/mindspore/ccsrc/minddata/dataset/include/dataset/vision_lite.h index fbefa0e2af9..5c2c3fba2d9 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/vision_lite.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/vision_lite.h @@ -35,7 +35,7 @@ namespace vision { class RotateOperation; /// \brief Apply affine transform on the input image. -class MS_API Affine final : public TensorTransform { +class DATASET_API Affine final : public TensorTransform { public: /// \brief Constructor. /// \param[in] degrees The degrees to rotate the image. @@ -79,7 +79,7 @@ class MS_API Affine final : public TensorTransform { }; /// \brief Crop the input image at the center to the given size. -class MS_API CenterCrop final : public TensorTransform { +class DATASET_API CenterCrop final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the cropped image. @@ -113,7 +113,7 @@ class MS_API CenterCrop final : public TensorTransform { }; /// \brief Crop an image based on location and crop size. -class MS_API Crop final : public TensorTransform { +class DATASET_API Crop final : public TensorTransform { public: /// \brief Constructor. /// \param[in] coordinates Starting location of crop. Must be a vector of two values, in the form of {x_coor, y_coor}. @@ -146,7 +146,7 @@ class MS_API Crop final : public TensorTransform { }; /// \brief Decode the input image in RGB mode. -class MS_API Decode final : public TensorTransform { +class DATASET_API Decode final : public TensorTransform { public: /// \brief Constructor. /// \param[in] rgb A boolean indicating whether to decode the image in RGB mode or not. @@ -177,7 +177,7 @@ class MS_API Decode final : public TensorTransform { }; /// \brief Blur the input image with the specified Gaussian kernel. -class MS_API GaussianBlur final : public TensorTransform { +class DATASET_API GaussianBlur final : public TensorTransform { public: /// \brief Constructor. /// \param[in] kernel_size A vector of Gaussian kernel size for width and height. The value must be positive and odd. @@ -209,7 +209,7 @@ class MS_API GaussianBlur final : public TensorTransform { }; /// \brief Transpose the input image; shape (H, W, C) to shape (C, H, W). -class MS_API HWC2CHW final : public TensorTransform { +class DATASET_API HWC2CHW final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -231,7 +231,7 @@ class MS_API HWC2CHW final : public TensorTransform { }; /// \brief Normalize the input image with respect to mean and standard deviation. -class MS_API Normalize final : public TensorTransform { +class DATASET_API Normalize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] mean A vector of mean values for each channel, with respect to channel order. @@ -269,7 +269,7 @@ class MS_API Normalize final : public TensorTransform { }; /// \brief Apply a Random Affine transformation on the input image in RGB or Greyscale mode. -class MS_API RandomAffine final : public TensorTransform { +class DATASET_API RandomAffine final : public TensorTransform { public: /// \brief Constructor. /// \param[in] degrees A float vector of size 2, representing the starting and ending degree. @@ -320,7 +320,7 @@ class MS_API RandomAffine final : public TensorTransform { }; /// \brief Resize the input image to the given size. -class MS_API Resize final : public TensorTransform { +class DATASET_API Resize final : public TensorTransform { public: /// \brief Constructor. /// \param[in] size A vector representing the output size of the resized image. @@ -360,7 +360,7 @@ class MS_API Resize final : public TensorTransform { }; /// \brief Keep the original picture ratio and fills the rest. -class MS_API ResizePreserveAR final : public TensorTransform { +class DATASET_API ResizePreserveAR final : public TensorTransform { public: /// \brief Constructor. /// \param[in] height The height of image output value after resizing. @@ -401,7 +401,7 @@ class MS_API ResizePreserveAR final : public TensorTransform { /// \brief RGB2BGR TensorTransform. /// \note Convert the format of input image from RGB to BGR. -class MS_API RGB2BGR final : public TensorTransform { +class DATASET_API RGB2BGR final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -428,7 +428,7 @@ class MS_API RGB2BGR final : public TensorTransform { /// \brief RGB2GRAY TensorTransform. /// \note Convert RGB image or color image to grayscale image. /// \brief Convert a RGB image or color image to a grayscale one. -class MS_API RGB2GRAY final : public TensorTransform { +class DATASET_API RGB2GRAY final : public TensorTransform { public: /// \brief Constructor. /// \par Example @@ -453,7 +453,7 @@ class MS_API RGB2GRAY final : public TensorTransform { }; /// \brief Rotate the input image according to parameters. -class MS_API Rotate final : public TensorTransform { +class DATASET_API Rotate final : public TensorTransform { public: /// \brief Constructor. /// \note This api is only used in Lite, the interpolation mode is bilinear.