diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.cc index 967287d312f..43bb3a9386a 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.cc @@ -89,6 +89,14 @@ Status CacheLookupOp::HandshakeRandomAccessOp(const RandomAccessOp *op) { } Status CacheLookupOp::InitSampler() { return SamplerRT::InitSampler(); } void CacheLookupOp::Print(std::ostream &out, bool show_all) const { CacheBase::Print(out, show_all); } +void CacheLookupOp::SamplerPrint(std::ostream &out, bool show_all) const { + out << "\nSampler: CacheLookupOp"; + if (show_all) { + // Call the super class for displaying any common detailed info + SamplerRT::SamplerPrint(out, show_all); + // Then add our own info if any + } +} Status CacheLookupOp::GetNextSample(std::unique_ptr *out_buffer) { std::vector cache_miss; RETURN_IF_NOT_OK(keys_miss_->Pop(0, &cache_miss)); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h index fdf9b530ef8..de7967c51b2 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h @@ -99,6 +99,7 @@ class CacheLookupOp : public CacheBase, public SamplerRT { Status InitSampler() override; Status GetNextSample(std::unique_ptr *out_buffer) override; void Print(std::ostream &out, bool show_all) const override; + void SamplerPrint(std::ostream &out, bool show_all) const override; bool AllowCacheMiss() override { return true; } std::string Name() const override { return kCacheLookupOp; } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc index 99ff0f3fd34..ba6f210b4fc 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc @@ -252,7 +252,7 @@ void DatasetOp::Print(std::ostream &out, bool show_all) const { << "\nNumber repeats per epoch : " << op_num_repeats_per_epoch_; if (sampler_) { out << "\nSampler:\n"; - sampler_->Print(out, show_all); + sampler_->SamplerPrint(out, show_all); } } } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.cc index 4a646aa0699..f34e36e0867 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.cc @@ -170,10 +170,10 @@ int64_t DistributedSamplerRT::CalculateNumSamples(int64_t num_rows) { return std::ceil(num_samples * 1.0 / num_devices_); } -void DistributedSamplerRT::Print(std::ostream &out, bool show_all) const { +void DistributedSamplerRT::SamplerPrint(std::ostream &out, bool show_all) const { out << "\nSampler: DistributedSampler"; if (show_all) { - SamplerRT::Print(out, show_all); + SamplerRT::SamplerPrint(out, show_all); out << "\nseed: " << seed_ << "\ndevice_id: " << device_id_ << "\nnum_devices: " << num_devices_ << "\nshuffle: " << shuffle_; } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h index 288b7eeb553..20a14edfe19 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/distributed_sampler.h @@ -65,7 +65,7 @@ class DistributedSamplerRT : public SamplerRT { int64_t CalculateNumSamples(int64_t num_rows) override; - void Print(std::ostream &out, bool show_all) const override; + void SamplerPrint(std::ostream &out, bool show_all) const override; private: int64_t cnt_; // number of samples that have already been filled in to buffer diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.cc index 9728b3ccdac..046f19de1bc 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.cc @@ -116,11 +116,11 @@ Status PKSamplerRT::HandshakeRandomAccessOp(const RandomAccessOp *op) { return Status::OK(); } -void PKSamplerRT::Print(std::ostream &out, bool show_all) const { +void PKSamplerRT::SamplerPrint(std::ostream &out, bool show_all) const { out << "\nSampler: PKSampler"; if (show_all) { // Call the super class for displaying any common detailed info - SamplerRT::Print(out, show_all); + SamplerRT::SamplerPrint(out, show_all); // Then add our own info if any } } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.h index 33e3172ff56..f3fde59ab79 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/pk_sampler.h @@ -59,7 +59,7 @@ class PKSamplerRT : public SamplerRT { // NOT YET FINISHED // Printer for debugging purposes. // @param out - output stream to write to // @param show_all - bool to show detailed vs summary - void Print(std::ostream &out, bool show_all) const override; + void SamplerPrint(std::ostream &out, bool show_all) const override; private: bool shuffle_; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/python_sampler.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/python_sampler.cc index cb2f8fb7d5e..7637c840921 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/python_sampler.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/python_sampler.cc @@ -106,11 +106,11 @@ Status PythonSamplerRT::ResetSampler() { return Status::OK(); } -void PythonSamplerRT::Print(std::ostream &out, bool show_all) const { +void PythonSamplerRT::SamplerPrint(std::ostream &out, bool show_all) const { out << "\nSampler: PythonSampler"; if (show_all) { // Call the super class for displaying any common detailed info - SamplerRT::Print(out, show_all); + SamplerRT::SamplerPrint(out, show_all); // Then add our own info if any } } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/python_sampler.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/python_sampler.h index 1bf6c7979a9..8d4018e3191 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/python_sampler.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/python_sampler.h @@ -53,7 +53,7 @@ class PythonSamplerRT : public SamplerRT { // Printer for debugging purposes. // @param out - output stream to write to // @param show_all - bool to show detailed vs summary - void Print(std::ostream &out, bool show_all) const override; + void SamplerPrint(std::ostream &out, bool show_all) const override; private: bool need_to_reset_; // Whether Reset() should be called before calling GetNextBuffer() diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/random_sampler.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/random_sampler.cc index 07b503ff7aa..a525a3f9071 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/random_sampler.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/random_sampler.cc @@ -115,11 +115,11 @@ Status RandomSamplerRT::ResetSampler() { return Status::OK(); } -void RandomSamplerRT::Print(std::ostream &out, bool show_all) const { +void RandomSamplerRT::SamplerPrint(std::ostream &out, bool show_all) const { out << "\nSampler: RandomSampler"; if (show_all) { // Call the super class for displaying any common detailed info - SamplerRT::Print(out, show_all); + SamplerRT::SamplerPrint(out, show_all); // Then add our own info if any } } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h index 80cbd24e5c9..e7e3b531363 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/random_sampler.h @@ -50,7 +50,7 @@ class RandomSamplerRT : public SamplerRT { // @return - The error code return Status ResetSampler() override; - void Print(std::ostream &out, bool show_all) const override; + void SamplerPrint(std::ostream &out, bool show_all) const override; private: uint32_t seed_; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sampler.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sampler.cc index a15adc999fc..06accbd5cca 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sampler.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sampler.cc @@ -78,7 +78,7 @@ Status SamplerRT::CreateSamplerTensor(std::shared_ptr *sample_ids, int64 return Status::OK(); } -void SamplerRT::Print(std::ostream &out, bool show_all) const { +void SamplerRT::SamplerPrint(std::ostream &out, bool show_all) const { // Sampler printing is usually only called in the show_all mode. // Derived classes will display the name, then call back to this base // for common info. diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sampler.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sampler.h index ea12d97f50a..3ac155a86c1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sampler.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sampler.h @@ -126,7 +126,7 @@ class SamplerRT { // A print method typically used for debugging // @param out - The output stream to write output to // @param show_all - A bool to control if you want to show all info or just a summary - virtual void Print(std::ostream &out, bool show_all) const; + virtual void SamplerPrint(std::ostream &out, bool show_all) const; // << Stream output operator overload // @notes This allows you to write the debug print info using stream operators @@ -134,7 +134,7 @@ class SamplerRT { // @param sampler - reference to teh sampler to print // @return - the output stream must be returned friend std::ostream &operator<<(std::ostream &out, const SamplerRT &sampler) { - sampler.Print(out, false); + sampler.SamplerPrint(out, false); return out; } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.cc index 36e8680d676..2752a36412e 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.cc @@ -97,11 +97,11 @@ Status SequentialSamplerRT::ResetSampler() { return Status::OK(); } -void SequentialSamplerRT::Print(std::ostream &out, bool show_all) const { +void SequentialSamplerRT::SamplerPrint(std::ostream &out, bool show_all) const { out << "\nSampler: SequentialSampler"; if (show_all) { // Call the super class for displaying any common detailed info - SamplerRT::Print(out, show_all); + SamplerRT::SamplerPrint(out, show_all); // Then add our own info out << "\nStart index: " << start_index_; } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h index 13a2ede3372..128a4f2602f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h @@ -52,7 +52,7 @@ class SequentialSamplerRT : public SamplerRT { // Printer for debugging purposes. // @param out - output stream to write to // @param show_all - bool to show detailed vs summary - void Print(std::ostream &out, bool show_all) const override; + void SamplerPrint(std::ostream &out, bool show_all) const override; private: int64_t current_id_; // The id sequencer. Each new id increments from this diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.cc index 011a36041ba..d8b15d4426f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.cc @@ -119,11 +119,11 @@ Status SubsetRandomSamplerRT::GetNextSample(std::unique_ptr *out_buf return Status::OK(); } -void SubsetRandomSamplerRT::Print(std::ostream &out, bool show_all) const { +void SubsetRandomSamplerRT::SamplerPrint(std::ostream &out, bool show_all) const { out << "\nSampler: SubsetRandomSampler"; if (show_all) { // Call the super class for displaying any common detailed info - SamplerRT::Print(out, show_all); + SamplerRT::SamplerPrint(out, show_all); // Then add our own info if any } } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.h index 608fdc69d23..f794c78e80c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/subset_random_sampler.h @@ -54,7 +54,7 @@ class SubsetRandomSamplerRT : public SamplerRT { // Printer for debugging purposes. // @param out - output stream to write to // @param show_all - bool to show detailed vs summary - void Print(std::ostream &out, bool show_all) const override; + void SamplerPrint(std::ostream &out, bool show_all) const override; private: // A list of indices (already randomized in constructor). diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc index 6d7c0db89ff..2e9da033921 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.cc @@ -181,11 +181,11 @@ Status WeightedRandomSamplerRT::GetNextSample(std::unique_ptr *out_b return Status::OK(); } -void WeightedRandomSamplerRT::Print(std::ostream &out, bool show_all) const { +void WeightedRandomSamplerRT::SamplerPrint(std::ostream &out, bool show_all) const { out << "\nSampler: WeightedRandomSampler"; if (show_all) { // Call the super class for displaying any common detailed info - SamplerRT::Print(out, show_all); + SamplerRT::SamplerPrint(out, show_all); // Then add our own info if any } } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.h index 134f288914d..5a687d8c1d0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sampler/weighted_random_sampler.h @@ -56,7 +56,7 @@ class WeightedRandomSamplerRT : public SamplerRT { // Printer for debugging purposes. // @param out - output stream to write to // @param show_all - bool to show detailed vs summary - void Print(std::ostream &out, bool show_all) const override; + void SamplerPrint(std::ostream &out, bool show_all) const override; private: // A list of weights for each sample.