diff --git a/mindspore/ccsrc/minddata/dataset/api/execute.cc b/mindspore/ccsrc/minddata/dataset/api/execute.cc index 373e504311a..af466c5fb64 100644 --- a/mindspore/ccsrc/minddata/dataset/api/execute.cc +++ b/mindspore/ccsrc/minddata/dataset/api/execute.cc @@ -673,7 +673,8 @@ Status Execute::Run(const std::vector> &data_g extern "C" { // ExecuteRun_C has C-linkage specified, but returns user-defined type 'mindspore::Status' which is incompatible with C void ExecuteRun_C(const std::vector> &data_graph, - std::vector &inputs, std::vector *outputs, Status *s) { + const std::vector &inputs, std::vector *outputs, + Status *s) { Status ret = Execute::Run(data_graph, inputs, outputs); if (s == nullptr) { return; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/allpass_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/allpass_biquad_ir.h index a22ba09b816..58164064fc1 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/allpass_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/allpass_biquad_ir.h @@ -36,7 +36,7 @@ class AllpassBiquadOperation : public TensorOperation { public: AllpassBiquadOperation(int32_t sample_rate, float central_freq, float Q); - ~AllpassBiquadOperation() = default; + ~AllpassBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/amplitude_to_db_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/amplitude_to_db_ir.h index 1eec798c4ae..56f1eb178fb 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/amplitude_to_db_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/amplitude_to_db_ir.h @@ -34,7 +34,7 @@ class AmplitudeToDBOperation : public TensorOperation { public: AmplitudeToDBOperation(ScaleType stype, float ref_value, float amin, float top_db); - ~AmplitudeToDBOperation(); + ~AmplitudeToDBOperation() override; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/angle_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/angle_ir.h index 5fee89497bd..ffcab0299c8 100755 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/angle_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/angle_ir.h @@ -36,7 +36,7 @@ class AngleOperation : public TensorOperation { public: AngleOperation(); - ~AngleOperation() = default; + ~AngleOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/band_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/band_biquad_ir.h index a609b897415..eecbaa9c504 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/band_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/band_biquad_ir.h @@ -36,7 +36,7 @@ class BandBiquadOperation : public TensorOperation { public: BandBiquadOperation(int32_t sample_rate, float central_freq, float Q, bool noise); - ~BandBiquadOperation() = default; + ~BandBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bandpass_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bandpass_biquad_ir.h index 848cacf1cb9..1ab9bd6f10e 100755 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bandpass_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bandpass_biquad_ir.h @@ -36,7 +36,7 @@ class BandpassBiquadOperation : public TensorOperation { public: BandpassBiquadOperation(int32_t sample_rate, float central_freq, float Q, bool const_skirt_gain); - ~BandpassBiquadOperation() = default; + ~BandpassBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bandreject_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bandreject_biquad_ir.h index 35807fcb6ea..dbc6a9a91a2 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bandreject_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bandreject_biquad_ir.h @@ -36,7 +36,7 @@ class BandrejectBiquadOperation : public TensorOperation { public: BandrejectBiquadOperation(int32_t sample_rate, float central_freq, float Q); - ~BandrejectBiquadOperation() = default; + ~BandrejectBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bass_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bass_biquad_ir.h index d10ca974d85..610bf6d36e6 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bass_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/bass_biquad_ir.h @@ -36,7 +36,7 @@ class BassBiquadOperation : public TensorOperation { public: BassBiquadOperation(int32_t sample_rate, float gain, float central_freq, float Q); - ~BassBiquadOperation() = default; + ~BassBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/biquad_ir.h index 0aaed55adc4..2f349eab8fc 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/biquad_ir.h @@ -36,7 +36,7 @@ class BiquadOperation : public TensorOperation { public: BiquadOperation(float b0, float b1, float b2, float a0, float a1, float a2); - ~BiquadOperation() = default; + ~BiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/complex_norm_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/complex_norm_ir.h index e067ea95eba..b0bb41416d3 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/complex_norm_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/complex_norm_ir.h @@ -33,7 +33,7 @@ class ComplexNormOperation : public TensorOperation { public: explicit ComplexNormOperation(float power); - ~ComplexNormOperation(); + ~ComplexNormOperation() override; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/compute_deltas_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/compute_deltas_ir.h index 3a46ae4654d..ce90b5cbcbc 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/compute_deltas_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/compute_deltas_ir.h @@ -32,7 +32,7 @@ class ComputeDeltasOperation : public TensorOperation { public: ComputeDeltasOperation(int32_t win_length, BorderType pad_mode); - ~ComputeDeltasOperation() = default; + ~ComputeDeltasOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/contrast_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/contrast_ir.h index 027ef67c803..dcebab4a7c3 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/contrast_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/contrast_ir.h @@ -34,7 +34,7 @@ class ContrastOperation : public TensorOperation { public: explicit ContrastOperation(float enhancement_amount); - ~ContrastOperation() = default; + ~ContrastOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/db_to_amplitude_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/db_to_amplitude_ir.h index ff17bdab1ac..a05c4c59805 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/db_to_amplitude_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/db_to_amplitude_ir.h @@ -35,7 +35,7 @@ class DBToAmplitudeOperation : public TensorOperation { public: DBToAmplitudeOperation(float ref, float power); - ~DBToAmplitudeOperation() = default; + ~DBToAmplitudeOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/dc_shift_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/dc_shift_ir.h index c53d1c5cb3a..66322372ce0 100755 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/dc_shift_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/dc_shift_ir.h @@ -34,7 +34,7 @@ class DCShiftOperation : public TensorOperation { public: DCShiftOperation(float shift, float limiter_gain); - ~DCShiftOperation() = default; + ~DCShiftOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/deemph_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/deemph_biquad_ir.h index 61ff1122b2f..f5fc8e4e37e 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/deemph_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/deemph_biquad_ir.h @@ -35,7 +35,7 @@ class DeemphBiquadOperation : public TensorOperation { public: explicit DeemphBiquadOperation(int32_t sample_rate); - ~DeemphBiquadOperation() = default; + ~DeemphBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/detect_pitch_frequency_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/detect_pitch_frequency_ir.h index 074665e5ed5..09a85406024 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/detect_pitch_frequency_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/detect_pitch_frequency_ir.h @@ -37,7 +37,7 @@ class DetectPitchFrequencyOperation : public TensorOperation { DetectPitchFrequencyOperation(int32_t sample_rate, float frame_time, int32_t win_length, int32_t freq_low, int32_t freq_high); - ~DetectPitchFrequencyOperation() = default; + ~DetectPitchFrequencyOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/dither_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/dither_ir.h index 22ba3e4d74d..f4d975197f1 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/dither_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/dither_ir.h @@ -35,7 +35,7 @@ class DitherOperation : public TensorOperation { public: DitherOperation(DensityFunction density_function, bool noise_shaping); - ~DitherOperation() = default; + ~DitherOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/equalizer_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/equalizer_biquad_ir.h index 9387d60b8e2..6269480b32e 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/equalizer_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/equalizer_biquad_ir.h @@ -35,7 +35,7 @@ class EqualizerBiquadOperation : public TensorOperation { public: EqualizerBiquadOperation(int32_t sample_rate, float center_freq, float gain, float Q); - ~EqualizerBiquadOperation() = default; + ~EqualizerBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/fade_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/fade_ir.h index c950de0f807..e9ac6bcd084 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/fade_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/fade_ir.h @@ -33,7 +33,7 @@ class FadeOperation : public TensorOperation { public: FadeOperation(int32_t fade_in_len, int32_t fade_out_len, FadeShape fade_shape); - ~FadeOperation() = default; + ~FadeOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/flanger_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/flanger_ir.h index 7b11e035b9e..c94fe94d9df 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/flanger_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/flanger_ir.h @@ -37,7 +37,7 @@ class FlangerOperation : public TensorOperation { explicit FlangerOperation(int32_t sample_rate, float delay, float depth, float regen, float width, float speed, float phase, Modulation modulation, Interpolation interpolation); - ~FlangerOperation() = default; + ~FlangerOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/frequency_masking_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/frequency_masking_ir.h index e43caedf080..79b85a72f53 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/frequency_masking_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/frequency_masking_ir.h @@ -32,7 +32,7 @@ class FrequencyMaskingOperation : public TensorOperation { public: FrequencyMaskingOperation(bool iid_masks, int32_t frequency_mask_param, int32_t mask_start, float mask_value); - ~FrequencyMaskingOperation(); + ~FrequencyMaskingOperation() override; std::shared_ptr Build() override; @@ -43,9 +43,9 @@ class FrequencyMaskingOperation : public TensorOperation { Status to_json(nlohmann::json *out_json) override; private: + bool iid_masks_; int32_t frequency_mask_param_; int32_t mask_start_; - bool iid_masks_; float mask_value_; }; // class FrequencyMaskingOperation } // namespace audio diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/gain_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/gain_ir.h index a2a564d0374..71b9c1f61ae 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/gain_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/gain_ir.h @@ -35,7 +35,7 @@ class GainOperation : public TensorOperation { public: explicit GainOperation(float gain_db); - ~GainOperation() = default; + ~GainOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/highpass_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/highpass_biquad_ir.h index 9bd218df3be..e52a70cc18e 100755 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/highpass_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/highpass_biquad_ir.h @@ -36,7 +36,7 @@ class HighpassBiquadOperation : public TensorOperation { public: HighpassBiquadOperation(int32_t sample_rate, float cutoff_freq, float Q); - ~HighpassBiquadOperation() = default; + ~HighpassBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lfilter_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lfilter_ir.h index 56a7c9efc6b..303d280972f 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lfilter_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lfilter_ir.h @@ -36,7 +36,7 @@ class LFilterOperation : public TensorOperation { public: LFilterOperation(const std::vector &a_coeffs, const std::vector &b_coeffs, bool clamp); - ~LFilterOperation() = default; + ~LFilterOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lowpass_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lowpass_biquad_ir.h index 54fccaf8851..4cebca6c3cc 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lowpass_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/lowpass_biquad_ir.h @@ -37,7 +37,7 @@ class LowpassBiquadOperation : public TensorOperation { public: LowpassBiquadOperation(int32_t sample_rate, float cutoff_freq, float Q); - ~LowpassBiquadOperation() = default; + ~LowpassBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/magphase_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/magphase_ir.h index 0a65bedb47b..00fc23a12f3 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/magphase_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/magphase_ir.h @@ -34,7 +34,7 @@ class MagphaseOperation : public TensorOperation { public: explicit MagphaseOperation(float power); - ~MagphaseOperation() = default; + ~MagphaseOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/mu_law_decoding_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/mu_law_decoding_ir.h index eb4e1f037e4..1801dec4de4 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/mu_law_decoding_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/mu_law_decoding_ir.h @@ -32,7 +32,7 @@ class MuLawDecodingOperation : public TensorOperation { public: explicit MuLawDecodingOperation(int32_t quantization_channels); - ~MuLawDecodingOperation(); + ~MuLawDecodingOperation() override; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/mu_law_encoding_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/mu_law_encoding_ir.h index b10736bb0b2..09ccdeaff57 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/mu_law_encoding_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/mu_law_encoding_ir.h @@ -32,7 +32,7 @@ class MuLawEncodingOperation : public TensorOperation { public: explicit MuLawEncodingOperation(int32_t quantization_channels); - ~MuLawEncodingOperation(); + ~MuLawEncodingOperation() override; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/overdrive_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/overdrive_ir.h index 65ef1bed1dc..b81922cd799 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/overdrive_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/overdrive_ir.h @@ -37,7 +37,7 @@ class OverdriveOperation : public TensorOperation { public: explicit OverdriveOperation(float gain, float color); - ~OverdriveOperation() = default; + ~OverdriveOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/phaser_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/phaser_ir.h index 6020e7d9d76..c27fc45672e 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/phaser_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/phaser_ir.h @@ -38,7 +38,7 @@ class PhaserOperation : public TensorOperation { PhaserOperation(int32_t sample_rate, float gain_in, float gain_out, float delay_ms, float decay, float mod_speed, bool sinusoidal); - ~PhaserOperation() = default; + ~PhaserOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/riaa_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/riaa_biquad_ir.h index f7aee2a4185..d7421f6dbfb 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/riaa_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/riaa_biquad_ir.h @@ -36,7 +36,7 @@ class RiaaBiquadOperation : public TensorOperation { public: explicit RiaaBiquadOperation(int32_t sample_rate); - ~RiaaBiquadOperation() = default; + ~RiaaBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/sliding_window_cmn_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/sliding_window_cmn_ir.h index 1bf303134f3..a72ad3cf614 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/sliding_window_cmn_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/sliding_window_cmn_ir.h @@ -32,7 +32,7 @@ class SlidingWindowCmnOperation : public TensorOperation { public: SlidingWindowCmnOperation(int32_t cmn_window, int32_t min_cmn_window, bool center, bool norm_vars); - ~SlidingWindowCmnOperation(); + ~SlidingWindowCmnOperation() override; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/spectral_centroid_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/spectral_centroid_ir.h index 2da8df3a44f..993588aab25 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/spectral_centroid_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/spectral_centroid_ir.h @@ -33,7 +33,7 @@ class SpectralCentroidOperation : public TensorOperation { SpectralCentroidOperation(int32_t sample_rate, int32_t n_fft, int32_t win_length, int32_t hop_length, int32_t pad, WindowType window); - ~SpectralCentroidOperation() = default; + ~SpectralCentroidOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/spectrogram_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/spectrogram_ir.h index b8c17d6d685..bc68a7c7d7d 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/spectrogram_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/spectrogram_ir.h @@ -33,7 +33,7 @@ class SpectrogramOperation : public TensorOperation { SpectrogramOperation(int32_t n_fft, int32_t win_length, int32_t hop_length, int32_t pad, WindowType window, float power, bool normalized, bool center, BorderType pad_mode, bool onesided); - ~SpectrogramOperation() = default; + ~SpectrogramOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_masking_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_masking_ir.h index bf1b80de058..dbf22e20c2e 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_masking_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_masking_ir.h @@ -32,7 +32,7 @@ class TimeMaskingOperation : public TensorOperation { public: TimeMaskingOperation(bool iid_masks, int32_t time_mask_param, int32_t mask_start, float mask_value); - ~TimeMaskingOperation(); + ~TimeMaskingOperation() override; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_stretch_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_stretch_ir.h index ea907b8c63a..1a21f43c2c5 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_stretch_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/time_stretch_ir.h @@ -32,7 +32,7 @@ class TimeStretchOperation : public TensorOperation { public: TimeStretchOperation(float hop_length, int n_freq, float fixed_rate); - ~TimeStretchOperation(); + ~TimeStretchOperation() override; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/treble_biquad_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/treble_biquad_ir.h index a0d828c0918..8462e6c21aa 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/treble_biquad_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/treble_biquad_ir.h @@ -37,7 +37,7 @@ class TrebleBiquadOperation : public TensorOperation { public: TrebleBiquadOperation(int32_t sample_rate, float gain, float central_freq, float Q); - ~TrebleBiquadOperation() = default; + ~TrebleBiquadOperation() override = default; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/vol_ir.h b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/vol_ir.h index 52ec572a23b..a8f2b85ce77 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/vol_ir.h +++ b/mindspore/ccsrc/minddata/dataset/audio/ir/kernels/vol_ir.h @@ -33,7 +33,7 @@ class VolOperation : public TensorOperation { public: VolOperation(float gain, GainType gain_type); - ~VolOperation(); + ~VolOperation() override; std::shared_ptr Build() override; diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc b/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc index 61bc3bbbac2..fadac46deed 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc @@ -33,7 +33,7 @@ namespace dataset { /// \param[out] output - Tensor has n points with linearly space. The spacing between the points is (end-start)/(n-1). /// \return Status return code. template -Status Linspace(std::shared_ptr *output, T start, T end, int n) { +Status Linspace(std::shared_ptr *output, T start, T end, int32_t n) { RETURN_IF_NOT_OK(ValidateNoGreaterThan("Linspace", "start", start, "end", end)); n = std::isnan(n) ? 100 : n; TensorShape out_shape({n}); @@ -61,7 +61,7 @@ Status ComplexAngle(const std::shared_ptr &input, std::shared_ptrshape(); TensorShape out_shape({input_shape[0], input_shape[1], input_shape[2]}); std::vector phase(input_shape[0] * input_shape[1] * input_shape[2]); - int ind = 0; + size_t ind = 0; for (auto itr = input->begin(); itr != input->end(); itr++, ind++) { auto x = (*itr); @@ -89,7 +89,7 @@ Status ComplexAbs(const std::shared_ptr &input, std::shared_ptr TensorShape input_shape = input->shape(); TensorShape out_shape({input_shape[0], input_shape[1], input_shape[2]}); std::vector abs(input_shape[0] * input_shape[1] * input_shape[2]); - int ind = 0; + size_t ind = 0; for (auto itr = input->begin(); itr != input->end(); itr++, ind++) { T x = (*itr); itr++; @@ -121,7 +121,7 @@ Status Polar(const std::shared_ptr &abs, const std::shared_ptr & TensorShape input_shape = abs->shape(); TensorShape out_shape({input_shape[0], input_shape[1], input_shape[2], 2}); std::vector complex_vec(input_shape[0] * input_shape[1] * input_shape[2] * 2); - int ind = 0; + size_t ind = 0; auto itr_abs = abs->begin(); auto itr_angle = angle->begin(); @@ -143,7 +143,7 @@ Status Polar(const std::shared_ptr &abs, const std::shared_ptr & /// \param[out] output - Complex tensor, . /// \return Status return code. template -Status PadComplexTensor(const std::shared_ptr &input, std::shared_ptr *output, int length, int dim) { +Status PadComplexTensor(const std::shared_ptr &input, std::shared_ptr *output, int length, size_t dim) { TensorShape input_shape = input->shape(); std::vector pad_shape_vec = {input_shape[0], input_shape[1], input_shape[2], input_shape[3]}; pad_shape_vec[dim] += static_cast(length); @@ -153,7 +153,7 @@ Status PadComplexTensor(const std::shared_ptr &input, std::shared_ptrbegin(); int64_t input_cnt = 0; /*lint -e{446} ind is modified in the body of the for loop */ - for (int ind = 0; ind < static_cast(in_vect.size()); ind++) { + for (auto ind = 0; ind < static_cast(in_vect.size()); ind++) { in_vect[ind] = (*itr_input); input_cnt = (input_cnt + 1) % (input_shape[2] * input_shape[3]); itr_input++; @@ -199,7 +199,7 @@ Status Phase(const std::shared_ptr &angle_0, const std::shared_ptrbegin(); (void)phase.insert(phase.begin(), (*itr_p0)); itr_p0++; @@ -235,7 +235,7 @@ Status Mag(const std::shared_ptr &abs_0, const std::shared_ptr & std::vector mag(mag_shape[0] * mag_shape[1] * mag_shape[2]); auto itr_abs_0 = abs_0->begin(); auto itr_abs_1 = abs_1->begin(); - for (int ind = 0; itr_abs_0 != abs_0->end(); itr_abs_0++, itr_abs_1++, ind++) { + for (auto ind = 0; itr_abs_0 != abs_0->end(); itr_abs_0++, itr_abs_1++, ind++) { mag[ind] = alphas[ind % mag_shape[2]] * (*itr_abs_1) + (1 - alphas[ind % mag_shape[2]]) * (*itr_abs_0); } std::shared_ptr mag_tensor; @@ -246,7 +246,7 @@ Status Mag(const std::shared_ptr &abs_0, const std::shared_ptr & template Status TimeStretch(std::shared_ptr input, std::shared_ptr *output, float rate, - std::shared_ptr phase_advance) { + const std::shared_ptr &phase_advance) { // pack <..., freq, time, complex> TensorShape input_shape = input->shape(); TensorShape toShape({input->Size() / (input_shape[-1] * input_shape[-2] * input_shape[-3]), input_shape[-3], @@ -260,11 +260,11 @@ Status TimeStretch(std::shared_ptr input, std::shared_ptr *outpu std::vector time_steps_0, time_steps_1; std::vector alphas; for (int ind = 0;; ind++) { - auto val = ind * rate; + T val = static_cast(ind) * rate; if (val >= input_shape[-2]) { break; } - int val_int = static_cast(val); + auto val_int = static_cast(val); time_steps_0.push_back(val_int); time_steps_1.push_back(val_int + 1); alphas.push_back(fmod(val, 1)); @@ -319,7 +319,7 @@ Status TimeStretch(std::shared_ptr input, std::shared_ptr *outpu } Status TimeStretch(const std::shared_ptr &input, std::shared_ptr *output, float rate, float hop_length, - float n_freq) { + int32_t n_freq) { std::shared_ptr phase_advance; switch (input->type().value()) { case DataType::DE_FLOAT32: @@ -340,15 +340,15 @@ Status Dct(std::shared_ptr *output, int n_mfcc, int n_mels, NormMode nor TensorShape dct_shape({n_mels, n_mfcc}); Tensor::CreateEmpty(dct_shape, DataType(DataType::DE_FLOAT32), output); auto iter = (*output)->begin(); - const float sqrt_2 = 1 / sqrt(2); - float sqrt_2_n_mels = sqrt(2.0 / n_mels); + const float sqrt_2 = 1 / sqrt(2.0f); + auto sqrt_2_n_mels = static_cast(sqrt(2.0 / n_mels)); for (int i = 0; i < n_mels; i++) { for (int j = 0; j < n_mfcc; j++) { // calculate temp: // 1. while norm = None, use 2*cos(PI*(i+0.5)*j/n_mels) // 2. while norm = Ortho, divide the first row by sqrt(2), // then using sqrt(2.0 / n_mels)*cos(PI*(i+0.5)*j/n_mels) - float temp = PI / n_mels * (i + 0.5) * j; + auto temp = static_cast(PI / n_mels * (i + 0.5) * j); temp = cos(temp); if (norm == NormMode::kOrtho) { if (j == 0) { @@ -400,11 +400,11 @@ Status MaskAlongAxis(const std::shared_ptr &input, std::shared_ptrtype().SizeInBytes(); + size_t cell_size = input->type().SizeInBytes(); if (axis == 1) { // freq - for (int ind = 0; ind < input->Size() / input_shape[-2] * mask_width; ind++) { + for (auto ind = 0; ind < input->Size() / input_shape[-2] * mask_width; ind++) { int block_num = ind / (mask_width * input_shape[-1]); auto start_pos = ind % (mask_width * input_shape[-1]) + mask_start * input_shape[-1] + input_shape[-1] * input_shape[-2] * block_num; @@ -448,7 +448,7 @@ template Status Norm(const std::shared_ptr &input, std::shared_ptr *output, float power) { // calculate the output dimension auto input_size = input->shape().AsVector(); - int32_t dim_back = static_cast(input_size.back()); + auto dim_back = input_size.back(); RETURN_IF_NOT_OK( ValidateTensorShape("ComplexNorm", input->IsComplex(), "<..., complex=2>", std::to_string(dim_back))); input_size.pop_back(); @@ -489,8 +489,8 @@ Status ComplexNorm(const std::shared_ptr &input, std::shared_ptr } template -float sgn(T val) { - return static_cast(static_cast(0) < val) - static_cast(val < static_cast(0)); +inline float sgn(T val) { + return (val > 0) ? 1 : ((val < 0) ? -1 : 0); } template @@ -642,10 +642,10 @@ Status Fade(const std::shared_ptr &input, std::shared_ptr *outpu int32_t fade_out_len, FadeShape fade_shape) { RETURN_IF_NOT_OK(Tensor::CreateFromTensor(input, output)); const TensorShape input_shape = input->shape(); - int32_t waveform_length = static_cast(input_shape[-1]); + auto waveform_length = static_cast(input_shape[-1]); RETURN_IF_NOT_OK(ValidateNoGreaterThan("Fade", "fade_in_len", fade_in_len, "length of waveform", waveform_length)); RETURN_IF_NOT_OK(ValidateNoGreaterThan("Fade", "fade_out_len", fade_out_len, "length of waveform", waveform_length)); - int32_t num_waveform = static_cast(input->Size() / waveform_length); + auto num_waveform = static_cast(input->Size() / waveform_length); TensorShape toShape = TensorShape({num_waveform, waveform_length}); RETURN_IF_NOT_OK((*output)->Reshape(toShape)); TensorPtr fade_in; @@ -792,7 +792,7 @@ Status GenerateWaveTable(std::shared_ptr *output, const DataType &type, RETURN_UNEXPECTED_IF_NULL(output); CHECK_FAIL_RETURN_UNEXPECTED(table_size > 0, "table_size must be more than 0, but got: " + std::to_string(table_size)); - int32_t phase_offset = static_cast(phase / PI / 2 * table_size + 0.5); + auto phase_offset = static_cast(phase / PI / 2 * table_size + 0.5); // get the offset of the i-th std::vector point; for (auto i = 0; i < table_size; i++) { @@ -814,7 +814,7 @@ Status GenerateWaveTable(std::shared_ptr *output, const DataType &type, // change phase *iter = point[i] * 2.0 / table_size; // get complete offset - int32_t value = static_cast(4 * point[i] / table_size); + auto value = static_cast(4 * point[i] / table_size); // change the value of the square wave according to the number of complete offsets if (value == 0) { *iter = *iter + 0.5; @@ -859,7 +859,7 @@ Status ReadWaveFile(const std::string &wav_file_dir, std::vector *wavefor std::ifstream in(file_path.ToString(), std::ios::in | std::ios::binary); CHECK_FAIL_RETURN_UNEXPECTED(in.is_open(), "Invalid file, failed to open waveform file: " + file_path.ToString() + ", make sure the file not damaged or permission denied."); - WavHeader *header = new WavHeader(); + auto *header = new WavHeader(); in.read(reinterpret_cast(header), sizeof(WavHeader)); *sample_rate = header->sample_rate; float bytes_per_sample = header->bits_per_sample / 8; @@ -1012,7 +1012,7 @@ Status SlidingWindowCmnHelper(const std::shared_ptr &input, std::shared_ RETURN_IF_NOT_OK( input->Reshape(TensorShape({static_cast(first_index / (num_frames * num_feats)), num_frames, num_feats}))); - int32_t num_channels = static_cast(input->shape()[0]); + auto num_channels = static_cast(input->shape()[0]); TensorPtr cmn_waveform; RETURN_IF_NOT_OK( Tensor::CreateEmpty(TensorShape({num_channels, num_frames, num_feats}), input->type(), &cmn_waveform)); @@ -1059,7 +1059,7 @@ Status Pad(const std::shared_ptr &input, std::shared_ptr *output RETURN_IF_NOT_OK(ValidateNonNegative("Pad", "pad_right", pad_right)); TensorShape input_shape = input->shape(); int32_t wave_length = input_shape[-1]; - int32_t num_wavs = static_cast(input->Size() / wave_length); + auto num_wavs = static_cast(input->Size() / wave_length); TensorShape to_shape = TensorShape({num_wavs, wave_length}); RETURN_IF_NOT_OK(input->Reshape(to_shape)); int32_t pad_length = wave_length + pad_left + pad_right; @@ -1553,7 +1553,7 @@ Status SpectralCentroidImpl(const std::shared_ptr &input, std::shared_pt } } specgram.push_back(tmp); - specgram_sum.push_back(specgram[k].colwise().sum()); + specgram_sum.emplace_back(specgram[k].colwise().sum()); } for (int k = 0; k < k_num; k++) { for (int i = 0; i < channals; ++i) { @@ -1561,7 +1561,7 @@ Status SpectralCentroidImpl(const std::shared_ptr &input, std::shared_pt tmp(i, j) = freqs_r(i, 0) * specgram[k](i, j); } } - specgram_result.push_back((tmp).colwise().sum()); + specgram_result.emplace_back((tmp).colwise().sum()); } auto itr_output = output_tensor->begin(); for (int k = 0; k < k_num; k++) { diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.h b/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.h index db46136a622..30c9d3322a0 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.h +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.h @@ -56,8 +56,8 @@ Status AmplitudeToDB(const std::shared_ptr &input, std::shared_ptrReshape(to_shape)); std::vector max_val; - int step = to_shape[-3] * input_shape[-2] * input_shape[-1]; - int cnt = 0; + uint64_t step = to_shape[-3] * input_shape[-2] * input_shape[-1]; + uint64_t cnt = 0; T temp_max = std::numeric_limits::lowest(); for (auto itr = input->begin(); itr != input->end(); itr++) { // do clamp @@ -73,10 +73,10 @@ Status AmplitudeToDB(const std::shared_ptr &input, std::shared_ptrbegin(); itr != input->end(); itr++, ind++) { - float lower_bound = max_val[ind / step] - top_db; - *itr = std::max((*itr), static_cast(lower_bound)); + T lower_bound = max_val[ind / step] - top_db; + *itr = std::max((*itr), lower_bound); } } RETURN_IF_NOT_OK(input->Reshape(input_shape)); @@ -147,10 +147,9 @@ Status Contrast(const std::shared_ptr &input, std::shared_ptr *o RETURN_IF_NOT_OK(Tensor::CreateEmpty(output_shape, input->type(), &out)); auto itr_out = out->begin(); for (auto itr_in = input->begin(); itr_in != input->end(); itr_in++) { - T temp1, temp2 = 0; // PI / 2 is half of the constant PI - temp1 = static_cast(*itr_in) * (PI / TWO); - temp2 = enhancement_amount_value * std::sin(temp1 * 4); + T temp1 = static_cast(*itr_in) * (PI / TWO); + T temp2 = enhancement_amount_value * std::sin(temp1 * 4); *itr_out = std::sin(temp1 + temp2); itr_out++; } @@ -242,8 +241,8 @@ Status LFilter(const std::shared_ptr &input, std::shared_ptr *ou TensorShape input_shape = input->shape(); TensorShape toShape({input->Size() / input_shape[-1], input_shape[-1]}); input->Reshape(toShape); - auto shape_0 = input->shape()[0]; - auto shape_1 = input->shape()[1]; + auto shape_0 = static_cast(input->shape()[0]); + auto shape_1 = static_cast(input->shape()[1]); std::vector signal; std::shared_ptr out; std::vector out_vect(shape_0 * shape_1); @@ -355,7 +354,7 @@ Status SpectralCentroid(const std::shared_ptr &input, std::shared_ptr &input, std::shared_ptr *output, float rate, float hop_length, - float n_freq); + int32_t n_freq); /// \brief Apply a mask along axis. /// \param input: Tensor of shape <..., freq, time>. diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/lfilter_op.cc b/mindspore/ccsrc/minddata/dataset/audio/kernels/lfilter_op.cc index 587724fe5f4..ada059f8892 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/kernels/lfilter_op.cc +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/lfilter_op.cc @@ -29,20 +29,20 @@ Status LFilterOp::Compute(const std::shared_ptr &input, std::shared_ptr< } else if (input->type() == DataType(DataType::DE_FLOAT64)) { std::vector a_coeffs_double; std::vector b_coeffs_double; - for (int i = 0; i < a_coeffs_.size(); i++) { + for (auto i = 0; i < a_coeffs_.size(); i++) { a_coeffs_double.push_back(static_cast(a_coeffs_[i])); } - for (int i = 0; i < b_coeffs_.size(); i++) { + for (auto i = 0; i < b_coeffs_.size(); i++) { b_coeffs_double.push_back(static_cast(b_coeffs_[i])); } return LFilter(input, output, a_coeffs_double, b_coeffs_double, clamp_); } else { std::vector a_coeffs_float16; std::vector b_coeffs_float16; - for (int i = 0; i < a_coeffs_.size(); i++) { + for (auto i = 0; i < a_coeffs_.size(); i++) { a_coeffs_float16.push_back(static_cast(a_coeffs_[i])); } - for (int i = 0; i < b_coeffs_.size(); i++) { + for (auto i = 0; i < b_coeffs_.size(); i++) { b_coeffs_float16.push_back(static_cast(b_coeffs_[i])); } return LFilter(input, output, a_coeffs_float16, b_coeffs_float16, clamp_); diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/lfilter_op.h b/mindspore/ccsrc/minddata/dataset/audio/kernels/lfilter_op.h index 9c593b88d43..16c21dc3f1c 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/kernels/lfilter_op.h +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/lfilter_op.h @@ -29,18 +29,18 @@ namespace dataset { class LFilterOp : public TensorOp { public: - LFilterOp(std::vector a_coeffs, std::vector b_coeffs, bool clamp) + LFilterOp(const std::vector &a_coeffs, const std::vector &b_coeffs, bool clamp) : a_coeffs_(a_coeffs), b_coeffs_(b_coeffs), clamp_(clamp) {} ~LFilterOp() override = default; void Print(std::ostream &out) const override { out << Name() << ": a_coeffs: "; - for (int i = 0; i < a_coeffs_.size(); i++) { + for (auto i = 0; i < a_coeffs_.size(); i++) { out << a_coeffs_[i] << " "; } out << "b_coeffs: "; - for (int i = 0; i < b_coeffs_.size(); i++) { + for (auto i = 0; i < b_coeffs_.size(); i++) { out << b_coeffs_[i] << " "; } out << "clamp: " << clamp_ << std::endl; diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/time_stretch_op.cc b/mindspore/ccsrc/minddata/dataset/audio/kernels/time_stretch_op.cc index f866994b064..2c94e64799b 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/kernels/time_stretch_op.cc +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/time_stretch_op.cc @@ -68,7 +68,7 @@ Status TimeStretchOp::OutputShape(const std::vector &inputs, std::v std::vector s_vec = s.AsVector(); s_vec.pop_back(); s_vec.pop_back(); - s_vec.push_back(std::ceil(s[-2] / fixed_rate_)); + s_vec.push_back(std::ceil(s[-2] / static_cast(fixed_rate_))); // push back complex s_vec.push_back(2); outputs.emplace_back(TensorShape(s_vec)); diff --git a/mindspore/ccsrc/minddata/dataset/callback/callback_manager.h b/mindspore/ccsrc/minddata/dataset/callback/callback_manager.h index 935685eef05..dfe01fecda2 100644 --- a/mindspore/ccsrc/minddata/dataset/callback/callback_manager.h +++ b/mindspore/ccsrc/minddata/dataset/callback/callback_manager.h @@ -74,8 +74,8 @@ class CallbackManager { Status StepEnd(const CallbackParam &); private: - bool enabled_; // flag to enable callback, if false, all functions would return immediately - DatasetOp *op_; // back pointer to DatasetOp, raw pointer to avoid circular ownership + bool enabled_; // flag to enable callback, if false, all functions would return immediately + DatasetOp *op_ = nullptr; // back pointer to DatasetOp, raw pointer to avoid circular ownership std::vector> callbacks_; // list of callbacks the DatasetOp needs to call std::vector begin_indices_; std::vector end_indices_; diff --git a/mindspore/ccsrc/minddata/dataset/callback/ds_callback.h b/mindspore/ccsrc/minddata/dataset/callback/ds_callback.h index 3f46296b026..8fbf6830729 100644 --- a/mindspore/ccsrc/minddata/dataset/callback/ds_callback.h +++ b/mindspore/ccsrc/minddata/dataset/callback/ds_callback.h @@ -34,7 +34,7 @@ class DSCallback { explicit DSCallback(int32_t step_size = 1) : step_size_(step_size) {} /// \brief Destructor - ~DSCallback() = default; + virtual ~DSCallback() = default; /// \brief actual callback function for begin, needs to be overridden in the derived class /// \param cb_param, callback parameter passed in from DatasetOp when calling the callback diff --git a/mindspore/ccsrc/minddata/dataset/callback/py_ds_callback.h b/mindspore/ccsrc/minddata/dataset/callback/py_ds_callback.h index 2c2198a24c2..38e640e546d 100644 --- a/mindspore/ccsrc/minddata/dataset/callback/py_ds_callback.h +++ b/mindspore/ccsrc/minddata/dataset/callback/py_ds_callback.h @@ -42,7 +42,7 @@ class PyDSCallback : public DSCallback { epoch_end_needed_(false), step_end_needed_(false) {} - ~PyDSCallback() = default; + ~PyDSCallback() override = default; void SetBegin(const py::function &f); void SetEnd(const py::function &f); @@ -128,5 +128,4 @@ class PyDSCallback : public DSCallback { }; } // namespace dataset } // namespace mindspore - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_PY_DS_CALLBACK_H diff --git a/mindspore/ccsrc/minddata/dataset/core/config_manager.h b/mindspore/ccsrc/minddata/dataset/core/config_manager.h index 28b94e7433a..b8cee901db6 100644 --- a/mindspore/ccsrc/minddata/dataset/core/config_manager.h +++ b/mindspore/ccsrc/minddata/dataset/core/config_manager.h @@ -63,7 +63,7 @@ class ConfigManager { // Another debug print helper. Converts the print info to a string for you. // @return The string version of the debug print - std::string ToString() { + std::string ToString() const { std::stringstream ss; ss << *this; return ss.str(); @@ -178,7 +178,7 @@ class ConfigManager { // getter function // @return The interval of monitor sampling - int32_t monitor_sampling_interval() const { return monitor_sampling_interval_; } + uint32_t monitor_sampling_interval() const { return monitor_sampling_interval_; } // setter function // @param auto_num_workers - whether assign threads to each op automatically @@ -200,13 +200,13 @@ class ConfigManager { // getter function // @return The timeout DSWaitedCallback would wait for before raising an error - int32_t callback_timeout() const { return callback_timout_; } + uint32_t callback_timeout() const { return callback_timout_; } // getter function // E.g. 0 would corresponds to a 1:1:1 ratio of num_worker among leaf batch and map. // please refer to AutoWorkerPass for detail on what each option is. // @return The experimental config used by AutoNumWorker, each 1 refers to a different setup configuration - uint8_t get_auto_worker_config() { return auto_worker_config_; } + uint8_t get_auto_worker_config() const { return auto_worker_config_; } // setter function // E.g. set the value of 0 would corresponds to a 1:1:1 ratio of num_worker among leaf batch and map. @@ -220,7 +220,7 @@ class ConfigManager { // getter function // @return - Flag to indicate whether shared memory for multi-processing is enabled - bool enable_shared_mem() { return enable_shared_mem_; } + bool enable_shared_mem() const { return enable_shared_mem_; } // setter function // @param offload - To enable automatic offloading of dataset ops @@ -228,7 +228,7 @@ class ConfigManager { // getter function // @return - Flag to indicate whether automatic offloading is enabled for the dataset - bool get_auto_offload() { return auto_offload_; } + bool get_auto_offload() const { return auto_offload_; } // setter function // @param enable - To enable autotune @@ -236,11 +236,11 @@ class ConfigManager { // getter function // @return - Flag to indicate whether autotune is enabled - bool enable_autotune() { return enable_autotune_; } + bool enable_autotune() const { return enable_autotune_; } // getter function // @return - autotune interval in steps - int64_t autotune_interval() { return autotune_interval_; } + int64_t autotune_interval() const { return autotune_interval_; } // setter function // @param interval - autotune interval in steps @@ -277,5 +277,4 @@ class ConfigManager { }; } // namespace dataset } // namespace mindspore - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_CONFIG_MANAGER_H_ diff --git a/mindspore/ccsrc/minddata/dataset/core/device_tensor.h b/mindspore/ccsrc/minddata/dataset/core/device_tensor.h index bff26ead8a1..1498022654a 100644 --- a/mindspore/ccsrc/minddata/dataset/core/device_tensor.h +++ b/mindspore/ccsrc/minddata/dataset/core/device_tensor.h @@ -32,7 +32,7 @@ class DeviceTensor : public Tensor { public: DeviceTensor(const TensorShape &shape, const DataType &type); - ~DeviceTensor() {} + ~DeviceTensor() override = default; Status SetAttributes(uint8_t *data_ptr, const uint32_t &dataSize, const uint32_t &width, const uint32_t &widthStride, const uint32_t &height, const uint32_t &heightStride); diff --git a/mindspore/ccsrc/minddata/dataset/core/tensor.cc b/mindspore/ccsrc/minddata/dataset/core/tensor.cc index 75a286805f5..74f0294eb64 100644 --- a/mindspore/ccsrc/minddata/dataset/core/tensor.cc +++ b/mindspore/ccsrc/minddata/dataset/core/tensor.cc @@ -85,10 +85,12 @@ Tensor &Tensor::operator=(Tensor &&other) noexcept { data_ = other.GetMutableBuffer(); data_end_ = other.data_end_; data_allocator_ = std::move(other.data_allocator_); + yuv_shape_ = other.yuv_shape_; other.Invalidate(); } return *this; } + Status Tensor::CreateEmpty(const TensorShape &shape, const DataType &type, TensorPtr *out) { CHECK_FAIL_RETURN_UNEXPECTED(shape.known(), "Invalid shape."); CHECK_FAIL_RETURN_UNEXPECTED(type != DataType::DE_UNKNOWN, "Invalid data type."); @@ -111,6 +113,7 @@ Status Tensor::CreateEmpty(const TensorShape &shape, const DataType &type, Tenso } return Status::OK(); } + Status Tensor::CreateFromMemory(const TensorShape &shape, const DataType &type, const uchar *src, TensorPtr *out) { RETURN_IF_NOT_OK(CreateEmpty(shape, type, out)); if (src != nullptr && out != nullptr) { @@ -680,7 +683,7 @@ Status Tensor::to_json(nlohmann::json *out_json) { RETURN_IF_NOT_OK(to_json_convert(&args)); } else if (type_ == DataType::DE_STRING) { std::vector data_out; - for (auto it = this->begin(); it != this->end(); it++) { + for (auto it = this->begin(); it != this->end(); ++it) { data_out.emplace_back(*it); } args["data"] = data_out; @@ -739,7 +742,8 @@ Status Tensor::from_json(nlohmann::json op_params, std::shared_ptr *tens } template -Status Tensor::from_json_convert(nlohmann::json json_data, TensorShape shape, std::shared_ptr *tensor) { +Status Tensor::from_json_convert(const nlohmann::json &json_data, const TensorShape &shape, + std::shared_ptr *tensor) { std::vector data = json_data; RETURN_IF_NOT_OK(CreateFromVector(data, shape, tensor)); return Status::OK(); diff --git a/mindspore/ccsrc/minddata/dataset/core/tensor.h b/mindspore/ccsrc/minddata/dataset/core/tensor.h index acd4d0e18c3..ba9a395d0c8 100644 --- a/mindspore/ccsrc/minddata/dataset/core/tensor.h +++ b/mindspore/ccsrc/minddata/dataset/core/tensor.h @@ -225,7 +225,8 @@ class Tensor { static Status from_json(nlohmann::json op_params, std::shared_ptr *tensor); template - static Status from_json_convert(nlohmann::json json_data, TensorShape shape, std::shared_ptr *tensor); + static Status from_json_convert(const nlohmann::json &json_data, const TensorShape &shape, + std::shared_ptr *tensor); /// Get item located at `index`, caller needs to provide the type. /// \tparam T @@ -481,6 +482,9 @@ class Tensor { ~TensorIterator() = default; TensorIterator &operator=(const TensorIterator &rhs) { + if (this == &rhs) { + return *this; + } ptr_ = rhs.ptr_; return *this; } @@ -565,7 +569,7 @@ class Tensor { using pointer = std::string_view *; using reference = std::string_view &; - explicit TensorIterator(uchar *data = nullptr, dsize_t index = 0) { + explicit TensorIterator(const uchar *data = nullptr, dsize_t index = 0) { data_ = reinterpret_cast(data); index_ = index; } @@ -795,7 +799,7 @@ inline Status Tensor::CreateFromVector(const std::vector(*alloc, TensorShape({static_cast(items.size())}), DataType(DataType::DE_STRING)); CHECK_FAIL_RETURN_UNEXPECTED(out != nullptr, "Allocate memory failed."); - if (items.size() == 0) { + if (items.empty()) { if (shape.known()) { return (*out)->Reshape(shape); } diff --git a/mindspore/ccsrc/minddata/dataset/engine/connector.h b/mindspore/ccsrc/minddata/dataset/engine/connector.h index f966f251381..a41583b5276 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/connector.h +++ b/mindspore/ccsrc/minddata/dataset/engine/connector.h @@ -195,7 +195,7 @@ class Connector { int32_t expect_consumer_; // The index to the queues_ where the next data should be popped. - int32_t pop_from_; + size_t pop_from_; int32_t num_producers_; int32_t num_consumers_; diff --git a/mindspore/ccsrc/minddata/dataset/engine/execution_tree.h b/mindspore/ccsrc/minddata/dataset/engine/execution_tree.h index 761072a4977..069e5636d2a 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/execution_tree.h +++ b/mindspore/ccsrc/minddata/dataset/engine/execution_tree.h @@ -64,23 +64,28 @@ class ExecutionTree { ++ind_; return *this; } // prefix ++ overload + Iterator operator++(int) { Iterator it = *this; it.ind_ = ind_; ind_++; return it; } // post-fix ++ overload + Iterator &operator--() { --ind_; return *this; } // prefix -- overload + Iterator operator--(int) { Iterator it = *this; it.ind_ = ind_; ind_--; return it; - } // post-fix -- overload + } // post-fix -- overload + DatasetOp &operator*() { return *nodes_[ind_]; } // dereference operator + std::shared_ptr operator->() { return nodes_[ind_]; } // getter function @@ -91,10 +96,10 @@ class ExecutionTree { bool operator!=(const Iterator &rhs) { return nodes_[ind_] != rhs.nodes_[rhs.ind_]; } - int32_t NumNodes() { return nodes_.size(); } + size_t NumNodes() const { return nodes_.size(); } private: - int32_t ind_; // the cur node our Iterator points to + size_t ind_; // the cur node our Iterator points to std::vector> nodes_; // store the nodes in post order void PostOrderTraverse(const std::shared_ptr &); }; @@ -140,7 +145,7 @@ class ExecutionTree { /// \param out - reference to the output stream being overloaded /// \param exe_tree - reference to the execution tree to display /// \return - the output stream must be returned - friend std::ostream &operator<<(std::ostream &out, ExecutionTree &exe_tree) { + friend std::ostream &operator<<(std::ostream &out, const ExecutionTree &exe_tree) { exe_tree.Print(out); return out; } @@ -164,8 +169,10 @@ class ExecutionTree { /// \return Status The status code returned Status LaunchWorkers(int32_t num_workers, std::function func, std::vector *worker_tasks, std::string name = "", int32_t operator_id = -1); + Status LaunchWorkers(int32_t num_workers, std::function func, std::string name = "", int32_t operator_id = -1); + /// \brief Getter method /// \return shared_ptr to the root operator std::shared_ptr root() const { return root_; } @@ -233,5 +240,4 @@ class ExecutionTree { }; } // namespace dataset } // namespace mindspore - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_EXECUTION_TREE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/edge.h b/mindspore/ccsrc/minddata/dataset/engine/gnn/edge.h index 927f568e202..c9e5b49f526 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/edge.h +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/edge.h @@ -28,7 +28,6 @@ namespace mindspore { namespace dataset { namespace gnn { using EdgeType = int8_t; -using EdgeIdType = int32_t; class Edge { public: @@ -38,7 +37,8 @@ class Edge { // @param WeightType weight - edge weight // @param std::shared_ptr src_node - source node // @param std::shared_ptr dst_node - destination node - Edge(EdgeIdType id, EdgeType type, WeightType weight, std::shared_ptr src_node, std::shared_ptr dst_node) + Edge(EdgeIdType id, EdgeType type, WeightType weight, const std::shared_ptr &src_node, + const std::shared_ptr &dst_node) : id_(id), type_(type), weight_(weight), src_node_(src_node), dst_node_(dst_node) {} virtual ~Edge() = default; diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data.h b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data.h index 7722717f48f..ebc0f116526 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data.h +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data.h @@ -44,6 +44,9 @@ struct MetaInfo { class GraphData { public: + // Destructor + virtual ~GraphData() = default; + // Get all nodes from the graph. // @param NodeType node_type - type of node // @param std::shared_ptr *out - Returned nodes id diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_client.h b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_client.h index c05ad375c9e..a24f78a4802 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_client.h +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_client.h @@ -17,13 +17,13 @@ #define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_GNN_GRAPH_DATA_CLIENT_H_ #include +#include #include #include -#include #include #include -#include #include +#include #if !defined(_WIN32) && !defined(_WIN64) #include "proto/gnn_graph_data.grpc.pb.h" @@ -48,7 +48,7 @@ class GraphDataClient : public GraphData { // @param int32_t num_workers - number of parallel threads GraphDataClient(const std::string &dataset_file, const std::string &hostname, int32_t port); - ~GraphDataClient(); + ~GraphDataClient() override; Status Init() override; diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_impl.cc b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_impl.cc index babb0263a68..238a0e786b8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_impl.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_impl.cc @@ -28,7 +28,7 @@ namespace mindspore { namespace dataset { namespace gnn { -GraphDataImpl::GraphDataImpl(std::string dataset_file, int32_t num_workers, bool server_mode) +GraphDataImpl::GraphDataImpl(const std::string &dataset_file, int32_t num_workers, bool server_mode) : dataset_file_(dataset_file), num_workers_(num_workers), rnd_(GetRandomDevice()), @@ -38,7 +38,7 @@ GraphDataImpl::GraphDataImpl(std::string dataset_file, int32_t num_workers, bool MS_LOG(INFO) << "num_workers:" << num_workers; } -GraphDataImpl::~GraphDataImpl() {} +GraphDataImpl::~GraphDataImpl() = default; Status GraphDataImpl::GetAllNodes(NodeType node_type, std::shared_ptr *out) { RETURN_UNEXPECTED_IF_NULL(out); diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_impl.h b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_impl.h index 9838ca4ca39..ea1cd9cda3b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_impl.h +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_impl.h @@ -44,9 +44,9 @@ class GraphDataImpl : public GraphData { // Constructor // @param std::string dataset_file - // @param int32_t num_workers - number of parallel threads - GraphDataImpl(std::string dataset_file, int32_t num_workers, bool server_mode = false); + GraphDataImpl(const std::string &dataset_file, int32_t num_workers, bool server_mode = false); - ~GraphDataImpl(); + ~GraphDataImpl() override; // Get all nodes from the graph. // @param NodeType node_type - type of node @@ -150,11 +150,11 @@ class GraphDataImpl : public GraphData { Status GraphInfo(py::dict *out) override; #endif - const std::unordered_map> *GetAllDefaultNodeFeatures() { + const std::unordered_map> *GetAllDefaultNodeFeatures() const { return &default_node_feature_map_; } - const std::unordered_map> *GetAllDefaultEdgeFeatures() { + const std::unordered_map> *GetAllDefaultEdgeFeatures() const { return &default_edge_feature_map_; } diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_server.h b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_server.h index 51832392027..d68be74b440 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_server.h +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_data_server.h @@ -48,9 +48,9 @@ class GraphDataServer { Status ClientRegister(int32_t pid); Status ClientUnRegister(int32_t pid); - enum ServerState state() { return state_; } + enum ServerState state() const { return state_; } - bool IsStopped() { + bool IsStopped() const { if (state_ == kGdsStopped) { return true; } else { @@ -86,7 +86,7 @@ class GraphDataServer { #if !defined(_WIN32) && !defined(_WIN64) class UntypedCall { public: - virtual ~UntypedCall() {} + virtual ~UntypedCall() = default; virtual Status operator()() = 0; @@ -112,7 +112,7 @@ class CallData : public UntypedCall { handle_request_function_(handle_request_function), responder_(&ctx_) {} - ~CallData() = default; + ~CallData() override = default; static Status EnqueueRequest(ServiceImpl *service_impl, AsyncService *async_service, grpc::ServerCompletionQueue *cq, EnqueueFunction enqueue_function, HandleRequestFunction handle_request_function) { diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_shared_memory.h b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_shared_memory.h index 2b94c8c3000..a58f7f87926 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_shared_memory.h +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_shared_memory.h @@ -50,9 +50,9 @@ class GraphSharedMemory { Status GetData(uint8_t *data, int64_t data_len, int64_t offset, int64_t get_data_len); - key_t memory_key() { return memory_key_; } + key_t memory_key() const { return memory_key_; } - int64_t memory_size() { return memory_size_; } + int64_t memory_size() const { return memory_size_; } private: Status SharedMemoryImpl(const int &shmflg); diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/local_node.h b/mindspore/ccsrc/minddata/dataset/engine/gnn/local_node.h index 6447e46a90b..2a8057e6f9c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/local_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/local_node.h @@ -36,7 +36,7 @@ class LocalNode : public Node { // @param NodeType type - node type LocalNode(NodeIdType id, NodeType type, WeightType weight); - ~LocalNode() = default; + ~LocalNode() override = default; // Get the feature of a node // @param FeatureType feature_type - type of feature diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/cache/dataset_cache.h b/mindspore/ccsrc/minddata/dataset/engine/ir/cache/dataset_cache.h index 0e49eb80687..417f674f39e 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/cache/dataset_cache.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/cache/dataset_cache.h @@ -23,17 +23,23 @@ #include "minddata/dataset/util/status.h" namespace mindspore::dataset { - class DatasetCache { public: + virtual ~DatasetCache() = default; + virtual Status Build() = 0; + virtual Status ValidateParams() = 0; + virtual Status CreateCacheOp(int32_t num_workers, int32_t connector_queue_size, std::shared_ptr sampler, std::shared_ptr *ds) = 0; + virtual Status CreateCacheLookupOp(int32_t num_workers, int32_t connector_queue_size, std::shared_ptr sampler, std::shared_ptr *ds) = 0; + virtual Status CreateCacheMergeOp(int32_t num_workers, int32_t connector_queue_size, std::shared_ptr *ds) = 0; + virtual Status to_json(nlohmann::json *out_json) { return Status::OK(); } #ifndef ENABLE_ANDROID @@ -41,5 +47,4 @@ class DatasetCache { #endif }; } // namespace mindspore::dataset - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_CACHE_DATASET_CACHE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/cache/dataset_cache_impl.h b/mindspore/ccsrc/minddata/dataset/engine/ir/cache/dataset_cache_impl.h index 3ad78a2c062..f043f345205 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/cache/dataset_cache_impl.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/cache/dataset_cache_impl.h @@ -75,7 +75,7 @@ class DatasetCacheImpl : public DatasetCache { Status to_json(nlohmann::json *out_json) override; - ~DatasetCacheImpl() = default; + ~DatasetCacheImpl() override = default; private: std::shared_ptr cache_client_; diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.h b/mindspore/ccsrc/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.h index bf48efb0001..49163af9686 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/cache/pre_built_dataset_cache.h @@ -37,7 +37,7 @@ class PreBuiltDatasetCache : public DatasetCacheImpl { cache_client_ = std::move(cc); } - ~PreBuiltDatasetCache() = default; + ~PreBuiltDatasetCache() override = default; /// Method to initialize the DatasetCache by creating an instance of a CacheClient /// \return Status Error code @@ -45,5 +45,4 @@ class PreBuiltDatasetCache : public DatasetCacheImpl { }; } // namespace dataset } // namespace mindspore - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_CACHE_PRE_BUILT_DATASET_CACHE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/batch_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/batch_node.h index 89d2cda3680..b32984eead7 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/batch_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/batch_node.h @@ -28,7 +28,6 @@ namespace mindspore { namespace dataset { - class BatchNode : public DatasetNode { public: #ifdef ENABLE_PYTHON @@ -43,7 +42,7 @@ class BatchNode : public DatasetNode { BatchNode(std::shared_ptr child, int32_t batch_size, bool drop_remainder); /// \brief Destructor - ~BatchNode() = default; + ~BatchNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -126,7 +125,6 @@ class BatchNode : public DatasetNode { #endif std::map>> pad_map_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_BATCH_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.h index 77ff1b3442e..8e2411a1302 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/bucket_batch_by_length_node.h @@ -27,7 +27,6 @@ namespace mindspore { namespace dataset { - class BucketBatchByLengthNode : public DatasetNode { public: /// \brief Constructor @@ -38,7 +37,7 @@ class BucketBatchByLengthNode : public DatasetNode { bool pad_to_bucket_boundary = false, bool drop_remainder = false); /// \brief Destructor - ~BucketBatchByLengthNode() = default; + ~BucketBatchByLengthNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -81,7 +80,6 @@ class BucketBatchByLengthNode : public DatasetNode { bool pad_to_bucket_boundary_; bool drop_remainder_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_BUCKET_BATCH_BY_LENGTH_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.h index 55fcd5a5f57..8d6f1144a90 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_sentence_piece_vocab_node.h @@ -28,7 +28,6 @@ namespace mindspore { namespace dataset { - class BuildSentenceVocabNode : public DatasetNode { public: /// \brief Constructor @@ -37,7 +36,7 @@ class BuildSentenceVocabNode : public DatasetNode { SentencePieceModel model_type, const std::unordered_map ¶ms); /// \brief Destructor - ~BuildSentenceVocabNode() = default; + ~BuildSentenceVocabNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -88,7 +87,6 @@ class BuildSentenceVocabNode : public DatasetNode { SentencePieceModel model_type_; std::unordered_map params_; }; - } // namespace dataset } // namespace mindspore #endif // #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_BUILD_SENTENCE_PIECE_VOCAB_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_vocab_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_vocab_node.h index 02b57ba29a2..30088fcd463 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_vocab_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/build_vocab_node.h @@ -26,7 +26,6 @@ namespace mindspore { namespace dataset { - class BuildVocabNode : public DatasetNode { public: /// \brief Constructor @@ -35,7 +34,7 @@ class BuildVocabNode : public DatasetNode { const std::vector &special_tokens, bool special_first); /// \brief Destructor - ~BuildVocabNode() = default; + ~BuildVocabNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -86,7 +85,6 @@ class BuildVocabNode : public DatasetNode { std::vector special_tokens_; bool special_first_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_BUILD_VOCAB_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_lookup_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_lookup_node.h index c87cb18a2ae..8ec381f7827 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_lookup_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_lookup_node.h @@ -32,7 +32,7 @@ class CacheLookupNode : public DatasetNode, public SamplerObj { std::shared_ptr cache); /// \brief Destructor - ~CacheLookupNode() = default; + ~CacheLookupNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -87,5 +87,4 @@ class CacheLookupNode : public DatasetNode, public SamplerObj { }; } // namespace dataset } // namespace mindspore - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_LOOKUP_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_merge_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_merge_node.h index 297d7273c24..00449e1ae08 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_merge_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_merge_node.h @@ -30,7 +30,7 @@ class CacheMergeNode : public DatasetNode { CacheMergeNode(std::shared_ptr child, std::shared_ptr cache); /// \brief Destructor - ~CacheMergeNode() = default; + ~CacheMergeNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -67,5 +67,4 @@ class CacheMergeNode : public DatasetNode { }; } // namespace dataset } // namespace mindspore - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_MERGE_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_node.h index dd04096d74f..a7010aa28ec 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/cache_node.h @@ -31,7 +31,7 @@ class CacheNode : public DatasetNode { std::shared_ptr cache); /// \brief Destructor - ~CacheNode() = default; + ~CacheNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -71,5 +71,4 @@ class CacheNode : public DatasetNode { }; } // namespace dataset } // namespace mindspore - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/concat_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/concat_node.h index 97ac08aaf40..97aa99c9539 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/concat_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/concat_node.h @@ -26,7 +26,6 @@ namespace mindspore { namespace dataset { - class ConcatNode : public DatasetNode { public: /// \brief Constructor @@ -36,7 +35,7 @@ class ConcatNode : public DatasetNode { const std::vector> &children_start_end_index = {}); /// \brief Destructor - ~ConcatNode() = default; + ~ConcatNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -89,11 +88,6 @@ class ConcatNode : public DatasetNode { const std::vector> &ChildrenFlagAndNums() const { return children_flag_and_nums_; } const std::vector> &ChildrenStartEndIndex() const { return children_start_end_index_; } - private: - std::shared_ptr sampler_; - std::vector> children_flag_and_nums_; - std::vector> children_start_end_index_; - /// \brief Base-class override for accepting IRNodePass visitor /// \param[in] p The node to visit /// \param[out] modified Indicator if the node was modified @@ -105,8 +99,12 @@ class ConcatNode : public DatasetNode { /// \param[out] modified Indicator if the node was modified /// \return Status of the node visit Status AcceptAfter(IRNodePass *const p, bool *const modified) override; -}; + private: + std::shared_ptr sampler_; + std::vector> children_flag_and_nums_; + std::vector> children_start_end_index_; +}; } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CONCAT_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/dataset_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/dataset_node.cc index afd94a3fa25..63e290b79ed 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/dataset_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/dataset_node.cc @@ -34,7 +34,6 @@ Status ComputeShuffleSize(int64_t num_files, int64_t num_devices, int64_t num_ro RETURN_UNEXPECTED_IF_NULL(shuffle_size); const int64_t average_files_multiplier = 4; const int64_t shuffle_max = 10000; - int64_t avg_rows_per_file = 0; // Adjust the num rows per shard if sharding was given if (num_devices > 0) { @@ -52,7 +51,7 @@ Status ComputeShuffleSize(int64_t num_files, int64_t num_devices, int64_t num_ro // get the average per file CHECK_FAIL_RETURN_UNEXPECTED(num_files != 0, "The size of dataset_files must be greater than 0."); - avg_rows_per_file = num_rows / num_files; + int64_t avg_rows_per_file = num_rows / num_files; *shuffle_size = std::max(avg_rows_per_file * average_files_multiplier, shuffle_max); return Status::OK(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/dataset_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/dataset_node.h index 2e3be5a645b..c8922405199 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/dataset_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/dataset_node.h @@ -181,7 +181,7 @@ class DatasetNode : public std::enable_shared_from_this { explicit DatasetNode(const std::shared_ptr &dataset_cache); /// \brief Destructor - ~DatasetNode() = default; + virtual ~DatasetNode() = default; /// \brief Node name getter /// \return Name of the current node @@ -286,7 +286,7 @@ class DatasetNode : public std::enable_shared_from_this { /// \brief Check if this node is an orphan node /// \return True if this node isn't nullptr nor does it have any children and a parent - static bool IsOrphanNode(std::shared_ptr node) { + static bool IsOrphanNode(const std::shared_ptr &node) { return node != nullptr && node->parent_ == nullptr && node->Children().empty(); } @@ -294,7 +294,7 @@ class DatasetNode : public std::enable_shared_from_this { void HasCacheAbove() { descendant_of_cache_ = true; } /// \brief Getter of the number of workers - int32_t NumWorkers() { return num_workers_; } + int32_t NumWorkers() const { return num_workers_; } /// \brief Getter of dataset cache std::shared_ptr GetDatasetCache() { return cache_; } @@ -346,7 +346,7 @@ class DatasetNode : public std::enable_shared_from_this { void SetTotalRepeats(int32_t total_repeats) { total_repeats_ = total_repeats; } /// \brief Setter function, set the number of epochs for the operator - void SetNumEpochs(int32_t num_epochs) { num_epochs_ = num_epochs; } + virtual void SetNumEpochs(int32_t num_epochs) { num_epochs_ = num_epochs; } /// \brief Getter function /// \return The number of required repeats for the operator @@ -399,7 +399,7 @@ class MappableSourceNode : public DatasetNode { Status Accept(IRNodePass *const p, bool *const modified) override; /// \brief Destructor - ~MappableSourceNode() = default; + virtual ~MappableSourceNode() = default; /// \brief Node name getter /// \return Name of the current node @@ -430,7 +430,7 @@ class NonMappableSourceNode : public DatasetNode { Status Accept(IRNodePass *const p, bool *const modified) override; /// \brief Destructor - ~NonMappableSourceNode() = default; + virtual ~NonMappableSourceNode() = default; /// \brief Node name getter /// \return Name of the current node diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/epoch_ctrl_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/epoch_ctrl_node.h index 867a3010674..ea45201b8b1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/epoch_ctrl_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/epoch_ctrl_node.h @@ -27,7 +27,6 @@ namespace mindspore { namespace dataset { - class EpochCtrlNode : public RepeatNode { // Allow GeneratorNode to access internal members friend class GeneratorNode; @@ -40,7 +39,7 @@ class EpochCtrlNode : public RepeatNode { EpochCtrlNode(std::shared_ptr child, int32_t num_epochs); /// \brief Destructor - ~EpochCtrlNode() = default; + ~EpochCtrlNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -75,7 +74,6 @@ class EpochCtrlNode : public RepeatNode { /// \return Status of the node visit Status AcceptAfter(IRNodePass *const p, bool *const modified) override; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_EPOCH_CTRL_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/filter_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/filter_node.h index e7fdc959f5d..16a7087245c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/filter_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/filter_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class FilterNode : public DatasetNode { public: /// \brief Constructor @@ -33,7 +32,7 @@ class FilterNode : public DatasetNode { std::vector input_columns = {}); /// \brief Destructor - ~FilterNode() = default; + ~FilterNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -83,7 +82,6 @@ class FilterNode : public DatasetNode { std::shared_ptr predicate_; std::vector input_columns_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_FILTER_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/map_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/map_node.h index 8378a80378f..5e00066ede8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/map_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/map_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class MapNode : public DatasetNode { public: /// \brief Constructor @@ -36,7 +35,7 @@ class MapNode : public DatasetNode { ManualOffloadMode offload = ManualOffloadMode::kUnspecified); /// \brief Destructor - ~MapNode() = default; + ~MapNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -127,7 +126,6 @@ class MapNode : public DatasetNode { /// \brief ManualOffloadMode to indicate manual_offload status ManualOffloadMode offload_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_MAP_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/project_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/project_node.h index b439580f433..866c511a211 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/project_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/project_node.h @@ -25,14 +25,13 @@ namespace mindspore { namespace dataset { - class ProjectNode : public DatasetNode { public: /// \brief Constructor explicit ProjectNode(std::shared_ptr child, const std::vector &columns); /// \brief Destructor - ~ProjectNode() = default; + ~ProjectNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -74,7 +73,6 @@ class ProjectNode : public DatasetNode { private: std::vector columns_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_PROJECT_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/rename_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/rename_node.h index 5b1a0e46bbf..b2248442bb0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/rename_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/rename_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class RenameNode : public DatasetNode { public: /// \brief Constructor @@ -33,7 +32,7 @@ class RenameNode : public DatasetNode { const std::vector &output_columns); /// \brief Destructor - ~RenameNode() = default; + ~RenameNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -77,7 +76,6 @@ class RenameNode : public DatasetNode { std::vector input_columns_; std::vector output_columns_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_RENAME_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/repeat_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/repeat_node.h index c8f26b5b036..8243ea8f207 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/repeat_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/repeat_node.h @@ -27,7 +27,6 @@ namespace mindspore { namespace dataset { - class RepeatOp; class RepeatNode : public DatasetNode { @@ -42,7 +41,7 @@ class RepeatNode : public DatasetNode { RepeatNode(std::shared_ptr child, int32_t count); /// \brief Destructor - ~RepeatNode() = default; + ~RepeatNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -67,7 +66,7 @@ class RepeatNode : public DatasetNode { /// \brief Getter /// \return Number of cycles to repeat the execution - const int32_t Count() const { return repeat_count_; } + int32_t Count() const { return repeat_count_; } /// \brief Base-class override for GetDatasetSize /// \param[in] size_getter Shared pointer to DatasetSizeGetter @@ -136,7 +135,6 @@ class RepeatNode : public DatasetNode { std::shared_ptr reset_ancestor_; // updated its immediate Repeat/EpochCtrl ancestor in GeneratorNodePass int32_t repeat_count_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_REPEAT_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/root_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/root_node.h index 283a389686c..93e2de01059 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/root_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/root_node.h @@ -35,7 +35,7 @@ class RootNode : public DatasetNode { explicit RootNode(std::shared_ptr child); /// \brief Destructor - ~RootNode() = default; + ~RootNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -55,10 +55,10 @@ class RootNode : public DatasetNode { Status Build(std::vector> *const node_ops) override; /// \brief Getter of number of epochs - int32_t num_epochs() { return num_epochs_; } + int32_t num_epochs() const { return num_epochs_; } /// \brief Setter of number of epochs - void SetNumEpochs(int32_t num_epochs) { num_epochs_ = num_epochs; } + void SetNumEpochs(int32_t num_epochs) override { num_epochs_ = num_epochs; } /// \brief Parameters validation /// \return Status Status::OK() if all the parameters are valid @@ -79,7 +79,6 @@ class RootNode : public DatasetNode { private: int32_t num_epochs_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_ROOT_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/shuffle_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/shuffle_node.h index 98f44721f32..571ebd3e8d0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/shuffle_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/shuffle_node.h @@ -27,12 +27,11 @@ namespace mindspore { namespace dataset { - class ShuffleNode : public DatasetNode { public: ShuffleNode(std::shared_ptr child, int32_t shuffle_size, bool reset_every_epoch); - ~ShuffleNode() = default; + ~ShuffleNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -76,7 +75,6 @@ class ShuffleNode : public DatasetNode { uint32_t shuffle_seed_; bool reset_every_epoch_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SHUFFLE_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/skip_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/skip_node.h index e52a26fdb18..abe5b1650a7 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/skip_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/skip_node.h @@ -25,14 +25,13 @@ namespace mindspore { namespace dataset { - class SkipNode : public DatasetNode { public: /// \brief Constructor explicit SkipNode(std::shared_ptr child, int32_t count); /// \brief Destructor - ~SkipNode() = default; + ~SkipNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -57,7 +56,7 @@ class SkipNode : public DatasetNode { /// \brief Getter /// \return Number of rows to skip - const int32_t Count() const { return skip_count_; } + int32_t Count() const { return skip_count_; } /// \brief Base-class override for GetDatasetSize /// \param[in] size_getter Shared pointer to DatasetSizeGetter @@ -99,7 +98,6 @@ class SkipNode : public DatasetNode { private: int32_t skip_count_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SKIP_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h index 4902465e4d9..4c2cb87b430 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/ag_news_node.h @@ -34,7 +34,7 @@ class AGNewsNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor. - ~AGNewsNode() = default; + ~AGNewsNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/album_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/album_node.cc index de82d4b7aaa..634643bc11c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/album_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/album_node.cc @@ -99,7 +99,6 @@ Status AlbumNode::GetDatasetSize(const std::shared_ptr &size_ *dataset_size = dataset_size_; return Status::OK(); } - int64_t sample_size = -1; int64_t num_rows = 0; // iterate over the files in the directory and count files to initiate num_rows Path folder(dataset_dir_); @@ -118,7 +117,7 @@ Status AlbumNode::GetDatasetSize(const std::shared_ptr &size_ // give sampler the total number of files and check if num_samples is smaller std::shared_ptr sampler_rt = nullptr; RETURN_IF_NOT_OK(sampler_->SamplerBuild(&sampler_rt)); - sample_size = sampler_rt->CalculateNumSamples(num_rows); + int64_t sample_size = sampler_rt->CalculateNumSamples(num_rows); if (sample_size == -1) { RETURN_IF_NOT_OK(size_getter->DryRun(shared_from_this(), &sample_size)); } diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/album_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/album_node.h index dfbe3b911e5..29f4b5632fc 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/album_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/album_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class AlbumNode : public MappableSourceNode { public: /// \brief Constructor @@ -34,7 +33,7 @@ class AlbumNode : public MappableSourceNode { const std::shared_ptr &cache); /// \brief Destructor - ~AlbumNode() = default; + ~AlbumNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -102,7 +101,6 @@ class AlbumNode : public MappableSourceNode { bool decode_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_ALBUM_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h index 95670470a23..6696edcd700 100755 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/amazon_review_node.h @@ -32,7 +32,7 @@ class AmazonReviewNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor. - ~AmazonReviewNode() = default; + ~AmazonReviewNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/caltech256_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/caltech256_node.h index 4a4506877fc..5275a7199a6 100755 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/caltech256_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/caltech256_node.h @@ -37,7 +37,7 @@ class Caltech256Node : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor. - ~Caltech256Node() = default; + ~Caltech256Node() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/celeba_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/celeba_node.h index 75f139982aa..971f5a76f41 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/celeba_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/celeba_node.h @@ -27,7 +27,6 @@ namespace mindspore { namespace dataset { - class CelebANode : public MappableSourceNode { public: /// \brief Constructor @@ -35,7 +34,7 @@ class CelebANode : public MappableSourceNode { const bool &decode, const std::set &extensions, const std::shared_ptr &cache); /// \brief Destructor - ~CelebANode() = default; + ~CelebANode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -104,7 +103,6 @@ class CelebANode : public MappableSourceNode { std::set extensions_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CELEBA_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cifar100_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cifar100_node.h index a0a8be8fa7e..b92cdf23632 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cifar100_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cifar100_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class Cifar100Node : public MappableSourceNode { public: /// \brief Constructor @@ -33,7 +32,7 @@ class Cifar100Node : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor - ~Cifar100Node() = default; + ~Cifar100Node() override = default; /// \brief Node name getter /// \return Name of the current node @@ -98,7 +97,6 @@ class Cifar100Node : public MappableSourceNode { std::string usage_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CIFAR100_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cifar10_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cifar10_node.h index b14bba17c3f..acaa74c8ae1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cifar10_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cifar10_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class Cifar10Node : public MappableSourceNode { public: /// \brief Constructor @@ -33,7 +32,7 @@ class Cifar10Node : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor - ~Cifar10Node() = default; + ~Cifar10Node() override = default; /// \brief Node name getter /// \return Name of the current node @@ -98,7 +97,6 @@ class Cifar10Node : public MappableSourceNode { std::string usage_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CIFAR10_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.cc index 6a019f1085f..40f990a0272 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.cc @@ -28,14 +28,14 @@ namespace dataset { // Constructor for CityscapesNode CityscapesNode::CityscapesNode(const std::string &dataset_dir, const std::string &usage, const std::string &quality_mode, const std::string &task, bool decode, - std::shared_ptr sampler, std::shared_ptr cache) - : MappableSourceNode(std::move(cache)), + const std::shared_ptr &sampler, const std::shared_ptr &cache) + : MappableSourceNode(cache), dataset_dir_(dataset_dir), usage_(usage), quality_mode_(quality_mode), task_(task), - sampler_(sampler), - decode_(decode) {} + decode_(decode), + sampler_(sampler) {} std::shared_ptr CityscapesNode::Copy() { std::shared_ptr sampler = (sampler_ == nullptr) ? nullptr : sampler_->SamplerCopy(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.h index 586ad659d7c..d2eb4be3e87 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/cityscapes_node.h @@ -25,16 +25,15 @@ namespace mindspore { namespace dataset { - class CityscapesNode : public MappableSourceNode { public: /// \brief Constructor. CityscapesNode(const std::string &dataset_dir, const std::string &usage, const std::string &quality_mode, - const std::string &task, bool decode, std::shared_ptr sampler, - std::shared_ptr cache); + const std::string &task, bool decode, const std::shared_ptr &sampler, + const std::shared_ptr &cache); /// \brief Destructor. - ~CityscapesNode() = default; + ~CityscapesNode() override = default; /// \brief Node name getter. /// \return Name of the current node. @@ -105,7 +104,6 @@ class CityscapesNode : public MappableSourceNode { bool decode_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CITYSCAPES_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/clue_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/clue_node.h index ca83de77cc5..1adb0799bfb 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/clue_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/clue_node.h @@ -26,7 +26,6 @@ namespace mindspore { namespace dataset { - /// \class CLUENode /// \brief A Dataset derived class to represent CLUE dataset class CLUENode : public NonMappableSourceNode { @@ -36,7 +35,7 @@ class CLUENode : public NonMappableSourceNode { ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, std::shared_ptr cache); /// \brief Destructor - ~CLUENode() = default; + ~CLUENode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -145,7 +144,6 @@ class CLUENode : public NonMappableSourceNode { int32_t num_shards_; int32_t shard_id_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CLUE_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/coco_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/coco_node.h index 4bc29360af7..6ed1d0a3a56 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/coco_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/coco_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class CocoNode : public MappableSourceNode { public: /// \brief Constructor @@ -34,7 +33,7 @@ class CocoNode : public MappableSourceNode { const bool &extra_metadata); /// \brief Destructor - ~CocoNode() = default; + ~CocoNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -104,7 +103,6 @@ class CocoNode : public MappableSourceNode { std::shared_ptr sampler_; bool extra_metadata_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_COCO_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/conll2000_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/conll2000_node.h index fe903ded442..fc36d7b3a4f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/conll2000_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/conll2000_node.h @@ -34,7 +34,7 @@ class CoNLL2000Node : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, std::shared_ptr cache); /// \brief Destructor. - ~CoNLL2000Node() = default; + ~CoNLL2000Node() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/csv_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/csv_node.h index 6602f83daf6..9345f739b00 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/csv_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/csv_node.h @@ -32,9 +32,12 @@ enum CsvType : uint8_t { INT = 0, FLOAT, STRING }; class CsvBase { public: CsvBase() = default; + explicit CsvBase(CsvType t) : type(t) {} - virtual ~CsvBase() {} - CsvType type; + + virtual ~CsvBase() = default; + + CsvType type{INT}; }; /// \brief CSV Record that can represent integer, float and string. @@ -42,8 +45,11 @@ template class CsvRecord : public CsvBase { public: CsvRecord() = default; + CsvRecord(CsvType t, T v) : CsvBase(t), value(v) {} - ~CsvRecord() {} + + ~CsvRecord() override = default; + T value; }; @@ -56,7 +62,7 @@ class CSVNode : public NonMappableSourceNode { std::shared_ptr cache); /// \brief Destructor - ~CSVNode() = default; + ~CSVNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -139,7 +145,6 @@ class CSVNode : public NonMappableSourceNode { int32_t num_shards_; int32_t shard_id_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_CSV_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.h index 120ee4588fb..40a7a1454e5 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/dbpedia_node.h @@ -33,7 +33,7 @@ class DBpediaNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, std::shared_ptr cache); /// \brief Destructor. - ~DBpediaNode() = default; + ~DBpediaNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/div2k_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/div2k_node.h index a4d1a094668..cef040e72f8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/div2k_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/div2k_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class DIV2KNode : public MappableSourceNode { public: /// \brief Constructor. @@ -33,7 +32,7 @@ class DIV2KNode : public MappableSourceNode { bool decode, const std::shared_ptr &sampler, std::shared_ptr cache); /// \brief Destructor. - ~DIV2KNode() = default; + ~DIV2KNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/emnist_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/emnist_node.h index 000f82dfcb4..9cf792fe2a2 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/emnist_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/emnist_node.h @@ -37,7 +37,7 @@ class EMnistNode : public MappableSourceNode { std::shared_ptr sampler, std::shared_ptr cache); /// \brief Destructor. - ~EMnistNode() = default; + ~EMnistNode() override = default; /// \brief Node name getter. /// \return Name of the current node. @@ -105,7 +105,6 @@ class EMnistNode : public MappableSourceNode { std::string usage_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_EMNIST_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.h index 8100691000d..987b2ab869d 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/en_wik9_node.h @@ -40,7 +40,7 @@ class EnWik9Node : public NonMappableSourceNode { int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor. - ~EnWik9Node() = default; + ~EnWik9Node() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/fake_image_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/fake_image_node.h index 0a62928d75a..02b5cc219a7 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/fake_image_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/fake_image_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class FakeImageNode : public MappableSourceNode { public: /// \brief Constructor. @@ -33,7 +32,7 @@ class FakeImageNode : public MappableSourceNode { std::shared_ptr sampler, std::shared_ptr cache); /// \brief Destructor. - ~FakeImageNode() = default; + ~FakeImageNode() override = default; /// \brief Node name getter. /// \return Name of the current node. @@ -95,7 +94,6 @@ class FakeImageNode : public MappableSourceNode { int32_t base_seed_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_FAKE_IMAGE_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.h index f2a5d43123e..a6f91f0a303 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/fashion_mnist_node.h @@ -32,7 +32,7 @@ class FashionMnistNode : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor. - ~FashionMnistNode() = default; + ~FashionMnistNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/flickr_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/flickr_node.h index 0f6e298fddb..d09a2ed1448 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/flickr_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/flickr_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class FlickrNode : public MappableSourceNode { public: /// \brief Constructor @@ -33,7 +32,7 @@ class FlickrNode : public MappableSourceNode { std::shared_ptr sampler, std::shared_ptr cache); /// \brief Destructor - ~FlickrNode() = default; + ~FlickrNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -102,7 +101,6 @@ class FlickrNode : public MappableSourceNode { bool decode_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_FLICKR_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/generator_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/generator_node.cc index ade0265bff5..a157baaef85 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/generator_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/generator_node.cc @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - GeneratorNode::GeneratorNode(py::function generator_function, const std::vector &column_names, const std::vector &column_types, int64_t source_len, std::shared_ptr sampler, uint32_t num_parallel_workers) @@ -33,20 +32,20 @@ GeneratorNode::GeneratorNode(py::function generator_function, const std::vector< generator_function_(generator_function), column_names_(column_names), column_types_(column_types), - reset_ancestor_(nullptr), - sampler_(std::move(sampler)), source_len_(source_len), - num_parallel_workers_(num_parallel_workers) {} + sampler_(std::move(sampler)), + num_parallel_workers_(num_parallel_workers), + reset_ancestor_(nullptr) {} GeneratorNode::GeneratorNode(py::function generator_function, const std::shared_ptr &schema, int64_t source_len, std::shared_ptr sampler, uint32_t num_parallel_workers) : MappableSourceNode(), generator_function_(generator_function), schema_(schema), - reset_ancestor_(nullptr), - sampler_(std::move(sampler)), source_len_(source_len), - num_parallel_workers_(num_parallel_workers) {} + sampler_(std::move(sampler)), + num_parallel_workers_(num_parallel_workers), + reset_ancestor_(nullptr) {} std::shared_ptr GeneratorNode::Copy() { std::shared_ptr node; diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/generator_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/generator_node.h index da1e99627e8..ba97484007b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/generator_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/generator_node.h @@ -42,7 +42,7 @@ class GeneratorNode : public MappableSourceNode { std::shared_ptr sampler, uint32_t num_parallel_workers); /// \brief Destructor - ~GeneratorNode() = default; + ~GeneratorNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -123,7 +123,6 @@ class GeneratorNode : public MappableSourceNode { /// \return Status of the node visit Status AcceptAfter(IRNodePass *p, bool *const modified) override; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_GENERATOR_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/image_folder_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/image_folder_node.h index 24e2067516f..972ef9a673b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/image_folder_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/image_folder_node.h @@ -28,7 +28,6 @@ namespace mindspore { namespace dataset { - /// \class ImageFolderNode /// \brief A Dataset derived class to represent ImageFolder dataset class ImageFolderNode : public MappableSourceNode { @@ -39,7 +38,7 @@ class ImageFolderNode : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor - ~ImageFolderNode() = default; + ~ImageFolderNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -110,7 +109,6 @@ class ImageFolderNode : public MappableSourceNode { std::map class_indexing_; std::set exts_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_IMAGE_FOLDER_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/imdb_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/imdb_node.h index f4721471395..1053cf20797 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/imdb_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/imdb_node.h @@ -40,7 +40,7 @@ class IMDBNode : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor - ~IMDBNode() = default; + ~IMDBNode() override = default; /// \brief Node name getter /// \return Name of the current node diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.h index 84082aada9a..c420b6aff7a 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.h @@ -51,7 +51,7 @@ class IWSLT2016Node : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, std::shared_ptr cache); /// \brief Destructor. - ~IWSLT2016Node() = default; + ~IWSLT2016Node() override = default; /// \brief Node name getter. /// \return std::string Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.h index 7e7696a68be..4a7db3b5660 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.h @@ -49,7 +49,7 @@ class IWSLT2017Node : public NonMappableSourceNode { std::shared_ptr cache); /// \brief Destructor. - ~IWSLT2017Node() = default; + ~IWSLT2017Node() override = default; /// \brief Node name getter. /// \return std::string Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/kmnist_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/kmnist_node.h index d25478fea29..d17ba5d1ea3 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/kmnist_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/kmnist_node.h @@ -36,7 +36,7 @@ class KMnistNode : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor. - ~KMnistNode() = default; + ~KMnistNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.h index 4ee06c437bb..920df3bd0c0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/lj_speech_node.h @@ -33,7 +33,7 @@ class LJSpeechNode : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor. - ~LJSpeechNode() = default; + ~LJSpeechNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/manifest_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/manifest_node.h index e4f23deb411..b7202b7443c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/manifest_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/manifest_node.h @@ -26,7 +26,6 @@ namespace mindspore { namespace dataset { - class ManifestNode : public MappableSourceNode { public: /// \brief Constructor @@ -34,7 +33,7 @@ class ManifestNode : public MappableSourceNode { const std::map &class_indexing, bool decode, std::shared_ptr cache); /// \brief Destructor - ~ManifestNode() = default; + ~ManifestNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -104,7 +103,6 @@ class ManifestNode : public MappableSourceNode { std::map class_index_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_MANIFEST_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/minddata_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/minddata_node.h index 127ba5b440d..3e719c3ad03 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/minddata_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/minddata_node.h @@ -27,7 +27,6 @@ namespace mindspore { namespace dataset { - class MindDataNode : public MappableSourceNode { public: /// \brief Constructor @@ -41,7 +40,7 @@ class MindDataNode : public MappableSourceNode { ShuffleMode shuffle_mode = ShuffleMode::kGlobal, std::shared_ptr cache = nullptr); /// \brief Destructor - ~MindDataNode() = default; + ~MindDataNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -120,7 +119,6 @@ class MindDataNode : public MappableSourceNode { std::vector> operators_; ShuffleMode shuffle_mode_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_MINDDATA_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/mnist_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/mnist_node.h index 0e896f03b3f..6a85e3cec7c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/mnist_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/mnist_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class MnistNode : public MappableSourceNode { public: /// \brief Constructor @@ -33,7 +32,7 @@ class MnistNode : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor - ~MnistNode() = default; + ~MnistNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -98,7 +97,6 @@ class MnistNode : public MappableSourceNode { std::string usage_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_MNIST_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h index a1796f52f07..796052e8e78 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/penn_treebank_node.h @@ -34,7 +34,7 @@ class PennTreebankNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor. - ~PennTreebankNode() = default; + ~PennTreebankNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.h index 969230c7034..c65cac4abf5 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/photo_tour_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class PhotoTourNode : public MappableSourceNode { public: /// \brief Constructor. @@ -33,7 +32,7 @@ class PhotoTourNode : public MappableSourceNode { std::shared_ptr sampler, std::shared_ptr cache); /// \brief Destructor. - ~PhotoTourNode() = default; + ~PhotoTourNode() override = default; /// \brief Node name getter. /// \return Name of the current node. @@ -94,7 +93,6 @@ class PhotoTourNode : public MappableSourceNode { std::string usage_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_PHOTO_TOUR_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/places365_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/places365_node.h index 51bf2a75431..0d895ad3a68 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/places365_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/places365_node.h @@ -32,7 +32,7 @@ class Places365Node : public MappableSourceNode { std::shared_ptr sampler, std::shared_ptr cache); /// \brief Destructor. - ~Places365Node() = default; + ~Places365Node() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h index f70fe969dc6..4f64e13c461 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/qmnist_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class QMnistNode : public MappableSourceNode { public: /// \brief Constructor. @@ -33,7 +32,7 @@ class QMnistNode : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor. - ~QMnistNode() = default; + ~QMnistNode() override = default; /// \brief Node name getter. /// \return Name of the current node. @@ -105,7 +104,6 @@ class QMnistNode : public MappableSourceNode { bool compat_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_QMNIST_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.cc index b4d0235e6b0..f00086e9e71 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.cc @@ -23,7 +23,6 @@ namespace mindspore { namespace dataset { - std::shared_ptr RandomNode::Copy() { std::shared_ptr node; if (schema_ != nullptr) { diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.h index f099910e677..978d6f8ef55 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.h @@ -28,7 +28,6 @@ namespace mindspore { namespace dataset { - class RandomNode : public NonMappableSourceNode { public: // Some constants to provide limits to random generation. @@ -37,25 +36,25 @@ class RandomNode : public NonMappableSourceNode { static constexpr int32_t kMaxDimValue = 32; /// \brief Constructor - RandomNode(const int32_t &total_rows, std::shared_ptr schema, const std::vector &columns_list, - std::shared_ptr cache) - : NonMappableSourceNode(std::move(cache)), + RandomNode(int32_t total_rows, const std::shared_ptr &schema, const std::vector &columns_list, + const std::shared_ptr &cache) + : NonMappableSourceNode(cache), total_rows_(total_rows), schema_path_(""), - schema_(std::move(schema)), + schema_(schema), columns_list_(columns_list) {} /// \brief Constructor - RandomNode(const int32_t &total_rows, std::string schema_path, const std::vector &columns_list, - std::shared_ptr cache) - : NonMappableSourceNode(std::move(cache)), + RandomNode(int32_t total_rows, const std::string &schema_path, const std::vector &columns_list, + const std::shared_ptr &cache) + : NonMappableSourceNode(cache), total_rows_(total_rows), schema_path_(schema_path), schema_(nullptr), columns_list_(columns_list) {} /// \brief Destructor - ~RandomNode() = default; + ~RandomNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -137,7 +136,6 @@ class RandomNode : public NonMappableSourceNode { std::mt19937 rand_gen_; std::unique_ptr data_schema_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_RANDOM_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.h index fe3565719ad..fcb47c3c9ec 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/distributed_sampler_ir.h @@ -32,7 +32,6 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; @@ -41,7 +40,7 @@ class DistributedSamplerObj : public SamplerObj { DistributedSamplerObj(int64_t num_shards, int64_t shard_id, bool shuffle, int64_t num_samples, uint32_t seed, int64_t offset, bool even_dist); - ~DistributedSamplerObj(); + ~DistributedSamplerObj() override; Status SamplerBuild(std::shared_ptr *sampler) override; @@ -80,7 +79,6 @@ class DistributedSamplerObj : public SamplerObj { int64_t offset_; bool even_dist_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_DISTRIBUTED_SAMPLER_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/mindrecord_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/mindrecord_sampler_ir.h index e95fdb0ef55..867548949a2 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/mindrecord_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/mindrecord_sampler_ir.h @@ -26,7 +26,6 @@ namespace mindspore { namespace dataset { - #ifndef ENABLE_ANDROID class MindRecordSamplerObj : public SamplerObj { public: @@ -34,7 +33,7 @@ class MindRecordSamplerObj : public SamplerObj { MindRecordSamplerObj() : shard_reader_(nullptr) {} /// \brief Destructor - ~MindRecordSamplerObj() = default; + ~MindRecordSamplerObj() override = default; /// \brief Convert a MindRecordSamplerObj into a runtime MindRecordSamplerRT object /// Note that this function not only creates a runtime sampler object, but also creates a ShardReader, @@ -61,7 +60,6 @@ class MindRecordSamplerObj : public SamplerObj { std::unique_ptr shard_reader_; }; #endif - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_MINDRECORD_SAMPLER_IR_H diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.h index e2a805d37ba..8492b076e3c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/pk_sampler_ir.h @@ -32,7 +32,6 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; @@ -40,7 +39,7 @@ class PKSamplerObj : public SamplerObj { public: PKSamplerObj(int64_t num_val, bool shuffle, int64_t num_samples); - ~PKSamplerObj(); + ~PKSamplerObj() override; Status SamplerBuild(std::shared_ptr *sampler) override; @@ -71,7 +70,6 @@ class PKSamplerObj : public SamplerObj { bool shuffle_; int64_t num_samples_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_PK_SAMPLER_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.h index 8b76f37d811..b0c2a959687 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/prebuilt_sampler_ir.h @@ -31,18 +31,18 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; class PreBuiltSamplerObj : public SamplerObj { public: explicit PreBuiltSamplerObj(std::shared_ptr sampler); + #ifndef ENABLE_ANDROID explicit PreBuiltSamplerObj(std::shared_ptr sampler); #endif - ~PreBuiltSamplerObj(); + ~PreBuiltSamplerObj() override; Status SamplerBuild(std::shared_ptr *const sampler) override; @@ -62,7 +62,6 @@ class PreBuiltSamplerObj : public SamplerObj { std::shared_ptr sp_minddataset_; #endif }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_PREBUILT_SAMPLER_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.h index 1af197a6f2e..a19876c2a99 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/random_sampler_ir.h @@ -32,7 +32,6 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; @@ -40,7 +39,7 @@ class RandomSamplerObj : public SamplerObj { public: RandomSamplerObj(bool replacement, int64_t num_samples, bool reshuffle_each_epoch = true); - ~RandomSamplerObj(); + ~RandomSamplerObj() override; Status SamplerBuild(std::shared_ptr *sampler) override; @@ -71,7 +70,6 @@ class RandomSamplerObj : public SamplerObj { int64_t num_samples_; bool reshuffle_each_epoch_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_RANDOM_SAMPLER_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.h index 81ecedf3949..2c80f598891 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/samplers_ir.h @@ -32,7 +32,6 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; @@ -42,7 +41,7 @@ class SamplerObj { SamplerObj(); /// \brief Destructor - ~SamplerObj(); + virtual ~SamplerObj(); /// \brief Pure virtual function for derived class to implement parameters validation /// \return The Status code of the function. It returns OK status if parameters are valid. @@ -93,7 +92,6 @@ class SamplerObj { std::vector> children_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SAMPLERS_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h index b33957f36f0..b88be53c1f0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/sequential_sampler_ir.h @@ -32,7 +32,6 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; @@ -40,7 +39,7 @@ class SequentialSamplerObj : public SamplerObj { public: SequentialSamplerObj(int64_t start_index, int64_t num_samples); - ~SequentialSamplerObj(); + ~SequentialSamplerObj() override; Status SamplerBuild(std::shared_ptr *sampler) override; @@ -70,7 +69,6 @@ class SequentialSamplerObj : public SamplerObj { int64_t start_index_; int64_t num_samples_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SEQUENTIAL_SAMPLER_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.h index d11e0f04e61..dc6796df2f7 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/subset_random_sampler_ir.h @@ -33,7 +33,6 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; @@ -41,7 +40,7 @@ class SubsetRandomSamplerObj : public SubsetSamplerObj { public: SubsetRandomSamplerObj(std::vector indices, int64_t num_samples); - ~SubsetRandomSamplerObj(); + ~SubsetRandomSamplerObj() override; Status to_json(nlohmann::json *const out_json) override; @@ -59,7 +58,6 @@ class SubsetRandomSamplerObj : public SubsetSamplerObj { private: }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SUBSET_RANDOM_SAMPLER_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h index db55644825f..f259f6ce060 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/subset_sampler_ir.h @@ -32,7 +32,6 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; @@ -40,7 +39,7 @@ class SubsetSamplerObj : public SamplerObj { public: SubsetSamplerObj(std::vector indices, int64_t num_samples); - ~SubsetSamplerObj(); + ~SubsetSamplerObj() override; Status SamplerBuild(std::shared_ptr *sampler) override; @@ -70,7 +69,6 @@ class SubsetSamplerObj : public SamplerObj { const std::vector indices_; int64_t num_samples_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_SUBSET_SAMPLER_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h index 4c966a92ff5..66a4f74faa3 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/samplers/weighted_random_sampler_ir.h @@ -32,7 +32,6 @@ namespace mindspore { namespace dataset { - // Internal Sampler class forward declaration class SamplerRT; @@ -40,7 +39,7 @@ class WeightedRandomSamplerObj : public SamplerObj { public: explicit WeightedRandomSamplerObj(std::vector weights, int64_t num_samples = 0, bool replacement = true); - ~WeightedRandomSamplerObj(); + ~WeightedRandomSamplerObj() override; Status SamplerBuild(std::shared_ptr *sampler) override; @@ -67,7 +66,6 @@ class WeightedRandomSamplerObj : public SamplerObj { int64_t num_samples_; bool replacement_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SAMPLERS_WEIGHTED_RANDOM_SAMPLER_IR_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/sbu_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/sbu_node.h index 76a23fbc709..70ad3110b18 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/sbu_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/sbu_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class SBUNode : public MappableSourceNode { public: /// \brief Constructor. @@ -33,7 +32,7 @@ class SBUNode : public MappableSourceNode { const std::shared_ptr &cache); /// \brief Destructor. - ~SBUNode() = default; + ~SBUNode() override = default; /// \brief Node name getter. /// \return Name of the current node. @@ -91,7 +90,6 @@ class SBUNode : public MappableSourceNode { bool decode_; std::shared_ptr sampler_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_SBU_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/semeion_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/semeion_node.h index 01ee08e8cf9..9911430a81e 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/semeion_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/semeion_node.h @@ -31,7 +31,7 @@ class SemeionNode : public MappableSourceNode { const std::shared_ptr &cache); /// \brief Destructor. - ~SemeionNode() = default; + ~SemeionNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h index c05d024d637..400564096f1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/sogou_news_node.h @@ -47,7 +47,7 @@ class SogouNewsNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor. - ~SogouNewsNode() = default; + ~SogouNewsNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.h index 182989dcae8..f0eecee971b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/speech_commands_node.h @@ -31,7 +31,7 @@ class SpeechCommandsNode : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor. - ~SpeechCommandsNode() = default; + ~SpeechCommandsNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/stl10_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/stl10_node.h index 76fde409d20..4b094e5d923 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/stl10_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/stl10_node.h @@ -32,7 +32,7 @@ class STL10Node : public MappableSourceNode { std::shared_ptr cache); /// \brief Destructor - ~STL10Node() = default; + ~STL10Node() override = default; /// \brief Node name getter /// \return Name of the current node diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/tedlium_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/tedlium_node.h index 8c91d6f68fa..36d4607cff2 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/tedlium_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/tedlium_node.h @@ -32,7 +32,7 @@ class TedliumNode : public MappableSourceNode { const std::shared_ptr &cache); /// \brief Destructor. - ~TedliumNode() = default; + ~TedliumNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/text_file_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/text_file_node.h index 81507dc8441..bafe9ea7a42 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/text_file_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/text_file_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - /// \class TextFileNode /// \brief A Dataset derived class to represent TextFile dataset class TextFileNode : public NonMappableSourceNode { @@ -35,7 +34,7 @@ class TextFileNode : public NonMappableSourceNode { int32_t shard_id, std::shared_ptr cache); /// \brief Destructor - ~TextFileNode() = default; + ~TextFileNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -112,7 +111,6 @@ class TextFileNode : public NonMappableSourceNode { int32_t shard_id_; ShuffleMode shuffle_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_TEXT_FILE_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/tf_record_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/tf_record_node.h index 9c7e301d73f..7cb3cb4148e 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/tf_record_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/tf_record_node.h @@ -26,7 +26,6 @@ namespace mindspore { namespace dataset { - /// \class TFRecordNode /// \brief A Dataset derived class to represent TFRecord dataset class TFRecordNode : public NonMappableSourceNode { @@ -35,10 +34,10 @@ class TFRecordNode : public NonMappableSourceNode { public: /// \brief Constructor /// \note Parameter 'schema' is the path to the schema file - TFRecordNode(const std::vector &dataset_files, std::string schema, + TFRecordNode(const std::vector &dataset_files, const std::string &schema, const std::vector &columns_list, int64_t num_samples, ShuffleMode shuffle, - int32_t num_shards, int32_t shard_id, bool shard_equal_rows, std::shared_ptr cache) - : NonMappableSourceNode(std::move(cache)), + int32_t num_shards, int32_t shard_id, bool shard_equal_rows, const std::shared_ptr &cache) + : NonMappableSourceNode(cache), dataset_files_(dataset_files), schema_path_(schema), columns_list_(columns_list), @@ -56,10 +55,10 @@ class TFRecordNode : public NonMappableSourceNode { /// \brief Constructor /// \note Parameter 'schema' is shared pointer to Schema object - TFRecordNode(const std::vector &dataset_files, std::shared_ptr schema, + TFRecordNode(const std::vector &dataset_files, const std::shared_ptr &schema, const std::vector &columns_list, int64_t num_samples, ShuffleMode shuffle, - int32_t num_shards, int32_t shard_id, bool shard_equal_rows, std::shared_ptr cache) - : NonMappableSourceNode(std::move(cache)), + int32_t num_shards, int32_t shard_id, bool shard_equal_rows, const std::shared_ptr &cache) + : NonMappableSourceNode(cache), dataset_files_(dataset_files), schema_obj_(schema), columns_list_(columns_list), @@ -70,7 +69,7 @@ class TFRecordNode : public NonMappableSourceNode { shard_equal_rows_(shard_equal_rows) {} /// \brief Destructor - ~TFRecordNode() = default; + ~TFRecordNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -171,7 +170,6 @@ class TFRecordNode : public NonMappableSourceNode { int32_t shard_id_; bool shard_equal_rows_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_TF_RECORD_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/udpos_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/udpos_node.h index 9f1123da97b..334310e18c9 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/udpos_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/udpos_node.h @@ -34,7 +34,7 @@ class UDPOSNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, std::shared_ptr cache); /// \brief Destructor. - ~UDPOSNode() = default; + ~UDPOSNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/usps_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/usps_node.h index 8965b18233a..ccb9f20cdc1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/usps_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/usps_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class USPSNode : public NonMappableSourceNode { public: /// \brief Constructor. @@ -33,7 +32,7 @@ class USPSNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, std::shared_ptr cache); /// \brief Destructor. - ~USPSNode() = default; + ~USPSNode() override = default; /// \brief Node name getter. /// \return Name of the current node. @@ -116,7 +115,6 @@ class USPSNode : public NonMappableSourceNode { int32_t num_shards_; int32_t shard_id_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_USPS_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/voc_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/voc_node.h index 0fd0b4e5485..a54f0cc343d 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/voc_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/voc_node.h @@ -26,7 +26,6 @@ namespace mindspore { namespace dataset { - class VOCNode : public MappableSourceNode { public: /// \brief Constructor @@ -35,7 +34,7 @@ class VOCNode : public MappableSourceNode { std::shared_ptr cache, bool extra_metadata = false); /// \brief Destructor - ~VOCNode() = default; + ~VOCNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -114,7 +113,6 @@ class VOCNode : public MappableSourceNode { std::shared_ptr sampler_; bool extra_metadata_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_VOC_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/wider_face_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/wider_face_node.h index 72e77cc37e8..3e9e30c0f28 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/wider_face_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/wider_face_node.h @@ -33,7 +33,7 @@ class WIDERFaceNode : public MappableSourceNode { const std::shared_ptr &sampler, const std::shared_ptr &cache); /// \brief Destructor. - ~WIDERFaceNode() = default; + ~WIDERFaceNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.h index 378f1a90e6c..fc55477bd1b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/wiki_text_node.h @@ -34,7 +34,7 @@ class WikiTextNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor. - ~WikiTextNode() = default; + ~WikiTextNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.h index b25f3a5c218..9ed57ad3d56 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yahoo_answers_node.h @@ -33,7 +33,7 @@ class YahooAnswersNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, std::shared_ptr cache); /// \brief Destructor. - ~YahooAnswersNode() = default; + ~YahooAnswersNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.h index ebd66085fd4..786f9975b7f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yelp_review_node.h @@ -47,7 +47,7 @@ class YelpReviewNode : public NonMappableSourceNode { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor. - ~YelpReviewNode() = default; + ~YelpReviewNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h index 32b5053fc2b..4feab11d555 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/yes_no_node.h @@ -30,7 +30,7 @@ class YesNoNode : public MappableSourceNode { YesNoNode(const std::string &dataset_dir, std::shared_ptr sampler, std::shared_ptr cache); /// \brief Destructor. - ~YesNoNode() = default; + ~YesNoNode() override = default; /// \brief Node name getter. /// \return Name of the current node. diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/sync_wait_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/sync_wait_node.h index 7c68390d670..854dd9bd809 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/sync_wait_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/sync_wait_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - /// \class SyncWaitNode /// \brief A Dataset derived class to represent SyncWaitNode dataset class SyncWaitNode : public DatasetNode { @@ -34,7 +33,7 @@ class SyncWaitNode : public DatasetNode { SyncWaitNode(std::shared_ptr child, const std::string &condition_name, py::function callback); /// \brief Destructor - ~SyncWaitNode() = default; + ~SyncWaitNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -65,7 +64,6 @@ class SyncWaitNode : public DatasetNode { std::string condition_name_; py::function callback_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SYNC_WAIT_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/take_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/take_node.h index c6ff10c41f3..8f50d1ee859 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/take_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/take_node.h @@ -25,14 +25,13 @@ namespace mindspore { namespace dataset { - class TakeNode : public DatasetNode { public: /// \brief Constructor explicit TakeNode(std::shared_ptr child, int32_t count); /// \brief Destructor - ~TakeNode() = default; + ~TakeNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -57,7 +56,7 @@ class TakeNode : public DatasetNode { /// \brief Getter /// \return Number of rows to output - const int32_t Count() const { return take_count_; } + int32_t Count() const { return take_count_; } /// \brief Base-class override for GetDatasetSize /// \param[in] size_getter Shared pointer to DatasetSizeGetter @@ -99,7 +98,6 @@ class TakeNode : public DatasetNode { private: int32_t take_count_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_TAKE_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/transfer_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/transfer_node.h index b5a359e1262..4ac4550c0a8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/transfer_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/transfer_node.h @@ -25,7 +25,6 @@ namespace mindspore { namespace dataset { - class TransferNode : public DatasetNode { public: /// \brief Constructor @@ -33,7 +32,7 @@ class TransferNode : public DatasetNode { bool send_epoch_end, int32_t total_batch, bool create_data_info_queue); /// \brief Destructor - ~TransferNode() = default; + ~TransferNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -99,7 +98,6 @@ class TransferNode : public DatasetNode { int32_t total_batch_; bool create_data_info_queue_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_SOURCE_TRANSFER_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/zip_node.h b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/zip_node.h index 2d614ce00ad..b409ca60e34 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/zip_node.h +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/zip_node.h @@ -25,14 +25,13 @@ namespace mindspore { namespace dataset { - class ZipNode : public DatasetNode { public: /// \brief Constructor explicit ZipNode(const std::vector> &datasets); /// \brief Destructor - ~ZipNode() = default; + ~ZipNode() override = default; /// \brief Node name getter /// \return Name of the current node @@ -85,7 +84,6 @@ class ZipNode : public DatasetNode { private: std::vector> datasets_; }; - } // namespace dataset } // namespace mindspore #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_ZIP_NODE_H_ diff --git a/mindspore/ccsrc/minddata/dataset/engine/jagged_connector.h b/mindspore/ccsrc/minddata/dataset/engine/jagged_connector.h index 1a610b3f177..4f32ab896c2 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/jagged_connector.h +++ b/mindspore/ccsrc/minddata/dataset/engine/jagged_connector.h @@ -59,8 +59,8 @@ class JaggedConnector : public Connector { } for (int offset = 1; offset <= num_producers_; offset++) { - int32_t nextQueueIndex = (pop_from_ + offset) % num_producers_; - if (is_queue_finished_[nextQueueIndex] == false) { + size_t nextQueueIndex = (pop_from_ + offset) % num_producers_; + if (!is_queue_finished_[nextQueueIndex]) { pop_from_ = nextQueueIndex; break; } @@ -74,7 +74,7 @@ class JaggedConnector : public Connector { } void DoReset() { - for (int i = 0; i < is_queue_finished_.size(); i++) { + for (auto i = 0; i < is_queue_finished_.size(); i++) { is_queue_finished_[i] = false; } diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/pass.h index 6a0c2f3641c..7d9341f0f4b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pass.h @@ -125,7 +125,7 @@ class IRNodePass : public IRPass { // Default DFS traversal explicit IRNodePass(Order order = Order::DFS) { traversalOrder_ = order; } - ~IRNodePass() = default; + ~IRNodePass() override = default; /// \brief Run the transformation pass against the IR tree /// \param[in,out] root_ir Pointer to the IR tree to be transformed diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/post/auto_worker_pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/post/auto_worker_pass.h index 683c541507c..681c9902edf 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/post/auto_worker_pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/post/auto_worker_pass.h @@ -43,12 +43,10 @@ class AutoWorkerPass : public IRTreePass { {{"MappableSource", 4}, {"NonMappableSource", 4}, {kBatchNode, 8}, {kMapNode, 8}}, // config7 leaf:batch:map=1:2:2 }; AutoWorkerPass() - : min_num_workers_(1), - max_num_workers_(8), - thread_cnt_(GlobalContext::Instance()->config_manager()->num_cpu_threads()) {} + : min_num_workers_(1), max_num_workers_(8), thread_cnt_(GlobalContext::config_manager()->num_cpu_threads()) {} /// \brief destructor, by doing "= default", compiler will automatically generate the correct destructor - ~AutoWorkerPass() = default; + ~AutoWorkerPass() override = default; Status RunOnTree(std::shared_ptr root_ir, bool *) override; @@ -59,7 +57,7 @@ class AutoWorkerPass : public IRTreePass { : IRNodePass(), weight_sum_(0), weight_profile_(weight_profile) {} /// \brief destructor, by doing "= default", compiler will automatically generate the correct destructor - ~OpWeightPass() = default; + ~OpWeightPass() override = default; // this is the base class function which contains the logic to handle most of the pipeline ops // pipeline ops although can't config num_workers it still runs 1 thread they need to be factored into weight diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.h index 9284cb75910..293a7b8118f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/epoch_ctrl_pass.h @@ -72,7 +72,7 @@ class EpochCtrlPass : public IRTreePass { std::shared_ptr injection_point() { return injection_point_; } /// \brief Getter - int32_t num_epochs() { return num_epochs_; } + int32_t num_epochs() const { return num_epochs_; } private: std::shared_ptr injection_point_; diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/input_validation_pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/input_validation_pass.h index a016906fc05..db6448b42ac 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/input_validation_pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/input_validation_pass.h @@ -27,6 +27,7 @@ namespace dataset { /// \class InputValidationPass /// \brief This is a parse pass that validates input parameters of the IR tree. class InputValidationPass : public IRNodePass { + public: /// \brief Runs a validation pass to check input parameters /// \param[in] node The node being visited /// \param[in, out] *modified indicates whether the node has been visited diff --git a/mindspore/ccsrc/minddata/dataset/engine/perf/connector_size.cc b/mindspore/ccsrc/minddata/dataset/engine/perf/connector_size.cc index abec7986e28..7b0bf15e405 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/perf/connector_size.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/perf/connector_size.cc @@ -31,10 +31,12 @@ using Qrow = std::vector; // Sample action Status ConnectorSize::Sample() { - if (active_ == false) return Status::OK(); + if (!active_) { + return Status::OK(); + } Qrow cur_row; (void)std::transform(tree_->begin(), tree_->end(), std::back_inserter(cur_row), - [](DatasetOp &op) { return op.ConnectorSize(); }); + [](const DatasetOp &op) { return op.ConnectorSize(); }); // Tree Iterator is in PostOrder (leaf first, e.g., 3,2,1) // reverse the order of the vector to get the root first. std::reverse(cur_row.begin(), cur_row.end()); diff --git a/mindspore/ccsrc/minddata/dataset/engine/perf/cyclic_array.h b/mindspore/ccsrc/minddata/dataset/engine/perf/cyclic_array.h index 2d761c052fb..129295302e3 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/perf/cyclic_array.h +++ b/mindspore/ccsrc/minddata/dataset/engine/perf/cyclic_array.h @@ -17,15 +17,15 @@ #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_CYCLIC_ARRAY_H #define MINDSPORE_CCSRC_MINDDATA_DATASET_CYCLIC_ARRAY_H -#include #include #include +#include #include + #include "minddata/dataset/include/dataset/constants.h" namespace mindspore { namespace dataset { - /// \class CyclicArray "include/cyclic_array.h /// \brief This is a container with a contiguous memory layout that pnly keeps N last entries, /// when the number of entries exceeds the capacity @@ -164,11 +164,11 @@ class CyclicArray { /// \brief pushes a value /// \param[in] val value - void push_back(T val) { + void push_back(const T &val) { buf_[tail_] = val; if (size_ >= capacity_) { - (tail_ != capacity_) ? tail_++ : tail_ = 0; - (head_ != capacity_) ? head_++ : head_ = 0; + (tail_ != capacity_) ? tail_++ : (tail_ = 0); + (head_ != capacity_) ? head_++ : (head_ = 0); } else { tail_++; size_++; diff --git a/mindspore/ccsrc/minddata/dataset/engine/perf/perf_data.h b/mindspore/ccsrc/minddata/dataset/engine/perf/perf_data.h index 2a251057236..03af345cc84 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/perf/perf_data.h +++ b/mindspore/ccsrc/minddata/dataset/engine/perf/perf_data.h @@ -50,7 +50,7 @@ class PerfData { // T must be any container working with range based loops template void AddSample(const T &row) { - auto i = 0; + size_t i = 0; for (const auto &e : row) { if (data_.size() > i) { data_[i++].push_back(e); diff --git a/mindspore/ccsrc/minddata/dataset/engine/perf/profiling.h b/mindspore/ccsrc/minddata/dataset/engine/perf/profiling.h index 5cff3cae108..3a3ac0dec56 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/perf/profiling.h +++ b/mindspore/ccsrc/minddata/dataset/engine/perf/profiling.h @@ -44,7 +44,7 @@ const char kCpuSamplerName[] = "Cpu_Sampler"; // Profiling is a class of basic unit of profiling action // This base class encapsulate the serialization output logic -class Profiling : std::enable_shared_from_this { +class Profiling : public std::enable_shared_from_this { public: // Constructor Profiling() : active_(false) {} @@ -82,7 +82,8 @@ class Sampling : public Profiling { public: // Sampling action function. This function will be invoked by performance monitor thread. virtual Status Sample() = 0; - virtual ~Sampling() = default; + + ~Sampling() override = default; }; typedef struct TracingRecord_s { @@ -179,7 +180,7 @@ class ProfilingManager { // @param step_num - The number of steps void RecordEndOfEpoch(uint32_t step_num); - const std::unordered_map> &GetSamplingNodes() { return sampling_nodes_; } + const std::unordered_map> &GetSamplingNodes() const { return sampling_nodes_; } // Launch monitoring thread. Status LaunchMonitor(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/tree_adapter.h b/mindspore/ccsrc/minddata/dataset/engine/tree_adapter.h index e39675d726e..41ddb4abd1f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/tree_adapter.h +++ b/mindspore/ccsrc/minddata/dataset/engine/tree_adapter.h @@ -68,7 +68,7 @@ class TreeAdapter { Status GetNext(TensorRow *); // unique_ptr overloads operator bool(), will return false if it doesn't manage an object - std::weak_ptr GetRoot() { return tree_ ? tree_->root() : nullptr; } + std::weak_ptr GetRoot() const { return tree_ ? tree_->root() : nullptr; } // This function will return the column_name_map once BuildAndPrepare() is called std::unordered_map GetColumnNameMap() const { return column_name_map_; } diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/audio.h b/mindspore/ccsrc/minddata/dataset/include/dataset/audio.h index 6804fd231c4..7fef6abc4ff 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/audio.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/audio.h @@ -40,8 +40,9 @@ class MS_API Angle final : public TensorTransform { public: /// \brief Constructor. Angle(); + /// \brief Destructor. - ~Angle() = default; + ~Angle() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -58,7 +59,7 @@ class MS_API AllpassBiquad final : public TensorTransform { explicit AllpassBiquad(int32_t sample_rate, float central_freq, float Q = 0.707); /// \brief Destructor. - ~AllpassBiquad() = default; + ~AllpassBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -84,7 +85,7 @@ class MS_API AmplitudeToDB final : public TensorTransform { float top_db = 80.0); /// \brief Destructor. - ~AmplitudeToDB() = default; + ~AmplitudeToDB() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -107,7 +108,7 @@ class MS_API BandBiquad final : public TensorTransform { explicit BandBiquad(int32_t sample_rate, float central_freq, float Q = 0.707, bool noise = false); /// \brief Destructor. - ~BandBiquad() = default; + ~BandBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -131,7 +132,7 @@ class MS_API BandpassBiquad final : public TensorTransform { explicit BandpassBiquad(int32_t sample_rate, float central_freq, float Q = 0.707, bool const_skirt_gain = false); /// \brief Destructor. - ~BandpassBiquad() = default; + ~BandpassBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -153,7 +154,7 @@ class MS_API BandrejectBiquad final : public TensorTransform { explicit BandrejectBiquad(int32_t sample_rate, float central_freq, float Q = 0.707); /// \brief Destructor. - ~BandrejectBiquad() = default; + ~BandrejectBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -176,7 +177,7 @@ class MS_API BassBiquad final : public TensorTransform { explicit BassBiquad(int32_t sample_rate, float gain, float central_freq = 100, float Q = 0.707); /// \brief Destructor. - ~BassBiquad() = default; + ~BassBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -201,7 +202,7 @@ class MS_API Biquad final : public TensorTransform { explicit Biquad(float b0, float b1, float b2, float a0, float a1, float a2); /// \brief Destructor. - ~Biquad() = default; + ~Biquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -222,7 +223,7 @@ class MS_API ComplexNorm final : public TensorTransform { explicit ComplexNorm(float power = 1.0); /// \brief Destructor. - ~ComplexNorm() = default; + ~ComplexNorm() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -244,7 +245,7 @@ class MS_API ComputeDeltas final : public TensorTransform { explicit ComputeDeltas(int32_t win_length = 5, BorderType pad_mode = BorderType::kEdge); /// \brief Destructor. - ~ComputeDeltas() = default; + ~ComputeDeltas() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -264,7 +265,7 @@ class MS_API Contrast final : public TensorTransform { explicit Contrast(float enhancement_amount = 75.0); /// \brief Destructor. - ~Contrast() = default; + ~Contrast() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -285,7 +286,7 @@ class MS_API DBToAmplitude final : public TensorTransform { explicit DBToAmplitude(float ref, float power); /// \brief Destructor. - ~DBToAmplitude() = default; + ~DBToAmplitude() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -311,7 +312,7 @@ class MS_API DCShift : public TensorTransform { explicit DCShift(float shift); /// \brief Destructor. - ~DCShift() = default; + ~DCShift() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -336,7 +337,7 @@ class MS_API DeemphBiquad final : public TensorTransform { explicit DeemphBiquad(int32_t sample_rate); /// \brief Destructor. - ~DeemphBiquad() = default; + ~DeemphBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -363,7 +364,7 @@ class MS_API DetectPitchFrequency final : public TensorTransform { int32_t freq_low = 85, int32_t freq_high = 3400); /// \brief Destructor. - ~DetectPitchFrequency() = default; + ~DetectPitchFrequency() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -389,7 +390,7 @@ class MS_API Dither final : public TensorTransform { explicit Dither(DensityFunction density_function = DensityFunction::kTPDF, bool noise_shaping = false); /// \brief Destructor. - ~Dither() = default; + ~Dither() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -412,7 +413,7 @@ class MS_API EqualizerBiquad final : public TensorTransform { EqualizerBiquad(int32_t sample_rate, float center_freq, float gain, float Q = 0.707); /// \brief Destructor. - ~EqualizerBiquad() = default; + ~EqualizerBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -436,7 +437,7 @@ class MS_API Fade final : public TensorTransform { explicit Fade(int32_t fade_in_len = 0, int32_t fade_out_len = 0, FadeShape fade_shape = FadeShape::kLinear); /// \brief Destructor. - ~Fade() = default; + ~Fade() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -468,7 +469,7 @@ class MS_API Flanger final : public TensorTransform { Interpolation interpolation = Interpolation::kLinear); /// \brief Destructor. - ~Flanger() = default; + ~Flanger() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -495,7 +496,7 @@ class MS_API FrequencyMasking final : public TensorTransform { float mask_value = 0.0); /// \brief Destructor. - ~FrequencyMasking() = default; + ~FrequencyMasking() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -515,7 +516,7 @@ class MS_API Gain final : public TensorTransform { explicit Gain(float gain_db = 1.0); /// \brief Destructor. - ~Gain() = default; + ~Gain() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -537,7 +538,7 @@ class MS_API HighpassBiquad final : public TensorTransform { HighpassBiquad(int32_t sample_rate, float cutoff_freq, float Q = 0.707); /// \brief Destructor. - ~HighpassBiquad() = default; + ~HighpassBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -562,7 +563,7 @@ class MS_API LFilter final : public TensorTransform { explicit LFilter(const std::vector &a_coeffs, const std::vector &b_coeffs, bool clamp = true); /// \brief Destructor. - ~LFilter() = default; + ~LFilter() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -584,7 +585,7 @@ class MS_API LowpassBiquad final : public TensorTransform { LowpassBiquad(int32_t sample_rate, float cutoff_freq, float Q = 0.707); /// \brief Destructor. - ~LowpassBiquad() = default; + ~LowpassBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -604,7 +605,7 @@ class MS_API Magphase final : public TensorTransform { explicit Magphase(float power); /// \brief Destructor. - ~Magphase() = default; + ~Magphase() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -625,7 +626,7 @@ class MS_API MuLawDecoding final : public TensorTransform { explicit MuLawDecoding(int32_t quantization_channels = 256); /// \brief Destructor. - ~MuLawDecoding() = default; + ~MuLawDecoding() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -646,7 +647,7 @@ class MS_API MuLawEncoding final : public TensorTransform { explicit MuLawEncoding(int32_t quantization_channels = 256); /// \brief Destructor. - ~MuLawEncoding() = default; + ~MuLawEncoding() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -667,7 +668,7 @@ class MS_API Overdrive final : public TensorTransform { explicit Overdrive(float gain = 20.0f, float color = 20.0f); /// \brief Destructor. - ~Overdrive() = default; + ~Overdrive() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -697,7 +698,7 @@ class MS_API Phaser final : public TensorTransform { float decay = 0.4f, float mod_speed = 0.5f, bool sinusoidal = true); /// \brief Destructor. - ~Phaser() = default; + ~Phaser() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -718,7 +719,7 @@ class MS_API RiaaBiquad final : public TensorTransform { explicit RiaaBiquad(int32_t sample_rate); /// \brief Destructor. - ~RiaaBiquad() = default; + ~RiaaBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -744,7 +745,7 @@ class MS_API SlidingWindowCmn final : public TensorTransform { bool norm_vars = false); /// \brief Destructor. - ~SlidingWindowCmn() = default; + ~SlidingWindowCmn() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -771,7 +772,7 @@ class MS_API SpectralCentroid : public TensorTransform { explicit SpectralCentroid(int32_t sample_rate, int32_t n_fft = 400, int32_t win_length = 0, int32_t hop_length = 0, int32_t pad = 0, WindowType window = WindowType::kHann); - ~SpectralCentroid() = default; + ~SpectralCentroid() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -810,7 +811,7 @@ class MS_API Spectrogram : public TensorTransform { bool center = true, BorderType pad_mode = BorderType::kReflect, bool onesided = true); /// \brief Destructor. - ~Spectrogram() = default; + ~Spectrogram() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -847,7 +848,7 @@ class MS_API TimeMasking final : public TensorTransform { float mask_value = 0.0); /// \brief Destructor. - ~TimeMasking() = default; + ~TimeMasking() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -872,7 +873,7 @@ class MS_API TimeStretch final : public TensorTransform { float fixed_rate = std::numeric_limits::quiet_NaN()); /// \brief Destructor. - ~TimeStretch() = default; + ~TimeStretch() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -895,7 +896,7 @@ class MS_API TrebleBiquad final : public TensorTransform { TrebleBiquad(int32_t sample_rate, float gain, float central_freq = 3000, float Q = 0.707); /// \brief Destructor. - ~TrebleBiquad() = default; + ~TrebleBiquad() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -919,7 +920,7 @@ class MS_API Vol final : public TensorTransform { explicit Vol(float gain, GainType gain_type = GainType::kAmplitude); /// \brief Destructor. - ~Vol() = default; + ~Vol() override = default; protected: /// \brief Function to convert TensorTransform object into a TensorOperation object. @@ -933,5 +934,4 @@ class MS_API Vol final : public TensorTransform { } // namespace audio } // namespace dataset } // namespace mindspore - #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_INCLUDE_DATASET_AUDIO_H_ diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h b/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h index 12821f040c2..4b0c2685d86 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h @@ -296,7 +296,7 @@ constexpr int32_t kCfgDefaultCachePort = 50052; constexpr char kCfgDefaultCacheHost[] = "127.0.0.1"; constexpr int32_t kDftCachePrefetchSize = 20; constexpr int32_t kDftNumConnections = 12; -constexpr int32_t kDftAutoNumWorkers = false; +constexpr bool kDftAutoNumWorkers = false; constexpr char kDftMetaColumnPrefix[] = "_meta-"; constexpr int32_t kDecimal = 10; // used in strtol() to convert a string value according to decimal numeral system constexpr int32_t kMinLegalPort = 1025; diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h b/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h index 73896280120..fcc06727dd7 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/datasets.h @@ -92,7 +92,7 @@ class MS_API Dataset : public std::enable_shared_from_this { Dataset(); /// \brief Destructor - ~Dataset() = default; + virtual ~Dataset() = default; /// \brief Get the dataset size /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting @@ -547,6 +547,7 @@ class MS_API Dataset : public std::enable_shared_from_this { std::shared_ptr Repeat(int32_t count = -1) { return std::make_shared(shared_from_this(), count); } + /// \brief Function to create a Shuffle Dataset. /// \note Randomly shuffles the rows of this dataset. /// \param[in] buffer_size The size of the buffer (must be larger than 1) for shuffling @@ -776,7 +777,7 @@ class MS_API BatchDataset : public Dataset { BatchDataset(const std::shared_ptr &input, int32_t batch_size, bool drop_remainder = false); /// \brief Destructor of BatchDataset. - ~BatchDataset() = default; + ~BatchDataset() override = default; }; /// \class BucketBatchByLengthDataset @@ -817,7 +818,7 @@ class MS_API BucketBatchByLengthDataset : public Dataset { bool pad_to_bucket_boundary = false, bool drop_remainder = false); /// \brief Destructor of BucketBatchByLengthDataset. - ~BucketBatchByLengthDataset() = default; + ~BucketBatchByLengthDataset() override = default; }; /// \class ConcatDataset @@ -830,7 +831,7 @@ class MS_API ConcatDataset : public Dataset { explicit ConcatDataset(const std::vector> &input); /// \brief Destructor of ConcatDataset. - ~ConcatDataset() = default; + ~ConcatDataset() override = default; }; /// \class FilterDataset @@ -846,7 +847,7 @@ class MS_API FilterDataset : public Dataset { const std::vector> &input_columns); /// \brief Destructor of FilterDataset. - ~FilterDataset() = default; + ~FilterDataset() override = default; }; /// \class MapDataset @@ -876,7 +877,7 @@ class MS_API MapDataset : public Dataset { const std::vector> &callbacks); /// \brief Destructor of MapDataset. - ~MapDataset() = default; + ~MapDataset() override = default; }; /// \class ProjectDataset @@ -890,7 +891,7 @@ class MS_API ProjectDataset : public Dataset { ProjectDataset(const std::shared_ptr &input, const std::vector> &columns); /// \brief Destructor of ProjectDataset. - ~ProjectDataset() = default; + ~ProjectDataset() override = default; }; /// \class RenameDataset @@ -906,7 +907,7 @@ class MS_API RenameDataset : public Dataset { const std::vector> &output_columns); /// \brief Destructor of RenameDataset. - ~RenameDataset() = default; + ~RenameDataset() override = default; }; /// \class RepeatDataset @@ -920,7 +921,7 @@ class MS_API RepeatDataset : public Dataset { RepeatDataset(const std::shared_ptr &input, int32_t count); /// \brief Destructor of RepeatDataset. - ~RepeatDataset() = default; + ~RepeatDataset() override = default; }; /// \class ShuffleDataset @@ -934,7 +935,7 @@ class MS_API ShuffleDataset : public Dataset { ShuffleDataset(const std::shared_ptr &input, int32_t buffer_size); /// \brief Destructor of ShuffleDataset. - ~ShuffleDataset() = default; + ~ShuffleDataset() override = default; }; /// \class SkipDataset @@ -948,7 +949,7 @@ class MS_API SkipDataset : public Dataset { SkipDataset(const std::shared_ptr &input, int32_t count); /// \brief Destructor of SkipDataset. - ~SkipDataset() = default; + ~SkipDataset() override = default; }; /// \class TakeDataset @@ -962,7 +963,7 @@ class MS_API TakeDataset : public Dataset { TakeDataset(const std::shared_ptr &input, int32_t count); /// \brief Destructor of TakeDataset. - ~TakeDataset() = default; + ~TakeDataset() override = default; }; /// \class ZipDataset @@ -975,7 +976,7 @@ class MS_API ZipDataset : public Dataset { explicit ZipDataset(const std::vector> &inputs); /// \brief Destructor of ZipDataset. - ~ZipDataset() = default; + ~ZipDataset() override = default; }; /// \brief Function to create a SchemaObj. @@ -1013,7 +1014,7 @@ class MS_API AGNewsDataset : public Dataset { ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of AGNewsDataset. - ~AGNewsDataset() = default; + ~AGNewsDataset() override = default; }; /// \brief Function to create a AGNewsDataset. @@ -1082,7 +1083,7 @@ class MS_API AlbumDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of AlbumDataset. - ~AlbumDataset() = default; + ~AlbumDataset() override = default; }; /// \brief Function to create an AlbumDataset. @@ -1119,6 +1120,7 @@ Album(const std::string &dataset_dir, const std::string &data_schema, const std: return std::make_shared(StringToChar(dataset_dir), StringToChar(data_schema), VectorStringToChar(column_names), decode, sampler, cache); } + /// \brief Function to create an AlbumDataset. /// \note The generated dataset is specified through setting a schema. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1135,6 +1137,7 @@ inline std::shared_ptr MS_API Album(const std::string &dataset_dir return std::make_shared(StringToChar(dataset_dir), StringToChar(data_schema), VectorStringToChar(column_names), decode, sampler, cache); } + /// \brief Function to create an AlbumDataset. /// \note The generated dataset is specified through setting a schema. /// \param[in] dataset_dir Path to the root directory that contains the dataset. @@ -1174,7 +1177,7 @@ class MS_API AmazonReviewDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of AmazonReviewDataset. - ~AmazonReviewDataset() = default; + ~AmazonReviewDataset() override = default; }; /// \brief Function to create a AmazonReviewDataset. @@ -1247,7 +1250,7 @@ class MS_API Caltech256Dataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of Caltech256Dataset. - ~Caltech256Dataset() = default; + ~Caltech256Dataset() override = default; }; /// \brief Function to create a Caltech256Dataset. @@ -1343,7 +1346,7 @@ class MS_API CelebADataset : public Dataset { const std::set> &extensions, const std::shared_ptr &cache); /// \brief Destructor of CelebADataset. - ~CelebADataset() = default; + ~CelebADataset() override = default; }; /// \brief Function to create a CelebADataset. @@ -1445,7 +1448,7 @@ class MS_API Cifar10Dataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of Cifar10Dataset. - ~Cifar10Dataset() = default; + ~Cifar10Dataset() override = default; }; /// \brief Function to create a Cifar10 Dataset. @@ -1533,7 +1536,7 @@ class MS_API Cifar100Dataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of Cifar100Dataset. - ~Cifar100Dataset() = default; + ~Cifar100Dataset() override = default; }; /// \brief Function to create a Cifar100 Dataset. @@ -1642,7 +1645,7 @@ class MS_API CityscapesDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of CityscapesDataset. - ~CityscapesDataset() = default; + ~CityscapesDataset() override = default; }; /// \brief Function to create a CityscapesDataset. @@ -1748,7 +1751,7 @@ class MS_API CLUEDataset : public Dataset { int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of CLUEDataset. - ~CLUEDataset() = default; + ~CLUEDataset() override = default; }; /// \brief Function to create a CLUEDataset. @@ -1833,7 +1836,7 @@ class MS_API CocoDataset : public Dataset { const std::shared_ptr &cache, const bool &extra_metadata); /// \brief Constructor of CocoDataset. - ~CocoDataset() = default; + ~CocoDataset() override = default; }; /// \brief Function to create a CocoDataset. @@ -1950,7 +1953,7 @@ class MS_API CoNLL2000Dataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of CoNLL2000Dataset. - ~CoNLL2000Dataset() = default; + ~CoNLL2000Dataset() override = default; }; /// \brief Function to create a CoNLL2000Dataset. @@ -2021,7 +2024,7 @@ class MS_API CSVDataset : public Dataset { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of CSVDataset. - ~CSVDataset() = default; + ~CSVDataset() override = default; }; /// \brief Function to create a CSVDataset. @@ -2092,7 +2095,7 @@ class MS_API DBpediaDataset : public Dataset { ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of DBpediaDataset. - ~DBpediaDataset() = default; + ~DBpediaDataset() override = default; }; /// \brief Function to create a DBpediaDataset. @@ -2164,7 +2167,7 @@ class MS_API DIV2KDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of DIV2KDataset. - ~DIV2KDataset() = default; + ~DIV2KDataset() override = default; }; /// \brief Function to create a DIV2KDataset. @@ -2275,7 +2278,7 @@ class MS_API EMnistDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of EMnistDataset. - ~EMnistDataset() = default; + ~EMnistDataset() override = default; }; /// \brief Function to create a EMnistDataset. @@ -2360,7 +2363,7 @@ class MS_API EnWik9Dataset : public Dataset { int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of EnWik9Dataset. - ~EnWik9Dataset() = default; + ~EnWik9Dataset() override = default; }; /// \brief Function to create a EnWik9Dataset. @@ -2421,7 +2424,7 @@ class MS_API FakeImageDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of FakeImageDataset. - ~FakeImageDataset() = default; + ~FakeImageDataset() override = default; }; /// \brief Function to create a FakeImageDataset. @@ -2504,7 +2507,7 @@ class MS_API FashionMnistDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of FashionMnistDataset. - ~FashionMnistDataset() = default; + ~FashionMnistDataset() override = default; }; /// \brief Function to create a FashionMnistDataset. @@ -2582,7 +2585,7 @@ class MS_API FlickrDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of FlickrDataset. - ~FlickrDataset() = default; + ~FlickrDataset() override = default; }; /// \brief Function to create a FlickrDataset @@ -2689,7 +2692,7 @@ class MS_API ImageFolderDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of ImageFolderDataset. - ~ImageFolderDataset() = default; + ~ImageFolderDataset() override = default; }; /// \brief Function to create an ImageFolderDataset. @@ -2796,7 +2799,7 @@ class MS_API IMDBDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of IMDBDataset. - ~IMDBDataset() = default; + ~IMDBDataset() override = default; }; /// \brief A source dataset for reading and parsing IMDB dataset. @@ -2882,7 +2885,7 @@ class MS_API IWSLT2016Dataset : public Dataset { int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of IWSLT2016Dataset. - ~IWSLT2016Dataset() = default; + ~IWSLT2016Dataset() override = default; }; /// \brief Function to create a IWSLT2016Dataset. @@ -2939,7 +2942,7 @@ class MS_API IWSLT2017Dataset : public Dataset { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of IWSLT2017Dataset. - ~IWSLT2017Dataset() = default; + ~IWSLT2017Dataset() override = default; }; /// \brief Function to create a IWSLT2017Dataset. @@ -3004,7 +3007,7 @@ class MS_API KMnistDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of KMnistDataset. - ~KMnistDataset() = default; + ~KMnistDataset() override = default; }; /// \brief Function to create a KMnistDataset. @@ -3075,7 +3078,7 @@ class MS_API LJSpeechDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of LJSpeechDataset. - ~LJSpeechDataset() = default; + ~LJSpeechDataset() override = default; }; /// \brief Function to create a LJSpeech Dataset. @@ -3160,7 +3163,7 @@ class MS_API ManifestDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of ManifestDataset. - ~ManifestDataset() = default; + ~ManifestDataset() override = default; }; /// \brief Function to create a ManifestDataset. @@ -3361,7 +3364,7 @@ class MS_API MindDataDataset : public Dataset { const std::shared_ptr &cache = nullptr); /// \brief Destructor of MindDataDataset. - ~MindDataDataset() = default; + ~MindDataDataset() override = default; }; /// \brief Function to create a MindDataDataset. @@ -3578,7 +3581,7 @@ class MS_API MnistDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of MnistDataset. - ~MnistDataset() = default; + ~MnistDataset() override = default; }; /// \brief Function to create a MnistDataset. @@ -3658,7 +3661,7 @@ class MS_API PennTreebankDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of PennTreebankDataset. - ~PennTreebankDataset() = default; + ~PennTreebankDataset() override = default; }; /// \brief Function to create a PennTreebank Dataset. @@ -3724,7 +3727,7 @@ class MS_API PhotoTourDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of PhotoTourDataset. - ~PhotoTourDataset() = default; + ~PhotoTourDataset() override = default; }; /// \brief Function to create a PhotoTourDataset. @@ -3818,7 +3821,7 @@ class MS_API Places365Dataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of Places365Dataset. - ~Places365Dataset() = default; + ~Places365Dataset() override = default; }; /// \brief Function to create a Places365Dataset. @@ -3910,7 +3913,7 @@ class MS_API QMnistDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of QMnistDataset. - ~QMnistDataset() = default; + ~QMnistDataset() override = default; }; /// \brief Function to create a QMnistDataset. @@ -4003,7 +4006,7 @@ class MS_API RandomDataDataset : public Dataset { const std::vector> &columns_list, const std::shared_ptr &cache); /// \brief Destructor of RandomDataDataset. - ~RandomDataDataset() = default; + ~RandomDataDataset() override = default; }; /// \brief Function to create a RandomDataset. @@ -4073,7 +4076,7 @@ class MS_API SBUDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of SBUDataset. - ~SBUDataset() = default; + ~SBUDataset() override = default; }; /// \brief Function to create a SBUDataset. @@ -4156,7 +4159,7 @@ class MS_API SemeionDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of SemeionDataset. - ~SemeionDataset() = default; + ~SemeionDataset() override = default; }; /// \brief Function to create a Semeion Dataset. @@ -4231,7 +4234,7 @@ class MS_API SogouNewsDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of SogouNewsDataset. - ~SogouNewsDataset() = default; + ~SogouNewsDataset() override = default; }; /// \brief Function to create a SogouNewsDataset. @@ -4289,7 +4292,7 @@ class MS_API SpeechCommandsDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of SpeechCommandsDataset. - ~SpeechCommandsDataset() = default; + ~SpeechCommandsDataset() override = default; }; /// \brief Function to create a SpeechCommands Dataset. @@ -4366,7 +4369,7 @@ class MS_API STL10Dataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of STL10Dataset. - ~STL10Dataset() = default; + ~STL10Dataset() override = default; }; /// \brief Function to create a STL10 Dataset. @@ -4452,7 +4455,7 @@ class MS_API TedliumDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of TedliumDataset. - ~TedliumDataset() = default; + ~TedliumDataset() override = default; }; /// \brief Function to create a TedliumDataset. @@ -4535,7 +4538,7 @@ class MS_API TextFileDataset : public Dataset { int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of TextFileDataset. - ~TextFileDataset() = default; + ~TextFileDataset() override = default; }; /// \brief Function to create a TextFileDataset. @@ -4635,7 +4638,7 @@ class MS_API TFRecordDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of TFRecordDataset. - ~TFRecordDataset() = default; + ~TFRecordDataset() override = default; }; /// \brief Function to create a TFRecordDataset. @@ -4693,7 +4696,7 @@ std::shared_ptr MS_API TFRecord(const std::vector } else { std::string schema_path = schema; if (!schema_path.empty()) { - struct stat sb; + struct stat sb {}; int rc = stat(schema_path.c_str(), &sb); if (rc != 0) { return nullptr; @@ -4727,7 +4730,7 @@ class MS_API UDPOSDataset : public Dataset { ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of UDPOSDataset. - ~UDPOSDataset() = default; + ~UDPOSDataset() override = default; }; /// \brief Function to create a UDPOSDataset. @@ -4789,7 +4792,7 @@ class MS_API USPSDataset : public Dataset { ShuffleMode shuffle, int32_t num_shards, int32_t shard_id, const std::shared_ptr &cache); /// \brief Destructor of USPSDataset. - ~USPSDataset() = default; + ~USPSDataset() override = default; }; /// \brief Function to create a USPSDataset. @@ -4876,7 +4879,7 @@ class MS_API VOCDataset : public Dataset { bool extra_metadata); /// \brief Destructor of VOCDataset. - ~VOCDataset() = default; + ~VOCDataset() override = default; }; /// \brief Function to create a VOCDataset. @@ -5002,7 +5005,7 @@ class MS_API WIDERFaceDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of WIDERFaceDataset. - ~WIDERFaceDataset() = default; + ~WIDERFaceDataset() override = default; }; /// \brief Function to create a WIDERFace Dataset. @@ -5096,7 +5099,7 @@ class MS_API WikiTextDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of WikiTextDataset. - ~WikiTextDataset() = default; + ~WikiTextDataset() override = default; }; /// \brief Function to create a WikiText Dataset. @@ -5160,7 +5163,7 @@ class MS_API YahooAnswersDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of YahooAnswers. - ~YahooAnswersDataset() = default; + ~YahooAnswersDataset() override = default; }; /// \brief Function to create a YahooAnswersDataset. @@ -5224,7 +5227,7 @@ class MS_API YelpReviewDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of YelpReviewDataset. - ~YelpReviewDataset() = default; + ~YelpReviewDataset() override = default; }; /// \brief Function to create a YelpReviewDataset. @@ -5280,7 +5283,7 @@ class MS_API YesNoDataset : public Dataset { const std::shared_ptr &cache); /// \brief Destructor of YesNoDataset. - ~YesNoDataset() = default; + ~YesNoDataset() override = default; }; /// \brief Function to create a YesNo Dataset. @@ -5359,7 +5362,7 @@ std::shared_ptr MS_API CreateDatasetCacheCharIF( /// std::shared_ptr iter = ds->CreateIterator(); /// \endcode inline std::shared_ptr MS_API CreateDatasetCache( - session_id_type id, uint64_t mem_sz, bool spill, std::optional hostname = std::nullopt, + 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) { std::optional> hostname_c = std::nullopt; diff --git a/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h b/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h index 7130e49b510..0eed5eddb67 100644 --- a/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h +++ b/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h @@ -62,7 +62,7 @@ class MS_API TensorTransform : public std::enable_shared_from_this { Dataset(); /// \brief Destructor - ~Dataset() = default; + virtual ~Dataset() = default; /// \brief Gets the dataset size /// \param[in] estimate This is only supported by some of the ops and it's used to speed up the process of getting @@ -493,7 +493,7 @@ class MS_API BatchDataset : public Dataset { public: BatchDataset(const std::shared_ptr &input, int32_t batch_size, bool drop_remainder = false); - ~BatchDataset() = default; + ~BatchDataset() override = default; }; class MS_API MapDataset : public Dataset { @@ -503,21 +503,21 @@ class MS_API MapDataset : public Dataset { const std::vector> &project_columns, const std::shared_ptr &cache, const std::vector> &callbacks); - ~MapDataset() = default; + ~MapDataset() override = default; }; class MS_API ProjectDataset : public Dataset { public: ProjectDataset(const std::shared_ptr &input, const std::vector> &columns); - ~ProjectDataset() = default; + ~ProjectDataset() override = default; }; class MS_API ShuffleDataset : public Dataset { public: ShuffleDataset(const std::shared_ptr &input, int32_t buffer_size); - ~ShuffleDataset() = default; + ~ShuffleDataset() override = default; }; /// \brief Function to create a SchemaObj. @@ -572,7 +572,7 @@ class MS_API AlbumDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// \brief Destructor of AlbumDataset. - ~AlbumDataset() = default; + ~AlbumDataset() override = default; }; /// \brief Function to create an AlbumDataset @@ -609,6 +609,7 @@ Album(const std::string &dataset_dir, const std::string &data_schema, const std: return std::make_shared(StringToChar(dataset_dir), StringToChar(data_schema), VectorStringToChar(column_names), decode, sampler, cache); } + /// \brief Function to create an AlbumDataset /// \notes The generated dataset is specified through setting a schema /// \param[in] dataset_dir Path to the root directory that contains the dataset @@ -625,6 +626,7 @@ inline std::shared_ptr MS_API Album(const std::string &dataset_dir return std::make_shared(StringToChar(dataset_dir), StringToChar(data_schema), VectorStringToChar(column_names), decode, sampler, cache); } + /// \brief Function to create an AlbumDataset /// \notes The generated dataset is specified through setting a schema /// \param[in] dataset_dir Path to the root directory that contains the dataset @@ -670,7 +672,7 @@ class MS_API MnistDataset : public Dataset { const std::reference_wrapper &sampler, const std::shared_ptr &cache); /// Destructor of MnistDataset. - ~MnistDataset() = default; + ~MnistDataset() override = default; }; /// \brief Function to create a MnistDataset