From a306264030965e791e998f10a043a0a712145e48 Mon Sep 17 00:00:00 2001 From: nhussain Date: Fri, 24 Jul 2020 14:58:12 -0400 Subject: [PATCH] remove print calls --- .../dataset/engine/datasetops/barrier_op.h | 4 +++ .../dataset/engine/datasetops/batch_op.cc | 2 +- .../dataset/engine/datasetops/batch_op.h | 2 +- .../datasetops/bucket_batch_by_length_op.cc | 2 -- .../datasetops/bucket_batch_by_length_op.h | 5 +--- .../build_sentence_piece_vocab_op.h | 2 ++ .../engine/datasetops/build_vocab_op.cc | 2 +- .../engine/datasetops/build_vocab_op.h | 1 + .../dataset/engine/datasetops/cache_base_op.h | 3 +++ .../engine/datasetops/cache_lookup_op.h | 2 +- .../engine/datasetops/cache_merge_op.cc | 2 +- .../engine/datasetops/cache_merge_op.h | 2 ++ .../dataset/engine/datasetops/cache_op.h | 2 +- .../dataset/engine/datasetops/concat_op.cc | 2 +- .../dataset/engine/datasetops/concat_op.h | 2 +- .../dataset/engine/datasetops/dataset_op.cc | 2 ++ .../dataset/engine/datasetops/dataset_op.h | 27 ++++++++++++++++++- .../engine/datasetops/device_queue_op.cc | 2 +- .../engine/datasetops/device_queue_op.h | 2 +- .../engine/datasetops/epoch_ctrl_op.cc | 2 +- .../dataset/engine/datasetops/epoch_ctrl_op.h | 1 + .../dataset/engine/datasetops/filter_op.cc | 2 +- .../dataset/engine/datasetops/filter_op.h | 2 +- .../dataset/engine/datasetops/map_op.cc | 2 +- .../dataset/engine/datasetops/map_op.h | 2 +- .../dataset/engine/datasetops/parallel_op.h | 2 ++ .../dataset/engine/datasetops/pipeline_op.h | 2 ++ .../dataset/engine/datasetops/project_op.cc | 2 +- .../dataset/engine/datasetops/project_op.h | 2 +- .../dataset/engine/datasetops/rename_op.cc | 2 +- .../dataset/engine/datasetops/rename_op.h | 2 +- .../dataset/engine/datasetops/repeat_op.cc | 2 +- .../dataset/engine/datasetops/repeat_op.h | 2 +- .../dataset/engine/datasetops/shuffle_op.cc | 2 +- .../dataset/engine/datasetops/shuffle_op.h | 2 +- .../dataset/engine/datasetops/skip_op.cc | 2 +- .../dataset/engine/datasetops/skip_op.h | 2 +- .../dataset/engine/datasetops/take_op.cc | 2 +- .../dataset/engine/datasetops/take_op.h | 2 +- .../dataset/engine/datasetops/zip_op.cc | 2 +- .../dataset/engine/datasetops/zip_op.h | 2 +- .../dataset/kernels/data/concatenate_op.h | 1 - .../dataset/kernels/data/duplicate_op.h | 2 -- .../minddata/dataset/kernels/data/fill_op.h | 1 - .../minddata/dataset/kernels/data/mask_op.h | 2 -- .../dataset/kernels/data/one_hot_op.h | 2 -- .../dataset/kernels/data/pad_end_op.h | 2 -- .../minddata/dataset/kernels/data/slice_op.h | 2 -- .../dataset/kernels/data/to_float16_op.h | 2 -- .../dataset/kernels/data/type_cast_op.h | 1 - .../dataset/kernels/image/auto_contrast_op.h | 2 -- .../kernels/image/bounding_box_augment_op.h | 2 -- .../dataset/kernels/image/decode_op.h | 1 - .../dataset/kernels/image/equalize_op.h | 3 --- .../dataset/kernels/image/hwc_to_chw_op.h | 2 -- .../dataset/kernels/image/invert_op.h | 3 --- .../minddata/dataset/kernels/image/pad_op.h | 2 -- .../kernels/image/random_color_adjust_op.h | 4 --- .../image/random_crop_decode_resize_op.h | 3 +-- .../dataset/kernels/image/random_crop_op.h | 2 +- .../kernels/image/random_crop_with_bbox_op.h | 2 +- .../kernels/image/random_horizontal_flip_op.h | 2 -- .../random_horizontal_flip_with_bbox_op.h | 2 -- .../dataset/kernels/image/random_resize_op.h | 4 +-- .../image/random_resize_with_bbox_op.h | 2 +- .../kernels/image/random_rotation_op.h | 4 --- .../kernels/image/random_vertical_flip_op.h | 2 -- .../image/random_vertical_flip_with_bbox_op.h | 2 -- .../dataset/kernels/image/rescale_op.h | 2 +- .../kernels/image/resize_bilinear_op.cc | 1 - .../kernels/image/resize_bilinear_op.h | 4 --- .../dataset/kernels/image/resize_op.h | 2 +- .../kernels/image/resize_with_bbox_op.h | 2 +- .../dataset/kernels/image/uniform_aug_op.h | 2 +- .../ccsrc/minddata/dataset/kernels/no_op.h | 2 -- .../minddata/dataset/kernels/tensor_op.cc | 2 -- .../minddata/dataset/kernels/tensor_op.h | 7 +++-- .../dataset/text/kernels/basic_tokenizer_op.h | 2 -- .../dataset/text/kernels/bert_tokenizer_op.h | 2 -- .../dataset/text/kernels/case_fold_op.h | 2 -- .../dataset/text/kernels/jieba_tokenizer_op.h | 3 +-- .../dataset/text/kernels/normalize_utf8_op.h | 2 -- .../dataset/text/kernels/regex_replace_op.h | 2 -- .../dataset/text/kernels/regex_tokenizer_op.h | 2 -- .../kernels/sentence_piece_tokenizer_op.h | 2 +- .../dataset/text/kernels/sliding_window_op.h | 4 --- .../text/kernels/truncate_sequence_pair_op.h | 2 -- .../text/kernels/unicode_char_tokenizer_op.h | 2 -- .../kernels/unicode_script_tokenizer_op.h | 2 -- .../text/kernels/whitespace_tokenizer_op.h | 2 -- .../text/kernels/wordpiece_tokenizer_op.h | 2 -- tests/ut/cpp/dataset/batch_op_test.cc | 5 +++- tests/ut/cpp/dataset/concatenate_op_test.cc | 8 ------ 93 files changed, 95 insertions(+), 143 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/barrier_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/barrier_op.h index 261ff6da6b..cdbae0941e 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/barrier_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/barrier_op.h @@ -121,6 +121,10 @@ class BarrierOp : public PipelineOp { // @param show_all - if it should print everything void Print(std::ostream &out, bool show_all) const override; + // Op name getter + // @return Name of the current Op + std::string Name() const override { return kBarrierOp; } + // Provide stream operator for displaying it friend std::ostream &operator<<(std::ostream &out, const BarrierOp &bo) { bo.Print(out, false); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc index 844d054307..d195647f65 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.cc @@ -136,7 +136,7 @@ Status BatchOp::operator()() { void BatchOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h index 825e99a077..503415704f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/batch_op.h @@ -200,7 +200,7 @@ class BatchOp : public ParallelOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "BatchOp"; } + std::string Name() const override { return kBatchOp; } // batch the rows in src table then put it to dest table // @param const std::unique_ptr *src - table that has the rows for batching diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc index 138bb7980b..971f14c669 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.cc @@ -107,8 +107,6 @@ Status BucketBatchByLengthOp::EoeReceived(int32_t) { return Status::OK(); } -void BucketBatchByLengthOp::Print(std::ostream &out, bool show_all) const { out << "BucketBatchByLengthOp\n"; } - Status BucketBatchByLengthOp::operator()() { TaskManager::FindMe()->Post(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h index 2c9c926203..e14a5ff760 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/bucket_batch_by_length_op.h @@ -109,10 +109,7 @@ class BucketBatchByLengthOp : public PipelineOp { // @return Status - The error code returned Status EoeReceived(int32_t) override; - // 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 - void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kBucketBatchByLengthOp; } // << Stream output operator overload // @notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h index e53d5276fc..fc7c7d987f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_sentence_piece_vocab_op.h @@ -157,6 +157,8 @@ class BuildSentencePieceVocabOp : public PipelineOp { Status Reset() override { RETURN_STATUS_UNEXPECTED("Reset shouldn't be called in BuildSentencePieceVocabOp"); } + std::string Name() const override { return kBuildSentencePieceVocabOp; } + // build the input params for sentence api std::unordered_map BuildParams(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.cc index 2867533842..9b3eaab6f6 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.cc @@ -208,7 +208,7 @@ BuildVocabOp::Builder::Builder() // A print method typically used for debugging void BuildVocabOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.h index 0e8f135529..07650381f8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/build_vocab_op.h @@ -135,6 +135,7 @@ class BuildVocabOp : public ParallelOp { /// \param[out] out The output stream to write output to /// \param[in] show_all A bool to control if you want to show all info or just a summary void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kBuildVocabOp; } /// \briefStream output operator overload /// \notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_base_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_base_op.h index 775b20e312..40f3426394 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_base_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_base_op.h @@ -59,6 +59,9 @@ class CacheBase : public ParallelOp { /// \param show_all A bool to control if you want to show all info or just a summary void Print(std::ostream &out, bool show_all) const override; + /// \brief Gives a name to the class, typically used for debugging + std::string Name() const override { return kCacheBase; } + /// \brief << Stream output operator overload /// \notes This allows you to write the debug print info using stream operators /// \param out reference to the output stream being overloaded 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 37fad046e2..adec3d8283 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_lookup_op.h @@ -100,7 +100,7 @@ class CacheLookupOp : public CacheBase, public Sampler { Status GetNextSample(std::unique_ptr *out_buffer) override; void Print(std::ostream &out, bool show_all) const override; bool AllowCacheMiss() override { return true; } - std::string Name() const override { return "CacheLookupOp"; } + std::string Name() const override { return kCacheLookupOp; } /// \brief Base-class override for NodePass visitor acceptor /// \param[in] p The node to visit diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.cc index 39029918e8..6a7fa69936 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.cc @@ -30,7 +30,7 @@ namespace dataset { CacheMergeOp::~CacheMergeOp() = default; void CacheMergeOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this is summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.h index 1a818d0d4f..a4d92d1221 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_merge_op.h @@ -140,6 +140,8 @@ class CacheMergeOp : public ParallelOp { std::shared_ptr cache_client, const std::shared_ptr &sampler); ~CacheMergeOp(); void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kCacheMergeOp; } + friend std::ostream &operator<<(std::ostream &out, const CacheMergeOp &mo) { mo.Print(out, false); return out; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.h index 6639e7037c..f6af02fdba 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/cache_op.h @@ -140,7 +140,7 @@ class CacheOp : public CacheBase, public RandomAccessOp { /// \brief Base-class override for handling cases if we allow cache miss bool AllowCacheMiss() override { return false; } /// \brief Base-class override for the name of this operator - std::string Name() const override { return "CacheOp"; } + std::string Name() const override { return kCacheOp; } /// \brief A public wrapper for creating the cache through the client /// \param[in] cache_crc The crc that identifies the cache /// \see cache_pass.cc diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.cc index 7acb68350b..a01a9cc87f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.cc @@ -43,7 +43,7 @@ ConcatOp::ConcatOp(int32_t op_connector_size) : PipelineOp(op_connector_size), c // A function that prints info about the Operator void ConcatOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this is summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.h index 5a3bf8a56b..58653b5a01 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/concat_op.h @@ -77,7 +77,7 @@ class ConcatOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "ConcatOp"; } + std::string Name() const override { return kConcatOp; } // Private function for computing the assignment of the column name map. // @return - Status diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc index dd53e0527d..69c5ee0315 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc @@ -239,6 +239,8 @@ void DatasetOp::Print(std::ostream &out, bool show_all) const { if (sampler_) { sampler_->Print(out, show_all); } + } else { + out << Name() << std::endl; } } diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h index b62408618a..01eb2f93c3 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.h @@ -28,6 +28,31 @@ namespace mindspore { namespace dataset { +constexpr char kBarrierOp[] = "BarrierOp"; +constexpr char kBatchOp[] = "BatchOp"; +constexpr char kBucketBatchByLengthOp[] = "BucketBatchByLengthOp"; +constexpr char kBuildSentencePieceVocabOp[] = "BuildSentencePieceVocabOp"; +constexpr char kBuildVocabOp[] = "BuildVocabOp"; +constexpr char kCacheBase[] = "CacheBase"; +constexpr char kCacheLookupOp[] = "CacheLookupOp"; +constexpr char kCacheMergeOp[] = "CacheMergeOp"; +constexpr char kCacheOp[] = "CacheOp"; +constexpr char kConcatOp[] = "ConcatOp"; +constexpr char kDatasetOp[] = "DatasetOp"; +constexpr char kDeviceQueueOp[] = "DeviceQueueOp"; +constexpr char kEpochCtrlOp[] = "EpochCtrlOp"; +constexpr char kFilterOp[] = "FilterOp"; +constexpr char kMapOp[] = "MapOp"; +constexpr char kParallelOp[] = "ParallelOp"; +constexpr char kPipelineOp[] = "PipelineOp"; +constexpr char kProjectOp[] = "ProjectOp"; +constexpr char kRenameOp[] = "RenameOp"; +constexpr char kRepeatOp[] = "RepeatOp"; +constexpr char kShuffleOp[] = "ShuffleOp"; +constexpr char kSkipOp[] = "SkipOp"; +constexpr char kTakeOp[] = "TakeOp"; +constexpr char kZipOp[] = "ZipOp"; + // Forward declare class ExecutionTree; @@ -292,7 +317,7 @@ class DatasetOp : public std::enable_shared_from_this { /// Op name getter /// \return Name of the current Op - virtual std::string Name() const { return "DatasetOp"; } + virtual std::string Name() const = 0; /// Execution Tree getter /// \return Pointer to the ExecutionTree the current op belongs to, no ownership diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.cc index d9cda4d456..1e89a0d0f8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.cc @@ -307,7 +307,7 @@ Status DeviceQueueOp::SendDataToCPU() { void DeviceQueueOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h index e26c4c3ffc..224d36b85f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h @@ -146,7 +146,7 @@ class DeviceQueueOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "DeviceQueueOp"; } + std::string Name() const override { return kDeviceQueueOp; } private: // Name: checkExceptions(DataBuffer); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc index de0ab7452f..82885b89c0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.cc @@ -43,7 +43,7 @@ EpochCtrlOp::~EpochCtrlOp() {} // A print method typically used for debugging void EpochCtrlOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.h index ed8fcb1a34..c494208116 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/epoch_ctrl_op.h @@ -52,6 +52,7 @@ class EpochCtrlOp : public RepeatOp { // @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 void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kEpochCtrlOp; } // This function returns the buffer that is at the top of our output connector. The caller is // typically our parent node, when the parent is asking us to provide the next buffer of data. diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc index f32648a3df..39cdb45b20 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.cc @@ -91,7 +91,7 @@ Status FilterOp::ValidateInColumns(const std::vector *input_columns // A print method typically used for debugging. void FilterOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.h index 6ab1c2b599..8cc0cd55ff 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/filter_op.h @@ -129,7 +129,7 @@ class FilterOp : public ParallelOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "FilterOp"; } + std::string Name() const override { return kFilterOp; } private: // predicate_func python callable which returns a boolean value. diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.cc index e5e70dbbdf..bfd0962ae8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.cc @@ -84,7 +84,7 @@ int32_t MapOp::num_consumers() const { // A print method typically used for debugging void MapOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info ParallelOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.h index 65a72c703c..7cb5807738 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/map_op.h @@ -179,7 +179,7 @@ class MapOp : public ParallelOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "MapOp"; } + std::string Name() const override { return kMapOp; } // List of tensor ops getter/setter // @Return the vector of tensor ops by non-const reference diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.h index b865168d29..8d7ba6302a 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/parallel_op.h @@ -17,6 +17,7 @@ #define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_PARALLEL_OP_H_ #include +#include #include #include "minddata/dataset/core/constants.h" #include "minddata/dataset/engine/datasetops/dataset_op.h" @@ -54,6 +55,7 @@ class ParallelOp : public DatasetOp { // @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 void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kParallelOp; } // << Stream output operator overload // @notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/pipeline_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/pipeline_op.h index 9b2ac7d8e7..88faad8265 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/pipeline_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/pipeline_op.h @@ -17,6 +17,7 @@ #define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_DATASETOPS_PIPELINE_OP_H_ #include +#include #include #include "minddata/dataset/engine/datasetops/dataset_op.h" @@ -42,6 +43,7 @@ class PipelineOp : public DatasetOp { // @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 void Print(std::ostream &out, bool show_all) const override; + std::string Name() const override { return kPipelineOp; } // << Stream output operator overload // @notes This allows you to write the debug print info using stream operators diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc index e232a64164..9c8013497c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.cc @@ -52,7 +52,7 @@ ProjectOp::ProjectOp(const std::vector &columns_to_project) void ProjectOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h index fd6bf8b85b..864baab0fa 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/project_op.h @@ -109,7 +109,7 @@ class ProjectOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "ProjectOp"; } + std::string Name() const override { return kProjectOp; } private: std::vector columns_to_project_; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc index d12660e6f9..132c826f54 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.cc @@ -142,7 +142,7 @@ Status RenameOp::ComputeColMap() { void RenameOp::Print(std::ostream &out, // In: The output stream to print to bool show_all) const { // In: T/F if it should print everything // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.h index 960509b109..25c9e46896 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/rename_op.h @@ -118,7 +118,7 @@ class RenameOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "RenameOp"; } + std::string Name() const override { return kRenameOp; } protected: // Rename core functionality diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc index b5319a8a71..83cd8b5af8 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.cc @@ -54,7 +54,7 @@ RepeatOp::~RepeatOp() {} // A print method typically used for debugging void RepeatOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.h index a055a20477..e763e2bcca 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/repeat_op.h @@ -129,7 +129,7 @@ class RepeatOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "RepeatOp"; } + std::string Name() const override { return kRepeatOp; } // \brief Adds an operator to the repeat ops list of tracked leaf/eoe nodes // \param[in] eoe_op The input leaf/eoe operator to add to the list diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc index 0eb5f29eaf..b1acd79d7c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.cc @@ -101,7 +101,7 @@ Status ShuffleOp::SelfReset() { // A print method typically used for debugging void ShuffleOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.h index b09763907b..37ae9230c7 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/shuffle_op.h @@ -163,7 +163,7 @@ class ShuffleOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "ShuffleOp"; } + std::string Name() const override { return kShuffleOp; } private: // Private function to add a new row to the shuffle buffer. diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc index 2fe8cbeaa6..7c562a03e1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.cc @@ -59,7 +59,7 @@ SkipOp::~SkipOp() {} // A print method typically used for debugging void SkipOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.h index ed20fb3b07..657da1fe84 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/skip_op.h @@ -82,7 +82,7 @@ class SkipOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "SkipOp"; } + std::string Name() const override { return kSkipOp; } private: int32_t max_skips_; // The number of skips that the user requested diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.cc index d1f07983f7..dfd4f254e0 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.cc @@ -54,7 +54,7 @@ TakeOp::TakeOp(int32_t count, int32_t op_connector_size) // A print method typically used for debugging void TakeOp::Print(std::ostream &out, bool show_all) const { // Always show the id and name as first line regardless if this summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.h index 4d98ef3f1e..d055207520 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/take_op.h @@ -86,7 +86,7 @@ class TakeOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "TakeOp"; } + std::string Name() const override { return kTakeOp; } private: int32_t max_takes_; // The number of takes that the user requested diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc index 0df6375b59..ad513cc4af 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.cc @@ -209,7 +209,7 @@ Status ZipOp::drainPipeline() { void ZipOp::Print(std::ostream &out, // In: The output stream to print to bool show_all) const { // In: T/F if it should print everything // Always show the id and name as first line regardless if this is summary or detailed print - out << "(" << std::setw(2) << operator_id_ << ") :"; + out << "(" << std::setw(2) << operator_id_ << ") <" << Name() << ">:"; if (!show_all) { // Call the super class for displaying any common 1-liner info PipelineOp::Print(out, show_all); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.h index 3bbb48aa19..2995b49c23 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/zip_op.h @@ -112,7 +112,7 @@ class ZipOp : public PipelineOp { // Op name getter // @return Name of the current Op - std::string Name() const override { return "ZipOp"; } + std::string Name() const override { return kZipOp; } private: // Handles preprocessing of the main loop, used when starting new epoch diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/concatenate_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/concatenate_op.h index e762b548a2..cf2afb30d2 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/concatenate_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/concatenate_op.h @@ -40,7 +40,6 @@ class ConcatenateOp : public TensorOp { /// Print method to see which tensor Op this is. /// @param std::ostream &out - output stream object. - void Print(std::ostream &out) const override { out << "ConcatenateOp"; } /// Compute method allowing multiple tensors as inputs /// @param TensorRow &input - input tensor rows diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/duplicate_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/duplicate_op.h index 62824c5623..bf4aa4bda8 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/duplicate_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/duplicate_op.h @@ -32,8 +32,6 @@ class DuplicateOp : public TensorOp { ~DuplicateOp() override = default; - void Print(std::ostream &out) const override { out << "DuplicateOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; uint32_t NumOutput() override { return 2; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/fill_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/fill_op.h index f2f6d7cfd6..e2761142df 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/fill_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/fill_op.h @@ -31,7 +31,6 @@ class FillOp : public TensorOp { explicit FillOp(std::shared_ptr value) : fill_value_(value) {} ~FillOp() override = default; - void Print(std::ostream &out) const override { out << "FillOp"; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/mask_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/mask_op.h index e6ac8c3964..762cf1de40 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/mask_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/mask_op.h @@ -37,8 +37,6 @@ class MaskOp : public TensorOp { ~MaskOp() override = default; - void Print(std::ostream &out) const override { out << "MaskOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputType(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/one_hot_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/one_hot_op.h index 493f943ff8..629a7e3082 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/one_hot_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/one_hot_op.h @@ -31,8 +31,6 @@ class OneHotOp : public TensorOp { ~OneHotOp() override = default; - void Print(std::ostream &out) const override { out << "OneHotOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/pad_end_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/pad_end_op.h index 5a0639bf70..019124382a 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/pad_end_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/pad_end_op.h @@ -32,8 +32,6 @@ class PadEndOp : public TensorOp { ~PadEndOp() override = default; - void Print(std::ostream &out) const override { out << "PadEndOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/slice_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/slice_op.h index 6c77846c01..39042cf6d4 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/slice_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/slice_op.h @@ -67,8 +67,6 @@ class SliceOp : public TensorOp { ~SliceOp() override = default; - void Print(std::ostream &out) const override { out << "SliceOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kSliceOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/to_float16_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/to_float16_op.h index 91f660ca9c..6d0b2f6f30 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/to_float16_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/to_float16_op.h @@ -39,8 +39,6 @@ class ToFloat16Op : public TensorOp { // @return Status - The error code return Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; - void Print(std::ostream &out) const override { out << "ToFloat16Op"; } - Status OutputType(const std::vector &inputs, std::vector &outputs) override; std::string Name() const override { return kToFloat16Op; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/type_cast_op.h b/mindspore/ccsrc/minddata/dataset/kernels/data/type_cast_op.h index 744c99bd0d..64a84713da 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/type_cast_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/type_cast_op.h @@ -39,7 +39,6 @@ class TypeCastOp : public TensorOp { Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; - void Print(std::ostream &out) const override { out << "TypeCastOp"; } Status OutputType(const std::vector &inputs, std::vector &outputs) override; std::string Name() const override { return kTypeCastOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/auto_contrast_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/auto_contrast_op.h index 0bbed64173..6d8c847b67 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/auto_contrast_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/auto_contrast_op.h @@ -45,8 +45,6 @@ class AutoContrastOp : public TensorOp { return out; } - void Print(std::ostream &out) const override { out << Name(); } - std::string Name() const override { return kAutoContrastOp; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/bounding_box_augment_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/bounding_box_augment_op.h index f2eee20f3e..c992c9196e 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/bounding_box_augment_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/bounding_box_augment_op.h @@ -47,8 +47,6 @@ class BoundingBoxAugmentOp : public TensorOp { return out; } - void Print(std::ostream &out) const override { out << "BoundingBoxAugmentOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kBoundingBoxAugmentOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.h index 62a0437e5c..b5bfe5a014 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/decode_op.h @@ -37,7 +37,6 @@ class DecodeOp : public TensorOp { Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; - void Print(std::ostream &out) const override { out << "DecodeOp"; } Status OutputShape(const std::vector &inputs, std::vector &outputs) override; Status OutputType(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/equalize_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/equalize_op.h index 9fd030f585..d7bc46b480 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/equalize_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/equalize_op.h @@ -32,9 +32,6 @@ class EqualizeOp : public TensorOp { EqualizeOp() {} ~EqualizeOp() = default; - // Description: A function that prints info about the node - void Print(std::ostream &out) const override { out << Name(); } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kEqualizeOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/hwc_to_chw_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/hwc_to_chw_op.h index c071b9c476..c2eb2e8759 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/hwc_to_chw_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/hwc_to_chw_op.h @@ -28,8 +28,6 @@ namespace mindspore { namespace dataset { class HwcToChwOp : public TensorOp { public: - void Print(std::ostream &out) const override { out << "HwcToChw"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/invert_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/invert_op.h index 7db01f7d3f..3a9ee464c9 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/invert_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/invert_op.h @@ -31,9 +31,6 @@ class InvertOp : public TensorOp { InvertOp() {} ~InvertOp() = default; - // Description: A function that prints info about the node - void Print(std::ostream &out) const override { out << Name(); } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kInvertOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/pad_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/pad_op.h index a89f8be738..7f2e313c38 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/pad_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/pad_op.h @@ -49,8 +49,6 @@ class PadOp : public TensorOp { ~PadOp() override = default; - void Print(std::ostream &out) const override { out << "PadOp: "; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_adjust_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_adjust_op.h index 98201c4ace..5555963ac5 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_adjust_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_adjust_op.h @@ -47,10 +47,6 @@ class RandomColorAdjustOp : public TensorOp { ~RandomColorAdjustOp() override = default; - // Print function for RandomJitter. - // @param out output stream to print to. - void Print(std::ostream &out) const override { out << "RandomColorAdjustOp: "; } - // Overrides the base class compute function. // Calls multiple transform functions in ImageUtils, this function takes an input tensor. // and transforms its data using openCV, the output memory is manipulated to contain the result. diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_decode_resize_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_decode_resize_op.h index bb280cc199..161bdaf42f 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_decode_resize_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_decode_resize_op.h @@ -40,8 +40,7 @@ class RandomCropDecodeResizeOp : public RandomCropAndResizeOp { ~RandomCropDecodeResizeOp() override = default; void Print(std::ostream &out) const override { - out << "RandomCropDecodeResize: " << RandomCropAndResizeOp::target_height_ << " " - << RandomCropAndResizeOp::target_width_; + out << Name() << ": " << RandomCropAndResizeOp::target_height_ << " " << RandomCropAndResizeOp::target_width_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_op.h index 8e437580d4..3dfb3f713d 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_op.h @@ -52,7 +52,7 @@ class RandomCropOp : public TensorOp { ~RandomCropOp() override = default; - void Print(std::ostream &out) const override { out << "RandomCropOp: " << crop_height_ << " " << crop_width_; } + void Print(std::ostream &out) const override { out << Name() << ": " << crop_height_ << " " << crop_width_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_with_bbox_op.h index 089fe76f0f..479f087954 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_crop_with_bbox_op.h @@ -38,7 +38,7 @@ class RandomCropWithBBoxOp : public RandomCropOp { ~RandomCropWithBBoxOp() override = default; void Print(std::ostream &out) const override { - out << "RandomCropWithBBoxOp: " << RandomCropOp::crop_height_ << " " << RandomCropOp::crop_width_; + out << Name() << ": " << RandomCropOp::crop_height_ << " " << RandomCropOp::crop_width_; } Status Compute(const TensorRow &input, TensorRow *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_op.h index c5610cfc50..53c11df1a6 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_op.h @@ -44,8 +44,6 @@ class RandomHorizontalFlipOp : public TensorOp { return out; } - void Print(std::ostream &out) const override { out << "RandomHorizontalFlipOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kRandomHorizontalFlipOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h index 0cb8815c2e..f8e1e847f6 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_horizontal_flip_with_bbox_op.h @@ -45,8 +45,6 @@ class RandomHorizontalFlipWithBBoxOp : public TensorOp { return out; } - void Print(std::ostream &out) const override { out << "RandomHorizontalFlipWithBBoxOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kRandomHorizontalFlipWithBBoxOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_op.h index 9b4a1cf126..77dee5b4d9 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_op.h @@ -40,9 +40,7 @@ class RandomResizeOp : public ResizeOp { ~RandomResizeOp() = default; // Description: A function that prints info about the node - void Print(std::ostream &out) const override { - out << "RandomResizeOp: " << ResizeOp::size1_ << " " << ResizeOp::size2_; - } + void Print(std::ostream &out) const override { out << Name() << ": " << ResizeOp::size1_ << " " << ResizeOp::size2_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_with_bbox_op.h index d5e70d08e2..dbca032520 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_resize_with_bbox_op.h @@ -42,7 +42,7 @@ class RandomResizeWithBBoxOp : public ResizeWithBBoxOp { // Description: A function that prints info about the node void Print(std::ostream &out) const override { - out << "RandomResizeWithBBoxOp: " << ResizeWithBBoxOp::size1_ << " " << ResizeWithBBoxOp::size2_; + out << Name() << ": " << ResizeWithBBoxOp::size1_ << " " << ResizeWithBBoxOp::size2_; } Status Compute(const TensorRow &input, TensorRow *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_rotation_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_rotation_op.h index 17777a60d8..bdd5cda97a 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_rotation_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_rotation_op.h @@ -58,10 +58,6 @@ class RandomRotationOp : public TensorOp { ~RandomRotationOp() override = default; - // Print function for RandomRotation - // @param out output stream to print to - void Print(std::ostream &out) const override { out << "RandomRotationOp: "; } - // Overrides the base class compute function // Calls the rotate function in ImageUtils, this function takes an input tensor // and transforms its data using openCV, the output memory is manipulated to contain the result diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_op.h index 6b328d5882..1724d7a57d 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_op.h @@ -38,8 +38,6 @@ class RandomVerticalFlipOp : public TensorOp { ~RandomVerticalFlipOp() override = default; - void Print(std::ostream &out) const override { out << "RandomVerticalFlipOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kRandomVerticalFlipOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h index 68cbf81c8e..d3e7871aec 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_vertical_flip_with_bbox_op.h @@ -39,8 +39,6 @@ class RandomVerticalFlipWithBBoxOp : public TensorOp { ~RandomVerticalFlipWithBBoxOp() override = default; - void Print(std::ostream &out) const override { out << "RandomVerticalFlipWithBBoxOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kRandomVerticalFlipWithBBoxOp; } diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/rescale_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/rescale_op.h index 8f8943ad63..1a6f597ad5 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/rescale_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/rescale_op.h @@ -33,7 +33,7 @@ class RescaleOp : public TensorOp { ~RescaleOp() override = default; void Print(std::ostream &out) const override { - out << "RescaleOp: shift: " << shift_ << ", Rescale: " << rescale_ << std::endl; + out << Name() << ": shift: " << shift_ << ", Rescale: " << rescale_ << std::endl; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.cc index 48a8fbbc53..db10f5f10c 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.cc @@ -22,6 +22,5 @@ namespace mindspore { namespace dataset { const int32_t ResizeBilinearOp::kDefWidth = 0; -void ResizeBilinearOp::Print(std::ostream &out) const { out << "ResizeBilinearOp: "; } } // namespace dataset } // namespace mindspore diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.h index 99222622b0..ab5ecd292a 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_bilinear_op.h @@ -48,10 +48,6 @@ class ResizeBilinearOp : public ResizeOp { // Description: Destructor ~ResizeBilinearOp() = default; - // Name: Print() - // Description: A function that prints info about the node - void Print(std::ostream &out) const override; - std::string Name() const override { return kResizeBilinearOp; } }; } // namespace dataset diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_op.h index 9693e95106..149cab6e85 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_op.h @@ -50,7 +50,7 @@ class ResizeOp : public TensorOp { ~ResizeOp() override = default; - void Print(std::ostream &out) const override { out << "ResizeOp: " << size1_ << " " << size2_; } + void Print(std::ostream &out) const override { out << Name() << ": " << size1_ << " " << size2_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; Status OutputShape(const std::vector &inputs, std::vector &outputs) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_with_bbox_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_with_bbox_op.h index c975d956a5..18781da1a5 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/resize_with_bbox_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/resize_with_bbox_op.h @@ -34,7 +34,7 @@ class ResizeWithBBoxOp : public ResizeOp { ~ResizeWithBBoxOp() override = default; - void Print(std::ostream &out) const override { out << "ResizeWithBBoxOp: " << size1_ << " " << size2_; } + void Print(std::ostream &out) const override { out << Name() << ": " << size1_ << " " << size2_; } Status Compute(const TensorRow &input, TensorRow *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/uniform_aug_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/uniform_aug_op.h index af5158bc7f..ec7080d1de 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/uniform_aug_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/uniform_aug_op.h @@ -40,7 +40,7 @@ class UniformAugOp : public TensorOp { // Destructor ~UniformAugOp() override = default; - void Print(std::ostream &out) const override { out << "UniformAugOp:: number of ops " << num_ops_; } + void Print(std::ostream &out) const override { out << Name() << ":: number of ops " << num_ops_; } // Overrides the base class compute function // @return Status - The error code return diff --git a/mindspore/ccsrc/minddata/dataset/kernels/no_op.h b/mindspore/ccsrc/minddata/dataset/kernels/no_op.h index d6058d63d6..18761cde25 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/no_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/no_op.h @@ -31,8 +31,6 @@ class NoOp : public TensorOp { return Status::OK(); } - void Print(std::ostream &out) const override { out << "NoOp"; }; - std::string Name() const override { return kNoOp; } }; } // namespace dataset diff --git a/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.cc b/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.cc index b625e3b532..e394284679 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.cc @@ -48,8 +48,6 @@ Status TensorOp::Compute(const TensorRow &input, TensorRow *output) { "Is this TensorOp oneToOne? If no, please implement this Compute() in the derived class."); } -void TensorOp::Print(std::ostream &out) const { out << "TensorOp" << std::endl; } - Status TensorOp::OutputShape(const std::vector &inputs, std::vector &outputs) { if (inputs.size() != NumInput()) return Status(StatusCode::kUnexpectedError, diff --git a/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.h b/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.h index 1db0e7ab41..9c16f541a9 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/tensor_op.h @@ -86,6 +86,9 @@ namespace mindspore { namespace dataset { +// base class +constexpr char kTensorOp[] = "TensorOp"; + // image constexpr char kAutoContrastOp[] = "AutoContrastOp"; constexpr char kBoundingBoxAugmentOp[] = "BoundingBoxAugmentOp"; @@ -140,7 +143,7 @@ constexpr char kRandomSelectSubpolicyOp[] = "RandomSelectSubpolicyOp"; constexpr char kSentencepieceTokenizerOp[] = "SentencepieceTokenizerOp"; // data -constexpr char kConcatenateOp[] = "kConcatenateOp"; +constexpr char kConcatenateOp[] = "ConcatenateOp"; constexpr char kDuplicateOp[] = "DuplicateOp"; constexpr char kFillOp[] = "FillOp"; constexpr char kMaskOp[] = "MaskOp"; @@ -163,7 +166,7 @@ class TensorOp { // A function that prints info about the tensor operation // @param out - virtual void Print(std::ostream &out) const; + virtual void Print(std::ostream &out) const { out << Name() << std::endl; } // Provide stream operator for displaying it // @param output stream diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/basic_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/basic_tokenizer_op.h index b8234a5af9..39b4ec521d 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/basic_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/basic_tokenizer_op.h @@ -45,8 +45,6 @@ class BasicTokenizerOp : public TensorOp { ~BasicTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "BasicTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; protected: diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/bert_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/bert_tokenizer_op.h index 429e1af02e..5af84da5d9 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/bert_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/bert_tokenizer_op.h @@ -42,8 +42,6 @@ class BertTokenizerOp : public TensorOp { ~BertTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "BertTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kBertTokenizerOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/case_fold_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/case_fold_op.h index 417f617777..9b2f4bef1d 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/case_fold_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/case_fold_op.h @@ -31,8 +31,6 @@ class CaseFoldOp : public TensorOp { ~CaseFoldOp() override = default; - void Print(std::ostream &out) const override { out << "CaseFoldOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kCaseFoldOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/jieba_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/jieba_tokenizer_op.h index 2cbd56bb40..a319ccd015 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/jieba_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/jieba_tokenizer_op.h @@ -46,8 +46,7 @@ class JiebaTokenizerOp : public TensorOp { ~JiebaTokenizerOp() override = default; void Print(std::ostream &out) const override { - out << "JiebaTokenizerOp: " << jieba_mode_ << "hmm_model_path_ " << hmm_model_path_ << "mp_dict_path_" - << mp_dict_path_; + out << Name() << ": " << jieba_mode_ << "hmm_model_path_ " << hmm_model_path_ << "mp_dict_path_" << mp_dict_path_; } Status Compute(const TensorRow &input, TensorRow *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/normalize_utf8_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/normalize_utf8_op.h index 69ceee4b35..66b630adb1 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/normalize_utf8_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/normalize_utf8_op.h @@ -39,8 +39,6 @@ class NormalizeUTF8Op : public TensorOp { ~NormalizeUTF8Op() override = default; - void Print(std::ostream &out) const override { out << "NormalizeUTF8Op"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kNormalizeUTF8Op; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/regex_replace_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/regex_replace_op.h index 601fb8a402..ae9723da09 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/regex_replace_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/regex_replace_op.h @@ -38,8 +38,6 @@ class RegexReplaceOp : public TensorOp { ~RegexReplaceOp() override = default; - void Print(std::ostream &out) const override { out << "RegexReplaceOp"; } - Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; std::string Name() const override { return kRegexReplaceOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/regex_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/regex_tokenizer_op.h index 1ce7cef3db..eabed89480 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/regex_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/regex_tokenizer_op.h @@ -43,8 +43,6 @@ class RegexTokenizerOp : public TensorOp { ~RegexTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "RegexTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; protected: diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.h index 130842cb77..8106726e61 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.h @@ -45,7 +45,7 @@ class SentencePieceTokenizerOp : public TensorOp { Status GetModelRealPath(const std::string &model_path, const std::string &filename); void Print(std::ostream &out) const override { - out << "SentencePieceTokenizerOp out_type = " << out_type_ << " load_type = " << load_type_; + out << Name() << " out_type = " << out_type_ << " load_type = " << load_type_; } Status Compute(const std::shared_ptr &input, std::shared_ptr *output) override; diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/sliding_window_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/sliding_window_op.h index d944d4eb5e..5725e94a7b 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/sliding_window_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/sliding_window_op.h @@ -52,10 +52,6 @@ class SlidingWindowOp : public TensorOp { /// \return Status return code Status OutputShape(const std::vector &inputs, std::vector &outputs) override; - /// \brief Print args for debugging. - /// \param[in] out - std::ostream &out. - void Print(std::ostream &out) const override { out << "SliceWindowOp"; } - /// \brief Print name of op. std::string Name() const override { return kSlidingWindowOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/truncate_sequence_pair_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/truncate_sequence_pair_op.h index e8a9d86315..dbfcd6b61a 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/truncate_sequence_pair_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/truncate_sequence_pair_op.h @@ -36,8 +36,6 @@ class TruncateSequencePairOp : public TensorOp { ~TruncateSequencePairOp() override = default; - void Print(std::ostream &out) const override { out << "TruncateSequencePairOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kTruncateSequencePairOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_char_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_char_tokenizer_op.h index acfec8e5c8..8a0bc01391 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_char_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_char_tokenizer_op.h @@ -33,8 +33,6 @@ class UnicodeCharTokenizerOp : public TensorOp { ~UnicodeCharTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "UnicodeCharTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kUnicodeCharTokenizerOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_script_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_script_tokenizer_op.h index cb093c69fb..2fe5629682 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_script_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/unicode_script_tokenizer_op.h @@ -36,8 +36,6 @@ class UnicodeScriptTokenizerOp : public TensorOp { ~UnicodeScriptTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "UnicodeScriptTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kUnicodeScriptTokenizerOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/whitespace_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/whitespace_tokenizer_op.h index 652257d33b..adbc6f6244 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/whitespace_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/whitespace_tokenizer_op.h @@ -33,8 +33,6 @@ class WhitespaceTokenizerOp : public TensorOp { ~WhitespaceTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "WhitespaceTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; std::string Name() const override { return kWhitespaceTokenizerOp; } diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/wordpiece_tokenizer_op.h b/mindspore/ccsrc/minddata/dataset/text/kernels/wordpiece_tokenizer_op.h index f7c57842ce..d636ab8e0f 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/wordpiece_tokenizer_op.h +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/wordpiece_tokenizer_op.h @@ -44,8 +44,6 @@ class WordpieceTokenizerOp : public TensorOp { ~WordpieceTokenizerOp() override = default; - void Print(std::ostream &out) const override { out << "WordpieceTokenizerOp"; } - Status Compute(const TensorRow &input, TensorRow *output) override; protected: diff --git a/tests/ut/cpp/dataset/batch_op_test.cc b/tests/ut/cpp/dataset/batch_op_test.cc index 3e1f3c0b32..11d3f3e05f 100644 --- a/tests/ut/cpp/dataset/batch_op_test.cc +++ b/tests/ut/cpp/dataset/batch_op_test.cc @@ -78,7 +78,10 @@ std::shared_ptr Build(std::vector &op = Batch(12); + EXPECT_EQ(op->Name(), "BatchOp"); + + auto tree = Build({TFReader(schema_file), op}); tree->Prepare(); Status rc = tree->Launch(); if (rc.IsError()) { diff --git a/tests/ut/cpp/dataset/concatenate_op_test.cc b/tests/ut/cpp/dataset/concatenate_op_test.cc index dc2fc69266..fa8a20fffd 100644 --- a/tests/ut/cpp/dataset/concatenate_op_test.cc +++ b/tests/ut/cpp/dataset/concatenate_op_test.cc @@ -54,13 +54,5 @@ TEST_F(MindDataTestConcatenateOp, TestOp) { ASSERT_TRUE(output->type() == expected->type()); MS_LOG(DEBUG) << *output << std::endl; MS_LOG(DEBUG) << *expected << std::endl; - ASSERT_TRUE(*output == *expected); - - // std::vector inputs = {TensorShape({3})}; - // std::vector outputs = {}; - // s = op->OutputShape(inputs, outputs); - // EXPECT_TRUE(s.IsOk()); - // ASSERT_TRUE(outputs[0] == TensorShape{6}); - // MS_LOG(INFO) << "MindDataTestConcatenateOp-TestOp end."; }